rev |
line source |
nuclear@1
|
1
|
nuclear@1
|
2 /* pngget.c - retrieval of values from info struct
|
nuclear@1
|
3 *
|
nuclear@1
|
4 * Last changed in libpng 1.2.30 [August 15, 2008]
|
nuclear@1
|
5 * For conditions of distribution and use, see copyright notice in png.h
|
nuclear@1
|
6 * Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
nuclear@1
|
7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
nuclear@1
|
8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
nuclear@1
|
9 */
|
nuclear@1
|
10
|
nuclear@1
|
11 #define PNG_INTERNAL
|
nuclear@1
|
12 #include "png.h"
|
nuclear@1
|
13 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
nuclear@1
|
14
|
nuclear@1
|
15 png_uint_32 PNGAPI
|
nuclear@1
|
16 png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
|
nuclear@1
|
17 {
|
nuclear@1
|
18 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
19 return(info_ptr->valid & flag);
|
nuclear@1
|
20 else
|
nuclear@1
|
21 return(0);
|
nuclear@1
|
22 }
|
nuclear@1
|
23
|
nuclear@1
|
24 png_uint_32 PNGAPI
|
nuclear@1
|
25 png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
26 {
|
nuclear@1
|
27 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
28 return(info_ptr->rowbytes);
|
nuclear@1
|
29 else
|
nuclear@1
|
30 return(0);
|
nuclear@1
|
31 }
|
nuclear@1
|
32
|
nuclear@1
|
33 #if defined(PNG_INFO_IMAGE_SUPPORTED)
|
nuclear@1
|
34 png_bytepp PNGAPI
|
nuclear@1
|
35 png_get_rows(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
36 {
|
nuclear@1
|
37 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
38 return(info_ptr->row_pointers);
|
nuclear@1
|
39 else
|
nuclear@1
|
40 return(0);
|
nuclear@1
|
41 }
|
nuclear@1
|
42 #endif
|
nuclear@1
|
43
|
nuclear@1
|
44 #ifdef PNG_EASY_ACCESS_SUPPORTED
|
nuclear@1
|
45 /* easy access to info, added in libpng-0.99 */
|
nuclear@1
|
46 png_uint_32 PNGAPI
|
nuclear@1
|
47 png_get_image_width(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
48 {
|
nuclear@1
|
49 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
50 {
|
nuclear@1
|
51 return info_ptr->width;
|
nuclear@1
|
52 }
|
nuclear@1
|
53 return (0);
|
nuclear@1
|
54 }
|
nuclear@1
|
55
|
nuclear@1
|
56 png_uint_32 PNGAPI
|
nuclear@1
|
57 png_get_image_height(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
58 {
|
nuclear@1
|
59 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
60 {
|
nuclear@1
|
61 return info_ptr->height;
|
nuclear@1
|
62 }
|
nuclear@1
|
63 return (0);
|
nuclear@1
|
64 }
|
nuclear@1
|
65
|
nuclear@1
|
66 png_byte PNGAPI
|
nuclear@1
|
67 png_get_bit_depth(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
68 {
|
nuclear@1
|
69 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
70 {
|
nuclear@1
|
71 return info_ptr->bit_depth;
|
nuclear@1
|
72 }
|
nuclear@1
|
73 return (0);
|
nuclear@1
|
74 }
|
nuclear@1
|
75
|
nuclear@1
|
76 png_byte PNGAPI
|
nuclear@1
|
77 png_get_color_type(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
78 {
|
nuclear@1
|
79 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
80 {
|
nuclear@1
|
81 return info_ptr->color_type;
|
nuclear@1
|
82 }
|
nuclear@1
|
83 return (0);
|
nuclear@1
|
84 }
|
nuclear@1
|
85
|
nuclear@1
|
86 png_byte PNGAPI
|
nuclear@1
|
87 png_get_filter_type(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
88 {
|
nuclear@1
|
89 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
90 {
|
nuclear@1
|
91 return info_ptr->filter_type;
|
nuclear@1
|
92 }
|
nuclear@1
|
93 return (0);
|
nuclear@1
|
94 }
|
nuclear@1
|
95
|
nuclear@1
|
96 png_byte PNGAPI
|
nuclear@1
|
97 png_get_interlace_type(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
98 {
|
nuclear@1
|
99 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
100 {
|
nuclear@1
|
101 return info_ptr->interlace_type;
|
nuclear@1
|
102 }
|
nuclear@1
|
103 return (0);
|
nuclear@1
|
104 }
|
nuclear@1
|
105
|
nuclear@1
|
106 png_byte PNGAPI
|
nuclear@1
|
107 png_get_compression_type(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
108 {
|
nuclear@1
|
109 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
110 {
|
nuclear@1
|
111 return info_ptr->compression_type;
|
nuclear@1
|
112 }
|
nuclear@1
|
113 return (0);
|
nuclear@1
|
114 }
|
nuclear@1
|
115
|
nuclear@1
|
116 png_uint_32 PNGAPI
|
nuclear@1
|
117 png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
118 {
|
nuclear@1
|
119 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
120 #if defined(PNG_pHYs_SUPPORTED)
|
nuclear@1
|
121 if (info_ptr->valid & PNG_INFO_pHYs)
|
nuclear@1
|
122 {
|
nuclear@1
|
123 png_debug1(1, "in %s retrieval function\n", "png_get_x_pixels_per_meter");
|
nuclear@1
|
124 if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
|
nuclear@1
|
125 return (0);
|
nuclear@1
|
126 else return (info_ptr->x_pixels_per_unit);
|
nuclear@1
|
127 }
|
nuclear@1
|
128 #else
|
nuclear@1
|
129 return (0);
|
nuclear@1
|
130 #endif
|
nuclear@1
|
131 return (0);
|
nuclear@1
|
132 }
|
nuclear@1
|
133
|
nuclear@1
|
134 png_uint_32 PNGAPI
|
nuclear@1
|
135 png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
136 {
|
nuclear@1
|
137 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
138 #if defined(PNG_pHYs_SUPPORTED)
|
nuclear@1
|
139 if (info_ptr->valid & PNG_INFO_pHYs)
|
nuclear@1
|
140 {
|
nuclear@1
|
141 png_debug1(1, "in %s retrieval function\n", "png_get_y_pixels_per_meter");
|
nuclear@1
|
142 if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
|
nuclear@1
|
143 return (0);
|
nuclear@1
|
144 else return (info_ptr->y_pixels_per_unit);
|
nuclear@1
|
145 }
|
nuclear@1
|
146 #else
|
nuclear@1
|
147 return (0);
|
nuclear@1
|
148 #endif
|
nuclear@1
|
149 return (0);
|
nuclear@1
|
150 }
|
nuclear@1
|
151
|
nuclear@1
|
152 png_uint_32 PNGAPI
|
nuclear@1
|
153 png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
154 {
|
nuclear@1
|
155 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
156 #if defined(PNG_pHYs_SUPPORTED)
|
nuclear@1
|
157 if (info_ptr->valid & PNG_INFO_pHYs)
|
nuclear@1
|
158 {
|
nuclear@1
|
159 png_debug1(1, "in %s retrieval function\n", "png_get_pixels_per_meter");
|
nuclear@1
|
160 if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER ||
|
nuclear@1
|
161 info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit)
|
nuclear@1
|
162 return (0);
|
nuclear@1
|
163 else return (info_ptr->x_pixels_per_unit);
|
nuclear@1
|
164 }
|
nuclear@1
|
165 #else
|
nuclear@1
|
166 return (0);
|
nuclear@1
|
167 #endif
|
nuclear@1
|
168 return (0);
|
nuclear@1
|
169 }
|
nuclear@1
|
170
|
nuclear@1
|
171 #ifdef PNG_FLOATING_POINT_SUPPORTED
|
nuclear@1
|
172 float PNGAPI
|
nuclear@1
|
173 png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
174 {
|
nuclear@1
|
175 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
176 #if defined(PNG_pHYs_SUPPORTED)
|
nuclear@1
|
177 if (info_ptr->valid & PNG_INFO_pHYs)
|
nuclear@1
|
178 {
|
nuclear@1
|
179 png_debug1(1, "in %s retrieval function\n", "png_get_aspect_ratio");
|
nuclear@1
|
180 if (info_ptr->x_pixels_per_unit == 0)
|
nuclear@1
|
181 return ((float)0.0);
|
nuclear@1
|
182 else
|
nuclear@1
|
183 return ((float)((float)info_ptr->y_pixels_per_unit
|
nuclear@1
|
184 /(float)info_ptr->x_pixels_per_unit));
|
nuclear@1
|
185 }
|
nuclear@1
|
186 #else
|
nuclear@1
|
187 return (0.0);
|
nuclear@1
|
188 #endif
|
nuclear@1
|
189 return ((float)0.0);
|
nuclear@1
|
190 }
|
nuclear@1
|
191 #endif
|
nuclear@1
|
192
|
nuclear@1
|
193 png_int_32 PNGAPI
|
nuclear@1
|
194 png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
195 {
|
nuclear@1
|
196 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
197 #if defined(PNG_oFFs_SUPPORTED)
|
nuclear@1
|
198 if (info_ptr->valid & PNG_INFO_oFFs)
|
nuclear@1
|
199 {
|
nuclear@1
|
200 png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns");
|
nuclear@1
|
201 if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
|
nuclear@1
|
202 return (0);
|
nuclear@1
|
203 else return (info_ptr->x_offset);
|
nuclear@1
|
204 }
|
nuclear@1
|
205 #else
|
nuclear@1
|
206 return (0);
|
nuclear@1
|
207 #endif
|
nuclear@1
|
208 return (0);
|
nuclear@1
|
209 }
|
nuclear@1
|
210
|
nuclear@1
|
211 png_int_32 PNGAPI
|
nuclear@1
|
212 png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
213 {
|
nuclear@1
|
214 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
215 #if defined(PNG_oFFs_SUPPORTED)
|
nuclear@1
|
216 if (info_ptr->valid & PNG_INFO_oFFs)
|
nuclear@1
|
217 {
|
nuclear@1
|
218 png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns");
|
nuclear@1
|
219 if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
|
nuclear@1
|
220 return (0);
|
nuclear@1
|
221 else return (info_ptr->y_offset);
|
nuclear@1
|
222 }
|
nuclear@1
|
223 #else
|
nuclear@1
|
224 return (0);
|
nuclear@1
|
225 #endif
|
nuclear@1
|
226 return (0);
|
nuclear@1
|
227 }
|
nuclear@1
|
228
|
nuclear@1
|
229 png_int_32 PNGAPI
|
nuclear@1
|
230 png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
231 {
|
nuclear@1
|
232 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
233 #if defined(PNG_oFFs_SUPPORTED)
|
nuclear@1
|
234 if (info_ptr->valid & PNG_INFO_oFFs)
|
nuclear@1
|
235 {
|
nuclear@1
|
236 png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns");
|
nuclear@1
|
237 if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
|
nuclear@1
|
238 return (0);
|
nuclear@1
|
239 else return (info_ptr->x_offset);
|
nuclear@1
|
240 }
|
nuclear@1
|
241 #else
|
nuclear@1
|
242 return (0);
|
nuclear@1
|
243 #endif
|
nuclear@1
|
244 return (0);
|
nuclear@1
|
245 }
|
nuclear@1
|
246
|
nuclear@1
|
247 png_int_32 PNGAPI
|
nuclear@1
|
248 png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
249 {
|
nuclear@1
|
250 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
251 #if defined(PNG_oFFs_SUPPORTED)
|
nuclear@1
|
252 if (info_ptr->valid & PNG_INFO_oFFs)
|
nuclear@1
|
253 {
|
nuclear@1
|
254 png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns");
|
nuclear@1
|
255 if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
|
nuclear@1
|
256 return (0);
|
nuclear@1
|
257 else return (info_ptr->y_offset);
|
nuclear@1
|
258 }
|
nuclear@1
|
259 #else
|
nuclear@1
|
260 return (0);
|
nuclear@1
|
261 #endif
|
nuclear@1
|
262 return (0);
|
nuclear@1
|
263 }
|
nuclear@1
|
264
|
nuclear@1
|
265 #if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)
|
nuclear@1
|
266 png_uint_32 PNGAPI
|
nuclear@1
|
267 png_get_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
268 {
|
nuclear@1
|
269 return ((png_uint_32)((float)png_get_pixels_per_meter(png_ptr, info_ptr)
|
nuclear@1
|
270 *.0254 +.5));
|
nuclear@1
|
271 }
|
nuclear@1
|
272
|
nuclear@1
|
273 png_uint_32 PNGAPI
|
nuclear@1
|
274 png_get_x_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
275 {
|
nuclear@1
|
276 return ((png_uint_32)((float)png_get_x_pixels_per_meter(png_ptr, info_ptr)
|
nuclear@1
|
277 *.0254 +.5));
|
nuclear@1
|
278 }
|
nuclear@1
|
279
|
nuclear@1
|
280 png_uint_32 PNGAPI
|
nuclear@1
|
281 png_get_y_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
282 {
|
nuclear@1
|
283 return ((png_uint_32)((float)png_get_y_pixels_per_meter(png_ptr, info_ptr)
|
nuclear@1
|
284 *.0254 +.5));
|
nuclear@1
|
285 }
|
nuclear@1
|
286
|
nuclear@1
|
287 float PNGAPI
|
nuclear@1
|
288 png_get_x_offset_inches(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
289 {
|
nuclear@1
|
290 return ((float)png_get_x_offset_microns(png_ptr, info_ptr)
|
nuclear@1
|
291 *.00003937);
|
nuclear@1
|
292 }
|
nuclear@1
|
293
|
nuclear@1
|
294 float PNGAPI
|
nuclear@1
|
295 png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
296 {
|
nuclear@1
|
297 return ((float)png_get_y_offset_microns(png_ptr, info_ptr)
|
nuclear@1
|
298 *.00003937);
|
nuclear@1
|
299 }
|
nuclear@1
|
300
|
nuclear@1
|
301 #if defined(PNG_pHYs_SUPPORTED)
|
nuclear@1
|
302 png_uint_32 PNGAPI
|
nuclear@1
|
303 png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
|
nuclear@1
|
304 png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
|
nuclear@1
|
305 {
|
nuclear@1
|
306 png_uint_32 retval = 0;
|
nuclear@1
|
307
|
nuclear@1
|
308 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
|
nuclear@1
|
309 {
|
nuclear@1
|
310 png_debug1(1, "in %s retrieval function\n", "pHYs");
|
nuclear@1
|
311 if (res_x != NULL)
|
nuclear@1
|
312 {
|
nuclear@1
|
313 *res_x = info_ptr->x_pixels_per_unit;
|
nuclear@1
|
314 retval |= PNG_INFO_pHYs;
|
nuclear@1
|
315 }
|
nuclear@1
|
316 if (res_y != NULL)
|
nuclear@1
|
317 {
|
nuclear@1
|
318 *res_y = info_ptr->y_pixels_per_unit;
|
nuclear@1
|
319 retval |= PNG_INFO_pHYs;
|
nuclear@1
|
320 }
|
nuclear@1
|
321 if (unit_type != NULL)
|
nuclear@1
|
322 {
|
nuclear@1
|
323 *unit_type = (int)info_ptr->phys_unit_type;
|
nuclear@1
|
324 retval |= PNG_INFO_pHYs;
|
nuclear@1
|
325 if (*unit_type == 1)
|
nuclear@1
|
326 {
|
nuclear@1
|
327 if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50);
|
nuclear@1
|
328 if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50);
|
nuclear@1
|
329 }
|
nuclear@1
|
330 }
|
nuclear@1
|
331 }
|
nuclear@1
|
332 return (retval);
|
nuclear@1
|
333 }
|
nuclear@1
|
334 #endif /* PNG_pHYs_SUPPORTED */
|
nuclear@1
|
335 #endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
|
nuclear@1
|
336
|
nuclear@1
|
337 /* png_get_channels really belongs in here, too, but it's been around longer */
|
nuclear@1
|
338
|
nuclear@1
|
339 #endif /* PNG_EASY_ACCESS_SUPPORTED */
|
nuclear@1
|
340
|
nuclear@1
|
341 png_byte PNGAPI
|
nuclear@1
|
342 png_get_channels(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
343 {
|
nuclear@1
|
344 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
345 return(info_ptr->channels);
|
nuclear@1
|
346 else
|
nuclear@1
|
347 return (0);
|
nuclear@1
|
348 }
|
nuclear@1
|
349
|
nuclear@1
|
350 png_bytep PNGAPI
|
nuclear@1
|
351 png_get_signature(png_structp png_ptr, png_infop info_ptr)
|
nuclear@1
|
352 {
|
nuclear@1
|
353 if (png_ptr != NULL && info_ptr != NULL)
|
nuclear@1
|
354 return(info_ptr->signature);
|
nuclear@1
|
355 else
|
nuclear@1
|
356 return (NULL);
|
nuclear@1
|
357 }
|
nuclear@1
|
358
|
nuclear@1
|
359 #if defined(PNG_bKGD_SUPPORTED)
|
nuclear@1
|
360 png_uint_32 PNGAPI
|
nuclear@1
|
361 png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
|
nuclear@1
|
362 png_color_16p *background)
|
nuclear@1
|
363 {
|
nuclear@1
|
364 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD)
|
nuclear@1
|
365 && background != NULL)
|
nuclear@1
|
366 {
|
nuclear@1
|
367 png_debug1(1, "in %s retrieval function\n", "bKGD");
|
nuclear@1
|
368 *background = &(info_ptr->background);
|
nuclear@1
|
369 return (PNG_INFO_bKGD);
|
nuclear@1
|
370 }
|
nuclear@1
|
371 return (0);
|
nuclear@1
|
372 }
|
nuclear@1
|
373 #endif
|
nuclear@1
|
374
|
nuclear@1
|
375 #if defined(PNG_cHRM_SUPPORTED)
|
nuclear@1
|
376 #ifdef PNG_FLOATING_POINT_SUPPORTED
|
nuclear@1
|
377 png_uint_32 PNGAPI
|
nuclear@1
|
378 png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
|
nuclear@1
|
379 double *white_x, double *white_y, double *red_x, double *red_y,
|
nuclear@1
|
380 double *green_x, double *green_y, double *blue_x, double *blue_y)
|
nuclear@1
|
381 {
|
nuclear@1
|
382 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
|
nuclear@1
|
383 {
|
nuclear@1
|
384 png_debug1(1, "in %s retrieval function\n", "cHRM");
|
nuclear@1
|
385 if (white_x != NULL)
|
nuclear@1
|
386 *white_x = (double)info_ptr->x_white;
|
nuclear@1
|
387 if (white_y != NULL)
|
nuclear@1
|
388 *white_y = (double)info_ptr->y_white;
|
nuclear@1
|
389 if (red_x != NULL)
|
nuclear@1
|
390 *red_x = (double)info_ptr->x_red;
|
nuclear@1
|
391 if (red_y != NULL)
|
nuclear@1
|
392 *red_y = (double)info_ptr->y_red;
|
nuclear@1
|
393 if (green_x != NULL)
|
nuclear@1
|
394 *green_x = (double)info_ptr->x_green;
|
nuclear@1
|
395 if (green_y != NULL)
|
nuclear@1
|
396 *green_y = (double)info_ptr->y_green;
|
nuclear@1
|
397 if (blue_x != NULL)
|
nuclear@1
|
398 *blue_x = (double)info_ptr->x_blue;
|
nuclear@1
|
399 if (blue_y != NULL)
|
nuclear@1
|
400 *blue_y = (double)info_ptr->y_blue;
|
nuclear@1
|
401 return (PNG_INFO_cHRM);
|
nuclear@1
|
402 }
|
nuclear@1
|
403 return (0);
|
nuclear@1
|
404 }
|
nuclear@1
|
405 #endif
|
nuclear@1
|
406 #ifdef PNG_FIXED_POINT_SUPPORTED
|
nuclear@1
|
407 png_uint_32 PNGAPI
|
nuclear@1
|
408 png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
|
nuclear@1
|
409 png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x,
|
nuclear@1
|
410 png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
|
nuclear@1
|
411 png_fixed_point *blue_x, png_fixed_point *blue_y)
|
nuclear@1
|
412 {
|
nuclear@1
|
413 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
|
nuclear@1
|
414 {
|
nuclear@1
|
415 png_debug1(1, "in %s retrieval function\n", "cHRM");
|
nuclear@1
|
416 if (white_x != NULL)
|
nuclear@1
|
417 *white_x = info_ptr->int_x_white;
|
nuclear@1
|
418 if (white_y != NULL)
|
nuclear@1
|
419 *white_y = info_ptr->int_y_white;
|
nuclear@1
|
420 if (red_x != NULL)
|
nuclear@1
|
421 *red_x = info_ptr->int_x_red;
|
nuclear@1
|
422 if (red_y != NULL)
|
nuclear@1
|
423 *red_y = info_ptr->int_y_red;
|
nuclear@1
|
424 if (green_x != NULL)
|
nuclear@1
|
425 *green_x = info_ptr->int_x_green;
|
nuclear@1
|
426 if (green_y != NULL)
|
nuclear@1
|
427 *green_y = info_ptr->int_y_green;
|
nuclear@1
|
428 if (blue_x != NULL)
|
nuclear@1
|
429 *blue_x = info_ptr->int_x_blue;
|
nuclear@1
|
430 if (blue_y != NULL)
|
nuclear@1
|
431 *blue_y = info_ptr->int_y_blue;
|
nuclear@1
|
432 return (PNG_INFO_cHRM);
|
nuclear@1
|
433 }
|
nuclear@1
|
434 return (0);
|
nuclear@1
|
435 }
|
nuclear@1
|
436 #endif
|
nuclear@1
|
437 #endif
|
nuclear@1
|
438
|
nuclear@1
|
439 #if defined(PNG_gAMA_SUPPORTED)
|
nuclear@1
|
440 #ifdef PNG_FLOATING_POINT_SUPPORTED
|
nuclear@1
|
441 png_uint_32 PNGAPI
|
nuclear@1
|
442 png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
|
nuclear@1
|
443 {
|
nuclear@1
|
444 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
|
nuclear@1
|
445 && file_gamma != NULL)
|
nuclear@1
|
446 {
|
nuclear@1
|
447 png_debug1(1, "in %s retrieval function\n", "gAMA");
|
nuclear@1
|
448 *file_gamma = (double)info_ptr->gamma;
|
nuclear@1
|
449 return (PNG_INFO_gAMA);
|
nuclear@1
|
450 }
|
nuclear@1
|
451 return (0);
|
nuclear@1
|
452 }
|
nuclear@1
|
453 #endif
|
nuclear@1
|
454 #ifdef PNG_FIXED_POINT_SUPPORTED
|
nuclear@1
|
455 png_uint_32 PNGAPI
|
nuclear@1
|
456 png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
|
nuclear@1
|
457 png_fixed_point *int_file_gamma)
|
nuclear@1
|
458 {
|
nuclear@1
|
459 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
|
nuclear@1
|
460 && int_file_gamma != NULL)
|
nuclear@1
|
461 {
|
nuclear@1
|
462 png_debug1(1, "in %s retrieval function\n", "gAMA");
|
nuclear@1
|
463 *int_file_gamma = info_ptr->int_gamma;
|
nuclear@1
|
464 return (PNG_INFO_gAMA);
|
nuclear@1
|
465 }
|
nuclear@1
|
466 return (0);
|
nuclear@1
|
467 }
|
nuclear@1
|
468 #endif
|
nuclear@1
|
469 #endif
|
nuclear@1
|
470
|
nuclear@1
|
471 #if defined(PNG_sRGB_SUPPORTED)
|
nuclear@1
|
472 png_uint_32 PNGAPI
|
nuclear@1
|
473 png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
|
nuclear@1
|
474 {
|
nuclear@1
|
475 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
|
nuclear@1
|
476 && file_srgb_intent != NULL)
|
nuclear@1
|
477 {
|
nuclear@1
|
478 png_debug1(1, "in %s retrieval function\n", "sRGB");
|
nuclear@1
|
479 *file_srgb_intent = (int)info_ptr->srgb_intent;
|
nuclear@1
|
480 return (PNG_INFO_sRGB);
|
nuclear@1
|
481 }
|
nuclear@1
|
482 return (0);
|
nuclear@1
|
483 }
|
nuclear@1
|
484 #endif
|
nuclear@1
|
485
|
nuclear@1
|
486 #if defined(PNG_iCCP_SUPPORTED)
|
nuclear@1
|
487 png_uint_32 PNGAPI
|
nuclear@1
|
488 png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
|
nuclear@1
|
489 png_charpp name, int *compression_type,
|
nuclear@1
|
490 png_charpp profile, png_uint_32 *proflen)
|
nuclear@1
|
491 {
|
nuclear@1
|
492 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)
|
nuclear@1
|
493 && name != NULL && profile != NULL && proflen != NULL)
|
nuclear@1
|
494 {
|
nuclear@1
|
495 png_debug1(1, "in %s retrieval function\n", "iCCP");
|
nuclear@1
|
496 *name = info_ptr->iccp_name;
|
nuclear@1
|
497 *profile = info_ptr->iccp_profile;
|
nuclear@1
|
498 /* compression_type is a dummy so the API won't have to change
|
nuclear@1
|
499 if we introduce multiple compression types later. */
|
nuclear@1
|
500 *proflen = (int)info_ptr->iccp_proflen;
|
nuclear@1
|
501 *compression_type = (int)info_ptr->iccp_compression;
|
nuclear@1
|
502 return (PNG_INFO_iCCP);
|
nuclear@1
|
503 }
|
nuclear@1
|
504 return (0);
|
nuclear@1
|
505 }
|
nuclear@1
|
506 #endif
|
nuclear@1
|
507
|
nuclear@1
|
508 #if defined(PNG_sPLT_SUPPORTED)
|
nuclear@1
|
509 png_uint_32 PNGAPI
|
nuclear@1
|
510 png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
|
nuclear@1
|
511 png_sPLT_tpp spalettes)
|
nuclear@1
|
512 {
|
nuclear@1
|
513 if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
|
nuclear@1
|
514 {
|
nuclear@1
|
515 *spalettes = info_ptr->splt_palettes;
|
nuclear@1
|
516 return ((png_uint_32)info_ptr->splt_palettes_num);
|
nuclear@1
|
517 }
|
nuclear@1
|
518 return (0);
|
nuclear@1
|
519 }
|
nuclear@1
|
520 #endif
|
nuclear@1
|
521
|
nuclear@1
|
522 #if defined(PNG_hIST_SUPPORTED)
|
nuclear@1
|
523 png_uint_32 PNGAPI
|
nuclear@1
|
524 png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
|
nuclear@1
|
525 {
|
nuclear@1
|
526 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
|
nuclear@1
|
527 && hist != NULL)
|
nuclear@1
|
528 {
|
nuclear@1
|
529 png_debug1(1, "in %s retrieval function\n", "hIST");
|
nuclear@1
|
530 *hist = info_ptr->hist;
|
nuclear@1
|
531 return (PNG_INFO_hIST);
|
nuclear@1
|
532 }
|
nuclear@1
|
533 return (0);
|
nuclear@1
|
534 }
|
nuclear@1
|
535 #endif
|
nuclear@1
|
536
|
nuclear@1
|
537 png_uint_32 PNGAPI
|
nuclear@1
|
538 png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
|
nuclear@1
|
539 png_uint_32 *width, png_uint_32 *height, int *bit_depth,
|
nuclear@1
|
540 int *color_type, int *interlace_type, int *compression_type,
|
nuclear@1
|
541 int *filter_type)
|
nuclear@1
|
542
|
nuclear@1
|
543 {
|
nuclear@1
|
544 if (png_ptr != NULL && info_ptr != NULL && width != NULL && height != NULL &&
|
nuclear@1
|
545 bit_depth != NULL && color_type != NULL)
|
nuclear@1
|
546 {
|
nuclear@1
|
547 png_debug1(1, "in %s retrieval function\n", "IHDR");
|
nuclear@1
|
548 *width = info_ptr->width;
|
nuclear@1
|
549 *height = info_ptr->height;
|
nuclear@1
|
550 *bit_depth = info_ptr->bit_depth;
|
nuclear@1
|
551 if (info_ptr->bit_depth < 1 || info_ptr->bit_depth > 16)
|
nuclear@1
|
552 png_error(png_ptr, "Invalid bit depth");
|
nuclear@1
|
553 *color_type = info_ptr->color_type;
|
nuclear@1
|
554 if (info_ptr->color_type > 6)
|
nuclear@1
|
555 png_error(png_ptr, "Invalid color type");
|
nuclear@1
|
556 if (compression_type != NULL)
|
nuclear@1
|
557 *compression_type = info_ptr->compression_type;
|
nuclear@1
|
558 if (filter_type != NULL)
|
nuclear@1
|
559 *filter_type = info_ptr->filter_type;
|
nuclear@1
|
560 if (interlace_type != NULL)
|
nuclear@1
|
561 *interlace_type = info_ptr->interlace_type;
|
nuclear@1
|
562
|
nuclear@1
|
563 /* check for potential overflow of rowbytes */
|
nuclear@1
|
564 if (*width == 0 || *width > PNG_UINT_31_MAX)
|
nuclear@1
|
565 png_error(png_ptr, "Invalid image width");
|
nuclear@1
|
566 if (*height == 0 || *height > PNG_UINT_31_MAX)
|
nuclear@1
|
567 png_error(png_ptr, "Invalid image height");
|
nuclear@1
|
568 if (info_ptr->width > (PNG_UINT_32_MAX
|
nuclear@1
|
569 >> 3) /* 8-byte RGBA pixels */
|
nuclear@1
|
570 - 64 /* bigrowbuf hack */
|
nuclear@1
|
571 - 1 /* filter byte */
|
nuclear@1
|
572 - 7*8 /* rounding of width to multiple of 8 pixels */
|
nuclear@1
|
573 - 8) /* extra max_pixel_depth pad */
|
nuclear@1
|
574 {
|
nuclear@1
|
575 png_warning(png_ptr,
|
nuclear@1
|
576 "Width too large for libpng to process image data.");
|
nuclear@1
|
577 }
|
nuclear@1
|
578 return (1);
|
nuclear@1
|
579 }
|
nuclear@1
|
580 return (0);
|
nuclear@1
|
581 }
|
nuclear@1
|
582
|
nuclear@1
|
583 #if defined(PNG_oFFs_SUPPORTED)
|
nuclear@1
|
584 png_uint_32 PNGAPI
|
nuclear@1
|
585 png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
|
nuclear@1
|
586 png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
|
nuclear@1
|
587 {
|
nuclear@1
|
588 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
|
nuclear@1
|
589 && offset_x != NULL && offset_y != NULL && unit_type != NULL)
|
nuclear@1
|
590 {
|
nuclear@1
|
591 png_debug1(1, "in %s retrieval function\n", "oFFs");
|
nuclear@1
|
592 *offset_x = info_ptr->x_offset;
|
nuclear@1
|
593 *offset_y = info_ptr->y_offset;
|
nuclear@1
|
594 *unit_type = (int)info_ptr->offset_unit_type;
|
nuclear@1
|
595 return (PNG_INFO_oFFs);
|
nuclear@1
|
596 }
|
nuclear@1
|
597 return (0);
|
nuclear@1
|
598 }
|
nuclear@1
|
599 #endif
|
nuclear@1
|
600
|
nuclear@1
|
601 #if defined(PNG_pCAL_SUPPORTED)
|
nuclear@1
|
602 png_uint_32 PNGAPI
|
nuclear@1
|
603 png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
|
nuclear@1
|
604 png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
|
nuclear@1
|
605 png_charp *units, png_charpp *params)
|
nuclear@1
|
606 {
|
nuclear@1
|
607 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)
|
nuclear@1
|
608 && purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
|
nuclear@1
|
609 nparams != NULL && units != NULL && params != NULL)
|
nuclear@1
|
610 {
|
nuclear@1
|
611 png_debug1(1, "in %s retrieval function\n", "pCAL");
|
nuclear@1
|
612 *purpose = info_ptr->pcal_purpose;
|
nuclear@1
|
613 *X0 = info_ptr->pcal_X0;
|
nuclear@1
|
614 *X1 = info_ptr->pcal_X1;
|
nuclear@1
|
615 *type = (int)info_ptr->pcal_type;
|
nuclear@1
|
616 *nparams = (int)info_ptr->pcal_nparams;
|
nuclear@1
|
617 *units = info_ptr->pcal_units;
|
nuclear@1
|
618 *params = info_ptr->pcal_params;
|
nuclear@1
|
619 return (PNG_INFO_pCAL);
|
nuclear@1
|
620 }
|
nuclear@1
|
621 return (0);
|
nuclear@1
|
622 }
|
nuclear@1
|
623 #endif
|
nuclear@1
|
624
|
nuclear@1
|
625 #if defined(PNG_sCAL_SUPPORTED)
|
nuclear@1
|
626 #ifdef PNG_FLOATING_POINT_SUPPORTED
|
nuclear@1
|
627 png_uint_32 PNGAPI
|
nuclear@1
|
628 png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
|
nuclear@1
|
629 int *unit, double *width, double *height)
|
nuclear@1
|
630 {
|
nuclear@1
|
631 if (png_ptr != NULL && info_ptr != NULL &&
|
nuclear@1
|
632 (info_ptr->valid & PNG_INFO_sCAL))
|
nuclear@1
|
633 {
|
nuclear@1
|
634 *unit = info_ptr->scal_unit;
|
nuclear@1
|
635 *width = info_ptr->scal_pixel_width;
|
nuclear@1
|
636 *height = info_ptr->scal_pixel_height;
|
nuclear@1
|
637 return (PNG_INFO_sCAL);
|
nuclear@1
|
638 }
|
nuclear@1
|
639 return(0);
|
nuclear@1
|
640 }
|
nuclear@1
|
641 #else
|
nuclear@1
|
642 #ifdef PNG_FIXED_POINT_SUPPORTED
|
nuclear@1
|
643 png_uint_32 PNGAPI
|
nuclear@1
|
644 png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
|
nuclear@1
|
645 int *unit, png_charpp width, png_charpp height)
|
nuclear@1
|
646 {
|
nuclear@1
|
647 if (png_ptr != NULL && info_ptr != NULL &&
|
nuclear@1
|
648 (info_ptr->valid & PNG_INFO_sCAL))
|
nuclear@1
|
649 {
|
nuclear@1
|
650 *unit = info_ptr->scal_unit;
|
nuclear@1
|
651 *width = info_ptr->scal_s_width;
|
nuclear@1
|
652 *height = info_ptr->scal_s_height;
|
nuclear@1
|
653 return (PNG_INFO_sCAL);
|
nuclear@1
|
654 }
|
nuclear@1
|
655 return(0);
|
nuclear@1
|
656 }
|
nuclear@1
|
657 #endif
|
nuclear@1
|
658 #endif
|
nuclear@1
|
659 #endif
|
nuclear@1
|
660
|
nuclear@1
|
661 #if defined(PNG_pHYs_SUPPORTED)
|
nuclear@1
|
662 png_uint_32 PNGAPI
|
nuclear@1
|
663 png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
|
nuclear@1
|
664 png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
|
nuclear@1
|
665 {
|
nuclear@1
|
666 png_uint_32 retval = 0;
|
nuclear@1
|
667
|
nuclear@1
|
668 if (png_ptr != NULL && info_ptr != NULL &&
|
nuclear@1
|
669 (info_ptr->valid & PNG_INFO_pHYs))
|
nuclear@1
|
670 {
|
nuclear@1
|
671 png_debug1(1, "in %s retrieval function\n", "pHYs");
|
nuclear@1
|
672 if (res_x != NULL)
|
nuclear@1
|
673 {
|
nuclear@1
|
674 *res_x = info_ptr->x_pixels_per_unit;
|
nuclear@1
|
675 retval |= PNG_INFO_pHYs;
|
nuclear@1
|
676 }
|
nuclear@1
|
677 if (res_y != NULL)
|
nuclear@1
|
678 {
|
nuclear@1
|
679 *res_y = info_ptr->y_pixels_per_unit;
|
nuclear@1
|
680 retval |= PNG_INFO_pHYs;
|
nuclear@1
|
681 }
|
nuclear@1
|
682 if (unit_type != NULL)
|
nuclear@1
|
683 {
|
nuclear@1
|
684 *unit_type = (int)info_ptr->phys_unit_type;
|
nuclear@1
|
685 retval |= PNG_INFO_pHYs;
|
nuclear@1
|
686 }
|
nuclear@1
|
687 }
|
nuclear@1
|
688 return (retval);
|
nuclear@1
|
689 }
|
nuclear@1
|
690 #endif
|
nuclear@1
|
691
|
nuclear@1
|
692 png_uint_32 PNGAPI
|
nuclear@1
|
693 png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
|
nuclear@1
|
694 int *num_palette)
|
nuclear@1
|
695 {
|
nuclear@1
|
696 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE)
|
nuclear@1
|
697 && palette != NULL)
|
nuclear@1
|
698 {
|
nuclear@1
|
699 png_debug1(1, "in %s retrieval function\n", "PLTE");
|
nuclear@1
|
700 *palette = info_ptr->palette;
|
nuclear@1
|
701 *num_palette = info_ptr->num_palette;
|
nuclear@1
|
702 png_debug1(3, "num_palette = %d\n", *num_palette);
|
nuclear@1
|
703 return (PNG_INFO_PLTE);
|
nuclear@1
|
704 }
|
nuclear@1
|
705 return (0);
|
nuclear@1
|
706 }
|
nuclear@1
|
707
|
nuclear@1
|
708 #if defined(PNG_sBIT_SUPPORTED)
|
nuclear@1
|
709 png_uint_32 PNGAPI
|
nuclear@1
|
710 png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
|
nuclear@1
|
711 {
|
nuclear@1
|
712 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)
|
nuclear@1
|
713 && sig_bit != NULL)
|
nuclear@1
|
714 {
|
nuclear@1
|
715 png_debug1(1, "in %s retrieval function\n", "sBIT");
|
nuclear@1
|
716 *sig_bit = &(info_ptr->sig_bit);
|
nuclear@1
|
717 return (PNG_INFO_sBIT);
|
nuclear@1
|
718 }
|
nuclear@1
|
719 return (0);
|
nuclear@1
|
720 }
|
nuclear@1
|
721 #endif
|
nuclear@1
|
722
|
nuclear@1
|
723 #if defined(PNG_TEXT_SUPPORTED)
|
nuclear@1
|
724 png_uint_32 PNGAPI
|
nuclear@1
|
725 png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
|
nuclear@1
|
726 int *num_text)
|
nuclear@1
|
727 {
|
nuclear@1
|
728 if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
|
nuclear@1
|
729 {
|
nuclear@1
|
730 png_debug1(1, "in %s retrieval function\n",
|
nuclear@1
|
731 (png_ptr->chunk_name[0] == '\0' ? "text"
|
nuclear@1
|
732 : (png_const_charp)png_ptr->chunk_name));
|
nuclear@1
|
733 if (text_ptr != NULL)
|
nuclear@1
|
734 *text_ptr = info_ptr->text;
|
nuclear@1
|
735 if (num_text != NULL)
|
nuclear@1
|
736 *num_text = info_ptr->num_text;
|
nuclear@1
|
737 return ((png_uint_32)info_ptr->num_text);
|
nuclear@1
|
738 }
|
nuclear@1
|
739 if (num_text != NULL)
|
nuclear@1
|
740 *num_text = 0;
|
nuclear@1
|
741 return(0);
|
nuclear@1
|
742 }
|
nuclear@1
|
743 #endif
|
nuclear@1
|
744
|
nuclear@1
|
745 #if defined(PNG_tIME_SUPPORTED)
|
nuclear@1
|
746 png_uint_32 PNGAPI
|
nuclear@1
|
747 png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
|
nuclear@1
|
748 {
|
nuclear@1
|
749 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)
|
nuclear@1
|
750 && mod_time != NULL)
|
nuclear@1
|
751 {
|
nuclear@1
|
752 png_debug1(1, "in %s retrieval function\n", "tIME");
|
nuclear@1
|
753 *mod_time = &(info_ptr->mod_time);
|
nuclear@1
|
754 return (PNG_INFO_tIME);
|
nuclear@1
|
755 }
|
nuclear@1
|
756 return (0);
|
nuclear@1
|
757 }
|
nuclear@1
|
758 #endif
|
nuclear@1
|
759
|
nuclear@1
|
760 #if defined(PNG_tRNS_SUPPORTED)
|
nuclear@1
|
761 png_uint_32 PNGAPI
|
nuclear@1
|
762 png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
|
nuclear@1
|
763 png_bytep *trans, int *num_trans, png_color_16p *trans_values)
|
nuclear@1
|
764 {
|
nuclear@1
|
765 png_uint_32 retval = 0;
|
nuclear@1
|
766 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
|
nuclear@1
|
767 {
|
nuclear@1
|
768 png_debug1(1, "in %s retrieval function\n", "tRNS");
|
nuclear@1
|
769 if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
nuclear@1
|
770 {
|
nuclear@1
|
771 if (trans != NULL)
|
nuclear@1
|
772 {
|
nuclear@1
|
773 *trans = info_ptr->trans;
|
nuclear@1
|
774 retval |= PNG_INFO_tRNS;
|
nuclear@1
|
775 }
|
nuclear@1
|
776 if (trans_values != NULL)
|
nuclear@1
|
777 *trans_values = &(info_ptr->trans_values);
|
nuclear@1
|
778 }
|
nuclear@1
|
779 else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */
|
nuclear@1
|
780 {
|
nuclear@1
|
781 if (trans_values != NULL)
|
nuclear@1
|
782 {
|
nuclear@1
|
783 *trans_values = &(info_ptr->trans_values);
|
nuclear@1
|
784 retval |= PNG_INFO_tRNS;
|
nuclear@1
|
785 }
|
nuclear@1
|
786 if (trans != NULL)
|
nuclear@1
|
787 *trans = NULL;
|
nuclear@1
|
788 }
|
nuclear@1
|
789 if (num_trans != NULL)
|
nuclear@1
|
790 {
|
nuclear@1
|
791 *num_trans = info_ptr->num_trans;
|
nuclear@1
|
792 retval |= PNG_INFO_tRNS;
|
nuclear@1
|
793 }
|
nuclear@1
|
794 }
|
nuclear@1
|
795 return (retval);
|
nuclear@1
|
796 }
|
nuclear@1
|
797 #endif
|
nuclear@1
|
798
|
nuclear@1
|
799 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
nuclear@1
|
800 png_uint_32 PNGAPI
|
nuclear@1
|
801 png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
|
nuclear@1
|
802 png_unknown_chunkpp unknowns)
|
nuclear@1
|
803 {
|
nuclear@1
|
804 if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL)
|
nuclear@1
|
805 {
|
nuclear@1
|
806 *unknowns = info_ptr->unknown_chunks;
|
nuclear@1
|
807 return ((png_uint_32)info_ptr->unknown_chunks_num);
|
nuclear@1
|
808 }
|
nuclear@1
|
809 return (0);
|
nuclear@1
|
810 }
|
nuclear@1
|
811 #endif
|
nuclear@1
|
812
|
nuclear@1
|
813 #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
|
nuclear@1
|
814 png_byte PNGAPI
|
nuclear@1
|
815 png_get_rgb_to_gray_status (png_structp png_ptr)
|
nuclear@1
|
816 {
|
nuclear@1
|
817 return (png_byte)(png_ptr? png_ptr->rgb_to_gray_status : 0);
|
nuclear@1
|
818 }
|
nuclear@1
|
819 #endif
|
nuclear@1
|
820
|
nuclear@1
|
821 #if defined(PNG_USER_CHUNKS_SUPPORTED)
|
nuclear@1
|
822 png_voidp PNGAPI
|
nuclear@1
|
823 png_get_user_chunk_ptr(png_structp png_ptr)
|
nuclear@1
|
824 {
|
nuclear@1
|
825 return (png_ptr? png_ptr->user_chunk_ptr : NULL);
|
nuclear@1
|
826 }
|
nuclear@1
|
827 #endif
|
nuclear@1
|
828
|
nuclear@1
|
829 #ifdef PNG_WRITE_SUPPORTED
|
nuclear@1
|
830 png_uint_32 PNGAPI
|
nuclear@1
|
831 png_get_compression_buffer_size(png_structp png_ptr)
|
nuclear@1
|
832 {
|
nuclear@1
|
833 return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L);
|
nuclear@1
|
834 }
|
nuclear@1
|
835 #endif
|
nuclear@1
|
836
|
nuclear@1
|
837 #ifdef PNG_ASSEMBLER_CODE_SUPPORTED
|
nuclear@1
|
838 #ifndef PNG_1_0_X
|
nuclear@1
|
839 /* this function was added to libpng 1.2.0 and should exist by default */
|
nuclear@1
|
840 png_uint_32 PNGAPI
|
nuclear@1
|
841 png_get_asm_flags (png_structp png_ptr)
|
nuclear@1
|
842 {
|
nuclear@1
|
843 /* obsolete, to be removed from libpng-1.4.0 */
|
nuclear@1
|
844 return (png_ptr? 0L: 0L);
|
nuclear@1
|
845 }
|
nuclear@1
|
846
|
nuclear@1
|
847 /* this function was added to libpng 1.2.0 and should exist by default */
|
nuclear@1
|
848 png_uint_32 PNGAPI
|
nuclear@1
|
849 png_get_asm_flagmask (int flag_select)
|
nuclear@1
|
850 {
|
nuclear@1
|
851 /* obsolete, to be removed from libpng-1.4.0 */
|
nuclear@1
|
852 flag_select=flag_select;
|
nuclear@1
|
853 return 0L;
|
nuclear@1
|
854 }
|
nuclear@1
|
855
|
nuclear@1
|
856 /* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */
|
nuclear@1
|
857 /* this function was added to libpng 1.2.0 */
|
nuclear@1
|
858 png_uint_32 PNGAPI
|
nuclear@1
|
859 png_get_mmx_flagmask (int flag_select, int *compilerID)
|
nuclear@1
|
860 {
|
nuclear@1
|
861 /* obsolete, to be removed from libpng-1.4.0 */
|
nuclear@1
|
862 flag_select=flag_select;
|
nuclear@1
|
863 *compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */
|
nuclear@1
|
864 return 0L;
|
nuclear@1
|
865 }
|
nuclear@1
|
866
|
nuclear@1
|
867 /* this function was added to libpng 1.2.0 */
|
nuclear@1
|
868 png_byte PNGAPI
|
nuclear@1
|
869 png_get_mmx_bitdepth_threshold (png_structp png_ptr)
|
nuclear@1
|
870 {
|
nuclear@1
|
871 /* obsolete, to be removed from libpng-1.4.0 */
|
nuclear@1
|
872 return (png_ptr? 0: 0);
|
nuclear@1
|
873 }
|
nuclear@1
|
874
|
nuclear@1
|
875 /* this function was added to libpng 1.2.0 */
|
nuclear@1
|
876 png_uint_32 PNGAPI
|
nuclear@1
|
877 png_get_mmx_rowbytes_threshold (png_structp png_ptr)
|
nuclear@1
|
878 {
|
nuclear@1
|
879 /* obsolete, to be removed from libpng-1.4.0 */
|
nuclear@1
|
880 return (png_ptr? 0L: 0L);
|
nuclear@1
|
881 }
|
nuclear@1
|
882 #endif /* ?PNG_1_0_X */
|
nuclear@1
|
883 #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
|
nuclear@1
|
884
|
nuclear@1
|
885 #ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
nuclear@1
|
886 /* these functions were added to libpng 1.2.6 */
|
nuclear@1
|
887 png_uint_32 PNGAPI
|
nuclear@1
|
888 png_get_user_width_max (png_structp png_ptr)
|
nuclear@1
|
889 {
|
nuclear@1
|
890 return (png_ptr? png_ptr->user_width_max : 0);
|
nuclear@1
|
891 }
|
nuclear@1
|
892 png_uint_32 PNGAPI
|
nuclear@1
|
893 png_get_user_height_max (png_structp png_ptr)
|
nuclear@1
|
894 {
|
nuclear@1
|
895 return (png_ptr? png_ptr->user_height_max : 0);
|
nuclear@1
|
896 }
|
nuclear@1
|
897 #endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
nuclear@1
|
898
|
nuclear@1
|
899
|
nuclear@1
|
900 #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|