]>
Commit | Line | Data |
---|---|---|
1f77ed93 JB |
1 | --- texlive-20080816-source/texk/web2c/luatexdir/image/image.h.orig 2008-04-28 10:45:24.000000000 +0200 |
2 | +++ texlive-20080816-source/texk/web2c/luatexdir/image/image.h 2016-07-23 18:18:25.545919882 +0200 | |
3 | @@ -22,7 +22,7 @@ | |
4 | #ifndef IMAGE_H | |
5 | # define IMAGE_H | |
6 | ||
7 | -# include <../libpng/png.h> | |
8 | +# include <png.h> | |
9 | ||
10 | # define JPG_UINT16 unsigned int | |
11 | # define JPG_UINT32 unsigned long | |
12 | --- texlive-20080816-source/texk/web2c/luatexdir/image/writepng.c.orig 2008-04-28 10:45:24.000000000 +0200 | |
13 | +++ texlive-20080816-source/texk/web2c/luatexdir/image/writepng.c 2016-07-24 08:43:25.776117469 +0200 | |
14 | @@ -59,7 +59,7 @@ | |
15 | if ((info_p = png_create_info_struct(png_p)) == NULL) | |
16 | pdftex_fail("libpng: png_create_info_struct() failed"); | |
17 | img_png_info_ptr(idict) = info_p; | |
18 | - if (setjmp(png_p->jmpbuf)) | |
19 | + if (png_jmpbuf(png_p)) | |
20 | pdftex_fail("libpng: internal error"); | |
21 | png_init_io(png_p, img_file(idict)); | |
22 | png_read_info(png_p, info_p); | |
23 | @@ -68,12 +68,12 @@ | |
24 | png_set_tRNS_to_alpha(png_p); | |
25 | } | |
26 | /* alpha channel support */ | |
27 | - if (fixed_pdf_minor_version < 4 && png_p->color_type | PNG_COLOR_MASK_ALPHA) | |
28 | + if (fixed_pdf_minor_version < 4 && png_get_color_type(png_p, info_p) & PNG_COLOR_MASK_ALPHA) | |
29 | png_set_strip_alpha(png_p); | |
30 | /* 16bit depth support */ | |
31 | if (fixed_pdf_minor_version < 5) | |
32 | fixed_image_hicolor = 0; | |
33 | - if (info_p->bit_depth == 16 && !fixed_image_hicolor) | |
34 | + if (png_get_bit_depth(png_p, info_p) == 16 && !fixed_image_hicolor) | |
35 | png_set_strip_16(png_p); | |
36 | /* gamma support */ | |
37 | if (fixed_image_apply_gamma) { | |
38 | @@ -86,15 +86,15 @@ | |
39 | /* reset structure */ | |
40 | png_read_update_info(png_p, info_p); | |
41 | /* resolution support */ | |
42 | - img_xsize(idict) = info_p->width; | |
43 | - img_ysize(idict) = info_p->height; | |
44 | - if (info_p->valid & PNG_INFO_pHYs) { | |
45 | + img_xsize(idict) = png_get_image_width(png_p, info_p); | |
46 | + img_ysize(idict) = png_get_image_height(png_p, info_p); | |
47 | + if (png_get_valid(png_p, info_p, PNG_INFO_pHYs)) { | |
48 | img_xres(idict) = | |
49 | round(0.0254 * png_get_x_pixels_per_meter(png_p, info_p)); | |
50 | img_yres(idict) = | |
51 | round(0.0254 * png_get_y_pixels_per_meter(png_p, info_p)); | |
52 | } | |
53 | - switch (info_p->color_type) { | |
54 | + switch (png_get_color_type(png_p, info_p)) { | |
55 | case PNG_COLOR_TYPE_PALETTE: | |
56 | img_color(idict) = IMAGE_COLOR_C | IMAGE_COLOR_I; | |
57 | break; | |
58 | @@ -107,9 +107,9 @@ | |
59 | img_color(idict) = IMAGE_COLOR_C; | |
60 | break; | |
61 | default: | |
62 | - pdftex_fail("unsupported type of color_type <%i>", info_p->color_type); | |
63 | + pdftex_fail("unsupported type of color_type <%i>", png_get_color_type(png_p, info_p)); | |
64 | } | |
65 | - img_colordepth(idict) = info_p->bit_depth; | |
66 | + img_colordepth(idict) = png_get_bit_depth(png_p, info_p); | |
67 | if (readtype == IMG_CLOSEINBETWEEN) | |
68 | close_and_cleanup_png(idict); | |
69 | } | |
70 | @@ -134,10 +134,10 @@ | |
71 | #define write_simple_pixel(r) pdf_buf[pdf_ptr++] = *r++ | |
72 | ||
73 | #define write_noninterlaced(outmac) \ | |
74 | - for (i = 0; (unsigned) i < (int)info_p->height; i++) { \ | |
75 | + for (i = 0; (unsigned) i < (int)height; i++) { \ | |
76 | png_read_row(png_p, row, NULL); \ | |
77 | r = row; \ | |
78 | - k = info_p->rowbytes; \ | |
79 | + k = rowbytes; \ | |
80 | while(k > 0) { \ | |
81 | l = (k > pdf_buf_size)? pdf_buf_size : k; \ | |
82 | pdfroom(l); \ | |
83 | @@ -149,9 +149,9 @@ | |
84 | } | |
85 | ||
86 | #define write_interlaced(outmac) \ | |
87 | - for (i = 0; (unsigned) i < (int)info_p->height; i++) { \ | |
88 | + for (i = 0; (unsigned) i < (int)height; i++) { \ | |
89 | row = rows[i]; \ | |
90 | - k = info_p->rowbytes; \ | |
91 | + k = rowbytes; \ | |
92 | while(k > 0) { \ | |
93 | l = (k > pdf_buf_size)? pdf_buf_size : k;\ | |
94 | pdfroom(l); \ | |
95 | @@ -173,36 +173,46 @@ | |
96 | if (img_colorspace(idict) != 0) { | |
97 | pdf_printf("%i 0 R\n", (int) img_colorspace(idict)); | |
98 | } else { | |
99 | + png_colorp palette; | |
100 | + int num_palette; | |
101 | pdf_create_obj(0, 0); | |
102 | palette_objnum = obj_ptr; | |
103 | + png_get_PLTE(png_p, info_p, &palette, &num_palette); | |
104 | pdf_printf("[/Indexed /DeviceRGB %i %i 0 R]\n", | |
105 | - (int) (info_p->num_palette - 1), (int) palette_objnum); | |
106 | + (int) (num_palette - 1), (int) palette_objnum); | |
107 | } | |
108 | pdf_begin_stream(); | |
109 | - if (info_p->interlace_type == PNG_INTERLACE_NONE) { | |
110 | - row = xtalloc(info_p->rowbytes, png_byte); | |
111 | + if (png_get_interlace_type(png_p, info_p) == PNG_INTERLACE_NONE) { | |
112 | + png_uint_32 height = png_get_image_height(png_p, info_p); | |
113 | + png_size_t rowbytes = png_get_rowbytes(png_p, info_p); | |
114 | + row = xtalloc(rowbytes, png_byte); | |
115 | write_noninterlaced(write_simple_pixel(r)); | |
116 | xfree(row); | |
117 | } else { | |
118 | - if (info_p->height * info_p->rowbytes >= 10240000L) | |
119 | + png_uint_32 height = png_get_image_height(png_p, info_p); | |
120 | + png_size_t rowbytes = png_get_rowbytes(png_p, info_p); | |
121 | + if (height * rowbytes >= 10240000L) | |
122 | pdftex_warn | |
123 | ("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)"); | |
124 | - rows = xtalloc(info_p->height, png_bytep); | |
125 | - for (i = 0; (unsigned) i < info_p->height; i++) | |
126 | - rows[i] = xtalloc(info_p->rowbytes, png_byte); | |
127 | + rows = xtalloc(height, png_bytep); | |
128 | + for (i = 0; (unsigned) i < height; i++) | |
129 | + rows[i] = xtalloc(rowbytes, png_byte); | |
130 | png_read_image(png_p, rows); | |
131 | write_interlaced(write_simple_pixel(row)); | |
132 | xfree(rows); | |
133 | } | |
134 | pdf_end_stream(); | |
135 | if (palette_objnum > 0) { | |
136 | + png_colorp palette; | |
137 | + int num_palette; | |
138 | + png_get_PLTE(png_p, info_p, &palette, &num_palette); | |
139 | pdf_begin_dict(palette_objnum, 0); | |
140 | pdf_begin_stream(); | |
141 | - for (i = 0; (unsigned) i < info_p->num_palette; i++) { | |
142 | + for (i = 0; (unsigned) i < num_palette; i++) { | |
143 | pdfroom(3); | |
144 | - pdf_buf[pdf_ptr++] = info_p->palette[i].red; | |
145 | - pdf_buf[pdf_ptr++] = info_p->palette[i].green; | |
146 | - pdf_buf[pdf_ptr++] = info_p->palette[i].blue; | |
147 | + pdf_buf[pdf_ptr++] = palette[i].red; | |
148 | + pdf_buf[pdf_ptr++] = palette[i].green; | |
149 | + pdf_buf[pdf_ptr++] = palette[i].blue; | |
150 | } | |
151 | pdf_end_stream(); | |
152 | } | |
153 | @@ -220,17 +230,21 @@ | |
154 | pdf_puts("/DeviceGray\n"); | |
155 | } | |
156 | pdf_begin_stream(); | |
157 | - if (info_p->interlace_type == PNG_INTERLACE_NONE) { | |
158 | - row = xtalloc(info_p->rowbytes, png_byte); | |
159 | + if (png_get_interlace_type(png_p, info_p) == PNG_INTERLACE_NONE) { | |
160 | + png_uint_32 height = png_get_image_height(png_p, info_p); | |
161 | + png_size_t rowbytes = png_get_rowbytes(png_p, info_p); | |
162 | + row = xtalloc(rowbytes, png_byte); | |
163 | write_noninterlaced(write_simple_pixel(r)); | |
164 | xfree(row); | |
165 | } else { | |
166 | - if (info_p->height * info_p->rowbytes >= 10240000L) | |
167 | + png_uint_32 height = png_get_image_height(png_p, info_p); | |
168 | + png_size_t rowbytes = png_get_rowbytes(png_p, info_p); | |
169 | + if (height * rowbytes >= 10240000L) | |
170 | pdftex_warn | |
171 | ("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)"); | |
172 | - rows = xtalloc(info_p->height, png_bytep); | |
173 | - for (i = 0; (unsigned) i < info_p->height; i++) | |
174 | - rows[i] = xtalloc(info_p->rowbytes, png_byte); | |
175 | + rows = xtalloc(height, png_bytep); | |
176 | + for (i = 0; (unsigned) i < height; i++) | |
177 | + rows[i] = xtalloc(rowbytes, png_byte); | |
178 | png_read_image(png_p, rows); | |
179 | write_interlaced(write_simple_pixel(row)); | |
180 | xfree(rows); | |
181 | @@ -257,26 +271,30 @@ | |
182 | pdf_create_obj(0, 0); | |
183 | smask_objnum = obj_ptr; | |
184 | pdf_printf("/SMask %i 0 R\n", (int) smask_objnum); | |
185 | - smask_size = (info_p->rowbytes / 2) * info_p->height; | |
186 | + smask_size = (png_get_rowbytes(png_p, info_p) / 2) * png_get_image_height(png_p, info_p); | |
187 | smask = xtalloc(smask_size, png_byte); | |
188 | pdf_begin_stream(); | |
189 | - if (info_p->interlace_type == PNG_INTERLACE_NONE) { | |
190 | - row = xtalloc(info_p->rowbytes, png_byte); | |
191 | - if ((info_p->bit_depth == 16) && fixed_image_hicolor) { | |
192 | + if (png_get_interlace_type(png_p, info_p) == PNG_INTERLACE_NONE) { | |
193 | + png_uint_32 height = png_get_image_height(png_p, info_p); | |
194 | + png_size_t rowbytes = png_get_rowbytes(png_p, info_p); | |
195 | + row = xtalloc(rowbytes, png_byte); | |
196 | + if ((png_get_bit_depth(png_p, info_p) == 16) && fixed_image_hicolor) { | |
197 | write_noninterlaced(write_gray_pixel_16(r)); | |
198 | } else { | |
199 | write_noninterlaced(write_gray_pixel_8(r)); | |
200 | } | |
201 | xfree(row); | |
202 | } else { | |
203 | - if (info_p->height * info_p->rowbytes >= 10240000L) | |
204 | + png_uint_32 height = png_get_image_height(png_p, info_p); | |
205 | + png_size_t rowbytes = png_get_rowbytes(png_p, info_p); | |
206 | + if (height * rowbytes >= 10240000L) | |
207 | pdftex_warn | |
208 | ("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)"); | |
209 | - rows = xtalloc(info_p->height, png_bytep); | |
210 | - for (i = 0; (unsigned) i < info_p->height; i++) | |
211 | - rows[i] = xtalloc(info_p->rowbytes, png_byte); | |
212 | + rows = xtalloc(height, png_bytep); | |
213 | + for (i = 0; (unsigned) i < height; i++) | |
214 | + rows[i] = xtalloc(rowbytes, png_byte); | |
215 | png_read_image(png_p, rows); | |
216 | - if ((info_p->bit_depth == 16) && fixed_image_hicolor) { | |
217 | + if ((png_get_bit_depth(png_p, info_p) == 16) && fixed_image_hicolor) { | |
218 | write_interlaced(write_gray_pixel_16(row)); | |
219 | } else { | |
220 | write_interlaced(write_gray_pixel_8(row)); | |
221 | @@ -286,14 +304,14 @@ | |
222 | pdf_end_stream(); | |
223 | pdf_flush(); | |
224 | /* now write the Smask object */ | |
225 | - bitdepth = (int) info_p->bit_depth; | |
226 | + bitdepth = (int) png_get_bit_depth(png_p, info_p); | |
227 | pdf_begin_dict(smask_objnum, 0); | |
228 | pdf_puts("/Type /XObject\n/Subtype /Image\n"); | |
229 | if (img_attr(idict) != NULL && strlen(img_attr(idict)) > 0) | |
230 | pdf_printf("%s\n", img_attr(idict)); | |
231 | pdf_printf("/Width %i\n/Height %i\n/BitsPerComponent %i\n", | |
232 | - (int) info_p->width, | |
233 | - (int) info_p->height, (bitdepth == 16 ? 8 : bitdepth)); | |
234 | + (int) png_get_image_width(png_p, info_p), | |
235 | + (int) png_get_image_height(png_p, info_p), (bitdepth == 16 ? 8 : bitdepth)); | |
236 | pdf_puts("/ColorSpace /DeviceGray\n"); | |
237 | pdf_begin_stream(); | |
238 | for (i = 0; i < smask_size; i++) { | |
239 | @@ -319,17 +337,21 @@ | |
240 | pdf_puts("/DeviceRGB\n"); | |
241 | } | |
242 | pdf_begin_stream(); | |
243 | - if (info_p->interlace_type == PNG_INTERLACE_NONE) { | |
244 | - row = xtalloc(info_p->rowbytes, png_byte); | |
245 | + if (png_get_interlace_type(png_p, info_p) == PNG_INTERLACE_NONE) { | |
246 | + png_uint_32 height = png_get_image_height(png_p, info_p); | |
247 | + png_size_t rowbytes = png_get_rowbytes(png_p, info_p); | |
248 | + row = xtalloc(rowbytes, png_byte); | |
249 | write_noninterlaced(write_simple_pixel(r)); | |
250 | xfree(row); | |
251 | } else { | |
252 | - if (info_p->height * info_p->rowbytes >= 10240000L) | |
253 | + png_uint_32 height = png_get_image_height(png_p, info_p); | |
254 | + png_size_t rowbytes = png_get_rowbytes(png_p, info_p); | |
255 | + if (height * rowbytes >= 10240000L) | |
256 | pdftex_warn | |
257 | ("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)"); | |
258 | - rows = xtalloc(info_p->height, png_bytep); | |
259 | - for (i = 0; (unsigned) i < info_p->height; i++) | |
260 | - rows[i] = xtalloc(info_p->rowbytes, png_byte); | |
261 | + rows = xtalloc(height, png_bytep); | |
262 | + for (i = 0; (unsigned) i < height; i++) | |
263 | + rows[i] = xtalloc(rowbytes, png_byte); | |
264 | png_read_image(png_p, rows); | |
265 | write_interlaced(write_simple_pixel(row)); | |
266 | xfree(rows); | |
267 | @@ -356,26 +378,30 @@ | |
268 | pdf_create_obj(0, 0); | |
269 | smask_objnum = obj_ptr; | |
270 | pdf_printf("/SMask %i 0 R\n", (int) smask_objnum); | |
271 | - smask_size = (info_p->rowbytes / 2) * info_p->height; | |
272 | + smask_size = (png_get_rowbytes(png_p, info_p) / 2) * png_get_image_height(png_p, info_p); | |
273 | smask = xtalloc(smask_size, png_byte); | |
274 | pdf_begin_stream(); | |
275 | - if (info_p->interlace_type == PNG_INTERLACE_NONE) { | |
276 | - row = xtalloc(info_p->rowbytes, png_byte); | |
277 | - if ((info_p->bit_depth == 16) && fixed_image_hicolor) { | |
278 | + if (png_get_interlace_type(png_p, info_p) == PNG_INTERLACE_NONE) { | |
279 | + png_uint_32 height = png_get_image_height(png_p, info_p); | |
280 | + png_size_t rowbytes = png_get_rowbytes(png_p, info_p); | |
281 | + row = xtalloc(rowbytes, png_byte); | |
282 | + if ((png_get_bit_depth(png_p, info_p) == 16) && fixed_image_hicolor) { | |
283 | write_noninterlaced(write_rgb_pixel_16(r)); | |
284 | } else { | |
285 | write_noninterlaced(write_rgb_pixel_8(r)); | |
286 | } | |
287 | xfree(row); | |
288 | } else { | |
289 | - if (info_p->height * info_p->rowbytes >= 10240000L) | |
290 | + png_uint_32 height = png_get_image_height(png_p, info_p); | |
291 | + png_size_t rowbytes = png_get_rowbytes(png_p, info_p); | |
292 | + if (height * rowbytes >= 10240000L) | |
293 | pdftex_warn | |
294 | ("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)"); | |
295 | - rows = xtalloc(info_p->height, png_bytep); | |
296 | - for (i = 0; (unsigned) i < info_p->height; i++) | |
297 | - rows[i] = xtalloc(info_p->rowbytes, png_byte); | |
298 | + rows = xtalloc(height, png_bytep); | |
299 | + for (i = 0; (unsigned) i < height; i++) | |
300 | + rows[i] = xtalloc(rowbytes, png_byte); | |
301 | png_read_image(png_p, rows); | |
302 | - if ((info_p->bit_depth == 16) && fixed_image_hicolor) { | |
303 | + if ((png_get_bit_depth(png_p, info_p) == 16) && fixed_image_hicolor) { | |
304 | write_interlaced(write_rgb_pixel_16(row)); | |
305 | } else { | |
306 | write_interlaced(write_rgb_pixel_8(row)); | |
307 | @@ -386,14 +412,14 @@ | |
308 | pdf_flush(); | |
309 | /* now write the Smask object */ | |
310 | if (smask_objnum > 0) { | |
311 | - bitdepth = (int) info_p->bit_depth; | |
312 | + bitdepth = (int) png_get_bit_depth(png_p, info_p); | |
313 | pdf_begin_dict(smask_objnum, 0); | |
314 | pdf_puts("/Type /XObject\n/Subtype /Image\n"); | |
315 | if (img_attr(idict) != NULL) | |
316 | pdf_printf("%s\n", img_attr(idict)); | |
317 | pdf_printf("/Width %i\n/Height %i\n/BitsPerComponent %i\n", | |
318 | - (int) info_p->width, | |
319 | - (int) info_p->height, (bitdepth == 16 ? 8 : bitdepth)); | |
320 | + (int) png_get_image_width(png_p, info_p), | |
321 | + (int) png_get_image_height(png_p, info_p), (bitdepth == 16 ? 8 : bitdepth)); | |
322 | pdf_puts("/ColorSpace /DeviceGray\n"); | |
323 | pdf_begin_stream(); | |
324 | for (i = 0; i < smask_size; i++) { | |
325 | @@ -442,7 +468,7 @@ | |
326 | assert(idict != NULL); | |
327 | png_p = img_png_png_ptr(idict); | |
328 | info_p = img_png_info_ptr(idict); | |
329 | - fp = (FILE *) png_p->io_ptr; | |
330 | + fp = (FILE *) png_get_io_ptr(png_p); | |
331 | /* 1st pass to find overall stream /Length */ | |
332 | if (fseek(fp, 8, SEEK_SET) != 0) | |
333 | pdftex_fail("writepng: fseek in PNG file failed"); | |
334 | @@ -463,9 +489,9 @@ | |
335 | pdf_printf("/Length %d\n", streamlength); | |
336 | pdf_printf("/Filter /FlateDecode\n"); | |
337 | pdf_printf("/DecodeParms << "); | |
338 | - pdf_printf("/Colors %d ", info_p->color_type == 2 ? 3 : 1); | |
339 | - pdf_printf("/Columns %d ", (int) info_p->width); | |
340 | - pdf_printf("/BitsPerComponent %i ", (int) info_p->bit_depth); | |
341 | + pdf_printf("/Colors %d ", png_get_color_type(png_p, info_p) == PNG_COLOR_TYPE_RGB ? 3 : 1); | |
342 | + pdf_printf("/Columns %d ", (int) png_get_image_width(png_p, info_p)); | |
343 | + pdf_printf("/BitsPerComponent %i ", (int) png_get_bit_depth(png_p, info_p)); | |
344 | pdf_printf("/Predictor %d ", 10); /* actual predictor defined on line basis */ | |
345 | pdf_printf(">>\n>>\nstream\n"); | |
346 | /* 2nd pass to copy data */ | |
347 | @@ -535,8 +561,8 @@ | |
348 | if (img_attr(idict) != NULL && strlen(img_attr(idict)) > 0) | |
349 | pdf_printf("%s\n", img_attr(idict)); | |
350 | pdf_printf("/Width %i\n/Height %i\n/BitsPerComponent %i\n", | |
351 | - (int) info_p->width, | |
352 | - (int) info_p->height, (int) info_p->bit_depth); | |
353 | + (int) png_get_image_width(png_p, info_p), | |
354 | + (int) png_get_image_height(png_p, info_p), (int) png_get_bit_depth(png_p, info_p)); | |
355 | pdf_puts("/ColorSpace "); | |
356 | checked_gamma = 1.0; | |
357 | if (fixed_image_apply_gamma) { | |
358 | @@ -549,22 +575,27 @@ | |
359 | } | |
360 | /* the switching between |info_p| and |png_p| queries has been trial and error. | |
361 | */ | |
362 | - if (fixed_pdf_minor_version > 1 && info_p->interlace_type == PNG_INTERLACE_NONE && (png_p->transformations == 0 || png_p->transformations == 0x2000) /* gamma */ | |
363 | - &&!(png_p->color_type == PNG_COLOR_TYPE_GRAY_ALPHA || | |
364 | - png_p->color_type == PNG_COLOR_TYPE_RGB_ALPHA) | |
365 | - && (fixed_image_hicolor || (png_p->bit_depth <= 8)) | |
366 | + if (fixed_pdf_minor_version > 1 && png_get_interlace_type(png_p, info_p) == PNG_INTERLACE_NONE /* && (png_p->transformations == PNG_TRANSFORM_IDENTITY || png_p->transformations == PNG_TRANSFORM_GRAY_TO_PNG) */ /* gamma */ | |
367 | + &&!(png_get_color_type(png_p, info_p) == PNG_COLOR_TYPE_GRAY_ALPHA || | |
368 | + png_get_color_type(png_p, info_p) == PNG_COLOR_TYPE_RGB_ALPHA) | |
369 | + && (fixed_image_hicolor || (png_get_bit_depth(png_p, info_p) <= 8)) | |
370 | && (checked_gamma <= 1.01 && checked_gamma > 0.99) | |
371 | ) { | |
372 | if (img_colorspace(idict) != 0) { | |
373 | pdf_printf("%i 0 R\n", (int) img_colorspace(idict)); | |
374 | } else { | |
375 | - switch (info_p->color_type) { | |
376 | + switch (png_get_color_type(png_p, info_p)) { | |
377 | case PNG_COLOR_TYPE_PALETTE: | |
378 | + { | |
379 | + png_colorp palette; | |
380 | + int num_palette; | |
381 | + png_get_PLTE(png_p, info_p, &palette, &num_palette); | |
382 | pdf_create_obj(0, 0); | |
383 | palette_objnum = obj_ptr; | |
384 | pdf_printf("[/Indexed /DeviceRGB %i %i 0 R]\n", | |
385 | - (int) (info_p->num_palette - 1), | |
386 | + (int) (num_palette - 1), | |
387 | (int) palette_objnum); | |
388 | + } | |
389 | break; | |
390 | case PNG_COLOR_TYPE_GRAY: | |
391 | pdf_puts("/DeviceGray\n"); | |
392 | @@ -577,13 +608,16 @@ | |
393 | tex_printf(" (PNG copy)"); | |
394 | copy_png(idict); | |
395 | if (palette_objnum > 0) { | |
396 | + png_colorp palette; | |
397 | + int num_palette; | |
398 | + png_get_PLTE(png_p, info_p, &palette, &num_palette); | |
399 | pdf_begin_dict(palette_objnum, 0); | |
400 | pdf_begin_stream(); | |
401 | - for (i = 0; (unsigned) i < info_p->num_palette; i++) { | |
402 | + for (i = 0; (unsigned) i < num_palette; i++) { | |
403 | pdfroom(3); | |
404 | - pdf_buf[pdf_ptr++] = info_p->palette[i].red; | |
405 | - pdf_buf[pdf_ptr++] = info_p->palette[i].green; | |
406 | - pdf_buf[pdf_ptr++] = info_p->palette[i].blue; | |
407 | + pdf_buf[pdf_ptr++] = palette[i].red; | |
408 | + pdf_buf[pdf_ptr++] = palette[i].green; | |
409 | + pdf_buf[pdf_ptr++] = palette[i].blue; | |
410 | } | |
411 | pdf_end_stream(); | |
412 | } | |
413 | @@ -593,22 +627,22 @@ | |
414 | if (fixed_image_apply_gamma && | |
415 | (checked_gamma > 1.01 || checked_gamma < 0.99)) | |
416 | tex_printf("gamma delta=%lf ", checked_gamma); | |
417 | - if (png_p->transformations != PNG_TRANSFORM_IDENTITY) | |
418 | - tex_printf("transform=%lu", (long) png_p->transformations); | |
419 | - if ((info_p->color_type != PNG_COLOR_TYPE_GRAY) | |
420 | - && (info_p->color_type != PNG_COLOR_TYPE_RGB) | |
421 | - && (info_p->color_type != PNG_COLOR_TYPE_PALETTE)) | |
422 | + /* if (png_p->transformations != PNG_TRANSFORM_IDENTITY) | |
423 | + tex_printf("transform=%lu", (long) png_p->transformations); */ | |
424 | + if ((png_get_color_type(png_p, info_p) != PNG_COLOR_TYPE_GRAY) | |
425 | + && (png_get_color_type(png_p, info_p) != PNG_COLOR_TYPE_RGB) | |
426 | + && (png_get_color_type(png_p, info_p) != PNG_COLOR_TYPE_PALETTE)) | |
427 | tex_printf("colortype "); | |
428 | if (fixed_pdf_minor_version <= 1) | |
429 | tex_printf("version=%d ", (int) fixed_pdf_minor_version); | |
430 | - if (info_p->interlace_type != PNG_INTERLACE_NONE) | |
431 | + if (png_get_interlace_type(png_p, info_p) != PNG_INTERLACE_NONE) | |
432 | tex_printf("interlaced "); | |
433 | - if (info_p->bit_depth > 8) | |
434 | - tex_printf("bitdepth=%d ", info_p->bit_depth); | |
435 | + if (png_get_bit_depth(png_p, info_p) > 8) | |
436 | + tex_printf("bitdepth=%d ", png_get_bit_depth(png_p, info_p)); | |
437 | if (png_get_valid(png_p, info_p, PNG_INFO_tRNS)) | |
438 | tex_printf("simple transparancy "); | |
439 | } | |
440 | - switch (info_p->color_type) { | |
441 | + switch (png_get_color_type(png_p, info_p)) { | |
442 | case PNG_COLOR_TYPE_PALETTE: | |
443 | write_png_palette(idict); | |
444 | break; | |
445 | @@ -632,7 +666,7 @@ | |
446 | break; | |
447 | default: | |
448 | pdftex_fail("unsupported type of color_type <%i>", | |
449 | - info_p->color_type); | |
450 | + png_get_color_type(png_p, info_p)); | |
451 | } | |
452 | } | |
453 | pdf_flush(); |