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


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat May 8 2021 02:42:40