Visualization Library 2.0.0-b5

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

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