1998-03-28 02:44:41 +00:00
|
|
|
|
|
|
|
/* pngget.c - retrieval of values from info struct
|
1998-12-08 19:44:02 +00:00
|
|
|
*
|
2014-11-26 04:42:00 +00:00
|
|
|
* Last changed in libpng 1.6.15 [November 20, 2014]
|
2014-08-22 11:11:00 +00:00
|
|
|
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
2000-08-19 02:06:43 +00:00
|
|
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
|
|
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
2009-11-11 01:39:31 +00:00
|
|
|
*
|
|
|
|
* This code is released under the libpng license.
|
|
|
|
* For conditions of distribution and use, see the disclaimer
|
|
|
|
* and license in png.h
|
|
|
|
*
|
1998-12-08 19:44:02 +00:00
|
|
|
*/
|
1998-03-28 02:44:41 +00:00
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
#include "pngpriv.h"
|
2006-09-29 22:46:58 +00:00
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_valid(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
2011-04-12 19:45:24 +00:00
|
|
|
png_uint_32 flag)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
1998-12-08 19:44:02 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
1998-03-28 02:44:41 +00:00
|
|
|
return(info_ptr->valid & flag);
|
2009-11-11 01:39:31 +00:00
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
return(0);
|
1998-03-28 02:44:41 +00:00
|
|
|
}
|
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
png_size_t PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_rowbytes(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
1998-12-08 19:44:02 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
1998-03-28 02:44:41 +00:00
|
|
|
return(info_ptr->rowbytes);
|
2009-11-11 01:39:31 +00:00
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
return(0);
|
1998-03-28 02:44:41 +00:00
|
|
|
}
|
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_INFO_IMAGE_SUPPORTED
|
2000-08-19 02:06:43 +00:00
|
|
|
png_bytepp PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_rows(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
2000-08-19 02:06:43 +00:00
|
|
|
{
|
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
|
|
|
return(info_ptr->row_pointers);
|
2009-11-11 01:39:31 +00:00
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
return(0);
|
2000-08-19 02:06:43 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
#ifdef PNG_EASY_ACCESS_SUPPORTED
|
2009-11-11 01:39:31 +00:00
|
|
|
/* Easy access to info, added in libpng-0.99 */
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_image_width(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
|
|
|
return info_ptr->width;
|
2009-11-11 01:39:31 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_image_height(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
|
|
|
return info_ptr->height;
|
2009-11-11 01:39:31 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_byte PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_bit_depth(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
|
|
|
return info_ptr->bit_depth;
|
2009-11-11 01:39:31 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_byte PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_color_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
|
|
|
return info_ptr->color_type;
|
2009-11-11 01:39:31 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_byte PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_filter_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
|
|
|
return info_ptr->filter_type;
|
2009-11-11 01:39:31 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_byte PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_interlace_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
|
|
|
return info_ptr->interlace_type;
|
2009-11-11 01:39:31 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_byte PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_compression_type(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
|
|
|
return info_ptr->compression_type;
|
2009-11-11 01:39:31 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
|
|
|
|
info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_pHYs_SUPPORTED
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
|
|
|
png_debug1(1, "in %s retrieval function",
|
|
|
|
"png_get_x_pixels_per_meter");
|
2009-11-11 01:39:31 +00:00
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
|
|
|
|
return (info_ptr->x_pixels_per_unit);
|
|
|
|
}
|
2014-08-22 11:11:00 +00:00
|
|
|
#else
|
|
|
|
PNG_UNUSED(png_ptr)
|
|
|
|
PNG_UNUSED(info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
#endif
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
|
|
|
|
info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_pHYs_SUPPORTED
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2012-03-04 03:18:12 +00:00
|
|
|
png_debug1(1, "in %s retrieval function",
|
|
|
|
"png_get_y_pixels_per_meter");
|
2009-11-11 01:39:31 +00:00
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
|
|
|
|
return (info_ptr->y_pixels_per_unit);
|
1998-12-08 19:44:02 +00:00
|
|
|
}
|
2014-08-22 11:11:00 +00:00
|
|
|
#else
|
|
|
|
PNG_UNUSED(png_ptr)
|
|
|
|
PNG_UNUSED(info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
#endif
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_pHYs_SUPPORTED
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
|
2009-11-11 01:39:31 +00:00
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER &&
|
|
|
|
info_ptr->x_pixels_per_unit == info_ptr->y_pixels_per_unit)
|
|
|
|
return (info_ptr->x_pixels_per_unit);
|
1998-12-08 19:44:02 +00:00
|
|
|
}
|
2014-08-22 11:11:00 +00:00
|
|
|
#else
|
|
|
|
PNG_UNUSED(png_ptr)
|
|
|
|
PNG_UNUSED(info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
#endif
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
|
|
|
float PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_pixel_aspect_ratio(png_const_structrp png_ptr, png_const_inforp
|
|
|
|
info_ptr)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
|
|
|
#ifdef PNG_READ_pHYs_SUPPORTED
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio");
|
2010-01-05 21:46:26 +00:00
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
if (info_ptr->x_pixels_per_unit != 0)
|
2000-08-19 02:06:43 +00:00
|
|
|
return ((float)((float)info_ptr->y_pixels_per_unit
|
2012-03-04 03:18:12 +00:00
|
|
|
/(float)info_ptr->x_pixels_per_unit));
|
1998-12-08 19:44:02 +00:00
|
|
|
}
|
2013-01-26 18:00:21 +00:00
|
|
|
#else
|
|
|
|
PNG_UNUSED(png_ptr)
|
|
|
|
PNG_UNUSED(info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
#endif
|
2012-03-04 03:18:12 +00:00
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
return ((float)0.0);
|
1998-12-08 19:44:02 +00:00
|
|
|
}
|
2000-08-19 02:06:43 +00:00
|
|
|
#endif
|
1998-12-08 19:44:02 +00:00
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
#ifdef PNG_FIXED_POINT_SUPPORTED
|
|
|
|
png_fixed_point PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr,
|
|
|
|
png_const_inforp info_ptr)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
|
|
|
#ifdef PNG_READ_pHYs_SUPPORTED
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_pHYs) != 0 &&
|
|
|
|
info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0 &&
|
|
|
|
info_ptr->x_pixels_per_unit <= PNG_UINT_31_MAX &&
|
|
|
|
info_ptr->y_pixels_per_unit <= PNG_UINT_31_MAX)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
|
|
|
png_fixed_point res;
|
|
|
|
|
|
|
|
png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio_fixed");
|
|
|
|
|
|
|
|
/* The following casts work because a PNG 4 byte integer only has a valid
|
|
|
|
* range of 0..2^31-1; otherwise the cast might overflow.
|
|
|
|
*/
|
|
|
|
if (png_muldiv(&res, (png_int_32)info_ptr->y_pixels_per_unit, PNG_FP_1,
|
2014-11-26 04:42:00 +00:00
|
|
|
(png_int_32)info_ptr->x_pixels_per_unit) != 0)
|
2012-03-04 03:18:12 +00:00
|
|
|
return res;
|
|
|
|
}
|
2013-01-26 18:00:21 +00:00
|
|
|
#else
|
|
|
|
PNG_UNUSED(png_ptr)
|
|
|
|
PNG_UNUSED(info_ptr)
|
2012-03-04 03:18:12 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_int_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_x_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_oFFs_SUPPORTED
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
|
2009-11-11 01:39:31 +00:00
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
|
|
|
|
return (info_ptr->x_offset);
|
1998-12-08 19:44:02 +00:00
|
|
|
}
|
2014-08-22 11:11:00 +00:00
|
|
|
#else
|
|
|
|
PNG_UNUSED(png_ptr)
|
|
|
|
PNG_UNUSED(info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
#endif
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_int_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_y_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_oFFs_SUPPORTED
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
|
2009-11-11 01:39:31 +00:00
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
|
|
|
|
return (info_ptr->y_offset);
|
1998-12-08 19:44:02 +00:00
|
|
|
}
|
2014-08-22 11:11:00 +00:00
|
|
|
#else
|
|
|
|
PNG_UNUSED(png_ptr)
|
|
|
|
PNG_UNUSED(info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
#endif
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_int_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_x_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_oFFs_SUPPORTED
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2012-03-04 03:18:12 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "png_get_x_offset_pixels");
|
2009-11-11 01:39:31 +00:00
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
|
|
|
|
return (info_ptr->x_offset);
|
1998-12-08 19:44:02 +00:00
|
|
|
}
|
2014-08-22 11:11:00 +00:00
|
|
|
#else
|
|
|
|
PNG_UNUSED(png_ptr)
|
|
|
|
PNG_UNUSED(info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
#endif
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_int_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_y_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_oFFs_SUPPORTED
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2012-03-04 03:18:12 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "png_get_y_offset_pixels");
|
2009-11-11 01:39:31 +00:00
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
|
|
|
|
return (info_ptr->y_offset);
|
1998-12-08 19:44:02 +00:00
|
|
|
}
|
2014-08-22 11:11:00 +00:00
|
|
|
#else
|
|
|
|
PNG_UNUSED(png_ptr)
|
|
|
|
PNG_UNUSED(info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
#endif
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
#ifdef PNG_INCH_CONVERSIONS_SUPPORTED
|
|
|
|
static png_uint_32
|
|
|
|
ppi_from_ppm(png_uint_32 ppm)
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
/* The conversion is *(2.54/100), in binary (32 digits):
|
|
|
|
* .00000110100000001001110101001001
|
|
|
|
*/
|
|
|
|
png_uint_32 t1001, t1101;
|
|
|
|
ppm >>= 1; /* .1 */
|
|
|
|
t1001 = ppm + (ppm >> 3); /* .1001 */
|
|
|
|
t1101 = t1001 + (ppm >> 1); /* .1101 */
|
|
|
|
ppm >>= 20; /* .000000000000000000001 */
|
|
|
|
t1101 += t1101 >> 15; /* .1101000000000001101 */
|
|
|
|
t1001 >>= 11; /* .000000000001001 */
|
|
|
|
t1001 += t1001 >> 12; /* .000000000001001000000001001 */
|
|
|
|
ppm += t1001; /* .000000000001001000001001001 */
|
|
|
|
ppm += t1101; /* .110100000001001110101001001 */
|
|
|
|
return (ppm + 16) >> 5;/* .00000110100000001001110101001001 */
|
|
|
|
#else
|
|
|
|
/* The argument is a PNG unsigned integer, so it is not permitted
|
|
|
|
* to be bigger than 2^31.
|
|
|
|
*/
|
|
|
|
png_fixed_point result;
|
|
|
|
if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, (png_int_32)ppm, 127,
|
2014-11-26 04:42:00 +00:00
|
|
|
5000) != 0)
|
2012-03-04 03:18:12 +00:00
|
|
|
return result;
|
|
|
|
|
|
|
|
/* Overflow. */
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2012-03-04 03:18:12 +00:00
|
|
|
return ppi_from_ppm(png_get_pixels_per_meter(png_ptr, info_ptr));
|
1998-12-08 19:44:02 +00:00
|
|
|
}
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_x_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2012-03-04 03:18:12 +00:00
|
|
|
return ppi_from_ppm(png_get_x_pixels_per_meter(png_ptr, info_ptr));
|
1998-12-08 19:44:02 +00:00
|
|
|
}
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_y_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2012-03-04 03:18:12 +00:00
|
|
|
return ppi_from_ppm(png_get_y_pixels_per_meter(png_ptr, info_ptr));
|
1998-12-08 19:44:02 +00:00
|
|
|
}
|
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
#ifdef PNG_FIXED_POINT_SUPPORTED
|
|
|
|
static png_fixed_point
|
2013-09-26 18:39:44 +00:00
|
|
|
png_fixed_inches_from_microns(png_const_structrp png_ptr, png_int_32 microns)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
|
|
|
/* Convert from metres * 1,000,000 to inches * 100,000, meters to
|
|
|
|
* inches is simply *(100/2.54), so we want *(10/2.54) == 500/127.
|
|
|
|
* Notice that this can overflow - a warning is output and 0 is
|
|
|
|
* returned.
|
|
|
|
*/
|
|
|
|
return png_muldiv_warn(png_ptr, microns, 500, 127);
|
|
|
|
}
|
|
|
|
|
|
|
|
png_fixed_point PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_x_offset_inches_fixed(png_const_structrp png_ptr,
|
|
|
|
png_const_inforp info_ptr)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
|
|
|
return png_fixed_inches_from_microns(png_ptr,
|
|
|
|
png_get_x_offset_microns(png_ptr, info_ptr));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef PNG_FIXED_POINT_SUPPORTED
|
|
|
|
png_fixed_point PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_y_offset_inches_fixed(png_const_structrp png_ptr,
|
|
|
|
png_const_inforp info_ptr)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
|
|
|
return png_fixed_inches_from_microns(png_ptr,
|
|
|
|
png_get_y_offset_microns(png_ptr, info_ptr));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
2000-08-19 02:06:43 +00:00
|
|
|
float PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_x_offset_inches(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2012-03-04 03:18:12 +00:00
|
|
|
/* To avoid the overflow do the conversion directly in floating
|
|
|
|
* point.
|
|
|
|
*/
|
|
|
|
return (float)(png_get_x_offset_microns(png_ptr, info_ptr) * .00003937);
|
1998-12-08 19:44:02 +00:00
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
#endif
|
1998-12-08 19:44:02 +00:00
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
2000-08-19 02:06:43 +00:00
|
|
|
float PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_y_offset_inches(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2012-03-04 03:18:12 +00:00
|
|
|
/* To avoid the overflow do the conversion directly in floating
|
|
|
|
* point.
|
|
|
|
*/
|
|
|
|
return (float)(png_get_y_offset_microns(png_ptr, info_ptr) * .00003937);
|
1998-12-08 19:44:02 +00:00
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
#endif
|
1998-12-08 19:44:02 +00:00
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_pHYs_SUPPORTED
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
2012-03-04 03:18:12 +00:00
|
|
|
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
|
|
|
png_uint_32 retval = 0;
|
|
|
|
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "pHYs");
|
2010-01-05 21:46:26 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
if (res_x != NULL)
|
|
|
|
{
|
|
|
|
*res_x = info_ptr->x_pixels_per_unit;
|
|
|
|
retval |= PNG_INFO_pHYs;
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
if (res_y != NULL)
|
|
|
|
{
|
|
|
|
*res_y = info_ptr->y_pixels_per_unit;
|
|
|
|
retval |= PNG_INFO_pHYs;
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
if (unit_type != NULL)
|
|
|
|
{
|
|
|
|
*unit_type = (int)info_ptr->phys_unit_type;
|
|
|
|
retval |= PNG_INFO_pHYs;
|
2012-03-04 03:18:12 +00:00
|
|
|
|
2008-09-10 20:56:22 +00:00
|
|
|
if (*unit_type == 1)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2000-08-19 02:06:43 +00:00
|
|
|
if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50);
|
|
|
|
if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50);
|
1998-12-08 19:44:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
return (retval);
|
|
|
|
}
|
2014-11-26 04:42:00 +00:00
|
|
|
#endif /* pHYs */
|
|
|
|
#endif /* INCH_CONVERSIONS */
|
1998-12-08 19:44:02 +00:00
|
|
|
|
|
|
|
/* png_get_channels really belongs in here, too, but it's been around longer */
|
|
|
|
|
2014-11-26 04:42:00 +00:00
|
|
|
#endif /* EASY_ACCESS */
|
1998-12-08 19:44:02 +00:00
|
|
|
|
2013-09-26 18:39:44 +00:00
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_byte PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_channels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
1998-12-08 19:44:02 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
1998-03-28 02:44:41 +00:00
|
|
|
return(info_ptr->channels);
|
2012-03-04 03:18:12 +00:00
|
|
|
|
|
|
|
return (0);
|
1998-03-28 02:44:41 +00:00
|
|
|
}
|
|
|
|
|
2013-09-26 18:39:44 +00:00
|
|
|
#ifdef PNG_READ_SUPPORTED
|
2012-03-04 03:18:12 +00:00
|
|
|
png_const_bytep PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_signature(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
1998-12-08 19:44:02 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
1998-03-28 02:44:41 +00:00
|
|
|
return(info_ptr->signature);
|
2012-03-04 03:18:12 +00:00
|
|
|
|
|
|
|
return (NULL);
|
1998-03-28 02:44:41 +00:00
|
|
|
}
|
2013-09-26 18:39:44 +00:00
|
|
|
#endif
|
1998-03-28 02:44:41 +00:00
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_bKGD_SUPPORTED
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_bKGD(png_const_structrp png_ptr, png_inforp info_ptr,
|
1998-03-28 02:44:41 +00:00
|
|
|
png_color_16p *background)
|
|
|
|
{
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_bKGD) != 0 &&
|
|
|
|
background != NULL)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "bKGD");
|
2010-01-05 21:46:26 +00:00
|
|
|
|
1998-03-28 02:44:41 +00:00
|
|
|
*background = &(info_ptr->background);
|
|
|
|
return (PNG_INFO_bKGD);
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-03-28 02:44:41 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_cHRM_SUPPORTED
|
2012-03-04 03:18:12 +00:00
|
|
|
/* The XYZ APIs were added in 1.5.5 to take advantage of the code added at the
|
|
|
|
* same time to correct the rgb grayscale coefficient defaults obtained from the
|
|
|
|
* cHRM chunk in 1.5.4
|
|
|
|
*/
|
|
|
|
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
2012-03-04 03:18:12 +00:00
|
|
|
double *white_x, double *white_y, double *red_x, double *red_y,
|
|
|
|
double *green_x, double *green_y, double *blue_x, double *blue_y)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
2013-09-26 18:39:44 +00:00
|
|
|
/* Quiet API change: this code used to only return the end points if a cHRM
|
|
|
|
* chunk was present, but the end points can also come from iCCP or sRGB
|
|
|
|
* chunks, so in 1.6.0 the png_get_ APIs return the end points regardless and
|
|
|
|
* the png_set_ APIs merely check that set end points are mutually
|
|
|
|
* consistent.
|
|
|
|
*/
|
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
2014-11-26 04:42:00 +00:00
|
|
|
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "cHRM");
|
2010-01-05 21:46:26 +00:00
|
|
|
|
1998-03-28 02:44:41 +00:00
|
|
|
if (white_x != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*white_x = png_float(png_ptr,
|
|
|
|
info_ptr->colorspace.end_points_xy.whitex, "cHRM white X");
|
1998-03-28 02:44:41 +00:00
|
|
|
if (white_y != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*white_y = png_float(png_ptr,
|
|
|
|
info_ptr->colorspace.end_points_xy.whitey, "cHRM white Y");
|
1998-03-28 02:44:41 +00:00
|
|
|
if (red_x != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*red_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.redx,
|
|
|
|
"cHRM red X");
|
1998-03-28 02:44:41 +00:00
|
|
|
if (red_y != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*red_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.redy,
|
|
|
|
"cHRM red Y");
|
1998-03-28 02:44:41 +00:00
|
|
|
if (green_x != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*green_x = png_float(png_ptr,
|
|
|
|
info_ptr->colorspace.end_points_xy.greenx, "cHRM green X");
|
1998-03-28 02:44:41 +00:00
|
|
|
if (green_y != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*green_y = png_float(png_ptr,
|
|
|
|
info_ptr->colorspace.end_points_xy.greeny, "cHRM green Y");
|
1998-03-28 02:44:41 +00:00
|
|
|
if (blue_x != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*blue_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluex,
|
|
|
|
"cHRM blue X");
|
1998-03-28 02:44:41 +00:00
|
|
|
if (blue_y != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*blue_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluey,
|
|
|
|
"cHRM blue Y");
|
1998-03-28 02:44:41 +00:00
|
|
|
return (PNG_INFO_cHRM);
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-03-28 02:44:41 +00:00
|
|
|
return (0);
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
2012-03-04 03:18:12 +00:00
|
|
|
double *red_X, double *red_Y, double *red_Z, double *green_X,
|
|
|
|
double *green_Y, double *green_Z, double *blue_X, double *blue_Y,
|
|
|
|
double *blue_Z)
|
|
|
|
{
|
2013-09-26 18:39:44 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
2014-11-26 04:42:00 +00:00
|
|
|
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
2013-09-26 18:39:44 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "cHRM_XYZ(float)");
|
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
if (red_X != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*red_X = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_X,
|
|
|
|
"cHRM red X");
|
2012-03-04 03:18:12 +00:00
|
|
|
if (red_Y != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*red_Y = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_Y,
|
|
|
|
"cHRM red Y");
|
2012-03-04 03:18:12 +00:00
|
|
|
if (red_Z != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*red_Z = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_Z,
|
|
|
|
"cHRM red Z");
|
2012-03-04 03:18:12 +00:00
|
|
|
if (green_X != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*green_X = png_float(png_ptr,
|
|
|
|
info_ptr->colorspace.end_points_XYZ.green_X, "cHRM green X");
|
2012-03-04 03:18:12 +00:00
|
|
|
if (green_Y != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*green_Y = png_float(png_ptr,
|
|
|
|
info_ptr->colorspace.end_points_XYZ.green_Y, "cHRM green Y");
|
2012-03-04 03:18:12 +00:00
|
|
|
if (green_Z != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*green_Z = png_float(png_ptr,
|
|
|
|
info_ptr->colorspace.end_points_XYZ.green_Z, "cHRM green Z");
|
2012-03-04 03:18:12 +00:00
|
|
|
if (blue_X != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*blue_X = png_float(png_ptr,
|
|
|
|
info_ptr->colorspace.end_points_XYZ.blue_X, "cHRM blue X");
|
2012-03-04 03:18:12 +00:00
|
|
|
if (blue_Y != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*blue_Y = png_float(png_ptr,
|
|
|
|
info_ptr->colorspace.end_points_XYZ.blue_Y, "cHRM blue Y");
|
2012-03-04 03:18:12 +00:00
|
|
|
if (blue_Z != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*blue_Z = png_float(png_ptr,
|
|
|
|
info_ptr->colorspace.end_points_XYZ.blue_Z, "cHRM blue Z");
|
2012-03-04 03:18:12 +00:00
|
|
|
return (PNG_INFO_cHRM);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifdef PNG_FIXED_POINT_SUPPORTED
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
|
|
|
png_fixed_point *int_red_X, png_fixed_point *int_red_Y,
|
|
|
|
png_fixed_point *int_red_Z, png_fixed_point *int_green_X,
|
|
|
|
png_fixed_point *int_green_Y, png_fixed_point *int_green_Z,
|
|
|
|
png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y,
|
|
|
|
png_fixed_point *int_blue_Z)
|
|
|
|
{
|
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
2014-11-26 04:42:00 +00:00
|
|
|
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
2013-09-26 18:39:44 +00:00
|
|
|
{
|
|
|
|
png_debug1(1, "in %s retrieval function", "cHRM_XYZ");
|
|
|
|
|
|
|
|
if (int_red_X != NULL)
|
|
|
|
*int_red_X = info_ptr->colorspace.end_points_XYZ.red_X;
|
|
|
|
if (int_red_Y != NULL)
|
|
|
|
*int_red_Y = info_ptr->colorspace.end_points_XYZ.red_Y;
|
|
|
|
if (int_red_Z != NULL)
|
|
|
|
*int_red_Z = info_ptr->colorspace.end_points_XYZ.red_Z;
|
|
|
|
if (int_green_X != NULL)
|
|
|
|
*int_green_X = info_ptr->colorspace.end_points_XYZ.green_X;
|
|
|
|
if (int_green_Y != NULL)
|
|
|
|
*int_green_Y = info_ptr->colorspace.end_points_XYZ.green_Y;
|
|
|
|
if (int_green_Z != NULL)
|
|
|
|
*int_green_Z = info_ptr->colorspace.end_points_XYZ.green_Z;
|
|
|
|
if (int_blue_X != NULL)
|
|
|
|
*int_blue_X = info_ptr->colorspace.end_points_XYZ.blue_X;
|
|
|
|
if (int_blue_Y != NULL)
|
|
|
|
*int_blue_Y = info_ptr->colorspace.end_points_XYZ.blue_Y;
|
|
|
|
if (int_blue_Z != NULL)
|
|
|
|
*int_blue_Z = info_ptr->colorspace.end_points_XYZ.blue_Z;
|
|
|
|
return (PNG_INFO_cHRM);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
png_uint_32 PNGAPI
|
|
|
|
png_get_cHRM_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
2012-03-04 03:18:12 +00:00
|
|
|
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)
|
2000-08-19 02:06:43 +00:00
|
|
|
{
|
2010-01-05 21:46:26 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "cHRM");
|
|
|
|
|
2013-09-26 18:39:44 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
2014-11-26 04:42:00 +00:00
|
|
|
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
2000-08-19 02:06:43 +00:00
|
|
|
{
|
|
|
|
if (white_x != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*white_x = info_ptr->colorspace.end_points_xy.whitex;
|
2000-08-19 02:06:43 +00:00
|
|
|
if (white_y != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*white_y = info_ptr->colorspace.end_points_xy.whitey;
|
2000-08-19 02:06:43 +00:00
|
|
|
if (red_x != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*red_x = info_ptr->colorspace.end_points_xy.redx;
|
2000-08-19 02:06:43 +00:00
|
|
|
if (red_y != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*red_y = info_ptr->colorspace.end_points_xy.redy;
|
2000-08-19 02:06:43 +00:00
|
|
|
if (green_x != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*green_x = info_ptr->colorspace.end_points_xy.greenx;
|
2000-08-19 02:06:43 +00:00
|
|
|
if (green_y != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*green_y = info_ptr->colorspace.end_points_xy.greeny;
|
2000-08-19 02:06:43 +00:00
|
|
|
if (blue_x != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*blue_x = info_ptr->colorspace.end_points_xy.bluex;
|
2000-08-19 02:06:43 +00:00
|
|
|
if (blue_y != NULL)
|
2013-09-26 18:39:44 +00:00
|
|
|
*blue_y = info_ptr->colorspace.end_points_xy.bluey;
|
2000-08-19 02:06:43 +00:00
|
|
|
return (PNG_INFO_cHRM);
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
return (0);
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
# endif
|
2000-08-19 02:06:43 +00:00
|
|
|
#endif
|
1998-03-28 02:44:41 +00:00
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_gAMA_SUPPORTED
|
2013-09-26 18:39:44 +00:00
|
|
|
# ifdef PNG_FIXED_POINT_SUPPORTED
|
|
|
|
png_uint_32 PNGAPI
|
|
|
|
png_get_gAMA_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
2012-03-04 03:18:12 +00:00
|
|
|
png_fixed_point *file_gamma)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
2010-01-05 21:46:26 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "gAMA");
|
|
|
|
|
2013-09-26 18:39:44 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
2014-11-26 04:42:00 +00:00
|
|
|
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
|
2013-09-26 18:39:44 +00:00
|
|
|
file_gamma != NULL)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
2013-09-26 18:39:44 +00:00
|
|
|
*file_gamma = info_ptr->colorspace.gamma;
|
1998-03-28 02:44:41 +00:00
|
|
|
return (PNG_INFO_gAMA);
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-03-28 02:44:41 +00:00
|
|
|
return (0);
|
|
|
|
}
|
2013-09-26 18:39:44 +00:00
|
|
|
# endif
|
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_gAMA(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
2012-03-04 03:18:12 +00:00
|
|
|
double *file_gamma)
|
2000-08-19 02:06:43 +00:00
|
|
|
{
|
2013-09-26 18:39:44 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "gAMA(float)");
|
2010-01-05 21:46:26 +00:00
|
|
|
|
2013-09-26 18:39:44 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
2014-11-26 04:42:00 +00:00
|
|
|
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
|
2013-09-26 18:39:44 +00:00
|
|
|
file_gamma != NULL)
|
|
|
|
{
|
|
|
|
*file_gamma = png_float(png_ptr, info_ptr->colorspace.gamma,
|
|
|
|
"png_get_gAMA");
|
|
|
|
return (PNG_INFO_gAMA);
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
2013-09-26 18:39:44 +00:00
|
|
|
return (0);
|
2000-08-19 02:06:43 +00:00
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
# endif
|
2000-08-19 02:06:43 +00:00
|
|
|
#endif
|
1998-03-28 02:44:41 +00:00
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_sRGB_SUPPORTED
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_sRGB(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
2011-04-12 19:45:24 +00:00
|
|
|
int *file_srgb_intent)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2010-01-05 21:46:26 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "sRGB");
|
|
|
|
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_sRGB) != 0 && file_srgb_intent != NULL)
|
1998-12-08 19:44:02 +00:00
|
|
|
{
|
2013-09-26 18:39:44 +00:00
|
|
|
*file_srgb_intent = info_ptr->colorspace.rendering_intent;
|
1998-12-08 19:44:02 +00:00
|
|
|
return (PNG_INFO_sRGB);
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_iCCP_SUPPORTED
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
|
2012-03-04 03:18:12 +00:00
|
|
|
png_charpp name, int *compression_type,
|
|
|
|
png_bytepp profile, png_uint_32 *proflen)
|
2000-08-19 02:06:43 +00:00
|
|
|
{
|
2010-01-05 21:46:26 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "iCCP");
|
|
|
|
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_iCCP) != 0 &&
|
|
|
|
name != NULL && compression_type != NULL && profile != NULL &&
|
|
|
|
proflen != NULL)
|
2000-08-19 02:06:43 +00:00
|
|
|
{
|
|
|
|
*name = info_ptr->iccp_name;
|
|
|
|
*profile = info_ptr->iccp_profile;
|
2013-09-26 18:39:44 +00:00
|
|
|
*proflen = png_get_uint_32(info_ptr->iccp_profile);
|
|
|
|
/* This is somewhat irrelevant since the profile data returned has
|
|
|
|
* actually been uncompressed.
|
2009-11-11 01:39:31 +00:00
|
|
|
*/
|
2013-09-26 18:39:44 +00:00
|
|
|
*compression_type = PNG_COMPRESSION_TYPE_BASE;
|
2000-08-19 02:06:43 +00:00
|
|
|
return (PNG_INFO_iCCP);
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_sPLT_SUPPORTED
|
2013-09-26 18:39:44 +00:00
|
|
|
int PNGAPI
|
|
|
|
png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
|
2012-03-04 03:18:12 +00:00
|
|
|
png_sPLT_tpp spalettes)
|
2000-08-19 02:06:43 +00:00
|
|
|
{
|
|
|
|
if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
|
2007-11-07 04:24:14 +00:00
|
|
|
{
|
2012-03-04 03:18:12 +00:00
|
|
|
*spalettes = info_ptr->splt_palettes;
|
2013-09-26 18:39:44 +00:00
|
|
|
return info_ptr->splt_palettes_num;
|
2007-11-07 04:24:14 +00:00
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
2007-11-07 04:24:14 +00:00
|
|
|
return (0);
|
2000-08-19 02:06:43 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_hIST_SUPPORTED
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
|
2011-04-12 19:45:24 +00:00
|
|
|
png_uint_16p *hist)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
2010-01-05 21:46:26 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "hIST");
|
|
|
|
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_hIST) != 0 && hist != NULL)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
|
|
|
*hist = info_ptr->hist;
|
|
|
|
return (PNG_INFO_hIST);
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-03-28 02:44:41 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_IHDR(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
2012-03-04 03:18:12 +00:00
|
|
|
png_uint_32 *width, png_uint_32 *height, int *bit_depth,
|
|
|
|
int *color_type, int *interlace_type, int *compression_type,
|
|
|
|
int *filter_type)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
2010-01-05 21:46:26 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "IHDR");
|
2009-11-11 01:39:31 +00:00
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
if (png_ptr == NULL || info_ptr == NULL || width == NULL ||
|
|
|
|
height == NULL || bit_depth == NULL || color_type == NULL)
|
|
|
|
return (0);
|
2009-11-11 01:39:31 +00:00
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
*width = info_ptr->width;
|
|
|
|
*height = info_ptr->height;
|
|
|
|
*bit_depth = info_ptr->bit_depth;
|
|
|
|
*color_type = info_ptr->color_type;
|
2009-11-11 01:39:31 +00:00
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
if (compression_type != NULL)
|
|
|
|
*compression_type = info_ptr->compression_type;
|
1998-12-08 19:44:02 +00:00
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
if (filter_type != NULL)
|
|
|
|
*filter_type = info_ptr->filter_type;
|
2009-11-11 01:39:31 +00:00
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
if (interlace_type != NULL)
|
|
|
|
*interlace_type = info_ptr->interlace_type;
|
2009-11-11 01:39:31 +00:00
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
/* This is redundant if we can be sure that the info_ptr values were all
|
|
|
|
* assigned in png_set_IHDR(). We do the check anyhow in case an
|
|
|
|
* application has ignored our advice not to mess with the members
|
|
|
|
* of info_ptr directly.
|
|
|
|
*/
|
2013-09-26 18:39:44 +00:00
|
|
|
png_check_IHDR(png_ptr, info_ptr->width, info_ptr->height,
|
2010-01-05 21:46:26 +00:00
|
|
|
info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type,
|
|
|
|
info_ptr->compression_type, info_ptr->filter_type);
|
2009-11-11 01:39:31 +00:00
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
return (1);
|
1998-03-28 02:44:41 +00:00
|
|
|
}
|
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_oFFs_SUPPORTED
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_oFFs(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
2012-03-04 03:18:12 +00:00
|
|
|
png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
2010-01-05 21:46:26 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "oFFs");
|
|
|
|
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_oFFs) != 0 &&
|
|
|
|
offset_x != NULL && offset_y != NULL && unit_type != NULL)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
|
|
|
*offset_x = info_ptr->x_offset;
|
|
|
|
*offset_y = info_ptr->y_offset;
|
|
|
|
*unit_type = (int)info_ptr->offset_unit_type;
|
|
|
|
return (PNG_INFO_oFFs);
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-03-28 02:44:41 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_pCAL_SUPPORTED
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
2012-03-04 03:18:12 +00:00
|
|
|
png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
|
|
|
|
png_charp *units, png_charpp *params)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
2010-01-05 21:46:26 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "pCAL");
|
|
|
|
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_pCAL) != 0 &&
|
|
|
|
purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
|
2009-11-11 01:39:31 +00:00
|
|
|
nparams != NULL && units != NULL && params != NULL)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
|
|
|
*purpose = info_ptr->pcal_purpose;
|
|
|
|
*X0 = info_ptr->pcal_X0;
|
|
|
|
*X1 = info_ptr->pcal_X1;
|
|
|
|
*type = (int)info_ptr->pcal_type;
|
|
|
|
*nparams = (int)info_ptr->pcal_nparams;
|
|
|
|
*units = info_ptr->pcal_units;
|
|
|
|
*params = info_ptr->pcal_params;
|
|
|
|
return (PNG_INFO_pCAL);
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-03-28 02:44:41 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_sCAL_SUPPORTED
|
2012-03-04 03:18:12 +00:00
|
|
|
# ifdef PNG_FIXED_POINT_SUPPORTED
|
2013-09-26 18:39:44 +00:00
|
|
|
# if defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) || \
|
|
|
|
defined(PNG_FLOATING_POINT_SUPPORTED)
|
2012-03-04 03:18:12 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
2012-03-04 03:18:12 +00:00
|
|
|
int *unit, png_fixed_point *width, png_fixed_point *height)
|
|
|
|
{
|
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
2014-11-26 04:42:00 +00:00
|
|
|
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
|
|
|
*unit = info_ptr->scal_unit;
|
2013-09-26 18:39:44 +00:00
|
|
|
/*TODO: make this work without FP support; the API is currently eliminated
|
|
|
|
* if neither floating point APIs nor internal floating point arithmetic
|
|
|
|
* are enabled.
|
|
|
|
*/
|
2012-03-04 03:18:12 +00:00
|
|
|
*width = png_fixed(png_ptr, atof(info_ptr->scal_s_width), "sCAL width");
|
|
|
|
*height = png_fixed(png_ptr, atof(info_ptr->scal_s_height),
|
|
|
|
"sCAL height");
|
|
|
|
return (PNG_INFO_sCAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
# endif /* FLOATING_ARITHMETIC */
|
|
|
|
# endif /* FIXED_POINT */
|
|
|
|
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_sCAL(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
2012-03-04 03:18:12 +00:00
|
|
|
int *unit, double *width, double *height)
|
2000-08-19 02:06:43 +00:00
|
|
|
{
|
2012-03-04 03:18:12 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
2014-11-26 04:42:00 +00:00
|
|
|
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
|
|
|
*unit = info_ptr->scal_unit;
|
|
|
|
*width = atof(info_ptr->scal_s_width);
|
|
|
|
*height = atof(info_ptr->scal_s_height);
|
|
|
|
return (PNG_INFO_sCAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
return(0);
|
2000-08-19 02:06:43 +00:00
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
# endif /* FLOATING POINT */
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_sCAL_s(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
2012-03-04 03:18:12 +00:00
|
|
|
int *unit, png_charpp width, png_charpp height)
|
2000-08-19 02:06:43 +00:00
|
|
|
{
|
2012-03-04 03:18:12 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
2014-11-26 04:42:00 +00:00
|
|
|
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
|
|
|
*unit = info_ptr->scal_unit;
|
|
|
|
*width = info_ptr->scal_s_width;
|
|
|
|
*height = info_ptr->scal_s_height;
|
|
|
|
return (PNG_INFO_sCAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
return(0);
|
2000-08-19 02:06:43 +00:00
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
#endif /* sCAL */
|
2000-08-19 02:06:43 +00:00
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_pHYs_SUPPORTED
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_pHYs(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
2012-03-04 03:18:12 +00:00
|
|
|
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
1998-12-08 19:44:02 +00:00
|
|
|
png_uint_32 retval = 0;
|
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "pHYs");
|
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
2014-11-26 04:42:00 +00:00
|
|
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
1998-12-08 19:44:02 +00:00
|
|
|
if (res_x != NULL)
|
|
|
|
{
|
|
|
|
*res_x = info_ptr->x_pixels_per_unit;
|
|
|
|
retval |= PNG_INFO_pHYs;
|
|
|
|
}
|
2009-11-11 01:39:31 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
if (res_y != NULL)
|
|
|
|
{
|
|
|
|
*res_y = info_ptr->y_pixels_per_unit;
|
|
|
|
retval |= PNG_INFO_pHYs;
|
|
|
|
}
|
2009-11-11 01:39:31 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
if (unit_type != NULL)
|
|
|
|
{
|
|
|
|
*unit_type = (int)info_ptr->phys_unit_type;
|
|
|
|
retval |= PNG_INFO_pHYs;
|
|
|
|
}
|
1998-03-28 02:44:41 +00:00
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
return (retval);
|
1998-03-28 02:44:41 +00:00
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
#endif /* pHYs */
|
1998-03-28 02:44:41 +00:00
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_PLTE(png_const_structrp png_ptr, png_inforp info_ptr,
|
2012-03-04 03:18:12 +00:00
|
|
|
png_colorp *palette, int *num_palette)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
2010-01-05 21:46:26 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "PLTE");
|
|
|
|
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_PLTE) != 0 && palette != NULL)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
|
|
|
*palette = info_ptr->palette;
|
|
|
|
*num_palette = info_ptr->num_palette;
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug1(3, "num_palette = %d", *num_palette);
|
1998-03-28 02:44:41 +00:00
|
|
|
return (PNG_INFO_PLTE);
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-03-28 02:44:41 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_sBIT_SUPPORTED
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_sBIT(png_const_structrp png_ptr, png_inforp info_ptr,
|
2011-04-12 19:45:24 +00:00
|
|
|
png_color_8p *sig_bit)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
2010-01-05 21:46:26 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "sBIT");
|
|
|
|
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_sBIT) != 0 && sig_bit != NULL)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
|
|
|
*sig_bit = &(info_ptr->sig_bit);
|
|
|
|
return (PNG_INFO_sBIT);
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-03-28 02:44:41 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_TEXT_SUPPORTED
|
2013-09-26 18:39:44 +00:00
|
|
|
int PNGAPI
|
|
|
|
png_get_text(png_const_structrp png_ptr, png_inforp info_ptr,
|
2011-04-12 19:45:24 +00:00
|
|
|
png_textp *text_ptr, int *num_text)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
1998-12-08 19:44:02 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
2012-03-04 03:18:12 +00:00
|
|
|
png_debug1(1, "in 0x%lx retrieval function",
|
|
|
|
(unsigned long)png_ptr->chunk_name);
|
2009-11-11 01:39:31 +00:00
|
|
|
|
1998-03-28 02:44:41 +00:00
|
|
|
if (text_ptr != NULL)
|
|
|
|
*text_ptr = info_ptr->text;
|
2009-11-11 01:39:31 +00:00
|
|
|
|
1998-03-28 02:44:41 +00:00
|
|
|
if (num_text != NULL)
|
|
|
|
*num_text = info_ptr->num_text;
|
2009-11-11 01:39:31 +00:00
|
|
|
|
2013-09-26 18:39:44 +00:00
|
|
|
return info_ptr->num_text;
|
1998-03-28 02:44:41 +00:00
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
2000-08-19 02:06:43 +00:00
|
|
|
if (num_text != NULL)
|
2012-03-04 03:18:12 +00:00
|
|
|
*num_text = 0;
|
|
|
|
|
1998-03-28 02:44:41 +00:00
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_tIME_SUPPORTED
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_tIME(png_const_structrp png_ptr, png_inforp info_ptr,
|
|
|
|
png_timep *mod_time)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
2010-01-05 21:46:26 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "tIME");
|
|
|
|
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_tIME) != 0 && mod_time != NULL)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
|
|
|
*mod_time = &(info_ptr->mod_time);
|
|
|
|
return (PNG_INFO_tIME);
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-03-28 02:44:41 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-01-05 21:46:26 +00:00
|
|
|
#ifdef PNG_tRNS_SUPPORTED
|
2000-08-19 02:06:43 +00:00
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_tRNS(png_const_structrp png_ptr, png_inforp info_ptr,
|
2012-03-04 03:18:12 +00:00
|
|
|
png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
1998-12-08 19:44:02 +00:00
|
|
|
png_uint_32 retval = 0;
|
2014-11-26 04:42:00 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
|
|
|
(info_ptr->valid & PNG_INFO_tRNS) != 0)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "tRNS");
|
2010-01-05 21:46:26 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
2012-03-04 03:18:12 +00:00
|
|
|
if (trans_alpha != NULL)
|
|
|
|
{
|
|
|
|
*trans_alpha = info_ptr->trans_alpha;
|
|
|
|
retval |= PNG_INFO_tRNS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (trans_color != NULL)
|
|
|
|
*trans_color = &(info_ptr->trans_color);
|
1998-03-28 02:44:41 +00:00
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
2012-03-04 03:18:12 +00:00
|
|
|
if (trans_color != NULL)
|
|
|
|
{
|
|
|
|
*trans_color = &(info_ptr->trans_color);
|
|
|
|
retval |= PNG_INFO_tRNS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (trans_alpha != NULL)
|
|
|
|
*trans_alpha = NULL;
|
1998-03-28 02:44:41 +00:00
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
2008-09-10 20:56:22 +00:00
|
|
|
if (num_trans != NULL)
|
1998-03-28 02:44:41 +00:00
|
|
|
{
|
1998-12-08 19:44:02 +00:00
|
|
|
*num_trans = info_ptr->num_trans;
|
|
|
|
retval |= PNG_INFO_tRNS;
|
1998-03-28 02:44:41 +00:00
|
|
|
}
|
|
|
|
}
|
2012-03-04 03:18:12 +00:00
|
|
|
|
1998-12-08 19:44:02 +00:00
|
|
|
return (retval);
|
1998-03-28 02:44:41 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-09-26 18:39:44 +00:00
|
|
|
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
2012-03-04 03:18:12 +00:00
|
|
|
int PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_unknown_chunks(png_const_structrp png_ptr, png_inforp info_ptr,
|
2012-03-04 03:18:12 +00:00
|
|
|
png_unknown_chunkpp unknowns)
|
|
|
|
{
|
|
|
|
if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL)
|
|
|
|
{
|
|
|
|
*unknowns = info_ptr->unknown_chunks;
|
|
|
|
return info_ptr->unknown_chunks_num;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
|
|
|
|
png_byte PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_rgb_to_gray_status (png_const_structrp png_ptr)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
|
|
|
return (png_byte)(png_ptr ? png_ptr->rgb_to_gray_status : 0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef PNG_USER_CHUNKS_SUPPORTED
|
|
|
|
png_voidp PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_user_chunk_ptr(png_const_structrp png_ptr)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
|
|
|
return (png_ptr ? png_ptr->user_chunk_ptr : NULL);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
png_size_t PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_compression_buffer_size(png_const_structrp png_ptr)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
2013-09-26 18:39:44 +00:00
|
|
|
if (png_ptr == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
# ifdef PNG_WRITE_SUPPORTED
|
2014-11-26 04:42:00 +00:00
|
|
|
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
|
2013-09-26 18:39:44 +00:00
|
|
|
# endif
|
|
|
|
{
|
|
|
|
# ifdef PNG_SEQUENTIAL_READ_SUPPORTED
|
|
|
|
return png_ptr->IDAT_read_size;
|
|
|
|
# else
|
|
|
|
return PNG_IDAT_READ_SIZE;
|
|
|
|
# endif
|
|
|
|
}
|
|
|
|
|
|
|
|
# ifdef PNG_WRITE_SUPPORTED
|
|
|
|
else
|
|
|
|
return png_ptr->zbuffer_size;
|
|
|
|
# endif
|
2012-03-04 03:18:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
|
|
|
/* These functions were added to libpng 1.2.6 and were enabled
|
|
|
|
* by default in libpng-1.4.0 */
|
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_user_width_max (png_const_structrp png_ptr)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
|
|
|
return (png_ptr ? png_ptr->user_width_max : 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_user_height_max (png_const_structrp png_ptr)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
|
|
|
return (png_ptr ? png_ptr->user_height_max : 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This function was added to libpng 1.4.0 */
|
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_chunk_cache_max (png_const_structrp png_ptr)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
|
|
|
return (png_ptr ? png_ptr->user_chunk_cache_max : 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This function was added to libpng 1.4.1 */
|
|
|
|
png_alloc_size_t PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_chunk_malloc_max (png_const_structrp png_ptr)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
|
|
|
return (png_ptr ? png_ptr->user_chunk_malloc_max : 0);
|
|
|
|
}
|
2014-11-26 04:42:00 +00:00
|
|
|
#endif /* SET_USER_LIMITS */
|
2012-03-04 03:18:12 +00:00
|
|
|
|
|
|
|
/* These functions were added to libpng 1.4.0 */
|
|
|
|
#ifdef PNG_IO_STATE_SUPPORTED
|
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_io_state (png_const_structrp png_ptr)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
|
|
|
return png_ptr->io_state;
|
|
|
|
}
|
|
|
|
|
|
|
|
png_uint_32 PNGAPI
|
2013-09-26 18:39:44 +00:00
|
|
|
png_get_io_chunk_type (png_const_structrp png_ptr)
|
2012-03-04 03:18:12 +00:00
|
|
|
{
|
|
|
|
return png_ptr->chunk_name;
|
|
|
|
}
|
2014-11-26 04:42:00 +00:00
|
|
|
#endif /* IO_STATE */
|
2012-03-04 03:18:12 +00:00
|
|
|
|
2013-04-12 20:25:04 +00:00
|
|
|
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
|
|
|
# ifdef PNG_GET_PALETTE_MAX_SUPPORTED
|
|
|
|
int PNGAPI
|
|
|
|
png_get_palette_max(png_const_structp png_ptr, png_const_infop info_ptr)
|
|
|
|
{
|
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
|
|
|
return png_ptr->num_palette_max;
|
|
|
|
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
#ifdef PNG_APNG_SUPPORTED
|
2007-03-20 23:56:50 +00:00
|
|
|
png_uint_32 PNGAPI
|
2007-03-21 18:55:05 +00:00
|
|
|
png_get_acTL(png_structp png_ptr, png_infop info_ptr,
|
2007-04-19 20:40:53 +00:00
|
|
|
png_uint_32 *num_frames, png_uint_32 *num_plays)
|
2007-03-20 23:56:50 +00:00
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "acTL");
|
2011-04-12 19:45:24 +00:00
|
|
|
|
2007-03-20 23:56:50 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
2014-11-26 04:42:00 +00:00
|
|
|
(info_ptr->valid & PNG_INFO_acTL) != 0 &&
|
2007-04-19 20:40:53 +00:00
|
|
|
num_frames != NULL && num_plays != NULL)
|
2007-03-20 23:56:50 +00:00
|
|
|
{
|
|
|
|
*num_frames = info_ptr->num_frames;
|
2007-04-19 20:40:53 +00:00
|
|
|
*num_plays = info_ptr->num_plays;
|
2007-03-20 23:56:50 +00:00
|
|
|
return (1);
|
|
|
|
}
|
2011-04-12 19:45:24 +00:00
|
|
|
|
2007-03-20 23:56:50 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
png_uint_32 PNGAPI
|
|
|
|
png_get_num_frames(png_structp png_ptr, png_infop info_ptr)
|
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug(1, "in png_get_num_frames()");
|
2011-04-12 19:45:24 +00:00
|
|
|
|
2007-03-20 23:56:50 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
|
|
|
return (info_ptr->num_frames);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
png_uint_32 PNGAPI
|
2007-04-19 20:40:53 +00:00
|
|
|
png_get_num_plays(png_structp png_ptr, png_infop info_ptr)
|
2007-03-20 23:56:50 +00:00
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug(1, "in png_get_num_plays()");
|
2011-04-12 19:45:24 +00:00
|
|
|
|
2007-03-20 23:56:50 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
2007-04-19 20:40:53 +00:00
|
|
|
return (info_ptr->num_plays);
|
2007-03-20 23:56:50 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
png_uint_32 PNGAPI
|
2007-03-21 18:55:05 +00:00
|
|
|
png_get_next_frame_fcTL(png_structp png_ptr, png_infop info_ptr,
|
2007-03-20 23:56:50 +00:00
|
|
|
png_uint_32 *width, png_uint_32 *height,
|
|
|
|
png_uint_32 *x_offset, png_uint_32 *y_offset,
|
|
|
|
png_uint_16 *delay_num, png_uint_16 *delay_den,
|
2007-03-22 23:35:51 +00:00
|
|
|
png_byte *dispose_op, png_byte *blend_op)
|
2007-03-20 23:56:50 +00:00
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug1(1, "in %s retrieval function", "fcTL");
|
2011-04-12 19:45:24 +00:00
|
|
|
|
2007-03-20 23:56:50 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL &&
|
2014-11-26 04:42:00 +00:00
|
|
|
(info_ptr->valid & PNG_INFO_fcTL) != 0 &&
|
2011-04-12 19:45:24 +00:00
|
|
|
width != NULL && height != NULL &&
|
2012-04-24 23:50:00 +00:00
|
|
|
x_offset != NULL && y_offset != NULL &&
|
2007-03-22 23:35:51 +00:00
|
|
|
delay_num != NULL && delay_den != NULL &&
|
2012-03-04 03:18:12 +00:00
|
|
|
dispose_op != NULL && blend_op != NULL)
|
2007-03-20 23:56:50 +00:00
|
|
|
{
|
|
|
|
*width = info_ptr->next_frame_width;
|
|
|
|
*height = info_ptr->next_frame_height;
|
|
|
|
*x_offset = info_ptr->next_frame_x_offset;
|
|
|
|
*y_offset = info_ptr->next_frame_y_offset;
|
|
|
|
*delay_num = info_ptr->next_frame_delay_num;
|
|
|
|
*delay_den = info_ptr->next_frame_delay_den;
|
2007-03-22 23:35:51 +00:00
|
|
|
*dispose_op = info_ptr->next_frame_dispose_op;
|
|
|
|
*blend_op = info_ptr->next_frame_blend_op;
|
2007-03-20 23:56:50 +00:00
|
|
|
return (1);
|
|
|
|
}
|
2011-04-12 19:45:24 +00:00
|
|
|
|
2007-03-20 23:56:50 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
png_uint_32 PNGAPI
|
|
|
|
png_get_next_frame_width(png_structp png_ptr, png_infop info_ptr)
|
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug(1, "in png_get_next_frame_width()");
|
2011-04-12 19:45:24 +00:00
|
|
|
|
2007-03-20 23:56:50 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
|
|
|
return (info_ptr->next_frame_width);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
png_uint_32 PNGAPI
|
|
|
|
png_get_next_frame_height(png_structp png_ptr, png_infop info_ptr)
|
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug(1, "in png_get_next_frame_height()");
|
2011-04-12 19:45:24 +00:00
|
|
|
|
2007-03-20 23:56:50 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
|
|
|
return (info_ptr->next_frame_height);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
png_uint_32 PNGAPI
|
|
|
|
png_get_next_frame_x_offset(png_structp png_ptr, png_infop info_ptr)
|
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug(1, "in png_get_next_frame_x_offset()");
|
2011-04-12 19:45:24 +00:00
|
|
|
|
2007-03-20 23:56:50 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
|
|
|
return (info_ptr->next_frame_x_offset);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
png_uint_32 PNGAPI
|
|
|
|
png_get_next_frame_y_offset(png_structp png_ptr, png_infop info_ptr)
|
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug(1, "in png_get_next_frame_y_offset()");
|
2011-04-12 19:45:24 +00:00
|
|
|
|
2007-03-20 23:56:50 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
|
|
|
return (info_ptr->next_frame_y_offset);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
png_uint_16 PNGAPI
|
|
|
|
png_get_next_frame_delay_num(png_structp png_ptr, png_infop info_ptr)
|
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug(1, "in png_get_next_frame_delay_num()");
|
2011-04-12 19:45:24 +00:00
|
|
|
|
2007-03-20 23:56:50 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
|
|
|
return (info_ptr->next_frame_delay_num);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
png_uint_16 PNGAPI
|
|
|
|
png_get_next_frame_delay_den(png_structp png_ptr, png_infop info_ptr)
|
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug(1, "in png_get_next_frame_delay_den()");
|
2011-04-12 19:45:24 +00:00
|
|
|
|
2007-03-20 23:56:50 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
|
|
|
return (info_ptr->next_frame_delay_den);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
png_byte PNGAPI
|
2007-03-22 23:35:51 +00:00
|
|
|
png_get_next_frame_dispose_op(png_structp png_ptr, png_infop info_ptr)
|
2007-03-20 23:56:50 +00:00
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug(1, "in png_get_next_frame_dispose_op()");
|
2011-04-12 19:45:24 +00:00
|
|
|
|
2007-03-20 23:56:50 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
2007-03-22 23:35:51 +00:00
|
|
|
return (info_ptr->next_frame_dispose_op);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
png_byte PNGAPI
|
|
|
|
png_get_next_frame_blend_op(png_structp png_ptr, png_infop info_ptr)
|
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug(1, "in png_get_next_frame_blend_op()");
|
2011-04-12 19:45:24 +00:00
|
|
|
|
2007-03-22 23:35:51 +00:00
|
|
|
if (png_ptr != NULL && info_ptr != NULL)
|
|
|
|
return (info_ptr->next_frame_blend_op);
|
2007-03-20 23:56:50 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
png_byte PNGAPI
|
2007-04-19 20:40:53 +00:00
|
|
|
png_get_first_frame_is_hidden(png_structp png_ptr, png_infop info_ptr)
|
2007-03-20 23:56:50 +00:00
|
|
|
{
|
2008-12-22 23:40:01 +00:00
|
|
|
png_debug(1, "in png_first_frame_is_hidden()");
|
2011-04-12 19:45:24 +00:00
|
|
|
|
2007-04-19 20:40:53 +00:00
|
|
|
if (png_ptr != NULL)
|
2007-11-07 04:24:14 +00:00
|
|
|
return (png_byte)(png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN);
|
2011-04-12 19:45:24 +00:00
|
|
|
|
2012-03-04 03:18:12 +00:00
|
|
|
PNG_UNUSED(info_ptr)
|
|
|
|
|
2007-03-20 23:56:50 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2014-11-26 04:42:00 +00:00
|
|
|
#endif /* APNG */
|
|
|
|
#endif /* READ || WRITE */
|