ccdemos/image.c
branchpyrit
changeset 27 e9bb83c2b8b9
parent 15 a0a3e334744f
child 60 a23b5089b9c3
equal deleted inserted replaced
26:9073320e9f4c 27:e9bb83c2b8b9
    79 		return (0);
    79 		return (0);
    80 	}
    80 	}
    81 
    81 
    82 	if (setjmp(png_jmpbuf(png))) {
    82 	if (setjmp(png_jmpbuf(png))) {
    83 		fclose(f);
    83 		fclose(f);
       
    84 		png_destroy_info_struct(png, &pnginfo);
    84 		png_destroy_write_struct(&png, &pnginfo);
    85 		png_destroy_write_struct(&png, &pnginfo);
    85 		return (0);
    86 		return (0);
    86 	}
    87 	}
    87 
    88 
    88 	/* predat knihovne PNG ukazatel na soubor */
    89 	/* predat knihovne PNG ukazatel na soubor */
   104 	for (y = 0; y < img->height; y++, data += img->width * img->pixel_size)
   105 	for (y = 0; y < img->height; y++, data += img->width * img->pixel_size)
   105 		png_write_row(png, (png_byte *) data);
   106 		png_write_row(png, (png_byte *) data);
   106 
   107 
   107 	/* ukoncit soubor a uvolnit pomocne struktury */
   108 	/* ukoncit soubor a uvolnit pomocne struktury */
   108 	png_write_end(png, pnginfo);
   109 	png_write_end(png, pnginfo);
       
   110 	png_destroy_info_struct(png, &pnginfo);
   109 	png_destroy_write_struct(&png, 0);
   111 	png_destroy_write_struct(&png, 0);
   110 
   112 
   111 	fclose(f);
   113 	fclose(f);
   112 
   114 
   113 	return (1);
   115 	return (1);