/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* pngget.c - retrieval of values from info struct
*
* This file is available under and governed by the GNU General Public
* License version 2 only, as published by the Free Software Foundation.
* However, the following notice accompanied the original version of this
* file and, per its terms, should not be removed:
*
* Last changed in libpng 1.5.1 [February 3, 2011]
* Copyright (c) 1998-2011 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.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
*/
#include "pngpriv.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
{
return(0);
}
{
return(0);
}
#ifdef PNG_INFO_IMAGE_SUPPORTED
{
return(info_ptr->row_pointers);
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);
}
{
#ifdef PNG_pHYs_SUPPORTED
{
"png_get_x_pixels_per_meter");
return (info_ptr->x_pixels_per_unit);
}
#endif
return (0);
}
{
#ifdef PNG_pHYs_SUPPORTED
{
"png_get_y_pixels_per_meter");
return (info_ptr->y_pixels_per_unit);
}
#endif
return (0);
}
{
#ifdef PNG_pHYs_SUPPORTED
{
return (info_ptr->x_pixels_per_unit);
}
#endif
return (0);
}
#ifdef PNG_FLOATING_POINT_SUPPORTED
float PNGAPI
{
#ifdef PNG_READ_pHYs_SUPPORTED
{
if (info_ptr->x_pixels_per_unit != 0)
return ((float)((float)info_ptr->y_pixels_per_unit
/(float)info_ptr->x_pixels_per_unit));
}
#endif
return ((float)0.0);
}
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
{
#ifdef PNG_READ_pHYs_SUPPORTED
{
/* 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.
*/
return res;
}
#endif
return 0;
}
#endif
{
#ifdef PNG_oFFs_SUPPORTED
{
}
#endif
return (0);
}
{
#ifdef PNG_oFFs_SUPPORTED
{
}
#endif
return (0);
}
{
#ifdef PNG_oFFs_SUPPORTED
{
}
#endif
return (0);
}
{
#ifdef PNG_oFFs_SUPPORTED
{
}
#endif
return (0);
}
static png_uint_32
{
#if 0
/* The conversion is *(2.54/100), in binary (32 digits):
* .00000110100000001001110101001001
*/
#else
/* The argument is a PNG unsigned integer, so it is not permitted
* to be bigger than 2^31.
*/
5000))
return result;
/* Overflow. */
return 0;
#endif
}
{
}
{
}
{
}
#ifdef PNG_FIXED_POINT_SUPPORTED
static png_fixed_point
{
/* 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_fixed_inches_from_microns(png_ptr,
}
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
{
return png_fixed_inches_from_microns(png_ptr,
}
#endif
#ifdef PNG_FLOATING_POINT_SUPPORTED
float PNGAPI
{
/* To avoid the overflow do the conversion directly in floating
* point.
*/
}
#endif
#ifdef PNG_FLOATING_POINT_SUPPORTED
float PNGAPI
{
/* To avoid the overflow do the conversion directly in floating
* point.
*/
}
#endif
#ifdef PNG_pHYs_SUPPORTED
{
{
{
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_SUPPORTED */
/* png_get_channels really belongs in here, too, but it's been around longer */
#endif /* PNG_EASY_ACCESS_SUPPORTED */
{
return (0);
}
{
return (NULL);
}
#ifdef PNG_bKGD_SUPPORTED
{
&& background != NULL)
{
return (PNG_INFO_bKGD);
}
return (0);
}
#endif
#ifdef 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
#ifdef PNG_gAMA_SUPPORTED
{
&& file_gamma != NULL)
{
return (PNG_INFO_gAMA);
}
return (0);
}
# ifdef PNG_FLOATING_POINT_SUPPORTED
double *file_gamma)
{
if (ok)
return ok;
}
# endif
#endif
#ifdef PNG_sRGB_SUPPORTED
int *file_srgb_intent)
{
&& file_srgb_intent != NULL)
{
return (PNG_INFO_sRGB);
}
return (0);
}
#endif
#ifdef 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
#ifdef PNG_sPLT_SUPPORTED
{
{
}
return (0);
}
#endif
#ifdef PNG_hIST_SUPPORTED
{
{
return (PNG_INFO_hIST);
}
return (0);
}
#endif
int *filter_type)
{
return (0);
if (compression_type != NULL)
if (filter_type != NULL)
if (interlace_type != NULL)
/* 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.
*/
return (1);
}
#ifdef PNG_oFFs_SUPPORTED
{
{
return (PNG_INFO_oFFs);
}
return (0);
}
#endif
#ifdef PNG_pCAL_SUPPORTED
{
{
return (PNG_INFO_pCAL);
}
return (0);
}
#endif
#ifdef PNG_sCAL_SUPPORTED
# ifdef PNG_FIXED_POINT_SUPPORTED
{
{
/*TODO: make this work without FP support */
"sCAL height");
return (PNG_INFO_sCAL);
}
return(0);
}
# endif /* FLOATING_ARITHMETIC */
# endif /* FIXED_POINT */
# ifdef PNG_FLOATING_POINT_SUPPORTED
{
{
return (PNG_INFO_sCAL);
}
return(0);
}
# endif /* FLOATING POINT */
{
{
return (PNG_INFO_sCAL);
}
return(0);
}
#endif /* sCAL */
#ifdef PNG_pHYs_SUPPORTED
{
{
{
retval |= PNG_INFO_pHYs;
}
{
retval |= PNG_INFO_pHYs;
}
{
retval |= PNG_INFO_pHYs;
}
}
return (retval);
}
#endif /* pHYs */
{
{
return (PNG_INFO_PLTE);
}
return (0);
}
#ifdef PNG_sBIT_SUPPORTED
{
{
return (PNG_INFO_sBIT);
}
return (0);
}
#endif
#ifdef PNG_TEXT_SUPPORTED
{
{
}
*num_text = 0;
return(0);
}
#endif
#ifdef PNG_tIME_SUPPORTED
{
{
return (PNG_INFO_tIME);
}
return (0);
}
#endif
#ifdef PNG_tRNS_SUPPORTED
{
{
{
if (trans_alpha != NULL)
{
retval |= PNG_INFO_tRNS;
}
if (trans_color != NULL)
}
else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */
{
if (trans_color != NULL)
{
retval |= PNG_INFO_tRNS;
}
if (trans_alpha != NULL)
*trans_alpha = NULL;
}
{
retval |= PNG_INFO_tRNS;
}
}
return (retval);
}
#endif
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
int PNGAPI
{
{
return info_ptr->unknown_chunks_num;
}
return (0);
}
#endif
{
}
#endif
#ifdef PNG_USER_CHUNKS_SUPPORTED
{
}
#endif
{
}
/* These functions were added to libpng 1.2.6 and were enabled
* by default in libpng-1.4.0 */
{
}
{
}
/* This function was added to libpng 1.4.0 */
{
}
/* This function was added to libpng 1.4.1 */
{
}
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
/* These functions were added to libpng 1.4.0 */
#ifdef PNG_IO_STATE_SUPPORTED
{
}
{
}
{
return png_ptr->chunk_name;
}
#endif /* ?PNG_IO_STATE_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */