Bug 1874684 - Part 28: Return DateDuration from DifferenceISODateTime. r=mgaudet
[gecko.git] / media / libpng / pngget.c
blob9c7977b2878596c94661631dadc74a06e5c42808
2 /* pngget.c - retrieval of values from info struct
4 * Copyright (c) 2018-2024 Cosmin Truta
5 * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
6 * Copyright (c) 1996-1997 Andreas Dilger
7 * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
9 * This code is released under the libpng license.
10 * For conditions of distribution and use, see the disclaimer
11 * and license in png.h
15 #include "pngpriv.h"
17 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
19 png_uint_32 PNGAPI
20 png_get_valid(png_const_structrp png_ptr, png_const_inforp info_ptr,
21 png_uint_32 flag)
23 if (png_ptr != NULL && info_ptr != NULL)
25 #ifdef PNG_READ_tRNS_SUPPORTED
26 /* png_handle_PLTE() may have canceled a valid tRNS chunk but left the
27 * 'valid' flag for the detection of duplicate chunks. Do not report a
28 * valid tRNS chunk in this case.
30 if (flag == PNG_INFO_tRNS && png_ptr->num_trans == 0)
31 return 0;
32 #endif
34 return info_ptr->valid & flag;
37 return 0;
40 size_t PNGAPI
41 png_get_rowbytes(png_const_structrp png_ptr, png_const_inforp info_ptr)
43 if (png_ptr != NULL && info_ptr != NULL)
44 return info_ptr->rowbytes;
46 return 0;
49 #ifdef PNG_INFO_IMAGE_SUPPORTED
50 png_bytepp PNGAPI
51 png_get_rows(png_const_structrp png_ptr, png_const_inforp info_ptr)
53 if (png_ptr != NULL && info_ptr != NULL)
54 return info_ptr->row_pointers;
56 return 0;
58 #endif
60 #ifdef PNG_EASY_ACCESS_SUPPORTED
61 /* Easy access to info, added in libpng-0.99 */
62 png_uint_32 PNGAPI
63 png_get_image_width(png_const_structrp png_ptr, png_const_inforp info_ptr)
65 if (png_ptr != NULL && info_ptr != NULL)
66 return info_ptr->width;
68 return 0;
71 png_uint_32 PNGAPI
72 png_get_image_height(png_const_structrp png_ptr, png_const_inforp info_ptr)
74 if (png_ptr != NULL && info_ptr != NULL)
75 return info_ptr->height;
77 return 0;
80 png_byte PNGAPI
81 png_get_bit_depth(png_const_structrp png_ptr, png_const_inforp info_ptr)
83 if (png_ptr != NULL && info_ptr != NULL)
84 return info_ptr->bit_depth;
86 return 0;
89 png_byte PNGAPI
90 png_get_color_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
92 if (png_ptr != NULL && info_ptr != NULL)
93 return info_ptr->color_type;
95 return 0;
98 png_byte PNGAPI
99 png_get_filter_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
101 if (png_ptr != NULL && info_ptr != NULL)
102 return info_ptr->filter_type;
104 return 0;
107 png_byte PNGAPI
108 png_get_interlace_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
110 if (png_ptr != NULL && info_ptr != NULL)
111 return info_ptr->interlace_type;
113 return 0;
116 png_byte PNGAPI
117 png_get_compression_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
119 if (png_ptr != NULL && info_ptr != NULL)
120 return info_ptr->compression_type;
122 return 0;
125 png_uint_32 PNGAPI
126 png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
127 info_ptr)
129 #ifdef PNG_pHYs_SUPPORTED
130 png_debug(1, "in png_get_x_pixels_per_meter");
132 if (png_ptr != NULL && info_ptr != NULL &&
133 (info_ptr->valid & PNG_INFO_pHYs) != 0)
135 if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
136 return info_ptr->x_pixels_per_unit;
138 #else
139 PNG_UNUSED(png_ptr)
140 PNG_UNUSED(info_ptr)
141 #endif
143 return 0;
146 png_uint_32 PNGAPI
147 png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
148 info_ptr)
150 #ifdef PNG_pHYs_SUPPORTED
151 png_debug(1, "in png_get_y_pixels_per_meter");
153 if (png_ptr != NULL && info_ptr != NULL &&
154 (info_ptr->valid & PNG_INFO_pHYs) != 0)
156 if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
157 return info_ptr->y_pixels_per_unit;
159 #else
160 PNG_UNUSED(png_ptr)
161 PNG_UNUSED(info_ptr)
162 #endif
164 return 0;
167 png_uint_32 PNGAPI
168 png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
170 #ifdef PNG_pHYs_SUPPORTED
171 png_debug(1, "in png_get_pixels_per_meter");
173 if (png_ptr != NULL && info_ptr != NULL &&
174 (info_ptr->valid & PNG_INFO_pHYs) != 0)
176 if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER &&
177 info_ptr->x_pixels_per_unit == info_ptr->y_pixels_per_unit)
178 return info_ptr->x_pixels_per_unit;
180 #else
181 PNG_UNUSED(png_ptr)
182 PNG_UNUSED(info_ptr)
183 #endif
185 return 0;
188 #ifdef PNG_FLOATING_POINT_SUPPORTED
189 float PNGAPI
190 png_get_pixel_aspect_ratio(png_const_structrp png_ptr, png_const_inforp
191 info_ptr)
193 #ifdef PNG_READ_pHYs_SUPPORTED
194 png_debug(1, "in png_get_pixel_aspect_ratio");
196 if (png_ptr != NULL && info_ptr != NULL &&
197 (info_ptr->valid & PNG_INFO_pHYs) != 0)
199 if (info_ptr->x_pixels_per_unit != 0)
200 return (float)info_ptr->y_pixels_per_unit
201 / (float)info_ptr->x_pixels_per_unit;
203 #else
204 PNG_UNUSED(png_ptr)
205 PNG_UNUSED(info_ptr)
206 #endif
208 return (float)0.0;
210 #endif
212 #ifdef PNG_FIXED_POINT_SUPPORTED
213 png_fixed_point PNGAPI
214 png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr,
215 png_const_inforp info_ptr)
217 #ifdef PNG_READ_pHYs_SUPPORTED
218 png_debug(1, "in png_get_pixel_aspect_ratio_fixed");
220 if (png_ptr != NULL && info_ptr != NULL &&
221 (info_ptr->valid & PNG_INFO_pHYs) != 0 &&
222 info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0 &&
223 info_ptr->x_pixels_per_unit <= PNG_UINT_31_MAX &&
224 info_ptr->y_pixels_per_unit <= PNG_UINT_31_MAX)
226 png_fixed_point res;
228 /* The following casts work because a PNG 4 byte integer only has a valid
229 * range of 0..2^31-1; otherwise the cast might overflow.
231 if (png_muldiv(&res, (png_int_32)info_ptr->y_pixels_per_unit, PNG_FP_1,
232 (png_int_32)info_ptr->x_pixels_per_unit) != 0)
233 return res;
235 #else
236 PNG_UNUSED(png_ptr)
237 PNG_UNUSED(info_ptr)
238 #endif
240 return 0;
242 #endif
244 png_int_32 PNGAPI
245 png_get_x_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
247 #ifdef PNG_oFFs_SUPPORTED
248 png_debug(1, "in png_get_x_offset_microns");
250 if (png_ptr != NULL && info_ptr != NULL &&
251 (info_ptr->valid & PNG_INFO_oFFs) != 0)
253 if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
254 return info_ptr->x_offset;
256 #else
257 PNG_UNUSED(png_ptr)
258 PNG_UNUSED(info_ptr)
259 #endif
261 return 0;
264 png_int_32 PNGAPI
265 png_get_y_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
267 #ifdef PNG_oFFs_SUPPORTED
268 png_debug(1, "in png_get_y_offset_microns");
270 if (png_ptr != NULL && info_ptr != NULL &&
271 (info_ptr->valid & PNG_INFO_oFFs) != 0)
273 if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
274 return info_ptr->y_offset;
276 #else
277 PNG_UNUSED(png_ptr)
278 PNG_UNUSED(info_ptr)
279 #endif
281 return 0;
284 png_int_32 PNGAPI
285 png_get_x_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
287 #ifdef PNG_oFFs_SUPPORTED
288 png_debug(1, "in png_get_x_offset_pixels");
290 if (png_ptr != NULL && info_ptr != NULL &&
291 (info_ptr->valid & PNG_INFO_oFFs) != 0)
293 if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
294 return info_ptr->x_offset;
296 #else
297 PNG_UNUSED(png_ptr)
298 PNG_UNUSED(info_ptr)
299 #endif
301 return 0;
304 png_int_32 PNGAPI
305 png_get_y_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
307 #ifdef PNG_oFFs_SUPPORTED
308 png_debug(1, "in png_get_y_offset_pixels");
310 if (png_ptr != NULL && info_ptr != NULL &&
311 (info_ptr->valid & PNG_INFO_oFFs) != 0)
313 if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
314 return info_ptr->y_offset;
316 #else
317 PNG_UNUSED(png_ptr)
318 PNG_UNUSED(info_ptr)
319 #endif
321 return 0;
324 #ifdef PNG_INCH_CONVERSIONS_SUPPORTED
325 static png_uint_32
326 ppi_from_ppm(png_uint_32 ppm)
328 #if 0
329 /* The conversion is *(2.54/100), in binary (32 digits):
330 * .00000110100000001001110101001001
332 png_uint_32 t1001, t1101;
333 ppm >>= 1; /* .1 */
334 t1001 = ppm + (ppm >> 3); /* .1001 */
335 t1101 = t1001 + (ppm >> 1); /* .1101 */
336 ppm >>= 20; /* .000000000000000000001 */
337 t1101 += t1101 >> 15; /* .1101000000000001101 */
338 t1001 >>= 11; /* .000000000001001 */
339 t1001 += t1001 >> 12; /* .000000000001001000000001001 */
340 ppm += t1001; /* .000000000001001000001001001 */
341 ppm += t1101; /* .110100000001001110101001001 */
342 return (ppm + 16) >> 5;/* .00000110100000001001110101001001 */
343 #else
344 /* The argument is a PNG unsigned integer, so it is not permitted
345 * to be bigger than 2^31.
347 png_fixed_point result;
348 if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, (png_int_32)ppm, 127,
349 5000) != 0)
350 return (png_uint_32)result;
352 /* Overflow. */
353 return 0;
354 #endif
357 png_uint_32 PNGAPI
358 png_get_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
360 return ppi_from_ppm(png_get_pixels_per_meter(png_ptr, info_ptr));
363 png_uint_32 PNGAPI
364 png_get_x_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
366 return ppi_from_ppm(png_get_x_pixels_per_meter(png_ptr, info_ptr));
369 png_uint_32 PNGAPI
370 png_get_y_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
372 return ppi_from_ppm(png_get_y_pixels_per_meter(png_ptr, info_ptr));
375 #ifdef PNG_FIXED_POINT_SUPPORTED
376 static png_fixed_point
377 png_fixed_inches_from_microns(png_const_structrp png_ptr, png_int_32 microns)
379 /* Convert from meters * 1,000,000 to inches * 100,000, meters to
380 * inches is simply *(100/2.54), so we want *(10/2.54) == 500/127.
381 * Notice that this can overflow - a warning is output and 0 is
382 * returned.
384 return png_muldiv_warn(png_ptr, microns, 500, 127);
387 png_fixed_point PNGAPI
388 png_get_x_offset_inches_fixed(png_const_structrp png_ptr,
389 png_const_inforp info_ptr)
391 return png_fixed_inches_from_microns(png_ptr,
392 png_get_x_offset_microns(png_ptr, info_ptr));
394 #endif
396 #ifdef PNG_FIXED_POINT_SUPPORTED
397 png_fixed_point PNGAPI
398 png_get_y_offset_inches_fixed(png_const_structrp png_ptr,
399 png_const_inforp info_ptr)
401 return png_fixed_inches_from_microns(png_ptr,
402 png_get_y_offset_microns(png_ptr, info_ptr));
404 #endif
406 #ifdef PNG_FLOATING_POINT_SUPPORTED
407 float PNGAPI
408 png_get_x_offset_inches(png_const_structrp png_ptr, png_const_inforp info_ptr)
410 /* To avoid the overflow do the conversion directly in floating
411 * point.
413 return (float)(png_get_x_offset_microns(png_ptr, info_ptr) * .00003937);
415 #endif
417 #ifdef PNG_FLOATING_POINT_SUPPORTED
418 float PNGAPI
419 png_get_y_offset_inches(png_const_structrp png_ptr, png_const_inforp info_ptr)
421 /* To avoid the overflow do the conversion directly in floating
422 * point.
424 return (float)(png_get_y_offset_microns(png_ptr, info_ptr) * .00003937);
426 #endif
428 #ifdef PNG_pHYs_SUPPORTED
429 png_uint_32 PNGAPI
430 png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
431 png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
433 png_uint_32 retval = 0;
435 png_debug1(1, "in %s retrieval function", "pHYs");
437 if (png_ptr != NULL && info_ptr != NULL &&
438 (info_ptr->valid & PNG_INFO_pHYs) != 0)
440 if (res_x != NULL)
442 *res_x = info_ptr->x_pixels_per_unit;
443 retval |= PNG_INFO_pHYs;
446 if (res_y != NULL)
448 *res_y = info_ptr->y_pixels_per_unit;
449 retval |= PNG_INFO_pHYs;
452 if (unit_type != NULL)
454 *unit_type = (int)info_ptr->phys_unit_type;
455 retval |= PNG_INFO_pHYs;
457 if (*unit_type == 1)
459 if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50);
460 if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50);
465 return retval;
467 #endif /* pHYs */
468 #endif /* INCH_CONVERSIONS */
470 /* png_get_channels really belongs in here, too, but it's been around longer */
472 #endif /* EASY_ACCESS */
475 png_byte PNGAPI
476 png_get_channels(png_const_structrp png_ptr, png_const_inforp info_ptr)
478 if (png_ptr != NULL && info_ptr != NULL)
479 return info_ptr->channels;
481 return 0;
484 #ifdef PNG_READ_SUPPORTED
485 png_const_bytep PNGAPI
486 png_get_signature(png_const_structrp png_ptr, png_const_inforp info_ptr)
488 if (png_ptr != NULL && info_ptr != NULL)
489 return info_ptr->signature;
491 return NULL;
493 #endif
495 #ifdef PNG_bKGD_SUPPORTED
496 png_uint_32 PNGAPI
497 png_get_bKGD(png_const_structrp png_ptr, png_inforp info_ptr,
498 png_color_16p *background)
500 png_debug1(1, "in %s retrieval function", "bKGD");
502 if (png_ptr != NULL && info_ptr != NULL &&
503 (info_ptr->valid & PNG_INFO_bKGD) != 0 &&
504 background != NULL)
506 *background = &(info_ptr->background);
507 return PNG_INFO_bKGD;
510 return 0;
512 #endif
514 #ifdef PNG_cHRM_SUPPORTED
515 /* The XYZ APIs were added in 1.5.5 to take advantage of the code added at the
516 * same time to correct the rgb grayscale coefficient defaults obtained from the
517 * cHRM chunk in 1.5.4
519 # ifdef PNG_FLOATING_POINT_SUPPORTED
520 png_uint_32 PNGAPI
521 png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
522 double *white_x, double *white_y, double *red_x, double *red_y,
523 double *green_x, double *green_y, double *blue_x, double *blue_y)
525 png_debug1(1, "in %s retrieval function", "cHRM");
527 /* Quiet API change: this code used to only return the end points if a cHRM
528 * chunk was present, but the end points can also come from iCCP or sRGB
529 * chunks, so in 1.6.0 the png_get_ APIs return the end points regardless and
530 * the png_set_ APIs merely check that set end points are mutually
531 * consistent.
533 if (png_ptr != NULL && info_ptr != NULL &&
534 (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
536 if (white_x != NULL)
537 *white_x = png_float(png_ptr,
538 info_ptr->colorspace.end_points_xy.whitex, "cHRM white X");
539 if (white_y != NULL)
540 *white_y = png_float(png_ptr,
541 info_ptr->colorspace.end_points_xy.whitey, "cHRM white Y");
542 if (red_x != NULL)
543 *red_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.redx,
544 "cHRM red X");
545 if (red_y != NULL)
546 *red_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.redy,
547 "cHRM red Y");
548 if (green_x != NULL)
549 *green_x = png_float(png_ptr,
550 info_ptr->colorspace.end_points_xy.greenx, "cHRM green X");
551 if (green_y != NULL)
552 *green_y = png_float(png_ptr,
553 info_ptr->colorspace.end_points_xy.greeny, "cHRM green Y");
554 if (blue_x != NULL)
555 *blue_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluex,
556 "cHRM blue X");
557 if (blue_y != NULL)
558 *blue_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluey,
559 "cHRM blue Y");
560 return PNG_INFO_cHRM;
563 return 0;
566 png_uint_32 PNGAPI
567 png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr,
568 double *red_X, double *red_Y, double *red_Z, double *green_X,
569 double *green_Y, double *green_Z, double *blue_X, double *blue_Y,
570 double *blue_Z)
572 png_debug1(1, "in %s retrieval function", "cHRM_XYZ(float)");
574 if (png_ptr != NULL && info_ptr != NULL &&
575 (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
577 if (red_X != NULL)
578 *red_X = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_X,
579 "cHRM red X");
580 if (red_Y != NULL)
581 *red_Y = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_Y,
582 "cHRM red Y");
583 if (red_Z != NULL)
584 *red_Z = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_Z,
585 "cHRM red Z");
586 if (green_X != NULL)
587 *green_X = png_float(png_ptr,
588 info_ptr->colorspace.end_points_XYZ.green_X, "cHRM green X");
589 if (green_Y != NULL)
590 *green_Y = png_float(png_ptr,
591 info_ptr->colorspace.end_points_XYZ.green_Y, "cHRM green Y");
592 if (green_Z != NULL)
593 *green_Z = png_float(png_ptr,
594 info_ptr->colorspace.end_points_XYZ.green_Z, "cHRM green Z");
595 if (blue_X != NULL)
596 *blue_X = png_float(png_ptr,
597 info_ptr->colorspace.end_points_XYZ.blue_X, "cHRM blue X");
598 if (blue_Y != NULL)
599 *blue_Y = png_float(png_ptr,
600 info_ptr->colorspace.end_points_XYZ.blue_Y, "cHRM blue Y");
601 if (blue_Z != NULL)
602 *blue_Z = png_float(png_ptr,
603 info_ptr->colorspace.end_points_XYZ.blue_Z, "cHRM blue Z");
604 return PNG_INFO_cHRM;
607 return 0;
609 # endif
611 # ifdef PNG_FIXED_POINT_SUPPORTED
612 png_uint_32 PNGAPI
613 png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
614 png_fixed_point *int_red_X, png_fixed_point *int_red_Y,
615 png_fixed_point *int_red_Z, png_fixed_point *int_green_X,
616 png_fixed_point *int_green_Y, png_fixed_point *int_green_Z,
617 png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y,
618 png_fixed_point *int_blue_Z)
620 png_debug1(1, "in %s retrieval function", "cHRM_XYZ");
622 if (png_ptr != NULL && info_ptr != NULL &&
623 (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
625 if (int_red_X != NULL)
626 *int_red_X = info_ptr->colorspace.end_points_XYZ.red_X;
627 if (int_red_Y != NULL)
628 *int_red_Y = info_ptr->colorspace.end_points_XYZ.red_Y;
629 if (int_red_Z != NULL)
630 *int_red_Z = info_ptr->colorspace.end_points_XYZ.red_Z;
631 if (int_green_X != NULL)
632 *int_green_X = info_ptr->colorspace.end_points_XYZ.green_X;
633 if (int_green_Y != NULL)
634 *int_green_Y = info_ptr->colorspace.end_points_XYZ.green_Y;
635 if (int_green_Z != NULL)
636 *int_green_Z = info_ptr->colorspace.end_points_XYZ.green_Z;
637 if (int_blue_X != NULL)
638 *int_blue_X = info_ptr->colorspace.end_points_XYZ.blue_X;
639 if (int_blue_Y != NULL)
640 *int_blue_Y = info_ptr->colorspace.end_points_XYZ.blue_Y;
641 if (int_blue_Z != NULL)
642 *int_blue_Z = info_ptr->colorspace.end_points_XYZ.blue_Z;
643 return PNG_INFO_cHRM;
646 return 0;
649 png_uint_32 PNGAPI
650 png_get_cHRM_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
651 png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x,
652 png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
653 png_fixed_point *blue_x, png_fixed_point *blue_y)
655 png_debug1(1, "in %s retrieval function", "cHRM");
657 if (png_ptr != NULL && info_ptr != NULL &&
658 (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
660 if (white_x != NULL)
661 *white_x = info_ptr->colorspace.end_points_xy.whitex;
662 if (white_y != NULL)
663 *white_y = info_ptr->colorspace.end_points_xy.whitey;
664 if (red_x != NULL)
665 *red_x = info_ptr->colorspace.end_points_xy.redx;
666 if (red_y != NULL)
667 *red_y = info_ptr->colorspace.end_points_xy.redy;
668 if (green_x != NULL)
669 *green_x = info_ptr->colorspace.end_points_xy.greenx;
670 if (green_y != NULL)
671 *green_y = info_ptr->colorspace.end_points_xy.greeny;
672 if (blue_x != NULL)
673 *blue_x = info_ptr->colorspace.end_points_xy.bluex;
674 if (blue_y != NULL)
675 *blue_y = info_ptr->colorspace.end_points_xy.bluey;
676 return PNG_INFO_cHRM;
679 return 0;
681 # endif
682 #endif
684 #ifdef PNG_gAMA_SUPPORTED
685 # ifdef PNG_FIXED_POINT_SUPPORTED
686 png_uint_32 PNGAPI
687 png_get_gAMA_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
688 png_fixed_point *file_gamma)
690 png_debug1(1, "in %s retrieval function", "gAMA");
692 if (png_ptr != NULL && info_ptr != NULL &&
693 (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
694 file_gamma != NULL)
696 *file_gamma = info_ptr->colorspace.gamma;
697 return PNG_INFO_gAMA;
700 return 0;
702 # endif
704 # ifdef PNG_FLOATING_POINT_SUPPORTED
705 png_uint_32 PNGAPI
706 png_get_gAMA(png_const_structrp png_ptr, png_const_inforp info_ptr,
707 double *file_gamma)
709 png_debug1(1, "in %s retrieval function", "gAMA(float)");
711 if (png_ptr != NULL && info_ptr != NULL &&
712 (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
713 file_gamma != NULL)
715 *file_gamma = png_float(png_ptr, info_ptr->colorspace.gamma,
716 "png_get_gAMA");
717 return PNG_INFO_gAMA;
720 return 0;
722 # endif
723 #endif
725 #ifdef PNG_sRGB_SUPPORTED
726 png_uint_32 PNGAPI
727 png_get_sRGB(png_const_structrp png_ptr, png_const_inforp info_ptr,
728 int *file_srgb_intent)
730 png_debug1(1, "in %s retrieval function", "sRGB");
732 if (png_ptr != NULL && info_ptr != NULL &&
733 (info_ptr->valid & PNG_INFO_sRGB) != 0 && file_srgb_intent != NULL)
735 *file_srgb_intent = info_ptr->colorspace.rendering_intent;
736 return PNG_INFO_sRGB;
739 return 0;
741 #endif
743 #ifdef PNG_iCCP_SUPPORTED
744 png_uint_32 PNGAPI
745 png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
746 png_charpp name, int *compression_type,
747 png_bytepp profile, png_uint_32 *proflen)
749 png_debug1(1, "in %s retrieval function", "iCCP");
751 if (png_ptr != NULL && info_ptr != NULL &&
752 (info_ptr->valid & PNG_INFO_iCCP) != 0 &&
753 name != NULL && profile != NULL && proflen != NULL)
755 *name = info_ptr->iccp_name;
756 *profile = info_ptr->iccp_profile;
757 *proflen = png_get_uint_32(info_ptr->iccp_profile);
758 /* This is somewhat irrelevant since the profile data returned has
759 * actually been uncompressed.
761 if (compression_type != NULL)
762 *compression_type = PNG_COMPRESSION_TYPE_BASE;
763 return PNG_INFO_iCCP;
766 return 0;
769 #endif
771 #ifdef PNG_sPLT_SUPPORTED
772 int PNGAPI
773 png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
774 png_sPLT_tpp spalettes)
776 png_debug1(1, "in %s retrieval function", "sPLT");
778 if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
780 *spalettes = info_ptr->splt_palettes;
781 return info_ptr->splt_palettes_num;
784 return 0;
786 #endif
788 #ifdef PNG_eXIf_SUPPORTED
789 png_uint_32 PNGAPI
790 png_get_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
791 png_bytep *exif)
793 png_warning(png_ptr, "png_get_eXIf does not work; use png_get_eXIf_1");
794 PNG_UNUSED(info_ptr)
795 PNG_UNUSED(exif)
796 return 0;
799 png_uint_32 PNGAPI
800 png_get_eXIf_1(png_const_structrp png_ptr, png_const_inforp info_ptr,
801 png_uint_32 *num_exif, png_bytep *exif)
803 png_debug1(1, "in %s retrieval function", "eXIf");
805 if (png_ptr != NULL && info_ptr != NULL &&
806 (info_ptr->valid & PNG_INFO_eXIf) != 0 && exif != NULL)
808 *num_exif = info_ptr->num_exif;
809 *exif = info_ptr->exif;
810 return PNG_INFO_eXIf;
813 return 0;
815 #endif
817 #ifdef PNG_hIST_SUPPORTED
818 png_uint_32 PNGAPI
819 png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
820 png_uint_16p *hist)
822 png_debug1(1, "in %s retrieval function", "hIST");
824 if (png_ptr != NULL && info_ptr != NULL &&
825 (info_ptr->valid & PNG_INFO_hIST) != 0 && hist != NULL)
827 *hist = info_ptr->hist;
828 return PNG_INFO_hIST;
831 return 0;
833 #endif
835 png_uint_32 PNGAPI
836 png_get_IHDR(png_const_structrp png_ptr, png_const_inforp info_ptr,
837 png_uint_32 *width, png_uint_32 *height, int *bit_depth,
838 int *color_type, int *interlace_type, int *compression_type,
839 int *filter_type)
841 png_debug1(1, "in %s retrieval function", "IHDR");
843 if (png_ptr == NULL || info_ptr == NULL)
844 return 0;
846 if (width != NULL)
847 *width = info_ptr->width;
849 if (height != NULL)
850 *height = info_ptr->height;
852 if (bit_depth != NULL)
853 *bit_depth = info_ptr->bit_depth;
855 if (color_type != NULL)
856 *color_type = info_ptr->color_type;
858 if (compression_type != NULL)
859 *compression_type = info_ptr->compression_type;
861 if (filter_type != NULL)
862 *filter_type = info_ptr->filter_type;
864 if (interlace_type != NULL)
865 *interlace_type = info_ptr->interlace_type;
867 /* This is redundant if we can be sure that the info_ptr values were all
868 * assigned in png_set_IHDR(). We do the check anyhow in case an
869 * application has ignored our advice not to mess with the members
870 * of info_ptr directly.
872 png_check_IHDR(png_ptr, info_ptr->width, info_ptr->height,
873 info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type,
874 info_ptr->compression_type, info_ptr->filter_type);
876 return 1;
879 #ifdef PNG_oFFs_SUPPORTED
880 png_uint_32 PNGAPI
881 png_get_oFFs(png_const_structrp png_ptr, png_const_inforp info_ptr,
882 png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
884 png_debug1(1, "in %s retrieval function", "oFFs");
886 if (png_ptr != NULL && info_ptr != NULL &&
887 (info_ptr->valid & PNG_INFO_oFFs) != 0 &&
888 offset_x != NULL && offset_y != NULL && unit_type != NULL)
890 *offset_x = info_ptr->x_offset;
891 *offset_y = info_ptr->y_offset;
892 *unit_type = (int)info_ptr->offset_unit_type;
893 return PNG_INFO_oFFs;
896 return 0;
898 #endif
900 #ifdef PNG_pCAL_SUPPORTED
901 png_uint_32 PNGAPI
902 png_get_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
903 png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
904 png_charp *units, png_charpp *params)
906 png_debug1(1, "in %s retrieval function", "pCAL");
908 if (png_ptr != NULL && info_ptr != NULL &&
909 (info_ptr->valid & PNG_INFO_pCAL) != 0 &&
910 purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
911 nparams != NULL && units != NULL && params != NULL)
913 *purpose = info_ptr->pcal_purpose;
914 *X0 = info_ptr->pcal_X0;
915 *X1 = info_ptr->pcal_X1;
916 *type = (int)info_ptr->pcal_type;
917 *nparams = (int)info_ptr->pcal_nparams;
918 *units = info_ptr->pcal_units;
919 *params = info_ptr->pcal_params;
920 return PNG_INFO_pCAL;
923 return 0;
925 #endif
927 #ifdef PNG_sCAL_SUPPORTED
928 # ifdef PNG_FIXED_POINT_SUPPORTED
929 # if defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) || \
930 defined(PNG_FLOATING_POINT_SUPPORTED)
931 png_uint_32 PNGAPI
932 png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
933 int *unit, png_fixed_point *width, png_fixed_point *height)
935 png_debug1(1, "in %s retrieval function", "sCAL");
937 if (png_ptr != NULL && info_ptr != NULL &&
938 (info_ptr->valid & PNG_INFO_sCAL) != 0)
940 *unit = info_ptr->scal_unit;
941 /*TODO: make this work without FP support; the API is currently eliminated
942 * if neither floating point APIs nor internal floating point arithmetic
943 * are enabled.
945 *width = png_fixed(png_ptr, atof(info_ptr->scal_s_width), "sCAL width");
946 *height = png_fixed(png_ptr, atof(info_ptr->scal_s_height),
947 "sCAL height");
948 return PNG_INFO_sCAL;
951 return 0;
953 # endif /* FLOATING_ARITHMETIC */
954 # endif /* FIXED_POINT */
955 # ifdef PNG_FLOATING_POINT_SUPPORTED
956 png_uint_32 PNGAPI
957 png_get_sCAL(png_const_structrp png_ptr, png_const_inforp info_ptr,
958 int *unit, double *width, double *height)
960 png_debug1(1, "in %s retrieval function", "sCAL(float)");
962 if (png_ptr != NULL && info_ptr != NULL &&
963 (info_ptr->valid & PNG_INFO_sCAL) != 0)
965 *unit = info_ptr->scal_unit;
966 *width = atof(info_ptr->scal_s_width);
967 *height = atof(info_ptr->scal_s_height);
968 return PNG_INFO_sCAL;
971 return 0;
973 # endif /* FLOATING POINT */
974 png_uint_32 PNGAPI
975 png_get_sCAL_s(png_const_structrp png_ptr, png_const_inforp info_ptr,
976 int *unit, png_charpp width, png_charpp height)
978 png_debug1(1, "in %s retrieval function", "sCAL(str)");
980 if (png_ptr != NULL && info_ptr != NULL &&
981 (info_ptr->valid & PNG_INFO_sCAL) != 0)
983 *unit = info_ptr->scal_unit;
984 *width = info_ptr->scal_s_width;
985 *height = info_ptr->scal_s_height;
986 return PNG_INFO_sCAL;
989 return 0;
991 #endif /* sCAL */
993 #ifdef PNG_pHYs_SUPPORTED
994 png_uint_32 PNGAPI
995 png_get_pHYs(png_const_structrp png_ptr, png_const_inforp info_ptr,
996 png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
998 png_uint_32 retval = 0;
1000 png_debug1(1, "in %s retrieval function", "pHYs");
1002 if (png_ptr != NULL && info_ptr != NULL &&
1003 (info_ptr->valid & PNG_INFO_pHYs) != 0)
1005 if (res_x != NULL)
1007 *res_x = info_ptr->x_pixels_per_unit;
1008 retval |= PNG_INFO_pHYs;
1011 if (res_y != NULL)
1013 *res_y = info_ptr->y_pixels_per_unit;
1014 retval |= PNG_INFO_pHYs;
1017 if (unit_type != NULL)
1019 *unit_type = (int)info_ptr->phys_unit_type;
1020 retval |= PNG_INFO_pHYs;
1024 return retval;
1026 #endif /* pHYs */
1028 png_uint_32 PNGAPI
1029 png_get_PLTE(png_const_structrp png_ptr, png_inforp info_ptr,
1030 png_colorp *palette, int *num_palette)
1032 png_debug1(1, "in %s retrieval function", "PLTE");
1034 if (png_ptr != NULL && info_ptr != NULL &&
1035 (info_ptr->valid & PNG_INFO_PLTE) != 0 && palette != NULL)
1037 *palette = info_ptr->palette;
1038 *num_palette = info_ptr->num_palette;
1039 png_debug1(3, "num_palette = %d", *num_palette);
1040 return PNG_INFO_PLTE;
1043 return 0;
1046 #ifdef PNG_sBIT_SUPPORTED
1047 png_uint_32 PNGAPI
1048 png_get_sBIT(png_const_structrp png_ptr, png_inforp info_ptr,
1049 png_color_8p *sig_bit)
1051 png_debug1(1, "in %s retrieval function", "sBIT");
1053 if (png_ptr != NULL && info_ptr != NULL &&
1054 (info_ptr->valid & PNG_INFO_sBIT) != 0 && sig_bit != NULL)
1056 *sig_bit = &(info_ptr->sig_bit);
1057 return PNG_INFO_sBIT;
1060 return 0;
1062 #endif
1064 #ifdef PNG_TEXT_SUPPORTED
1065 int PNGAPI
1066 png_get_text(png_const_structrp png_ptr, png_inforp info_ptr,
1067 png_textp *text_ptr, int *num_text)
1069 if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
1071 png_debug1(1, "in text retrieval function, chunk typeid = 0x%lx",
1072 (unsigned long)png_ptr->chunk_name);
1074 if (text_ptr != NULL)
1075 *text_ptr = info_ptr->text;
1077 if (num_text != NULL)
1078 *num_text = info_ptr->num_text;
1080 return info_ptr->num_text;
1083 if (num_text != NULL)
1084 *num_text = 0;
1086 return 0;
1088 #endif
1090 #ifdef PNG_tIME_SUPPORTED
1091 png_uint_32 PNGAPI
1092 png_get_tIME(png_const_structrp png_ptr, png_inforp info_ptr,
1093 png_timep *mod_time)
1095 png_debug1(1, "in %s retrieval function", "tIME");
1097 if (png_ptr != NULL && info_ptr != NULL &&
1098 (info_ptr->valid & PNG_INFO_tIME) != 0 && mod_time != NULL)
1100 *mod_time = &(info_ptr->mod_time);
1101 return PNG_INFO_tIME;
1104 return 0;
1106 #endif
1108 #ifdef PNG_tRNS_SUPPORTED
1109 png_uint_32 PNGAPI
1110 png_get_tRNS(png_const_structrp png_ptr, png_inforp info_ptr,
1111 png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
1113 png_uint_32 retval = 0;
1115 png_debug1(1, "in %s retrieval function", "tRNS");
1117 if (png_ptr != NULL && info_ptr != NULL &&
1118 (info_ptr->valid & PNG_INFO_tRNS) != 0)
1120 if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
1122 if (trans_alpha != NULL)
1124 *trans_alpha = info_ptr->trans_alpha;
1125 retval |= PNG_INFO_tRNS;
1128 if (trans_color != NULL)
1129 *trans_color = &(info_ptr->trans_color);
1132 else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */
1134 if (trans_color != NULL)
1136 *trans_color = &(info_ptr->trans_color);
1137 retval |= PNG_INFO_tRNS;
1140 if (trans_alpha != NULL)
1141 *trans_alpha = NULL;
1144 if (num_trans != NULL)
1146 *num_trans = info_ptr->num_trans;
1147 retval |= PNG_INFO_tRNS;
1151 return retval;
1153 #endif
1155 #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
1156 int PNGAPI
1157 png_get_unknown_chunks(png_const_structrp png_ptr, png_inforp info_ptr,
1158 png_unknown_chunkpp unknowns)
1160 if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL)
1162 *unknowns = info_ptr->unknown_chunks;
1163 return info_ptr->unknown_chunks_num;
1166 return 0;
1168 #endif
1170 #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
1171 png_byte PNGAPI
1172 png_get_rgb_to_gray_status(png_const_structrp png_ptr)
1174 return (png_byte)(png_ptr ? png_ptr->rgb_to_gray_status : 0);
1176 #endif
1178 #ifdef PNG_USER_CHUNKS_SUPPORTED
1179 png_voidp PNGAPI
1180 png_get_user_chunk_ptr(png_const_structrp png_ptr)
1182 return (png_ptr ? png_ptr->user_chunk_ptr : NULL);
1184 #endif
1186 size_t PNGAPI
1187 png_get_compression_buffer_size(png_const_structrp png_ptr)
1189 if (png_ptr == NULL)
1190 return 0;
1192 #ifdef PNG_WRITE_SUPPORTED
1193 if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
1194 #endif
1196 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
1197 return png_ptr->IDAT_read_size;
1198 #else
1199 return PNG_IDAT_READ_SIZE;
1200 #endif
1203 #ifdef PNG_WRITE_SUPPORTED
1204 else
1205 return png_ptr->zbuffer_size;
1206 #endif
1209 #ifdef PNG_SET_USER_LIMITS_SUPPORTED
1210 /* These functions were added to libpng 1.2.6 and were enabled
1211 * by default in libpng-1.4.0 */
1212 png_uint_32 PNGAPI
1213 png_get_user_width_max(png_const_structrp png_ptr)
1215 return (png_ptr ? png_ptr->user_width_max : 0);
1218 png_uint_32 PNGAPI
1219 png_get_user_height_max(png_const_structrp png_ptr)
1221 return (png_ptr ? png_ptr->user_height_max : 0);
1224 /* This function was added to libpng 1.4.0 */
1225 png_uint_32 PNGAPI
1226 png_get_chunk_cache_max(png_const_structrp png_ptr)
1228 return (png_ptr ? png_ptr->user_chunk_cache_max : 0);
1231 /* This function was added to libpng 1.4.1 */
1232 png_alloc_size_t PNGAPI
1233 png_get_chunk_malloc_max(png_const_structrp png_ptr)
1235 return (png_ptr ? png_ptr->user_chunk_malloc_max : 0);
1237 #endif /* SET_USER_LIMITS */
1239 /* These functions were added to libpng 1.4.0 */
1240 #ifdef PNG_IO_STATE_SUPPORTED
1241 png_uint_32 PNGAPI
1242 png_get_io_state(png_const_structrp png_ptr)
1244 return png_ptr->io_state;
1247 png_uint_32 PNGAPI
1248 png_get_io_chunk_type(png_const_structrp png_ptr)
1250 return png_ptr->chunk_name;
1252 #endif /* IO_STATE */
1254 #ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
1255 # ifdef PNG_GET_PALETTE_MAX_SUPPORTED
1256 int PNGAPI
1257 png_get_palette_max(png_const_structp png_ptr, png_const_infop info_ptr)
1259 if (png_ptr != NULL && info_ptr != NULL)
1260 return png_ptr->num_palette_max;
1262 return -1;
1264 # endif
1265 #endif
1267 #ifdef PNG_APNG_SUPPORTED
1268 png_uint_32 PNGAPI
1269 png_get_acTL(png_structp png_ptr, png_infop info_ptr,
1270 png_uint_32 *num_frames, png_uint_32 *num_plays)
1272 png_debug1(1, "in %s retrieval function", "acTL");
1274 if (png_ptr != NULL && info_ptr != NULL &&
1275 (info_ptr->valid & PNG_INFO_acTL) != 0 &&
1276 num_frames != NULL && num_plays != NULL)
1278 *num_frames = info_ptr->num_frames;
1279 *num_plays = info_ptr->num_plays;
1280 return (1);
1283 return (0);
1286 png_uint_32 PNGAPI
1287 png_get_num_frames(png_structp png_ptr, png_infop info_ptr)
1289 png_debug(1, "in png_get_num_frames()");
1291 if (png_ptr != NULL && info_ptr != NULL)
1292 return (info_ptr->num_frames);
1293 return (0);
1296 png_uint_32 PNGAPI
1297 png_get_num_plays(png_structp png_ptr, png_infop info_ptr)
1299 png_debug(1, "in png_get_num_plays()");
1301 if (png_ptr != NULL && info_ptr != NULL)
1302 return (info_ptr->num_plays);
1303 return (0);
1306 png_uint_32 PNGAPI
1307 png_get_next_frame_fcTL(png_structp png_ptr, png_infop info_ptr,
1308 png_uint_32 *width, png_uint_32 *height,
1309 png_uint_32 *x_offset, png_uint_32 *y_offset,
1310 png_uint_16 *delay_num, png_uint_16 *delay_den,
1311 png_byte *dispose_op, png_byte *blend_op)
1313 png_debug1(1, "in %s retrieval function", "fcTL");
1315 if (png_ptr != NULL && info_ptr != NULL &&
1316 (info_ptr->valid & PNG_INFO_fcTL) != 0 &&
1317 width != NULL && height != NULL &&
1318 x_offset != NULL && y_offset != NULL &&
1319 delay_num != NULL && delay_den != NULL &&
1320 dispose_op != NULL && blend_op != NULL)
1322 *width = info_ptr->next_frame_width;
1323 *height = info_ptr->next_frame_height;
1324 *x_offset = info_ptr->next_frame_x_offset;
1325 *y_offset = info_ptr->next_frame_y_offset;
1326 *delay_num = info_ptr->next_frame_delay_num;
1327 *delay_den = info_ptr->next_frame_delay_den;
1328 *dispose_op = info_ptr->next_frame_dispose_op;
1329 *blend_op = info_ptr->next_frame_blend_op;
1330 return (1);
1333 return (0);
1336 png_uint_32 PNGAPI
1337 png_get_next_frame_width(png_structp png_ptr, png_infop info_ptr)
1339 png_debug(1, "in png_get_next_frame_width()");
1341 if (png_ptr != NULL && info_ptr != NULL)
1342 return (info_ptr->next_frame_width);
1343 return (0);
1346 png_uint_32 PNGAPI
1347 png_get_next_frame_height(png_structp png_ptr, png_infop info_ptr)
1349 png_debug(1, "in png_get_next_frame_height()");
1351 if (png_ptr != NULL && info_ptr != NULL)
1352 return (info_ptr->next_frame_height);
1353 return (0);
1356 png_uint_32 PNGAPI
1357 png_get_next_frame_x_offset(png_structp png_ptr, png_infop info_ptr)
1359 png_debug(1, "in png_get_next_frame_x_offset()");
1361 if (png_ptr != NULL && info_ptr != NULL)
1362 return (info_ptr->next_frame_x_offset);
1363 return (0);
1366 png_uint_32 PNGAPI
1367 png_get_next_frame_y_offset(png_structp png_ptr, png_infop info_ptr)
1369 png_debug(1, "in png_get_next_frame_y_offset()");
1371 if (png_ptr != NULL && info_ptr != NULL)
1372 return (info_ptr->next_frame_y_offset);
1373 return (0);
1376 png_uint_16 PNGAPI
1377 png_get_next_frame_delay_num(png_structp png_ptr, png_infop info_ptr)
1379 png_debug(1, "in png_get_next_frame_delay_num()");
1381 if (png_ptr != NULL && info_ptr != NULL)
1382 return (info_ptr->next_frame_delay_num);
1383 return (0);
1386 png_uint_16 PNGAPI
1387 png_get_next_frame_delay_den(png_structp png_ptr, png_infop info_ptr)
1389 png_debug(1, "in png_get_next_frame_delay_den()");
1391 if (png_ptr != NULL && info_ptr != NULL)
1392 return (info_ptr->next_frame_delay_den);
1393 return (0);
1396 png_byte PNGAPI
1397 png_get_next_frame_dispose_op(png_structp png_ptr, png_infop info_ptr)
1399 png_debug(1, "in png_get_next_frame_dispose_op()");
1401 if (png_ptr != NULL && info_ptr != NULL)
1402 return (info_ptr->next_frame_dispose_op);
1403 return (0);
1406 png_byte PNGAPI
1407 png_get_next_frame_blend_op(png_structp png_ptr, png_infop info_ptr)
1409 png_debug(1, "in png_get_next_frame_blend_op()");
1411 if (png_ptr != NULL && info_ptr != NULL)
1412 return (info_ptr->next_frame_blend_op);
1413 return (0);
1416 png_byte PNGAPI
1417 png_get_first_frame_is_hidden(png_structp png_ptr, png_infop info_ptr)
1419 png_debug(1, "in png_first_frame_is_hidden()");
1421 if (png_ptr != NULL)
1422 return (png_byte)(png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN);
1424 PNG_UNUSED(info_ptr)
1426 return 0;
1428 #endif /* APNG */
1429 #endif /* READ || WRITE */