equal
deleted
inserted
replaced
41 { |
41 { |
42 *img = (struct image *) malloc(sizeof(struct image)); |
42 *img = (struct image *) malloc(sizeof(struct image)); |
43 (*img)->pixel_size = pixelsize; |
43 (*img)->pixel_size = pixelsize; |
44 (*img)->width = width; |
44 (*img)->width = width; |
45 (*img)->height = height; |
45 (*img)->height = height; |
46 (*img)->data = (char *) malloc(width * height * pixelsize); |
46 (*img)->data = (unsigned char *) malloc(width * height * pixelsize); |
47 return(0); |
47 return(0); |
48 } |
48 } |
49 |
49 |
50 int destroy_image(struct image **img) |
50 void destroy_image(struct image **img) |
51 { |
51 { |
52 free((*img)->data); |
52 free((*img)->data); |
53 free(*img); |
53 free(*img); |
54 *img = NULL; |
54 *img = NULL; |
55 } |
55 } |
59 { |
59 { |
60 int y; /* pomocna promenna pro pruchod radku obrazu */ |
60 int y; /* pomocna promenna pro pruchod radku obrazu */ |
61 FILE *f; |
61 FILE *f; |
62 png_structp png; /* PNG data */ |
62 png_structp png; /* PNG data */ |
63 png_infop pnginfo; /* PNG info */ |
63 png_infop pnginfo; /* PNG info */ |
64 char *data; |
64 unsigned char *data; |
65 |
65 |
66 if ((f = fopen(fname, "wb")) == NULL) |
66 if ((f = fopen(fname, "wb")) == NULL) |
67 return (0); |
67 return (0); |
68 |
68 |
69 png = png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); |
69 png = png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); |