pngget.c revision f9a51917495bc8ba8b60632219652a7b122c1190
/* pngget.c - retrieval of values from info struct
*
* libpng 1.2.8 - December 3, 2004
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2004 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/
#define PNG_INTERNAL
#include "png.h"
{
else
return(0);
}
{
else
return(0);
}
#if defined(PNG_INFO_IMAGE_SUPPORTED)
{
return(info_ptr->row_pointers);
else
return(0);
}
#endif
#ifdef PNG_EASY_ACCESS_SUPPORTED
/* easy access to info, added in libpng-0.99 */
{
{
}
return (0);
}
{
{
}
return (0);
}
{
{
}
return (0);
}
{
{
return info_ptr->color_type;
}
return (0);
}
{
{
return info_ptr->filter_type;
}
return (0);
}
{
{
return info_ptr->interlace_type;
}
return (0);
}
{
{
return info_ptr->compression_type;
}
return (0);
}
{
#if defined(PNG_pHYs_SUPPORTED)
{
return (0);
else return (info_ptr->x_pixels_per_unit);
}
#else
return (0);
#endif
return (0);
}
{
#if defined(PNG_pHYs_SUPPORTED)
{
return (0);
else return (info_ptr->y_pixels_per_unit);
}
#else
return (0);
#endif
return (0);
}
{
#if defined(PNG_pHYs_SUPPORTED)
{
return (0);
else return (info_ptr->x_pixels_per_unit);
}
#else
return (0);
#endif
return (0);
}
#ifdef PNG_FLOATING_POINT_SUPPORTED
float PNGAPI
{
#if defined(PNG_pHYs_SUPPORTED)
{
if (info_ptr->x_pixels_per_unit == 0)
return ((float)0.0);
else
return ((float)((float)info_ptr->y_pixels_per_unit
/(float)info_ptr->x_pixels_per_unit));
}
#else
return (0.0);
#endif
return ((float)0.0);
}
#endif
{
#if defined(PNG_oFFs_SUPPORTED)
{
return (0);
}
#else
return (0);
#endif
return (0);
}
{
#if defined(PNG_oFFs_SUPPORTED)
{
return (0);
}
#else
return (0);
#endif
return (0);
}
{
#if defined(PNG_oFFs_SUPPORTED)
{
return (0);
}
#else
return (0);
#endif
return (0);
}
{
#if defined(PNG_oFFs_SUPPORTED)
{
return (0);
}
#else
return (0);
#endif
return (0);
}
#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)
{
*.0254 +.5));
}
{
*.0254 +.5));
}
{
*.0254 +.5));
}
float PNGAPI
{
*.00003937);
}
float PNGAPI
{
*.00003937);
}
#if defined(PNG_pHYs_SUPPORTED)
{
png_uint_32 retval = 0;
{
{
retval |= PNG_INFO_pHYs;
}
{
retval |= PNG_INFO_pHYs;
}
{
retval |= PNG_INFO_pHYs;
if(*unit_type == 1)
{
}
}
}
return (retval);
}
#endif /* PNG_pHYs_SUPPORTED */
#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
/* png_get_channels really belongs in here, too, but it's been around longer */
#endif /* PNG_EASY_ACCESS_SUPPORTED */
{
else
return (0);
}
{
else
return (NULL);
}
#if defined(PNG_bKGD_SUPPORTED)
{
&& background != NULL)
{
return (PNG_INFO_bKGD);
}
return (0);
}
#endif
#if defined(PNG_cHRM_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
{
{
return (PNG_INFO_cHRM);
}
return (0);
}
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
{
{
return (PNG_INFO_cHRM);
}
return (0);
}
#endif
#endif
#if defined(PNG_gAMA_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
{
&& file_gamma != NULL)
{
return (PNG_INFO_gAMA);
}
return (0);
}
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
{
&& int_file_gamma != NULL)
{
return (PNG_INFO_gAMA);
}
return (0);
}
#endif
#endif
#if defined(PNG_sRGB_SUPPORTED)
{
&& file_srgb_intent != NULL)
{
return (PNG_INFO_sRGB);
}
return (0);
}
#endif
#if defined(PNG_iCCP_SUPPORTED)
{
{
/* compression_type is a dummy so the API won't have to change
if we introduce multiple compression types later. */
return (PNG_INFO_iCCP);
}
return (0);
}
#endif
#if defined(PNG_sPLT_SUPPORTED)
{
}
#endif
#if defined(PNG_hIST_SUPPORTED)
{
{
return (PNG_INFO_hIST);
}
return (0);
}
#endif
int *filter_type)
{
{
if (compression_type != NULL)
if (filter_type != NULL)
if (interlace_type != NULL)
/* check for potential overflow of rowbytes */
>> 3) /* 8-byte RGBA pixels */
- 64 /* bigrowbuf hack */
- 1 /* filter byte */
- 7*8 /* rounding of width to multiple of 8 pixels */
- 8) /* extra max_pixel_depth pad */
{
"Width too large for libpng to process image data.");
}
return (1);
}
return (0);
}
#if defined(PNG_oFFs_SUPPORTED)
{
{
return (PNG_INFO_oFFs);
}
return (0);
}
#endif
#if defined(PNG_pCAL_SUPPORTED)
{
{
return (PNG_INFO_pCAL);
}
return (0);
}
#endif
#if defined(PNG_sCAL_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
{
{
return (PNG_INFO_sCAL);
}
return(0);
}
#else
#ifdef PNG_FIXED_POINT_SUPPORTED
{
{
return (PNG_INFO_sCAL);
}
return(0);
}
#endif
#endif
#endif
#if defined(PNG_pHYs_SUPPORTED)
{
png_uint_32 retval = 0;
{
{
retval |= PNG_INFO_pHYs;
}
{
retval |= PNG_INFO_pHYs;
}
{
retval |= PNG_INFO_pHYs;
}
}
return (retval);
}
#endif
int *num_palette)
{
{
return (PNG_INFO_PLTE);
}
return (0);
}
#if defined(PNG_sBIT_SUPPORTED)
{
{
return (PNG_INFO_sBIT);
}
return (0);
}
#endif
#if defined(PNG_TEXT_SUPPORTED)
int *num_text)
{
{
}
*num_text = 0;
return(0);
}
#endif
#if defined(PNG_tIME_SUPPORTED)
{
{
return (PNG_INFO_tIME);
}
return (0);
}
#endif
#if defined(PNG_tRNS_SUPPORTED)
{
png_uint_32 retval = 0;
{
{
{
retval |= PNG_INFO_tRNS;
}
if (trans_values != NULL)
}
else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */
{
if (trans_values != NULL)
{
retval |= PNG_INFO_tRNS;
}
}
{
retval |= PNG_INFO_tRNS;
}
}
return (retval);
}
#endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
{
}
#endif
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
{
}
#endif
#if defined(PNG_USER_CHUNKS_SUPPORTED)
{
}
#endif
#ifdef PNG_WRITE_SUPPORTED
{
}
#endif
#ifndef PNG_1_0_X
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
/* this function was added to libpng 1.2.0 and should exist by default */
{
}
/* this function was added to libpng 1.2.0 and should exist by default */
{
if (flag_select & PNG_SELECT_READ)
/* no non-MMX flags yet */
#if 0
/* GRR: no write-flags yet, either, but someday... */
if (flag_select & PNG_SELECT_WRITE)
#endif /* 0 */
return settable_asm_flags; /* _theoretically_ settable capabilities only */
}
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
/* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */
/* this function was added to libpng 1.2.0 */
{
if (flag_select & PNG_SELECT_READ)
#if 0
/* GRR: no MMX write support yet, but someday... */
if (flag_select & PNG_SELECT_WRITE)
#endif /* 0 */
if (compilerID != NULL) {
#ifdef PNG_USE_PNGVCRD
#else
#ifdef PNG_USE_PNGGCCRD
#else
#endif
#endif
}
return settable_mmx_flags; /* _theoretically_ settable capabilities only */
}
/* this function was added to libpng 1.2.0 */
{
}
/* this function was added to libpng 1.2.0 */
{
}
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
/* these functions were added to libpng 1.2.6 */
{
}
{
}
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
#endif /* ?PNG_1_0_X */