blob: c31286852e9953e6b7ac05d8c2e0006df27e5934 [file] [log] [blame]
Andreas Dilger47a0c421997-05-16 02:46:07 -05001
2/* pngget.c - retrieval of values from info struct
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06003 *
Glenn Randers-Pehrson3358a982009-08-13 18:04:26 -05004 * Last changed in libpng 1.4.0 [August 13, 2009]
Glenn Randers-Pehrson79134c62009-02-14 10:32:18 -06005 * Copyright (c) 1998-2009 Glenn Randers-Pehrson
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05006 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
Glenn Randers-Pehrson3e61d792009-06-24 09:31:28 -05008 *
Glenn Randers-Pehrsonbfbf8652009-06-26 21:46:52 -05009 * This code is released under the libpng license.
Glenn Randers-Pehrsonc332bbc2009-06-25 13:43:50 -050010 * For conditions of distribution and use, see the disclaimer
Glenn Randers-Pehrson037023b2009-06-24 10:27:36 -050011 * and license in png.h
Glenn Randers-Pehrson3e61d792009-06-24 09:31:28 -050012 *
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060013 */
Andreas Dilger47a0c421997-05-16 02:46:07 -050014
Andreas Dilger47a0c421997-05-16 02:46:07 -050015#include "png.h"
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -060016#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -050017#include "pngpriv.h"
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -060018
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -050019png_uint_32 PNGAPI
Andreas Dilger47a0c421997-05-16 02:46:07 -050020png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
21{
Glenn Randers-Pehrsona357b991998-02-08 20:56:40 -060022 if (png_ptr != NULL && info_ptr != NULL)
Andreas Dilger47a0c421997-05-16 02:46:07 -050023 return(info_ptr->valid & flag);
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -050024
Andreas Dilger47a0c421997-05-16 02:46:07 -050025 else
26 return(0);
27}
28
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -050029png_size_t PNGAPI
Andreas Dilger47a0c421997-05-16 02:46:07 -050030png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
31{
Glenn Randers-Pehrsona357b991998-02-08 20:56:40 -060032 if (png_ptr != NULL && info_ptr != NULL)
Andreas Dilger47a0c421997-05-16 02:46:07 -050033 return(info_ptr->rowbytes);
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -050034
Andreas Dilger47a0c421997-05-16 02:46:07 -050035 else
36 return(0);
37}
38
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -060039#if defined(PNG_INFO_IMAGE_SUPPORTED)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -050040png_bytepp PNGAPI
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -060041png_get_rows(png_structp png_ptr, png_infop info_ptr)
42{
43 if (png_ptr != NULL && info_ptr != NULL)
44 return(info_ptr->row_pointers);
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -050045
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -060046 else
47 return(0);
48}
49#endif
50
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060051#ifdef PNG_EASY_ACCESS_SUPPORTED
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -050052/* Easy access to info, added in libpng-0.99 */
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -050053png_uint_32 PNGAPI
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060054png_get_image_width(png_structp png_ptr, png_infop info_ptr)
55{
Glenn Randers-Pehrsona357b991998-02-08 20:56:40 -060056 if (png_ptr != NULL && info_ptr != NULL)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060057 return info_ptr->width;
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -050058
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060059 return (0);
60}
61
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -050062png_uint_32 PNGAPI
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060063png_get_image_height(png_structp png_ptr, png_infop info_ptr)
64{
Glenn Randers-Pehrsona357b991998-02-08 20:56:40 -060065 if (png_ptr != NULL && info_ptr != NULL)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060066 return info_ptr->height;
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -050067
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060068 return (0);
69}
70
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -050071png_byte PNGAPI
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060072png_get_bit_depth(png_structp png_ptr, png_infop info_ptr)
73{
Glenn Randers-Pehrsona357b991998-02-08 20:56:40 -060074 if (png_ptr != NULL && info_ptr != NULL)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060075 return info_ptr->bit_depth;
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -050076
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060077 return (0);
78}
79
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -050080png_byte PNGAPI
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060081png_get_color_type(png_structp png_ptr, png_infop info_ptr)
82{
Glenn Randers-Pehrsona357b991998-02-08 20:56:40 -060083 if (png_ptr != NULL && info_ptr != NULL)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060084 return info_ptr->color_type;
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -050085
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060086 return (0);
87}
88
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -050089png_byte PNGAPI
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060090png_get_filter_type(png_structp png_ptr, png_infop info_ptr)
91{
Glenn Randers-Pehrsona357b991998-02-08 20:56:40 -060092 if (png_ptr != NULL && info_ptr != NULL)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060093 return info_ptr->filter_type;
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -050094
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060095 return (0);
96}
97
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -050098png_byte PNGAPI
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060099png_get_interlace_type(png_structp png_ptr, png_infop info_ptr)
100{
Glenn Randers-Pehrsona357b991998-02-08 20:56:40 -0600101 if (png_ptr != NULL && info_ptr != NULL)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600102 return info_ptr->interlace_type;
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500103
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600104 return (0);
105}
106
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500107png_byte PNGAPI
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600108png_get_compression_type(png_structp png_ptr, png_infop info_ptr)
109{
Glenn Randers-Pehrsona357b991998-02-08 20:56:40 -0600110 if (png_ptr != NULL && info_ptr != NULL)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600111 return info_ptr->compression_type;
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500112
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600113 return (0);
114}
115
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500116png_uint_32 PNGAPI
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600117png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
118{
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500119 if (png_ptr != NULL && info_ptr != NULL)
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600120#if defined(PNG_pHYs_SUPPORTED)
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500121 if (info_ptr->valid & PNG_INFO_pHYs)
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600122 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500123 png_debug1(1, "in %s retrieval function", "png_get_x_pixels_per_meter");
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500124
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -0500125 if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600126 return (0);
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500127
Glenn Randers-Pehrsond8eb62f2009-05-30 20:19:20 -0500128 else
129 return (info_ptr->x_pixels_per_unit);
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600130 }
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500131#else
132 return (0);
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600133#endif
134 return (0);
135}
136
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500137png_uint_32 PNGAPI
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600138png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
139{
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500140 if (png_ptr != NULL && info_ptr != NULL)
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600141#if defined(PNG_pHYs_SUPPORTED)
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500142 if (info_ptr->valid & PNG_INFO_pHYs)
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600143 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500144 png_debug1(1, "in %s retrieval function", "png_get_y_pixels_per_meter");
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500145
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -0500146 if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600147 return (0);
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500148
Glenn Randers-Pehrsond8eb62f2009-05-30 20:19:20 -0500149 else
150 return (info_ptr->y_pixels_per_unit);
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600151 }
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500152#else
153 return (0);
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600154#endif
155 return (0);
156}
157
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500158png_uint_32 PNGAPI
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600159png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
160{
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500161 if (png_ptr != NULL && info_ptr != NULL)
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600162#if defined(PNG_pHYs_SUPPORTED)
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500163 if (info_ptr->valid & PNG_INFO_pHYs)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600164 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500165 png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500166
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -0500167 if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER ||
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600168 info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600169 return (0);
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500170
Glenn Randers-Pehrsond8eb62f2009-05-30 20:19:20 -0500171 else
172 return (info_ptr->x_pixels_per_unit);
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600173 }
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500174#else
175 return (0);
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600176#endif
177 return (0);
178}
179
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600180#ifdef PNG_FLOATING_POINT_SUPPORTED
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500181float PNGAPI
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600182png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
183 {
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500184 if (png_ptr != NULL && info_ptr != NULL)
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600185#if defined(PNG_pHYs_SUPPORTED)
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500186
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500187 if (info_ptr->valid & PNG_INFO_pHYs)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600188 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500189 png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio");
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600190 if (info_ptr->x_pixels_per_unit == 0)
Glenn Randers-Pehrson0f881d61998-02-07 10:20:57 -0600191 return ((float)0.0);
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600192 else
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500193 return ((float)((float)info_ptr->y_pixels_per_unit
194 /(float)info_ptr->x_pixels_per_unit));
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600195 }
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500196#else
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500197 return (0.0);
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600198#endif
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500199 return ((float)0.0);
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600200}
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600201#endif
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600202
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500203png_int_32 PNGAPI
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600204png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
205{
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500206 if (png_ptr != NULL && info_ptr != NULL)
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600207#if defined(PNG_oFFs_SUPPORTED)
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500208
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500209 if (info_ptr->valid & PNG_INFO_oFFs)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600210 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500211 png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500212
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -0500213 if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600214 return (0);
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500215
Glenn Randers-Pehrsond8eb62f2009-05-30 20:19:20 -0500216 else
217 return (info_ptr->x_offset);
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600218 }
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500219#else
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500220 return (0);
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600221#endif
222 return (0);
223}
224
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500225png_int_32 PNGAPI
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600226png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
227{
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500228 if (png_ptr != NULL && info_ptr != NULL)
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500229
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600230#if defined(PNG_oFFs_SUPPORTED)
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500231 if (info_ptr->valid & PNG_INFO_oFFs)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600232 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500233 png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500234
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -0500235 if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600236 return (0);
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500237
Glenn Randers-Pehrsond8eb62f2009-05-30 20:19:20 -0500238 else
239 return (info_ptr->y_offset);
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600240 }
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500241#else
242 return (0);
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600243#endif
244 return (0);
245}
246
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500247png_int_32 PNGAPI
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600248png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
249{
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500250 if (png_ptr != NULL && info_ptr != NULL)
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500251
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600252#if defined(PNG_oFFs_SUPPORTED)
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500253 if (info_ptr->valid & PNG_INFO_oFFs)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600254 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500255 png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500256
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -0500257 if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600258 return (0);
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500259
Glenn Randers-Pehrsond8eb62f2009-05-30 20:19:20 -0500260 else
261 return (info_ptr->x_offset);
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600262 }
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500263#else
264 return (0);
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600265#endif
266 return (0);
267}
268
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500269png_int_32 PNGAPI
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600270png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
271{
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500272 if (png_ptr != NULL && info_ptr != NULL)
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500273
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600274#if defined(PNG_oFFs_SUPPORTED)
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500275 if (info_ptr->valid & PNG_INFO_oFFs)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600276 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500277 png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500278
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -0500279 if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600280 return (0);
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500281
Glenn Randers-Pehrsond8eb62f2009-05-30 20:19:20 -0500282 else
283 return (info_ptr->y_offset);
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600284 }
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500285#else
286 return (0);
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600287#endif
288 return (0);
289}
290
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600291#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500292png_uint_32 PNGAPI
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600293png_get_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
294{
295 return ((png_uint_32)((float)png_get_pixels_per_meter(png_ptr, info_ptr)
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500296 *.0254 +.5));
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600297}
298
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500299png_uint_32 PNGAPI
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600300png_get_x_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
301{
302 return ((png_uint_32)((float)png_get_x_pixels_per_meter(png_ptr, info_ptr)
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500303 *.0254 +.5));
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600304}
305
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500306png_uint_32 PNGAPI
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600307png_get_y_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
308{
309 return ((png_uint_32)((float)png_get_y_pixels_per_meter(png_ptr, info_ptr)
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500310 *.0254 +.5));
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600311}
312
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500313float PNGAPI
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600314png_get_x_offset_inches(png_structp png_ptr, png_infop info_ptr)
315{
316 return ((float)png_get_x_offset_microns(png_ptr, info_ptr)
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -0600317 *.00003937);
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600318}
319
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500320float PNGAPI
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600321png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
322{
323 return ((float)png_get_y_offset_microns(png_ptr, info_ptr)
Glenn Randers-Pehrson104622b2000-05-29 08:58:03 -0500324 *.00003937);
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600325}
326
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500327#if defined(PNG_pHYs_SUPPORTED)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500328png_uint_32 PNGAPI
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600329png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
330 png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
331{
332 png_uint_32 retval = 0;
333
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600334 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600335 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500336 png_debug1(1, "in %s retrieval function", "pHYs");
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600337 if (res_x != NULL)
338 {
339 *res_x = info_ptr->x_pixels_per_unit;
340 retval |= PNG_INFO_pHYs;
341 }
342 if (res_y != NULL)
343 {
344 *res_y = info_ptr->y_pixels_per_unit;
345 retval |= PNG_INFO_pHYs;
346 }
347 if (unit_type != NULL)
348 {
349 *unit_type = (int)info_ptr->phys_unit_type;
350 retval |= PNG_INFO_pHYs;
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -0500351 if (*unit_type == 1)
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600352 {
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -0600353 if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50);
354 if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50);
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600355 }
356 }
357 }
358 return (retval);
359}
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500360#endif /* PNG_pHYs_SUPPORTED */
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600361#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600362
363/* png_get_channels really belongs in here, too, but it's been around longer */
Glenn Randers-Pehrsonf7d1a171998-06-06 15:31:35 -0500364
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600365#endif /* PNG_EASY_ACCESS_SUPPORTED */
366
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500367png_byte PNGAPI
Andreas Dilger47a0c421997-05-16 02:46:07 -0500368png_get_channels(png_structp png_ptr, png_infop info_ptr)
369{
Glenn Randers-Pehrsona357b991998-02-08 20:56:40 -0600370 if (png_ptr != NULL && info_ptr != NULL)
Andreas Dilger47a0c421997-05-16 02:46:07 -0500371 return(info_ptr->channels);
372 else
Glenn Randers-Pehrson0f881d61998-02-07 10:20:57 -0600373 return (0);
Andreas Dilger47a0c421997-05-16 02:46:07 -0500374}
375
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500376png_bytep PNGAPI
Andreas Dilger47a0c421997-05-16 02:46:07 -0500377png_get_signature(png_structp png_ptr, png_infop info_ptr)
378{
Glenn Randers-Pehrsona357b991998-02-08 20:56:40 -0600379 if (png_ptr != NULL && info_ptr != NULL)
Andreas Dilger47a0c421997-05-16 02:46:07 -0500380 return(info_ptr->signature);
381 else
Glenn Randers-Pehrson0f881d61998-02-07 10:20:57 -0600382 return (NULL);
Andreas Dilger47a0c421997-05-16 02:46:07 -0500383}
384
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500385#if defined(PNG_bKGD_SUPPORTED)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500386png_uint_32 PNGAPI
Andreas Dilger47a0c421997-05-16 02:46:07 -0500387png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
388 png_color_16p *background)
389{
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600390 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD)
391 && background != NULL)
Andreas Dilger47a0c421997-05-16 02:46:07 -0500392 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500393 png_debug1(1, "in %s retrieval function", "bKGD");
Andreas Dilger47a0c421997-05-16 02:46:07 -0500394 *background = &(info_ptr->background);
395 return (PNG_INFO_bKGD);
396 }
397 return (0);
398}
399#endif
400
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500401#if defined(PNG_cHRM_SUPPORTED)
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600402#ifdef PNG_FLOATING_POINT_SUPPORTED
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500403png_uint_32 PNGAPI
Andreas Dilger47a0c421997-05-16 02:46:07 -0500404png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
405 double *white_x, double *white_y, double *red_x, double *red_y,
406 double *green_x, double *green_y, double *blue_x, double *blue_y)
407{
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600408 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
Andreas Dilger47a0c421997-05-16 02:46:07 -0500409 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500410 png_debug1(1, "in %s retrieval function", "cHRM");
Andreas Dilger47a0c421997-05-16 02:46:07 -0500411 if (white_x != NULL)
412 *white_x = (double)info_ptr->x_white;
413 if (white_y != NULL)
414 *white_y = (double)info_ptr->y_white;
415 if (red_x != NULL)
416 *red_x = (double)info_ptr->x_red;
417 if (red_y != NULL)
418 *red_y = (double)info_ptr->y_red;
419 if (green_x != NULL)
420 *green_x = (double)info_ptr->x_green;
421 if (green_y != NULL)
422 *green_y = (double)info_ptr->y_green;
423 if (blue_x != NULL)
424 *blue_x = (double)info_ptr->x_blue;
425 if (blue_y != NULL)
426 *blue_y = (double)info_ptr->y_blue;
427 return (PNG_INFO_cHRM);
428 }
429 return (0);
430}
431#endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600432#ifdef PNG_FIXED_POINT_SUPPORTED
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500433png_uint_32 PNGAPI
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600434png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600435 png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x,
436 png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
437 png_fixed_point *blue_x, png_fixed_point *blue_y)
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600438{
439 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
440 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500441 png_debug1(1, "in %s retrieval function", "cHRM");
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600442 if (white_x != NULL)
443 *white_x = info_ptr->int_x_white;
444 if (white_y != NULL)
445 *white_y = info_ptr->int_y_white;
446 if (red_x != NULL)
447 *red_x = info_ptr->int_x_red;
448 if (red_y != NULL)
449 *red_y = info_ptr->int_y_red;
450 if (green_x != NULL)
451 *green_x = info_ptr->int_x_green;
452 if (green_y != NULL)
453 *green_y = info_ptr->int_y_green;
454 if (blue_x != NULL)
455 *blue_x = info_ptr->int_x_blue;
456 if (blue_y != NULL)
457 *blue_y = info_ptr->int_y_blue;
458 return (PNG_INFO_cHRM);
459 }
460 return (0);
461}
462#endif
463#endif
Andreas Dilger47a0c421997-05-16 02:46:07 -0500464
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500465#if defined(PNG_gAMA_SUPPORTED)
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600466#ifdef PNG_FLOATING_POINT_SUPPORTED
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500467png_uint_32 PNGAPI
Andreas Dilger47a0c421997-05-16 02:46:07 -0500468png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
469{
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600470 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
471 && file_gamma != NULL)
Andreas Dilger47a0c421997-05-16 02:46:07 -0500472 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500473 png_debug1(1, "in %s retrieval function", "gAMA");
Andreas Dilger47a0c421997-05-16 02:46:07 -0500474 *file_gamma = (double)info_ptr->gamma;
475 return (PNG_INFO_gAMA);
476 }
477 return (0);
478}
479#endif
Glenn Randers-Pehrson6942d532000-05-01 09:31:54 -0500480#ifdef PNG_FIXED_POINT_SUPPORTED
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500481png_uint_32 PNGAPI
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600482png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600483 png_fixed_point *int_file_gamma)
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600484{
485 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
486 && int_file_gamma != NULL)
487 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500488 png_debug1(1, "in %s retrieval function", "gAMA");
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600489 *int_file_gamma = info_ptr->int_gamma;
490 return (PNG_INFO_gAMA);
491 }
492 return (0);
493}
494#endif
Glenn Randers-Pehrson6942d532000-05-01 09:31:54 -0500495#endif
Andreas Dilger47a0c421997-05-16 02:46:07 -0500496
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500497#if defined(PNG_sRGB_SUPPORTED)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500498png_uint_32 PNGAPI
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600499png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600500{
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600501 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
502 && file_srgb_intent != NULL)
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600503 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500504 png_debug1(1, "in %s retrieval function", "sRGB");
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600505 *file_srgb_intent = (int)info_ptr->srgb_intent;
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600506 return (PNG_INFO_sRGB);
507 }
508 return (0);
509}
510#endif
511
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500512#if defined(PNG_iCCP_SUPPORTED)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500513png_uint_32 PNGAPI
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600514png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
515 png_charpp name, int *compression_type,
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600516 png_charpp profile, png_uint_32 *proflen)
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600517{
518 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)
519 && name != NULL && profile != NULL && proflen != NULL)
520 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500521 png_debug1(1, "in %s retrieval function", "iCCP");
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600522 *name = info_ptr->iccp_name;
523 *profile = info_ptr->iccp_profile;
Glenn Randers-Pehrson4bb4d012009-05-20 12:45:29 -0500524 /* Compression_type is a dummy so the API won't have to change
525 * if we introduce multiple compression types later.
526 */
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600527 *proflen = (int)info_ptr->iccp_proflen;
528 *compression_type = (int)info_ptr->iccp_compression;
529 return (PNG_INFO_iCCP);
530 }
531 return (0);
532}
533#endif
534
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500535#if defined(PNG_sPLT_SUPPORTED)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500536png_uint_32 PNGAPI
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -0600537png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrson520a7642000-03-21 05:13:06 -0600538 png_sPLT_tpp spalettes)
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600539{
540 if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -0500541 {
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600542 *spalettes = info_ptr->splt_palettes;
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -0500543 return ((png_uint_32)info_ptr->splt_palettes_num);
544 }
545 return (0);
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600546}
547#endif
548
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500549#if defined(PNG_hIST_SUPPORTED)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500550png_uint_32 PNGAPI
Andreas Dilger47a0c421997-05-16 02:46:07 -0500551png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
552{
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600553 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
554 && hist != NULL)
Andreas Dilger47a0c421997-05-16 02:46:07 -0500555 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500556 png_debug1(1, "in %s retrieval function", "hIST");
Andreas Dilger47a0c421997-05-16 02:46:07 -0500557 *hist = info_ptr->hist;
558 return (PNG_INFO_hIST);
559 }
560 return (0);
561}
562#endif
563
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500564png_uint_32 PNGAPI
Andreas Dilger47a0c421997-05-16 02:46:07 -0500565png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
566 png_uint_32 *width, png_uint_32 *height, int *bit_depth,
567 int *color_type, int *interlace_type, int *compression_type,
568 int *filter_type)
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600569
Andreas Dilger47a0c421997-05-16 02:46:07 -0500570{
Glenn Randers-Pehrsona357b991998-02-08 20:56:40 -0600571 if (png_ptr != NULL && info_ptr != NULL && width != NULL && height != NULL &&
Andreas Dilger47a0c421997-05-16 02:46:07 -0500572 bit_depth != NULL && color_type != NULL)
573 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500574 png_debug1(1, "in %s retrieval function", "IHDR");
Andreas Dilger47a0c421997-05-16 02:46:07 -0500575 *width = info_ptr->width;
576 *height = info_ptr->height;
577 *bit_depth = info_ptr->bit_depth;
Glenn Randers-Pehrson73d57cb2002-03-25 18:49:08 -0600578 if (info_ptr->bit_depth < 1 || info_ptr->bit_depth > 16)
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500579 png_error(png_ptr, "Invalid bit depth");
580
Andreas Dilger47a0c421997-05-16 02:46:07 -0500581 *color_type = info_ptr->color_type;
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500582
Glenn Randers-Pehrson73d57cb2002-03-25 18:49:08 -0600583 if (info_ptr->color_type > 6)
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500584 png_error(png_ptr, "Invalid color type");
585
Andreas Dilger47a0c421997-05-16 02:46:07 -0500586 if (compression_type != NULL)
587 *compression_type = info_ptr->compression_type;
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500588
Andreas Dilger47a0c421997-05-16 02:46:07 -0500589 if (filter_type != NULL)
590 *filter_type = info_ptr->filter_type;
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500591
Andreas Dilger47a0c421997-05-16 02:46:07 -0500592 if (interlace_type != NULL)
593 *interlace_type = info_ptr->interlace_type;
Glenn Randers-Pehrson0f881d61998-02-07 10:20:57 -0600594
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500595 /* Check for potential overflow of rowbytes */
Glenn Randers-Pehrson16e11662004-11-01 14:13:40 -0600596 if (*width == 0 || *width > PNG_UINT_31_MAX)
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600597 png_error(png_ptr, "Invalid image width");
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500598
Glenn Randers-Pehrson16e11662004-11-01 14:13:40 -0600599 if (*height == 0 || *height > PNG_UINT_31_MAX)
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600600 png_error(png_ptr, "Invalid image height");
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500601
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500602 if (info_ptr->width > (PNG_UINT_32_MAX
603 >> 3) /* 8-byte RGBA pixels */
604 - 64 /* bigrowbuf hack */
605 - 1 /* filter byte */
606 - 7*8 /* rounding of width to multiple of 8 pixels */
607 - 8) /* extra max_pixel_depth pad */
Glenn Randers-Pehrson0f881d61998-02-07 10:20:57 -0600608 {
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500609 png_warning(png_ptr,
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500610 "Width too large for libpng to process image data");
Glenn Randers-Pehrson0f881d61998-02-07 10:20:57 -0600611 }
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500612
Andreas Dilger47a0c421997-05-16 02:46:07 -0500613 return (1);
614 }
615 return (0);
616}
617
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500618#if defined(PNG_oFFs_SUPPORTED)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500619png_uint_32 PNGAPI
Andreas Dilger47a0c421997-05-16 02:46:07 -0500620png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600621 png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
Andreas Dilger47a0c421997-05-16 02:46:07 -0500622{
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600623 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
624 && offset_x != NULL && offset_y != NULL && unit_type != NULL)
Andreas Dilger47a0c421997-05-16 02:46:07 -0500625 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500626 png_debug1(1, "in %s retrieval function", "oFFs");
Andreas Dilger47a0c421997-05-16 02:46:07 -0500627 *offset_x = info_ptr->x_offset;
628 *offset_y = info_ptr->y_offset;
629 *unit_type = (int)info_ptr->offset_unit_type;
630 return (PNG_INFO_oFFs);
631 }
632 return (0);
633}
634#endif
635
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500636#if defined(PNG_pCAL_SUPPORTED)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500637png_uint_32 PNGAPI
Andreas Dilger47a0c421997-05-16 02:46:07 -0500638png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
639 png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
640 png_charp *units, png_charpp *params)
641{
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600642 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500643 && purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
644 nparams != NULL && units != NULL && params != NULL)
Andreas Dilger47a0c421997-05-16 02:46:07 -0500645 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500646 png_debug1(1, "in %s retrieval function", "pCAL");
Andreas Dilger47a0c421997-05-16 02:46:07 -0500647 *purpose = info_ptr->pcal_purpose;
648 *X0 = info_ptr->pcal_X0;
649 *X1 = info_ptr->pcal_X1;
650 *type = (int)info_ptr->pcal_type;
651 *nparams = (int)info_ptr->pcal_nparams;
652 *units = info_ptr->pcal_units;
653 *params = info_ptr->pcal_params;
654 return (PNG_INFO_pCAL);
655 }
656 return (0);
657}
658#endif
659
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500660#if defined(PNG_sCAL_SUPPORTED)
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600661#ifdef PNG_FLOATING_POINT_SUPPORTED
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500662png_uint_32 PNGAPI
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600663png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600664 int *unit, double *width, double *height)
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600665{
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600666 if (png_ptr != NULL && info_ptr != NULL &&
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500667 (info_ptr->valid & PNG_INFO_sCAL))
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600668 {
669 *unit = info_ptr->scal_unit;
670 *width = info_ptr->scal_pixel_width;
671 *height = info_ptr->scal_pixel_height;
672 return (PNG_INFO_sCAL);
673 }
674 return(0);
675}
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600676#else
677#ifdef PNG_FIXED_POINT_SUPPORTED
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500678png_uint_32 PNGAPI
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600679png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600680 int *unit, png_charpp width, png_charpp height)
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600681{
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600682 if (png_ptr != NULL && info_ptr != NULL &&
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500683 (info_ptr->valid & PNG_INFO_sCAL))
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600684 {
685 *unit = info_ptr->scal_unit;
686 *width = info_ptr->scal_s_width;
687 *height = info_ptr->scal_s_height;
688 return (PNG_INFO_sCAL);
689 }
690 return(0);
691}
692#endif
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600693#endif
694#endif
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600695
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500696#if defined(PNG_pHYs_SUPPORTED)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500697png_uint_32 PNGAPI
Andreas Dilger47a0c421997-05-16 02:46:07 -0500698png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
699 png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
700{
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600701 png_uint_32 retval = 0;
702
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600703 if (png_ptr != NULL && info_ptr != NULL &&
704 (info_ptr->valid & PNG_INFO_pHYs))
Andreas Dilger47a0c421997-05-16 02:46:07 -0500705 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500706 png_debug1(1, "in %s retrieval function", "pHYs");
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500707
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600708 if (res_x != NULL)
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600709 {
710 *res_x = info_ptr->x_pixels_per_unit;
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600711 retval |= PNG_INFO_pHYs;
712 }
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500713
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600714 if (res_y != NULL)
715 {
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600716 *res_y = info_ptr->y_pixels_per_unit;
717 retval |= PNG_INFO_pHYs;
718 }
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500719
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600720 if (unit_type != NULL)
721 {
722 *unit_type = (int)info_ptr->phys_unit_type;
723 retval |= PNG_INFO_pHYs;
724 }
Andreas Dilger47a0c421997-05-16 02:46:07 -0500725 }
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600726 return (retval);
Andreas Dilger47a0c421997-05-16 02:46:07 -0500727}
728#endif
729
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500730png_uint_32 PNGAPI
Andreas Dilger47a0c421997-05-16 02:46:07 -0500731png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
732 int *num_palette)
733{
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600734 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE)
735 && palette != NULL)
Andreas Dilger47a0c421997-05-16 02:46:07 -0500736 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500737 png_debug1(1, "in %s retrieval function", "PLTE");
Andreas Dilger47a0c421997-05-16 02:46:07 -0500738 *palette = info_ptr->palette;
739 *num_palette = info_ptr->num_palette;
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500740 png_debug1(3, "num_palette = %d", *num_palette);
Andreas Dilger47a0c421997-05-16 02:46:07 -0500741 return (PNG_INFO_PLTE);
742 }
743 return (0);
744}
745
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500746#if defined(PNG_sBIT_SUPPORTED)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500747png_uint_32 PNGAPI
Andreas Dilger47a0c421997-05-16 02:46:07 -0500748png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
749{
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600750 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)
751 && sig_bit != NULL)
Andreas Dilger47a0c421997-05-16 02:46:07 -0500752 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500753 png_debug1(1, "in %s retrieval function", "sBIT");
Andreas Dilger47a0c421997-05-16 02:46:07 -0500754 *sig_bit = &(info_ptr->sig_bit);
755 return (PNG_INFO_sBIT);
756 }
757 return (0);
758}
759#endif
760
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500761#if defined(PNG_TEXT_SUPPORTED)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500762png_uint_32 PNGAPI
Andreas Dilger47a0c421997-05-16 02:46:07 -0500763png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
764 int *num_text)
765{
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600766 if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
Andreas Dilger47a0c421997-05-16 02:46:07 -0500767 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500768 png_debug1(1, "in %s retrieval function",
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600769 (png_ptr->chunk_name[0] == '\0' ? "text"
770 : (png_const_charp)png_ptr->chunk_name));
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500771
Andreas Dilger47a0c421997-05-16 02:46:07 -0500772 if (text_ptr != NULL)
773 *text_ptr = info_ptr->text;
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500774
Andreas Dilger47a0c421997-05-16 02:46:07 -0500775 if (num_text != NULL)
776 *num_text = info_ptr->num_text;
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500777
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600778 return ((png_uint_32)info_ptr->num_text);
Andreas Dilger47a0c421997-05-16 02:46:07 -0500779 }
Glenn Randers-Pehrsona77ef622000-02-18 13:48:52 -0600780 if (num_text != NULL)
781 *num_text = 0;
Andreas Dilger47a0c421997-05-16 02:46:07 -0500782 return(0);
783}
784#endif
785
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500786#if defined(PNG_tIME_SUPPORTED)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500787png_uint_32 PNGAPI
Andreas Dilger47a0c421997-05-16 02:46:07 -0500788png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
789{
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600790 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)
791 && mod_time != NULL)
Andreas Dilger47a0c421997-05-16 02:46:07 -0500792 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500793 png_debug1(1, "in %s retrieval function", "tIME");
Andreas Dilger47a0c421997-05-16 02:46:07 -0500794 *mod_time = &(info_ptr->mod_time);
795 return (PNG_INFO_tIME);
796 }
797 return (0);
798}
799#endif
800
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500801#if defined(PNG_tRNS_SUPPORTED)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500802png_uint_32 PNGAPI
Andreas Dilger47a0c421997-05-16 02:46:07 -0500803png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrson6abea752009-08-08 16:52:06 -0500804 png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
Andreas Dilger47a0c421997-05-16 02:46:07 -0500805{
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600806 png_uint_32 retval = 0;
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600807 if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
Andreas Dilger47a0c421997-05-16 02:46:07 -0500808 {
Glenn Randers-Pehrson51650b82008-08-05 07:44:42 -0500809 png_debug1(1, "in %s retrieval function", "tRNS");
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600810 if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
Andreas Dilger47a0c421997-05-16 02:46:07 -0500811 {
Glenn Randers-Pehrson6abea752009-08-08 16:52:06 -0500812 if (trans_alpha != NULL)
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600813 {
Glenn Randers-Pehrson6abea752009-08-08 16:52:06 -0500814 *trans_alpha = info_ptr->trans_alpha;
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600815 retval |= PNG_INFO_tRNS;
816 }
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500817
Glenn Randers-Pehrson56f63962008-10-06 10:16:17 -0500818 if (trans_color != NULL)
819 *trans_color = &(info_ptr->trans_color);
Andreas Dilger47a0c421997-05-16 02:46:07 -0500820 }
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600821 else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */
Andreas Dilger47a0c421997-05-16 02:46:07 -0500822 {
Glenn Randers-Pehrson56f63962008-10-06 10:16:17 -0500823 if (trans_color != NULL)
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600824 {
Glenn Randers-Pehrson56f63962008-10-06 10:16:17 -0500825 *trans_color = &(info_ptr->trans_color);
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600826 retval |= PNG_INFO_tRNS;
827 }
Glenn Randers-Pehrson glennrp@comcast.netb1c0d332009-05-15 20:39:34 -0500828
Glenn Randers-Pehrson6abea752009-08-08 16:52:06 -0500829 if (trans_alpha != NULL)
830 *trans_alpha = NULL;
Andreas Dilger47a0c421997-05-16 02:46:07 -0500831 }
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -0500832 if (num_trans != NULL)
Andreas Dilger47a0c421997-05-16 02:46:07 -0500833 {
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600834 *num_trans = info_ptr->num_trans;
835 retval |= PNG_INFO_tRNS;
Andreas Dilger47a0c421997-05-16 02:46:07 -0500836 }
Andreas Dilger47a0c421997-05-16 02:46:07 -0500837 }
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600838 return (retval);
Andreas Dilger47a0c421997-05-16 02:46:07 -0500839}
840#endif
841
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500842#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500843png_uint_32 PNGAPI
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600844png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
845 png_unknown_chunkpp unknowns)
846{
847 if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL)
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -0500848 {
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600849 *unknowns = info_ptr->unknown_chunks;
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -0500850 return ((png_uint_32)info_ptr->unknown_chunks_num);
851 }
852 return (0);
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600853}
854#endif
855
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600856#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500857png_byte PNGAPI
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600858png_get_rgb_to_gray_status (png_structp png_ptr)
859{
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600860 return (png_byte)(png_ptr? png_ptr->rgb_to_gray_status : 0);
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600861}
862#endif
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600863
Glenn Randers-Pehrson3097f612001-05-07 14:52:45 -0500864#if defined(PNG_USER_CHUNKS_SUPPORTED)
Glenn Randers-Pehrson75294572000-05-06 14:09:57 -0500865png_voidp PNGAPI
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600866png_get_user_chunk_ptr(png_structp png_ptr)
867{
Glenn Randers-Pehrson231e6872001-01-12 15:13:06 -0600868 return (png_ptr? png_ptr->user_chunk_ptr : NULL);
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -0600869}
870#endif
871
Glenn Randers-Pehrson5fea36f2004-07-28 08:20:44 -0500872#ifdef PNG_WRITE_SUPPORTED
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500873png_size_t PNGAPI
Glenn Randers-Pehrson228bd392000-04-23 23:14:02 -0500874png_get_compression_buffer_size(png_structp png_ptr)
875{
Glenn Randers-Pehrson145f5c82008-07-10 09:13:13 -0500876 return (png_ptr ? png_ptr->zbuf_size : 0L);
Glenn Randers-Pehrson228bd392000-04-23 23:14:02 -0500877}
Glenn Randers-Pehrson5fea36f2004-07-28 08:20:44 -0500878#endif
Glenn Randers-Pehrsone68f5a32001-05-14 09:20:53 -0500879
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500880
881#ifdef PNG_SET_USER_LIMITS_SUPPORTED
Glenn Randers-Pehrson800d1e92008-08-20 17:25:21 -0500882/* These functions were added to libpng 1.2.6 */
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500883png_uint_32 PNGAPI
884png_get_user_width_max (png_structp png_ptr)
885{
886 return (png_ptr? png_ptr->user_width_max : 0);
887}
888png_uint_32 PNGAPI
889png_get_user_height_max (png_structp png_ptr)
890{
891 return (png_ptr? png_ptr->user_height_max : 0);
892}
Glenn Randers-Pehrson800d1e92008-08-20 17:25:21 -0500893/* This function was added to libpng 1.4.0 */
894png_uint_32 PNGAPI
895png_get_chunk_cache_max (png_structp png_ptr)
896{
897 return (png_ptr? png_ptr->user_chunk_cache_max? 0x7fffffffL :
898 png_ptr->user_chunk_cache_max - 1 : 0);
899}
Glenn Randers-Pehrson272489d2004-08-04 06:34:52 -0500900#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
Glenn Randers-Pehrsond60c8862009-06-15 21:56:14 -0500901
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500902#ifdef PNG_IO_STATE_SUPPORTED
903png_uint_32 PNGAPI
904png_get_io_state (png_structp png_ptr)
905{
906 return png_ptr->io_state;
907}
908
909png_bytep PNGAPI
910png_get_io_chunk_name (png_structp png_ptr)
911{
912 return png_ptr->chunk_name;
913}
914#endif /* ?PNG_IO_STATE_SUPPORTED */
915
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600916#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */