Updated the Windows build to:
authorSam Lantinga <slouken@libsdl.org>
Mon, 02 Jan 2012 17:19:13 -0500
changeset 288cbf4a9d168ff
parent 287 9cd057e88c99
child 289 b1feae8662a5
Updated the Windows build to:
Visual Studio 2008
jpeg-8c
libpng-1.5.7
libwebp-0.1.3
tiff-4.0.0
zlib-1.2.5

All Windows binaries have been rebuilt with mingw-w32-1.0
IMG_gif.c
IMG_jpg.c
IMG_webp.c
IMG_xpm.c
VisualC/SDL_image.dsp
VisualC/SDL_image.dsw
VisualC/SDL_image.sln
VisualC/SDL_image.vcproj
VisualC/graphics/include/jconfig.h
VisualC/graphics/include/jerror.h
VisualC/graphics/include/jmorecfg.h
VisualC/graphics/include/jpeglib.h
VisualC/graphics/include/png.h
VisualC/graphics/include/pngconf.h
VisualC/graphics/include/pnglibconf.h
VisualC/graphics/include/tiff.h
VisualC/graphics/include/tiffconf.h
VisualC/graphics/include/tiffio.h
VisualC/graphics/include/tiffvers.h
VisualC/graphics/include/webp/decode.h
VisualC/graphics/include/webp/decode_vp8.h
VisualC/graphics/include/webp/encode.h
VisualC/graphics/include/webp/mux.h
VisualC/graphics/include/webp/types.h
VisualC/graphics/include/zconf.h
VisualC/graphics/include/zlib.h
VisualC/graphics/lib/COPYING.jpeg.txt
VisualC/graphics/lib/COPYING.png.txt
VisualC/graphics/lib/COPYING.tiff.txt
VisualC/graphics/lib/COPYING.webp.txt
VisualC/graphics/lib/COPYING.zlib.txt
VisualC/graphics/lib/jpeg.dll
VisualC/graphics/lib/libjpeg-8.dll
VisualC/graphics/lib/libpng12-0.dll
VisualC/graphics/lib/libpng15-15.dll
VisualC/graphics/lib/libtiff-3.dll
VisualC/graphics/lib/libtiff-5.dll
VisualC/graphics/lib/libwebp-2.dll
VisualC/graphics/lib/zlib1.dll
VisualC/showimage/showimage.dsp
VisualC/showimage/showimage.sln
VisualC/showimage/showimage.vcproj
     1.1 --- a/IMG_gif.c	Mon Jan 02 15:48:33 2012 -0500
     1.2 +++ b/IMG_gif.c	Mon Jan 02 17:19:13 2012 -0500
     1.3 @@ -177,7 +177,7 @@
     1.4  	RWSetMsg("not a GIF file");
     1.5          goto done;
     1.6      }
     1.7 -    strncpy(version, (char *) buf + 3, 3);
     1.8 +    memcpy(version, (char *) buf + 3, 3);
     1.9      version[3] = '\0';
    1.10  
    1.11      if ((strcmp(version, "87a") != 0) && (strcmp(version, "89a") != 0)) {
     2.1 --- a/IMG_jpg.c	Mon Jan 02 15:48:33 2012 -0500
     2.2 +++ b/IMG_jpg.c	Mon Jan 02 17:19:13 2012 -0500
     2.3 @@ -260,7 +260,7 @@
     2.4  /*
     2.5   * Fill the input buffer --- called whenever buffer is emptied.
     2.6   */
     2.7 -static int fill_input_buffer (j_decompress_ptr cinfo)
     2.8 +static boolean fill_input_buffer (j_decompress_ptr cinfo)
     2.9  {
    2.10  	my_source_mgr * src = (my_source_mgr *) cinfo->src;
    2.11  	int nbytes;
     3.1 --- a/IMG_webp.c	Mon Jan 02 15:48:33 2012 -0500
     3.2 +++ b/IMG_webp.c	Mon Jan 02 17:19:13 2012 -0500
     3.3 @@ -124,6 +124,7 @@
     3.4  static int webp_getinfo( SDL_RWops *src, int *datasize ) {
     3.5  	int start;
     3.6  	int is_WEBP;
     3.7 +	int data;
     3.8  	Uint8 magic[20];
     3.9  
    3.10  	if ( !src )
    3.11 @@ -144,7 +145,7 @@
    3.12  										 magic[14] == '8' &&
    3.13  										 magic[15] == ' '  ) {
    3.14  			is_WEBP = 1;
    3.15 -			int data = magic[16] | magic[17]<<8 | magic[18]<<16 | magic[19]<<24;
    3.16 +			data = magic[16] | magic[17]<<8 | magic[18]<<16 | magic[19]<<24;
    3.17  			if ( datasize )
    3.18  				*datasize = data;
    3.19  		}
    3.20 @@ -168,6 +169,11 @@
    3.21  	Uint32 Gmask;
    3.22  	Uint32 Bmask;
    3.23  	Uint32 Amask;
    3.24 +	WebPBitstreamFeatures features;
    3.25 +	int raw_data_size;
    3.26 +	uint8_t *raw_data;
    3.27 +	int r;
    3.28 +	uint8_t *ret;
    3.29  
    3.30  	if ( !src ) {
    3.31  		/* The error message has been set in SDL_RWFromFile */
    3.32 @@ -181,7 +187,7 @@
    3.33  	}
    3.34  
    3.35  
    3.36 -	int raw_data_size = -1;
    3.37 +	raw_data_size = -1;
    3.38  	if ( !webp_getinfo( src, &raw_data_size ) ) {
    3.39  		error = "Invalid WEBP";
    3.40  		goto error;
    3.41 @@ -190,13 +196,13 @@
    3.42  	// skip header
    3.43  	SDL_RWseek(src, start+20, RW_SEEK_SET );
    3.44  
    3.45 -	uint8_t *raw_data = (uint8_t*) malloc( raw_data_size );
    3.46 +	raw_data = (uint8_t*) malloc( raw_data_size );
    3.47  	if ( raw_data == NULL ) {
    3.48  		error = "Failed to allocate enought buffer for WEBP";
    3.49  		goto error;
    3.50  	}
    3.51  
    3.52 -	int r = SDL_RWread(src, raw_data, 1, raw_data_size );
    3.53 +	r = SDL_RWread(src, raw_data, 1, raw_data_size );
    3.54  	if ( r != raw_data_size ) {
    3.55  		error = "Failed to read WEBP";
    3.56  		goto error;
    3.57 @@ -211,8 +217,7 @@
    3.58  	}
    3.59  #endif
    3.60  
    3.61 -	WebPBitstreamFeatures features;
    3.62 -  if ( lib.webp_get_features_internal( raw_data, raw_data_size, &features, WEBP_DECODER_ABI_VERSION ) != VP8_STATUS_OK ) {
    3.63 +	if ( lib.webp_get_features_internal( raw_data, raw_data_size, &features, WEBP_DECODER_ABI_VERSION ) != VP8_STATUS_OK ) {
    3.64  		error = "WebPGetFeatures has failed";
    3.65  		return NULL;
    3.66  	}
    3.67 @@ -231,8 +236,6 @@
    3.68  		goto error;
    3.69  	}
    3.70  
    3.71 -
    3.72 -	uint8_t *ret = NULL;
    3.73  	if ( features.has_alpha ) {
    3.74  		ret = lib.webp_decode_rgba_into( raw_data, raw_data_size, surface->pixels, surface->pitch * surface->h,  surface->pitch );
    3.75  	} else {
     4.1 --- a/IMG_xpm.c	Mon Jan 02 15:48:33 2012 -0500
     4.2 +++ b/IMG_xpm.c	Mon Jan 02 17:19:13 2012 -0500
     4.3 @@ -245,6 +245,8 @@
     4.4   */
     4.5  static char *get_next_line(char ***lines, SDL_RWops *src, int len)
     4.6  {
     4.7 +	char *linebufnew;
     4.8 +
     4.9  	if(lines) {
    4.10  		return *(*lines)++;
    4.11  	} else {
    4.12 @@ -260,7 +262,7 @@
    4.13  			len += 4;	/* "\",\n\0" */
    4.14  			if(len > buflen){
    4.15  				buflen = len;
    4.16 -				char *linebufnew = realloc(linebuf, buflen);
    4.17 +				linebufnew = realloc(linebuf, buflen);
    4.18  				if(!linebufnew) {
    4.19  					free(linebuf);
    4.20  					error = "Out of memory";
    4.21 @@ -280,7 +282,7 @@
    4.22  					if(buflen == 0)
    4.23  						buflen = 16;
    4.24  					buflen *= 2;
    4.25 -					char *linebufnew = realloc(linebuf, buflen);
    4.26 +					linebufnew = realloc(linebuf, buflen);
    4.27  					if(!linebufnew) {
    4.28  						free(linebuf);
    4.29  						error = "Out of memory";
     5.1 --- a/VisualC/SDL_image.dsp	Mon Jan 02 15:48:33 2012 -0500
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,164 +0,0 @@
     5.4 -# Microsoft Developer Studio Project File - Name="SDL_image" - Package Owner=<4>
     5.5 -# Microsoft Developer Studio Generated Build File, Format Version 5.00
     5.6 -# ** DO NOT EDIT **
     5.7 -
     5.8 -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
     5.9 -
    5.10 -CFG=SDL_image - Win32 Release
    5.11 -!MESSAGE This is not a valid makefile. To build this project using NMAKE,
    5.12 -!MESSAGE use the Export Makefile command and run
    5.13 -!MESSAGE 
    5.14 -!MESSAGE NMAKE /f "SDL_image.mak".
    5.15 -!MESSAGE 
    5.16 -!MESSAGE You can specify a configuration when running NMAKE
    5.17 -!MESSAGE by defining the macro CFG on the command line. For example:
    5.18 -!MESSAGE 
    5.19 -!MESSAGE NMAKE /f "SDL_image.mak" CFG="SDL_image - Win32 Release"
    5.20 -!MESSAGE 
    5.21 -!MESSAGE Possible choices for configuration are:
    5.22 -!MESSAGE 
    5.23 -!MESSAGE "SDL_image - Win32 Release" (based on\
    5.24 - "Win32 (x86) Dynamic-Link Library")
    5.25 -!MESSAGE "SDL_image - Win32 Debug" (based on\
    5.26 - "Win32 (x86) Dynamic-Link Library")
    5.27 -!MESSAGE 
    5.28 -
    5.29 -# Begin Project
    5.30 -# PROP Scc_ProjName ""
    5.31 -# PROP Scc_LocalPath ""
    5.32 -CPP=cl.exe
    5.33 -MTL=midl.exe
    5.34 -RSC=rc.exe
    5.35 -
    5.36 -!IF  "$(CFG)" == "SDL_image - Win32 Release"
    5.37 -
    5.38 -# PROP BASE Use_MFC 0
    5.39 -# PROP BASE Use_Debug_Libraries 0
    5.40 -# PROP BASE Output_Dir "Release"
    5.41 -# PROP BASE Intermediate_Dir "Release"
    5.42 -# PROP BASE Target_Dir ""
    5.43 -# PROP Use_MFC 0
    5.44 -# PROP Use_Debug_Libraries 0
    5.45 -# PROP Output_Dir "Release"
    5.46 -# PROP Intermediate_Dir "Release"
    5.47 -# PROP Ignore_Export_Lib 0
    5.48 -# PROP Target_Dir ""
    5.49 -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
    5.50 -# ADD CPP /nologo /MD /W3 /GX /O2 /I "graphics\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "LOAD_BMP" /D "LOAD_GIF" /D "LOAD_JPG" /D LOAD_JPG_DYNAMIC=\"jpeg.dll\" /D "LOAD_LBM" /D "LOAD_PCX" /D "LOAD_PNG" /D LOAD_PNG_DYNAMIC=\"libpng12-0.dll\" /D "LOAD_PNM" /D "LOAD_TGA" /D "LOAD_TIF" /D LOAD_TIF_DYNAMIC=\"libtiff-3.dll\" /D "LOAD_XPM" /D "LOAD_XV" /D "PNG_USE_DLL" /D "ZLIB_DLL" /YX /FD /c
    5.51 -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
    5.52 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
    5.53 -# ADD BASE RSC /l 0x409 /d "NDEBUG"
    5.54 -# ADD RSC /l 0x409 /d "NDEBUG"
    5.55 -BSC32=bscmake.exe
    5.56 -# ADD BASE BSC32 /nologo
    5.57 -# ADD BSC32 /nologo
    5.58 -LINK32=link.exe
    5.59 -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /machine:I386
    5.60 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib SDL.lib /nologo /subsystem:windows /dll /machine:I386
    5.61 -
    5.62 -!ELSEIF  "$(CFG)" == "SDL_image - Win32 Debug"
    5.63 -
    5.64 -# PROP BASE Use_MFC 0
    5.65 -# PROP BASE Use_Debug_Libraries 1
    5.66 -# PROP BASE Output_Dir "Debug"
    5.67 -# PROP BASE Intermediate_Dir "Debug"
    5.68 -# PROP BASE Target_Dir ""
    5.69 -# PROP Use_MFC 0
    5.70 -# PROP Use_Debug_Libraries 1
    5.71 -# PROP Output_Dir "Debug"
    5.72 -# PROP Intermediate_Dir "Debug"
    5.73 -# PROP Ignore_Export_Lib 0
    5.74 -# PROP Target_Dir ""
    5.75 -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
    5.76 -# ADD CPP /nologo /MD /W3 /Gm /GX /Zi /Od /I "graphics\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "LOAD_BMP" /D "LOAD_GIF" /D "LOAD_JPG" /D LOAD_JPG_DYNAMIC=\"jpeg.dll\" /D "LOAD_LBM" /D "LOAD_PCX" /D "LOAD_PNG" /D LOAD_PNG_DYNAMIC=\"libpng12-0.dll\" /D "LOAD_PNM" /D "LOAD_TGA" /D "LOAD_TIF" /D LOAD_TIF_DYNAMIC=\"libtiff-3.dll\" /D "LOAD_XPM" /D "LOAD_XV" /D "PNG_USE_DLL" /D "ZLIB_DLL" /YX /FD /c
    5.77 -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
    5.78 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
    5.79 -# ADD BASE RSC /l 0x409 /d "_DEBUG"
    5.80 -# ADD RSC /l 0x409 /d "_DEBUG"
    5.81 -BSC32=bscmake.exe
    5.82 -# ADD BASE BSC32 /nologo
    5.83 -# ADD BSC32 /nologo
    5.84 -LINK32=link.exe
    5.85 -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
    5.86 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib SDL.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
    5.87 -
    5.88 -!ENDIF 
    5.89 -
    5.90 -# Begin Target
    5.91 -
    5.92 -# Name "SDL_image - Win32 Release"
    5.93 -# Name "SDL_image - Win32 Debug"
    5.94 -# Begin Group "SDL_image Sources"
    5.95 -
    5.96 -# PROP Default_Filter ""
    5.97 -# Begin Source File
    5.98 -
    5.99 -SOURCE=..\IMG.c
   5.100 -# End Source File
   5.101 -# Begin Source File
   5.102 -
   5.103 -SOURCE=..\IMG_bmp.c
   5.104 -# End Source File
   5.105 -# Begin Source File
   5.106 -
   5.107 -SOURCE=..\IMG_gif.c
   5.108 -# End Source File
   5.109 -# Begin Source File
   5.110 -
   5.111 -SOURCE=..\IMG_jpg.c
   5.112 -# End Source File
   5.113 -# Begin Source File
   5.114 -
   5.115 -SOURCE=..\IMG_lbm.c
   5.116 -# End Source File
   5.117 -# Begin Source File
   5.118 -
   5.119 -SOURCE=..\IMG_pcx.c
   5.120 -# End Source File
   5.121 -# Begin Source File
   5.122 -
   5.123 -SOURCE=..\IMG_png.c
   5.124 -# End Source File
   5.125 -# Begin Source File
   5.126 -
   5.127 -SOURCE=..\IMG_pnm.c
   5.128 -# End Source File
   5.129 -# Begin Source File
   5.130 -
   5.131 -SOURCE=..\IMG_tga.c
   5.132 -# End Source File
   5.133 -# Begin Source File
   5.134 -
   5.135 -SOURCE=..\IMG_tif.c
   5.136 -# End Source File
   5.137 -# Begin Source File
   5.138 -
   5.139 -SOURCE=..\IMG_xcf.c
   5.140 -# End Source File
   5.141 -# Begin Source File
   5.142 -
   5.143 -SOURCE=..\IMG_xpm.c
   5.144 -# End Source File
   5.145 -# Begin Source File
   5.146 -
   5.147 -SOURCE=..\IMG_xv.c
   5.148 -# End Source File
   5.149 -# Begin Source File
   5.150 -
   5.151 -SOURCE=..\IMG_xxx.c
   5.152 -# End Source File
   5.153 -# Begin Source File
   5.154 -
   5.155 -SOURCE=Version.rc
   5.156 -# End Source File
   5.157 -# End Group
   5.158 -# Begin Group "SDL_image Headers"
   5.159 -
   5.160 -# PROP Default_Filter ""
   5.161 -# Begin Source File
   5.162 -
   5.163 -SOURCE=..\SDL_image.h
   5.164 -# End Source File
   5.165 -# End Group
   5.166 -# End Target
   5.167 -# End Project
     6.1 --- a/VisualC/SDL_image.dsw	Mon Jan 02 15:48:33 2012 -0500
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,41 +0,0 @@
     6.4 -Microsoft Developer Studio Workspace File, Format Version 5.00
     6.5 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
     6.6 -
     6.7 -###############################################################################
     6.8 -
     6.9 -Project: "SDL_image"=".\SDL_image.dsp" - Package Owner=<4>
    6.10 -
    6.11 -Package=<5>
    6.12 -{{{
    6.13 -}}}
    6.14 -
    6.15 -Package=<4>
    6.16 -{{{
    6.17 -}}}
    6.18 -
    6.19 -###############################################################################
    6.20 -
    6.21 -Project: "showimage"=".\showimage\showimage.dsp" - Package Owner=<4>
    6.22 -
    6.23 -Package=<5>
    6.24 -{{{
    6.25 -}}}
    6.26 -
    6.27 -Package=<4>
    6.28 -{{{
    6.29 -}}}
    6.30 -
    6.31 -###############################################################################
    6.32 -
    6.33 -Global:
    6.34 -
    6.35 -Package=<5>
    6.36 -{{{
    6.37 -}}}
    6.38 -
    6.39 -Package=<3>
    6.40 -{{{
    6.41 -}}}
    6.42 -
    6.43 -###############################################################################
    6.44 -
     7.1 --- a/VisualC/SDL_image.sln	Mon Jan 02 15:48:33 2012 -0500
     7.2 +++ b/VisualC/SDL_image.sln	Mon Jan 02 17:19:13 2012 -0500
     7.3 @@ -1,6 +1,6 @@
     7.4  
     7.5 -Microsoft Visual Studio Solution File, Format Version 9.00
     7.6 -# Visual C++ Express 2005
     7.7 +Microsoft Visual Studio Solution File, Format Version 10.00
     7.8 +# Visual Studio 2008
     7.9  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL_image", "SDL_image.vcproj", "{2BD5534E-00E2-4BEA-AC96-D9A92EA24696}"
    7.10  EndProject
    7.11  Global
     8.1 --- a/VisualC/SDL_image.vcproj	Mon Jan 02 15:48:33 2012 -0500
     8.2 +++ b/VisualC/SDL_image.vcproj	Mon Jan 02 17:19:13 2012 -0500
     8.3 @@ -1,9 +1,10 @@
     8.4  <?xml version="1.0" encoding="Windows-1252"?>
     8.5  <VisualStudioProject
     8.6  	ProjectType="Visual C++"
     8.7 -	Version="8.00"
     8.8 +	Version="9.00"
     8.9  	Name="SDL_image"
    8.10  	ProjectGUID="{2BD5534E-00E2-4BEA-AC96-D9A92EA24696}"
    8.11 +	TargetFrameworkVersion="131072"
    8.12  	>
    8.13  	<Platforms>
    8.14  		<Platform
    8.15 @@ -47,7 +48,7 @@
    8.16  				Name="VCCLCompilerTool"
    8.17  				Optimization="0"
    8.18  				AdditionalIncludeDirectories="graphics\include"
    8.19 -				PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_JPG_DYNAMIC=\&quot;jpeg.dll\&quot;;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNG_DYNAMIC=\&quot;libpng12-0.dll\&quot;;LOAD_PNM;LOAD_TGA;LOAD_TIF;LOAD_TIF_DYNAMIC=\&quot;libtiff-3.dll\&quot;;LOAD_XPM;LOAD_XV;PNG_USE_DLL;ZLIB_DLL"
    8.20 +				PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_JPG_DYNAMIC=\&quot;libjpeg-8.dll\&quot;;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNG_DYNAMIC=\&quot;libpng15-15.dll\&quot;;LOAD_PNM;LOAD_TGA;LOAD_TIF;LOAD_TIF_DYNAMIC=\&quot;libtiff-5.dll\&quot;;LOAD_WEBP;LOAD_WEBP_DYNAMIC=\&quot;libwebp-2.dll\&quot;;LOAD_XPM;LOAD_XV;PNG_USE_DLL;ZLIB_DLL"
    8.21  				MinimalRebuild="true"
    8.22  				RuntimeLibrary="2"
    8.23  				PrecompiledHeaderFile=".\Debug/SDL_image.pch"
    8.24 @@ -78,6 +79,8 @@
    8.25  				GenerateDebugInformation="true"
    8.26  				ProgramDatabaseFile=".\Debug/SDL_image.pdb"
    8.27  				SubSystem="2"
    8.28 +				RandomizedBaseAddress="1"
    8.29 +				DataExecutionPrevention="0"
    8.30  				ImportLibrary=".\Debug/SDL_image.lib"
    8.31  				TargetMachine="1"
    8.32  			/>
    8.33 @@ -102,9 +105,6 @@
    8.34  				Name="VCAppVerifierTool"
    8.35  			/>
    8.36  			<Tool
    8.37 -				Name="VCWebDeploymentTool"
    8.38 -			/>
    8.39 -			<Tool
    8.40  				Name="VCPostBuildEventTool"
    8.41  			/>
    8.42  		</Configuration>
    8.43 @@ -143,7 +143,7 @@
    8.44  				Optimization="2"
    8.45  				InlineFunctionExpansion="1"
    8.46  				AdditionalIncludeDirectories="graphics\include"
    8.47 -				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_JPG_DYNAMIC=\&quot;jpeg.dll\&quot;;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNG_DYNAMIC=\&quot;libpng12-0.dll\&quot;;LOAD_PNM;LOAD_TGA;LOAD_TIF;LOAD_TIF_DYNAMIC=\&quot;libtiff-3.dll\&quot;;LOAD_XPM;LOAD_XV;PNG_USE_DLL;ZLIB_DLL"
    8.48 +				PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;LOAD_BMP;LOAD_GIF;LOAD_JPG;LOAD_JPG_DYNAMIC=\&quot;libjpeg-8.dll\&quot;;LOAD_LBM;LOAD_PCX;LOAD_PNG;LOAD_PNG_DYNAMIC=\&quot;libpng15-15.dll\&quot;;LOAD_PNM;LOAD_TGA;LOAD_TIF;LOAD_TIF_DYNAMIC=\&quot;libtiff-5.dll\&quot;;LOAD_WEBP;LOAD_WEBP_DYNAMIC=\&quot;libwebp-2.dll\&quot;;LOAD_XPM;LOAD_XV;PNG_USE_DLL;ZLIB_DLL"
    8.49  				StringPooling="true"
    8.50  				RuntimeLibrary="2"
    8.51  				EnableFunctionLevelLinking="true"
    8.52 @@ -173,6 +173,8 @@
    8.53  				SuppressStartupBanner="true"
    8.54  				ProgramDatabaseFile=".\Release/SDL_image.pdb"
    8.55  				SubSystem="2"
    8.56 +				RandomizedBaseAddress="1"
    8.57 +				DataExecutionPrevention="0"
    8.58  				ImportLibrary=".\Release/SDL_image.lib"
    8.59  				TargetMachine="1"
    8.60  			/>
    8.61 @@ -197,9 +199,6 @@
    8.62  				Name="VCAppVerifierTool"
    8.63  			/>
    8.64  			<Tool
    8.65 -				Name="VCWebDeploymentTool"
    8.66 -			/>
    8.67 -			<Tool
    8.68  				Name="VCPostBuildEventTool"
    8.69  			/>
    8.70  		</Configuration>
    8.71 @@ -431,6 +430,10 @@
    8.72  				</FileConfiguration>
    8.73  			</File>
    8.74  			<File
    8.75 +				RelativePath="..\IMG_webp.c"
    8.76 +				>
    8.77 +			</File>
    8.78 +			<File
    8.79  				RelativePath="..\IMG_xcf.c"
    8.80  				>
    8.81  				<FileConfiguration
     9.1 --- a/VisualC/graphics/include/jconfig.h	Mon Jan 02 15:48:33 2012 -0500
     9.2 +++ b/VisualC/graphics/include/jconfig.h	Mon Jan 02 17:19:13 2012 -0500
     9.3 @@ -1,23 +1,38 @@
     9.4 -/* jconfig.xmingw32msvc --- jconfig.h for mingw32/msvc. */
     9.5 -/* see jconfig.doc for explanations */
     9.6 +/* jconfig.h.  Generated from jconfig.cfg by configure.  */
     9.7 +/* jconfig.cfg --- source file edited by configure script */
     9.8 +/* see jconfig.txt for explanations */
     9.9  
    9.10 -#define HAVE_PROTOTYPES
    9.11 -#define HAVE_UNSIGNED_CHAR
    9.12 -#define HAVE_UNSIGNED_SHORT
    9.13 -/* #define void char */
    9.14 -/* #define const */
    9.15 -#undef CHAR_IS_UNSIGNED
    9.16 -#define HAVE_STDDEF_H
    9.17 -#define HAVE_STDLIB_H
    9.18 -#undef NEED_BSD_STRINGS
    9.19 -#undef NEED_SYS_TYPES_H
    9.20 -#undef NEED_FAR_POINTERS	/* win32 uses flat 32-bit addressing */
    9.21 -#undef NEED_SHORT_EXTERNAL_NAMES
    9.22 -#undef INCOMPLETE_TYPES_BROKEN
    9.23 +#define HAVE_PROTOTYPES 1
    9.24 +#define HAVE_UNSIGNED_CHAR 1
    9.25 +#define HAVE_UNSIGNED_SHORT 1
    9.26 +/* #undef void */
    9.27 +/* #undef const */
    9.28 +/* #undef CHAR_IS_UNSIGNED */
    9.29 +#define HAVE_STDDEF_H 1
    9.30 +#define HAVE_STDLIB_H 1
    9.31 +#define HAVE_LOCALE_H 1
    9.32 +/* #undef NEED_BSD_STRINGS */
    9.33 +/* #undef NEED_SYS_TYPES_H */
    9.34 +/* #undef NEED_FAR_POINTERS */
    9.35 +/* #undef NEED_SHORT_EXTERNAL_NAMES */
    9.36 +/* Define this if you get warnings about undefined structures. */
    9.37 +/* #undef INCOMPLETE_TYPES_BROKEN */
    9.38 +
    9.39 +/* Define "boolean" as unsigned char, not int, on Windows systems. */
    9.40 +#ifdef _WIN32
    9.41 +#ifndef __RPCNDR_H__		/* don't conflict if rpcndr.h already read */
    9.42 +typedef unsigned char boolean;
    9.43 +#endif
    9.44 +#define HAVE_BOOLEAN		/* prevent jmorecfg.h from redefining it */
    9.45 +#endif
    9.46  
    9.47  #ifdef JPEG_INTERNALS
    9.48  
    9.49 -#undef RIGHT_SHIFT_IS_UNSIGNED
    9.50 +/* #undef RIGHT_SHIFT_IS_UNSIGNED */
    9.51 +#define INLINE __inline__
    9.52 +/* These are for configuring the JPEG memory manager. */
    9.53 +/* #undef DEFAULT_MAX_MEM */
    9.54 +/* #undef NO_MKTEMP */
    9.55  
    9.56  #endif /* JPEG_INTERNALS */
    9.57  
    9.58 @@ -26,13 +41,14 @@
    9.59  #define BMP_SUPPORTED		/* BMP image file format */
    9.60  #define GIF_SUPPORTED		/* GIF image file format */
    9.61  #define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */
    9.62 -#undef RLE_SUPPORTED		/* Utah RLE image file format */
    9.63 +/* #undef RLE_SUPPORTED */
    9.64  #define TARGA_SUPPORTED		/* Targa image file format */
    9.65  
    9.66 -#undef TWO_FILE_COMMANDLINE	/* optional */
    9.67 -#define USE_SETMODE		/* Needed to make one-file style work in DJGPP */
    9.68 -#undef NEED_SIGNAL_CATCHER	/* Define this if you use jmemname.c */
    9.69 -#undef DONT_USE_B_MODE
    9.70 -#undef PROGRESS_REPORT		/* optional */
    9.71 +/* #undef TWO_FILE_COMMANDLINE */
    9.72 +/* #undef NEED_SIGNAL_CATCHER */
    9.73 +/* #undef DONT_USE_B_MODE */
    9.74 +
    9.75 +/* Define this if you want percent-done progress reports from cjpeg/djpeg. */
    9.76 +/* #undef PROGRESS_REPORT */
    9.77  
    9.78  #endif /* JPEG_CJPEG_DJPEG */
    10.1 --- a/VisualC/graphics/include/jerror.h	Mon Jan 02 15:48:33 2012 -0500
    10.2 +++ b/VisualC/graphics/include/jerror.h	Mon Jan 02 17:19:13 2012 -0500
    10.3 @@ -2,6 +2,7 @@
    10.4   * jerror.h
    10.5   *
    10.6   * Copyright (C) 1994-1997, Thomas G. Lane.
    10.7 + * Modified 1997-2009 by Guido Vollbeding.
    10.8   * This file is part of the Independent JPEG Group's software.
    10.9   * For conditions of distribution and use, see the accompanying README file.
   10.10   *
   10.11 @@ -39,14 +40,15 @@
   10.12  JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */
   10.13  
   10.14  /* For maintenance convenience, list is alphabetical by message code name */
   10.15 -JMESSAGE(JERR_ARITH_NOTIMPL,
   10.16 -	 "Sorry, there are legal restrictions on arithmetic coding")
   10.17  JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix")
   10.18  JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix")
   10.19  JMESSAGE(JERR_BAD_BUFFER_MODE, "Bogus buffer control mode")
   10.20  JMESSAGE(JERR_BAD_COMPONENT_ID, "Invalid component ID %d in SOS")
   10.21 +JMESSAGE(JERR_BAD_CROP_SPEC, "Invalid crop request")
   10.22  JMESSAGE(JERR_BAD_DCT_COEF, "DCT coefficient out of range")
   10.23 -JMESSAGE(JERR_BAD_DCTSIZE, "IDCT output block size %d not supported")
   10.24 +JMESSAGE(JERR_BAD_DCTSIZE, "DCT scaled block size %dx%d not supported")
   10.25 +JMESSAGE(JERR_BAD_DROP_SAMPLING,
   10.26 +	 "Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c")
   10.27  JMESSAGE(JERR_BAD_HUFF_TABLE, "Bogus Huffman table definition")
   10.28  JMESSAGE(JERR_BAD_IN_COLORSPACE, "Bogus input colorspace")
   10.29  JMESSAGE(JERR_BAD_J_COLORSPACE, "Bogus JPEG colorspace")
   10.30 @@ -93,6 +95,7 @@
   10.31  JMESSAGE(JERR_MODE_CHANGE, "Invalid color quantization mode change")
   10.32  JMESSAGE(JERR_NOTIMPL, "Not implemented yet")
   10.33  JMESSAGE(JERR_NOT_COMPILED, "Requested feature was omitted at compile time")
   10.34 +JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined")
   10.35  JMESSAGE(JERR_NO_BACKING_STORE, "Backing store not supported")
   10.36  JMESSAGE(JERR_NO_HUFF_TABLE, "Huffman table 0x%02x was not defined")
   10.37  JMESSAGE(JERR_NO_IMAGE, "JPEG datastream contains no image")
   10.38 @@ -170,6 +173,7 @@
   10.39  JMESSAGE(JTRC_XMS_CLOSE, "Freed XMS handle %u")
   10.40  JMESSAGE(JTRC_XMS_OPEN, "Obtained XMS handle %u")
   10.41  JMESSAGE(JWRN_ADOBE_XFORM, "Unknown Adobe color transform code %d")
   10.42 +JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code")
   10.43  JMESSAGE(JWRN_BOGUS_PROGRESSION,
   10.44  	 "Inconsistent progression sequence for component %d coefficient %d")
   10.45  JMESSAGE(JWRN_EXTRANEOUS_DATA,
   10.46 @@ -227,6 +231,15 @@
   10.47     (cinfo)->err->msg_parm.i[2] = (p3), \
   10.48     (cinfo)->err->msg_parm.i[3] = (p4), \
   10.49     (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
   10.50 +#define ERREXIT6(cinfo,code,p1,p2,p3,p4,p5,p6)  \
   10.51 +  ((cinfo)->err->msg_code = (code), \
   10.52 +   (cinfo)->err->msg_parm.i[0] = (p1), \
   10.53 +   (cinfo)->err->msg_parm.i[1] = (p2), \
   10.54 +   (cinfo)->err->msg_parm.i[2] = (p3), \
   10.55 +   (cinfo)->err->msg_parm.i[3] = (p4), \
   10.56 +   (cinfo)->err->msg_parm.i[4] = (p5), \
   10.57 +   (cinfo)->err->msg_parm.i[5] = (p6), \
   10.58 +   (*(cinfo)->err->error_exit) ((j_common_ptr) (cinfo)))
   10.59  #define ERREXITS(cinfo,code,str)  \
   10.60    ((cinfo)->err->msg_code = (code), \
   10.61     strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \
    11.1 --- a/VisualC/graphics/include/jmorecfg.h	Mon Jan 02 15:48:33 2012 -0500
    11.2 +++ b/VisualC/graphics/include/jmorecfg.h	Mon Jan 02 17:19:13 2012 -0500
    11.3 @@ -2,6 +2,7 @@
    11.4   * jmorecfg.h
    11.5   *
    11.6   * Copyright (C) 1991-1997, Thomas G. Lane.
    11.7 + * Modified 1997-2009 by Guido Vollbeding.
    11.8   * This file is part of the Independent JPEG Group's software.
    11.9   * For conditions of distribution and use, see the accompanying README file.
   11.10   *
   11.11 @@ -158,7 +159,13 @@
   11.12  /* INT32 must hold at least signed 32-bit values. */
   11.13  
   11.14  #ifndef XMD_H			/* X11/xmd.h correctly defines INT32 */
   11.15 -typedef long INT32;
   11.16 +#ifndef _BASETSD_H_		/* Microsoft defines it in basetsd.h */
   11.17 +#ifndef _BASETSD_H		/* MinGW is slightly different */
   11.18 +#ifndef QGLOBAL_H		/* Qt defines it in qglobal.h */
   11.19 +typedef int INT32;
   11.20 +#endif
   11.21 +#endif
   11.22 +#endif
   11.23  #endif
   11.24  
   11.25  /* Datatype used for image dimensions.  The JPEG standard only supports
   11.26 @@ -187,16 +194,8 @@
   11.27  /* a function referenced thru EXTERNs: */
   11.28  #define GLOBAL(type)		type
   11.29  /* a reference to a GLOBAL function: */
   11.30 -#ifdef WIN32
   11.31 -# ifdef BUILDING_JPEG_DLL
   11.32 -#  define DLLIMPORT __declspec (dllexport)
   11.33 -# else
   11.34 -#  define DLLIMPORT __declspec (dllimport)
   11.35 -# endif
   11.36 -# define EXTERN(type)        DLLIMPORT extern type
   11.37 -#else
   11.38  #define EXTERN(type)		extern type
   11.39 -#endif 
   11.40 +
   11.41  
   11.42  /* This macro is used to declare a "method", that is, a function pointer.
   11.43   * We want to supply prototype parameters if the compiler can cope.
   11.44 @@ -217,11 +216,13 @@
   11.45   * explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
   11.46   */
   11.47  
   11.48 +#ifndef FAR
   11.49  #ifdef NEED_FAR_POINTERS
   11.50  #define FAR  far
   11.51  #else
   11.52  #define FAR
   11.53  #endif
   11.54 +#endif
   11.55  
   11.56  
   11.57  /*
   11.58 @@ -264,8 +265,6 @@
   11.59   * (You may HAVE to do that if your compiler doesn't like null source files.)
   11.60   */
   11.61  
   11.62 -/* Arithmetic coding is unsupported for legal reasons.  Complaints to IBM. */
   11.63 -
   11.64  /* Capability options common to encoder and decoder: */
   11.65  
   11.66  #define DCT_ISLOW_SUPPORTED	/* slow but accurate integer algorithm */
   11.67 @@ -274,9 +273,10 @@
   11.68  
   11.69  /* Encoder capability options: */
   11.70  
   11.71 -#undef  C_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */
   11.72 +#define C_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */
   11.73  #define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
   11.74  #define C_PROGRESSIVE_SUPPORTED	    /* Progressive JPEG? (Requires MULTISCAN)*/
   11.75 +#define DCT_SCALING_SUPPORTED	    /* Input rescaling via DCT? (Requires DCT_ISLOW)*/
   11.76  #define ENTROPY_OPT_SUPPORTED	    /* Optimization of entropy coding parms? */
   11.77  /* Note: if you selected 12-bit data precision, it is dangerous to turn off
   11.78   * ENTROPY_OPT_SUPPORTED.  The standard Huffman tables are only good for 8-bit
   11.79 @@ -290,12 +290,12 @@
   11.80  
   11.81  /* Decoder capability options: */
   11.82  
   11.83 -#undef  D_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */
   11.84 +#define D_ARITH_CODING_SUPPORTED    /* Arithmetic coding back end? */
   11.85  #define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
   11.86  #define D_PROGRESSIVE_SUPPORTED	    /* Progressive JPEG? (Requires MULTISCAN)*/
   11.87 +#define IDCT_SCALING_SUPPORTED	    /* Output rescaling via IDCT? */
   11.88  #define SAVE_MARKERS_SUPPORTED	    /* jpeg_save_markers() needed? */
   11.89  #define BLOCK_SMOOTHING_SUPPORTED   /* Block smoothing? (Progressive only) */
   11.90 -#define IDCT_SCALING_SUPPORTED	    /* Output rescaling via IDCT? */
   11.91  #undef  UPSAMPLE_SCALING_SUPPORTED  /* Output rescaling at upsample stage? */
   11.92  #define UPSAMPLE_MERGING_SUPPORTED  /* Fast path for sloppy upsampling? */
   11.93  #define QUANT_1PASS_SUPPORTED	    /* 1-pass color quantization? */
    12.1 --- a/VisualC/graphics/include/jpeglib.h	Mon Jan 02 15:48:33 2012 -0500
    12.2 +++ b/VisualC/graphics/include/jpeglib.h	Mon Jan 02 17:19:13 2012 -0500
    12.3 @@ -2,6 +2,7 @@
    12.4   * jpeglib.h
    12.5   *
    12.6   * Copyright (C) 1991-1998, Thomas G. Lane.
    12.7 + * Modified 2002-2010 by Guido Vollbeding.
    12.8   * This file is part of the Independent JPEG Group's software.
    12.9   * For conditions of distribution and use, see the accompanying README file.
   12.10   *
   12.11 @@ -26,11 +27,19 @@
   12.12  #include "jmorecfg.h"		/* seldom changed options */
   12.13  
   12.14  
   12.15 -/* Version ID for the JPEG library.
   12.16 - * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".
   12.17 +#ifdef __cplusplus
   12.18 +#ifndef DONT_USE_EXTERN_C
   12.19 +extern "C" {
   12.20 +#endif
   12.21 +#endif
   12.22 +
   12.23 +/* Version IDs for the JPEG library.
   12.24 + * Might be useful for tests like "#if JPEG_LIB_VERSION >= 80".
   12.25   */
   12.26  
   12.27 -#define JPEG_LIB_VERSION  62	/* Version 6b */
   12.28 +#define JPEG_LIB_VERSION        80	/* Compatibility version 8.0 */
   12.29 +#define JPEG_LIB_VERSION_MAJOR  8
   12.30 +#define JPEG_LIB_VERSION_MINOR  3
   12.31  
   12.32  
   12.33  /* Various constants determining the sizes of things.
   12.34 @@ -138,18 +147,18 @@
   12.35     */
   12.36    JDIMENSION width_in_blocks;
   12.37    JDIMENSION height_in_blocks;
   12.38 -  /* Size of a DCT block in samples.  Always DCTSIZE for compression.
   12.39 -   * For decompression this is the size of the output from one DCT block,
   12.40 -   * reflecting any scaling we choose to apply during the IDCT step.
   12.41 -   * Values of 1,2,4,8 are likely to be supported.  Note that different
   12.42 -   * components may receive different IDCT scalings.
   12.43 +  /* Size of a DCT block in samples,
   12.44 +   * reflecting any scaling we choose to apply during the DCT step.
   12.45 +   * Values from 1 to 16 are supported.
   12.46 +   * Note that different components may receive different DCT scalings.
   12.47     */
   12.48 -  int DCT_scaled_size;
   12.49 +  int DCT_h_scaled_size;
   12.50 +  int DCT_v_scaled_size;
   12.51    /* The downsampled dimensions are the component's actual, unpadded number
   12.52 -   * of samples at the main buffer (preprocessing/compression interface), thus
   12.53 -   * downsampled_width = ceil(image_width * Hi/Hmax)
   12.54 -   * and similarly for height.  For decompression, IDCT scaling is included, so
   12.55 -   * downsampled_width = ceil(image_width * Hi/Hmax * DCT_scaled_size/DCTSIZE)
   12.56 +   * of samples at the main buffer (preprocessing/compression interface);
   12.57 +   * DCT scaling is included, so
   12.58 +   * downsampled_width = ceil(image_width * Hi/Hmax * DCT_h_scaled_size/DCTSIZE)
   12.59 +   * and similarly for height.
   12.60     */
   12.61    JDIMENSION downsampled_width;	 /* actual width in samples */
   12.62    JDIMENSION downsampled_height; /* actual height in samples */
   12.63 @@ -164,7 +173,7 @@
   12.64    int MCU_width;		/* number of blocks per MCU, horizontally */
   12.65    int MCU_height;		/* number of blocks per MCU, vertically */
   12.66    int MCU_blocks;		/* MCU_width * MCU_height */
   12.67 -  int MCU_sample_width;		/* MCU width in samples, MCU_width*DCT_scaled_size */
   12.68 +  int MCU_sample_width;	/* MCU width in samples: MCU_width * DCT_h_scaled_size */
   12.69    int last_col_width;		/* # of non-dummy blocks across in last MCU */
   12.70    int last_row_height;		/* # of non-dummy blocks down in last MCU */
   12.71  
   12.72 @@ -291,6 +300,17 @@
   12.73     * helper routines to simplify changing parameters.
   12.74     */
   12.75  
   12.76 +  unsigned int scale_num, scale_denom; /* fraction by which to scale image */
   12.77 +
   12.78 +  JDIMENSION jpeg_width;	/* scaled JPEG image width */
   12.79 +  JDIMENSION jpeg_height;	/* scaled JPEG image height */
   12.80 +  /* Dimensions of actual JPEG image that will be written to file,
   12.81 +   * derived from input dimensions by scaling factors above.
   12.82 +   * These fields are computed by jpeg_start_compress().
   12.83 +   * You can also use jpeg_calc_jpeg_dimensions() to determine these values
   12.84 +   * in advance of calling jpeg_start_compress().
   12.85 +   */
   12.86 +
   12.87    int data_precision;		/* bits of precision in image data */
   12.88  
   12.89    int num_components;		/* # of color components in JPEG image */
   12.90 @@ -298,14 +318,17 @@
   12.91  
   12.92    jpeg_component_info * comp_info;
   12.93    /* comp_info[i] describes component that appears i'th in SOF */
   12.94 -  
   12.95 +
   12.96    JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
   12.97 -  /* ptrs to coefficient quantization tables, or NULL if not defined */
   12.98 -  
   12.99 +  int q_scale_factor[NUM_QUANT_TBLS];
  12.100 +  /* ptrs to coefficient quantization tables, or NULL if not defined,
  12.101 +   * and corresponding scale factors (percentage, initialized 100).
  12.102 +   */
  12.103 +
  12.104    JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
  12.105    JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
  12.106    /* ptrs to Huffman coding tables, or NULL if not defined */
  12.107 -  
  12.108 +
  12.109    UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
  12.110    UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
  12.111    UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
  12.112 @@ -321,6 +344,7 @@
  12.113    boolean arith_code;		/* TRUE=arithmetic coding, FALSE=Huffman */
  12.114    boolean optimize_coding;	/* TRUE=optimize entropy encoding parms */
  12.115    boolean CCIR601_sampling;	/* TRUE=first samples are cosited */
  12.116 +  boolean do_fancy_downsampling; /* TRUE=apply fancy downsampling */
  12.117    int smoothing_factor;		/* 1..100, or 0 for no input smoothing */
  12.118    J_DCT_METHOD dct_method;	/* DCT algorithm selector */
  12.119  
  12.120 @@ -364,6 +388,9 @@
  12.121    int max_h_samp_factor;	/* largest h_samp_factor */
  12.122    int max_v_samp_factor;	/* largest v_samp_factor */
  12.123  
  12.124 +  int min_DCT_h_scaled_size;	/* smallest DCT_h_scaled_size of any component */
  12.125 +  int min_DCT_v_scaled_size;	/* smallest DCT_v_scaled_size of any component */
  12.126 +
  12.127    JDIMENSION total_iMCU_rows;	/* # of iMCU rows to be input to coef ctlr */
  12.128    /* The coefficient controller receives data in units of MCU rows as defined
  12.129     * for fully interleaved scans (whether the JPEG file is interleaved or not).
  12.130 @@ -389,6 +416,10 @@
  12.131  
  12.132    int Ss, Se, Ah, Al;		/* progressive JPEG parameters for scan */
  12.133  
  12.134 +  int block_size;		/* the basic DCT block size: 1..16 */
  12.135 +  const int * natural_order;	/* natural-order position array */
  12.136 +  int lim_Se;			/* min( Se, DCTSIZE2-1 ) */
  12.137 +
  12.138    /*
  12.139     * Links to compression subobjects (methods and private variables of modules)
  12.140     */
  12.141 @@ -535,6 +566,7 @@
  12.142    jpeg_component_info * comp_info;
  12.143    /* comp_info[i] describes component that appears i'th in SOF */
  12.144  
  12.145 +  boolean is_baseline;		/* TRUE if Baseline SOF0 encountered */
  12.146    boolean progressive_mode;	/* TRUE if SOFn specifies progressive mode */
  12.147    boolean arith_code;		/* TRUE=arithmetic coding, FALSE=Huffman */
  12.148  
  12.149 @@ -575,7 +607,8 @@
  12.150    int max_h_samp_factor;	/* largest h_samp_factor */
  12.151    int max_v_samp_factor;	/* largest v_samp_factor */
  12.152  
  12.153 -  int min_DCT_scaled_size;	/* smallest DCT_scaled_size of any component */
  12.154 +  int min_DCT_h_scaled_size;	/* smallest DCT_h_scaled_size of any component */
  12.155 +  int min_DCT_v_scaled_size;	/* smallest DCT_v_scaled_size of any component */
  12.156  
  12.157    JDIMENSION total_iMCU_rows;	/* # of iMCU rows in image */
  12.158    /* The coefficient controller's input and output progress is measured in
  12.159 @@ -583,7 +616,7 @@
  12.160     * in fully interleaved JPEG scans, but are used whether the scan is
  12.161     * interleaved or not.  We define an iMCU row as v_samp_factor DCT block
  12.162     * rows of each component.  Therefore, the IDCT output contains
  12.163 -   * v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row.
  12.164 +   * v_samp_factor*DCT_v_scaled_size sample rows of a component per iMCU row.
  12.165     */
  12.166  
  12.167    JSAMPLE * sample_range_limit; /* table for fast range-limiting */
  12.168 @@ -607,6 +640,12 @@
  12.169  
  12.170    int Ss, Se, Ah, Al;		/* progressive JPEG parameters for scan */
  12.171  
  12.172 +  /* These fields are derived from Se of first SOS marker.
  12.173 +   */
  12.174 +  int block_size;		/* the basic DCT block size: 1..16 */
  12.175 +  const int * natural_order; /* natural-order position array for entropy decode */
  12.176 +  int lim_Se;			/* min( Se, DCTSIZE2-1 ) for entropy decode */
  12.177 +
  12.178    /* This field is shared between entropy decoder and marker parser.
  12.179     * It is either zero or the code of a JPEG marker that has been
  12.180     * read from the data source, but has not yet been processed.
  12.181 @@ -836,11 +875,14 @@
  12.182  #define jpeg_destroy_decompress	jDestDecompress
  12.183  #define jpeg_stdio_dest		jStdDest
  12.184  #define jpeg_stdio_src		jStdSrc
  12.185 +#define jpeg_mem_dest		jMemDest
  12.186 +#define jpeg_mem_src		jMemSrc
  12.187  #define jpeg_set_defaults	jSetDefaults
  12.188  #define jpeg_set_colorspace	jSetColorspace
  12.189  #define jpeg_default_colorspace	jDefColorspace
  12.190  #define jpeg_set_quality	jSetQuality
  12.191  #define jpeg_set_linear_quality	jSetLQuality
  12.192 +#define jpeg_default_qtables	jDefQTables
  12.193  #define jpeg_add_quant_table	jAddQuantTable
  12.194  #define jpeg_quality_scaling	jQualityScaling
  12.195  #define jpeg_simple_progression	jSimProgress
  12.196 @@ -850,6 +892,7 @@
  12.197  #define jpeg_start_compress	jStrtCompress
  12.198  #define jpeg_write_scanlines	jWrtScanlines
  12.199  #define jpeg_finish_compress	jFinCompress
  12.200 +#define jpeg_calc_jpeg_dimensions	jCjpegDimensions
  12.201  #define jpeg_write_raw_data	jWrtRawData
  12.202  #define jpeg_write_marker	jWrtMarker
  12.203  #define jpeg_write_m_header	jWrtMHeader
  12.204 @@ -866,6 +909,7 @@
  12.205  #define jpeg_input_complete	jInComplete
  12.206  #define jpeg_new_colormap	jNewCMap
  12.207  #define jpeg_consume_input	jConsumeInput
  12.208 +#define jpeg_core_output_dimensions	jCoreDimensions
  12.209  #define jpeg_calc_output_dimensions	jCalcDimensions
  12.210  #define jpeg_save_markers	jSaveMarkers
  12.211  #define jpeg_set_marker_processor	jSetMarker
  12.212 @@ -910,6 +954,14 @@
  12.213  EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile));
  12.214  EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile));
  12.215  
  12.216 +/* Data source and destination managers: memory buffers. */
  12.217 +EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo,
  12.218 +			       unsigned char ** outbuffer,
  12.219 +			       unsigned long * outsize));
  12.220 +EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo,
  12.221 +			      unsigned char * inbuffer,
  12.222 +			      unsigned long insize));
  12.223 +
  12.224  /* Default parameter setup for compression */
  12.225  EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo));
  12.226  /* Compression parameter setup aids */
  12.227 @@ -921,6 +973,8 @@
  12.228  EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo,
  12.229  					  int scale_factor,
  12.230  					  boolean force_baseline));
  12.231 +EXTERN(void) jpeg_default_qtables JPP((j_compress_ptr cinfo,
  12.232 +				       boolean force_baseline));
  12.233  EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl,
  12.234  				       const unsigned int *basic_table,
  12.235  				       int scale_factor,
  12.236 @@ -940,12 +994,15 @@
  12.237  					     JDIMENSION num_lines));
  12.238  EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo));
  12.239  
  12.240 +/* Precalculate JPEG dimensions for current compression parameters. */
  12.241 +EXTERN(void) jpeg_calc_jpeg_dimensions JPP((j_compress_ptr cinfo));
  12.242 +
  12.243  /* Replaces jpeg_write_scanlines when writing raw downsampled data. */
  12.244  EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo,
  12.245  					    JSAMPIMAGE data,
  12.246  					    JDIMENSION num_lines));
  12.247  
  12.248 -/* Write a special marker.  See libjpeg.doc concerning safe usage. */
  12.249 +/* Write a special marker.  See libjpeg.txt concerning safe usage. */
  12.250  EXTERN(void) jpeg_write_marker
  12.251  	JPP((j_compress_ptr cinfo, int marker,
  12.252  	     const JOCTET * dataptr, unsigned int datalen));
  12.253 @@ -999,6 +1056,7 @@
  12.254  #define JPEG_SCAN_COMPLETED	4 /* Completed last iMCU row of a scan */
  12.255  
  12.256  /* Precalculate output dimensions for current decompression parameters. */
  12.257 +EXTERN(void) jpeg_core_output_dimensions JPP((j_decompress_ptr cinfo));
  12.258  EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo));
  12.259  
  12.260  /* Control saving of COM and APPn markers into marker_list. */
  12.261 @@ -1093,4 +1151,10 @@
  12.262  #include "jerror.h"		/* fetch error codes too */
  12.263  #endif
  12.264  
  12.265 +#ifdef __cplusplus
  12.266 +#ifndef DONT_USE_EXTERN_C
  12.267 +}
  12.268 +#endif
  12.269 +#endif
  12.270 +
  12.271  #endif /* JPEGLIB_H */
    13.1 --- a/VisualC/graphics/include/png.h	Mon Jan 02 15:48:33 2012 -0500
    13.2 +++ b/VisualC/graphics/include/png.h	Mon Jan 02 17:19:13 2012 -0500
    13.3 @@ -1,25 +1,26 @@
    13.4 +
    13.5  /* png.h - header file for PNG reference library
    13.6   *
    13.7 - * libpng version 1.2.40 - September 10, 2009
    13.8 - * Copyright (c) 1998-2009 Glenn Randers-Pehrson
    13.9 + * libpng version 1.5.7 - December 15, 2011
   13.10 + * Copyright (c) 1998-2011 Glenn Randers-Pehrson
   13.11   * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
   13.12   * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
   13.13   *
   13.14   * This code is released under the libpng license (See LICENSE, below)
   13.15   *
   13.16   * Authors and maintainers:
   13.17 - *  libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
   13.18 - *  libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
   13.19 - *  libpng versions 0.97, January 1998, through 1.2.40 - September 10, 2009: Glenn
   13.20 - *  See also "Contributing Authors", below.
   13.21 + *   libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
   13.22 + *   libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
   13.23 + *   libpng versions 0.97, January 1998, through 1.5.7 - December 15, 2011: Glenn
   13.24 + *   See also "Contributing Authors", below.
   13.25   *
   13.26   * Note about libpng version numbers:
   13.27   *
   13.28 - *    Due to various miscommunications, unforeseen code incompatibilities
   13.29 - *    and occasional factors outside the authors' control, version numbering
   13.30 - *    on the library has not always been consistent and straightforward.
   13.31 - *    The following table summarizes matters since version 0.89c, which was
   13.32 - *    the first widely used release:
   13.33 + *   Due to various miscommunications, unforeseen code incompatibilities
   13.34 + *   and occasional factors outside the authors' control, version numbering
   13.35 + *   on the library has not always been consistent and straightforward.
   13.36 + *   The following table summarizes matters since version 0.89c, which was
   13.37 + *   the first widely used release:
   13.38   *
   13.39   *    source                 png.h  png.h  shared-lib
   13.40   *    version                string   int  version
   13.41 @@ -104,168 +105,88 @@
   13.42   *    1.0.16                  10    10016  10.so.0.1.0.16
   13.43   *    1.2.6                   13    10206  12.so.0.1.2.6
   13.44   *    1.2.7beta1-2            13    10207  12.so.0.1.2.7beta1-2
   13.45 - *    1.0.17rc1               10    10017  10.so.0.1.0.17rc1
   13.46 + *    1.0.17rc1               10    10017  12.so.0.1.0.17rc1
   13.47   *    1.2.7rc1                13    10207  12.so.0.1.2.7rc1
   13.48 - *    1.0.17                  10    10017  10.so.0.1.0.17
   13.49 + *    1.0.17                  10    10017  12.so.0.1.0.17
   13.50   *    1.2.7                   13    10207  12.so.0.1.2.7
   13.51   *    1.2.8beta1-5            13    10208  12.so.0.1.2.8beta1-5
   13.52 - *    1.0.18rc1-5             10    10018  10.so.0.1.0.18rc1-5
   13.53 + *    1.0.18rc1-5             10    10018  12.so.0.1.0.18rc1-5
   13.54   *    1.2.8rc1-5              13    10208  12.so.0.1.2.8rc1-5
   13.55 - *    1.0.18                  10    10018  10.so.0.1.0.18
   13.56 + *    1.0.18                  10    10018  12.so.0.1.0.18
   13.57   *    1.2.8                   13    10208  12.so.0.1.2.8
   13.58   *    1.2.9beta1-3            13    10209  12.so.0.1.2.9beta1-3
   13.59   *    1.2.9beta4-11           13    10209  12.so.0.9[.0]
   13.60   *    1.2.9rc1                13    10209  12.so.0.9[.0]
   13.61   *    1.2.9                   13    10209  12.so.0.9[.0]
   13.62 - *    1.2.10beta1-8           13    10210  12.so.0.10[.0]
   13.63 - *    1.2.10rc1-3             13    10210  12.so.0.10[.0]
   13.64 + *    1.2.10beta1-7           13    10210  12.so.0.10[.0]
   13.65 + *    1.2.10rc1-2             13    10210  12.so.0.10[.0]
   13.66   *    1.2.10                  13    10210  12.so.0.10[.0]
   13.67 + *    1.4.0beta1-5            14    10400  14.so.0.0[.0]
   13.68   *    1.2.11beta1-4           13    10211  12.so.0.11[.0]
   13.69 - *    1.0.19rc1-5             10    10019  10.so.0.19[.0]
   13.70 - *    1.2.11rc1-5             13    10211  12.so.0.11[.0]
   13.71 - *    1.0.19                  10    10019  10.so.0.19[.0]
   13.72 + *    1.4.0beta7-8            14    10400  14.so.0.0[.0]
   13.73   *    1.2.11                  13    10211  12.so.0.11[.0]
   13.74 - *    1.0.20                  10    10020  10.so.0.20[.0]
   13.75   *    1.2.12                  13    10212  12.so.0.12[.0]
   13.76 - *    1.2.13beta1             13    10213  12.so.0.13[.0]
   13.77 - *    1.0.21                  10    10021  10.so.0.21[.0]
   13.78 + *    1.4.0beta9-14           14    10400  14.so.0.0[.0]
   13.79   *    1.2.13                  13    10213  12.so.0.13[.0]
   13.80 - *    1.2.14beta1-2           13    10214  12.so.0.14[.0]
   13.81 - *    1.0.22rc1               10    10022  10.so.0.22[.0]
   13.82 - *    1.2.14rc1               13    10214  12.so.0.14[.0]
   13.83 - *    1.0.22                  10    10022  10.so.0.22[.0]
   13.84 - *    1.2.14                  13    10214  12.so.0.14[.0]
   13.85 - *    1.2.15beta1-6           13    10215  12.so.0.15[.0]
   13.86 - *    1.0.23rc1-5             10    10023  10.so.0.23[.0]
   13.87 - *    1.2.15rc1-5             13    10215  12.so.0.15[.0]
   13.88 - *    1.0.23                  10    10023  10.so.0.23[.0]
   13.89 - *    1.2.15                  13    10215  12.so.0.15[.0]
   13.90 - *    1.2.16beta1-2           13    10216  12.so.0.16[.0]
   13.91 - *    1.2.16rc1               13    10216  12.so.0.16[.0]
   13.92 - *    1.0.24                  10    10024  10.so.0.24[.0]
   13.93 - *    1.2.16                  13    10216  12.so.0.16[.0]
   13.94 - *    1.2.17beta1-2           13    10217  12.so.0.17[.0]
   13.95 - *    1.0.25rc1               10    10025  10.so.0.25[.0]
   13.96 - *    1.2.17rc1-3             13    10217  12.so.0.17[.0]
   13.97 - *    1.0.25                  10    10025  10.so.0.25[.0]
   13.98 - *    1.2.17                  13    10217  12.so.0.17[.0]
   13.99 - *    1.0.26                  10    10026  10.so.0.26[.0]
  13.100 - *    1.2.18                  13    10218  12.so.0.18[.0]
  13.101 - *    1.2.19beta1-31          13    10219  12.so.0.19[.0]
  13.102 - *    1.0.27rc1-6             10    10027  10.so.0.27[.0]
  13.103 - *    1.2.19rc1-6             13    10219  12.so.0.19[.0]
  13.104 - *    1.0.27                  10    10027  10.so.0.27[.0]
  13.105 - *    1.2.19                  13    10219  12.so.0.19[.0]
  13.106 - *    1.2.20beta01-04         13    10220  12.so.0.20[.0]
  13.107 - *    1.0.28rc1-6             10    10028  10.so.0.28[.0]
  13.108 - *    1.2.20rc1-6             13    10220  12.so.0.20[.0]
  13.109 - *    1.0.28                  10    10028  10.so.0.28[.0]
  13.110 - *    1.2.20                  13    10220  12.so.0.20[.0]
  13.111 - *    1.2.21beta1-2           13    10221  12.so.0.21[.0]
  13.112 - *    1.2.21rc1-3             13    10221  12.so.0.21[.0]
  13.113 - *    1.0.29                  10    10029  10.so.0.29[.0]
  13.114 - *    1.2.21                  13    10221  12.so.0.21[.0]
  13.115 - *    1.2.22beta1-4           13    10222  12.so.0.22[.0]
  13.116 - *    1.0.30rc1               10    10030  10.so.0.30[.0]
  13.117 - *    1.2.22rc1               13    10222  12.so.0.22[.0]
  13.118 - *    1.0.30                  10    10030  10.so.0.30[.0]
  13.119 - *    1.2.22                  13    10222  12.so.0.22[.0]
  13.120 - *    1.2.23beta01-05         13    10223  12.so.0.23[.0]
  13.121 - *    1.2.23rc01              13    10223  12.so.0.23[.0]
  13.122 - *    1.2.23                  13    10223  12.so.0.23[.0]
  13.123 - *    1.2.24beta01-02         13    10224  12.so.0.24[.0]
  13.124 - *    1.2.24rc01              13    10224  12.so.0.24[.0]
  13.125 - *    1.2.24                  13    10224  12.so.0.24[.0]
  13.126 - *    1.2.25beta01-06         13    10225  12.so.0.25[.0]
  13.127 - *    1.2.25rc01-02           13    10225  12.so.0.25[.0]
  13.128 - *    1.0.31                  10    10031  10.so.0.31[.0]
  13.129 - *    1.2.25                  13    10225  12.so.0.25[.0]
  13.130 - *    1.2.26beta01-06         13    10226  12.so.0.26[.0]
  13.131 - *    1.2.26rc01              13    10226  12.so.0.26[.0]
  13.132 - *    1.2.26                  13    10226  12.so.0.26[.0]
  13.133 - *    1.0.32                  10    10032  10.so.0.32[.0]
  13.134 - *    1.2.27beta01-06         13    10227  12.so.0.27[.0]
  13.135 - *    1.2.27rc01              13    10227  12.so.0.27[.0]
  13.136 - *    1.0.33                  10    10033  10.so.0.33[.0]
  13.137 - *    1.2.27                  13    10227  12.so.0.27[.0]
  13.138 - *    1.0.34                  10    10034  10.so.0.34[.0]
  13.139 - *    1.2.28                  13    10228  12.so.0.28[.0]
  13.140 - *    1.2.29beta01-03         13    10229  12.so.0.29[.0]
  13.141 - *    1.2.29rc01              13    10229  12.so.0.29[.0]
  13.142 - *    1.0.35                  10    10035  10.so.0.35[.0]
  13.143 - *    1.2.29                  13    10229  12.so.0.29[.0]
  13.144 - *    1.0.37                  10    10037  10.so.0.37[.0]
  13.145 - *    1.2.30beta01-04         13    10230  12.so.0.30[.0]
  13.146 - *    1.0.38rc01-08           10    10038  10.so.0.38[.0]
  13.147 - *    1.2.30rc01-08           13    10230  12.so.0.30[.0]
  13.148 - *    1.0.38                  10    10038  10.so.0.38[.0]
  13.149 - *    1.2.30                  13    10230  12.so.0.30[.0]
  13.150 - *    1.0.39rc01-03           10    10039  10.so.0.39[.0]
  13.151 - *    1.2.31rc01-03           13    10231  12.so.0.31[.0]
  13.152 - *    1.0.39                  10    10039  10.so.0.39[.0]
  13.153 - *    1.2.31                  13    10231  12.so.0.31[.0]
  13.154 - *    1.2.32beta01-02         13    10232  12.so.0.32[.0]
  13.155 - *    1.0.40rc01              10    10040  10.so.0.40[.0]
  13.156 - *    1.2.32rc01              13    10232  12.so.0.32[.0]
  13.157 - *    1.0.40                  10    10040  10.so.0.40[.0]
  13.158 - *    1.2.32                  13    10232  12.so.0.32[.0]
  13.159 - *    1.2.33beta01-02         13    10233  12.so.0.33[.0]
  13.160 - *    1.2.33rc01-02           13    10233  12.so.0.33[.0]
  13.161 - *    1.0.41rc01              10    10041  10.so.0.41[.0]
  13.162 - *    1.2.33                  13    10233  12.so.0.33[.0]
  13.163 - *    1.0.41                  10    10041  10.so.0.41[.0]
  13.164 - *    1.2.34beta01-07         13    10234  12.so.0.34[.0]
  13.165 - *    1.0.42rc01              10    10042  10.so.0.42[.0]
  13.166 - *    1.2.34rc01              13    10234  12.so.0.34[.0]
  13.167 - *    1.0.42                  10    10042  10.so.0.42[.0]
  13.168 - *    1.2.34                  13    10234  12.so.0.34[.0]
  13.169 - *    1.2.35beta01-03         13    10235  12.so.0.35[.0]
  13.170 - *    1.0.43rc01-02           10    10043  10.so.0.43[.0]
  13.171 - *    1.2.35rc01-02           13    10235  12.so.0.35[.0]
  13.172 - *    1.0.43                  10    10043  10.so.0.43[.0]
  13.173 - *    1.2.35                  13    10235  12.so.0.35[.0]
  13.174 - *    1.2.36beta01-05         13    10236  12.so.0.36[.0]
  13.175 - *    1.2.36rc01              13    10236  12.so.0.36[.0]
  13.176 - *    1.0.44                  10    10044  10.so.0.44[.0]
  13.177 - *    1.2.36                  13    10236  12.so.0.36[.0]
  13.178 - *    1.2.37beta01-03         13    10237  12.so.0.37[.0]
  13.179 - *    1.2.37rc01              13    10237  12.so.0.37[.0]
  13.180 - *    1.2.37                  13    10237  12.so.0.37[.0]
  13.181 - *    1.2.45                  10    10045  12.so.0.45[.0]
  13.182 - *    1.0.46                  10    10046  10.so.0.46[.0]
  13.183 - *    1.2.38beta01            13    10238  12.so.0.38[.0]
  13.184 - *    1.2.38rc01-03           13    10238  12.so.0.38[.0]
  13.185 - *    1.0.47                  10    10047  10.so.0.47[.0]
  13.186 - *    1.2.38                  13    10238  12.so.0.38[.0]
  13.187 - *    1.2.39beta01-05         13    10239  12.so.0.39[.0]
  13.188 - *    1.2.39rc01              13    10239  12.so.0.39[.0]
  13.189 - *    1.0.48                  10    10048  10.so.0.48[.0]
  13.190 - *    1.2.39                  13    10239  12.so.0.39[.0]
  13.191 - *    1.2.40beta01            13    10240  12.so.0.40[.0]
  13.192 - *    1.2.40rc01              13    10240  12.so.0.40[.0]
  13.193 - *    1.0.49                  10    10049  10.so.0.49[.0]
  13.194 - *    1.2.40                  13    10240  12.so.0.40[.0]
  13.195 + *    1.4.0beta15-36          14    10400  14.so.0.0[.0]
  13.196 + *    1.4.0beta37-87          14    10400  14.so.14.0[.0]
  13.197 + *    1.4.0rc01               14    10400  14.so.14.0[.0]
  13.198 + *    1.4.0beta88-109         14    10400  14.so.14.0[.0]
  13.199 + *    1.4.0rc02-08            14    10400  14.so.14.0[.0]
  13.200 + *    1.4.0                   14    10400  14.so.14.0[.0]
  13.201 + *    1.4.1beta01-03          14    10401  14.so.14.1[.0]
  13.202 + *    1.4.1rc01               14    10401  14.so.14.1[.0]
  13.203 + *    1.4.1beta04-12          14    10401  14.so.14.1[.0]
  13.204 + *    1.4.1                   14    10401  14.so.14.1[.0]
  13.205 + *    1.4.2                   14    10402  14.so.14.2[.0]
  13.206 + *    1.4.3                   14    10403  14.so.14.3[.0]
  13.207 + *    1.4.4                   14    10404  14.so.14.4[.0]
  13.208 + *    1.5.0beta01-58          15    10500  15.so.15.0[.0]
  13.209 + *    1.5.0rc01-07            15    10500  15.so.15.0[.0]
  13.210 + *    1.5.0                   15    10500  15.so.15.0[.0]
  13.211 + *    1.5.1beta01-11          15    10501  15.so.15.1[.0]
  13.212 + *    1.5.1rc01-02            15    10501  15.so.15.1[.0]
  13.213 + *    1.5.1                   15    10501  15.so.15.1[.0]
  13.214 + *    1.5.2beta01-03          15    10502  15.so.15.2[.0]
  13.215 + *    1.5.2rc01-03            15    10502  15.so.15.2[.0]
  13.216 + *    1.5.2                   15    10502  15.so.15.2[.0]
  13.217 + *    1.5.3beta01-10          15    10503  15.so.15.3[.0]
  13.218 + *    1.5.3rc01-02            15    10503  15.so.15.3[.0]
  13.219 + *    1.5.3beta11             15    10503  15.so.15.3[.0]
  13.220 + *    1.5.3 [omitted]
  13.221 + *    1.5.4beta01-08          15    10504  15.so.15.4[.0]
  13.222 + *    1.5.4rc01               15    10504  15.so.15.4[.0]
  13.223 + *    1.5.4                   15    10504  15.so.15.4[.0]
  13.224 + *    1.5.5beta01-08          15    10505  15.so.15.5[.0]
  13.225 + *    1.5.5rc01               15    10505  15.so.15.5[.0]
  13.226 + *    1.5.5                   15    10505  15.so.15.5[.0]
  13.227 + *    1.5.6beta01-07          15    10506  15.so.15.6[.0]
  13.228 + *    1.5.6rc01-03            15    10506  15.so.15.6[.0]
  13.229 + *    1.5.6                   15    10506  15.so.15.6[.0]
  13.230 + *    1.5.7beta01-05          15    10507  15.so.15.7[.0]
  13.231 + *    1.5.7rc01-03            15    10507  15.so.15.7[.0]
  13.232 + *    1.5.7                   15    10507  15.so.15.7[.0]
  13.233   *
  13.234 - *    Henceforth the source version will match the shared-library major
  13.235 - *    and minor numbers; the shared-library major version number will be
  13.236 - *    used for changes in backward compatibility, as it is intended.  The
  13.237 - *    PNG_LIBPNG_VER macro, which is not used within libpng but is available
  13.238 - *    for applications, is an unsigned integer of the form xyyzz corresponding
  13.239 - *    to the source version x.y.z (leading zeros in y and z).  Beta versions
  13.240 - *    were given the previous public release number plus a letter, until
  13.241 - *    version 1.0.6j; from then on they were given the upcoming public
  13.242 - *    release number plus "betaNN" or "rcNN".
  13.243 + *   Henceforth the source version will match the shared-library major
  13.244 + *   and minor numbers; the shared-library major version number will be
  13.245 + *   used for changes in backward compatibility, as it is intended.  The
  13.246 + *   PNG_LIBPNG_VER macro, which is not used within libpng but is available
  13.247 + *   for applications, is an unsigned integer of the form xyyzz corresponding
  13.248 + *   to the source version x.y.z (leading zeros in y and z).  Beta versions
  13.249 + *   were given the previous public release number plus a letter, until
  13.250 + *   version 1.0.6j; from then on they were given the upcoming public
  13.251 + *   release number plus "betaNN" or "rcN".
  13.252   *
  13.253 - *    Binary incompatibility exists only when applications make direct access
  13.254 - *    to the info_ptr or png_ptr members through png.h, and the compiled
  13.255 - *    application is loaded with a different version of the library.
  13.256 + *   Binary incompatibility exists only when applications make direct access
  13.257 + *   to the info_ptr or png_ptr members through png.h, and the compiled
  13.258 + *   application is loaded with a different version of the library.
  13.259   *
  13.260 - *    DLLNUM will change each time there are forward or backward changes
  13.261 - *    in binary compatibility (e.g., when a new feature is added).
  13.262 + *   DLLNUM will change each time there are forward or backward changes
  13.263 + *   in binary compatibility (e.g., when a new feature is added).
  13.264   *
  13.265 - * See libpng.txt or libpng.3 for more information.  The PNG specification
  13.266 - * is available as a W3C Recommendation and as an ISO Specification,
  13.267 - * <http://www.w3.org/TR/2003/REC-PNG-20031110/
  13.268 + * See libpng-manual.txt or libpng.3 for more information.  The PNG
  13.269 + * specification is available as a W3C Recommendation and as an ISO
  13.270 + * Specification, <http://www.w3.org/TR/2003/REC-PNG-20031110/
  13.271   */
  13.272  
  13.273  /*
  13.274 @@ -276,8 +197,8 @@
  13.275   *
  13.276   * This code is released under the libpng license.
  13.277   *
  13.278 - * libpng versions 1.2.6, August 15, 2004, through 1.2.40, September 10, 2009, are
  13.279 - * Copyright (c) 2004, 2006-2009 Glenn Randers-Pehrson, and are
  13.280 + * libpng versions 1.2.6, August 15, 2004, through 1.5.7, December 15, 2011, are
  13.281 + * Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
  13.282   * distributed according to the same disclaimer and license as libpng-1.2.5
  13.283   * with the following individual added to the list of Contributing Authors:
  13.284   *
  13.285 @@ -346,13 +267,13 @@
  13.286   * source code, or portions hereof, for any purpose, without fee, subject
  13.287   * to the following restrictions:
  13.288   *
  13.289 - * 1. The origin of this source code must not be misrepresented.
  13.290 + *   1. The origin of this source code must not be misrepresented.
  13.291   *
  13.292 - * 2. Altered versions must be plainly marked as such and
  13.293 - * must not be misrepresented as being the original source.
  13.294 + *   2. Altered versions must be plainly marked as such and must not
  13.295 + *      be misrepresented as being the original source.
  13.296   *
  13.297 - * 3. This Copyright notice may not be removed or altered from
  13.298 - *    any source or altered source distribution.
  13.299 + *   3. This Copyright notice may not be removed or altered from
  13.300 + *      any source or altered source distribution.
  13.301   *
  13.302   * The Contributing Authors and Group 42, Inc. specifically permit, without
  13.303   * fee, and encourage the use of this source code as a component to
  13.304 @@ -365,7 +286,7 @@
  13.305   * A "png_get_copyright" function is available, for convenient use in "about"
  13.306   * boxes and the like:
  13.307   *
  13.308 - * printf("%s",png_get_copyright(NULL));
  13.309 + *     printf("%s", png_get_copyright(NULL));
  13.310   *
  13.311   * Also, the PNG logo (in PNG format, of course) is supplied in the
  13.312   * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
  13.313 @@ -388,25 +309,24 @@
  13.314   * Y2K compliance in libpng:
  13.315   * =========================
  13.316   *
  13.317 - *    September 10, 2009
  13.318 + *    December 15, 2011
  13.319   *
  13.320   *    Since the PNG Development group is an ad-hoc body, we can't make
  13.321   *    an official declaration.
  13.322   *
  13.323   *    This is your unofficial assurance that libpng from version 0.71 and
  13.324 - *    upward through 1.2.40 are Y2K compliant.  It is my belief that earlier
  13.325 - *    versions were also Y2K compliant.
  13.326 + *    upward through 1.5.7 are Y2K compliant.  It is my belief that
  13.327 + *    earlier versions were also Y2K compliant.
  13.328   *
  13.329 - *    Libpng only has three year fields.  One is a 2-byte unsigned integer
  13.330 - *    that will hold years up to 65535.  The other two hold the date in text
  13.331 + *    Libpng only has two year fields.  One is a 2-byte unsigned integer
  13.332 + *    that will hold years up to 65535.  The other holds the date in text
  13.333   *    format, and will hold years up to 9999.
  13.334   *
  13.335   *    The integer is
  13.336   *        "png_uint_16 year" in png_time_struct.
  13.337   *
  13.338 - *    The strings are
  13.339 - *        "png_charp time_buffer" in png_struct and
  13.340 - *        "near_time_buffer", which is a local character string in png.c.
  13.341 + *    The string is
  13.342 + *        "png_char time_buffer" in png_struct
  13.343   *
  13.344   *    There are seven time-related functions:
  13.345   *        png.c: png_convert_to_rfc_1123() in png.c
  13.346 @@ -443,24 +363,28 @@
  13.347  #ifndef PNG_H
  13.348  #define PNG_H
  13.349  
  13.350 -/* This is not the place to learn how to use libpng.  The file libpng.txt
  13.351 +/* This is not the place to learn how to use libpng. The file libpng-manual.txt
  13.352   * describes how to use libpng, and the file example.c summarizes it
  13.353   * with some code on which to build.  This file is useful for looking
  13.354   * at the actual function definitions and structure components.
  13.355 + *
  13.356 + * If you just need to read a PNG file and don't want to read the documentation
  13.357 + * skip to the end of this file and read the section entitled 'simplified API'.
  13.358   */
  13.359  
  13.360  /* Version information for png.h - this should match the version in png.c */
  13.361 -#define PNG_LIBPNG_VER_STRING "1.2.40"
  13.362 +#define PNG_LIBPNG_VER_STRING "1.5.7"
  13.363  #define PNG_HEADER_VERSION_STRING \
  13.364 -   " libpng version 1.2.40 - September 10, 2009\n"
  13.365 +     " libpng version 1.5.7 - December 15, 2011\n"
  13.366  
  13.367 -#define PNG_LIBPNG_VER_SONUM   0
  13.368 -#define PNG_LIBPNG_VER_DLLNUM  13
  13.369 +#define PNG_LIBPNG_VER_SONUM   15
  13.370 +#define PNG_LIBPNG_VER_DLLNUM  15
  13.371  
  13.372  /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
  13.373  #define PNG_LIBPNG_VER_MAJOR   1
  13.374 -#define PNG_LIBPNG_VER_MINOR   2
  13.375 -#define PNG_LIBPNG_VER_RELEASE 40
  13.376 +#define PNG_LIBPNG_VER_MINOR   5
  13.377 +#define PNG_LIBPNG_VER_RELEASE 7
  13.378 +
  13.379  /* This should match the numeric part of the final component of
  13.380   * PNG_LIBPNG_VER_STRING, omitting any leading zero:
  13.381   */
  13.382 @@ -482,7 +406,7 @@
  13.383  #define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
  13.384                                         PNG_LIBPNG_BUILD_PRIVATE */
  13.385  
  13.386 -#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
  13.387 +#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_BETA
  13.388  
  13.389  /* Careful here.  At one time, Guy wanted to use 082, but that would be octal.
  13.390   * We must not include leading zeros.
  13.391 @@ -490,19 +414,45 @@
  13.392   * version 1.0.0 was mis-numbered 100 instead of 10000).  From
  13.393   * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release
  13.394   */
  13.395 -#define PNG_LIBPNG_VER 10240 /* 1.2.40 */
  13.396 +#define PNG_LIBPNG_VER 10507 /* 1.5.7 */
  13.397 +
  13.398 +/* Library configuration: these options cannot be changed after
  13.399 + * the library has been built.
  13.400 + */
  13.401 +#ifndef PNGLCONF_H
  13.402 +    /* If pnglibconf.h is missing, you can
  13.403 +     * copy scripts/pnglibconf.h.prebuilt to pnglibconf.h
  13.404 +     */
  13.405 +#   include "pnglibconf.h"
  13.406 +#endif
  13.407  
  13.408  #ifndef PNG_VERSION_INFO_ONLY
  13.409 -/* Include the compression library's header */
  13.410 -#include "zlib.h"
  13.411 +#  ifndef PNG_BUILDING_SYMBOL_TABLE
  13.412 +  /*
  13.413 +   *   Standard header files (not needed for the version info or while
  13.414 +   *   building symbol table -- see scripts/pnglibconf.dfa)
  13.415 +   */
  13.416 +#    ifdef PNG_SETJMP_SUPPORTED
  13.417 +#      include <setjmp.h>
  13.418 +#    endif
  13.419 +
  13.420 +    /* Need the time information for converting tIME chunks, it
  13.421 +     * defines struct tm:
  13.422 +     */
  13.423 +#    ifdef PNG_CONVERT_tIME_SUPPORTED
  13.424 +       /* "time.h" functions are not supported on all operating systems */
  13.425 +#      include <time.h>
  13.426 +#    endif
  13.427 +#  endif
  13.428 +
  13.429 +/* Machine specific configuration. */
  13.430 +#  include "pngconf.h"
  13.431  #endif
  13.432  
  13.433 -/* Include all user configurable info, including optional assembler routines */
  13.434 -#include "pngconf.h"
  13.435 -
  13.436  /*
  13.437 - * Added at libpng-1.2.8 */
  13.438 -/* Ref MSDN: Private as priority over Special
  13.439 + * Added at libpng-1.2.8
  13.440 + *
  13.441 + * Ref MSDN: Private as priority over Special
  13.442   * VS_FF_PRIVATEBUILD File *was not* built using standard release
  13.443   * procedures. If this value is given, the StringFileInfo block must
  13.444   * contain a PrivateBuild string.
  13.445 @@ -513,13 +463,13 @@
  13.446   * StringFileInfo block must contain a SpecialBuild string.
  13.447   */
  13.448  
  13.449 -#if defined(PNG_USER_PRIVATEBUILD)
  13.450 +#ifdef PNG_USER_PRIVATEBUILD /* From pnglibconf.h */
  13.451  #  define PNG_LIBPNG_BUILD_TYPE \
  13.452 -          (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE)
  13.453 +       (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE)
  13.454  #else
  13.455 -#  if defined(PNG_LIBPNG_SPECIALBUILD)
  13.456 +#  ifdef PNG_LIBPNG_SPECIALBUILD
  13.457  #    define PNG_LIBPNG_BUILD_TYPE \
  13.458 -            (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL)
  13.459 +         (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL)
  13.460  #  else
  13.461  #    define PNG_LIBPNG_BUILD_TYPE (PNG_LIBPNG_BUILD_BASE_TYPE)
  13.462  #  endif
  13.463 @@ -532,73 +482,61 @@
  13.464  extern "C" {
  13.465  #endif /* __cplusplus */
  13.466  
  13.467 -/* This file is arranged in several sections.  The first section contains
  13.468 - * structure and type definitions.  The second section contains the external
  13.469 - * library functions, while the third has the internal library functions,
  13.470 - * which applications aren't expected to use directly.
  13.471 - */
  13.472 -
  13.473 -#ifndef PNG_NO_TYPECAST_NULL
  13.474 -#define int_p_NULL                (int *)NULL
  13.475 -#define png_bytep_NULL            (png_bytep)NULL
  13.476 -#define png_bytepp_NULL           (png_bytepp)NULL
  13.477 -#define png_doublep_NULL          (png_doublep)NULL
  13.478 -#define png_error_ptr_NULL        (png_error_ptr)NULL
  13.479 -#define png_flush_ptr_NULL        (png_flush_ptr)NULL
  13.480 -#define png_free_ptr_NULL         (png_free_ptr)NULL
  13.481 -#define png_infopp_NULL           (png_infopp)NULL
  13.482 -#define png_malloc_ptr_NULL       (png_malloc_ptr)NULL
  13.483 -#define png_read_status_ptr_NULL  (png_read_status_ptr)NULL
  13.484 -#define png_rw_ptr_NULL           (png_rw_ptr)NULL
  13.485 -#define png_structp_NULL          (png_structp)NULL
  13.486 -#define png_uint_16p_NULL         (png_uint_16p)NULL
  13.487 -#define png_voidp_NULL            (png_voidp)NULL
  13.488 -#define png_write_status_ptr_NULL (png_write_status_ptr)NULL
  13.489 -#else
  13.490 -#define int_p_NULL                NULL
  13.491 -#define png_bytep_NULL            NULL
  13.492 -#define png_bytepp_NULL           NULL
  13.493 -#define png_doublep_NULL          NULL
  13.494 -#define png_error_ptr_NULL        NULL
  13.495 -#define png_flush_ptr_NULL        NULL
  13.496 -#define png_free_ptr_NULL         NULL
  13.497 -#define png_infopp_NULL           NULL
  13.498 -#define png_malloc_ptr_NULL       NULL
  13.499 -#define png_read_status_ptr_NULL  NULL
  13.500 -#define png_rw_ptr_NULL           NULL
  13.501 -#define png_structp_NULL          NULL
  13.502 -#define png_uint_16p_NULL         NULL
  13.503 -#define png_voidp_NULL            NULL
  13.504 -#define png_write_status_ptr_NULL NULL
  13.505 -#endif
  13.506 -
  13.507 -/* Variables declared in png.c - only it needs to define PNG_NO_EXTERN */
  13.508 -#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
  13.509  /* Version information for C files, stored in png.c.  This had better match
  13.510   * the version above.
  13.511   */
  13.512 -#ifdef PNG_USE_GLOBAL_ARRAYS
  13.513 -PNG_EXPORT_VAR (PNG_CONST char) png_libpng_ver[18];
  13.514 -  /* Need room for 99.99.99beta99z */
  13.515 -#else
  13.516  #define png_libpng_ver png_get_header_ver(NULL)
  13.517 -#endif
  13.518  
  13.519 -#ifdef PNG_USE_GLOBAL_ARRAYS
  13.520 -/* This was removed in version 1.0.5c */
  13.521 -/* Structures to facilitate easy interlacing.  See png.c for more details */
  13.522 -PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_start[7];
  13.523 -PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_inc[7];
  13.524 -PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_ystart[7];
  13.525 -PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_yinc[7];
  13.526 -PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_mask[7];
  13.527 -PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_dsp_mask[7];
  13.528 -/* This isn't currently used.  If you need it, see png.c for more details.
  13.529 -PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_height[7];
  13.530 -*/
  13.531 -#endif
  13.532 +/* This file is arranged in several sections:
  13.533 + *
  13.534 + * 1. Any configuration options that can be specified by for the application
  13.535 + *    code when it is built.  (Build time configuration is in pnglibconf.h)
  13.536 + * 2. Type definitions (base types are defined in pngconf.h), structure
  13.537 + *    definitions.
  13.538 + * 3. Exported library functions.
  13.539 + *
  13.540 + * The library source code has additional files (principally pngpriv.h) that
  13.541 + * allow configuration of the library.
  13.542 + */
  13.543 +/* Section 1: run time configuration
  13.544 + * See pnglibconf.h for build time configuration
  13.545 + *
  13.546 + * Run time configuration allows the application to choose between
  13.547 + * implementations of certain arithmetic APIs.  The default is set
  13.548 + * at build time and recorded in pnglibconf.h, but it is safe to
  13.549 + * override these (and only these) settings.  Note that this won't
  13.550 + * change what the library does, only application code, and the
  13.551 + * settings can (and probably should) be made on a per-file basis
  13.552 + * by setting the #defines before including png.h
  13.553 + *
  13.554 + * Use macros to read integers from PNG data or use the exported
  13.555 + * functions?
  13.556 + *   PNG_USE_READ_MACROS: use the macros (see below)  Note that
  13.557 + *     the macros evaluate their argument multiple times.
  13.558 + *   PNG_NO_USE_READ_MACROS: call the relevant library function.
  13.559 + *
  13.560 + * Use the alternative algorithm for compositing alpha samples that
  13.561 + * does not use division?
  13.562 + *   PNG_READ_COMPOSITE_NODIV_SUPPORTED: use the 'no division'
  13.563 + *      algorithm.
  13.564 + *   PNG_NO_READ_COMPOSITE_NODIV: use the 'division' algorithm.
  13.565 + *
  13.566 + * How to handle benign errors if PNG_ALLOW_BENIGN_ERRORS is
  13.567 + * false?
  13.568 + *   PNG_ALLOW_BENIGN_ERRORS: map calls to the benign error
  13.569 + *      APIs to png_warning.
  13.570 + * Otherwise the calls are mapped to png_error.
  13.571 + */
  13.572  
  13.573 -#endif /* PNG_NO_EXTERN */
  13.574 +/* Section 2: type definitions, including structures and compile time
  13.575 + * constants.
  13.576 + * See pngconf.h for base types that vary by machine/system
  13.577 + */
  13.578 +
  13.579 +/* This triggers a compiler error in png.c, if png.c and png.h
  13.580 + * do not agree upon the version number.
  13.581 + */
  13.582 +typedef char* png_libpng_version_1_5_7;
  13.583  
  13.584  /* Three color definitions.  The order of the red, green, and blue, (and the
  13.585   * exact size) is not important, although the size of the fields need to
  13.586 @@ -611,6 +549,7 @@
  13.587     png_byte blue;
  13.588  } png_color;
  13.589  typedef png_color FAR * png_colorp;
  13.590 +typedef PNG_CONST png_color FAR * png_const_colorp;
  13.591  typedef png_color FAR * FAR * png_colorpp;
  13.592  
  13.593  typedef struct png_color_16_struct
  13.594 @@ -622,6 +561,7 @@
  13.595     png_uint_16 gray;  /* for use in grayscale files */
  13.596  } png_color_16;
  13.597  typedef png_color_16 FAR * png_color_16p;
  13.598 +typedef PNG_CONST png_color_16 FAR * png_const_color_16p;
  13.599  typedef png_color_16 FAR * FAR * png_color_16pp;
  13.600  
  13.601  typedef struct png_color_8_struct
  13.602 @@ -633,6 +573,7 @@
  13.603     png_byte alpha; /* for alpha channel files */
  13.604  } png_color_8;
  13.605  typedef png_color_8 FAR * png_color_8p;
  13.606 +typedef PNG_CONST png_color_8 FAR * png_const_color_8p;
  13.607  typedef png_color_8 FAR * FAR * png_color_8pp;
  13.608  
  13.609  /*
  13.610 @@ -648,6 +589,7 @@
  13.611     png_uint_16 frequency;
  13.612  } png_sPLT_entry;
  13.613  typedef png_sPLT_entry FAR * png_sPLT_entryp;
  13.614 +typedef PNG_CONST png_sPLT_entry FAR * png_const_sPLT_entryp;
  13.615  typedef png_sPLT_entry FAR * FAR * png_sPLT_entrypp;
  13.616  
  13.617  /*  When the depth of the sPLT palette is 8 bits, the color and alpha samples
  13.618 @@ -663,16 +605,26 @@
  13.619     png_int_32 nentries;      /* number of palette entries */
  13.620  } png_sPLT_t;
  13.621  typedef png_sPLT_t FAR * png_sPLT_tp;
  13.622 +typedef PNG_CONST png_sPLT_t FAR * png_const_sPLT_tp;
  13.623  typedef png_sPLT_t FAR * FAR * png_sPLT_tpp;
  13.624  
  13.625  #ifdef PNG_TEXT_SUPPORTED
  13.626  /* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file,
  13.627   * and whether that contents is compressed or not.  The "key" field
  13.628 - * points to a regular zero-terminated C string.  The "text", "lang", and
  13.629 - * "lang_key" fields can be regular C strings, empty strings, or NULL pointers.
  13.630 - * However, the * structure returned by png_get_text() will always contain
  13.631 - * regular zero-terminated C strings (possibly empty), never NULL pointers,
  13.632 - * so they can be safely used in printf() and other string-handling functions.
  13.633 + * points to a regular zero-terminated C string.  The "text" fields can be a
  13.634 + * regular C string, an empty string, or a NULL pointer.
  13.635 + * However, the structure returned by png_get_text() will always contain
  13.636 + * the "text" field as a regular zero-terminated C string (possibly
  13.637 + * empty), never a NULL pointer, so it can be safely used in printf() and
  13.638 + * other string-handling functions.  Note that the "itxt_length", "lang", and
  13.639 + * "lang_key" members of the structure only exist when the library is built
  13.640 + * with iTXt chunk support.  Prior to libpng-1.4.0 the library was built by
  13.641 + * default without iTXt support. Also note that when iTXt *is* supported,
  13.642 + * the "lang" and "lang_key" fields contain NULL pointers when the
  13.643 + * "compression" field contains * PNG_TEXT_COMPRESSION_NONE or
  13.644 + * PNG_TEXT_COMPRESSION_zTXt. Note that the "compression value" is not the
  13.645 + * same as what appears in the PNG tEXt/zTXt/iTXt chunk's "compression flag"
  13.646 + * which is always 0 or 1, or its "compression method" which is always 0.
  13.647   */
  13.648  typedef struct png_text_struct
  13.649  {
  13.650 @@ -685,21 +637,19 @@
  13.651     png_charp text;         /* comment, may be an empty string (ie "")
  13.652                                or a NULL pointer */
  13.653     png_size_t text_length; /* length of the text string */
  13.654 -#ifdef PNG_iTXt_SUPPORTED
  13.655     png_size_t itxt_length; /* length of the itxt string */
  13.656     png_charp lang;         /* language code, 0-79 characters
  13.657                                or a NULL pointer */
  13.658     png_charp lang_key;     /* keyword translated UTF-8 string, 0 or more
  13.659                                chars or a NULL pointer */
  13.660 -#endif
  13.661  } png_text;
  13.662  typedef png_text FAR * png_textp;
  13.663 +typedef PNG_CONST png_text FAR * png_const_textp;
  13.664  typedef png_text FAR * FAR * png_textpp;
  13.665  #endif
  13.666  
  13.667  /* Supported compression types for text in PNG files (tEXt, and zTXt).
  13.668 - * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed.
  13.669 - */
  13.670 + * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */
  13.671  #define PNG_TEXT_COMPRESSION_NONE_WR -3
  13.672  #define PNG_TEXT_COMPRESSION_zTXt_WR -2
  13.673  #define PNG_TEXT_COMPRESSION_NONE    -1
  13.674 @@ -724,319 +674,60 @@
  13.675     png_byte second;  /* second of minute, 0 - 60 (for leap seconds) */
  13.676  } png_time;
  13.677  typedef png_time FAR * png_timep;
  13.678 +typedef PNG_CONST png_time FAR * png_const_timep;
  13.679  typedef png_time FAR * FAR * png_timepp;
  13.680  
  13.681  #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
  13.682 - defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
  13.683 +    defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
  13.684  /* png_unknown_chunk is a structure to hold queued chunks for which there is
  13.685   * no specific support.  The idea is that we can use this to queue
  13.686   * up private chunks for output even though the library doesn't actually
  13.687   * know about their semantics.
  13.688   */
  13.689 -#define PNG_CHUNK_NAME_LENGTH 5
  13.690  typedef struct png_unknown_chunk_t
  13.691  {
  13.692 -    png_byte name[PNG_CHUNK_NAME_LENGTH];
  13.693 +    png_byte name[5];
  13.694      png_byte *data;
  13.695      png_size_t size;
  13.696  
  13.697      /* libpng-using applications should NOT directly modify this byte. */
  13.698      png_byte location; /* mode of operation at read time */
  13.699  }
  13.700 +
  13.701 +
  13.702  png_unknown_chunk;
  13.703  typedef png_unknown_chunk FAR * png_unknown_chunkp;
  13.704 +typedef PNG_CONST png_unknown_chunk FAR * png_const_unknown_chunkp;
  13.705  typedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp;
  13.706  #endif
  13.707  
  13.708 -/* png_info is a structure that holds the information in a PNG file so
  13.709 - * that the application can find out the characteristics of the image.
  13.710 - * If you are reading the file, this structure will tell you what is
  13.711 - * in the PNG file.  If you are writing the file, fill in the information
  13.712 - * you want to put into the PNG file, then call png_write_info().
  13.713 - * The names chosen should be very close to the PNG specification, so
  13.714 - * consult that document for information about the meaning of each field.
  13.715 - *
  13.716 - * With libpng < 0.95, it was only possible to directly set and read the
  13.717 - * the values in the png_info_struct, which meant that the contents and
  13.718 - * order of the values had to remain fixed.  With libpng 0.95 and later,
  13.719 - * however, there are now functions that abstract the contents of
  13.720 - * png_info_struct from the application, so this makes it easier to use
  13.721 - * libpng with dynamic libraries, and even makes it possible to use
  13.722 - * libraries that don't have all of the libpng ancillary chunk-handing
  13.723 - * functionality.
  13.724 - *
  13.725 - * In any case, the order of the parameters in png_info_struct should NOT
  13.726 - * be changed for as long as possible to keep compatibility with applications
  13.727 - * that use the old direct-access method with png_info_struct.
  13.728 - *
  13.729 - * The following members may have allocated storage attached that should be
  13.730 - * cleaned up before the structure is discarded: palette, trans, text,
  13.731 - * pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
  13.732 - * splt_palettes, scal_unit, row_pointers, and unknowns.   By default, these
  13.733 - * are automatically freed when the info structure is deallocated, if they were
  13.734 - * allocated internally by libpng.  This behavior can be changed by means
  13.735 - * of the png_data_freer() function.
  13.736 - *
  13.737 - * More allocation details: all the chunk-reading functions that
  13.738 - * change these members go through the corresponding png_set_*
  13.739 - * functions.  A function to clear these members is available: see
  13.740 - * png_free_data().  The png_set_* functions do not depend on being
  13.741 - * able to point info structure members to any of the storage they are
  13.742 - * passed (they make their own copies), EXCEPT that the png_set_text
  13.743 - * functions use the same storage passed to them in the text_ptr or
  13.744 - * itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
  13.745 - * functions do not make their own copies.
  13.746 +/* Values for the unknown chunk location byte */
  13.747 +
  13.748 +#define PNG_HAVE_IHDR  0x01
  13.749 +#define PNG_HAVE_PLTE  0x02
  13.750 +#define PNG_AFTER_IDAT 0x08
  13.751 +
  13.752 +/* The complete definition of png_info has, as of libpng-1.5.0,
  13.753 + * been moved into a separate header file that is not accessible to
  13.754 + * applications.  Read libpng-manual.txt or libpng.3 for more info.
  13.755   */
  13.756 -typedef struct png_info_struct
  13.757 -{
  13.758 -   /* The following are necessary for every PNG file */
  13.759 -   png_uint_32 width;       /* width of image in pixels (from IHDR) */
  13.760 -   png_uint_32 height;      /* height of image in pixels (from IHDR) */
  13.761 -   png_uint_32 valid;       /* valid chunk data (see PNG_INFO_ below) */
  13.762 -   png_uint_32 rowbytes;    /* bytes needed to hold an untransformed row */
  13.763 -   png_colorp palette;      /* array of color values (valid & PNG_INFO_PLTE) */
  13.764 -   png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
  13.765 -   png_uint_16 num_trans;   /* number of transparent palette color (tRNS) */
  13.766 -   png_byte bit_depth;      /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
  13.767 -   png_byte color_type;     /* see PNG_COLOR_TYPE_ below (from IHDR) */
  13.768 -   /* The following three should have been named *_method not *_type */
  13.769 -   png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
  13.770 -   png_byte filter_type;    /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
  13.771 -   png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
  13.772 -
  13.773 -   /* The following is informational only on read, and not used on writes. */
  13.774 -   png_byte channels;       /* number of data channels per pixel (1, 2, 3, 4) */
  13.775 -   png_byte pixel_depth;    /* number of bits per pixel */
  13.776 -   png_byte spare_byte;     /* to align the data, and for future use */
  13.777 -   png_byte signature[8];   /* magic bytes read by libpng from start of file */
  13.778 -
  13.779 -   /* The rest of the data is optional.  If you are reading, check the
  13.780 -    * valid field to see if the information in these are valid.  If you
  13.781 -    * are writing, set the valid field to those chunks you want written,
  13.782 -    * and initialize the appropriate fields below.
  13.783 -    */
  13.784 -
  13.785 -#if defined(PNG_gAMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
  13.786 -   /* The gAMA chunk describes the gamma characteristics of the system
  13.787 -    * on which the image was created, normally in the range [1.0, 2.5].
  13.788 -    * Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
  13.789 -    */
  13.790 -   float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
  13.791 -#endif
  13.792 -
  13.793 -#if defined(PNG_sRGB_SUPPORTED)
  13.794 -    /* GR-P, 0.96a */
  13.795 -    /* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
  13.796 -   png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */
  13.797 -#endif
  13.798 -
  13.799 -#if defined(PNG_TEXT_SUPPORTED)
  13.800 -   /* The tEXt, and zTXt chunks contain human-readable textual data in
  13.801 -    * uncompressed, compressed, and optionally compressed forms, respectively.
  13.802 -    * The data in "text" is an array of pointers to uncompressed,
  13.803 -    * null-terminated C strings. Each chunk has a keyword that describes the
  13.804 -    * textual data contained in that chunk.  Keywords are not required to be
  13.805 -    * unique, and the text string may be empty.  Any number of text chunks may
  13.806 -    * be in an image.
  13.807 -    */
  13.808 -   int num_text; /* number of comments read/to write */
  13.809 -   int max_text; /* current size of text array */
  13.810 -   png_textp text; /* array of comments read/to write */
  13.811 -#endif /* PNG_TEXT_SUPPORTED */
  13.812 -
  13.813 -#if defined(PNG_tIME_SUPPORTED)
  13.814 -   /* The tIME chunk holds the last time the displayed image data was
  13.815 -    * modified.  See the png_time struct for the contents of this struct.
  13.816 -    */
  13.817 -   png_time mod_time;
  13.818 -#endif
  13.819 -
  13.820 -#if defined(PNG_sBIT_SUPPORTED)
  13.821 -   /* The sBIT chunk specifies the number of significant high-order bits
  13.822 -    * in the pixel data.  Values are in the range [1, bit_depth], and are
  13.823 -    * only specified for the channels in the pixel data.  The contents of
  13.824 -    * the low-order bits is not specified.  Data is valid if
  13.825 -    * (valid & PNG_INFO_sBIT) is non-zero.
  13.826 -    */
  13.827 -   png_color_8 sig_bit; /* significant bits in color channels */
  13.828 -#endif
  13.829 -
  13.830 -#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
  13.831 -defined(PNG_READ_BACKGROUND_SUPPORTED)
  13.832 -   /* The tRNS chunk supplies transparency data for paletted images and
  13.833 -    * other image types that don't need a full alpha channel.  There are
  13.834 -    * "num_trans" transparency values for a paletted image, stored in the
  13.835 -    * same order as the palette colors, starting from index 0.  Values
  13.836 -    * for the data are in the range [0, 255], ranging from fully transparent
  13.837 -    * to fully opaque, respectively.  For non-paletted images, there is a
  13.838 -    * single color specified that should be treated as fully transparent.
  13.839 -    * Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
  13.840 -    */
  13.841 -   png_bytep trans; /* transparent values for paletted image */
  13.842 -   png_color_16 trans_values; /* transparent color for non-palette image */
  13.843 -#endif
  13.844 -
  13.845 -#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
  13.846 -   /* The bKGD chunk gives the suggested image background color if the
  13.847 -    * display program does not have its own background color and the image
  13.848 -    * is needs to composited onto a background before display.  The colors
  13.849 -    * in "background" are normally in the same color space/depth as the
  13.850 -    * pixel data.  Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
  13.851 -    */
  13.852 -   png_color_16 background;
  13.853 -#endif
  13.854 -
  13.855 -#if defined(PNG_oFFs_SUPPORTED)
  13.856 -   /* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
  13.857 -    * and downwards from the top-left corner of the display, page, or other
  13.858 -    * application-specific co-ordinate space.  See the PNG_OFFSET_ defines
  13.859 -    * below for the unit types.  Valid if (valid & PNG_INFO_oFFs) non-zero.
  13.860 -    */
  13.861 -   png_int_32 x_offset; /* x offset on page */
  13.862 -   png_int_32 y_offset; /* y offset on page */
  13.863 -   png_byte offset_unit_type; /* offset units type */
  13.864 -#endif
  13.865 -
  13.866 -#if defined(PNG_pHYs_SUPPORTED)
  13.867 -   /* The pHYs chunk gives the physical pixel density of the image for
  13.868 -    * display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
  13.869 -    * defines below).  Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
  13.870 -    */
  13.871 -   png_uint_32 x_pixels_per_unit; /* horizontal pixel density */
  13.872 -   png_uint_32 y_pixels_per_unit; /* vertical pixel density */
  13.873 -   png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
  13.874 -#endif
  13.875 -
  13.876 -#if defined(PNG_hIST_SUPPORTED)
  13.877 -   /* The hIST chunk contains the relative frequency or importance of the
  13.878 -    * various palette entries, so that a viewer can intelligently select a
  13.879 -    * reduced-color palette, if required.  Data is an array of "num_palette"
  13.880 -    * values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
  13.881 -    * is non-zero.
  13.882 -    */
  13.883 -   png_uint_16p hist;
  13.884 -#endif
  13.885 -
  13.886 -#ifdef PNG_cHRM_SUPPORTED
  13.887 -   /* The cHRM chunk describes the CIE color characteristics of the monitor
  13.888 -    * on which the PNG was created.  This data allows the viewer to do gamut
  13.889 -    * mapping of the input image to ensure that the viewer sees the same
  13.890 -    * colors in the image as the creator.  Values are in the range
  13.891 -    * [0.0, 0.8].  Data valid if (valid & PNG_INFO_cHRM) non-zero.
  13.892 -    */
  13.893 -#ifdef PNG_FLOATING_POINT_SUPPORTED
  13.894 -   float x_white;
  13.895 -   float y_white;
  13.896 -   float x_red;
  13.897 -   float y_red;
  13.898 -   float x_green;
  13.899 -   float y_green;
  13.900 -   float x_blue;
  13.901 -   float y_blue;
  13.902 -#endif
  13.903 -#endif
  13.904 -
  13.905 -#if defined(PNG_pCAL_SUPPORTED)
  13.906 -   /* The pCAL chunk describes a transformation between the stored pixel
  13.907 -    * values and original physical data values used to create the image.
  13.908 -    * The integer range [0, 2^bit_depth - 1] maps to the floating-point
  13.909 -    * range given by [pcal_X0, pcal_X1], and are further transformed by a
  13.910 -    * (possibly non-linear) transformation function given by "pcal_type"
  13.911 -    * and "pcal_params" into "pcal_units".  Please see the PNG_EQUATION_
  13.912 -    * defines below, and the PNG-Group's PNG extensions document for a
  13.913 -    * complete description of the transformations and how they should be
  13.914 -    * implemented, and for a description of the ASCII parameter strings.
  13.915 -    * Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
  13.916 -    */
  13.917 -   png_charp pcal_purpose;  /* pCAL chunk description string */
  13.918 -   png_int_32 pcal_X0;      /* minimum value */
  13.919 -   png_int_32 pcal_X1;      /* maximum value */
  13.920 -   png_charp pcal_units;    /* Latin-1 string giving physical units */
  13.921 -   png_charpp pcal_params;  /* ASCII strings containing parameter values */
  13.922 -   png_byte pcal_type;      /* equation type (see PNG_EQUATION_ below) */
  13.923 -   png_byte pcal_nparams;   /* number of parameters given in pcal_params */
  13.924 -#endif
  13.925 -
  13.926 -/* New members added in libpng-1.0.6 */
  13.927 -#ifdef PNG_FREE_ME_SUPPORTED
  13.928 -   png_uint_32 free_me;     /* flags items libpng is responsible for freeing */
  13.929 -#endif
  13.930 -
  13.931 -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
  13.932 - defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
  13.933 -   /* Storage for unknown chunks that the library doesn't recognize. */
  13.934 -   png_unknown_chunkp unknown_chunks;
  13.935 -   png_size_t unknown_chunks_num;
  13.936 -#endif
  13.937 -
  13.938 -#if defined(PNG_iCCP_SUPPORTED)
  13.939 -   /* iCCP chunk data. */
  13.940 -   png_charp iccp_name;     /* profile name */
  13.941 -   png_charp iccp_profile;  /* International Color Consortium profile data */
  13.942 -                            /* Note to maintainer: should be png_bytep */
  13.943 -   png_uint_32 iccp_proflen;  /* ICC profile data length */
  13.944 -   png_byte iccp_compression; /* Always zero */
  13.945 -#endif
  13.946 -
  13.947 -#if defined(PNG_sPLT_SUPPORTED)
  13.948 -   /* Data on sPLT chunks (there may be more than one). */
  13.949 -   png_sPLT_tp splt_palettes;
  13.950 -   png_uint_32 splt_palettes_num;
  13.951 -#endif
  13.952 -
  13.953 -#if defined(PNG_sCAL_SUPPORTED)
  13.954 -   /* The sCAL chunk describes the actual physical dimensions of the
  13.955 -    * subject matter of the graphic.  The chunk contains a unit specification
  13.956 -    * a byte value, and two ASCII strings representing floating-point
  13.957 -    * values.  The values are width and height corresponsing to one pixel
  13.958 -    * in the image.  This external representation is converted to double
  13.959 -    * here.  Data values are valid if (valid & PNG_INFO_sCAL) is non-zero.
  13.960 -    */
  13.961 -   png_byte scal_unit;         /* unit of physical scale */
  13.962 -#ifdef PNG_FLOATING_POINT_SUPPORTED
  13.963 -   double scal_pixel_width;    /* width of one pixel */
  13.964 -   double scal_pixel_height;   /* height of one pixel */
  13.965 -#endif
  13.966 -#ifdef PNG_FIXED_POINT_SUPPORTED
  13.967 -   png_charp scal_s_width;     /* string containing height */
  13.968 -   png_charp scal_s_height;    /* string containing width */
  13.969 -#endif
  13.970 -#endif
  13.971 -
  13.972 -#if defined(PNG_INFO_IMAGE_SUPPORTED)
  13.973 -   /* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS) non-zero */
  13.974 -   /* Data valid if (valid & PNG_INFO_IDAT) non-zero */
  13.975 -   png_bytepp row_pointers;        /* the image bits */
  13.976 -#endif
  13.977 -
  13.978 -#if defined(PNG_FIXED_POINT_SUPPORTED) && defined(PNG_gAMA_SUPPORTED)
  13.979 -   png_fixed_point int_gamma; /* gamma of image, if (valid & PNG_INFO_gAMA) */
  13.980 -#endif
  13.981 -
  13.982 -#if defined(PNG_cHRM_SUPPORTED) && defined(PNG_FIXED_POINT_SUPPORTED)
  13.983 -   png_fixed_point int_x_white;
  13.984 -   png_fixed_point int_y_white;
  13.985 -   png_fixed_point int_x_red;
  13.986 -   png_fixed_point int_y_red;
  13.987 -   png_fixed_point int_x_green;
  13.988 -   png_fixed_point int_y_green;
  13.989 -   png_fixed_point int_x_blue;
  13.990 -   png_fixed_point int_y_blue;
  13.991 -#endif
  13.992 -
  13.993 -} png_info;
  13.994 -
  13.995 +typedef struct png_info_def png_info;
  13.996  typedef png_info FAR * png_infop;
  13.997 +typedef PNG_CONST png_info FAR * png_const_infop;
  13.998  typedef png_info FAR * FAR * png_infopp;
  13.999  
 13.1000  /* Maximum positive integer used in PNG is (2^31)-1 */
 13.1001  #define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
 13.1002  #define PNG_UINT_32_MAX ((png_uint_32)(-1))
 13.1003  #define PNG_SIZE_MAX ((png_size_t)(-1))
 13.1004 -#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
 13.1005 -/* PNG_MAX_UINT is deprecated; use PNG_UINT_31_MAX instead. */
 13.1006 -#define PNG_MAX_UINT PNG_UINT_31_MAX
 13.1007 -#endif
 13.1008 +
 13.1009 +/* These are constants for fixed point values encoded in the
 13.1010 + * PNG specification manner (x100000)
 13.1011 + */
 13.1012 +#define PNG_FP_1    100000
 13.1013 +#define PNG_FP_HALF  50000
 13.1014 +#define PNG_FP_MAX  ((png_fixed_point)0x7fffffffL)
 13.1015 +#define PNG_FP_MIN  (-PNG_FP_MAX)
 13.1016  
 13.1017  /* These describe the color_type field in png_info. */
 13.1018  /* color type masks */
 13.1019 @@ -1124,7 +815,7 @@
 13.1020  #define PNG_INFO_iCCP 0x1000   /* ESR, 1.0.6 */
 13.1021  #define PNG_INFO_sPLT 0x2000   /* ESR, 1.0.6 */
 13.1022  #define PNG_INFO_sCAL 0x4000   /* ESR, 1.0.6 */
 13.1023 -#define PNG_INFO_IDAT 0x8000L  /* ESR, 1.0.6 */
 13.1024 +#define PNG_INFO_IDAT 0x8000   /* ESR, 1.0.6 */
 13.1025  
 13.1026  /* This is used for the transformation routines, as some of them
 13.1027   * change these values for the row.  It also should enable using
 13.1028 @@ -1132,53 +823,86 @@
 13.1029   */
 13.1030  typedef struct png_row_info_struct
 13.1031  {
 13.1032 -   png_uint_32 width; /* width of row */
 13.1033 -   png_uint_32 rowbytes; /* number of bytes in row */
 13.1034 -   png_byte color_type; /* color type of row */
 13.1035 -   png_byte bit_depth; /* bit depth of row */
 13.1036 -   png_byte channels; /* number of channels (1, 2, 3, or 4) */
 13.1037 +   png_uint_32 width;    /* width of row */
 13.1038 +   png_size_t rowbytes;  /* number of bytes in row */
 13.1039 +   png_byte color_type;  /* color type of row */
 13.1040 +   png_byte bit_depth;   /* bit depth of row */
 13.1041 +   png_byte channels;    /* number of channels (1, 2, 3, or 4) */
 13.1042     png_byte pixel_depth; /* bits per pixel (depth * channels) */
 13.1043  } png_row_info;
 13.1044  
 13.1045  typedef png_row_info FAR * png_row_infop;
 13.1046  typedef png_row_info FAR * FAR * png_row_infopp;
 13.1047  
 13.1048 +/* The complete definition of png_struct has, as of libpng-1.5.0,
 13.1049 + * been moved into a separate header file that is not accessible to
 13.1050 + * applications.  Read libpng-manual.txt or libpng.3 for more info.
 13.1051 + */
 13.1052 +typedef struct png_struct_def png_struct;
 13.1053 +typedef PNG_CONST png_struct FAR * png_const_structp;
 13.1054 +typedef png_struct FAR * png_structp;
 13.1055 +
 13.1056  /* These are the function types for the I/O functions and for the functions
 13.1057   * that allow the user to override the default I/O functions with his or her
 13.1058   * own.  The png_error_ptr type should match that of user-supplied warning
 13.1059   * and error functions, while the png_rw_ptr type should match that of the
 13.1060 - * user read/write data functions.
 13.1061 + * user read/write data functions.  Note that the 'write' function must not
 13.1062 + * modify the buffer it is passed. The 'read' function, on the other hand, is
 13.1063 + * expected to return the read data in the buffer.
 13.1064   */
 13.1065 -typedef struct png_struct_def png_struct;
 13.1066 -typedef png_struct FAR * png_structp;
 13.1067 -
 13.1068 -typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp));
 13.1069 -typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t));
 13.1070 -typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp));
 13.1071 -typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32,
 13.1072 -   int));
 13.1073 -typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32,
 13.1074 -   int));
 13.1075 +typedef PNG_CALLBACK(void, *png_error_ptr, (png_structp, png_const_charp));
 13.1076 +typedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, png_size_t));
 13.1077 +typedef PNG_CALLBACK(void, *png_flush_ptr, (png_structp));
 13.1078 +typedef PNG_CALLBACK(void, *png_read_status_ptr, (png_structp, png_uint_32,
 13.1079 +    int));
 13.1080 +typedef PNG_CALLBACK(void, *png_write_status_ptr, (png_structp, png_uint_32,
 13.1081 +    int));
 13.1082  
 13.1083  #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
 13.1084 -typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp, png_infop));
 13.1085 -typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop));
 13.1086 -typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep,
 13.1087 -   png_uint_32, int));
 13.1088 +typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop));
 13.1089 +typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop));
 13.1090 +
 13.1091 +/* The following callback receives png_uint_32 row_number, int pass for the
 13.1092 + * png_bytep data of the row.  When transforming an interlaced image the
 13.1093 + * row number is the row number within the sub-image of the interlace pass, so
 13.1094 + * the value will increase to the height of the sub-image (not the full image)
 13.1095 + * then reset to 0 for the next pass.
 13.1096 + *
 13.1097 + * Use PNG_ROW_FROM_PASS_ROW(row, pass) and PNG_COL_FROM_PASS_COL(col, pass) to
 13.1098 + * find the output pixel (x,y) given an interlaced sub-image pixel
 13.1099 + * (row,col,pass).  (See below for these macros.)
 13.1100 + */
 13.1101 +typedef PNG_CALLBACK(void, *png_progressive_row_ptr, (png_structp, png_bytep,
 13.1102 +    png_uint_32, int));
 13.1103  #endif
 13.1104  
 13.1105  #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
 13.1106 -    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
 13.1107 -    defined(PNG_LEGACY_SUPPORTED)
 13.1108 -typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp,
 13.1109 -    png_row_infop, png_bytep));
 13.1110 +    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
 13.1111 +typedef PNG_CALLBACK(void, *png_user_transform_ptr, (png_structp, png_row_infop,
 13.1112 +    png_bytep));
 13.1113  #endif
 13.1114  
 13.1115 -#if defined(PNG_USER_CHUNKS_SUPPORTED)
 13.1116 -typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp));
 13.1117 +#ifdef PNG_USER_CHUNKS_SUPPORTED
 13.1118 +typedef PNG_CALLBACK(int, *png_user_chunk_ptr, (png_structp,
 13.1119 +    png_unknown_chunkp));
 13.1120  #endif
 13.1121 -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
 13.1122 -typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
 13.1123 +#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
 13.1124 +typedef PNG_CALLBACK(void, *png_unknown_chunk_ptr, (png_structp));
 13.1125 +#endif
 13.1126 +
 13.1127 +#ifdef PNG_SETJMP_SUPPORTED
 13.1128 +/* This must match the function definition in <setjmp.h>, and the application
 13.1129 + * must include this before png.h to obtain the definition of jmp_buf.  The
 13.1130 + * function is required to be PNG_NORETURN, but this is not checked.  If the
 13.1131 + * function does return the application will crash via an abort() or similar
 13.1132 + * system level call.
 13.1133 + *
 13.1134 + * If you get a warning here while building the library you may need to make
 13.1135 + * changes to ensure that pnglibconf.h records the calling convention used by
 13.1136 + * your compiler.  This may be very difficult - try using a different compiler
 13.1137 + * to build the library!
 13.1138 + */
 13.1139 +PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef);
 13.1140  #endif
 13.1141  
 13.1142  /* Transform masks for the high-level interface */
 13.1143 @@ -1194,678 +918,658 @@
 13.1144  #define PNG_TRANSFORM_SWAP_ALPHA     0x0100    /* read and write */
 13.1145  #define PNG_TRANSFORM_SWAP_ENDIAN    0x0200    /* read and write */
 13.1146  #define PNG_TRANSFORM_INVERT_ALPHA   0x0400    /* read and write */
 13.1147 -#define PNG_TRANSFORM_STRIP_FILLER   0x0800    /* write only, deprecated */
 13.1148 +#define PNG_TRANSFORM_STRIP_FILLER   0x0800    /* write only */
 13.1149  /* Added to libpng-1.2.34 */
 13.1150 -#define PNG_TRANSFORM_STRIP_FILLER_BEFORE 0x0800  /* write only */
 13.1151 -#define PNG_TRANSFORM_STRIP_FILLER_AFTER  0x1000  /* write only */
 13.1152 +#define PNG_TRANSFORM_STRIP_FILLER_BEFORE PNG_TRANSFORM_STRIP_FILLER
 13.1153 +#define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* write only */
 13.1154 +/* Added to libpng-1.4.0 */
 13.1155 +#define PNG_TRANSFORM_GRAY_TO_RGB   0x2000      /* read only */
 13.1156 +/* Added to libpng-1.5.4 */
 13.1157 +#define PNG_TRANSFORM_EXPAND_16     0x4000      /* read only */
 13.1158 +#define PNG_TRANSFORM_SCALE_16      0x8000      /* read only */
 13.1159  
 13.1160  /* Flags for MNG supported features */
 13.1161  #define PNG_FLAG_MNG_EMPTY_PLTE     0x01
 13.1162  #define PNG_FLAG_MNG_FILTER_64      0x04
 13.1163  #define PNG_ALL_MNG_FEATURES        0x05
 13.1164  
 13.1165 -typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t));
 13.1166 -typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp));
 13.1167 -
 13.1168 -/* The structure that holds the information to read and write PNG files.
 13.1169 - * The only people who need to care about what is inside of this are the
 13.1170 - * people who will be modifying the library for their own special needs.
 13.1171 - * It should NOT be accessed directly by an application, except to store
 13.1172 - * the jmp_buf.
 13.1173 +/* NOTE: prior to 1.5 these functions had no 'API' style declaration,
 13.1174 + * this allowed the zlib default functions to be used on Windows
 13.1175 + * platforms.  In 1.5 the zlib default malloc (which just calls malloc and
 13.1176 + * ignores the first argument) should be completely compatible with the
 13.1177 + * following.
 13.1178   */
 13.1179 -
 13.1180 -struct png_struct_def
 13.1181 -{
 13.1182 -#ifdef PNG_SETJMP_SUPPORTED
 13.1183 -   jmp_buf jmpbuf;            /* used in png_error */
 13.1184 -#endif
 13.1185 -   png_error_ptr error_fn;    /* function for printing errors and aborting */
 13.1186 -   png_error_ptr warning_fn;  /* function for printing warnings */
 13.1187 -   png_voidp error_ptr;       /* user supplied struct for error functions */
 13.1188 -   png_rw_ptr write_data_fn;  /* function for writing output data */
 13.1189 -   png_rw_ptr read_data_fn;   /* function for reading input data */
 13.1190 -   png_voidp io_ptr;          /* ptr to application struct for I/O functions */
 13.1191 -
 13.1192 -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
 13.1193 -   png_user_transform_ptr read_user_transform_fn; /* user read transform */
 13.1194 -#endif
 13.1195 -
 13.1196 -#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
 13.1197 -   png_user_transform_ptr write_user_transform_fn; /* user write transform */
 13.1198 -#endif
 13.1199 -
 13.1200 -/* These were added in libpng-1.0.2 */
 13.1201 -#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
 13.1202 -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
 13.1203 -    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
 13.1204 -   png_voidp user_transform_ptr; /* user supplied struct for user transform */
 13.1205 -   png_byte user_transform_depth;    /* bit depth of user transformed pixels */
 13.1206 -   png_byte user_transform_channels; /* channels in user transformed pixels */
 13.1207 -#endif
 13.1208 -#endif
 13.1209 -
 13.1210 -   png_uint_32 mode;          /* tells us where we are in the PNG file */
 13.1211 -   png_uint_32 flags;         /* flags indicating various things to libpng */
 13.1212 -   png_uint_32 transformations; /* which transformations to perform */
 13.1213 -
 13.1214 -   z_stream zstream;          /* pointer to decompression structure (below) */
 13.1215 -   png_bytep zbuf;            /* buffer for zlib */
 13.1216 -   png_size_t zbuf_size;      /* size of zbuf */
 13.1217 -   int zlib_level;            /* holds zlib compression level */
 13.1218 -   int zlib_method;           /* holds zlib compression method */
 13.1219 -   int zlib_window_bits;      /* holds zlib compression window bits */
 13.1220 -   int zlib_mem_level;        /* holds zlib compression memory level */
 13.1221 -   int zlib_strategy;         /* holds zlib compression strategy */
 13.1222 -
 13.1223 -   png_uint_32 width;         /* width of image in pixels */
 13.1224 -   png_uint_32 height;        /* height of image in pixels */
 13.1225 -   png_uint_32 num_rows;      /* number of rows in current pass */
 13.1226 -   png_uint_32 usr_width;     /* width of row at start of write */
 13.1227 -   png_uint_32 rowbytes;      /* size of row in bytes */
 13.1228 -   png_uint_32 irowbytes;     /* size of current interlaced row in bytes */
 13.1229 -   png_uint_32 iwidth;        /* width of current interlaced row in pixels */
 13.1230 -   png_uint_32 row_number;    /* current row in interlace pass */
 13.1231 -   png_bytep prev_row;        /* buffer to save previous (unfiltered) row */
 13.1232 -   png_bytep row_buf;         /* buffer to save current (unfiltered) row */
 13.1233 -#ifndef PNG_NO_WRITE_FILTER
 13.1234 -   png_bytep sub_row;         /* buffer to save "sub" row when filtering */
 13.1235 -   png_bytep up_row;          /* buffer to save "up" row when filtering */
 13.1236 -   png_bytep avg_row;         /* buffer to save "avg" row when filtering */
 13.1237 -   png_bytep paeth_row;       /* buffer to save "Paeth" row when filtering */
 13.1238 -#endif
 13.1239 -   png_row_info row_info;     /* used for transformation routines */
 13.1240 -
 13.1241 -   png_uint_32 idat_size;     /* current IDAT size for read */
 13.1242 -   png_uint_32 crc;           /* current chunk CRC value */
 13.1243 -   png_colorp palette;        /* palette from the input file */
 13.1244 -   png_uint_16 num_palette;   /* number of color entries in palette */
 13.1245 -   png_uint_16 num_trans;     /* number of transparency values */
 13.1246 -   png_byte chunk_name[5];    /* null-terminated name of current chunk */
 13.1247 -   png_byte compression;      /* file compression type (always 0) */
 13.1248 -   png_byte filter;           /* file filter type (always 0) */
 13.1249 -   png_byte interlaced;       /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
 13.1250 -   png_byte pass;             /* current interlace pass (0 - 6) */
 13.1251 -   png_byte do_filter;        /* row filter flags (see PNG_FILTER_ below ) */
 13.1252 -   png_byte color_type;       /* color type of file */
 13.1253 -   png_byte bit_depth;        /* bit depth of file */
 13.1254 -   png_byte usr_bit_depth;    /* bit depth of users row */
 13.1255 -   png_byte pixel_depth;      /* number of bits per pixel */
 13.1256 -   png_byte channels;         /* number of channels in file */
 13.1257 -   png_byte usr_channels;     /* channels at start of write */
 13.1258 -   png_byte sig_bytes;        /* magic bytes read/written from start of file */
 13.1259 -
 13.1260 -#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
 13.1261 -#ifdef PNG_LEGACY_SUPPORTED
 13.1262 -   png_byte filler;           /* filler byte for pixel expansion */
 13.1263 -#else
 13.1264 -   png_uint_16 filler;           /* filler bytes for pixel expansion */
 13.1265 -#endif
 13.1266 -#endif
 13.1267 -
 13.1268 -#if defined(PNG_bKGD_SUPPORTED)
 13.1269 -   png_byte background_gamma_type;
 13.1270 -#  ifdef PNG_FLOATING_POINT_SUPPORTED
 13.1271 -   float background_gamma;
 13.1272 -#  endif
 13.1273 -   png_color_16 background;   /* background color in screen gamma space */
 13.1274 -#if defined(PNG_READ_GAMMA_SUPPORTED)
 13.1275 -   png_color_16 background_1; /* background normalized to gamma 1.0 */
 13.1276 -#endif
 13.1277 -#endif /* PNG_bKGD_SUPPORTED */
 13.1278 -
 13.1279 -#if defined(PNG_WRITE_FLUSH_SUPPORTED)
 13.1280 -   png_flush_ptr output_flush_fn; /* Function for flushing output */
 13.1281 -   png_uint_32 flush_dist;    /* how many rows apart to flush, 0 - no flush */
 13.1282 -   png_uint_32 flush_rows;    /* number of rows written since last flush */
 13.1283 -#endif
 13.1284 -
 13.1285 -#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
 13.1286 -   int gamma_shift;      /* number of "insignificant" bits 16-bit gamma */
 13.1287 -#ifdef PNG_FLOATING_POINT_SUPPORTED
 13.1288 -   float gamma;          /* file gamma value */
 13.1289 -   float screen_gamma;   /* screen gamma value (display_exponent) */
 13.1290 -#endif
 13.1291 -#endif
 13.1292 -
 13.1293 -#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
 13.1294 -   png_bytep gamma_table;     /* gamma table for 8-bit depth files */
 13.1295 -   png_bytep gamma_from_1;    /* converts from 1.0 to screen */
 13.1296 -   png_bytep gamma_to_1;      /* converts from file to 1.0 */
 13.1297 -   png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
 13.1298 -   png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
 13.1299 -   png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
 13.1300 -#endif
 13.1301 -
 13.1302 -#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
 13.1303 -   png_color_8 sig_bit;       /* significant bits in each available channel */
 13.1304 -#endif
 13.1305 -
 13.1306 -#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
 13.1307 -   png_color_8 shift;         /* shift for significant bit tranformation */
 13.1308 -#endif
 13.1309 -
 13.1310 -#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
 13.1311 - || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
 13.1312 -   png_bytep trans;           /* transparency values for paletted files */
 13.1313 -   png_color_16 trans_values; /* transparency values for non-paletted files */
 13.1314 -#endif
 13.1315 -
 13.1316 -   png_read_status_ptr read_row_fn;   /* called after each row is decoded */
 13.1317 -   png_write_status_ptr write_row_fn; /* called after each row is encoded */
 13.1318 -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
 13.1319 -   png_progressive_info_ptr info_fn; /* called after header data fully read */
 13.1320 -   png_progressive_row_ptr row_fn;   /* called after each prog. row is decoded */
 13.1321 -   png_progressive_end_ptr end_fn;   /* called after image is complete */
 13.1322 -   png_bytep save_buffer_ptr;        /* current location in save_buffer */
 13.1323 -   png_bytep save_buffer;            /* buffer for previously read data */
 13.1324 -   png_bytep current_buffer_ptr;     /* current location in current_buffer */
 13.1325 -   png_bytep current_buffer;         /* buffer for recently used data */
 13.1326 -   png_uint_32 push_length;          /* size of current input chunk */
 13.1327 -   png_uint_32 skip_length;          /* bytes to skip in input data */
 13.1328 -   png_size_t save_buffer_size;      /* amount of data now in save_buffer */
 13.1329 -   png_size_t save_buffer_max;       /* total size of save_buffer */
 13.1330 -   png_size_t buffer_size;           /* total amount of available input data */
 13.1331 -   png_size_t current_buffer_size;   /* amount of data now in current_buffer */
 13.1332 -   int process_mode;                 /* what push library is currently doing */
 13.1333 -   int cur_palette;                  /* current push library palette index */
 13.1334 -
 13.1335 -#  if defined(PNG_TEXT_SUPPORTED)
 13.1336 -     png_size_t current_text_size;   /* current size of text input data */
 13.1337 -     png_size_t current_text_left;   /* how much text left to read in input */
 13.1338 -     png_charp current_text;         /* current text chunk buffer */
 13.1339 -     png_charp current_text_ptr;     /* current location in current_text */
 13.1340 -#  endif /* PNG_TEXT_SUPPORTED */
 13.1341 -#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
 13.1342 -
 13.1343 -#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
 13.1344 -/* for the Borland special 64K segment handler */
 13.1345 -   png_bytepp offset_table_ptr;
 13.1346 -   png_bytep offset_table;
 13.1347 -   png_uint_16 offset_table_number;
 13.1348 -   png_uint_16 offset_table_count;
 13.1349 -   png_uint_16 offset_table_count_free;
 13.1350 -#endif
 13.1351 -
 13.1352 -#if defined(PNG_READ_DITHER_SUPPORTED)
 13.1353 -   png_bytep palette_lookup;         /* lookup table for dithering */
 13.1354 -   png_bytep dither_index;           /* index translation for palette files */
 13.1355 -#endif
 13.1356 -
 13.1357 -#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
 13.1358 -   png_uint_16p hist;                /* histogram */
 13.1359 -#endif
 13.1360 -
 13.1361 -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
 13.1362 -   png_byte heuristic_method;        /* heuristic for row filter selection */
 13.1363 -   png_byte num_prev_filters;        /* number of weights for previous rows */
 13.1364 -   png_bytep prev_filters;           /* filter type(s) of previous row(s) */
 13.1365 -   png_uint_16p filter_weights;      /* weight(s) for previous line(s) */
 13.1366 -   png_uint_16p inv_filter_weights;  /* 1/weight(s) for previous line(s) */
 13.1367 -   png_uint_16p filter_costs;        /* relative filter calculation cost */
 13.1368 -   png_uint_16p inv_filter_costs;    /* 1/relative filter calculation cost */
 13.1369 -#endif
 13.1370 -
 13.1371 -#if defined(PNG_TIME_RFC1123_SUPPORTED)
 13.1372 -   png_charp time_buffer;            /* String to hold RFC 1123 time text */
 13.1373 -#endif
 13.1374 -
 13.1375 -/* New members added in libpng-1.0.6 */
 13.1376 -
 13.1377 -#ifdef PNG_FREE_ME_SUPPORTED
 13.1378 -   png_uint_32 free_me;   /* flags items libpng is responsible for freeing */
 13.1379 -#endif
 13.1380 -
 13.1381 -#if defined(PNG_USER_CHUNKS_SUPPORTED)
 13.1382 -   png_voidp user_chunk_ptr;
 13.1383 -   png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
 13.1384 -#endif
 13.1385 -
 13.1386 -#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
 13.1387 -   int num_chunk_list;
 13.1388 -   png_bytep chunk_list;
 13.1389 -#endif
 13.1390 -
 13.1391 -/* New members added in libpng-1.0.3 */
 13.1392 -#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
 13.1393 -   png_byte rgb_to_gray_status;
 13.1394 -   /* These were changed from png_byte in libpng-1.0.6 */
 13.1395 -   png_uint_16 rgb_to_gray_red_coeff;
 13.1396 -   png_uint_16 rgb_to_gray_green_coeff;
 13.1397 -   png_uint_16 rgb_to_gray_blue_coeff;
 13.1398 -#endif
 13.1399 -
 13.1400 -/* New member added in libpng-1.0.4 (renamed in 1.0.9) */
 13.1401 -#if defined(PNG_MNG_FEATURES_SUPPORTED) || \
 13.1402 -    defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
 13.1403 -    defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
 13.1404 -/* Changed from png_byte to png_uint_32 at version 1.2.0 */
 13.1405 -#ifdef PNG_1_0_X
 13.1406 -   png_byte mng_features_permitted;
 13.1407 -#else
 13.1408 -   png_uint_32 mng_features_permitted;
 13.1409 -#endif /* PNG_1_0_X */
 13.1410 -#endif
 13.1411 -
 13.1412 -/* New member added in libpng-1.0.7 */
 13.1413 -#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
 13.1414 -   png_fixed_point int_gamma;
 13.1415 -#endif
 13.1416 -
 13.1417 -/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
 13.1418 -#if defined(PNG_MNG_FEATURES_SUPPORTED)
 13.1419 -   png_byte filter_type;
 13.1420 -#endif
 13.1421 -
 13.1422 -#if defined(PNG_1_0_X)
 13.1423 -/* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */
 13.1424 -   png_uint_32 row_buf_size;
 13.1425 -#endif
 13.1426 -
 13.1427 -/* New members added in libpng-1.2.0 */
 13.1428 -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
 13.1429 -#  if !defined(PNG_1_0_X)
 13.1430 -#    if defined(PNG_MMX_CODE_SUPPORTED)
 13.1431 -   png_byte     mmx_bitdepth_threshold;
 13.1432 -   png_uint_32  mmx_rowbytes_threshold;
 13.1433 -#    endif
 13.1434 -   png_uint_32  asm_flags;
 13.1435 -#  endif
 13.1436 -#endif
 13.1437 -
 13.1438 -/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
 13.1439 -#ifdef PNG_USER_MEM_SUPPORTED
 13.1440 -   png_voidp mem_ptr;            /* user supplied struct for mem functions */
 13.1441 -   png_malloc_ptr malloc_fn;     /* function for allocating memory */
 13.1442 -   png_free_ptr free_fn;         /* function for freeing memory */
 13.1443 -#endif
 13.1444 -
 13.1445 -/* New member added in libpng-1.0.13 and 1.2.0 */
 13.1446 -   png_bytep big_row_buf;        /* buffer to save current (unfiltered) row */
 13.1447 -
 13.1448 -#if defined(PNG_READ_DITHER_SUPPORTED)
 13.1449 -/* The following three members were added at version 1.0.14 and 1.2.4 */
 13.1450 -   png_bytep dither_sort;        /* working sort array */
 13.1451 -   png_bytep index_to_palette;   /* where the original index currently is */
 13.1452 -                                 /* in the palette */
 13.1453 -   png_bytep palette_to_index;   /* which original index points to this */
 13.1454 -                                 /* palette color */
 13.1455 -#endif
 13.1456 -
 13.1457 -/* New members added in libpng-1.0.16 and 1.2.6 */
 13.1458 -   png_byte compression_type;
 13.1459 -
 13.1460 -#ifdef PNG_SET_USER_LIMITS_SUPPORTED
 13.1461 -   png_uint_32 user_width_max;
 13.1462 -   png_uint_32 user_height_max;
 13.1463 -#endif
 13.1464 -
 13.1465 -/* New member added in libpng-1.0.25 and 1.2.17 */
 13.1466 -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
 13.1467 -   /* Storage for unknown chunk that the library doesn't recognize. */
 13.1468 -   png_unknown_chunk unknown_chunk;
 13.1469 -#endif
 13.1470 -
 13.1471 -/* New members added in libpng-1.2.26 */
 13.1472 -  png_uint_32 old_big_row_buf_size, old_prev_row_size;
 13.1473 -
 13.1474 -/* New member added in libpng-1.2.30 */
 13.1475 -  png_charp chunkdata;  /* buffer for reading chunk data */
 13.1476 -
 13.1477 -};
 13.1478 -
 13.1479 -
 13.1480 -/* This triggers a compiler error in png.c, if png.c and png.h
 13.1481 - * do not agree upon the version number.
 13.1482 - */
 13.1483 -typedef png_structp version_1_2_40;
 13.1484 +typedef PNG_CALLBACK(png_voidp, *png_malloc_ptr, (png_structp,
 13.1485 +    png_alloc_size_t));
 13.1486 +typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp));
 13.1487  
 13.1488  typedef png_struct FAR * FAR * png_structpp;
 13.1489  
 13.1490 -/* Here are the function definitions most commonly used.  This is not
 13.1491 - * the place to find out how to use libpng.  See libpng.txt for the
 13.1492 +/* Section 3: exported functions
 13.1493 + * Here are the function definitions most commonly used.  This is not
 13.1494 + * the place to find out how to use libpng.  See libpng-manual.txt for the
 13.1495   * full explanation, see example.c for the summary.  This just provides
 13.1496   * a simple one line description of the use of each function.
 13.1497 + *
 13.1498 + * The PNG_EXPORT() and PNG_EXPORTA() macros used below are defined in
 13.1499 + * pngconf.h and in the *.dfn files in the scripts directory.
 13.1500 + *
 13.1501 + *   PNG_EXPORT(ordinal, type, name, (args));
 13.1502 + *
 13.1503 + *       ordinal:    ordinal that is used while building
 13.1504 + *                   *.def files. The ordinal value is only
 13.1505 + *                   relevant when preprocessing png.h with
 13.1506 + *                   the *.dfn files for building symbol table
 13.1507 + *                   entries, and are removed by pngconf.h.
 13.1508 + *       type:       return type of the function
 13.1509 + *       name:       function name
 13.1510 + *       args:       function arguments, with types
 13.1511 + *
 13.1512 + * When we wish to append attributes to a function prototype we use
 13.1513 + * the PNG_EXPORTA() macro instead.
 13.1514 + *
 13.1515 + *   PNG_EXPORTA(ordinal, type, name, (args), attributes);
 13.1516 + *
 13.1517 + *       ordinal, type, name, and args: same as in PNG_EXPORT().
 13.1518 + *       attributes: function attributes
 13.1519   */
 13.1520  
 13.1521  /* Returns the version number of the library */
 13.1522 -extern PNG_EXPORT(png_uint_32,png_access_version_number) PNGARG((void));
 13.1523 +PNG_EXPORT(1, png_uint_32, png_access_version_number, (void));
 13.1524  
 13.1525  /* Tell lib we have already handled the first <num_bytes> magic bytes.
 13.1526   * Handling more than 8 bytes from the beginning of the file is an error.
 13.1527   */
 13.1528 -extern PNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr,
 13.1529 -   int num_bytes));
 13.1530 +PNG_EXPORT(2, void, png_set_sig_bytes, (png_structp png_ptr, int num_bytes));
 13.1531  
 13.1532  /* Check sig[start] through sig[start + num_to_check - 1] to see if it's a
 13.1533   * PNG file.  Returns zero if the supplied bytes match the 8-byte PNG
 13.1534   * signature, and non-zero otherwise.  Having num_to_check == 0 or
 13.1535   * start > 7 will always fail (ie return non-zero).
 13.1536   */
 13.1537 -extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start,
 13.1538 -   png_size_t num_to_check));
 13.1539 +PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, png_size_t start,
 13.1540 +    png_size_t num_to_check));
 13.1541  
 13.1542  /* Simple signature checking function.  This is the same as calling
 13.1543   * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).
 13.1544   */
 13.1545 -extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num));
 13.1546 +#define png_check_sig(sig, n) !png_sig_cmp((sig), 0, (n))
 13.1547  
 13.1548  /* Allocate and initialize png_ptr struct for reading, and any other memory. */
 13.1549 -extern PNG_EXPORT(png_structp,png_create_read_struct)
 13.1550 -   PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
 13.1551 -   png_error_ptr error_fn, png_error_ptr warn_fn));
 13.1552 +PNG_EXPORTA(4, png_structp, png_create_read_struct,
 13.1553 +    (png_const_charp user_png_ver, png_voidp error_ptr,
 13.1554 +    png_error_ptr error_fn, png_error_ptr warn_fn),
 13.1555 +    PNG_ALLOCATED);
 13.1556  
 13.1557  /* Allocate and initialize png_ptr struct for writing, and any other memory */
 13.1558 -extern PNG_EXPORT(png_structp,png_create_write_struct)
 13.1559 -   PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
 13.1560 -   png_error_ptr error_fn, png_error_ptr warn_fn));
 13.1561 +PNG_EXPORTA(5, png_structp, png_create_write_struct,
 13.1562 +    (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn,
 13.1563 +    png_error_ptr warn_fn),
 13.1564 +    PNG_ALLOCATED);
 13.1565  
 13.1566 -#ifdef PNG_WRITE_SUPPORTED
 13.1567 -extern PNG_EXPORT(png_uint_32,png_get_compression_buffer_size)
 13.1568 -   PNGARG((png_structp png_ptr));
 13.1569 +PNG_EXPORT(6, png_size_t, png_get_compression_buffer_size,
 13.1570 +    (png_const_structp png_ptr));
 13.1571 +
 13.1572 +PNG_EXPORT(7, void, png_set_compression_buffer_size, (png_structp png_ptr,
 13.1573 +    png_size_t size));
 13.1574 +
 13.1575 +/* Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp
 13.1576 + * match up.
 13.1577 + */
 13.1578 +#ifdef PNG_SETJMP_SUPPORTED
 13.1579 +/* This function returns the jmp_buf built in to *png_ptr.  It must be
 13.1580 + * supplied with an appropriate 'longjmp' function to use on that jmp_buf
 13.1581 + * unless the default error function is overridden in which case NULL is
 13.1582 + * acceptable.  The size of the jmp_buf is checked against the actual size
 13.1583 + * allocated by the library - the call will return NULL on a mismatch
 13.1584 + * indicating an ABI mismatch.
 13.1585 + */
 13.1586 +PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structp png_ptr,
 13.1587 +    png_longjmp_ptr longjmp_fn, size_t jmp_buf_size));
 13.1588 +#  define png_jmpbuf(png_ptr) \
 13.1589 +      (*png_set_longjmp_fn((png_ptr), longjmp, sizeof (jmp_buf)))
 13.1590 +#else
 13.1591 +#  define png_jmpbuf(png_ptr) \
 13.1592 +      (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP)
 13.1593  #endif
 13.1594 +/* This function should be used by libpng applications in place of
 13.1595 + * longjmp(png_ptr->jmpbuf, val).  If longjmp_fn() has been set, it
 13.1596 + * will use it; otherwise it will call PNG_ABORT().  This function was
 13.1597 + * added in libpng-1.5.0.
 13.1598 + */
 13.1599 +PNG_EXPORTA(9, void, png_longjmp, (png_structp png_ptr, int val),
 13.1600 +    PNG_NORETURN);
 13.1601  
 13.1602 -#ifdef PNG_WRITE_SUPPORTED
 13.1603 -extern PNG_EXPORT(void,png_set_compression_buffer_size)
 13.1604 -   PNGARG((png_structp png_ptr, png_uint_32 size));
 13.1605 +#ifdef PNG_READ_SUPPORTED
 13.1606 +/* Reset the compression stream */
 13.1607 +PNG_EXPORT(10, int, png_reset_zstream, (png_structp png_ptr));
 13.1608  #endif
 13.1609  
 13.1610 -/* Reset the compression stream */
 13.1611 -extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr));
 13.1612 -
 13.1613  /* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */
 13.1614  #ifdef PNG_USER_MEM_SUPPORTED
 13.1615 -extern PNG_EXPORT(png_structp,png_create_read_struct_2)
 13.1616 -   PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
 13.1617 -   png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
 13.1618 -   png_malloc_ptr malloc_fn, png_free_ptr free_fn));
 13.1619 -extern PNG_EXPORT(png_structp,png_create_write_struct_2)
 13.1620 -   PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
 13.1621 -   png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
 13.1622 -   png_malloc_ptr malloc_fn, png_free_ptr free_fn));
 13.1623 +PNG_EXPORTA(11, png_structp, png_create_read_struct_2,
 13.1624 +    (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn,
 13.1625 +    png_error_ptr warn_fn,
 13.1626 +    png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn),
 13.1627 +    PNG_ALLOCATED);
 13.1628 +PNG_EXPORTA(12, png_structp, png_create_write_struct_2,
 13.1629 +    (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn,
 13.1630 +    png_error_ptr warn_fn,
 13.1631 +    png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn),
 13.1632 +    PNG_ALLOCATED);
 13.1633  #endif
 13.1634  
 13.1635 +/* Write the PNG file signature. */
 13.1636 +PNG_EXPORT(13, void, png_write_sig, (png_structp png_ptr));
 13.1637 +
 13.1638  /* Write a PNG chunk - size, type, (optional) data, CRC. */
 13.1639 -extern PNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr,
 13.1640 -   png_bytep chunk_name, png_bytep data, png_size_t length));
 13.1641 +PNG_EXPORT(14, void, png_write_chunk, (png_structp png_ptr, png_const_bytep
 13.1642 +    chunk_name, png_const_bytep data, png_size_t length));
 13.1643  
 13.1644  /* Write the start of a PNG chunk - length and chunk name. */
 13.1645 -extern PNG_EXPORT(void,png_write_chunk_start) PNGARG((png_structp png_ptr,
 13.1646 -   png_bytep chunk_name, png_uint_32 length));
 13.1647 +PNG_EXPORT(15, void, png_write_chunk_start, (png_structp png_ptr,
 13.1648 +    png_const_bytep chunk_name, png_uint_32 length));
 13.1649  
 13.1650  /* Write the data of a PNG chunk started with png_write_chunk_start(). */
 13.1651 -extern PNG_EXPORT(void,png_write_chunk_data) PNGARG((png_structp png_ptr,
 13.1652 -   png_bytep data, png_size_t length));
 13.1653 +PNG_EXPORT(16, void, png_write_chunk_data, (png_structp png_ptr,
 13.1654 +    png_const_bytep data, png_size_t length));
 13.1655  
 13.1656  /* Finish a chunk started with png_write_chunk_start() (includes CRC). */
 13.1657 -extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr));
 13.1658 +PNG_EXPORT(17, void, png_write_chunk_end, (png_structp png_ptr));
 13.1659  
 13.1660  /* Allocate and initialize the info structure */
 13.1661 -extern PNG_EXPORT(png_infop,png_create_info_struct)
 13.1662 -   PNGARG((png_structp png_ptr));
 13.1663 +PNG_EXPORTA(18, png_infop, png_create_info_struct, (png_structp png_ptr),
 13.1664 +    PNG_ALLOCATED);
 13.1665  
 13.1666 -#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
 13.1667 -/* Initialize the info structure (old interface - DEPRECATED) */
 13.1668 -extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr));
 13.1669 -#undef png_info_init
 13.1670 -#define png_info_init(info_ptr) png_info_init_3(&info_ptr,\
 13.1671 -    png_sizeof(png_info));
 13.1672 -#endif
 13.1673 -
 13.1674 -extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr,
 13.1675 +PNG_EXPORT(19, void, png_info_init_3, (png_infopp info_ptr,
 13.1676      png_size_t png_info_struct_size));
 13.1677  
 13.1678  /* Writes all the PNG information before the image. */
 13.1679 -extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr,
 13.1680 -   png_infop info_ptr));
 13.1681 -extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr,
 13.1682 -   png_infop info_ptr));
 13.1683 +PNG_EXPORT(20, void, png_write_info_before_PLTE,
 13.1684 +    (png_structp png_ptr, png_infop info_ptr));
 13.1685 +PNG_EXPORT(21, void, png_write_info,
 13.1686 +    (png_structp png_ptr, png_infop info_ptr));
 13.1687  
 13.1688 -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
 13.1689 +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
 13.1690  /* Read the information before the actual image data. */
 13.1691 -extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr,
 13.1692 -   png_infop info_ptr));
 13.1693 +PNG_EXPORT(22, void, png_read_info,
 13.1694 +    (png_structp png_ptr, png_infop info_ptr));
 13.1695  #endif
 13.1696  
 13.1697 -#if defined(PNG_TIME_RFC1123_SUPPORTED)
 13.1698 -extern PNG_EXPORT(png_charp,png_convert_to_rfc1123)
 13.1699 -   PNGARG((png_structp png_ptr, png_timep ptime));
 13.1700 +#ifdef PNG_TIME_RFC1123_SUPPORTED
 13.1701 +PNG_EXPORT(23, png_const_charp, png_convert_to_rfc1123,
 13.1702 +    (png_structp png_ptr,
 13.1703 +    png_const_timep ptime));
 13.1704  #endif
 13.1705  
 13.1706 -#if !defined(_WIN32_WCE)
 13.1707 -/* "time.h" functions are not supported on WindowsCE */
 13.1708 -#if defined(PNG_WRITE_tIME_SUPPORTED)
 13.1709 +#ifdef PNG_CONVERT_tIME_SUPPORTED
 13.1710  /* Convert from a struct tm to png_time */
 13.1711 -extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime,
 13.1712 -   struct tm FAR * ttime));
 13.1713 +PNG_EXPORT(24, void, png_convert_from_struct_tm, (png_timep ptime,
 13.1714 +    PNG_CONST struct tm FAR * ttime));
 13.1715  
 13.1716  /* Convert from time_t to png_time.  Uses gmtime() */
 13.1717 -extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime,
 13.1718 -   time_t ttime));
 13.1719 -#endif /* PNG_WRITE_tIME_SUPPORTED */
 13.1720 -#endif /* _WIN32_WCE */
 13.1721 +PNG_EXPORT(25, void, png_convert_from_time_t,
 13.1722 +    (png_timep ptime, time_t ttime));
 13.1723 +#endif /* PNG_CONVERT_tIME_SUPPORTED */
 13.1724  
 13.1725 -#if defined(PNG_READ_EXPAND_SUPPORTED)
 13.1726 +#ifdef PNG_READ_EXPAND_SUPPORTED
 13.1727  /* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */
 13.1728 -extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr));
 13.1729 -#if !defined(PNG_1_0_X)
 13.1730 -extern PNG_EXPORT(void,png_set_expand_gray_1_2_4_to_8) PNGARG((png_structp
 13.1731 -  png_ptr));
 13.1732 +PNG_EXPORT(26, void, png_set_expand, (png_structp png_ptr));
 13.1733 +PNG_EXPORT(27, void, png_set_expand_gray_1_2_4_to_8, (png_structp png_ptr));
 13.1734 +PNG_EXPORT(28, void, png_set_palette_to_rgb, (png_structp png_ptr));
 13.1735 +PNG_EXPORT(29, void, png_set_tRNS_to_alpha, (png_structp png_ptr));
 13.1736  #endif
 13.1737 -extern PNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr));
 13.1738 -extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr));
 13.1739 -#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
 13.1740 -/* Deprecated */
 13.1741 -extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp png_ptr));
 13.1742 -#endif
 13.1743 +
 13.1744 +#ifdef PNG_READ_EXPAND_16_SUPPORTED
 13.1745 +/* Expand to 16-bit channels, forces conversion of palette to RGB and expansion
 13.1746 + * of a tRNS chunk if present.
 13.1747 + */
 13.1748 +PNG_EXPORT(221, void, png_set_expand_16, (png_structp png_ptr));
 13.1749  #endif
 13.1750  
 13.1751  #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
 13.1752  /* Use blue, green, red order for pixels. */
 13.1753 -extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr));
 13.1754 +PNG_EXPORT(30, void, png_set_bgr, (png_structp png_ptr));
 13.1755  #endif
 13.1756  
 13.1757 -#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
 13.1758 +#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
 13.1759  /* Expand the grayscale to 24-bit RGB if necessary. */
 13.1760 -extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr));
 13.1761 +PNG_EXPORT(31, void, png_set_gray_to_rgb, (png_structp png_ptr));
 13.1762  #endif
 13.1763  
 13.1764 -#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
 13.1765 +#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
 13.1766  /* Reduce RGB to grayscale. */
 13.1767 -#ifdef PNG_FLOATING_POINT_SUPPORTED
 13.1768 -extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr,
 13.1769 -   int error_action, double red, double green ));
 13.1770 -#endif
 13.1771 -extern PNG_EXPORT(void,png_set_rgb_to_gray_fixed) PNGARG((png_structp png_ptr,
 13.1772 -   int error_action, png_fixed_point red, png_fixed_point green ));
 13.1773 -extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp
 13.1774 -   png_ptr));
 13.1775 +#define PNG_ERROR_ACTION_NONE  1
 13.1776 +#define PNG_ERROR_ACTION_WARN  2
 13.1777 +#define PNG_ERROR_ACTION_ERROR 3
 13.1778 +#define PNG_RGB_TO_GRAY_DEFAULT (-1)/*for red/green coefficients*/
 13.1779 +
 13.1780 +PNG_FP_EXPORT(32, void, png_set_rgb_to_gray, (png_structp png_ptr,
 13.1781 +    int error_action, double red, double green));
 13.1782 +PNG_FIXED_EXPORT(33, void, png_set_rgb_to_gray_fixed, (png_structp png_ptr,
 13.1783 +    int error_action, png_fixed_point red, png_fixed_point green));
 13.1784 +
 13.1785 +PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structp
 13.1786 +    png_ptr));
 13.1787  #endif
 13.1788  
 13.1789 -extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth,
 13.1790 -   png_colorp palette));
 13.1791 +#ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
 13.1792 +PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth,
 13.1793 +    png_colorp palette));
 13.1794 +#endif
 13.1795  
 13.1796 -#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
 13.1797 -extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr));
 13.1798 +#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
 13.1799 +/* How the alpha channel is interpreted - this affects how the color channels of
 13.1800 + * a PNG file are returned when an alpha channel, or tRNS chunk in a palette
 13.1801 + * file, is present.
 13.1802 + *
 13.1803 + * This has no effect on the way pixels are written into a PNG output
 13.1804 + * datastream. The color samples in a PNG datastream are never premultiplied
 13.1805 + * with the alpha samples.
 13.1806 + *
 13.1807 + * The default is to return data according to the PNG specification: the alpha
 13.1808 + * channel is a linear measure of the contribution of the pixel to the
 13.1809 + * corresponding composited pixel.  The gamma encoded color channels must be
 13.1810 + * scaled according to the contribution and to do this it is necessary to undo
 13.1811 + * the encoding, scale the color values, perform the composition and reencode
 13.1812 + * the values.  This is the 'PNG' mode.
 13.1813 + *
 13.1814 + * The alternative is to 'associate' the alpha with the color information by
 13.1815 + * storing color channel values that have been scaled by the alpha.  The
 13.1816 + * advantage is that the color channels can be resampled (the image can be
 13.1817 + * scaled) in this form.  The disadvantage is that normal practice is to store
 13.1818 + * linear, not (gamma) encoded, values and this requires 16-bit channels for
 13.1819 + * still images rather than the 8-bit channels that are just about sufficient if
 13.1820 + * gamma encoding is used.  In addition all non-transparent pixel values,
 13.1821 + * including completely opaque ones, must be gamma encoded to produce the final
 13.1822 + * image.  This is the 'STANDARD', 'ASSOCIATED' or 'PREMULTIPLIED' mode (the
 13.1823 + * latter being the two common names for associated alpha color channels.)
 13.1824 + *
 13.1825 + * Since it is not necessary to perform arithmetic on opaque color values so
 13.1826 + * long as they are not to be resampled and are in the final color space it is
 13.1827 + * possible to optimize the handling of alpha by storing the opaque pixels in
 13.1828 + * the PNG format (adjusted for the output color space) while storing partially
 13.1829 + * opaque pixels in the standard, linear, format.  The accuracy required for
 13.1830 + * standard alpha composition is relatively low, because the pixels are
 13.1831 + * isolated, therefore typically the accuracy loss in storing 8-bit linear
 13.1832 + * values is acceptable.  (This is not true if the alpha channel is used to
 13.1833 + * simulate transparency over large areas - use 16 bits or the PNG mode in
 13.1834 + * this case!)  This is the 'OPTIMIZED' mode.  For this mode a pixel is
 13.1835 + * treated as opaque only if the alpha value is equal to the maximum value.
 13.1836 + *
 13.1837 + * The final choice is to gamma encode the alpha channel as well.  This is
 13.1838 + * broken because, in practice, no implementation that uses this choice
 13.1839 + * correctly undoes the encoding before handling alpha composition.  Use this
 13.1840 + * choice only if other serious errors in the software or hardware you use
 13.1841 + * mandate it; the typical serious error is for dark halos to appear around
 13.1842 + * opaque areas of the composited PNG image because of arithmetic overflow.
 13.1843 + *
 13.1844 + * The API function png_set_alpha_mode specifies which of these choices to use
 13.1845 + * with an enumerated 'mode' value and the gamma of the required output:
 13.1846 + */
 13.1847 +#define PNG_ALPHA_PNG           0 /* according to the PNG standard */
 13.1848 +#define PNG_ALPHA_STANDARD      1 /* according to Porter/Duff */
 13.1849 +#define PNG_ALPHA_ASSOCIATED    1 /* as above; this is the normal practice */
 13.1850 +#define PNG_ALPHA_PREMULTIPLIED 1 /* as above */
 13.1851 +#define PNG_ALPHA_OPTIMIZED     2 /* 'PNG' for opaque pixels, else 'STANDARD' */
 13.1852 +#define PNG_ALPHA_BROKEN        3 /* the alpha channel is gamma encoded */
 13.1853 +
 13.1854 +PNG_FP_EXPORT(227, void, png_set_alpha_mode, (png_structp png_ptr, int mode,
 13.1855 +    double output_gamma));
 13.1856 +PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structp png_ptr,
 13.1857 +    int mode, png_fixed_point output_gamma));
 13.1858 +#endif
 13.1859 +
 13.1860 +#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED)
 13.1861 +/* The output_gamma value is a screen gamma in libpng terminology: it expresses
 13.1862 + * how to decode the output values, not how they are encoded.  The values used
 13.1863 + * correspond to the normal numbers used to describe the overall gamma of a
 13.1864 + * computer display system; for example 2.2 for an sRGB conformant system.  The
 13.1865 + * values are scaled by 100000 in the _fixed version of the API (so 220000 for
 13.1866 + * sRGB.)
 13.1867 + *
 13.1868 + * The inverse of the value is always used to provide a default for the PNG file
 13.1869 + * encoding if it has no gAMA chunk and if png_set_gamma() has not been called
 13.1870 + * to override the PNG gamma information.
 13.1871 + *
 13.1872 + * When the ALPHA_OPTIMIZED mode is selected the output gamma is used to encode
 13.1873 + * opaque pixels however pixels with lower alpha values are not encoded,
 13.1874 + * regardless of the output gamma setting.
 13.1875 + *
 13.1876 + * When the standard Porter Duff handling is requested with mode 1 the output
 13.1877 + * encoding is set to be linear and the output_gamma value is only relevant
 13.1878 + * as a default for input data that has no gamma information.  The linear output
 13.1879 + * encoding will be overridden if png_set_gamma() is called - the results may be
 13.1880 + * highly unexpected!
 13.1881 + *
 13.1882 + * The following numbers are derived from the sRGB standard and the research
 13.1883 + * behind it.  sRGB is defined to be approximated by a PNG gAMA chunk value of
 13.1884 + * 0.45455 (1/2.2) for PNG.  The value implicitly includes any viewing
 13.1885 + * correction required to take account of any differences in the color
 13.1886 + * environment of the original scene and the intended display environment; the
 13.1887 + * value expresses how to *decode* the image for display, not how the original
 13.1888 + * data was *encoded*.
 13.1889 + *
 13.1890 + * sRGB provides a peg for the PNG standard by defining a viewing environment.
 13.1891 + * sRGB itself, and earlier TV standards, actually use a more complex transform
 13.1892 + * (a linear portion then a gamma 2.4 power law) than PNG can express.  (PNG is
 13.1893 + * limited to simple power laws.)  By saying that an image for direct display on
 13.1894 + * an sRGB conformant system should be stored with a gAMA chunk value of 45455
 13.1895 + * (11.3.3.2 and 11.3.3.5 of the ISO PNG specification) the PNG specification
 13.1896 + * makes it possible to derive values for other display systems and
 13.1897 + * environments.
 13.1898 + *
 13.1899 + * The Mac value is deduced from the sRGB based on an assumption that the actual
 13.1900 + * extra viewing correction used in early Mac display systems was implemented as
 13.1901 + * a power 1.45 lookup table.
 13.1902 + *
 13.1903 + * Any system where a programmable lookup table is used or where the behavior of
 13.1904 + * the final display device characteristics can be changed requires system
 13.1905 + * specific code to obtain the current characteristic.  However this can be
 13.1906 + * difficult and most PNG gamma correction only requires an approximate value.
 13.1907 + *
 13.1908 + * By default, if png_set_alpha_mode() is not called, libpng assumes that all
 13.1909 + * values are unencoded, linear, values and that the output device also has a
 13.1910 + * linear characteristic.  This is only very rarely correct - it is invariably
 13.1911 + * better to call png_set_alpha_mode() with PNG_DEFAULT_sRGB than rely on the
 13.1912 + * default if you don't know what the right answer is!
 13.1913 + *
 13.1914 + * The special value PNG_GAMMA_MAC_18 indicates an older Mac system (pre Mac OS
 13.1915 + * 10.6) which used a correction table to implement a somewhat lower gamma on an
 13.1916 + * otherwise sRGB system.
 13.1917 + *
 13.1918 + * Both these values are reserved (not simple gamma values) in order to allow
 13.1919 + * more precise correction internally in the future.
 13.1920 + *
 13.1921 + * NOTE: the following values can be passed to either the fixed or floating
 13.1922 + * point APIs, but the floating point API will also accept floating point
 13.1923 + * values.
 13.1924 + */
 13.1925 +#define PNG_DEFAULT_sRGB -1       /* sRGB gamma and color space */
 13.1926 +#define PNG_GAMMA_MAC_18 -2       /* Old Mac '1.8' gamma and color space */
 13.1927 +#define PNG_GAMMA_sRGB   220000   /* Television standards--matches sRGB gamma */
 13.1928 +#define PNG_GAMMA_LINEAR PNG_FP_1 /* Linear */
 13.1929 +#endif
 13.1930 +
 13.1931 +/* The following are examples of calls to png_set_alpha_mode to achieve the
 13.1932 + * required overall gamma correction and, where necessary, alpha
 13.1933 + * premultiplication.
 13.1934 + *
 13.1935 + * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB);
 13.1936 + *    This is the default libpng handling of the alpha channel - it is not
 13.1937 + *    pre-multiplied into the color components.  In addition the call states
 13.1938 + *    that the output is for a sRGB system and causes all PNG files without gAMA
 13.1939 + *    chunks to be assumed to be encoded using sRGB.
 13.1940 + *
 13.1941 + * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC);
 13.1942 + *    In this case the output is assumed to be something like an sRGB conformant
 13.1943 + *    display preceeded by a power-law lookup table of power 1.45.  This is how
 13.1944 + *    early Mac systems behaved.
 13.1945 + *
 13.1946 + * png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_GAMMA_LINEAR);
 13.1947 + *    This is the classic Jim Blinn approach and will work in academic
 13.1948 + *    environments where everything is done by the book.  It has the shortcoming
 13.1949 + *    of assuming that input PNG data with no gamma information is linear - this
 13.1950 + *    is unlikely to be correct unless the PNG files where generated locally.
 13.1951 + *    Most of the time the output precision will be so low as to show
 13.1952 + *    significant banding in dark areas of the image.
 13.1953 + *
 13.1954 + * png_set_expand_16(pp);
 13.1955 + * png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_DEFAULT_sRGB);
 13.1956 + *    This is a somewhat more realistic Jim Blinn inspired approach.  PNG files
 13.1957 + *    are assumed to have the sRGB encoding if not marked with a gamma value and
 13.1958 + *    the output is always 16 bits per component.  This permits accurate scaling
 13.1959 + *    and processing of the data.  If you know that your input PNG files were
 13.1960 + *    generated locally you might need to replace PNG_DEFAULT_sRGB with the
 13.1961 + *    correct value for your system.
 13.1962 + *
 13.1963 + * png_set_alpha_mode(pp, PNG_ALPHA_OPTIMIZED, PNG_DEFAULT_sRGB);
 13.1964 + *    If you just need to composite the PNG image onto an existing background
 13.1965 + *    and if you control the code that does this you can use the optimization
 13.1966 + *    setting.  In this case you just copy completely opaque pixels to the
 13.1967 + *    output.  For pixels that are not completely transparent (you just skip
 13.1968 + *    those) you do the composition math using png_composite or png_composite_16
 13.1969 + *    below then encode the resultant 8-bit or 16-bit values to match the output
 13.1970 + *    encoding.
 13.1971 + *
 13.1972 + * Other cases
 13.1973 + *    If neither the PNG nor the standard linear encoding work for you because
 13.1974 + *    of the software or hardware you use then you have a big problem.  The PNG
 13.1975 + *    case will probably result in halos around the image.  The linear encoding
 13.1976 + *    will probably result in a washed out, too bright, image (it's actually too
 13.1977 + *    contrasty.)  Try the ALPHA_OPTIMIZED mode above - this will probably
 13.1978 + *    substantially reduce the halos.  Alternatively try:
 13.1979 + *
 13.1980 + * png_set_alpha_mode(pp, PNG_ALPHA_BROKEN, PNG_DEFAULT_sRGB);
 13.1981 + *    This option will also reduce the halos, but there will be slight dark
 13.1982 + *    halos round the opaque parts of the image where the background is light.
 13.1983 + *    In the OPTIMIZED mode the halos will be light halos where the background
 13.1984 + *    is dark.  Take your pick - the halos are unavoidable unless you can get
 13.1985 + *    your hardware/software fixed!  (The OPTIMIZED approach is slightly
 13.1986 + *    faster.)
 13.1987 + *
 13.1988 + * When the default gamma of PNG files doesn't match the output gamma.
 13.1989 + *    If you have PNG files with no gamma information png_set_alpha_mode allows
 13.1990 + *    you to provide a default gamma, but it also sets the ouput gamma to the
 13.1991 + *    matching value.  If you know your PNG files have a gamma that doesn't
 13.1992 + *    match the output you can take advantage of the fact that
 13.1993 + *    png_set_alpha_mode always sets the output gamma but only sets the PNG
 13.1994 + *    default if it is not already set:
 13.1995 + *
 13.1996 + * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB);
 13.1997 + * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC);
 13.1998 + *    The first call sets both the default and the output gamma values, the
 13.1999 + *    second call overrides the output gamma without changing the default.  This
 13.2000 + *    is easier than achieving the same effect with png_set_gamma.  You must use
 13.2001 + *    PNG_ALPHA_PNG for the first call - internal checking in png_set_alpha will
 13.2002 + *    fire if more than one call to png_set_alpha_mode and png_set_background is
 13.2003 + *    made in the same read operation, however multiple calls with PNG_ALPHA_PNG
 13.2004 + *    are ignored.
 13.2005 + */
 13.2006 +
 13.2007 +#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
 13.2008 +PNG_EXPORT(36, void, png_set_strip_alpha, (png_structp png_ptr));
 13.2009  #endif
 13.2010  
 13.2011  #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
 13.2012      defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
 13.2013 -extern PNG_EXPORT(void,png_set_swap_alpha) PNGARG((png_structp png_ptr));
 13.2014 +PNG_EXPORT(37, void, png_set_swap_alpha, (png_structp png_ptr));
 13.2015  #endif
 13.2016  
 13.2017  #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
 13.2018      defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
 13.2019 -extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr));
 13.2020 +PNG_EXPORT(38, void, png_set_invert_alpha, (png_structp png_ptr));
 13.2021  #endif
 13.2022  
 13.2023  #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
 13.2024  /* Add a filler byte to 8-bit Gray or 24-bit RGB images. */
 13.2025 -extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr,
 13.2026 -   png_uint_32 filler, int flags));
 13.2027 +PNG_EXPORT(39, void, png_set_filler, (png_structp png_ptr, png_uint_32 filler,
 13.2028 +    int flags));
 13.2029  /* The values of the PNG_FILLER_ defines should NOT be changed */
 13.2030 -#define PNG_FILLER_BEFORE 0
 13.2031 -#define PNG_FILLER_AFTER 1
 13.2032 +#  define PNG_FILLER_BEFORE 0
 13.2033 +#  define PNG_FILLER_AFTER 1
 13.2034  /* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */
 13.2035 -#if !defined(PNG_1_0_X)
 13.2036 -extern PNG_EXPORT(void,png_set_add_alpha) PNGARG((png_structp png_ptr,
 13.2037 -   png_uint_32 filler, int flags));
 13.2038 -#endif
 13.2039 +PNG_EXPORT(40, void, png_set_add_alpha,
 13.2040 +    (png_structp png_ptr, png_uint_32 filler,
 13.2041 +    int flags));
 13.2042  #endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */
 13.2043  
 13.2044  #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
 13.2045  /* Swap bytes in 16-bit depth files. */
 13.2046 -extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr));
 13.2047 +PNG_EXPORT(41, void, png_set_swap, (png_structp png_ptr));
 13.2048  #endif
 13.2049  
 13.2050  #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
 13.2051  /* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */
 13.2052 -extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr));
 13.2053 +PNG_EXPORT(42, void, png_set_packing, (png_structp png_ptr));
 13.2054  #endif
 13.2055  
 13.2056 -#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)
 13.2057 +#if defined(PNG_READ_PACKSWAP_SUPPORTED) || \
 13.2058 +    defined(PNG_WRITE_PACKSWAP_SUPPORTED)
 13.2059  /* Swap packing order of pixels in bytes. */
 13.2060 -extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr));
 13.2061 +PNG_EXPORT(43, void, png_set_packswap, (png_structp png_ptr));
 13.2062  #endif
 13.2063  
 13.2064  #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
 13.2065  /* Converts files to legal bit depths. */
 13.2066 -extern PNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr,
 13.2067 -   png_color_8p true_bits));
 13.2068 +PNG_EXPORT(44, void, png_set_shift, (png_structp png_ptr, png_const_color_8p
 13.2069 +    true_bits));
 13.2070  #endif
 13.2071  
 13.2072  #if defined(PNG_READ_INTERLACING_SUPPORTED) || \
 13.2073      defined(PNG_WRITE_INTERLACING_SUPPORTED)
 13.2074 -/* Have the code handle the interlacing.  Returns the number of passes. */
 13.2075 -extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr));
 13.2076 +/* Have the code handle the interlacing.  Returns the number of passes.
 13.2077 + * MUST be called before png_read_update_info or png_start_read_image,
 13.2078 + * otherwise it will not have the desired effect.  Note that it is still
 13.2079 + * necessary to call png_read_row or png_read_rows png_get_image_height
 13.2080 + * times for each pass.
 13.2081 +*/
 13.2082 +PNG_EXPORT(45, int, png_set_interlace_handling, (png_structp png_ptr));
 13.2083  #endif
 13.2084  
 13.2085  #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
 13.2086  /* Invert monochrome files */
 13.2087 -extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr));
 13.2088 +PNG_EXPORT(46, void, png_set_invert_mono, (png_structp png_ptr));
 13.2089  #endif
 13.2090  
 13.2091 -#if defined(PNG_READ_BACKGROUND_SUPPORTED)
 13.2092 -/* Handle alpha and tRNS by replacing with a background color. */
 13.2093 -#ifdef PNG_FLOATING_POINT_SUPPORTED
 13.2094 -extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr,
 13.2095 -   png_color_16p background_color, int background_gamma_code,
 13.2096 -   int need_expand, double background_gamma));
 13.2097 +#ifdef PNG_READ_BACKGROUND_SUPPORTED
 13.2098 +/* Handle alpha and tRNS by replacing with a background color.  Prior to
 13.2099 + * libpng-1.5.4 this API must not be called before the PNG file header has been
 13.2100 + * read.  Doing so will result in unexpected behavior and possible warnings or
 13.2101 + * errors if the PNG file contains a bKGD chunk.
 13.2102 + */
 13.2103 +PNG_FP_EXPORT(47, void, png_set_background, (png_structp png_ptr,
 13.2104 +    png_const_color_16p background_color, int background_gamma_code,
 13.2105 +    int need_expand, double background_gamma));
 13.2106 +PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structp png_ptr,
 13.2107 +    png_const_color_16p background_color, int background_gamma_code,
 13.2108 +    int need_expand, png_fixed_point background_gamma));
 13.2109  #endif
 13.2110 -#define PNG_BACKGROUND_GAMMA_UNKNOWN 0
 13.2111 -#define PNG_BACKGROUND_GAMMA_SCREEN  1
 13.2112 -#define PNG_BACKGROUND_GAMMA_FILE    2
 13.2113 -#define PNG_BACKGROUND_GAMMA_UNIQUE  3
 13.2114 +#ifdef PNG_READ_BACKGROUND_SUPPORTED
 13.2115 +#  define PNG_BACKGROUND_GAMMA_UNKNOWN 0
 13.2116 +#  define PNG_BACKGROUND_GAMMA_SCREEN  1
 13.2117 +#  define PNG_BACKGROUND_GAMMA_FILE    2
 13.2118 +#  define PNG_BACKGROUND_GAMMA_UNIQUE  3
 13.2119  #endif
 13.2120  
 13.2121 -#if defined(PNG_READ_16_TO_8_SUPPORTED)
 13.2122 -/* Strip the second byte of information from a 16-bit depth file. */
 13.2123 -extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr));
 13.2124 +#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
 13.2125 +/* Scale a 16-bit depth file down to 8-bit, accurately. */
 13.2126 +PNG_EXPORT(229, void, png_set_scale_16, (png_structp png_ptr));
 13.2127  #endif
 13.2128  
 13.2129 -#if defined(PNG_READ_DITHER_SUPPORTED)
 13.2130 -/* Turn on dithering, and reduce the palette to the number of colors available. */
 13.2131 -extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr,
 13.2132 -   png_colorp palette, int num_palette, int maximum_colors,
 13.2133 -   png_uint_16p histogram, int full_dither));
 13.2134 +#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
 13.2135 +#define PNG_READ_16_TO_8 SUPPORTED /* Name prior to 1.5.4 */
 13.2136 +/* Strip the second byte of information from a 16-bit depth file. */
 13.2137 +PNG_EXPORT(48, void, png_set_strip_16, (png_structp png_ptr));
 13.2138  #endif
 13.2139  
 13.2140 -#if defined(PNG_READ_GAMMA_SUPPORTED)
 13.2141 -/* Handle gamma correction. Screen_gamma=(display_exponent) */
 13.2142 -#ifdef PNG_FLOATING_POINT_SUPPORTED
 13.2143 -extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr,
 13.2144 -   double screen_gamma, double default_file_gamma));
 13.2145 -#endif
 13.2146 +#ifdef PNG_READ_QUANTIZE_SUPPORTED
 13.2147 +/* Turn on quantizing, and reduce the palette to the number of colors
 13.2148 + * available.
 13.2149 + */
 13.2150 +PNG_EXPORT(49, void, png_set_quantize,
 13.2151 +    (png_structp png_ptr, png_colorp palette,
 13.2152 +    int num_palette, int maximum_colors, png_const_uint_16p histogram,
 13.2153 +    int full_quantize));
 13.2154  #endif
 13.2155  
 13.2156 -#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
 13.2157 -#if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
 13.2158 -    defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
 13.2159 -/* Permit or disallow empty PLTE (0: not permitted, 1: permitted) */
 13.2160 -/* Deprecated and will be removed.  Use png_permit_mng_features() instead. */
 13.2161 -extern PNG_EXPORT(void,png_permit_empty_plte) PNGARG((png_structp png_ptr,
 13.2162 -   int empty_plte_permitted));
 13.2163 -#endif
 13.2164 +#ifdef PNG_READ_GAMMA_SUPPORTED
 13.2165 +/* The threshold on gamma processing is configurable but hard-wired into the
 13.2166 + * library.  The following is the floating point variant.
 13.2167 + */
 13.2168 +#define PNG_GAMMA_THRESHOLD (PNG_GAMMA_THRESHOLD_FIXED*.00001)
 13.2169 +
 13.2170 +/* Handle gamma correction. Screen_gamma=(display_exponent).
 13.2171 + * NOTE: this API simply sets the screen and file gamma values. It will
 13.2172 + * therefore override the value for gamma in a PNG file if it is called after
 13.2173 + * the file header has been read - use with care  - call before reading the PNG
 13.2174 + * file for best results!
 13.2175 + *
 13.2176 + * These routines accept the same gamma values as png_set_alpha_mode (described
 13.2177 + * above).  The PNG_GAMMA_ defines and PNG_DEFAULT_sRGB can be passed to either
 13.2178 + * API (floating point or fixed.)  Notice, however, that the 'file_gamma' value
 13.2179 + * is the inverse of a 'screen gamma' value.
 13.2180 + */
 13.2181 +PNG_FP_EXPORT(50, void, png_set_gamma,
 13.2182 +    (png_structp png_ptr, double screen_gamma,
 13.2183 +    double override_file_gamma));
 13.2184 +PNG_FIXED_EXPORT(208, void, png_set_gamma_fixed, (png_structp png_ptr,
 13.2185 +    png_fixed_point screen_gamma, png_fixed_point override_file_gamma));
 13.2186  #endif
 13.2187  
 13.2188 -#if defined(PNG_WRITE_FLUSH_SUPPORTED)
 13.2189 +#ifdef PNG_WRITE_FLUSH_SUPPORTED
 13.2190  /* Set how many lines between output flushes - 0 for no flushing */
 13.2191 -extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows));
 13.2192 +PNG_EXPORT(51, void, png_set_flush, (png_structp png_ptr, int nrows));
 13.2193  /* Flush the current PNG output buffer */
 13.2194 -extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr));
 13.2195 +PNG_EXPORT(52, void, png_write_flush, (png_structp png_ptr));
 13.2196  #endif
 13.2197  
 13.2198  /* Optional update palette with requested transformations */
 13.2199 -extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr));
 13.2200 +PNG_EXPORT(53, void, png_start_read_image, (png_structp png_ptr));
 13.2201  
 13.2202  /* Optional call to update the users info structure */
 13.2203 -extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr,
 13.2204 -   png_infop info_ptr));
 13.2205 +PNG_EXPORT(54, void, png_read_update_info,
 13.2206 +    (png_structp png_ptr, png_infop info_ptr));
 13.2207  
 13.2208 -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
 13.2209 +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
 13.2210  /* Read one or more rows of image data. */
 13.2211 -extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr,
 13.2212 -   png_bytepp row, png_bytepp display_row, png_uint_32 num_rows));
 13.2213 +PNG_EXPORT(55, void, png_read_rows, (png_structp png_ptr, png_bytepp row,
 13.2214 +    png_bytepp display_row, png_uint_32 num_rows));
 13.2215  #endif
 13.2216  
 13.2217 -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
 13.2218 +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
 13.2219  /* Read a row of data. */
 13.2220 -extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr,
 13.2221 -   png_bytep row,
 13.2222 -   png_bytep display_row));
 13.2223 +PNG_EXPORT(56, void, png_read_row, (png_structp png_ptr, png_bytep row,
 13.2224 +    png_bytep display_row));
 13.2225  #endif
 13.2226  
 13.2227 -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
 13.2228 +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
 13.2229  /* Read the whole image into memory at once. */
 13.2230 -extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr,
 13.2231 -   png_bytepp image));
 13.2232 +PNG_EXPORT(57, void, png_read_image, (png_structp png_ptr, png_bytepp image));
 13.2233  #endif
 13.2234  
 13.2235  /* Write a row of image data */
 13.2236 -extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr,
 13.2237 -   png_bytep row));
 13.2238 +PNG_EXPORT(58, void, png_write_row,
 13.2239 +    (png_structp png_ptr, png_const_bytep row));
 13.2240  
 13.2241 -/* Write a few rows of image data */
 13.2242 -extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr,
 13.2243 -   png_bytepp row, png_uint_32 num_rows));
 13.2244 +/* Write a few rows of image data: (*row) is not written; however, the type
 13.2245 + * is declared as writeable to maintain compatibility with previous versions
 13.2246 + * of libpng and to allow the 'display_row' array from read_rows to be passed
 13.2247 + * unchanged to write_rows.
 13.2248 + */
 13.2249 +PNG_EXPORT(59, void, png_write_rows, (png_structp png_ptr, png_bytepp row,
 13.2250 +    png_uint_32 num_rows));
 13.2251  
 13.2252  /* Write the image data */
 13.2253 -extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr,
 13.2254 -   png_bytepp image));
 13.2255 +PNG_EXPORT(60, void, png_write_image,
 13.2256 +    (png_structp png_ptr, png_bytepp image));
 13.2257  
 13.2258 -/* Writes the end of the PNG file. */
 13.2259 -extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr,
 13.2260 -   png_infop info_ptr));
 13.2261 +/* Write the end of the PNG file. */
 13.2262 +PNG_EXPORT(61, void, png_write_end,
 13.2263 +    (png_structp png_ptr, png_infop info_ptr));
 13.2264  
 13.2265 -#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
 13.2266 +#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
 13.2267  /* Read the end of the PNG file. */
 13.2268 -extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr,
 13.2269 -   png_infop info_ptr));
 13.2270 +PNG_EXPORT(62, void, png_read_end, (png_structp png_ptr, png_infop info_ptr));
 13.2271  #endif
 13.2272  
 13.2273  /* Free any memory associated with the png_info_struct */
 13.2274 -extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr,
 13.2275 -   png_infopp info_ptr_ptr));
 13.2276 +PNG_EXPORT(63, void, png_destroy_info_struct, (png_structp png_ptr,
 13.2277 +    png_infopp info_ptr_ptr));
 13.2278  
 13.2279  /* Free any memory associated with the png_struct and the png_info_structs */
 13.2280 -extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp
 13.2281 -   png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr));
 13.2282 -
 13.2283 -/* Free all memory used by the read (old method - NOT DLL EXPORTED) */
 13.2284 -extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.2285 -   png_infop end_info_ptr));
 13.2286 +PNG_EXPORT(64, void, png_destroy_read_struct, (png_structpp png_ptr_ptr,
 13.2287 +    png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr));
 13.2288  
 13.2289  /* Free any memory associated with the png_struct and the png_info_structs */
 13.2290 -extern PNG_EXPORT(void,png_destroy_write_struct)
 13.2291 -   PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr));
 13.2292 -
 13.2293 -/* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
 13.2294 -extern void png_write_destroy PNGARG((png_structp png_ptr));
 13.2295 +PNG_EXPORT(65, void, png_destroy_write_struct, (png_structpp png_ptr_ptr,
 13.2296 +    png_infopp info_ptr_ptr));
 13.2297  
 13.2298  /* Set the libpng method of handling chunk CRC errors */
 13.2299 -extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr,
 13.2300 -   int crit_action, int ancil_action));
 13.2301 +PNG_EXPORT(66, void, png_set_crc_action,
 13.2302 +    (png_structp png_ptr, int crit_action, int ancil_action));
 13.2303  
 13.2304 -/* Values for png_set_crc_action() to say how to handle CRC errors in
 13.2305 +/* Values for png_set_crc_action() say how to handle CRC errors in
 13.2306   * ancillary and critical chunks, and whether to use the data contained
 13.2307   * therein.  Note that it is impossible to "discard" data in a critical
 13.2308   * chunk.  For versions prior to 0.90, the action was always error/quit,
 13.2309 @@ -1892,8 +1596,8 @@
 13.2310  /* Set the filtering method(s) used by libpng.  Currently, the only valid
 13.2311   * value for "method" is 0.
 13.2312   */
 13.2313 -extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method,
 13.2314 -   int filters));
 13.2315 +PNG_EXPORT(67, void, png_set_filter,
 13.2316 +    (png_structp png_ptr, int method, int filters));
 13.2317  
 13.2318  /* Flags for png_set_filter() to say which filters to use.  The flags
 13.2319   * are chosen so that they don't conflict with real filter types
 13.2320 @@ -1919,7 +1623,7 @@
 13.2321  #define PNG_FILTER_VALUE_PAETH 4
 13.2322  #define PNG_FILTER_VALUE_LAST  5
 13.2323  
 13.2324 -#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* EXPERIMENTAL */
 13.2325 +#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* EXPERIMENTAL */
 13.2326  /* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_
 13.2327   * defines, either the default (minimum-sum-of-absolute-differences), or
 13.2328   * the experimental method (weighted-minimum-sum-of-absolute-differences).
 13.2329 @@ -1948,11 +1652,13 @@
 13.2330   * the weights and costs are set to 1.0, this degenerates the WEIGHTED method
 13.2331   * to the UNWEIGHTED method, but with added encoding time/computation.
 13.2332   */
 13.2333 -#ifdef PNG_FLOATING_POINT_SUPPORTED
 13.2334 -extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr,
 13.2335 -   int heuristic_method, int num_weights, png_doublep filter_weights,
 13.2336 -   png_doublep filter_costs));
 13.2337 -#endif
 13.2338 +PNG_FP_EXPORT(68, void, png_set_filter_heuristics, (png_structp png_ptr,
 13.2339 +    int heuristic_method, int num_weights, png_const_doublep filter_weights,
 13.2340 +    png_const_doublep filter_costs));
 13.2341 +PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed,
 13.2342 +    (png_structp png_ptr,
 13.2343 +    int heuristic_method, int num_weights, png_const_fixed_point_p
 13.2344 +    filter_weights, png_const_fixed_point_p filter_costs));
 13.2345  #endif /*  PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
 13.2346  
 13.2347  /* Heuristic used for row filter selection.  These defines should NOT be
 13.2348 @@ -1963,6 +1669,7 @@
 13.2349  #define PNG_FILTER_HEURISTIC_WEIGHTED   2  /* Experimental feature */
 13.2350  #define PNG_FILTER_HEURISTIC_LAST       3  /* Not a valid value */
 13.2351  
 13.2352 +#ifdef PNG_WRITE_SUPPORTED
 13.2353  /* Set the library compression level.  Currently, valid values range from
 13.2354   * 0 - 9, corresponding directly to the zlib compression levels 0 - 9
 13.2355   * (0 - no compression, 9 - "maximal" compression).  Note that tests have
 13.2356 @@ -1970,33 +1677,58 @@
 13.2357   * for PNG images, and do considerably fewer caclulations.  In the future,
 13.2358   * these values may not correspond directly to the zlib compression levels.
 13.2359   */
 13.2360 -extern PNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr,
 13.2361 -   int level));
 13.2362 +PNG_EXPORT(69, void, png_set_compression_level,
 13.2363 +    (png_structp png_ptr, int level));
 13.2364  
 13.2365 -extern PNG_EXPORT(void,png_set_compression_mem_level)
 13.2366 -   PNGARG((png_structp png_ptr, int mem_level));
 13.2367 +PNG_EXPORT(70, void, png_set_compression_mem_level, (png_structp png_ptr,
 13.2368 +    int mem_level));
 13.2369  
 13.2370 -extern PNG_EXPORT(void,png_set_compression_strategy)
 13.2371 -   PNGARG((png_structp png_ptr, int strategy));
 13.2372 +PNG_EXPORT(71, void, png_set_compression_strategy, (png_structp png_ptr,
 13.2373 +    int strategy));
 13.2374  
 13.2375 -extern PNG_EXPORT(void,png_set_compression_window_bits)
 13.2376 -   PNGARG((png_structp png_ptr, int window_bits));
 13.2377 +/* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a
 13.2378 + * smaller value of window_bits if it can do so safely.
 13.2379 + */
 13.2380 +PNG_EXPORT(72, void, png_set_compression_window_bits, (png_structp png_ptr,
 13.2381 +    int window_bits));
 13.2382  
 13.2383 -extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr,
 13.2384 -   int method));
 13.2385 +PNG_EXPORT(73, void, png_set_compression_method, (png_structp png_ptr,
 13.2386 +    int method));
 13.2387 +#endif
 13.2388 +
 13.2389 +#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
 13.2390 +/* Also set zlib parameters for compressing non-IDAT chunks */
 13.2391 +PNG_EXPORT(222, void, png_set_text_compression_level,
 13.2392 +    (png_structp png_ptr, int level));
 13.2393 +
 13.2394 +PNG_EXPORT(223, void, png_set_text_compression_mem_level, (png_structp png_ptr,
 13.2395 +    int mem_level));
 13.2396 +
 13.2397 +PNG_EXPORT(224, void, png_set_text_compression_strategy, (png_structp png_ptr,
 13.2398 +    int strategy));
 13.2399 +
 13.2400 +/* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a
 13.2401 + * smaller value of window_bits if it can do so safely.
 13.2402 + */
 13.2403 +PNG_EXPORT(225, void, png_set_text_compression_window_bits, (png_structp
 13.2404 +    png_ptr, int window_bits));
 13.2405 +
 13.2406 +PNG_EXPORT(226, void, png_set_text_compression_method, (png_structp png_ptr,
 13.2407 +    int method));
 13.2408 +#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED */
 13.2409  
 13.2410  /* These next functions are called for input/output, memory, and error
 13.2411   * handling.  They are in the file pngrio.c, pngwio.c, and pngerror.c,
 13.2412   * and call standard C I/O routines such as fread(), fwrite(), and
 13.2413   * fprintf().  These functions can be made to use other I/O routines
 13.2414   * at run time for those applications that need to handle I/O in a
 13.2415 - * different manner by calling png_set_???_fn().  See libpng.txt for
 13.2416 + * different manner by calling png_set_???_fn().  See libpng-manual.txt for
 13.2417   * more information.
 13.2418   */
 13.2419  
 13.2420 -#if !defined(PNG_NO_STDIO)
 13.2421 +#ifdef PNG_STDIO_SUPPORTED
 13.2422  /* Initialize the input/output for the PNG file to the default functions. */
 13.2423 -extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, png_FILE_p fp));
 13.2424 +PNG_EXPORT(74, void, png_init_io, (png_structp png_ptr, png_FILE_p fp));
 13.2425  #endif
 13.2426  
 13.2427  /* Replace the (error and abort), and warning functions with user
 13.2428 @@ -2007,11 +1739,12 @@
 13.2429   * default function will be used.
 13.2430   */
 13.2431  
 13.2432 -extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr,
 13.2433 -   png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn));
 13.2434 +PNG_EXPORT(75, void, png_set_error_fn,
 13.2435 +    (png_structp png_ptr, png_voidp error_ptr,
 13.2436 +    png_error_ptr error_fn, png_error_ptr warning_fn));
 13.2437  
 13.2438  /* Return the user pointer associated with the error functions */
 13.2439 -extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr));
 13.2440 +PNG_EXPORT(76, png_voidp, png_get_error_ptr, (png_const_structp png_ptr));
 13.2441  
 13.2442  /* Replace the default data output functions with a user supplied one(s).
 13.2443   * If buffered output is not used, then output_flush_fn can be set to NULL.
 13.2444 @@ -2023,117 +1756,139 @@
 13.2445   * default flush function, which uses the standard *FILE structure, will
 13.2446   * be used.
 13.2447   */
 13.2448 -extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr,
 13.2449 -   png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));
 13.2450 +PNG_EXPORT(77, void, png_set_write_fn, (png_structp png_ptr, png_voidp io_ptr,
 13.2451 +    png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));
 13.2452  
 13.2453  /* Replace the default data input function with a user supplied one. */
 13.2454 -extern PNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr,
 13.2455 -   png_voidp io_ptr, png_rw_ptr read_data_fn));
 13.2456 +PNG_EXPORT(78, void, png_set_read_fn, (png_structp png_ptr, png_voidp io_ptr,
 13.2457 +    png_rw_ptr read_data_fn));
 13.2458  
 13.2459  /* Return the user pointer associated with the I/O functions */
 13.2460 -extern PNG_EXPORT(png_voidp,png_get_io_ptr) PNGARG((png_structp png_ptr));
 13.2461 +PNG_EXPORT(79, png_voidp, png_get_io_ptr, (png_structp png_ptr));
 13.2462  
 13.2463 -extern PNG_EXPORT(void,png_set_read_status_fn) PNGARG((png_structp png_ptr,
 13.2464 -   png_read_status_ptr read_row_fn));
 13.2465 +PNG_EXPORT(80, void, png_set_read_status_fn, (png_structp png_ptr,
 13.2466 +    png_read_status_ptr read_row_fn));
 13.2467  
 13.2468 -extern PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr,
 13.2469 -   png_write_status_ptr write_row_fn));
 13.2470 +PNG_EXPORT(81, void, png_set_write_status_fn, (png_structp png_ptr,
 13.2471 +    png_write_status_ptr write_row_fn));
 13.2472  
 13.2473  #ifdef PNG_USER_MEM_SUPPORTED
 13.2474  /* Replace the default memory allocation functions with user supplied one(s). */
 13.2475 -extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr,
 13.2476 -   png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn));
 13.2477 +PNG_EXPORT(82, void, png_set_mem_fn, (png_structp png_ptr, png_voidp mem_ptr,
 13.2478 +    png_malloc_ptr malloc_fn, png_free_ptr free_fn));
 13.2479  /* Return the user pointer associated with the memory functions */
 13.2480 -extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr));
 13.2481 +PNG_EXPORT(83, png_voidp, png_get_mem_ptr, (png_const_structp png_ptr));
 13.2482  #endif
 13.2483  
 13.2484 -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
 13.2485 -    defined(PNG_LEGACY_SUPPORTED)
 13.2486 -extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp
 13.2487 -   png_ptr, png_user_transform_ptr read_user_transform_fn));
 13.2488 +#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
 13.2489 +PNG_EXPORT(84, void, png_set_read_user_transform_fn, (png_structp png_ptr,
 13.2490 +    png_user_transform_ptr read_user_transform_fn));
 13.2491  #endif
 13.2492  
 13.2493 -#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
 13.2494 -    defined(PNG_LEGACY_SUPPORTED)
 13.2495 -extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp
 13.2496 -   png_ptr, png_user_transform_ptr write_user_transform_fn));
 13.2497 +#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
 13.2498 +PNG_EXPORT(85, void, png_set_write_user_transform_fn, (png_structp png_ptr,
 13.2499 +    png_user_transform_ptr write_user_transform_fn));
 13.2500  #endif
 13.2501  
 13.2502 -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
 13.2503 -    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
 13.2504 -    defined(PNG_LEGACY_SUPPORTED)
 13.2505 -extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp
 13.2506 -   png_ptr, png_voidp user_transform_ptr, int user_transform_depth,
 13.2507 -   int user_transform_channels));
 13.2508 +#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
 13.2509 +PNG_EXPORT(86, void, png_set_user_transform_info, (png_structp png_ptr,
 13.2510 +    png_voidp user_transform_ptr, int user_transform_depth,
 13.2511 +    int user_transform_channels));
 13.2512  /* Return the user pointer associated with the user transform functions */
 13.2513 -extern PNG_EXPORT(png_voidp,png_get_user_transform_ptr)
 13.2514 -   PNGARG((png_structp png_ptr));
 13.2515 +PNG_EXPORT(87, png_voidp, png_get_user_transform_ptr,
 13.2516 +    (png_const_structp png_ptr));
 13.2517 +#endif
 13.2518 +
 13.2519 +#ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED
 13.2520 +/* Return information about the row currently being processed.  Note that these
 13.2521 + * APIs do not fail but will return unexpected results if called outside a user
 13.2522 + * transform callback.  Also note that when transforming an interlaced image the
 13.2523 + * row number is the row number within the sub-image of the interlace pass, so
 13.2524 + * the value will increase to the height of the sub-image (not the full image)
 13.2525 + * then reset to 0 for the next pass.
 13.2526 + *
 13.2527 + * Use PNG_ROW_FROM_PASS_ROW(row, pass) and PNG_COL_FROM_PASS_COL(col, pass) to
 13.2528 + * find the output pixel (x,y) given an interlaced sub-image pixel
 13.2529 + * (row,col,pass).  (See below for these macros.)
 13.2530 + */
 13.2531 +PNG_EXPORT(217, png_uint_32, png_get_current_row_number, (png_const_structp));
 13.2532 +PNG_EXPORT(218, png_byte, png_get_current_pass_number, (png_const_structp));
 13.2533  #endif
 13.2534  
 13.2535  #ifdef PNG_USER_CHUNKS_SUPPORTED
 13.2536 -extern PNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr,
 13.2537 -   png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn));
 13.2538 -extern PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_structp
 13.2539 -   png_ptr));
 13.2540 +PNG_EXPORT(88, void, png_set_read_user_chunk_fn, (png_structp png_ptr,
 13.2541 +    png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn));
 13.2542 +PNG_EXPORT(89, png_voidp, png_get_user_chunk_ptr, (png_const_structp png_ptr));
 13.2543  #endif
 13.2544  
 13.2545  #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
 13.2546  /* Sets the function callbacks for the push reader, and a pointer to a
 13.2547   * user-defined structure available to the callback functions.
 13.2548   */
 13.2549 -extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr,
 13.2550 -   png_voidp progressive_ptr,
 13.2551 -   png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
 13.2552 -   png_progressive_end_ptr end_fn));
 13.2553 +PNG_EXPORT(90, void, png_set_progressive_read_fn, (png_structp png_ptr,
 13.2554 +    png_voidp progressive_ptr, png_progressive_info_ptr info_fn,
 13.2555 +    png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn));
 13.2556  
 13.2557  /* Returns the user pointer associated with the push read functions */
 13.2558 -extern PNG_EXPORT(png_voidp,png_get_progressive_ptr)
 13.2559 -   PNGARG((png_structp png_ptr));
 13.2560 +PNG_EXPORT(91, png_voidp, png_get_progressive_ptr, (png_const_structp png_ptr));
 13.2561  
 13.2562  /* Function to be called when data becomes available */
 13.2563 -extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr,
 13.2564 -   png_infop info_ptr, png_bytep buffer, png_size_t buffer_size));
 13.2565 +PNG_EXPORT(92, void, png_process_data,
 13.2566 +    (png_structp png_ptr, png_infop info_ptr,
 13.2567 +    png_bytep buffer, png_size_t buffer_size));
 13.2568  
 13.2569 -/* Function that combines rows.  Not very much different than the
 13.2570 - * png_combine_row() call.  Is this even used?????
 13.2571 +/* A function which may be called *only* within png_process_data to stop the
 13.2572 + * processing of any more data.  The function returns the number of bytes
 13.2573 + * remaining, excluding any that libpng has cached internally.  A subsequent
 13.2574 + * call to png_process_data must supply these bytes again.  If the argument
 13.2575 + * 'save' is set to true the routine will first save all the pending data and
 13.2576 + * will always return 0.
 13.2577   */
 13.2578 -extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr,
 13.2579 -   png_bytep old_row, png_bytep new_row));
 13.2580 +PNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structp, int save));
 13.2581 +
 13.2582 +/* A function which may be called *only* outside (after) a call to
 13.2583 + * png_process_data.  It returns the number of bytes of data to skip in the
 13.2584 + * input.  Normally it will return 0, but if it returns a non-zero value the
 13.2585 + * application must skip than number of bytes of input data and pass the
 13.2586 + * following data to the next call to png_process_data.
 13.2587 + */
 13.2588 +PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structp));
 13.2589 +
 13.2590 +#ifdef PNG_READ_INTERLACING_SUPPORTED
 13.2591 +/* Function that combines rows.  'new_row' is a flag that should come from
 13.2592 + * the callback and be non-NULL if anything needs to be done; the library
 13.2593 + * stores its own version of the new data internally and ignores the passed
 13.2594 + * in value.
 13.2595 + */
 13.2596 +PNG_EXPORT(93, void, png_progressive_combine_row, (png_structp png_ptr,
 13.2597 +    png_bytep old_row, png_const_bytep new_row));
 13.2598 +#endif /* PNG_READ_INTERLACING_SUPPORTED */
 13.2599  #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
 13.2600  
 13.2601 -extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr,
 13.2602 -   png_uint_32 size));
 13.2603 +PNG_EXPORTA(94, png_voidp, png_malloc,
 13.2604 +    (png_structp png_ptr, png_alloc_size_t size),
 13.2605 +    PNG_ALLOCATED);
 13.2606 +/* Added at libpng version 1.4.0 */
 13.2607 +PNG_EXPORTA(95, png_voidp, png_calloc,
 13.2608 +    (png_structp png_ptr, png_alloc_size_t size),
 13.2609 +    PNG_ALLOCATED);
 13.2610  
 13.2611 -#if defined(PNG_1_0_X)
 13.2612 -#  define png_malloc_warn png_malloc
 13.2613 -#else
 13.2614  /* Added at libpng version 1.2.4 */
 13.2615 -extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr,
 13.2616 -   png_uint_32 size));
 13.2617 -#endif
 13.2618 +PNG_EXPORTA(96, png_voidp, png_malloc_warn, (png_structp png_ptr,
 13.2619 +    png_alloc_size_t size), PNG_ALLOCATED);
 13.2620  
 13.2621  /* Frees a pointer allocated by png_malloc() */
 13.2622 -extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));
 13.2623 -
 13.2624 -#if defined(PNG_1_0_X)
 13.2625 -/* Function to allocate memory for zlib. */
 13.2626 -extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items,
 13.2627 -   uInt size));
 13.2628 -
 13.2629 -/* Function to free memory for zlib */
 13.2630 -extern PNG_EXPORT(void,png_zfree) PNGARG((voidpf png_ptr, voidpf ptr));
 13.2631 -#endif
 13.2632 +PNG_EXPORT(97, void, png_free, (png_structp png_ptr, png_voidp ptr));
 13.2633  
 13.2634  /* Free data that was allocated internally */
 13.2635 -extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr,
 13.2636 -   png_infop info_ptr, png_uint_32 free_me, int num));
 13.2637 -#ifdef PNG_FREE_ME_SUPPORTED
 13.2638 +PNG_EXPORT(98, void, png_free_data,
 13.2639 +    (png_structp png_ptr, png_infop info_ptr, png_uint_32 free_me, int num));
 13.2640 +
 13.2641  /* Reassign responsibility for freeing existing data, whether allocated
 13.2642 - * by libpng or by the application
 13.2643 - */
 13.2644 -extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr,
 13.2645 -   png_infop info_ptr, int freer, png_uint_32 mask));
 13.2646 -#endif
 13.2647 + * by libpng or by the application */
 13.2648 +PNG_EXPORT(99, void, png_data_freer,
 13.2649 +    (png_structp png_ptr, png_infop info_ptr, int freer, png_uint_32 mask));
 13.2650 +
 13.2651  /* Assignments for png_data_freer */
 13.2652  #define PNG_DESTROY_WILL_FREE_DATA 1
 13.2653  #define PNG_SET_WILL_FREE_DATA 1
 13.2654 @@ -2154,47 +1909,59 @@
 13.2655  #define PNG_FREE_MUL  0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
 13.2656  
 13.2657  #ifdef PNG_USER_MEM_SUPPORTED
 13.2658 -extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr,
 13.2659 -   png_uint_32 size));
 13.2660 -extern PNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr,
 13.2661 -   png_voidp ptr));
 13.2662 +PNG_EXPORTA(100, png_voidp, png_malloc_default, (png_structp png_ptr,
 13.2663 +    png_alloc_size_t size), PNG_ALLOCATED);
 13.2664 +PNG_EXPORT(101, void, png_free_default, (png_structp png_ptr, png_voidp ptr));
 13.2665  #endif
 13.2666  
 13.2667 -extern PNG_EXPORT(png_voidp,png_memcpy_check) PNGARG((png_structp png_ptr,
 13.2668 -   png_voidp s1, png_voidp s2, png_uint_32 size));
 13.2669 -
 13.2670 -extern PNG_EXPORT(png_voidp,png_memset_check) PNGARG((png_structp png_ptr,
 13.2671 -   png_voidp s1, int value, png_uint_32 size));
 13.2672 -
 13.2673 -#if defined(USE_FAR_KEYWORD)  /* memory model conversion function */
 13.2674 -extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
 13.2675 -   int check));
 13.2676 -#endif /* USE_FAR_KEYWORD */
 13.2677 -
 13.2678 -#ifndef PNG_NO_ERROR_TEXT
 13.2679 +#ifdef PNG_ERROR_TEXT_SUPPORTED
 13.2680  /* Fatal error in PNG image of libpng - can't continue */
 13.2681 -extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr,
 13.2682 -   png_const_charp error_message));
 13.2683 +PNG_EXPORTA(102, void, png_error,
 13.2684 +    (png_structp png_ptr, png_const_charp error_message),
 13.2685 +    PNG_NORETURN);
 13.2686  
 13.2687  /* The same, but the chunk name is prepended to the error string. */
 13.2688 -extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr,
 13.2689 -   png_const_charp error_message));
 13.2690 +PNG_EXPORTA(103, void, png_chunk_error, (png_structp png_ptr,
 13.2691 +    png_const_charp error_message), PNG_NORETURN);
 13.2692 +
 13.2693  #else
 13.2694  /* Fatal error in PNG image of libpng - can't continue */
 13.2695 -extern PNG_EXPORT(void,png_err) PNGARG((png_structp png_ptr));
 13.2696 +PNG_EXPORTA(104, void, png_err, (png_structp png_ptr), PNG_NORETURN);
 13.2697  #endif
 13.2698  
 13.2699 -#ifndef PNG_NO_WARNINGS
 13.2700 +#ifdef PNG_WARNINGS_SUPPORTED
 13.2701  /* Non-fatal error in libpng.  Can continue, but may have a problem. */
 13.2702 -extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr,
 13.2703 -   png_const_charp warning_message));
 13.2704 +PNG_EXPORT(105, void, png_warning, (png_structp png_ptr,
 13.2705 +    png_const_charp warning_message));
 13.2706  
 13.2707 -#ifdef PNG_READ_SUPPORTED
 13.2708  /* Non-fatal error in libpng, chunk name is prepended to message. */
 13.2709 -extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr,
 13.2710 -   png_const_charp warning_message));
 13.2711 -#endif /* PNG_READ_SUPPORTED */
 13.2712 -#endif /* PNG_NO_WARNINGS */
 13.2713 +PNG_EXPORT(106, void, png_chunk_warning, (png_structp png_ptr,
 13.2714 +    png_const_charp warning_message));
 13.2715 +#endif
 13.2716 +
 13.2717 +#ifdef PNG_BENIGN_ERRORS_SUPPORTED
 13.2718 +/* Benign error in libpng.  Can continue, but may have a problem.
 13.2719 + * User can choose whether to handle as a fatal error or as a warning. */
 13.2720 +#  undef png_benign_error
 13.2721 +PNG_EXPORT(107, void, png_benign_error, (png_structp png_ptr,
 13.2722 +    png_const_charp warning_message));
 13.2723 +
 13.2724 +/* Same, chunk name is prepended to message. */
 13.2725 +#  undef png_chunk_benign_error
 13.2726 +PNG_EXPORT(108, void, png_chunk_benign_error, (png_structp png_ptr,
 13.2727 +    png_const_charp warning_message));
 13.2728 +
 13.2729 +PNG_EXPORT(109, void, png_set_benign_errors,
 13.2730 +    (png_structp png_ptr, int allowed));
 13.2731 +#else
 13.2732 +#  ifdef PNG_ALLOW_BENIGN_ERRORS
 13.2733 +#    define png_benign_error png_warning
 13.2734 +#    define png_chunk_benign_error png_chunk_warning
 13.2735 +#  else
 13.2736 +#    define png_benign_error png_error
 13.2737 +#    define png_chunk_benign_error png_chunk_error
 13.2738 +#  endif
 13.2739 +#endif
 13.2740  
 13.2741  /* The png_set_<chunk> functions are for storing values in the png_info_struct.
 13.2742   * Similarly, the png_get_<chunk> calls are used to read values from the
 13.2743 @@ -2209,480 +1976,416 @@
 13.2744   * png_info_struct.
 13.2745   */
 13.2746  /* Returns "flag" if chunk data is valid in info_ptr. */
 13.2747 -extern PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_structp png_ptr,
 13.2748 -png_infop info_ptr, png_uint_32 flag));
 13.2749 +PNG_EXPORT(110, png_uint_32, png_get_valid,
 13.2750 +    (png_const_structp png_ptr, png_const_infop info_ptr,
 13.2751 +    png_uint_32 flag));
 13.2752  
 13.2753  /* Returns number of bytes needed to hold a transformed row. */
 13.2754 -extern PNG_EXPORT(png_uint_32,png_get_rowbytes) PNGARG((png_structp png_ptr,
 13.2755 -png_infop info_ptr));
 13.2756 +PNG_EXPORT(111, png_size_t, png_get_rowbytes, (png_const_structp png_ptr,
 13.2757 +    png_const_infop info_ptr));
 13.2758  
 13.2759 -#if defined(PNG_INFO_IMAGE_SUPPORTED)
 13.2760 +#ifdef PNG_INFO_IMAGE_SUPPORTED
 13.2761  /* Returns row_pointers, which is an array of pointers to scanlines that was
 13.2762   * returned from png_read_png().
 13.2763   */
 13.2764 -extern PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_structp png_ptr,
 13.2765 -png_infop info_ptr));
 13.2766 +PNG_EXPORT(112, png_bytepp, png_get_rows,
 13.2767 +    (png_const_structp png_ptr, png_const_infop info_ptr));
 13.2768  /* Set row_pointers, which is an array of pointers to scanlines for use
 13.2769   * by png_write_png().
 13.2770   */
 13.2771 -extern PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr,
 13.2772 -   png_infop info_ptr, png_bytepp row_pointers));
 13.2773 +PNG_EXPORT(113, void, png_set_rows, (png_structp png_ptr,
 13.2774 +    png_infop info_ptr, png_bytepp row_pointers));
 13.2775  #endif
 13.2776  
 13.2777  /* Returns number of color channels in image. */
 13.2778 -extern PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_structp png_ptr,
 13.2779 -png_infop info_ptr));
 13.2780 +PNG_EXPORT(114, png_byte, png_get_channels,
 13.2781 +    (png_const_structp png_ptr, png_const_infop info_ptr));
 13.2782  
 13.2783  #ifdef PNG_EASY_ACCESS_SUPPORTED
 13.2784  /* Returns image width in pixels. */
 13.2785 -extern PNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_structp
 13.2786 -png_ptr, png_infop info_ptr));
 13.2787 +PNG_EXPORT(115, png_uint_32, png_get_image_width, (png_const_structp png_ptr,
 13.2788 +    png_const_infop info_ptr));
 13.2789  
 13.2790  /* Returns image height in pixels. */
 13.2791 -extern PNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_structp
 13.2792 -png_ptr, png_infop info_ptr));
 13.2793 +PNG_EXPORT(116, png_uint_32, png_get_image_height, (png_const_structp png_ptr,
 13.2794 +    png_const_infop info_ptr));
 13.2795  
 13.2796  /* Returns image bit_depth. */
 13.2797 -extern PNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_structp
 13.2798 -png_ptr, png_infop info_ptr));
 13.2799 +PNG_EXPORT(117, png_byte, png_get_bit_depth,
 13.2800 +    (png_const_structp png_ptr, png_const_infop info_ptr));
 13.2801  
 13.2802  /* Returns image color_type. */
 13.2803 -extern PNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_structp
 13.2804 -png_ptr, png_infop info_ptr));
 13.2805 +PNG_EXPORT(118, png_byte, png_get_color_type, (png_const_structp png_ptr,
 13.2806 +    png_const_infop info_ptr));
 13.2807  
 13.2808  /* Returns image filter_type. */
 13.2809 -extern PNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_structp
 13.2810 -png_ptr, png_infop info_ptr));
 13.2811 +PNG_EXPORT(119, png_byte, png_get_filter_type, (png_const_structp png_ptr,
 13.2812 +    png_const_infop info_ptr));
 13.2813  
 13.2814  /* Returns image interlace_type. */
 13.2815 -extern PNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_structp
 13.2816 -png_ptr, png_infop info_ptr));
 13.2817 +PNG_EXPORT(120, png_byte, png_get_interlace_type, (png_const_structp png_ptr,
 13.2818 +    png_const_infop info_ptr));
 13.2819  
 13.2820  /* Returns image compression_type. */
 13.2821 -extern PNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_structp
 13.2822 -png_ptr, png_infop info_ptr));
 13.2823 +PNG_EXPORT(121, png_byte, png_get_compression_type, (png_const_structp png_ptr,
 13.2824 +    png_const_infop info_ptr));
 13.2825  
 13.2826  /* Returns image resolution in pixels per meter, from pHYs chunk data. */
 13.2827 -extern PNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_structp
 13.2828 -png_ptr, png_infop info_ptr));
 13.2829 -extern PNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_structp
 13.2830 -png_ptr, png_infop info_ptr));
 13.2831 -extern PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_structp
 13.2832 -png_ptr, png_infop info_ptr));
 13.2833 +PNG_EXPORT(122, png_uint_32, png_get_pixels_per_meter,
 13.2834 +    (png_const_structp png_ptr, png_const_infop info_ptr));
 13.2835 +PNG_EXPORT(123, png_uint_32, png_get_x_pixels_per_meter,
 13.2836 +    (png_const_structp png_ptr, png_const_infop info_ptr));
 13.2837 +PNG_EXPORT(124, png_uint_32, png_get_y_pixels_per_meter,
 13.2838 +    (png_const_structp png_ptr, png_const_infop info_ptr));
 13.2839  
 13.2840  /* Returns pixel aspect ratio, computed from pHYs chunk data.  */
 13.2841 -#ifdef PNG_FLOATING_POINT_SUPPORTED
 13.2842 -extern PNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_structp
 13.2843 -png_ptr, png_infop info_ptr));
 13.2844 -#endif
 13.2845 +PNG_FP_EXPORT(125, float, png_get_pixel_aspect_ratio,
 13.2846 +    (png_const_structp png_ptr, png_const_infop info_ptr));
 13.2847 +PNG_FIXED_EXPORT(210, png_fixed_point, png_get_pixel_aspect_ratio_fixed,
 13.2848 +    (png_const_structp png_ptr, png_const_infop info_ptr));
 13.2849  
 13.2850  /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */
 13.2851 -extern PNG_EXPORT(png_int_32, png_get_x_offset_pixels) PNGARG((png_structp
 13.2852 -png_ptr, png_infop info_ptr));
 13.2853 -extern PNG_EXPORT(png_int_32, png_get_y_offset_pixels) PNGARG((png_structp
 13.2854 -png_ptr, png_infop info_ptr));
 13.2855 -extern PNG_EXPORT(png_int_32, png_get_x_offset_microns) PNGARG((png_structp
 13.2856 -png_ptr, png_infop info_ptr));
 13.2857 -extern PNG_EXPORT(png_int_32, png_get_y_offset_microns) PNGARG((png_structp
 13.2858 -png_ptr, png_infop info_ptr));
 13.2859 +PNG_EXPORT(126, png_int_32, png_get_x_offset_pixels,
 13.2860 +    (png_const_structp png_ptr, png_const_infop info_ptr));
 13.2861 +PNG_EXPORT(127, png_int_32, png_get_y_offset_pixels,
 13.2862 +    (png_const_structp png_ptr, png_const_infop info_ptr));
 13.2863 +PNG_EXPORT(128, png_int_32, png_get_x_offset_microns,
 13.2864 +    (png_const_structp png_ptr, png_const_infop info_ptr));
 13.2865 +PNG_EXPORT(129, png_int_32, png_get_y_offset_microns,
 13.2866 +    (png_const_structp png_ptr, png_const_infop info_ptr));
 13.2867  
 13.2868  #endif /* PNG_EASY_ACCESS_SUPPORTED */
 13.2869  
 13.2870  /* Returns pointer to signature string read from PNG header */
 13.2871 -extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr,
 13.2872 -png_infop info_ptr));
 13.2873 +PNG_EXPORT(130, png_const_bytep, png_get_signature,
 13.2874 +    (png_const_structp png_ptr, png_infop info_ptr));
 13.2875  
 13.2876 -#if defined(PNG_bKGD_SUPPORTED)
 13.2877 -extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr,
 13.2878 -   png_infop info_ptr, png_color_16p *background));
 13.2879 +#ifdef PNG_bKGD_SUPPORTED
 13.2880 +PNG_EXPORT(131, png_uint_32, png_get_bKGD,
 13.2881 +    (png_const_structp png_ptr, png_infop info_ptr,
 13.2882 +    png_color_16p *background));
 13.2883  #endif
 13.2884  
 13.2885 -#if defined(PNG_bKGD_SUPPORTED)
 13.2886 -extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr,
 13.2887 -   png_infop info_ptr, png_color_16p background));
 13.2888 +#ifdef PNG_bKGD_SUPPORTED
 13.2889 +PNG_EXPORT(132, void, png_set_bKGD, (png_structp png_ptr, png_infop info_ptr,
 13.2890 +    png_const_color_16p background));
 13.2891  #endif
 13.2892  
 13.2893 -#if defined(PNG_cHRM_SUPPORTED)
 13.2894 -#ifdef PNG_FLOATING_POINT_SUPPORTED
 13.2895 -extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr,
 13.2896 -   png_infop info_ptr, double *white_x, double *white_y, double *red_x,
 13.2897 -   double *red_y, double *green_x, double *green_y, double *blue_x,
 13.2898 -   double *blue_y));
 13.2899 +#ifdef PNG_cHRM_SUPPORTED
 13.2900 +PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM, (png_const_structp png_ptr,
 13.2901 +   png_const_infop info_ptr, double *white_x, double *white_y, double *red_x,
 13.2902 +    double *red_y, double *green_x, double *green_y, double *blue_x,
 13.2903 +    double *blue_y));
 13.2904 +PNG_FP_EXPORT(230, png_uint_32, png_get_cHRM_XYZ, (png_structp png_ptr,
 13.2905 +    png_const_infop info_ptr, double *red_X, double *red_Y, double *red_Z,
 13.2906 +    double *green_X, double *green_Y, double *green_Z, double *blue_X,
 13.2907 +    double *blue_Y, double *blue_Z));
 13.2908 +#ifdef PNG_FIXED_POINT_SUPPORTED /* Otherwise not implemented */
 13.2909 +PNG_FIXED_EXPORT(134, png_uint_32, png_get_cHRM_fixed,
 13.2910 +    (png_const_structp png_ptr,
 13.2911 +    png_const_infop info_ptr, png_fixed_point *int_white_x,
 13.2912 +    png_fixed_point *int_white_y, png_fixed_point *int_red_x,
 13.2913 +    png_fixed_point *int_red_y, png_fixed_point *int_green_x,
 13.2914 +    png_fixed_point *int_green_y, png_fixed_point *int_blue_x,
 13.2915 +    png_fixed_point *int_blue_y));
 13.2916  #endif
 13.2917 -#ifdef PNG_FIXED_POINT_SUPPORTED
 13.2918 -extern PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_structp png_ptr,
 13.2919 -   png_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point
 13.2920 -   *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y,
 13.2921 -   png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point
 13.2922 -   *int_blue_x, png_fixed_point *int_blue_y));
 13.2923 -#endif
 13.2924 +PNG_FIXED_EXPORT(231, png_uint_32, png_get_cHRM_XYZ_fixed,
 13.2925 +    (png_structp png_ptr, png_const_infop info_ptr,
 13.2926 +    png_fixed_point *int_red_X, png_fixed_point *int_red_Y,
 13.2927 +    png_fixed_point *int_red_Z, png_fixed_point *int_green_X,
 13.2928 +    png_fixed_point *int_green_Y, png_fixed_point *int_green_Z,
 13.2929 +    png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y,
 13.2930 +    png_fixed_point *int_blue_Z));
 13.2931  #endif
 13.2932  
 13.2933 -#if defined(PNG_cHRM_SUPPORTED)
 13.2934 -#ifdef PNG_FLOATING_POINT_SUPPORTED
 13.2935 -extern PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr,
 13.2936 -   png_infop info_ptr, double white_x, double white_y, double red_x,
 13.2937 -   double red_y, double green_x, double green_y, double blue_x, double blue_y));
 13.2938 -#endif
 13.2939 -#ifdef PNG_FIXED_POINT_SUPPORTED
 13.2940 -extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr,
 13.2941 -   png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y,
 13.2942 -   png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
 13.2943 -   int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
 13.2944 -   png_fixed_point int_blue_y));
 13.2945 -#endif
 13.2946 +#ifdef PNG_cHRM_SUPPORTED
 13.2947 +PNG_FP_EXPORT(135, void, png_set_cHRM,
 13.2948 +    (png_structp png_ptr, png_infop info_ptr,
 13.2949 +    double white_x, double white_y, double red_x, double red_y, double green_x,
 13.2950 +    double green_y, double blue_x, double blue_y));
 13.2951 +PNG_FP_EXPORT(232, void, png_set_cHRM_XYZ, (png_structp png_ptr,
 13.2952 +    png_infop info_ptr, double red_X, double red_Y, double red_Z,
 13.2953 +    double green_X, double green_Y, double green_Z, double blue_X,
 13.2954 +    double blue_Y, double blue_Z));
 13.2955 +PNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed, (png_structp png_ptr,
 13.2956 +    png_infop info_ptr, png_fixed_point int_white_x,
 13.2957 +    png_fixed_point int_white_y, png_fixed_point int_red_x,
 13.2958 +    png_fixed_point int_red_y, png_fixed_point int_green_x,
 13.2959 +    png_fixed_point int_green_y, png_fixed_point int_blue_x,
 13.2960 +    png_fixed_point int_blue_y));
 13.2961 +PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_structp png_ptr,
 13.2962 +    png_infop info_ptr, png_fixed_point int_red_X, png_fixed_point int_red_Y,
 13.2963 +    png_fixed_point int_red_Z, png_fixed_point int_green_X,
 13.2964 +    png_fixed_point int_green_Y, png_fixed_point int_green_Z,
 13.2965 +    png_fixed_point int_blue_X, png_fixed_point int_blue_Y,
 13.2966 +    png_fixed_point int_blue_Z));
 13.2967  #endif
 13.2968  
 13.2969 -#if defined(PNG_gAMA_SUPPORTED)
 13.2970 -#ifdef PNG_FLOATING_POINT_SUPPORTED
 13.2971 -extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr,
 13.2972 -   png_infop info_ptr, double *file_gamma));
 13.2973 -#endif
 13.2974 -extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_structp png_ptr,
 13.2975 -   png_infop info_ptr, png_fixed_point *int_file_gamma));
 13.2976 +#ifdef PNG_gAMA_SUPPORTED
 13.2977 +PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA,
 13.2978 +    (png_const_structp png_ptr, png_const_infop info_ptr,
 13.2979 +    double *file_gamma));
 13.2980 +PNG_FIXED_EXPORT(138, png_uint_32, png_get_gAMA_fixed,
 13.2981 +    (png_const_structp png_ptr, png_const_infop info_ptr,
 13.2982 +    png_fixed_point *int_file_gamma));
 13.2983  #endif
 13.2984  
 13.2985 -#if defined(PNG_gAMA_SUPPORTED)
 13.2986 -#ifdef PNG_FLOATING_POINT_SUPPORTED
 13.2987 -extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr,
 13.2988 -   png_infop info_ptr, double file_gamma));
 13.2989 -#endif
 13.2990 -extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr,
 13.2991 -   png_infop info_ptr, png_fixed_point int_file_gamma));
 13.2992 +#ifdef PNG_gAMA_SUPPORTED
 13.2993 +PNG_FP_EXPORT(139, void, png_set_gAMA, (png_structp png_ptr,
 13.2994 +    png_infop info_ptr, double file_gamma));
 13.2995 +PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_structp png_ptr,
 13.2996 +    png_infop info_ptr, png_fixed_point int_file_gamma));
 13.2997  #endif
 13.2998  
 13.2999 -#if defined(PNG_hIST_SUPPORTED)
 13.3000 -extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr,
 13.3001 -   png_infop info_ptr, png_uint_16p *hist));
 13.3002 +#ifdef PNG_hIST_SUPPORTED
 13.3003 +PNG_EXPORT(141, png_uint_32, png_get_hIST,
 13.3004 +    (png_const_structp png_ptr, png_const_infop info_ptr,
 13.3005 +    png_uint_16p *hist));
 13.3006  #endif
 13.3007  
 13.3008 -#if defined(PNG_hIST_SUPPORTED)
 13.3009 -extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr,
 13.3010 -   png_infop info_ptr, png_uint_16p hist));
 13.3011 +#ifdef PNG_hIST_SUPPORTED
 13.3012 +PNG_EXPORT(142, void, png_set_hIST, (png_structp png_ptr,
 13.3013 +    png_infop info_ptr, png_const_uint_16p hist));
 13.3014  #endif
 13.3015  
 13.3016 -extern PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr,
 13.3017 -   png_infop info_ptr, png_uint_32 *width, png_uint_32 *height,
 13.3018 -   int *bit_depth, int *color_type, int *interlace_method,
 13.3019 -   int *compression_method, int *filter_method));
 13.3020 +PNG_EXPORT(143, png_uint_32, png_get_IHDR,
 13.3021 +    (png_structp png_ptr, png_infop info_ptr,
 13.3022 +    png_uint_32 *width, png_uint_32 *height, int *bit_depth, int *color_type,
 13.3023 +    int *interlace_method, int *compression_method, int *filter_method));
 13.3024  
 13.3025 -extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr,
 13.3026 -   png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth,
 13.3027 -   int color_type, int interlace_method, int compression_method,
 13.3028 -   int filter_method));
 13.3029 +PNG_EXPORT(144, void, png_set_IHDR,
 13.3030 +    (png_structp png_ptr, png_infop info_ptr,
 13.3031 +    png_uint_32 width, png_uint_32 height, int bit_depth, int color_type,
 13.3032 +    int interlace_method, int compression_method, int filter_method));
 13.3033  
 13.3034 -#if defined(PNG_oFFs_SUPPORTED)
 13.3035 -extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr,
 13.3036 -   png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,
 13.3037 -   int *unit_type));
 13.3038 +#ifdef PNG_oFFs_SUPPORTED
 13.3039 +PNG_EXPORT(145, png_uint_32, png_get_oFFs,
 13.3040 +    (png_const_structp png_ptr, png_const_infop info_ptr,
 13.3041 +    png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type));
 13.3042  #endif
 13.3043  
 13.3044 -#if defined(PNG_oFFs_SUPPORTED)
 13.3045 -extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr,
 13.3046 -   png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y,
 13.3047 -   int unit_type));
 13.3048 +#ifdef PNG_oFFs_SUPPORTED
 13.3049 +PNG_EXPORT(146, void, png_set_oFFs,
 13.3050 +    (png_structp png_ptr, png_infop info_ptr,
 13.3051 +    png_int_32 offset_x, png_int_32 offset_y, int unit_type));
 13.3052  #endif
 13.3053  
 13.3054 -#if defined(PNG_pCAL_SUPPORTED)
 13.3055 -extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr,
 13.3056 -   png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1,
 13.3057 -   int *type, int *nparams, png_charp *units, png_charpp *params));
 13.3058 +#ifdef PNG_pCAL_SUPPORTED
 13.3059 +PNG_EXPORT(147, png_uint_32, png_get_pCAL,
 13.3060 +    (png_const_structp png_ptr, png_const_infop info_ptr,
 13.3061 +    png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type,
 13.3062 +    int *nparams,
 13.3063 +    png_charp *units, png_charpp *params));
 13.3064  #endif
 13.3065  
 13.3066 -#if defined(PNG_pCAL_SUPPORTED)
 13.3067 -extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr,
 13.3068 -   png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1,
 13.3069 -   int type, int nparams, png_charp units, png_charpp params));
 13.3070 +#ifdef PNG_pCAL_SUPPORTED
 13.3071 +PNG_EXPORT(148, void, png_set_pCAL, (png_structp png_ptr,
 13.3072 +    png_infop info_ptr,
 13.3073 +    png_const_charp purpose, png_int_32 X0, png_int_32 X1, int type,
 13.3074 +    int nparams, png_const_charp units, png_charpp params));
 13.3075  #endif
 13.3076  
 13.3077 -#if defined(PNG_pHYs_SUPPORTED)
 13.3078 -extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr,
 13.3079 -   png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
 13.3080 +#ifdef PNG_pHYs_SUPPORTED
 13.3081 +PNG_EXPORT(149, png_uint_32, png_get_pHYs,
 13.3082 +    (png_const_structp png_ptr, png_const_infop info_ptr,
 13.3083 +    png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
 13.3084  #endif
 13.3085  
 13.3086 -#if defined(PNG_pHYs_SUPPORTED)
 13.3087 -extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr,
 13.3088 -   png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type));
 13.3089 +#ifdef PNG_pHYs_SUPPORTED
 13.3090 +PNG_EXPORT(150, void, png_set_pHYs,
 13.3091 +    (png_structp png_ptr, png_infop info_ptr,
 13.3092 +    png_uint_32 res_x, png_uint_32 res_y, int unit_type));
 13.3093  #endif
 13.3094  
 13.3095 -extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr,
 13.3096 -   png_infop info_ptr, png_colorp *palette, int *num_palette));
 13.3097 +PNG_EXPORT(151, png_uint_32, png_get_PLTE,
 13.3098 +    (png_const_structp png_ptr, png_const_infop info_ptr,
 13.3099 +    png_colorp *palette, int *num_palette));
 13.3100  
 13.3101 -extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr,
 13.3102 -   png_infop info_ptr, png_colorp palette, int num_palette));
 13.3103 +PNG_EXPORT(152, void, png_set_PLTE,
 13.3104 +    (png_structp png_ptr, png_infop info_ptr,
 13.3105 +    png_const_colorp palette, int num_palette));
 13.3106  
 13.3107 -#if defined(PNG_sBIT_SUPPORTED)
 13.3108 -extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr,
 13.3109 -   png_infop info_ptr, png_color_8p *sig_bit));
 13.3110 +#ifdef PNG_sBIT_SUPPORTED
 13.3111 +PNG_EXPORT(153, png_uint_32, png_get_sBIT,
 13.3112 +    (png_const_structp png_ptr, png_infop info_ptr,
 13.3113 +    png_color_8p *sig_bit));
 13.3114  #endif
 13.3115  
 13.3116 -#if defined(PNG_sBIT_SUPPORTED)
 13.3117 -extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr,
 13.3118 -   png_infop info_ptr, png_color_8p sig_bit));
 13.3119 +#ifdef PNG_sBIT_SUPPORTED
 13.3120 +PNG_EXPORT(154, void, png_set_sBIT,
 13.3121 +    (png_structp png_ptr, png_infop info_ptr, png_const_color_8p sig_bit));
 13.3122  #endif
 13.3123  
 13.3124 -#if defined(PNG_sRGB_SUPPORTED)
 13.3125 -extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr,
 13.3126 -   png_infop info_ptr, int *intent));
 13.3127 +#ifdef PNG_sRGB_SUPPORTED
 13.3128 +PNG_EXPORT(155, png_uint_32, png_get_sRGB, (png_const_structp png_ptr,
 13.3129 +    png_const_infop info_ptr, int *file_srgb_intent));
 13.3130  #endif
 13.3131  
 13.3132 -#if defined(PNG_sRGB_SUPPORTED)
 13.3133 -extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr,
 13.3134 -   png_infop info_ptr, int intent));
 13.3135 -extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr,
 13.3136 -   png_infop info_ptr, int intent));
 13.3137 +#ifdef PNG_sRGB_SUPPORTED
 13.3138 +PNG_EXPORT(156, void, png_set_sRGB,
 13.3139 +    (png_structp png_ptr, png_infop info_ptr, int srgb_intent));
 13.3140 +PNG_EXPORT(157, void, png_set_sRGB_gAMA_and_cHRM, (png_structp png_ptr,
 13.3141 +    png_infop info_ptr, int srgb_intent));
 13.3142  #endif
 13.3143  
 13.3144 -#if defined(PNG_iCCP_SUPPORTED)
 13.3145 -extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr,
 13.3146 -   png_infop info_ptr, png_charpp name, int *compression_type,
 13.3147 -   png_charpp profile, png_uint_32 *proflen));
 13.3148 -   /* Note to maintainer: profile should be png_bytepp */
 13.3149 +#ifdef PNG_iCCP_SUPPORTED
 13.3150 +PNG_EXPORT(158, png_uint_32, png_get_iCCP,
 13.3151 +    (png_const_structp png_ptr, png_const_infop info_ptr,
 13.3152 +    png_charpp name, int *compression_type, png_bytepp profile,
 13.3153 +    png_uint_32 *proflen));
 13.3154  #endif
 13.3155  
 13.3156 -#if defined(PNG_iCCP_SUPPORTED)
 13.3157 -extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr,
 13.3158 -   png_infop info_ptr, png_charp name, int compression_type,
 13.3159 -   png_charp profile, png_uint_32 proflen));
 13.3160 -   /* Note to maintainer: profile should be png_bytep */
 13.3161 +#ifdef PNG_iCCP_SUPPORTED
 13.3162 +PNG_EXPORT(159, void, png_set_iCCP,
 13.3163 +    (png_structp png_ptr, png_infop info_ptr,
 13.3164 +    png_const_charp name, int compression_type, png_const_bytep profile,
 13.3165 +    png_uint_32 proflen));
 13.3166  #endif
 13.3167  
 13.3168 -#if defined(PNG_sPLT_SUPPORTED)
 13.3169 -extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr,
 13.3170 -   png_infop info_ptr, png_sPLT_tpp entries));
 13.3171 +#ifdef PNG_sPLT_SUPPORTED
 13.3172 +PNG_EXPORT(160, png_uint_32, png_get_sPLT,
 13.3173 +    (png_const_structp png_ptr, png_const_infop info_ptr,
 13.3174 +    png_sPLT_tpp entries));
 13.3175  #endif
 13.3176  
 13.3177 -#if defined(PNG_sPLT_SUPPORTED)
 13.3178 -extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr,
 13.3179 -   png_infop info_ptr, png_sPLT_tp entries, int nentries));
 13.3180 +#ifdef PNG_sPLT_SUPPORTED
 13.3181 +PNG_EXPORT(161, void, png_set_sPLT,
 13.3182 +    (png_structp png_ptr, png_infop info_ptr,
 13.3183 +    png_const_sPLT_tp entries, int nentries));
 13.3184  #endif
 13.3185  
 13.3186 -#if defined(PNG_TEXT_SUPPORTED)
 13.3187 +#ifdef PNG_TEXT_SUPPORTED
 13.3188  /* png_get_text also returns the number of text chunks in *num_text */
 13.3189 -extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr,
 13.3190 -   png_infop info_ptr, png_textp *text_ptr, int *num_text));
 13.3191 +PNG_EXPORT(162, png_uint_32, png_get_text,
 13.3192 +    (png_const_structp png_ptr, png_const_infop info_ptr,
 13.3193 +    png_textp *text_ptr, int *num_text));
 13.3194  #endif
 13.3195  
 13.3196 -/*
 13.3197 - *  Note while png_set_text() will accept a structure whose text,
 13.3198 - *  language, and  translated keywords are NULL pointers, the structure
 13.3199 - *  returned by png_get_text will always contain regular
 13.3200 - *  zero-terminated C strings.  They might be empty strings but
 13.3201 - *  they will never be NULL pointers.
 13.3202 +/* Note while png_set_text() will accept a structure whose text,
 13.3203 + * language, and  translated keywords are NULL pointers, the structure
 13.3204 + * returned by png_get_text will always contain regular
 13.3205 + * zero-terminated C strings.  They might be empty strings but
 13.3206 + * they will never be NULL pointers.
 13.3207   */
 13.3208  
 13.3209 -#if defined(PNG_TEXT_SUPPORTED)
 13.3210 -extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr,
 13.3211 -   png_infop info_ptr, png_textp text_ptr, int num_text));
 13.3212 +#ifdef PNG_TEXT_SUPPORTED
 13.3213 +PNG_EXPORT(163, void, png_set_text,
 13.3214 +    (png_structp png_ptr, png_infop info_ptr,
 13.3215 +    png_const_textp text_ptr, int num_text));
 13.3216  #endif
 13.3217  
 13.3218 -#if defined(PNG_tIME_SUPPORTED)
 13.3219 -extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr,
 13.3220 -   png_infop info_ptr, png_timep *mod_time));
 13.3221 +#ifdef PNG_tIME_SUPPORTED
 13.3222 +PNG_EXPORT(164, png_uint_32, png_get_tIME,
 13.3223 +    (png_const_structp png_ptr, png_infop info_ptr, png_timep *mod_time));
 13.3224  #endif
 13.3225  
 13.3226 -#if defined(PNG_tIME_SUPPORTED)
 13.3227 -extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr,
 13.3228 -   png_infop info_ptr, png_timep mod_time));
 13.3229 +#ifdef PNG_tIME_SUPPORTED
 13.3230 +PNG_EXPORT(165, void, png_set_tIME,
 13.3231 +    (png_structp png_ptr, png_infop info_ptr, png_const_timep mod_time));
 13.3232  #endif
 13.3233  
 13.3234 -#if defined(PNG_tRNS_SUPPORTED)
 13.3235 -extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr,
 13.3236 -   png_infop info_ptr, png_bytep *trans, int *num_trans,
 13.3237 -   png_color_16p *trans_values));
 13.3238 +#ifdef PNG_tRNS_SUPPORTED
 13.3239 +PNG_EXPORT(166, png_uint_32, png_get_tRNS,
 13.3240 +    (png_const_structp png_ptr, png_infop info_ptr,
 13.3241 +    png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color));
 13.3242  #endif
 13.3243  
 13.3244 -#if defined(PNG_tRNS_SUPPORTED)
 13.3245 -extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
 13.3246 -   png_infop info_ptr, png_bytep trans, int num_trans,
 13.3247 -   png_color_16p trans_values));
 13.3248 +#ifdef PNG_tRNS_SUPPORTED
 13.3249 +PNG_EXPORT(167, void, png_set_tRNS,
 13.3250 +    (png_structp png_ptr, png_infop info_ptr,
 13.3251 +    png_const_bytep trans_alpha, int num_trans,
 13.3252 +    png_const_color_16p trans_color));
 13.3253  #endif
 13.3254  
 13.3255 -#if defined(PNG_tRNS_SUPPORTED)
 13.3256 +#ifdef PNG_sCAL_SUPPORTED
 13.3257 +PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL,
 13.3258 +    (png_const_structp png_ptr, png_const_infop info_ptr,
 13.3259 +    int *unit, double *width, double *height));
 13.3260 +#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
 13.3261 +/* NOTE: this API is currently implemented using floating point arithmetic,
 13.3262 + * consequently it can only be used on systems with floating point support.
 13.3263 + * In any case the range of values supported by png_fixed_point is small and it
 13.3264 + * is highly recommended that png_get_sCAL_s be used instead.
 13.3265 + */
 13.3266 +PNG_FIXED_EXPORT(214, png_uint_32, png_get_sCAL_fixed,
 13.3267 +    (png_structp png_ptr, png_const_infop info_ptr, int *unit,
 13.3268 +    png_fixed_point *width,
 13.3269 +    png_fixed_point *height));
 13.3270  #endif
 13.3271 +PNG_EXPORT(169, png_uint_32, png_get_sCAL_s,
 13.3272 +    (png_const_structp png_ptr, png_const_infop info_ptr,
 13.3273 +    int *unit, png_charpp swidth, png_charpp sheight));
 13.3274  
 13.3275 -#if defined(PNG_sCAL_SUPPORTED)
 13.3276 -#ifdef PNG_FLOATING_POINT_SUPPORTED
 13.3277 -extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr,
 13.3278 -   png_infop info_ptr, int *unit, double *width, double *height));
 13.3279 -#else
 13.3280 -#ifdef PNG_FIXED_POINT_SUPPORTED
 13.3281 -extern PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr,
 13.3282 -   png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight));
 13.3283 -#endif
 13.3284 -#endif
 13.3285 +PNG_FP_EXPORT(170, void, png_set_sCAL,
 13.3286 +    (png_structp png_ptr, png_infop info_ptr,
 13.3287 +    int unit, double width, double height));
 13.3288 +PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, (png_structp png_ptr,
 13.3289 +   png_infop info_ptr, int unit, png_fixed_point width,
 13.3290 +   png_fixed_point height));
 13.3291 +PNG_EXPORT(171, void, png_set_sCAL_s,
 13.3292 +    (png_structp png_ptr, png_infop info_ptr,
 13.3293 +    int unit, png_const_charp swidth, png_const_charp sheight));
 13.3294  #endif /* PNG_sCAL_SUPPORTED */
 13.3295  
 13.3296 -#if defined(PNG_sCAL_SUPPORTED)
 13.3297 -#ifdef PNG_FLOATING_POINT_SUPPORTED
 13.3298 -extern PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr,
 13.3299 -   png_infop info_ptr, int unit, double width, double height));
 13.3300 -#else
 13.3301 -#ifdef PNG_FIXED_POINT_SUPPORTED
 13.3302 -extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr,
 13.3303 -   png_infop info_ptr, int unit, png_charp swidth, png_charp sheight));
 13.3304 -#endif
 13.3305 -#endif
 13.3306 -#endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */
 13.3307 -
 13.3308  #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
 13.3309  /* Provide a list of chunks and how they are to be handled, if the built-in
 13.3310     handling or default unknown chunk handling is not desired.  Any chunks not
 13.3311     listed will be handled in the default manner.  The IHDR and IEND chunks
 13.3312 -   must not be listed.
 13.3313 -      keep = 0: follow default behaviour
 13.3314 -           = 1: do not keep
 13.3315 -           = 2: keep only if safe-to-copy
 13.3316 -           = 3: keep even if unsafe-to-copy
 13.3317 +   must not be listed.  Because this turns off the default handling for chunks
 13.3318 +   that would otherwise be recognized the behavior of libpng transformations may
 13.3319 +   well become incorrect!
 13.3320 +      keep = 0: PNG_HANDLE_CHUNK_AS_DEFAULT: follow default behavior
 13.3321 +           = 1: PNG_HANDLE_CHUNK_NEVER:      do not keep
 13.3322 +           = 2: PNG_HANDLE_CHUNK_IF_SAFE:    keep only if safe-to-copy
 13.3323 +           = 3: PNG_HANDLE_CHUNK_ALWAYS:     keep even if unsafe-to-copy
 13.3324  */
 13.3325 -extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp
 13.3326 -   png_ptr, int keep, png_bytep chunk_list, int num_chunks));
 13.3327 -PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep
 13.3328 -   chunk_name));
 13.3329 +PNG_EXPORT(172, void, png_set_keep_unknown_chunks,
 13.3330 +    (png_structp png_ptr, int keep,
 13.3331 +    png_const_bytep chunk_list, int num_chunks));
 13.3332 +
 13.3333 +/* The handling code is returned; the result is therefore true (non-zero) if
 13.3334 + * special handling is required, false for the default handling.
 13.3335 + */
 13.3336 +PNG_EXPORT(173, int, png_handle_as_unknown, (png_structp png_ptr,
 13.3337 +    png_const_bytep chunk_name));
 13.3338  #endif
 13.3339 -#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
 13.3340 -extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr,
 13.3341 -   png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns));
 13.3342 -extern PNG_EXPORT(void, png_set_unknown_chunk_location)
 13.3343 -   PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location));
 13.3344 -extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp
 13.3345 -   png_ptr, png_infop info_ptr, png_unknown_chunkpp entries));
 13.3346 +#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
 13.3347 +PNG_EXPORT(174, void, png_set_unknown_chunks, (png_structp png_ptr,
 13.3348 +    png_infop info_ptr, png_const_unknown_chunkp unknowns,
 13.3349 +    int num_unknowns));
 13.3350 +PNG_EXPORT(175, void, png_set_unknown_chunk_location,
 13.3351 +    (png_structp png_ptr, png_infop info_ptr, int chunk, int location));
 13.3352 +PNG_EXPORT(176, int, png_get_unknown_chunks, (png_const_structp png_ptr,
 13.3353 +    png_const_infop info_ptr, png_unknown_chunkpp entries));
 13.3354  #endif
 13.3355  
 13.3356  /* Png_free_data() will turn off the "valid" flag for anything it frees.
 13.3357   * If you need to turn it off for a chunk that your application has freed,
 13.3358   * you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK);
 13.3359   */
 13.3360 -extern PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr,
 13.3361 -   png_infop info_ptr, int mask));
 13.3362 +PNG_EXPORT(177, void, png_set_invalid,
 13.3363 +    (png_structp png_ptr, png_infop info_ptr, int mask));
 13.3364  
 13.3365 -#if defined(PNG_INFO_IMAGE_SUPPORTED)
 13.3366 +#ifdef PNG_INFO_IMAGE_SUPPORTED
 13.3367  /* The "params" pointer is currently not used and is for future expansion. */
 13.3368 -extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr,
 13.3369 -                        png_infop info_ptr,
 13.3370 -                        int transforms,
 13.3371 -                        png_voidp params));
 13.3372 -extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
 13.3373 -                        png_infop info_ptr,
 13.3374 -                        int transforms,
 13.3375 -                        png_voidp params));
 13.3376 +PNG_EXPORT(178, void, png_read_png, (png_structp png_ptr, png_infop info_ptr,
 13.3377 +    int transforms, png_voidp params));
 13.3378 +PNG_EXPORT(179, void, png_write_png, (png_structp png_ptr, png_infop info_ptr,
 13.3379 +    int transforms, png_voidp params));
 13.3380  #endif
 13.3381  
 13.3382 -/* Define PNG_DEBUG at compile time for debugging information.  Higher
 13.3383 - * numbers for PNG_DEBUG mean more debugging information.  This has
 13.3384 - * only been added since version 0.95 so it is not implemented throughout
 13.3385 - * libpng yet, but more support will be added as needed.
 13.3386 - */
 13.3387 -#ifdef PNG_DEBUG
 13.3388 -#if (PNG_DEBUG > 0)
 13.3389 -#if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
 13.3390 -#include <crtdbg.h>
 13.3391 -#if (PNG_DEBUG > 1)
 13.3392 -#ifndef _DEBUG
 13.3393 -#  define _DEBUG
 13.3394 -#endif
 13.3395 -#ifndef png_debug
 13.3396 -#define png_debug(l,m)  _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
 13.3397 -#endif
 13.3398 -#ifndef png_debug1
 13.3399 -#define png_debug1(l,m,p1)  _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
 13.3400 -#endif
 13.3401 -#ifndef png_debug2
 13.3402 -#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
 13.3403 -#endif
 13.3404 -#endif
 13.3405 -#else /* PNG_DEBUG_FILE || !_MSC_VER */
 13.3406 -#ifndef PNG_DEBUG_FILE
 13.3407 -#define PNG_DEBUG_FILE stderr
 13.3408 -#endif /* PNG_DEBUG_FILE */
 13.3409 -
 13.3410 -#if (PNG_DEBUG > 1)
 13.3411 -/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on non-ISO
 13.3412 - * compilers.
 13.3413 - */
 13.3414 -#  ifdef __STDC__
 13.3415 -#    ifndef png_debug
 13.3416 -#      define png_debug(l,m) \
 13.3417 -       { \
 13.3418 -       int num_tabs=l; \
 13.3419 -       fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
 13.3420 -         (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
 13.3421 -       }
 13.3422 -#    endif
 13.3423 -#    ifndef png_debug1
 13.3424 -#      define png_debug1(l,m,p1) \
 13.3425 -       { \
 13.3426 -       int num_tabs=l; \
 13.3427 -       fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
 13.3428 -         (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
 13.3429 -       }
 13.3430 -#    endif
 13.3431 -#    ifndef png_debug2
 13.3432 -#      define png_debug2(l,m,p1,p2) \
 13.3433 -       { \
 13.3434 -       int num_tabs=l; \
 13.3435 -       fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
 13.3436 -         (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
 13.3437 -       }
 13.3438 -#    endif
 13.3439 -#  else /* __STDC __ */
 13.3440 -#    ifndef png_debug
 13.3441 -#      define png_debug(l,m) \
 13.3442 -       { \
 13.3443 -       int num_tabs=l; \
 13.3444 -       char format[256]; \
 13.3445 -       snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
 13.3446 -         (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
 13.3447 -         m,PNG_STRING_NEWLINE); \
 13.3448 -       fprintf(PNG_DEBUG_FILE,format); \
 13.3449 -       }
 13.3450 -#    endif
 13.3451 -#    ifndef png_debug1
 13.3452 -#      define png_debug1(l,m,p1) \
 13.3453 -       { \
 13.3454 -       int num_tabs=l; \
 13.3455 -       char format[256]; \
 13.3456 -       snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
 13.3457 -         (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
 13.3458 -         m,PNG_STRING_NEWLINE); \
 13.3459 -       fprintf(PNG_DEBUG_FILE,format,p1); \
 13.3460 -       }
 13.3461 -#    endif
 13.3462 -#    ifndef png_debug2
 13.3463 -#      define png_debug2(l,m,p1,p2) \
 13.3464 -       { \
 13.3465 -       int num_tabs=l; \
 13.3466 -       char format[256]; \
 13.3467 -       snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
 13.3468 -         (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
 13.3469 -         m,PNG_STRING_NEWLINE); \
 13.3470 -       fprintf(PNG_DEBUG_FILE,format,p1,p2); \
 13.3471 -       }
 13.3472 -#    endif
 13.3473 -#  endif /* __STDC __ */
 13.3474 -#endif /* (PNG_DEBUG > 1) */
 13.3475 -
 13.3476 -#endif /* _MSC_VER */
 13.3477 -#endif /* (PNG_DEBUG > 0) */
 13.3478 -#endif /* PNG_DEBUG */
 13.3479 -#ifndef png_debug
 13.3480 -#define png_debug(l, m)
 13.3481 -#endif
 13.3482 -#ifndef png_debug1
 13.3483 -#define png_debug1(l, m, p1)
 13.3484 -#endif
 13.3485 -#ifndef png_debug2
 13.3486 -#define png_debug2(l, m, p1, p2)
 13.3487 -#endif
 13.3488 -
 13.3489 -extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr));
 13.3490 -extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr));
 13.3491 -extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr));
 13.3492 -extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));
 13.3493 +PNG_EXPORT(180, png_const_charp, png_get_copyright,
 13.3494 +    (png_const_structp png_ptr));
 13.3495 +PNG_EXPORT(181, png_const_charp, png_get_header_ver,
 13.3496 +    (png_const_structp png_ptr));
 13.3497 +PNG_EXPORT(182, png_const_charp, png_get_header_version,
 13.3498 +    (png_const_structp png_ptr));
 13.3499 +PNG_EXPORT(183, png_const_charp, png_get_libpng_ver,
 13.3500 +    (png_const_structp png_ptr));
 13.3501  
 13.3502  #ifdef PNG_MNG_FEATURES_SUPPORTED
 13.3503 -extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp
 13.3504 -   png_ptr, png_uint_32 mng_features_permitted));
 13.3505 +PNG_EXPORT(184, png_uint_32, png_permit_mng_features, (png_structp png_ptr,
 13.3506 +    png_uint_32 mng_features_permitted));
 13.3507  #endif
 13.3508  
 13.3509  /* For use in png_set_keep_unknown, added to version 1.2.6 */
 13.3510 @@ -2691,96 +2394,148 @@
 13.3511  #define PNG_HANDLE_CHUNK_IF_SAFE      2
 13.3512  #define PNG_HANDLE_CHUNK_ALWAYS       3
 13.3513  
 13.3514 -/* Added to version 1.2.0 */
 13.3515 -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
 13.3516 -#if defined(PNG_MMX_CODE_SUPPORTED)
 13.3517 -#define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED  0x01  /* not user-settable */
 13.3518 -#define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU    0x02  /* not user-settable */
 13.3519 -#define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW  0x04
 13.3520 -#define PNG_ASM_FLAG_MMX_READ_INTERLACE    0x08
 13.3521 -#define PNG_ASM_FLAG_MMX_READ_FILTER_SUB   0x10
 13.3522 -#define PNG_ASM_FLAG_MMX_READ_FILTER_UP    0x20
 13.3523 -#define PNG_ASM_FLAG_MMX_READ_FILTER_AVG   0x40
 13.3524 -#define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH 0x80
 13.3525 -#define PNG_ASM_FLAGS_INITIALIZED          0x80000000  /* not user-settable */
 13.3526 -
 13.3527 -#define PNG_MMX_READ_FLAGS ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW  \
 13.3528 -                           | PNG_ASM_FLAG_MMX_READ_INTERLACE    \
 13.3529 -                           | PNG_ASM_FLAG_MMX_READ_FILTER_SUB   \
 13.3530 -                           | PNG_ASM_FLAG_MMX_READ_FILTER_UP    \
 13.3531 -                           | PNG_ASM_FLAG_MMX_READ_FILTER_AVG   \
 13.3532 -                           | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH )
 13.3533 -#define PNG_MMX_WRITE_FLAGS ( 0 )
 13.3534 -
 13.3535 -#define PNG_MMX_FLAGS ( PNG_ASM_FLAG_MMX_SUPPORT_COMPILED \
 13.3536 -                      | PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU   \
 13.3537 -                      | PNG_MMX_READ_FLAGS                \
 13.3538 -                      | PNG_MMX_WRITE_FLAGS )
 13.3539 -
 13.3540 -#define PNG_SELECT_READ   1
 13.3541 -#define PNG_SELECT_WRITE  2
 13.3542 -#endif /* PNG_MMX_CODE_SUPPORTED */
 13.3543 -
 13.3544 -#if !defined(PNG_1_0_X)
 13.3545 -/* pngget.c */
 13.3546 -extern PNG_EXPORT(png_uint_32,png_get_mmx_flagmask)
 13.3547 -   PNGARG((int flag_select, int *compilerID));
 13.3548 -
 13.3549 -/* pngget.c */
 13.3550 -extern PNG_EXPORT(png_uint_32,png_get_asm_flagmask)
 13.3551 -   PNGARG((int flag_select));
 13.3552 -
 13.3553 -/* pngget.c */
 13.3554 -extern PNG_EXPORT(png_uint_32,png_get_asm_flags)
 13.3555 -   PNGARG((png_structp png_ptr));
 13.3556 -
 13.3557 -/* pngget.c */
 13.3558 -extern PNG_EXPORT(png_byte,png_get_mmx_bitdepth_threshold)
 13.3559 -   PNGARG((png_structp png_ptr));
 13.3560 -
 13.3561 -/* pngget.c */
 13.3562 -extern PNG_EXPORT(png_uint_32,png_get_mmx_rowbytes_threshold)
 13.3563 -   PNGARG((png_structp png_ptr));
 13.3564 -
 13.3565 -/* pngset.c */
 13.3566 -extern PNG_EXPORT(void,png_set_asm_flags)
 13.3567 -   PNGARG((png_structp png_ptr, png_uint_32 asm_flags));
 13.3568 -
 13.3569 -/* pngset.c */
 13.3570 -extern PNG_EXPORT(void,png_set_mmx_thresholds)
 13.3571 -   PNGARG((png_structp png_ptr, png_byte mmx_bitdepth_threshold,
 13.3572 -   png_uint_32 mmx_rowbytes_threshold));
 13.3573 -
 13.3574 -#endif /* PNG_1_0_X */
 13.3575 -
 13.3576 -#if !defined(PNG_1_0_X)
 13.3577 -/* png.c, pnggccrd.c, or pngvcrd.c */
 13.3578 -extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));
 13.3579 -#endif /* PNG_1_0_X */
 13.3580 -#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
 13.3581 -
 13.3582  /* Strip the prepended error numbers ("#nnn ") from error and warning
 13.3583   * messages before passing them to the error or warning handler.
 13.3584   */
 13.3585  #ifdef PNG_ERROR_NUMBERS_SUPPORTED
 13.3586 -extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp
 13.3587 -   png_ptr, png_uint_32 strip_mode));
 13.3588 +PNG_EXPORT(185, void, png_set_strip_error_numbers,
 13.3589 +    (png_structp png_ptr,
 13.3590 +    png_uint_32 strip_mode));
 13.3591  #endif
 13.3592  
 13.3593 -/* Added at libpng-1.2.6 */
 13.3594 +/* Added in libpng-1.2.6 */
 13.3595  #ifdef PNG_SET_USER_LIMITS_SUPPORTED
 13.3596 -extern PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp
 13.3597 -   png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max));
 13.3598 -extern PNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_structp
 13.3599 -   png_ptr));
 13.3600 -extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
 13.3601 -   png_ptr));
 13.3602 +PNG_EXPORT(186, void, png_set_user_limits, (png_structp png_ptr,
 13.3603 +    png_uint_32 user_width_max, png_uint_32 user_height_max));
 13.3604 +PNG_EXPORT(187, png_uint_32, png_get_user_width_max,
 13.3605 +    (png_const_structp png_ptr));
 13.3606 +PNG_EXPORT(188, png_uint_32, png_get_user_height_max,
 13.3607 +    (png_const_structp png_ptr));
 13.3608 +/* Added in libpng-1.4.0 */
 13.3609 +PNG_EXPORT(189, void, png_set_chunk_cache_max, (png_structp png_ptr,
 13.3610 +    png_uint_32 user_chunk_cache_max));
 13.3611 +PNG_EXPORT(190, png_uint_32, png_get_chunk_cache_max,
 13.3612 +    (png_const_structp png_ptr));
 13.3613 +/* Added in libpng-1.4.1 */
 13.3614 +PNG_EXPORT(191, void, png_set_chunk_malloc_max, (png_structp png_ptr,
 13.3615 +    png_alloc_size_t user_chunk_cache_max));
 13.3616 +PNG_EXPORT(192, png_alloc_size_t, png_get_chunk_malloc_max,
 13.3617 +    (png_const_structp png_ptr));
 13.3618  #endif
 13.3619  
 13.3620 +#if defined(PNG_INCH_CONVERSIONS_SUPPORTED)
 13.3621 +PNG_EXPORT(193, png_uint_32, png_get_pixels_per_inch,
 13.3622 +    (png_const_structp png_ptr, png_const_infop info_ptr));
 13.3623  
 13.3624 -/* Maintainer: Put new public prototypes here ^, in libpng.3, and in
 13.3625 - * project defs
 13.3626 +PNG_EXPORT(194, png_uint_32, png_get_x_pixels_per_inch,
 13.3627 +    (png_const_structp png_ptr, png_const_infop info_ptr));
 13.3628 +
 13.3629 +PNG_EXPORT(195, png_uint_32, png_get_y_pixels_per_inch,
 13.3630 +    (png_const_structp png_ptr, png_const_infop info_ptr));
 13.3631 +
 13.3632 +PNG_FP_EXPORT(196, float, png_get_x_offset_inches,
 13.3633 +    (png_const_structp png_ptr, png_const_infop info_ptr));
 13.3634 +#ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */
 13.3635 +PNG_FIXED_EXPORT(211, png_fixed_point, png_get_x_offset_inches_fixed,
 13.3636 +    (png_structp png_ptr, png_const_infop info_ptr));
 13.3637 +#endif
 13.3638 +
 13.3639 +PNG_FP_EXPORT(197, float, png_get_y_offset_inches, (png_const_structp png_ptr,
 13.3640 +    png_const_infop info_ptr));
 13.3641 +#ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */
 13.3642 +PNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed,
 13.3643 +    (png_structp png_ptr, png_const_infop info_ptr));
 13.3644 +#endif
 13.3645 +
 13.3646 +#  ifdef PNG_pHYs_SUPPORTED
 13.3647 +PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_const_structp png_ptr,
 13.3648 +    png_const_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y,
 13.3649 +    int *unit_type));
 13.3650 +#  endif /* PNG_pHYs_SUPPORTED */
 13.3651 +#endif  /* PNG_INCH_CONVERSIONS_SUPPORTED */
 13.3652 +
 13.3653 +/* Added in libpng-1.4.0 */
 13.3654 +#ifdef PNG_IO_STATE_SUPPORTED
 13.3655 +PNG_EXPORT(199, png_uint_32, png_get_io_state, (png_structp png_ptr));
 13.3656 +
 13.3657 +PNG_EXPORTA(200, png_const_bytep, png_get_io_chunk_name,
 13.3658 +    (png_structp png_ptr), PNG_DEPRECATED);
 13.3659 +PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type,
 13.3660 +    (png_const_structp png_ptr));
 13.3661 +
 13.3662 +/* The flags returned by png_get_io_state() are the following: */
 13.3663 +#  define PNG_IO_NONE        0x0000   /* no I/O at this moment */
 13.3664 +#  define PNG_IO_READING     0x0001   /* currently reading */
 13.3665 +#  define PNG_IO_WRITING     0x0002   /* currently writing */
 13.3666 +#  define PNG_IO_SIGNATURE   0x0010   /* currently at the file signature */
 13.3667 +#  define PNG_IO_CHUNK_HDR   0x0020   /* currently at the chunk header */
 13.3668 +#  define PNG_IO_CHUNK_DATA  0x0040   /* currently at the chunk data */
 13.3669 +#  define PNG_IO_CHUNK_CRC   0x0080   /* currently at the chunk crc */
 13.3670 +#  define PNG_IO_MASK_OP     0x000f   /* current operation: reading/writing */
 13.3671 +#  define PNG_IO_MASK_LOC    0x00f0   /* current location: sig/hdr/data/crc */
 13.3672 +#endif /* ?PNG_IO_STATE_SUPPORTED */
 13.3673 +
 13.3674 +/* Interlace support.  The following macros are always defined so that if
 13.3675 + * libpng interlace handling is turned off the macros may be used to handle
 13.3676 + * interlaced images within the application.
 13.3677   */
 13.3678 +#define PNG_INTERLACE_ADAM7_PASSES 7
 13.3679 +
 13.3680 +/* Two macros to return the first row and first column of the original,
 13.3681 + * full, image which appears in a given pass.  'pass' is in the range 0
 13.3682 + * to 6 and the result is in the range 0 to 7.
 13.3683 + */
 13.3684 +#define PNG_PASS_START_ROW(pass) (((1&~(pass))<<(3-((pass)>>1)))&7)
 13.3685 +#define PNG_PASS_START_COL(pass) (((1& (pass))<<(3-(((pass)+1)>>1)))&7)
 13.3686 +
 13.3687 +/* A macro to return the offset between pixels in the output row for a pair of
 13.3688 + * pixels in the input - effectively the inverse of the 'COL_SHIFT' macro that
 13.3689 + * follows.  Note that ROW_OFFSET is the offset from one row to the next whereas
 13.3690 + * COL_OFFSET is from one column to the next, within a row.
 13.3691 + */
 13.3692 +#define PNG_PASS_ROW_OFFSET(pass) ((pass)>2?(8>>(((pass)-1)>>1)):8)
 13.3693 +#define PNG_PASS_COL_OFFSET(pass) (1<<((7-(pass))>>1))
 13.3694 +
 13.3695 +/* Two macros to help evaluate the number of rows or columns in each
 13.3696 + * pass.  This is expressed as a shift - effectively log2 of the number or
 13.3697 + * rows or columns in each 8x8 tile of the original image.
 13.3698 + */
 13.3699 +#define PNG_PASS_ROW_SHIFT(pass) ((pass)>2?(8-(pass))>>1:3)
 13.3700 +#define PNG_PASS_COL_SHIFT(pass) ((pass)>1?(7-(pass))>>1:3)
 13.3701 +
 13.3702 +/* Hence two macros to determine the number of rows or columns in a given
 13.3703 + * pass of an image given its height or width.  In fact these macros may
 13.3704 + * return non-zero even though the sub-image is empty, because the other
 13.3705 + * dimension may be empty for a small image.
 13.3706 + */
 13.3707 +#define PNG_PASS_ROWS(height, pass) (((height)+(((1<<PNG_PASS_ROW_SHIFT(pass))\
 13.3708 +   -1)-PNG_PASS_START_ROW(pass)))>>PNG_PASS_ROW_SHIFT(pass))
 13.3709 +#define PNG_PASS_COLS(width, pass) (((width)+(((1<<PNG_PASS_COL_SHIFT(pass))\
 13.3710 +   -1)-PNG_PASS_START_COL(pass)))>>PNG_PASS_COL_SHIFT(pass))
 13.3711 +
 13.3712 +/* For the reader row callbacks (both progressive and sequential) it is
 13.3713 + * necessary to find the row in the output image given a row in an interlaced
 13.3714 + * image, so two more macros:
 13.3715 + */
 13.3716 +#define PNG_ROW_FROM_PASS_ROW(yIn, pass) \
 13.3717 +   (((yIn)<<PNG_PASS_ROW_SHIFT(pass))+PNG_PASS_START_ROW(pass))
 13.3718 +#define PNG_COL_FROM_PASS_COL(xIn, pass) \
 13.3719 +   (((xIn)<<PNG_PASS_COL_SHIFT(pass))+PNG_PASS_START_COL(pass))
 13.3720 +
 13.3721 +/* Two macros which return a boolean (0 or 1) saying whether the given row
 13.3722 + * or column is in a particular pass.  These use a common utility macro that
 13.3723 + * returns a mask for a given pass - the offset 'off' selects the row or
 13.3724 + * column version.  The mask has the appropriate bit set for each column in
 13.3725 + * the tile.
 13.3726 + */
 13.3727 +#define PNG_PASS_MASK(pass,off) ( \
 13.3728 +   ((0x110145AF>>(((7-(off))-(pass))<<2)) & 0xF) | \
 13.3729 +   ((0x01145AF0>>(((7-(off))-(pass))<<2)) & 0xF0))
 13.3730 +
 13.3731 +#define PNG_ROW_IN_INTERLACE_PASS(y, pass) \
 13.3732 +   ((PNG_PASS_MASK(pass,0) >> ((y)&7)) & 1)
 13.3733 +#define PNG_COL_IN_INTERLACE_PASS(x, pass) \
 13.3734 +   ((PNG_PASS_MASK(pass,1) >> ((x)&7)) & 1)
 13.3735  
 13.3736  #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
 13.3737  /* With these routines we avoid an integer divide, which will be slower on
 13.3738 @@ -2795,927 +2550,98 @@
 13.3739   * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ]
 13.3740   */
 13.3741  
 13.3742 - /* fg and bg should be in `gamma 1.0' space; alpha is the opacity          */
 13.3743 + /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */
 13.3744  
 13.3745 -#  define png_composite(composite, fg, alpha, bg)                            \
 13.3746 -     { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) * (png_uint_16)(alpha) \
 13.3747 -                        +        (png_uint_16)(bg)*(png_uint_16)(255 -       \
 13.3748 -                        (png_uint_16)(alpha)) + (png_uint_16)128);           \
 13.3749 +#  define png_composite(composite, fg, alpha, bg)         \
 13.3750 +     { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \
 13.3751 +           * (png_uint_16)(alpha)                         \
 13.3752 +           + (png_uint_16)(bg)*(png_uint_16)(255          \
 13.3753 +           - (png_uint_16)(alpha)) + 128);                \
 13.3754         (composite) = (png_byte)((temp + (temp >> 8)) >> 8); }
 13.3755  
 13.3756 -#  define png_composite_16(composite, fg, alpha, bg)                         \
 13.3757 -     { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) * (png_uint_32)(alpha) \
 13.3758 -                        + (png_uint_32)(bg)*(png_uint_32)(65535L -           \
 13.3759 -                        (png_uint_32)(alpha)) + (png_uint_32)32768L);        \
 13.3760 +#  define png_composite_16(composite, fg, alpha, bg)       \
 13.3761 +     { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg)  \
 13.3762 +           * (png_uint_32)(alpha)                          \
 13.3763 +           + (png_uint_32)(bg)*(65535                      \
 13.3764 +           - (png_uint_32)(alpha)) + 32768);               \
 13.3765         (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
 13.3766  
 13.3767  #else  /* Standard method using integer division */
 13.3768  
 13.3769 -#  define png_composite(composite, fg, alpha, bg)                            \
 13.3770 -     (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) +    \
 13.3771 -       (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) +       \
 13.3772 -       (png_uint_16)127) / 255)
 13.3773 +#  define png_composite(composite, fg, alpha, bg)                          \
 13.3774 +     (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) +  \
 13.3775 +     (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) +       \
 13.3776 +     127) / 255)
 13.3777  
 13.3778  #  define png_composite_16(composite, fg, alpha, bg)                         \
 13.3779       (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
 13.3780 -       (png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) +      \
 13.3781 -       (png_uint_32)32767) / (png_uint_32)65535L)
 13.3782 -
 13.3783 +     (png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) +         \
 13.3784 +     32767) / 65535)
 13.3785  #endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
 13.3786  
 13.3787 -/* Inline macros to do direct reads of bytes from the input buffer.  These
 13.3788 - * require that you are using an architecture that uses PNG byte ordering
 13.3789 - * (MSB first) and supports unaligned data storage.  I think that PowerPC
 13.3790 - * in big-endian mode and 680x0 are the only ones that will support this.
 13.3791 - * The x86 line of processors definitely do not.  The png_get_int_32()
 13.3792 - * routine also assumes we are using two's complement format for negative
 13.3793 - * values, which is almost certainly true.
 13.3794 - */
 13.3795 -#if defined(PNG_READ_BIG_ENDIAN_SUPPORTED)
 13.3796 -#  define png_get_uint_32(buf) ( *((png_uint_32p) (buf)))
 13.3797 -#  define png_get_uint_16(buf) ( *((png_uint_16p) (buf)))
 13.3798 -#  define png_get_int_32(buf)  ( *((png_int_32p)  (buf)))
 13.3799 -#else
 13.3800 -extern PNG_EXPORT(png_uint_32,png_get_uint_32) PNGARG((png_bytep buf));
 13.3801 -extern PNG_EXPORT(png_uint_16,png_get_uint_16) PNGARG((png_bytep buf));
 13.3802 -extern PNG_EXPORT(png_int_32,png_get_int_32) PNGARG((png_bytep buf));
 13.3803 -#endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */
 13.3804 -extern PNG_EXPORT(png_uint_32,png_get_uint_31)
 13.3805 -  PNGARG((png_structp png_ptr, png_bytep buf));
 13.3806 +#ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED
 13.3807 +PNG_EXPORT(201, png_uint_32, png_get_uint_32, (png_const_bytep buf));
 13.3808 +PNG_EXPORT(202, png_uint_16, png_get_uint_16, (png_const_bytep buf));
 13.3809 +PNG_EXPORT(203, png_int_32, png_get_int_32, (png_const_bytep buf));
 13.3810 +#endif
 13.3811 +
 13.3812 +PNG_EXPORT(204, png_uint_32, png_get_uint_31, (png_structp png_ptr,
 13.3813 +    png_const_bytep buf));
 13.3814  /* No png_get_int_16 -- may be added if there's a real need for it. */
 13.3815  
 13.3816 -/* Place a 32-bit number into a buffer in PNG byte order (big-endian).
 13.3817 - */
 13.3818 -extern PNG_EXPORT(void,png_save_uint_32)
 13.3819 -   PNGARG((png_bytep buf, png_uint_32 i));
 13.3820 -extern PNG_EXPORT(void,png_save_int_32)
 13.3821 -   PNGARG((png_bytep buf, png_int_32 i));
 13.3822 +/* Place a 32-bit number into a buffer in PNG byte order (big-endian). */
 13.3823 +#ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED
 13.3824 +PNG_EXPORT(205, void, png_save_uint_32, (png_bytep buf, png_uint_32 i));
 13.3825 +#endif
 13.3826 +#ifdef PNG_SAVE_INT_32_SUPPORTED
 13.3827 +PNG_EXPORT(206, void, png_save_int_32, (png_bytep buf, png_int_32 i));
 13.3828 +#endif
 13.3829  
 13.3830  /* Place a 16-bit number into a buffer in PNG byte order.
 13.3831   * The parameter is declared unsigned int, not png_uint_16,
 13.3832   * just to avoid potential problems on pre-ANSI C compilers.
 13.3833   */
 13.3834 -extern PNG_EXPORT(void,png_save_uint_16)
 13.3835 -   PNGARG((png_bytep buf, unsigned int i));
 13.3836 +#ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED
 13.3837 +PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i));
 13.3838  /* No png_save_int_16 -- may be added if there's a real need for it. */
 13.3839 +#endif
 13.3840  
 13.3841 -/* ************************************************************************* */
 13.3842 +#ifdef PNG_USE_READ_MACROS
 13.3843 +/* Inline macros to do direct reads of bytes from the input buffer.
 13.3844 + * The png_get_int_32() routine assumes we are using two's complement
 13.3845 + * format for negative values, which is almost certainly true.
 13.3846 + */
 13.3847 +#  define png_get_uint_32(buf) \
 13.3848 +     (((png_uint_32)(*(buf)) << 24) + \
 13.3849 +      ((png_uint_32)(*((buf) + 1)) << 16) + \
 13.3850 +      ((png_uint_32)(*((buf) + 2)) << 8) + \
 13.3851 +      ((png_uint_32)(*((buf) + 3))))
 13.3852  
 13.3853 -/* These next functions are used internally in the code.  They generally
 13.3854 - * shouldn't be used unless you are writing code to add or replace some
 13.3855 - * functionality in libpng.  More information about most functions can
 13.3856 - * be found in the files where the functions are located.
 13.3857 +   /* From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
 13.3858 +    * function) incorrectly returned a value of type png_uint_32.
 13.3859 +    */
 13.3860 +#  define png_get_uint_16(buf) \
 13.3861 +     ((png_uint_16) \
 13.3862 +      (((unsigned int)(*(buf)) << 8) + \
 13.3863 +       ((unsigned int)(*((buf) + 1)))))
 13.3864 +
 13.3865 +#  define png_get_int_32(buf) \
 13.3866 +     ((png_int_32)((*(buf) & 0x80) \
 13.3867 +      ? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffffL) + 1)) \
 13.3868 +      : (png_int_32)png_get_uint_32(buf)))
 13.3869 +#endif
 13.3870 +
 13.3871 +/* Maintainer: Put new public prototypes here ^, in libpng.3, and project
 13.3872 + * defs
 13.3873   */
 13.3874  
 13.3875 -
 13.3876 -/* Various modes of operation, that are visible to applications because
 13.3877 - * they are used for unknown chunk location.
 13.3878 +/* The last ordinal number (this is the *last* one already used; the next
 13.3879 + * one to use is one more than this.)  Maintainer, remember to add an entry to
 13.3880 + * scripts/symbols.def as well.
 13.3881   */
 13.3882 -#define PNG_HAVE_IHDR               0x01
 13.3883 -#define PNG_HAVE_PLTE               0x02
 13.3884 -#define PNG_HAVE_IDAT               0x04
 13.3885 -#define PNG_AFTER_IDAT              0x08 /* Have complete zlib datastream */
 13.3886 -#define PNG_HAVE_IEND               0x10
 13.3887 -
 13.3888 -#if defined(PNG_INTERNAL)
 13.3889 -
 13.3890 -/* More modes of operation.  Note that after an init, mode is set to
 13.3891 - * zero automatically when the structure is created.
 13.3892 - */
 13.3893 -#define PNG_HAVE_gAMA               0x20
 13.3894 -#define PNG_HAVE_cHRM               0x40
 13.3895 -#define PNG_HAVE_sRGB               0x80
 13.3896 -#define PNG_HAVE_CHUNK_HEADER      0x100
 13.3897 -#define PNG_WROTE_tIME             0x200
 13.3898 -#define PNG_WROTE_INFO_BEFORE_PLTE 0x400
 13.3899 -#define PNG_BACKGROUND_IS_GRAY     0x800
 13.3900 -#define PNG_HAVE_PNG_SIGNATURE    0x1000
 13.3901 -#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
 13.3902 -
 13.3903 -/* Flags for the transformations the PNG library does on the image data */
 13.3904 -#define PNG_BGR                0x0001
 13.3905 -#define PNG_INTERLACE          0x0002
 13.3906 -#define PNG_PACK               0x0004
 13.3907 -#define PNG_SHIFT              0x0008
 13.3908 -#define PNG_SWAP_BYTES         0x0010
 13.3909 -#define PNG_INVERT_MONO        0x0020
 13.3910 -#define PNG_DITHER             0x0040
 13.3911 -#define PNG_BACKGROUND         0x0080
 13.3912 -#define PNG_BACKGROUND_EXPAND  0x0100
 13.3913 -                          /*   0x0200 unused */
 13.3914 -#define PNG_16_TO_8            0x0400
 13.3915 -#define PNG_RGBA               0x0800
 13.3916 -#define PNG_EXPAND             0x1000
 13.3917 -#define PNG_GAMMA              0x2000
 13.3918 -#define PNG_GRAY_TO_RGB        0x4000
 13.3919 -#define PNG_FILLER             0x8000L
 13.3920 -#define PNG_PACKSWAP          0x10000L
 13.3921 -#define PNG_SWAP_ALPHA        0x20000L
 13.3922 -#define PNG_STRIP_ALPHA       0x40000L
 13.3923 -#define PNG_INVERT_ALPHA      0x80000L
 13.3924 -#define PNG_USER_TRANSFORM   0x100000L
 13.3925 -#define PNG_RGB_TO_GRAY_ERR  0x200000L
 13.3926 -#define PNG_RGB_TO_GRAY_WARN 0x400000L
 13.3927 -#define PNG_RGB_TO_GRAY      0x600000L  /* two bits, RGB_TO_GRAY_ERR|WARN */
 13.3928 -                       /*    0x800000L     Unused */
 13.3929 -#define PNG_ADD_ALPHA       0x1000000L  /* Added to libpng-1.2.7 */
 13.3930 -#define PNG_EXPAND_tRNS     0x2000000L  /* Added to libpng-1.2.9 */
 13.3931 -                       /*   0x4000000L  unused */
 13.3932 -                       /*   0x8000000L  unused */
 13.3933 -                       /*  0x10000000L  unused */
 13.3934 -                       /*  0x20000000L  unused */
 13.3935 -                       /*  0x40000000L  unused */
 13.3936 -
 13.3937 -/* Flags for png_create_struct */
 13.3938 -#define PNG_STRUCT_PNG   0x0001
 13.3939 -#define PNG_STRUCT_INFO  0x0002
 13.3940 -
 13.3941 -/* Scaling factor for filter heuristic weighting calculations */
 13.3942 -#define PNG_WEIGHT_SHIFT 8
 13.3943 -#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT))
 13.3944 -#define PNG_COST_SHIFT 3
 13.3945 -#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))
 13.3946 -
 13.3947 -/* Flags for the png_ptr->flags rather than declaring a byte for each one */
 13.3948 -#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY     0x0001
 13.3949 -#define PNG_FLAG_ZLIB_CUSTOM_LEVEL        0x0002
 13.3950 -#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL    0x0004
 13.3951 -#define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS  0x0008
 13.3952 -#define PNG_FLAG_ZLIB_CUSTOM_METHOD       0x0010
 13.3953 -#define PNG_FLAG_ZLIB_FINISHED            0x0020
 13.3954 -#define PNG_FLAG_ROW_INIT                 0x0040
 13.3955 -#define PNG_FLAG_FILLER_AFTER             0x0080
 13.3956 -#define PNG_FLAG_CRC_ANCILLARY_USE        0x0100
 13.3957 -#define PNG_FLAG_CRC_ANCILLARY_NOWARN     0x0200
 13.3958 -#define PNG_FLAG_CRC_CRITICAL_USE         0x0400
 13.3959 -#define PNG_FLAG_CRC_CRITICAL_IGNORE      0x0800
 13.3960 -#define PNG_FLAG_FREE_PLTE                0x1000
 13.3961 -#define PNG_FLAG_FREE_TRNS                0x2000
 13.3962 -#define PNG_FLAG_FREE_HIST                0x4000
 13.3963 -#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS      0x8000L
 13.3964 -#define PNG_FLAG_KEEP_UNSAFE_CHUNKS       0x10000L
 13.3965 -#define PNG_FLAG_LIBRARY_MISMATCH         0x20000L
 13.3966 -#define PNG_FLAG_STRIP_ERROR_NUMBERS      0x40000L
 13.3967 -#define PNG_FLAG_STRIP_ERROR_TEXT         0x80000L
 13.3968 -#define PNG_FLAG_MALLOC_NULL_MEM_OK       0x100000L
 13.3969 -#define PNG_FLAG_ADD_ALPHA                0x200000L  /* Added to libpng-1.2.8 */
 13.3970 -#define PNG_FLAG_STRIP_ALPHA              0x400000L  /* Added to libpng-1.2.8 */
 13.3971 -                                  /*      0x800000L  unused */
 13.3972 -                                  /*     0x1000000L  unused */
 13.3973 -                                  /*     0x2000000L  unused */
 13.3974 -                                  /*     0x4000000L  unused */
 13.3975 -                                  /*     0x8000000L  unused */
 13.3976 -                                  /*    0x10000000L  unused */
 13.3977 -                                  /*    0x20000000L  unused */
 13.3978 -                                  /*    0x40000000L  unused */
 13.3979 -
 13.3980 -#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
 13.3981 -                                     PNG_FLAG_CRC_ANCILLARY_NOWARN)
 13.3982 -
 13.3983 -#define PNG_FLAG_CRC_CRITICAL_MASK  (PNG_FLAG_CRC_CRITICAL_USE | \
 13.3984 -                                     PNG_FLAG_CRC_CRITICAL_IGNORE)
 13.3985 -
 13.3986 -#define PNG_FLAG_CRC_MASK           (PNG_FLAG_CRC_ANCILLARY_MASK | \
 13.3987 -                                     PNG_FLAG_CRC_CRITICAL_MASK)
 13.3988 -
 13.3989 -/* Save typing and make code easier to understand */
 13.3990 -
 13.3991 -#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
 13.3992 -   abs((int)((c1).green) - (int)((c2).green)) + \
 13.3993 -   abs((int)((c1).blue) - (int)((c2).blue)))
 13.3994 -
 13.3995 -/* Added to libpng-1.2.6 JB */
 13.3996 -#define PNG_ROWBYTES(pixel_bits, width) \
 13.3997 -    ((pixel_bits) >= 8 ? \
 13.3998 -    ((width) * (((png_uint_32)(pixel_bits)) >> 3)) : \
 13.3999 -    (( ((width) * ((png_uint_32)(pixel_bits))) + 7) >> 3) )
 13.4000 -
 13.4001 -/* PNG_OUT_OF_RANGE returns true if value is outside the range
 13.4002 - * ideal-delta..ideal+delta.  Each argument is evaluated twice.
 13.4003 - * "ideal" and "delta" should be constants, normally simple
 13.4004 - * integers, "value" a variable. Added to libpng-1.2.6 JB
 13.4005 - */
 13.4006 -#define PNG_OUT_OF_RANGE(value, ideal, delta) \
 13.4007 -        ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
 13.4008 -
 13.4009 -/* Variables declared in png.c - only it needs to define PNG_NO_EXTERN */
 13.4010 -#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
 13.4011 -/* Place to hold the signature string for a PNG file. */
 13.4012 -#ifdef PNG_USE_GLOBAL_ARRAYS
 13.4013 -   PNG_EXPORT_VAR (PNG_CONST png_byte FARDATA) png_sig[8];
 13.4014 -#else
 13.4015 +#ifdef PNG_EXPORT_LAST_ORDINAL
 13.4016 +  PNG_EXPORT_LAST_ORDINAL(233);
 13.4017  #endif
 13.4018 -#endif /* PNG_NO_EXTERN */
 13.4019 -
 13.4020 -/* Constant strings for known chunk types.  If you need to add a chunk,
 13.4021 - * define the name here, and add an invocation of the macro in png.c and
 13.4022 - * wherever it's needed.
 13.4023 - */
 13.4024 -#define PNG_IHDR png_byte png_IHDR[5] = { 73,  72,  68,  82, '\0'}
 13.4025 -#define PNG_IDAT png_byte png_IDAT[5] = { 73,  68,  65,  84, '\0'}
 13.4026 -#define PNG_IEND png_byte png_IEND[5] = { 73,  69,  78,  68, '\0'}
 13.4027 -#define PNG_PLTE png_byte png_PLTE[5] = { 80,  76,  84,  69, '\0'}
 13.4028 -#define PNG_bKGD png_byte png_bKGD[5] = { 98,  75,  71,  68, '\0'}
 13.4029 -#define PNG_cHRM png_byte png_cHRM[5] = { 99,  72,  82,  77, '\0'}
 13.4030 -#define PNG_gAMA png_byte png_gAMA[5] = {103,  65,  77,  65, '\0'}
 13.4031 -#define PNG_hIST png_byte png_hIST[5] = {104,  73,  83,  84, '\0'}
 13.4032 -#define PNG_iCCP png_byte png_iCCP[5] = {105,  67,  67,  80, '\0'}
 13.4033 -#define PNG_iTXt png_byte png_iTXt[5] = {105,  84,  88, 116, '\0'}
 13.4034 -#define PNG_oFFs png_byte png_oFFs[5] = {111,  70,  70, 115, '\0'}
 13.4035 -#define PNG_pCAL png_byte png_pCAL[5] = {112,  67,  65,  76, '\0'}
 13.4036 -#define PNG_sCAL png_byte png_sCAL[5] = {115,  67,  65,  76, '\0'}
 13.4037 -#define PNG_pHYs png_byte png_pHYs[5] = {112,  72,  89, 115, '\0'}
 13.4038 -#define PNG_sBIT png_byte png_sBIT[5] = {115,  66,  73,  84, '\0'}
 13.4039 -#define PNG_sPLT png_byte png_sPLT[5] = {115,  80,  76,  84, '\0'}
 13.4040 -#define PNG_sRGB png_byte png_sRGB[5] = {115,  82,  71,  66, '\0'}
 13.4041 -#define PNG_tEXt png_byte png_tEXt[5] = {116,  69,  88, 116, '\0'}
 13.4042 -#define PNG_tIME png_byte png_tIME[5] = {116,  73,  77,  69, '\0'}
 13.4043 -#define PNG_tRNS png_byte png_tRNS[5] = {116,  82,  78,  83, '\0'}
 13.4044 -#define PNG_zTXt png_byte png_zTXt[5] = {122,  84,  88, 116, '\0'}
 13.4045 -
 13.4046 -#ifdef PNG_USE_GLOBAL_ARRAYS
 13.4047 -PNG_EXPORT_VAR (png_byte FARDATA) png_IHDR[5];
 13.4048 -PNG_EXPORT_VAR (png_byte FARDATA) png_IDAT[5];
 13.4049 -PNG_EXPORT_VAR (png_byte FARDATA) png_IEND[5];
 13.4050 -PNG_EXPORT_VAR (png_byte FARDATA) png_PLTE[5];
 13.4051 -PNG_EXPORT_VAR (png_byte FARDATA) png_bKGD[5];
 13.4052 -PNG_EXPORT_VAR (png_byte FARDATA) png_cHRM[5];
 13.4053 -PNG_EXPORT_VAR (png_byte FARDATA) png_gAMA[5];
 13.4054 -PNG_EXPORT_VAR (png_byte FARDATA) png_hIST[5];
 13.4055 -PNG_EXPORT_VAR (png_byte FARDATA) png_iCCP[5];
 13.4056 -PNG_EXPORT_VAR (png_byte FARDATA) png_iTXt[5];
 13.4057 -PNG_EXPORT_VAR (png_byte FARDATA) png_oFFs[5];
 13.4058 -PNG_EXPORT_VAR (png_byte FARDATA) png_pCAL[5];
 13.4059 -PNG_EXPORT_VAR (png_byte FARDATA) png_sCAL[5];
 13.4060 -PNG_EXPORT_VAR (png_byte FARDATA) png_pHYs[5];
 13.4061 -PNG_EXPORT_VAR (png_byte FARDATA) png_sBIT[5];
 13.4062 -PNG_EXPORT_VAR (png_byte FARDATA) png_sPLT[5];
 13.4063 -PNG_EXPORT_VAR (png_byte FARDATA) png_sRGB[5];
 13.4064 -PNG_EXPORT_VAR (png_byte FARDATA) png_tEXt[5];
 13.4065 -PNG_EXPORT_VAR (png_byte FARDATA) png_tIME[5];
 13.4066 -PNG_EXPORT_VAR (png_byte FARDATA) png_tRNS[5];
 13.4067 -PNG_EXPORT_VAR (png_byte FARDATA) png_zTXt[5];
 13.4068 -#endif /* PNG_USE_GLOBAL_ARRAYS */
 13.4069 -
 13.4070 -#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
 13.4071 -/* Initialize png_ptr struct for reading, and allocate any other memory.
 13.4072 - * (old interface - DEPRECATED - use png_create_read_struct instead).
 13.4073 - */
 13.4074 -extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr));
 13.4075 -#undef png_read_init
 13.4076 -#define png_read_init(png_ptr) png_read_init_3(&png_ptr, \
 13.4077 -    PNG_LIBPNG_VER_STRING,  png_sizeof(png_struct));
 13.4078 -#endif
 13.4079 -
 13.4080 -extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr,
 13.4081 -    png_const_charp user_png_ver, png_size_t png_struct_size));
 13.4082 -#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
 13.4083 -extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr,
 13.4084 -    png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
 13.4085 -    png_info_size));
 13.4086 -#endif
 13.4087 -
 13.4088 -#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
 13.4089 -/* Initialize png_ptr struct for writing, and allocate any other memory.
 13.4090 - * (old interface - DEPRECATED - use png_create_write_struct instead).
 13.4091 - */
 13.4092 -extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr));
 13.4093 -#undef png_write_init
 13.4094 -#define png_write_init(png_ptr) png_write_init_3(&png_ptr, \
 13.4095 -    PNG_LIBPNG_VER_STRING, png_sizeof(png_struct));
 13.4096 -#endif
 13.4097 -
 13.4098 -extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr,
 13.4099 -    png_const_charp user_png_ver, png_size_t png_struct_size));
 13.4100 -extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr,
 13.4101 -    png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
 13.4102 -    png_info_size));
 13.4103 -
 13.4104 -/* Allocate memory for an internal libpng struct */
 13.4105 -PNG_EXTERN png_voidp png_create_struct PNGARG((int type));
 13.4106 -
 13.4107 -/* Free memory from internal libpng struct */
 13.4108 -PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));
 13.4109 -
 13.4110 -PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr
 13.4111 -  malloc_fn, png_voidp mem_ptr));
 13.4112 -PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
 13.4113 -   png_free_ptr free_fn, png_voidp mem_ptr));
 13.4114 -
 13.4115 -/* Free any memory that info_ptr points to and reset struct. */
 13.4116 -PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
 13.4117 -   png_infop info_ptr));
 13.4118 -
 13.4119 -#ifndef PNG_1_0_X
 13.4120 -/* Function to allocate memory for zlib. */
 13.4121 -PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
 13.4122 -
 13.4123 -/* Function to free memory for zlib */
 13.4124 -PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
 13.4125 -
 13.4126 -#ifdef PNG_SIZE_T
 13.4127 -/* Function to convert a sizeof an item to png_sizeof item */
 13.4128 -   PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size));
 13.4129 -#endif
 13.4130 -
 13.4131 -/* Next four functions are used internally as callbacks.  PNGAPI is required
 13.4132 - * but not PNG_EXPORT.  PNGAPI added at libpng version 1.2.3.
 13.4133 - */
 13.4134 -
 13.4135 -PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr,
 13.4136 -   png_bytep data, png_size_t length));
 13.4137 -
 13.4138 -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
 13.4139 -PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr,
 13.4140 -   png_bytep buffer, png_size_t length));
 13.4141 -#endif
 13.4142 -
 13.4143 -PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr,
 13.4144 -   png_bytep data, png_size_t length));
 13.4145 -
 13.4146 -#if defined(PNG_WRITE_FLUSH_SUPPORTED)
 13.4147 -#if !defined(PNG_NO_STDIO)
 13.4148 -PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr));
 13.4149 -#endif
 13.4150 -#endif
 13.4151 -#else /* PNG_1_0_X */
 13.4152 -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
 13.4153 -PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr,
 13.4154 -   png_bytep buffer, png_size_t length));
 13.4155 -#endif
 13.4156 -#endif /* PNG_1_0_X */
 13.4157 -
 13.4158 -/* Reset the CRC variable */
 13.4159 -PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));
 13.4160 -
 13.4161 -/* Write the "data" buffer to whatever output you are using. */
 13.4162 -PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data,
 13.4163 -   png_size_t length));
 13.4164 -
 13.4165 -/* Read data from whatever input you are using into the "data" buffer */
 13.4166 -PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
 13.4167 -   png_size_t length));
 13.4168 -
 13.4169 -/* Read bytes into buf, and update png_ptr->crc */
 13.4170 -PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
 13.4171 -   png_size_t length));
 13.4172 -
 13.4173 -/* Decompress data in a chunk that uses compression */
 13.4174 -#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \
 13.4175 -    defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
 13.4176 -PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr,
 13.4177 -   int comp_type, png_size_t chunklength,
 13.4178 -   png_size_t prefix_length, png_size_t *data_length));
 13.4179 -#endif
 13.4180 -
 13.4181 -/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
 13.4182 -PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip));
 13.4183 -
 13.4184 -/* Read the CRC from the file and compare it to the libpng calculated CRC */
 13.4185 -PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr));
 13.4186 -
 13.4187 -/* Calculate the CRC over a section of data.  Note that we are only
 13.4188 - * passing a maximum of 64K on systems that have this as a memory limit,
 13.4189 - * since this is the maximum buffer size we can specify.
 13.4190 - */
 13.4191 -PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
 13.4192 -   png_size_t length));
 13.4193 -
 13.4194 -#if defined(PNG_WRITE_FLUSH_SUPPORTED)
 13.4195 -PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
 13.4196 -#endif
 13.4197 -
 13.4198 -/* Simple function to write the signature */
 13.4199 -PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr));
 13.4200 -
 13.4201 -/* Write various chunks */
 13.4202 -
 13.4203 -/* Write the IHDR chunk, and update the png_struct with the necessary
 13.4204 - * information.
 13.4205 - */
 13.4206 -PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
 13.4207 -   png_uint_32 height,
 13.4208 -   int bit_depth, int color_type, int compression_method, int filter_method,
 13.4209 -   int interlace_method));
 13.4210 -
 13.4211 -PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,
 13.4212 -   png_uint_32 num_pal));
 13.4213 -
 13.4214 -PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
 13.4215 -   png_size_t length));
 13.4216 -
 13.4217 -PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr));
 13.4218 -
 13.4219 -#if defined(PNG_WRITE_gAMA_SUPPORTED)
 13.4220 -#ifdef PNG_FLOATING_POINT_SUPPORTED
 13.4221 -PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma));
 13.4222 -#endif
 13.4223 -#ifdef PNG_FIXED_POINT_SUPPORTED
 13.4224 -PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, png_fixed_point
 13.4225 -    file_gamma));
 13.4226 -#endif
 13.4227 -#endif
 13.4228 -
 13.4229 -#if defined(PNG_WRITE_sBIT_SUPPORTED)
 13.4230 -PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
 13.4231 -   int color_type));
 13.4232 -#endif
 13.4233 -
 13.4234 -#if defined(PNG_WRITE_cHRM_SUPPORTED)
 13.4235 -#ifdef PNG_FLOATING_POINT_SUPPORTED
 13.4236 -PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr,
 13.4237 -   double white_x, double white_y,
 13.4238 -   double red_x, double red_y, double green_x, double green_y,
 13.4239 -   double blue_x, double blue_y));
 13.4240 -#endif
 13.4241 -#ifdef PNG_FIXED_POINT_SUPPORTED
 13.4242 -PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr,
 13.4243 -   png_fixed_point int_white_x, png_fixed_point int_white_y,
 13.4244 -   png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
 13.4245 -   int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
 13.4246 -   png_fixed_point int_blue_y));
 13.4247 -#endif
 13.4248 -#endif
 13.4249 -
 13.4250 -#if defined(PNG_WRITE_sRGB_SUPPORTED)
 13.4251 -PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,
 13.4252 -   int intent));
 13.4253 -#endif
 13.4254 -
 13.4255 -#if defined(PNG_WRITE_iCCP_SUPPORTED)
 13.4256 -PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,
 13.4257 -   png_charp name, int compression_type,
 13.4258 -   png_charp profile, int proflen));
 13.4259 -   /* Note to maintainer: profile should be png_bytep */
 13.4260 -#endif
 13.4261 -
 13.4262 -#if defined(PNG_WRITE_sPLT_SUPPORTED)
 13.4263 -PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr,
 13.4264 -   png_sPLT_tp palette));
 13.4265 -#endif
 13.4266 -
 13.4267 -#if defined(PNG_WRITE_tRNS_SUPPORTED)
 13.4268 -PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,
 13.4269 -   png_color_16p values, int number, int color_type));
 13.4270 -#endif
 13.4271 -
 13.4272 -#if defined(PNG_WRITE_bKGD_SUPPORTED)
 13.4273 -PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr,
 13.4274 -   png_color_16p values, int color_type));
 13.4275 -#endif
 13.4276 -
 13.4277 -#if defined(PNG_WRITE_hIST_SUPPORTED)
 13.4278 -PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,
 13.4279 -   int num_hist));
 13.4280 -#endif
 13.4281 -
 13.4282 -#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
 13.4283 -    defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
 13.4284 -PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,
 13.4285 -   png_charp key, png_charpp new_key));
 13.4286 -#endif
 13.4287 -
 13.4288 -#if defined(PNG_WRITE_tEXt_SUPPORTED)
 13.4289 -PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,
 13.4290 -   png_charp text, png_size_t text_len));
 13.4291 -#endif
 13.4292 -
 13.4293 -#if defined(PNG_WRITE_zTXt_SUPPORTED)
 13.4294 -PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,
 13.4295 -   png_charp text, png_size_t text_len, int compression));
 13.4296 -#endif
 13.4297 -
 13.4298 -#if defined(PNG_WRITE_iTXt_SUPPORTED)
 13.4299 -PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr,
 13.4300 -   int compression, png_charp key, png_charp lang, png_charp lang_key,
 13.4301 -   png_charp text));
 13.4302 -#endif
 13.4303 -
 13.4304 -#if defined(PNG_TEXT_SUPPORTED)  /* Added at version 1.0.14 and 1.2.4 */
 13.4305 -PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr,
 13.4306 -   png_infop info_ptr, png_textp text_ptr, int num_text));
 13.4307 -#endif
 13.4308 -
 13.4309 -#if defined(PNG_WRITE_oFFs_SUPPORTED)
 13.4310 -PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
 13.4311 -   png_int_32 x_offset, png_int_32 y_offset, int unit_type));
 13.4312 -#endif
 13.4313 -
 13.4314 -#if defined(PNG_WRITE_pCAL_SUPPORTED)
 13.4315 -PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose,
 13.4316 -   png_int_32 X0, png_int_32 X1, int type, int nparams,
 13.4317 -   png_charp units, png_charpp params));
 13.4318 -#endif
 13.4319 -
 13.4320 -#if defined(PNG_WRITE_pHYs_SUPPORTED)
 13.4321 -PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr,
 13.4322 -   png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
 13.4323 -   int unit_type));
 13.4324 -#endif
 13.4325 -
 13.4326 -#if defined(PNG_WRITE_tIME_SUPPORTED)
 13.4327 -PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
 13.4328 -   png_timep mod_time));
 13.4329 -#endif
 13.4330 -
 13.4331 -#if defined(PNG_WRITE_sCAL_SUPPORTED)
 13.4332 -#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
 13.4333 -PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,
 13.4334 -   int unit, double width, double height));
 13.4335 -#else
 13.4336 -#ifdef PNG_FIXED_POINT_SUPPORTED
 13.4337 -PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr,
 13.4338 -   int unit, png_charp width, png_charp height));
 13.4339 -#endif
 13.4340 -#endif
 13.4341 -#endif
 13.4342 -
 13.4343 -/* Called when finished processing a row of data */
 13.4344 -PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr));
 13.4345 -
 13.4346 -/* Internal use only.   Called before first row of data */
 13.4347 -PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));
 13.4348 -
 13.4349 -#if defined(PNG_READ_GAMMA_SUPPORTED)
 13.4350 -PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr));
 13.4351 -#endif
 13.4352 -
 13.4353 -/* Combine a row of data, dealing with alpha, etc. if requested */
 13.4354 -PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
 13.4355 -   int mask));
 13.4356 -
 13.4357 -#if defined(PNG_READ_INTERLACING_SUPPORTED)
 13.4358 -/* Expand an interlaced row */
 13.4359 -/* OLD pre-1.0.9 interface:
 13.4360 -PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
 13.4361 -   png_bytep row, int pass, png_uint_32 transformations));
 13.4362 - */
 13.4363 -PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));
 13.4364 -#endif
 13.4365 -
 13.4366 -/* GRR TO DO (2.0 or whenever):  simplify other internal calling interfaces */
 13.4367 -
 13.4368 -#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
 13.4369 -/* Grab pixels out of a row for an interlaced pass */
 13.4370 -PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
 13.4371 -   png_bytep row, int pass));
 13.4372 -#endif
 13.4373 -
 13.4374 -/* Unfilter a row */
 13.4375 -PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr,
 13.4376 -   png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter));
 13.4377 -
 13.4378 -/* Choose the best filter to use and filter the row data */
 13.4379 -PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr,
 13.4380 -   png_row_infop row_info));
 13.4381 -
 13.4382 -/* Write out the filtered row. */
 13.4383 -PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr,
 13.4384 -   png_bytep filtered_row));
 13.4385 -/* Finish a row while reading, dealing with interlacing passes, etc. */
 13.4386 -PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr));
 13.4387 -
 13.4388 -/* Initialize the row buffers, etc. */
 13.4389 -PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr));
 13.4390 -/* Optional call to update the users info structure */
 13.4391 -PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,
 13.4392 -   png_infop info_ptr));
 13.4393 -
 13.4394 -/* These are the functions that do the transformations */
 13.4395 -#if defined(PNG_READ_FILLER_SUPPORTED)
 13.4396 -PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,
 13.4397 -   png_bytep row, png_uint_32 filler, png_uint_32 flags));
 13.4398 -#endif
 13.4399 -
 13.4400 -#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
 13.4401 -PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info,
 13.4402 -   png_bytep row));
 13.4403 -#endif
 13.4404 -
 13.4405 -#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
 13.4406 -PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info,
 13.4407 -   png_bytep row));
 13.4408 -#endif
 13.4409 -
 13.4410 -#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
 13.4411 -PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info,
 13.4412 -   png_bytep row));
 13.4413 -#endif
 13.4414 -
 13.4415 -#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
 13.4416 -PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info,
 13.4417 -   png_bytep row));
 13.4418 -#endif
 13.4419 -
 13.4420 -#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
 13.4421 -    defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
 13.4422 -PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info,
 13.4423 -   png_bytep row, png_uint_32 flags));
 13.4424 -#endif
 13.4425 -
 13.4426 -#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
 13.4427 -PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));
 13.4428 -#endif
 13.4429 -
 13.4430 -#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)
 13.4431 -PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row));
 13.4432 -#endif
 13.4433 -
 13.4434 -#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
 13.4435 -PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop
 13.4436 -   row_info, png_bytep row));
 13.4437 -#endif
 13.4438 -
 13.4439 -#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
 13.4440 -PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,
 13.4441 -   png_bytep row));
 13.4442 -#endif
 13.4443 -
 13.4444 -#if defined(PNG_READ_PACK_SUPPORTED)
 13.4445 -PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));
 13.4446 -#endif
 13.4447 -
 13.4448 -#if defined(PNG_READ_SHIFT_SUPPORTED)
 13.4449 -PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row,
 13.4450 -   png_color_8p sig_bits));
 13.4451 -#endif
 13.4452 -
 13.4453 -#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
 13.4454 -PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));
 13.4455 -#endif
 13.4456 -
 13.4457 -#if defined(PNG_READ_16_TO_8_SUPPORTED)
 13.4458 -PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));
 13.4459 -#endif
 13.4460 -
 13.4461 -#if defined(PNG_READ_DITHER_SUPPORTED)
 13.4462 -PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info,
 13.4463 -   png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup));
 13.4464 -
 13.4465 -#  if defined(PNG_CORRECT_PALETTE_SUPPORTED)
 13.4466 -PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,
 13.4467 -   png_colorp palette, int num_palette));
 13.4468 -#  endif
 13.4469 -#endif
 13.4470 -
 13.4471 -#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
 13.4472 -PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row));
 13.4473 -#endif
 13.4474 -
 13.4475 -#if defined(PNG_WRITE_PACK_SUPPORTED)
 13.4476 -PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info,
 13.4477 -   png_bytep row, png_uint_32 bit_depth));
 13.4478 -#endif
 13.4479 -
 13.4480 -#if defined(PNG_WRITE_SHIFT_SUPPORTED)
 13.4481 -PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,
 13.4482 -   png_color_8p bit_depth));
 13.4483 -#endif
 13.4484 -
 13.4485 -#if defined(PNG_READ_BACKGROUND_SUPPORTED)
 13.4486 -#if defined(PNG_READ_GAMMA_SUPPORTED)
 13.4487 -PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
 13.4488 -   png_color_16p trans_values, png_color_16p background,
 13.4489 -   png_color_16p background_1,
 13.4490 -   png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
 13.4491 -   png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
 13.4492 -   png_uint_16pp gamma_16_to_1, int gamma_shift));
 13.4493 -#else
 13.4494 -PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
 13.4495 -   png_color_16p trans_values, png_color_16p background));
 13.4496 -#endif
 13.4497 -#endif
 13.4498 -
 13.4499 -#if defined(PNG_READ_GAMMA_SUPPORTED)
 13.4500 -PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row,
 13.4501 -   png_bytep gamma_table, png_uint_16pp gamma_16_table,
 13.4502 -   int gamma_shift));
 13.4503 -#endif
 13.4504 -
 13.4505 -#if defined(PNG_READ_EXPAND_SUPPORTED)
 13.4506 -PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info,
 13.4507 -   png_bytep row, png_colorp palette, png_bytep trans, int num_trans));
 13.4508 -PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,
 13.4509 -   png_bytep row, png_color_16p trans_value));
 13.4510 -#endif
 13.4511 -
 13.4512 -/* The following decodes the appropriate chunks, and does error correction,
 13.4513 - * then calls the appropriate callback for the chunk if it is valid.
 13.4514 - */
 13.4515 -
 13.4516 -/* Decode the IHDR chunk */
 13.4517 -PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4518 -   png_uint_32 length));
 13.4519 -PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4520 -   png_uint_32 length));
 13.4521 -PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4522 -   png_uint_32 length));
 13.4523 -
 13.4524 -#if defined(PNG_READ_bKGD_SUPPORTED)
 13.4525 -PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4526 -   png_uint_32 length));
 13.4527 -#endif
 13.4528 -
 13.4529 -#if defined(PNG_READ_cHRM_SUPPORTED)
 13.4530 -PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4531 -   png_uint_32 length));
 13.4532 -#endif
 13.4533 -
 13.4534 -#if defined(PNG_READ_gAMA_SUPPORTED)
 13.4535 -PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4536 -   png_uint_32 length));
 13.4537 -#endif
 13.4538 -
 13.4539 -#if defined(PNG_READ_hIST_SUPPORTED)
 13.4540 -PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4541 -   png_uint_32 length));
 13.4542 -#endif
 13.4543 -
 13.4544 -#if defined(PNG_READ_iCCP_SUPPORTED)
 13.4545 -extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4546 -   png_uint_32 length));
 13.4547 -#endif /* PNG_READ_iCCP_SUPPORTED */
 13.4548 -
 13.4549 -#if defined(PNG_READ_iTXt_SUPPORTED)
 13.4550 -PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4551 -   png_uint_32 length));
 13.4552 -#endif
 13.4553 -
 13.4554 -#if defined(PNG_READ_oFFs_SUPPORTED)
 13.4555 -PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4556 -   png_uint_32 length));
 13.4557 -#endif
 13.4558 -
 13.4559 -#if defined(PNG_READ_pCAL_SUPPORTED)
 13.4560 -PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4561 -   png_uint_32 length));
 13.4562 -#endif
 13.4563 -
 13.4564 -#if defined(PNG_READ_pHYs_SUPPORTED)
 13.4565 -PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4566 -   png_uint_32 length));
 13.4567 -#endif
 13.4568 -
 13.4569 -#if defined(PNG_READ_sBIT_SUPPORTED)
 13.4570 -PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4571 -   png_uint_32 length));
 13.4572 -#endif
 13.4573 -
 13.4574 -#if defined(PNG_READ_sCAL_SUPPORTED)
 13.4575 -PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4576 -   png_uint_32 length));
 13.4577 -#endif
 13.4578 -
 13.4579 -#if defined(PNG_READ_sPLT_SUPPORTED)
 13.4580 -extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4581 -   png_uint_32 length));
 13.4582 -#endif /* PNG_READ_sPLT_SUPPORTED */
 13.4583 -
 13.4584 -#if defined(PNG_READ_sRGB_SUPPORTED)
 13.4585 -PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4586 -   png_uint_32 length));
 13.4587 -#endif
 13.4588 -
 13.4589 -#if defined(PNG_READ_tEXt_SUPPORTED)
 13.4590 -PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4591 -   png_uint_32 length));
 13.4592 -#endif
 13.4593 -
 13.4594 -#if defined(PNG_READ_tIME_SUPPORTED)
 13.4595 -PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4596 -   png_uint_32 length));
 13.4597 -#endif
 13.4598 -
 13.4599 -#if defined(PNG_READ_tRNS_SUPPORTED)
 13.4600 -PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4601 -   png_uint_32 length));
 13.4602 -#endif
 13.4603 -
 13.4604 -#if defined(PNG_READ_zTXt_SUPPORTED)
 13.4605 -PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
 13.4606 -   png_uint_32 length));
 13.4607 -#endif
 13.4608 -
 13.4609 -PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
 13.4610 -   png_infop info_ptr, png_uint_32 length));
 13.4611 -
 13.4612 -PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,
 13.4613 -   png_bytep chunk_name));
 13.4614 -
 13.4615 -/* Handle the transformations for reading and writing */
 13.4616 -PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));
 13.4617 -PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr));
 13.4618 -
 13.4619 -PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr));
 13.4620 -
 13.4621 -#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
 13.4622 -PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr,
 13.4623 -   png_infop info_ptr));
 13.4624 -PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr,
 13.4625 -   png_infop info_ptr));
 13.4626 -PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr));
 13.4627 -PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr,
 13.4628 -   png_uint_32 length));
 13.4629 -PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr));
 13.4630 -PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr));
 13.4631 -PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr,
 13.4632 -   png_bytep buffer, png_size_t buffer_length));
 13.4633 -PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr));
 13.4634 -PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr,
 13.4635 -   png_bytep buffer, png_size_t buffer_length));
 13.4636 -PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr));
 13.4637 -PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr,
 13.4638 -   png_infop info_ptr, png_uint_32 length));
 13.4639 -PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr,
 13.4640 -   png_infop info_ptr));
 13.4641 -PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr,
 13.4642 -   png_infop info_ptr));
 13.4643 -PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row));
 13.4644 -PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr,
 13.4645 -   png_infop info_ptr));
 13.4646 -PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr,
 13.4647 -   png_infop info_ptr));
 13.4648 -PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr));
 13.4649 -#if defined(PNG_READ_tEXt_SUPPORTED)
 13.4650 -PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr,
 13.4651 -   png_infop info_ptr, png_uint_32 length));
 13.4652 -PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr,
 13.4653 -   png_infop info_ptr));
 13.4654 -#endif
 13.4655 -#if defined(PNG_READ_zTXt_SUPPORTED)
 13.4656 -PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr,
 13.4657 -   png_infop info_ptr, png_uint_32 length));
 13.4658 -PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr,
 13.4659 -   png_infop info_ptr));
 13.4660 -#endif
 13.4661 -#if defined(PNG_READ_iTXt_SUPPORTED)
 13.4662 -PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr,
 13.4663 -   png_infop info_ptr, png_uint_32 length));
 13.4664 -PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr,
 13.4665 -   png_infop info_ptr));
 13.4666 -#endif
 13.4667 -
 13.4668 -#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
 13.4669 -
 13.4670 -#ifdef PNG_MNG_FEATURES_SUPPORTED
 13.4671 -PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,
 13.4672 -   png_bytep row));
 13.4673 -PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
 13.4674 -   png_bytep row));
 13.4675 -#endif
 13.4676 -
 13.4677 -#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
 13.4678 -#if defined(PNG_MMX_CODE_SUPPORTED)
 13.4679 -/* png.c */ /* PRIVATE */
 13.4680 -PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr));
 13.4681 -#endif
 13.4682 -#endif
 13.4683 -
 13.4684 -#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)
 13.4685 -PNG_EXTERN png_uint_32 png_get_pixels_per_inch PNGARG((png_structp png_ptr,
 13.4686 -png_infop info_ptr));
 13.4687 -
 13.4688 -PNG_EXTERN png_uint_32 png_get_x_pixels_per_inch PNGARG((png_structp png_ptr,
 13.4689 -png_infop info_ptr));
 13.4690 -
 13.4691 -PNG_EXTERN png_uint_32 png_get_y_pixels_per_inch PNGARG((png_structp png_ptr,
 13.4692 -png_infop info_ptr));
 13.4693 -
 13.4694 -PNG_EXTERN float png_get_x_offset_inches PNGARG((png_structp png_ptr,
 13.4695 -png_infop info_ptr));
 13.4696 -
 13.4697 -PNG_EXTERN float png_get_y_offset_inches PNGARG((png_structp png_ptr,
 13.4698 -png_infop info_ptr));
 13.4699 -
 13.4700 -#if defined(PNG_pHYs_SUPPORTED)
 13.4701 -PNG_EXTERN png_uint_32 png_get_pHYs_dpi PNGARG((png_structp png_ptr,
 13.4702 -png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
 13.4703 -#endif /* PNG_pHYs_SUPPORTED */
 13.4704 -#endif  /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
 13.4705 -
 13.4706 -/* Read the chunk header (length + type name) */
 13.4707 -PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr));
 13.4708 -
 13.4709 -/* Added at libpng version 1.2.34 */
 13.4710 -#if defined(PNG_cHRM_SUPPORTED)
 13.4711 -PNG_EXTERN int png_check_cHRM_fixed  PNGARG((png_structp png_ptr,
 13.4712 -   png_fixed_point int_white_x, png_fixed_point int_white_y,
 13.4713 -   png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
 13.4714 -   int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
 13.4715 -   png_fixed_point int_blue_y));
 13.4716 -#endif
 13.4717 -
 13.4718 -#if defined(PNG_cHRM_SUPPORTED)
 13.4719 -#if !defined(PNG_NO_CHECK_cHRM)
 13.4720 -/* Added at libpng version 1.2.34 */
 13.4721 -PNG_EXTERN void png_64bit_product (long v1, long v2, unsigned long *hi_product,
 13.4722 -   unsigned long *lo_product);
 13.4723 -#endif
 13.4724 -#endif
 13.4725 -
 13.4726 -/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
 13.4727 -
 13.4728 -#endif /* PNG_INTERNAL */
 13.4729  
 13.4730  #ifdef __cplusplus
 13.4731  }
    14.1 --- a/VisualC/graphics/include/pngconf.h	Mon Jan 02 15:48:33 2012 -0500
    14.2 +++ b/VisualC/graphics/include/pngconf.h	Mon Jan 02 17:19:13 2012 -0500
    14.3 @@ -1,14 +1,16 @@
    14.4  
    14.5  /* pngconf.h - machine configurable file for libpng
    14.6   *
    14.7 - * libpng version 1.2.40 - September 10, 2009
    14.8 - * Copyright (c) 1998-2009 Glenn Randers-Pehrson
    14.9 + * libpng version 1.5.7 - December 15, 2011
   14.10 + *
   14.11 + * Copyright (c) 1998-2011 Glenn Randers-Pehrson
   14.12   * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
   14.13   * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
   14.14   *
   14.15   * This code is released under the libpng license.
   14.16   * For conditions of distribution and use, see the disclaimer
   14.17   * and license in png.h
   14.18 + *
   14.19   */
   14.20  
   14.21  /* Any machine specific code is near the front of this file, so if you
   14.22 @@ -20,254 +22,57 @@
   14.23  #ifndef PNGCONF_H
   14.24  #define PNGCONF_H
   14.25  
   14.26 -#define PNG_1_2_X
   14.27 +#ifndef PNG_BUILDING_SYMBOL_TABLE
   14.28 +/* PNG_NO_LIMITS_H may be used to turn off the use of the standard C
   14.29 + * definition file for  machine specific limits, this may impact the
   14.30 + * correctness of the definitons below (see uses of INT_MAX).
   14.31 + */
   14.32 +#  ifndef PNG_NO_LIMITS_H
   14.33 +#    include <limits.h>
   14.34 +#  endif
   14.35  
   14.36 -/*
   14.37 - * PNG_USER_CONFIG has to be defined on the compiler command line. This
   14.38 - * includes the resource compiler for Windows DLL configurations.
   14.39 +/* For the memory copy APIs (i.e. the standard definitions of these),
   14.40 + * because this file defines png_memcpy and so on the base APIs must
   14.41 + * be defined here.
   14.42   */
   14.43 -#ifdef PNG_USER_CONFIG
   14.44 -#  ifndef PNG_USER_PRIVATEBUILD
   14.45 -#    define PNG_USER_PRIVATEBUILD
   14.46 +#  ifdef BSD
   14.47 +#    include <strings.h>
   14.48 +#  else
   14.49 +#    include <string.h>
   14.50  #  endif
   14.51 -#include "pngusr.h"
   14.52 -#endif
   14.53  
   14.54 -/* PNG_CONFIGURE_LIBPNG is set by the "configure" script. */
   14.55 -#ifdef PNG_CONFIGURE_LIBPNG
   14.56 -#ifdef HAVE_CONFIG_H
   14.57 -#include "config.h"
   14.58 -#endif
   14.59 -#endif
   14.60 -
   14.61 -/*
   14.62 - * Added at libpng-1.2.8
   14.63 - *
   14.64 - * If you create a private DLL you need to define in "pngusr.h" the followings:
   14.65 - * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
   14.66 - *        the DLL was built>
   14.67 - *  e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons."
   14.68 - * #define PNG_USER_DLLFNAME_POSTFIX <two-letter postfix that serve to
   14.69 - *        distinguish your DLL from those of the official release. These
   14.70 - *        correspond to the trailing letters that come after the version
   14.71 - *        number and must match your private DLL name>
   14.72 - *  e.g. // private DLL "libpng13gx.dll"
   14.73 - *       #define PNG_USER_DLLFNAME_POSTFIX "gx"
   14.74 - *
   14.75 - * The following macros are also at your disposal if you want to complete the
   14.76 - * DLL VERSIONINFO structure.
   14.77 - * - PNG_USER_VERSIONINFO_COMMENTS
   14.78 - * - PNG_USER_VERSIONINFO_COMPANYNAME
   14.79 - * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS
   14.80 +/* For png_FILE_p - this provides the standard definition of a
   14.81 + * FILE
   14.82   */
   14.83 -
   14.84 -#ifdef __STDC__
   14.85 -#ifdef SPECIALBUILD
   14.86 -#  pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\
   14.87 - are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.")
   14.88 -#endif
   14.89 -
   14.90 -#ifdef PRIVATEBUILD
   14.91 -# pragma message("PRIVATEBUILD is deprecated.\
   14.92 - Use PNG_USER_PRIVATEBUILD instead.")
   14.93 -# define PNG_USER_PRIVATEBUILD PRIVATEBUILD
   14.94 -#endif
   14.95 -#endif /* __STDC__ */
   14.96 -
   14.97 -#ifndef PNG_VERSION_INFO_ONLY
   14.98 -
   14.99 -/* End of material added to libpng-1.2.8 */
  14.100 -
  14.101 -/* Added at libpng-1.2.19, removed at libpng-1.2.20 because it caused trouble
  14.102 -   Restored at libpng-1.2.21 */
  14.103 -#if !defined(PNG_NO_WARN_UNINITIALIZED_ROW) && \
  14.104 -    !defined(PNG_WARN_UNINITIALIZED_ROW)
  14.105 -#  define PNG_WARN_UNINITIALIZED_ROW 1
  14.106 -#endif
  14.107 -/* End of material added at libpng-1.2.19/1.2.21 */
  14.108 -
  14.109 -/* This is the size of the compression buffer, and thus the size of
  14.110 - * an IDAT chunk.  Make this whatever size you feel is best for your
  14.111 - * machine.  One of these will be allocated per png_struct.  When this
  14.112 - * is full, it writes the data to the disk, and does some other
  14.113 - * calculations.  Making this an extremely small size will slow
  14.114 - * the library down, but you may want to experiment to determine
  14.115 - * where it becomes significant, if you are concerned with memory
  14.116 - * usage.  Note that zlib allocates at least 32Kb also.  For readers,
  14.117 - * this describes the size of the buffer available to read the data in.
  14.118 - * Unless this gets smaller than the size of a row (compressed),
  14.119 - * it should not make much difference how big this is.
  14.120 - */
  14.121 -
  14.122 -#ifndef PNG_ZBUF_SIZE
  14.123 -#  define PNG_ZBUF_SIZE 8192
  14.124 -#endif
  14.125 -
  14.126 -/* Enable if you want a write-only libpng */
  14.127 -
  14.128 -#ifndef PNG_NO_READ_SUPPORTED
  14.129 -#  define PNG_READ_SUPPORTED
  14.130 -#endif
  14.131 -
  14.132 -/* Enable if you want a read-only libpng */
  14.133 -
  14.134 -#ifndef PNG_NO_WRITE_SUPPORTED
  14.135 -#  define PNG_WRITE_SUPPORTED
  14.136 -#endif
  14.137 -
  14.138 -/* Enabled by default in 1.2.0.  You can disable this if you don't need to
  14.139 -   support PNGs that are embedded in MNG datastreams */
  14.140 -#if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES)
  14.141 -#  ifndef PNG_MNG_FEATURES_SUPPORTED
  14.142 -#    define PNG_MNG_FEATURES_SUPPORTED
  14.143 +#  ifdef PNG_STDIO_SUPPORTED
  14.144 +#    include <stdio.h>
  14.145  #  endif
  14.146  #endif
  14.147  
  14.148 -#ifndef PNG_NO_FLOATING_POINT_SUPPORTED
  14.149 -#  ifndef PNG_FLOATING_POINT_SUPPORTED
  14.150 -#    define PNG_FLOATING_POINT_SUPPORTED
  14.151 +/* This controls optimization of the reading of 16 and 32 bit values
  14.152 + * from PNG files.  It can be set on a per-app-file basis - it
  14.153 + * just changes whether a macro is used to the function is called.
  14.154 + * The library builder sets the default, if read functions are not
  14.155 + * built into the library the macro implementation is forced on.
  14.156 + */
  14.157 +#ifndef PNG_READ_INT_FUNCTIONS_SUPPORTED
  14.158 +#  define PNG_USE_READ_MACROS
  14.159 +#endif
  14.160 +#if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS)
  14.161 +#  if PNG_DEFAULT_READ_MACROS
  14.162 +#    define PNG_USE_READ_MACROS
  14.163  #  endif
  14.164  #endif
  14.165  
  14.166 -/* If you are running on a machine where you cannot allocate more
  14.167 - * than 64K of memory at once, uncomment this.  While libpng will not
  14.168 - * normally need that much memory in a chunk (unless you load up a very
  14.169 - * large file), zlib needs to know how big of a chunk it can use, and
  14.170 - * libpng thus makes sure to check any memory allocation to verify it
  14.171 - * will fit into memory.
  14.172 -#define PNG_MAX_MALLOC_64K
  14.173 - */
  14.174 -#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
  14.175 -#  define PNG_MAX_MALLOC_64K
  14.176 -#endif
  14.177 -
  14.178 -/* Special munging to support doing things the 'cygwin' way:
  14.179 - * 'Normal' png-on-win32 defines/defaults:
  14.180 - *   PNG_BUILD_DLL -- building dll
  14.181 - *   PNG_USE_DLL   -- building an application, linking to dll
  14.182 - *   (no define)   -- building static library, or building an
  14.183 - *                    application and linking to the static lib
  14.184 - * 'Cygwin' defines/defaults:
  14.185 - *   PNG_BUILD_DLL -- (ignored) building the dll
  14.186 - *   (no define)   -- (ignored) building an application, linking to the dll
  14.187 - *   PNG_STATIC    -- (ignored) building the static lib, or building an
  14.188 - *                    application that links to the static lib.
  14.189 - *   ALL_STATIC    -- (ignored) building various static libs, or building an
  14.190 - *                    application that links to the static libs.
  14.191 - * Thus,
  14.192 - * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
  14.193 - * this bit of #ifdefs will define the 'correct' config variables based on
  14.194 - * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but
  14.195 - * unnecessary.
  14.196 +/* COMPILER SPECIFIC OPTIONS.
  14.197   *
  14.198 - * Also, the precedence order is:
  14.199 - *   ALL_STATIC (since we can't #undef something outside our namespace)
  14.200 - *   PNG_BUILD_DLL
  14.201 - *   PNG_STATIC
  14.202 - *   (nothing) == PNG_USE_DLL
  14.203 - *
  14.204 - * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
  14.205 - *   of auto-import in binutils, we no longer need to worry about
  14.206 - *   __declspec(dllexport) / __declspec(dllimport) and friends.  Therefore,
  14.207 - *   we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
  14.208 - *   to __declspec() stuff.  However, we DO need to worry about
  14.209 - *   PNG_BUILD_DLL and PNG_STATIC because those change some defaults
  14.210 - *   such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
  14.211 - */
  14.212 -#if defined(__CYGWIN__)
  14.213 -#  if defined(ALL_STATIC)
  14.214 -#    if defined(PNG_BUILD_DLL)
  14.215 -#      undef PNG_BUILD_DLL
  14.216 -#    endif
  14.217 -#    if defined(PNG_USE_DLL)
  14.218 -#      undef PNG_USE_DLL
  14.219 -#    endif
  14.220 -#    if defined(PNG_DLL)
  14.221 -#      undef PNG_DLL
  14.222 -#    endif
  14.223 -#    if !defined(PNG_STATIC)
  14.224 -#      define PNG_STATIC
  14.225 -#    endif
  14.226 -#  else
  14.227 -#    if defined (PNG_BUILD_DLL)
  14.228 -#      if defined(PNG_STATIC)
  14.229 -#        undef PNG_STATIC
  14.230 -#      endif
  14.231 -#      if defined(PNG_USE_DLL)
  14.232 -#        undef PNG_USE_DLL
  14.233 -#      endif
  14.234 -#      if !defined(PNG_DLL)
  14.235 -#        define PNG_DLL
  14.236 -#      endif
  14.237 -#    else
  14.238 -#      if defined(PNG_STATIC)
  14.239 -#        if defined(PNG_USE_DLL)
  14.240 -#          undef PNG_USE_DLL
  14.241 -#        endif
  14.242 -#        if defined(PNG_DLL)
  14.243 -#          undef PNG_DLL
  14.244 -#        endif
  14.245 -#      else
  14.246 -#        if !defined(PNG_USE_DLL)
  14.247 -#          define PNG_USE_DLL
  14.248 -#        endif
  14.249 -#        if !defined(PNG_DLL)
  14.250 -#          define PNG_DLL
  14.251 -#        endif
  14.252 -#      endif
  14.253 -#    endif
  14.254 -#  endif
  14.255 -#endif
  14.256 -
  14.257 -/* This protects us against compilers that run on a windowing system
  14.258 - * and thus don't have or would rather us not use the stdio types:
  14.259 - * stdin, stdout, and stderr.  The only one currently used is stderr
  14.260 - * in png_error() and png_warning().  #defining PNG_NO_CONSOLE_IO will
  14.261 - * prevent these from being compiled and used. #defining PNG_NO_STDIO
  14.262 - * will also prevent these, plus will prevent the entire set of stdio
  14.263 - * macros and functions (FILE *, printf, etc.) from being compiled and used,
  14.264 - * unless (PNG_DEBUG > 0) has been #defined.
  14.265 - *
  14.266 - * #define PNG_NO_CONSOLE_IO
  14.267 - * #define PNG_NO_STDIO
  14.268 + * These options are provided so that a variety of difficult compilers
  14.269 + * can be used.  Some are fixed at build time (e.g. PNG_API_RULE
  14.270 + * below) but still have compiler specific implementations, others
  14.271 + * may be changed on a per-file basis when compiling against libpng.
  14.272   */
  14.273  
  14.274 -#if defined(_WIN32_WCE)
  14.275 -#  include <windows.h>
  14.276 -   /* Console I/O functions are not supported on WindowsCE */
  14.277 -#  define PNG_NO_CONSOLE_IO
  14.278 -   /* abort() may not be supported on some/all Windows CE platforms */
  14.279 -#  define PNG_ABORT() exit(-1)
  14.280 -#  ifdef PNG_DEBUG
  14.281 -#    undef PNG_DEBUG
  14.282 -#  endif
  14.283 -#endif
  14.284 -
  14.285 -#ifdef PNG_BUILD_DLL
  14.286 -#  ifndef PNG_CONSOLE_IO_SUPPORTED
  14.287 -#    ifndef PNG_NO_CONSOLE_IO
  14.288 -#      define PNG_NO_CONSOLE_IO
  14.289 -#    endif
  14.290 -#  endif
  14.291 -#endif
  14.292 -
  14.293 -#  ifdef PNG_NO_STDIO
  14.294 -#    ifndef PNG_NO_CONSOLE_IO
  14.295 -#      define PNG_NO_CONSOLE_IO
  14.296 -#    endif
  14.297 -#    ifdef PNG_DEBUG
  14.298 -#      if (PNG_DEBUG > 0)
  14.299 -#        include <stdio.h>
  14.300 -#      endif
  14.301 -#    endif
  14.302 -#  else
  14.303 -#    if !defined(_WIN32_WCE)
  14.304 -/* "stdio.h" functions are not supported on WindowsCE */
  14.305 -#      include <stdio.h>
  14.306 -#    endif
  14.307 -#  endif
  14.308 -
  14.309 -/* This macro protects us against machines that don't have function
  14.310 +/* The PNGARG macro protects us against machines that don't have function
  14.311   * prototypes (ie K&R style headers).  If your compiler does not handle
  14.312   * function prototypes, define this macro and use the included ansi2knr.
  14.313   * I've always been able to use _NO_PROTO as the indicator, but you may
  14.314 @@ -276,858 +81,351 @@
  14.315   */
  14.316  #ifndef PNGARG
  14.317  
  14.318 -#ifdef OF /* zlib prototype munger */
  14.319 -#  define PNGARG(arglist) OF(arglist)
  14.320 -#else
  14.321 +#  ifdef OF /* zlib prototype munger */
  14.322 +#    define PNGARG(arglist) OF(arglist)
  14.323 +#  else
  14.324  
  14.325 -#ifdef _NO_PROTO
  14.326 -#  define PNGARG(arglist) ()
  14.327 -#  ifndef PNG_TYPECAST_NULL
  14.328 -#     define PNG_TYPECAST_NULL
  14.329 -#  endif
  14.330 -#else
  14.331 -#  define PNGARG(arglist) arglist
  14.332 -#endif /* _NO_PROTO */
  14.333 +#    ifdef _NO_PROTO
  14.334 +#      define PNGARG(arglist) ()
  14.335 +#    else
  14.336 +#      define PNGARG(arglist) arglist
  14.337 +#    endif /* _NO_PROTO */
  14.338  
  14.339 -
  14.340 -#endif /* OF */
  14.341 +#  endif /* OF */
  14.342  
  14.343  #endif /* PNGARG */
  14.344  
  14.345 -/* Try to determine if we are compiling on a Mac.  Note that testing for
  14.346 - * just __MWERKS__ is not good enough, because the Codewarrior is now used
  14.347 - * on non-Mac platforms.
  14.348 +/* Function calling conventions.
  14.349 + * =============================
  14.350 + * Normally it is not necessary to specify to the compiler how to call
  14.351 + * a function - it just does it - however on x86 systems derived from
  14.352 + * Microsoft and Borland C compilers ('IBM PC', 'DOS', 'Windows' systems
  14.353 + * and some others) there are multiple ways to call a function and the
  14.354 + * default can be changed on the compiler command line.  For this reason
  14.355 + * libpng specifies the calling convention of every exported function and
  14.356 + * every function called via a user supplied function pointer.  This is
  14.357 + * done in this file by defining the following macros:
  14.358 + *
  14.359 + * PNGAPI    Calling convention for exported functions.
  14.360 + * PNGCBAPI  Calling convention for user provided (callback) functions.
  14.361 + * PNGCAPI   Calling convention used by the ANSI-C library (required
  14.362 + *           for longjmp callbacks and sometimes used internally to
  14.363 + *           specify the calling convention for zlib).
  14.364 + *
  14.365 + * These macros should never be overridden.  If it is necessary to
  14.366 + * change calling convention in a private build this can be done
  14.367 + * by setting PNG_API_RULE (which defaults to 0) to one of the values
  14.368 + * below to select the correct 'API' variants.
  14.369 + *
  14.370 + * PNG_API_RULE=0 Use PNGCAPI - the 'C' calling convention - throughout.
  14.371 + *                This is correct in every known environment.
  14.372 + * PNG_API_RULE=1 Use the operating system convention for PNGAPI and
  14.373 + *                the 'C' calling convention (from PNGCAPI) for
  14.374 + *                callbacks (PNGCBAPI).  This is no longer required
  14.375 + *                in any known environment - if it has to be used
  14.376 + *                please post an explanation of the problem to the
  14.377 + *                libpng mailing list.
  14.378 + *
  14.379 + * These cases only differ if the operating system does not use the C
  14.380 + * calling convention, at present this just means the above cases
  14.381 + * (x86 DOS/Windows sytems) and, even then, this does not apply to
  14.382 + * Cygwin running on those systems.
  14.383 + *
  14.384 + * Note that the value must be defined in pnglibconf.h so that what
  14.385 + * the application uses to call the library matches the conventions
  14.386 + * set when building the library.
  14.387   */
  14.388 -#ifndef MACOS
  14.389 -#  if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
  14.390 -      defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
  14.391 -#    define MACOS
  14.392 +
  14.393 +/* Symbol export
  14.394 + * =============
  14.395 + * When building a shared library it is almost always necessary to tell
  14.396 + * the compiler which symbols to export.  The png.h macro 'PNG_EXPORT'
  14.397 + * is used to mark the symbols.  On some systems these symbols can be
  14.398 + * extracted at link time and need no special processing by the compiler,
  14.399 + * on other systems the symbols are flagged by the compiler and just
  14.400 + * the declaration requires a special tag applied (unfortunately) in a
  14.401 + * compiler dependent way.  Some systems can do either.
  14.402 + *
  14.403 + * A small number of older systems also require a symbol from a DLL to
  14.404 + * be flagged to the program that calls it.  This is a problem because
  14.405 + * we do not know in the header file included by application code that
  14.406 + * the symbol will come from a shared library, as opposed to a statically
  14.407 + * linked one.  For this reason the application must tell us by setting
  14.408 + * the magic flag PNG_USE_DLL to turn on the special processing before
  14.409 + * it includes png.h.
  14.410 + *
  14.411 + * Four additional macros are used to make this happen:
  14.412 + *
  14.413 + * PNG_IMPEXP The magic (if any) to cause a symbol to be exported from
  14.414 + *            the build or imported if PNG_USE_DLL is set - compiler
  14.415 + *            and system specific.
  14.416 + *
  14.417 + * PNG_EXPORT_TYPE(type) A macro that pre or appends PNG_IMPEXP to
  14.418 + *                       'type', compiler specific.
  14.419 + *
  14.420 + * PNG_DLL_EXPORT Set to the magic to use during a libpng build to
  14.421 + *                make a symbol exported from the DLL.  Not used in the
  14.422 + *                public header files; see pngpriv.h for how it is used
  14.423 + *                in the libpng build.
  14.424 + *
  14.425 + * PNG_DLL_IMPORT Set to the magic to force the libpng symbols to come
  14.426 + *                from a DLL - used to define PNG_IMPEXP when
  14.427 + *                PNG_USE_DLL is set.
  14.428 + */
  14.429 +
  14.430 +/* System specific discovery.
  14.431 + * ==========================
  14.432 + * This code is used at build time to find PNG_IMPEXP, the API settings
  14.433 + * and PNG_EXPORT_TYPE(), it may also set a macro to indicate the DLL
  14.434 + * import processing is possible.  On Windows/x86 systems it also sets
  14.435 + * compiler-specific macros to the values required to change the calling
  14.436 + * conventions of the various functions.
  14.437 + */
  14.438 +#if ( defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\
  14.439 +      defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) ) &&\
  14.440 +    ( defined(_X86_) || defined(_X64_) || defined(_M_IX86) ||\
  14.441 +      defined(_M_X64) || defined(_M_IA64) )
  14.442 +  /* Windows system (DOS doesn't support DLLs) running on x86/x64.  Includes
  14.443 +   * builds under Cygwin or MinGW.  Also includes Watcom builds but these need
  14.444 +   * special treatment because they are not compatible with GCC or Visual C
  14.445 +   * because of different calling conventions.
  14.446 +   */
  14.447 +#  if PNG_API_RULE == 2
  14.448 +    /* If this line results in an error, either because __watcall is not
  14.449 +     * understood or because of a redefine just below you cannot use *this*
  14.450 +     * build of the library with the compiler you are using.  *This* build was
  14.451 +     * build using Watcom and applications must also be built using Watcom!
  14.452 +     */
  14.453 +#    define PNGCAPI __watcall
  14.454 +#  endif
  14.455 +
  14.456 +#  if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
  14.457 +#    define PNGCAPI __cdecl
  14.458 +#    if PNG_API_RULE == 1
  14.459 +#      define PNGAPI __stdcall
  14.460 +#    endif
  14.461 +#  else
  14.462 +    /* An older compiler, or one not detected (erroneously) above,
  14.463 +     * if necessary override on the command line to get the correct
  14.464 +     * variants for the compiler.
  14.465 +     */
  14.466 +#    ifndef PNGCAPI
  14.467 +#      define PNGCAPI _cdecl
  14.468 +#    endif
  14.469 +#    if PNG_API_RULE == 1 && !defined(PNGAPI)
  14.470 +#      define PNGAPI _stdcall
  14.471 +#    endif
  14.472 +#  endif /* compiler/api */
  14.473 +  /* NOTE: PNGCBAPI always defaults to PNGCAPI. */
  14.474 +
  14.475 +#  if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
  14.476 +   ERROR: PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed
  14.477 +#  endif
  14.478 +
  14.479 +#  if (defined(_MSC_VER) && _MSC_VER < 800) ||\
  14.480 +      (defined(__BORLANDC__) && __BORLANDC__ < 0x500)
  14.481 +    /* older Borland and MSC
  14.482 +     * compilers used '__export' and required this to be after
  14.483 +     * the type.
  14.484 +     */
  14.485 +#    ifndef PNG_EXPORT_TYPE
  14.486 +#      define PNG_EXPORT_TYPE(type) type PNG_IMPEXP
  14.487 +#    endif
  14.488 +#    define PNG_DLL_EXPORT __export
  14.489 +#  else /* newer compiler */
  14.490 +#    define PNG_DLL_EXPORT __declspec(dllexport)
  14.491 +#    ifndef PNG_DLL_IMPORT
  14.492 +#      define PNG_DLL_IMPORT __declspec(dllimport)
  14.493 +#    endif
  14.494 +#  endif /* compiler */
  14.495 +
  14.496 +#else /* !Windows/x86 */
  14.497 +#  if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
  14.498 +#    define PNGAPI _System
  14.499 +#  else /* !Windows/x86 && !OS/2 */
  14.500 +    /* Use the defaults, or define PNG*API on the command line (but
  14.501 +     * this will have to be done for every compile!)
  14.502 +     */
  14.503 +#  endif /* other system, !OS/2 */
  14.504 +#endif /* !Windows/x86 */
  14.505 +
  14.506 +/* Now do all the defaulting . */
  14.507 +#ifndef PNGCAPI
  14.508 +#  define PNGCAPI
  14.509 +#endif
  14.510 +#ifndef PNGCBAPI
  14.511 +#  define PNGCBAPI PNGCAPI
  14.512 +#endif
  14.513 +#ifndef PNGAPI
  14.514 +#  define PNGAPI PNGCAPI
  14.515 +#endif
  14.516 +
  14.517 +/* PNG_IMPEXP may be set on the compilation system command line or (if not set)
  14.518 + * then in an internal header file when building the library, otherwise (when
  14.519 + * using the library) it is set here.
  14.520 + */
  14.521 +#ifndef PNG_IMPEXP
  14.522 +#  if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT)
  14.523 +     /* This forces use of a DLL, disallowing static linking */
  14.524 +#    define PNG_IMPEXP PNG_DLL_IMPORT
  14.525 +#  endif
  14.526 +
  14.527 +#  ifndef PNG_IMPEXP
  14.528 +#    define PNG_IMPEXP
  14.529  #  endif
  14.530  #endif
  14.531  
  14.532 -/* enough people need this for various reasons to include it here */
  14.533 -#if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
  14.534 -#  include <sys/types.h>
  14.535 +/* In 1.5.2 the definition of PNG_FUNCTION has been changed to always treat
  14.536 + * 'attributes' as a storage class - the attributes go at the start of the
  14.537 + * function definition, and attributes are always appended regardless of the
  14.538 + * compiler.  This considerably simplifies these macros but may cause problems
  14.539 + * if any compilers both need function attributes and fail to handle them as
  14.540 + * a storage class (this is unlikely.)
  14.541 + */
  14.542 +#ifndef PNG_FUNCTION
  14.543 +#  define PNG_FUNCTION(type, name, args, attributes) attributes type name args
  14.544  #endif
  14.545  
  14.546 -#if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)
  14.547 -#  define PNG_SETJMP_SUPPORTED
  14.548 +#ifndef PNG_EXPORT_TYPE
  14.549 +#  define PNG_EXPORT_TYPE(type) PNG_IMPEXP type
  14.550  #endif
  14.551  
  14.552 -#ifdef PNG_SETJMP_SUPPORTED
  14.553 -/* This is an attempt to force a single setjmp behaviour on Linux.  If
  14.554 - * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
  14.555 +   /* The ordinal value is only relevant when preprocessing png.h for symbol
  14.556 +    * table entries, so we discard it here.  See the .dfn files in the
  14.557 +    * scripts directory.
  14.558 +    */
  14.559 +#ifndef PNG_EXPORTA
  14.560 +
  14.561 +#  define PNG_EXPORTA(ordinal, type, name, args, attributes)\
  14.562 +      PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args), \
  14.563 +        extern attributes)
  14.564 +#endif
  14.565 +
  14.566 +/* ANSI-C (C90) does not permit a macro to be invoked with an empty argument,
  14.567 + * so make something non-empty to satisfy the requirement:
  14.568 + */
  14.569 +#define PNG_EMPTY /*empty list*/
  14.570 +
  14.571 +#define PNG_EXPORT(ordinal, type, name, args)\
  14.572 +   PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY)
  14.573 +
  14.574 +/* Use PNG_REMOVED to comment out a removed interface. */
  14.575 +#ifndef PNG_REMOVED
  14.576 +#  define PNG_REMOVED(ordinal, type, name, args, attributes)
  14.577 +#endif
  14.578 +
  14.579 +#ifndef PNG_CALLBACK
  14.580 +#  define PNG_CALLBACK(type, name, args) type (PNGCBAPI name) PNGARG(args)
  14.581 +#endif
  14.582 +
  14.583 +/* Support for compiler specific function attributes.  These are used
  14.584 + * so that where compiler support is available incorrect use of API
  14.585 + * functions in png.h will generate compiler warnings.
  14.586   *
  14.587 - * You can bypass this test if you know that your application uses exactly
  14.588 - * the same setjmp.h that was included when libpng was built.  Only define
  14.589 - * PNG_SKIP_SETJMP_CHECK while building your application, prior to the
  14.590 - * application's '#include "png.h"'. Don't define PNG_SKIP_SETJMP_CHECK
  14.591 - * while building a separate libpng library for general use.
  14.592 + * Added at libpng-1.2.41.
  14.593   */
  14.594  
  14.595 -#  ifndef PNG_SKIP_SETJMP_CHECK
  14.596 -#    ifdef __linux__
  14.597 -#      ifdef _BSD_SOURCE
  14.598 -#        define PNG_SAVE_BSD_SOURCE
  14.599 -#        undef _BSD_SOURCE
  14.600 -#      endif
  14.601 -#      ifdef _SETJMP_H
  14.602 -       /* If you encounter a compiler error here, see the explanation
  14.603 -        * near the end of INSTALL.
  14.604 -        */
  14.605 -           __pngconf.h__ in libpng already includes setjmp.h;
  14.606 -           __dont__ include it again.;
  14.607 -#      endif
  14.608 -#    endif /* __linux__ */
  14.609 -#  endif /* PNG_SKIP_SETJMP_CHECK */
  14.610 -
  14.611 -   /* include setjmp.h for error handling */
  14.612 -#  include <setjmp.h>
  14.613 -
  14.614 -#  ifdef __linux__
  14.615 -#    ifdef PNG_SAVE_BSD_SOURCE
  14.616 -#      ifndef _BSD_SOURCE
  14.617 -#        define _BSD_SOURCE
  14.618 -#      endif
  14.619 -#      undef PNG_SAVE_BSD_SOURCE
  14.620 -#    endif
  14.621 -#  endif /* __linux__ */
  14.622 -#endif /* PNG_SETJMP_SUPPORTED */
  14.623 -
  14.624 -#ifdef BSD
  14.625 -#  include <strings.h>
  14.626 -#else
  14.627 -#  include <string.h>
  14.628 -#endif
  14.629 -
  14.630 -/* Other defines for things like memory and the like can go here.  */
  14.631 -#ifdef PNG_INTERNAL
  14.632 -
  14.633 -#include <stdlib.h>
  14.634 -
  14.635 -/* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
  14.636 - * aren't usually used outside the library (as far as I know), so it is
  14.637 - * debatable if they should be exported at all.  In the future, when it is
  14.638 - * possible to have run-time registry of chunk-handling functions, some of
  14.639 - * these will be made available again.
  14.640 -#define PNG_EXTERN extern
  14.641 - */
  14.642 -#define PNG_EXTERN
  14.643 -
  14.644 -/* Other defines specific to compilers can go here.  Try to keep
  14.645 - * them inside an appropriate ifdef/endif pair for portability.
  14.646 - */
  14.647 -
  14.648 -#if defined(PNG_FLOATING_POINT_SUPPORTED)
  14.649 -#  if defined(MACOS)
  14.650 -     /* We need to check that <math.h> hasn't already been included earlier
  14.651 -      * as it seems it doesn't agree with <fp.h>, yet we should really use
  14.652 -      * <fp.h> if possible.
  14.653 -      */
  14.654 -#    if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
  14.655 -#      include <fp.h>
  14.656 -#    endif
  14.657 -#  else
  14.658 -#    include <math.h>
  14.659 -#  endif
  14.660 -#  if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
  14.661 -     /* Amiga SAS/C: We must include builtin FPU functions when compiling using
  14.662 -      * MATH=68881
  14.663 -      */
  14.664 -#    include <m68881.h>
  14.665 +#ifndef PNG_NO_PEDANTIC_WARNINGS
  14.666 +#  ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED
  14.667 +#    define PNG_PEDANTIC_WARNINGS_SUPPORTED
  14.668  #  endif
  14.669  #endif
  14.670  
  14.671 -/* Codewarrior on NT has linking problems without this. */
  14.672 -#if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
  14.673 -#  define PNG_ALWAYS_EXTERN
  14.674 +#ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED
  14.675 +  /* Support for compiler specific function attributes.  These are used
  14.676 +   * so that where compiler support is available incorrect use of API
  14.677 +   * functions in png.h will generate compiler warnings.  Added at libpng
  14.678 +   * version 1.2.41.
  14.679 +   */
  14.680 +#  if defined(__GNUC__)
  14.681 +#    ifndef PNG_USE_RESULT
  14.682 +#      define PNG_USE_RESULT __attribute__((__warn_unused_result__))
  14.683 +#    endif
  14.684 +#    ifndef PNG_NORETURN
  14.685 +#      define PNG_NORETURN   __attribute__((__noreturn__))
  14.686 +#    endif
  14.687 +#    ifndef PNG_ALLOCATED
  14.688 +#      define PNG_ALLOCATED  __attribute__((__malloc__))
  14.689 +#    endif
  14.690 +#    ifndef PNG_DEPRECATED
  14.691 +#      define PNG_DEPRECATED __attribute__((__deprecated__))
  14.692 +#    endif
  14.693 +#    ifndef PNG_PRIVATE
  14.694 +#      if 0 /* Doesn't work so we use deprecated instead*/
  14.695 +#        define PNG_PRIVATE \
  14.696 +          __attribute__((warning("This function is not exported by libpng.")))
  14.697 +#      else
  14.698 +#        define PNG_PRIVATE \
  14.699 +          __attribute__((__deprecated__))
  14.700 +#      endif
  14.701 +#    endif
  14.702 +#  endif /* __GNUC__ */
  14.703 +
  14.704 +#  if defined(_MSC_VER)  && (_MSC_VER >= 1300)
  14.705 +#    ifndef PNG_USE_RESULT
  14.706 +#      define PNG_USE_RESULT /* not supported */
  14.707 +#    endif
  14.708 +#    ifndef PNG_NORETURN
  14.709 +#      define PNG_NORETURN __declspec(noreturn)
  14.710 +#    endif
  14.711 +#    ifndef PNG_ALLOCATED
  14.712 +#      if (_MSC_VER >= 1400)
  14.713 +#        define PNG_ALLOCATED __declspec(restrict)
  14.714 +#      endif
  14.715 +#    endif
  14.716 +#    ifndef PNG_DEPRECATED
  14.717 +#      define PNG_DEPRECATED __declspec(deprecated)
  14.718 +#    endif
  14.719 +#    ifndef PNG_PRIVATE
  14.720 +#      define PNG_PRIVATE __declspec(deprecated)
  14.721 +#    endif
  14.722 +#  endif /* _MSC_VER */
  14.723 +#endif /* PNG_PEDANTIC_WARNINGS */
  14.724 +
  14.725 +#ifndef PNG_DEPRECATED
  14.726 +#  define PNG_DEPRECATED  /* Use of this function is deprecated */
  14.727  #endif
  14.728 -
  14.729 -/* This provides the non-ANSI (far) memory allocation routines. */
  14.730 -#if defined(__TURBOC__) && defined(__MSDOS__)
  14.731 -#  include <mem.h>
  14.732 -#  include <alloc.h>
  14.733 +#ifndef PNG_USE_RESULT
  14.734 +#  define PNG_USE_RESULT  /* The result of this function must be checked */
  14.735  #endif
  14.736 -
  14.737 -/* I have no idea why is this necessary... */
  14.738 -#if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \
  14.739 -    defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__))
  14.740 -#  include <malloc.h>
  14.741 +#ifndef PNG_NORETURN
  14.742 +#  define PNG_NORETURN    /* This function does not return */
  14.743  #endif
  14.744 -
  14.745 -/* This controls how fine the dithering gets.  As this allocates
  14.746 - * a largish chunk of memory (32K), those who are not as concerned
  14.747 - * with dithering quality can decrease some or all of these.
  14.748 - */
  14.749 -#ifndef PNG_DITHER_RED_BITS
  14.750 -#  define PNG_DITHER_RED_BITS 5
  14.751 +#ifndef PNG_ALLOCATED
  14.752 +#  define PNG_ALLOCATED   /* The result of the function is new memory */
  14.753  #endif
  14.754 -#ifndef PNG_DITHER_GREEN_BITS
  14.755 -#  define PNG_DITHER_GREEN_BITS 5
  14.756 +#ifndef PNG_PRIVATE
  14.757 +#  define PNG_PRIVATE     /* This is a private libpng function */
  14.758  #endif
  14.759 -#ifndef PNG_DITHER_BLUE_BITS
  14.760 -#  define PNG_DITHER_BLUE_BITS 5
  14.761 +#ifndef PNG_FP_EXPORT     /* A floating point API. */
  14.762 +#  ifdef PNG_FLOATING_POINT_SUPPORTED
  14.763 +#     define PNG_FP_EXPORT(ordinal, type, name, args)\
  14.764 +         PNG_EXPORT(ordinal, type, name, args)
  14.765 +#  else                   /* No floating point APIs */
  14.766 +#     define PNG_FP_EXPORT(ordinal, type, name, args)
  14.767 +#  endif
  14.768  #endif
  14.769 -
  14.770 -/* This controls how fine the gamma correction becomes when you
  14.771 - * are only interested in 8 bits anyway.  Increasing this value
  14.772 - * results in more memory being used, and more pow() functions
  14.773 - * being called to fill in the gamma tables.  Don't set this value
  14.774 - * less then 8, and even that may not work (I haven't tested it).
  14.775 - */
  14.776 -
  14.777 -#ifndef PNG_MAX_GAMMA_8
  14.778 -#  define PNG_MAX_GAMMA_8 11
  14.779 +#ifndef PNG_FIXED_EXPORT  /* A fixed point API. */
  14.780 +#  ifdef PNG_FIXED_POINT_SUPPORTED
  14.781 +#     define PNG_FIXED_EXPORT(ordinal, type, name, args)\
  14.782 +         PNG_EXPORT(ordinal, type, name, args)
  14.783 +#  else                   /* No fixed point APIs */
  14.784 +#     define PNG_FIXED_EXPORT(ordinal, type, name, args)
  14.785 +#  endif
  14.786  #endif
  14.787  
  14.788 -/* This controls how much a difference in gamma we can tolerate before
  14.789 - * we actually start doing gamma conversion.
  14.790 - */
  14.791 -#ifndef PNG_GAMMA_THRESHOLD
  14.792 -#  define PNG_GAMMA_THRESHOLD 0.05
  14.793 -#endif
  14.794 -
  14.795 -#endif /* PNG_INTERNAL */
  14.796 -
  14.797  /* The following uses const char * instead of char * for error
  14.798   * and warning message functions, so some compilers won't complain.
  14.799   * If you do not want to use const, define PNG_NO_CONST here.
  14.800 + *
  14.801 + * This should not change how the APIs are called, so it can be done
  14.802 + * on a per-file basis in the application.
  14.803   */
  14.804 -
  14.805 -#ifndef PNG_NO_CONST
  14.806 -#  define PNG_CONST const
  14.807 -#else
  14.808 -#  define PNG_CONST
  14.809 -#endif
  14.810 -
  14.811 -/* The following defines give you the ability to remove code from the
  14.812 - * library that you will not be using.  I wish I could figure out how to
  14.813 - * automate this, but I can't do that without making it seriously hard
  14.814 - * on the users.  So if you are not using an ability, change the #define
  14.815 - * to and #undef, and that part of the library will not be compiled.  If
  14.816 - * your linker can't find a function, you may want to make sure the
  14.817 - * ability is defined here.  Some of these depend upon some others being
  14.818 - * defined.  I haven't figured out all the interactions here, so you may
  14.819 - * have to experiment awhile to get everything to compile.  If you are
  14.820 - * creating or using a shared library, you probably shouldn't touch this,
  14.821 - * as it will affect the size of the structures, and this will cause bad
  14.822 - * things to happen if the library and/or application ever change.
  14.823 - */
  14.824 -
  14.825 -/* Any features you will not be using can be undef'ed here */
  14.826 -
  14.827 -/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
  14.828 - * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
  14.829 - * on the compile line, then pick and choose which ones to define without
  14.830 - * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
  14.831 - * if you only want to have a png-compliant reader/writer but don't need
  14.832 - * any of the extra transformations.  This saves about 80 kbytes in a
  14.833 - * typical installation of the library. (PNG_NO_* form added in version
  14.834 - * 1.0.1c, for consistency)
  14.835 - */
  14.836 -
  14.837 -/* The size of the png_text structure changed in libpng-1.0.6 when
  14.838 - * iTXt support was added.  iTXt support was turned off by default through
  14.839 - * libpng-1.2.x, to support old apps that malloc the png_text structure
  14.840 - * instead of calling png_set_text() and letting libpng malloc it.  It
  14.841 - * will be turned on by default in libpng-1.4.0.
  14.842 - */
  14.843 -
  14.844 -#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
  14.845 -#  ifndef PNG_NO_iTXt_SUPPORTED
  14.846 -#    define PNG_NO_iTXt_SUPPORTED
  14.847 -#  endif
  14.848 -#  ifndef PNG_NO_READ_iTXt
  14.849 -#    define PNG_NO_READ_iTXt
  14.850 -#  endif
  14.851 -#  ifndef PNG_NO_WRITE_iTXt
  14.852 -#    define PNG_NO_WRITE_iTXt
  14.853 -#  endif
  14.854 -#endif
  14.855 -
  14.856 -#if !defined(PNG_NO_iTXt_SUPPORTED)
  14.857 -#  if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
  14.858 -#    define PNG_READ_iTXt
  14.859 -#  endif
  14.860 -#  if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt)
  14.861 -#    define PNG_WRITE_iTXt
  14.862 -#  endif
  14.863 -#endif
  14.864 -
  14.865 -/* The following support, added after version 1.0.0, can be turned off here en
  14.866 - * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
  14.867 - * with old applications that require the length of png_struct and png_info
  14.868 - * to remain unchanged.
  14.869 - */
  14.870 -
  14.871 -#ifdef PNG_LEGACY_SUPPORTED
  14.872 -#  define PNG_NO_FREE_ME
  14.873 -#  define PNG_NO_READ_UNKNOWN_CHUNKS
  14.874 -#  define PNG_NO_WRITE_UNKNOWN_CHUNKS
  14.875 -#  define PNG_NO_HANDLE_AS_UNKNOWN
  14.876 -#  define PNG_NO_READ_USER_CHUNKS
  14.877 -#  define PNG_NO_READ_iCCP
  14.878 -#  define PNG_NO_WRITE_iCCP
  14.879 -#  define PNG_NO_READ_iTXt
  14.880 -#  define PNG_NO_WRITE_iTXt
  14.881 -#  define PNG_NO_READ_sCAL
  14.882 -#  define PNG_NO_WRITE_sCAL
  14.883 -#  define PNG_NO_READ_sPLT
  14.884 -#  define PNG_NO_WRITE_sPLT
  14.885 -#  define PNG_NO_INFO_IMAGE
  14.886 -#  define PNG_NO_READ_RGB_TO_GRAY
  14.887 -#  define PNG_NO_READ_USER_TRANSFORM
  14.888 -#  define PNG_NO_WRITE_USER_TRANSFORM
  14.889 -#  define PNG_NO_USER_MEM
  14.890 -#  define PNG_NO_READ_EMPTY_PLTE
  14.891 -#  define PNG_NO_MNG_FEATURES
  14.892 -#  define PNG_NO_FIXED_POINT_SUPPORTED
  14.893 -#endif
  14.894 -
  14.895 -/* Ignore attempt to turn off both floating and fixed point support */
  14.896 -#if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
  14.897 -    !defined(PNG_NO_FIXED_POINT_SUPPORTED)
  14.898 -#  define PNG_FIXED_POINT_SUPPORTED
  14.899 -#endif
  14.900 -
  14.901 -#ifndef PNG_NO_FREE_ME
  14.902 -#  define PNG_FREE_ME_SUPPORTED
  14.903 -#endif
  14.904 -
  14.905 -#ifdef PNG_READ_SUPPORTED
  14.906 -
  14.907 -#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
  14.908 -      !defined(PNG_NO_READ_TRANSFORMS)
  14.909 -#  define PNG_READ_TRANSFORMS_SUPPORTED
  14.910 -#endif
  14.911 -
  14.912 -#ifdef PNG_READ_TRANSFORMS_SUPPORTED
  14.913 -#  ifndef PNG_NO_READ_EXPAND
  14.914 -#    define PNG_READ_EXPAND_SUPPORTED
  14.915 -#  endif
  14.916 -#  ifndef PNG_NO_READ_SHIFT
  14.917 -#    define PNG_READ_SHIFT_SUPPORTED
  14.918 -#  endif
  14.919 -#  ifndef PNG_NO_READ_PACK
  14.920 -#    define PNG_READ_PACK_SUPPORTED
  14.921 -#  endif
  14.922 -#  ifndef PNG_NO_READ_BGR
  14.923 -#    define PNG_READ_BGR_SUPPORTED
  14.924 -#  endif
  14.925 -#  ifndef PNG_NO_READ_SWAP
  14.926 -#    define PNG_READ_SWAP_SUPPORTED
  14.927 -#  endif
  14.928 -#  ifndef PNG_NO_READ_PACKSWAP
  14.929 -#    define PNG_READ_PACKSWAP_SUPPORTED
  14.930 -#  endif
  14.931 -#  ifndef PNG_NO_READ_INVERT
  14.932 -#    define PNG_READ_INVERT_SUPPORTED
  14.933 -#  endif
  14.934 -#  ifndef PNG_NO_READ_DITHER
  14.935 -#    define PNG_READ_DITHER_SUPPORTED
  14.936 -#  endif
  14.937 -#  ifndef PNG_NO_READ_BACKGROUND
  14.938 -#    define PNG_READ_BACKGROUND_SUPPORTED
  14.939 -#  endif
  14.940 -#  ifndef PNG_NO_READ_16_TO_8
  14.941 -#    define PNG_READ_16_TO_8_SUPPORTED
  14.942 -#  endif
  14.943 -#  ifndef PNG_NO_READ_FILLER
  14.944 -#    define PNG_READ_FILLER_SUPPORTED
  14.945 -#  endif
  14.946 -#  ifndef PNG_NO_READ_GAMMA
  14.947 -#    define PNG_READ_GAMMA_SUPPORTED
  14.948 -#  endif
  14.949 -#  ifndef PNG_NO_READ_GRAY_TO_RGB
  14.950 -#    define PNG_READ_GRAY_TO_RGB_SUPPORTED
  14.951 -#  endif
  14.952 -#  ifndef PNG_NO_READ_SWAP_ALPHA
  14.953 -#    define PNG_READ_SWAP_ALPHA_SUPPORTED
  14.954 -#  endif
  14.955 -#  ifndef PNG_NO_READ_INVERT_ALPHA
  14.956 -#    define PNG_READ_INVERT_ALPHA_SUPPORTED
  14.957 -#  endif
  14.958 -#  ifndef PNG_NO_READ_STRIP_ALPHA
  14.959 -#    define PNG_READ_STRIP_ALPHA_SUPPORTED
  14.960 -#  endif
  14.961 -#  ifndef PNG_NO_READ_USER_TRANSFORM
  14.962 -#    define PNG_READ_USER_TRANSFORM_SUPPORTED
  14.963 -#  endif
  14.964 -#  ifndef PNG_NO_READ_RGB_TO_GRAY
  14.965 -#    define PNG_READ_RGB_TO_GRAY_SUPPORTED
  14.966 -#  endif
  14.967 -#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
  14.968 -
  14.969 -#if !defined(PNG_NO_PROGRESSIVE_READ) && \
  14.970 - !defined(PNG_PROGRESSIVE_READ_SUPPORTED) /* if you don't do progressive   */
  14.971 -#  define PNG_PROGRESSIVE_READ_SUPPORTED  /* reading.  This is not talking */
  14.972 -#endif                            /* about interlacing capability!  You'll */
  14.973 -           /* still have interlacing unless you change the following line: */
  14.974 -
  14.975 -#define PNG_READ_INTERLACING_SUPPORTED /* required in PNG-compliant decoders */
  14.976 -
  14.977 -#ifndef PNG_NO_READ_COMPOSITE_NODIV
  14.978 -#  ifndef PNG_NO_READ_COMPOSITED_NODIV  /* libpng-1.0.x misspelling */
  14.979 -#    define PNG_READ_COMPOSITE_NODIV_SUPPORTED  /* well tested on Intel, SGI */
  14.980 -#  endif
  14.981 -#endif
  14.982 -
  14.983 -#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
  14.984 -/* Deprecated, will be removed from version 2.0.0.
  14.985 -   Use PNG_MNG_FEATURES_SUPPORTED instead. */
  14.986 -#ifndef PNG_NO_READ_EMPTY_PLTE
  14.987 -#  define PNG_READ_EMPTY_PLTE_SUPPORTED
  14.988 -#endif
  14.989 -#endif
  14.990 -
  14.991 -#endif /* PNG_READ_SUPPORTED */
  14.992 -
  14.993 -#ifdef PNG_WRITE_SUPPORTED
  14.994 -
  14.995 -# if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
  14.996 -    !defined(PNG_NO_WRITE_TRANSFORMS)
  14.997 -#  define PNG_WRITE_TRANSFORMS_SUPPORTED
  14.998 -#endif
  14.999 -
 14.1000 -#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
 14.1001 -#  ifndef PNG_NO_WRITE_SHIFT
 14.1002 -#    define PNG_WRITE_SHIFT_SUPPORTED
 14.1003 -#  endif
 14.1004 -#  ifndef PNG_NO_WRITE_PACK
 14.1005 -#    define PNG_WRITE_PACK_SUPPORTED
 14.1006 -#  endif
 14.1007 -#  ifndef PNG_NO_WRITE_BGR
 14.1008 -#    define PNG_WRITE_BGR_SUPPORTED
 14.1009 -#  endif
 14.1010 -#  ifndef PNG_NO_WRITE_SWAP
 14.1011 -#    define PNG_WRITE_SWAP_SUPPORTED
 14.1012 -#  endif
 14.1013 -#  ifndef PNG_NO_WRITE_PACKSWAP
 14.1014 -#    define PNG_WRITE_PACKSWAP_SUPPORTED
 14.1015 -#  endif
 14.1016 -#  ifndef PNG_NO_WRITE_INVERT
 14.1017 -#    define PNG_WRITE_INVERT_SUPPORTED
 14.1018 -#  endif
 14.1019 -#  ifndef PNG_NO_WRITE_FILLER
 14.1020 -#    define PNG_WRITE_FILLER_SUPPORTED   /* same as WRITE_STRIP_ALPHA */
 14.1021 -#  endif
 14.1022 -#  ifndef PNG_NO_WRITE_SWAP_ALPHA
 14.1023 -#    define PNG_WRITE_SWAP_ALPHA_SUPPORTED
 14.1024 -#  endif
 14.1025 -#  ifndef PNG_NO_WRITE_INVERT_ALPHA
 14.1026 -#    define PNG_WRITE_INVERT_ALPHA_SUPPORTED
 14.1027 -#  endif
 14.1028 -#  ifndef PNG_NO_WRITE_USER_TRANSFORM
 14.1029 -#    define PNG_WRITE_USER_TRANSFORM_SUPPORTED
 14.1030 -#  endif
 14.1031 -#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
 14.1032 -
 14.1033 -#if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \
 14.1034 -    !defined(PNG_WRITE_INTERLACING_SUPPORTED)
 14.1035 -#define PNG_WRITE_INTERLACING_SUPPORTED  /* not required for PNG-compliant
 14.1036 -                                            encoders, but can cause trouble
 14.1037 -                                            if left undefined */
 14.1038 -#endif
 14.1039 -
 14.1040 -#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
 14.1041 -    !defined(PNG_WRITE_WEIGHTED_FILTER) && \
 14.1042 -     defined(PNG_FLOATING_POINT_SUPPORTED)
 14.1043 -#  define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
 14.1044 -#endif
 14.1045 -
 14.1046 -#ifndef PNG_NO_WRITE_FLUSH
 14.1047 -#  define PNG_WRITE_FLUSH_SUPPORTED
 14.1048 -#endif
 14.1049 -
 14.1050 -#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
 14.1051 -/* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
 14.1052 -#ifndef PNG_NO_WRITE_EMPTY_PLTE
 14.1053 -#  define PNG_WRITE_EMPTY_PLTE_SUPPORTED
 14.1054 -#endif
 14.1055 -#endif
 14.1056 -
 14.1057 -#endif /* PNG_WRITE_SUPPORTED */
 14.1058 -
 14.1059 -#ifndef PNG_1_0_X
 14.1060 -#  ifndef PNG_NO_ERROR_NUMBERS
 14.1061 -#    define PNG_ERROR_NUMBERS_SUPPORTED
 14.1062 -#  endif
 14.1063 -#endif /* PNG_1_0_X */
 14.1064 -
 14.1065 -#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
 14.1066 -    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
 14.1067 -#  ifndef PNG_NO_USER_TRANSFORM_PTR
 14.1068 -#    define PNG_USER_TRANSFORM_PTR_SUPPORTED
 14.1069 -#  endif
 14.1070 -#endif
 14.1071 -
 14.1072 -#ifndef PNG_NO_STDIO
 14.1073 -#  define PNG_TIME_RFC1123_SUPPORTED
 14.1074 -#endif
 14.1075 -
 14.1076 -/* This adds extra functions in pngget.c for accessing data from the
 14.1077 - * info pointer (added in version 0.99)
 14.1078 - * png_get_image_width()
 14.1079 - * png_get_image_height()
 14.1080 - * png_get_bit_depth()
 14.1081 - * png_get_color_type()
 14.1082 - * png_get_compression_type()
 14.1083 - * png_get_filter_type()
 14.1084 - * png_get_interlace_type()
 14.1085 - * png_get_pixel_aspect_ratio()
 14.1086 - * png_get_pixels_per_meter()
 14.1087 - * png_get_x_offset_pixels()
 14.1088 - * png_get_y_offset_pixels()
 14.1089 - * png_get_x_offset_microns()
 14.1090 - * png_get_y_offset_microns()
 14.1091 - */
 14.1092 -#if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)
 14.1093 -#  define PNG_EASY_ACCESS_SUPPORTED
 14.1094 -#endif
 14.1095 -
 14.1096 -/* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0
 14.1097 - * and removed from version 1.2.20.  The following will be removed
 14.1098 - * from libpng-1.4.0
 14.1099 -*/
 14.1100 -
 14.1101 -#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_OPTIMIZED_CODE)
 14.1102 -#  ifndef PNG_OPTIMIZED_CODE_SUPPORTED
 14.1103 -#    define PNG_OPTIMIZED_CODE_SUPPORTED
 14.1104 -#  endif
 14.1105 -#endif
 14.1106 -
 14.1107 -#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
 14.1108 -#  ifndef PNG_ASSEMBLER_CODE_SUPPORTED
 14.1109 -#    define PNG_ASSEMBLER_CODE_SUPPORTED
 14.1110 -#  endif
 14.1111 -
 14.1112 -#  if defined(__GNUC__) && defined(__x86_64__) && (__GNUC__ < 4)
 14.1113 -     /* work around 64-bit gcc compiler bugs in gcc-3.x */
 14.1114 -#    if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
 14.1115 -#      define PNG_NO_MMX_CODE
 14.1116 -#    endif
 14.1117 -#  endif
 14.1118 -
 14.1119 -#  if defined(__APPLE__)
 14.1120 -#    if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
 14.1121 -#      define PNG_NO_MMX_CODE
 14.1122 -#    endif
 14.1123 -#  endif
 14.1124 -
 14.1125 -#  if (defined(__MWERKS__) && ((__MWERKS__ < 0x0900) || macintosh))
 14.1126 -#    if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
 14.1127 -#      define PNG_NO_MMX_CODE
 14.1128 -#    endif
 14.1129 -#  endif
 14.1130 -
 14.1131 -#  if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
 14.1132 -#    define PNG_MMX_CODE_SUPPORTED
 14.1133 -#  endif
 14.1134 -
 14.1135 -#endif
 14.1136 -/* end of obsolete code to be removed from libpng-1.4.0 */
 14.1137 -
 14.1138 -#if !defined(PNG_1_0_X)
 14.1139 -#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
 14.1140 -#  define PNG_USER_MEM_SUPPORTED
 14.1141 -#endif
 14.1142 -#endif /* PNG_1_0_X */
 14.1143 -
 14.1144 -/* Added at libpng-1.2.6 */
 14.1145 -#if !defined(PNG_1_0_X)
 14.1146 -#ifndef PNG_SET_USER_LIMITS_SUPPORTED
 14.1147 -#if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED)
 14.1148 -#  define PNG_SET_USER_LIMITS_SUPPORTED
 14.1149 -#endif
 14.1150 -#endif
 14.1151 -#endif /* PNG_1_0_X */
 14.1152 -
 14.1153 -/* Added at libpng-1.0.16 and 1.2.6.  To accept all valid PNGS no matter
 14.1154 - * how large, set these limits to 0x7fffffffL
 14.1155 - */
 14.1156 -#ifndef PNG_USER_WIDTH_MAX
 14.1157 -#  define PNG_USER_WIDTH_MAX 1000000L
 14.1158 -#endif
 14.1159 -#ifndef PNG_USER_HEIGHT_MAX
 14.1160 -#  define PNG_USER_HEIGHT_MAX 1000000L
 14.1161 -#endif
 14.1162 -
 14.1163 -/* Added at libpng-1.2.34 and 1.4.0 */
 14.1164 -#ifndef PNG_STRING_NEWLINE
 14.1165 -#define PNG_STRING_NEWLINE "\n"
 14.1166 -#endif
 14.1167 -
 14.1168 -/* These are currently experimental features, define them if you want */
 14.1169 -
 14.1170 -/* very little testing */
 14.1171 -/*
 14.1172 -#ifdef PNG_READ_SUPPORTED
 14.1173 -#  ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
 14.1174 -#    define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
 14.1175 -#  endif
 14.1176 -#endif
 14.1177 -*/
 14.1178 -
 14.1179 -/* This is only for PowerPC big-endian and 680x0 systems */
 14.1180 -/* some testing */
 14.1181 -/*
 14.1182 -#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
 14.1183 -#  define PNG_READ_BIG_ENDIAN_SUPPORTED
 14.1184 -#endif
 14.1185 -*/
 14.1186 -
 14.1187 -/* Buggy compilers (e.g., gcc 2.7.2.2) need this */
 14.1188 -/*
 14.1189 -#define PNG_NO_POINTER_INDEXING
 14.1190 -*/
 14.1191 -
 14.1192 -/* These functions are turned off by default, as they will be phased out. */
 14.1193 -/*
 14.1194 -#define  PNG_USELESS_TESTS_SUPPORTED
 14.1195 -#define  PNG_CORRECT_PALETTE_SUPPORTED
 14.1196 -*/
 14.1197 -
 14.1198 -/* Any chunks you are not interested in, you can undef here.  The
 14.1199 - * ones that allocate memory may be expecially important (hIST,
 14.1200 - * tEXt, zTXt, tRNS, pCAL).  Others will just save time and make png_info
 14.1201 - * a bit smaller.
 14.1202 - */
 14.1203 -
 14.1204 -#if defined(PNG_READ_SUPPORTED) && \
 14.1205 -    !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
 14.1206 -    !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
 14.1207 -#  define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
 14.1208 -#endif
 14.1209 -
 14.1210 -#if defined(PNG_WRITE_SUPPORTED) && \
 14.1211 -    !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
 14.1212 -    !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
 14.1213 -#  define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
 14.1214 -#endif
 14.1215 -
 14.1216 -#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
 14.1217 -
 14.1218 -#ifdef PNG_NO_READ_TEXT
 14.1219 -#  define PNG_NO_READ_iTXt
 14.1220 -#  define PNG_NO_READ_tEXt
 14.1221 -#  define PNG_NO_READ_zTXt
 14.1222 -#endif
 14.1223 -#ifndef PNG_NO_READ_bKGD
 14.1224 -#  define PNG_READ_bKGD_SUPPORTED
 14.1225 -#  define PNG_bKGD_SUPPORTED
 14.1226 -#endif
 14.1227 -#ifndef PNG_NO_READ_cHRM
 14.1228 -#  define PNG_READ_cHRM_SUPPORTED
 14.1229 -#  define PNG_cHRM_SUPPORTED
 14.1230 -#endif
 14.1231 -#ifndef PNG_NO_READ_gAMA
 14.1232 -#  define PNG_READ_gAMA_SUPPORTED
 14.1233 -#  define PNG_gAMA_SUPPORTED
 14.1234 -#endif
 14.1235 -#ifndef PNG_NO_READ_hIST
 14.1236 -#  define PNG_READ_hIST_SUPPORTED
 14.1237 -#  define PNG_hIST_SUPPORTED
 14.1238 -#endif
 14.1239 -#ifndef PNG_NO_READ_iCCP
 14.1240 -#  define PNG_READ_iCCP_SUPPORTED
 14.1241 -#  define PNG_iCCP_SUPPORTED
 14.1242 -#endif
 14.1243 -#ifndef PNG_NO_READ_iTXt
 14.1244 -#  ifndef PNG_READ_iTXt_SUPPORTED
 14.1245 -#    define PNG_READ_iTXt_SUPPORTED
 14.1246 -#  endif
 14.1247 -#  ifndef PNG_iTXt_SUPPORTED
 14.1248 -#    define PNG_iTXt_SUPPORTED
 14.1249 -#  endif
 14.1250 -#endif
 14.1251 -#ifndef PNG_NO_READ_oFFs
 14.1252 -#  define PNG_READ_oFFs_SUPPORTED
 14.1253 -#  define PNG_oFFs_SUPPORTED
 14.1254 -#endif
 14.1255 -#ifndef PNG_NO_READ_pCAL
 14.1256 -#  define PNG_READ_pCAL_SUPPORTED
 14.1257 -#  define PNG_pCAL_SUPPORTED
 14.1258 -#endif
 14.1259 -#ifndef PNG_NO_READ_sCAL
 14.1260 -#  define PNG_READ_sCAL_SUPPORTED
 14.1261 -#  define PNG_sCAL_SUPPORTED
 14.1262 -#endif
 14.1263 -#ifndef PNG_NO_READ_pHYs
 14.1264 -#  define PNG_READ_pHYs_SUPPORTED
 14.1265 -#  define PNG_pHYs_SUPPORTED
 14.1266 -#endif
 14.1267 -#ifndef PNG_NO_READ_sBIT
 14.1268 -#  define PNG_READ_sBIT_SUPPORTED
 14.1269 -#  define PNG_sBIT_SUPPORTED
 14.1270 -#endif
 14.1271 -#ifndef PNG_NO_READ_sPLT
 14.1272 -#  define PNG_READ_sPLT_SUPPORTED
 14.1273 -#  define PNG_sPLT_SUPPORTED
 14.1274 -#endif
 14.1275 -#ifndef PNG_NO_READ_sRGB
 14.1276 -#  define PNG_READ_sRGB_SUPPORTED
 14.1277 -#  define PNG_sRGB_SUPPORTED
 14.1278 -#endif
 14.1279 -#ifndef PNG_NO_READ_tEXt
 14.1280 -#  define PNG_READ_tEXt_SUPPORTED
 14.1281 -#  define PNG_tEXt_SUPPORTED
 14.1282 -#endif
 14.1283 -#ifndef PNG_NO_READ_tIME
 14.1284 -#  define PNG_READ_tIME_SUPPORTED
 14.1285 -#  define PNG_tIME_SUPPORTED
 14.1286 -#endif
 14.1287 -#ifndef PNG_NO_READ_tRNS
 14.1288 -#  define PNG_READ_tRNS_SUPPORTED
 14.1289 -#  define PNG_tRNS_SUPPORTED
 14.1290 -#endif
 14.1291 -#ifndef PNG_NO_READ_zTXt
 14.1292 -#  define PNG_READ_zTXt_SUPPORTED
 14.1293 -#  define PNG_zTXt_SUPPORTED
 14.1294 -#endif
 14.1295 -#ifndef PNG_NO_READ_OPT_PLTE
 14.1296 -#  define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
 14.1297 -#endif                      /* optional PLTE chunk in RGB and RGBA images */
 14.1298 -#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
 14.1299 -    defined(PNG_READ_zTXt_SUPPORTED)
 14.1300 -#  define PNG_READ_TEXT_SUPPORTED
 14.1301 -#  define PNG_TEXT_SUPPORTED
 14.1302 -#endif
 14.1303 -
 14.1304 -#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
 14.1305 -
 14.1306 -#ifndef PNG_NO_READ_UNKNOWN_CHUNKS
 14.1307 -#  define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
 14.1308 -#  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
 14.1309 -#    define PNG_UNKNOWN_CHUNKS_SUPPORTED
 14.1310 -#  endif
 14.1311 -#endif
 14.1312 -#if !defined(PNG_NO_READ_USER_CHUNKS) && \
 14.1313 -     defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
 14.1314 -#  define PNG_READ_USER_CHUNKS_SUPPORTED
 14.1315 -#  define PNG_USER_CHUNKS_SUPPORTED
 14.1316 -#  ifdef PNG_NO_READ_UNKNOWN_CHUNKS
 14.1317 -#    undef PNG_NO_READ_UNKNOWN_CHUNKS
 14.1318 -#  endif
 14.1319 -#  ifdef PNG_NO_HANDLE_AS_UNKNOWN
 14.1320 -#    undef PNG_NO_HANDLE_AS_UNKNOWN
 14.1321 -#  endif
 14.1322 -#endif
 14.1323 -
 14.1324 -#ifndef PNG_NO_HANDLE_AS_UNKNOWN
 14.1325 -#  ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
 14.1326 -#    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
 14.1327 -#  endif
 14.1328 -#endif
 14.1329 -
 14.1330 -#ifdef PNG_WRITE_SUPPORTED
 14.1331 -#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
 14.1332 -
 14.1333 -#ifdef PNG_NO_WRITE_TEXT
 14.1334 -#  define PNG_NO_WRITE_iTXt
 14.1335 -#  define PNG_NO_WRITE_tEXt
 14.1336 -#  define PNG_NO_WRITE_zTXt
 14.1337 -#endif
 14.1338 -#ifndef PNG_NO_WRITE_bKGD
 14.1339 -#  define PNG_WRITE_bKGD_SUPPORTED
 14.1340 -#  ifndef PNG_bKGD_SUPPORTED
 14.1341 -#    define PNG_bKGD_SUPPORTED
 14.1342 -#  endif
 14.1343 -#endif
 14.1344 -#ifndef PNG_NO_WRITE_cHRM
 14.1345 -#  define PNG_WRITE_cHRM_SUPPORTED
 14.1346 -#  ifndef PNG_cHRM_SUPPORTED
 14.1347 -#    define PNG_cHRM_SUPPORTED
 14.1348 -#  endif
 14.1349 -#endif
 14.1350 -#ifndef PNG_NO_WRITE_gAMA
 14.1351 -#  define PNG_WRITE_gAMA_SUPPORTED
 14.1352 -#  ifndef PNG_gAMA_SUPPORTED
 14.1353 -#    define PNG_gAMA_SUPPORTED
 14.1354 -#  endif
 14.1355 -#endif
 14.1356 -#ifndef PNG_NO_WRITE_hIST
 14.1357 -#  define PNG_WRITE_hIST_SUPPORTED
 14.1358 -#  ifndef PNG_hIST_SUPPORTED
 14.1359 -#    define PNG_hIST_SUPPORTED
 14.1360 -#  endif
 14.1361 -#endif
 14.1362 -#ifndef PNG_NO_WRITE_iCCP
 14.1363 -#  define PNG_WRITE_iCCP_SUPPORTED
 14.1364 -#  ifndef PNG_iCCP_SUPPORTED
 14.1365 -#    define PNG_iCCP_SUPPORTED
 14.1366 -#  endif
 14.1367 -#endif
 14.1368 -#ifndef PNG_NO_WRITE_iTXt
 14.1369 -#  ifndef PNG_WRITE_iTXt_SUPPORTED
 14.1370 -#    define PNG_WRITE_iTXt_SUPPORTED
 14.1371 -#  endif
 14.1372 -#  ifndef PNG_iTXt_SUPPORTED
 14.1373 -#    define PNG_iTXt_SUPPORTED
 14.1374 -#  endif
 14.1375 -#endif
 14.1376 -#ifndef PNG_NO_WRITE_oFFs
 14.1377 -#  define PNG_WRITE_oFFs_SUPPORTED
 14.1378 -#  ifndef PNG_oFFs_SUPPORTED
 14.1379 -#    define PNG_oFFs_SUPPORTED
 14.1380 -#  endif
 14.1381 -#endif
 14.1382 -#ifndef PNG_NO_WRITE_pCAL
 14.1383 -#  define PNG_WRITE_pCAL_SUPPORTED
 14.1384 -#  ifndef PNG_pCAL_SUPPORTED
 14.1385 -#    define PNG_pCAL_SUPPORTED
 14.1386 -#  endif
 14.1387 -#endif
 14.1388 -#ifndef PNG_NO_WRITE_sCAL
 14.1389 -#  define PNG_WRITE_sCAL_SUPPORTED
 14.1390 -#  ifndef PNG_sCAL_SUPPORTED
 14.1391 -#    define PNG_sCAL_SUPPORTED
 14.1392 -#  endif
 14.1393 -#endif
 14.1394 -#ifndef PNG_NO_WRITE_pHYs
 14.1395 -#  define PNG_WRITE_pHYs_SUPPORTED
 14.1396 -#  ifndef PNG_pHYs_SUPPORTED
 14.1397 -#    define PNG_pHYs_SUPPORTED
 14.1398 -#  endif
 14.1399 -#endif
 14.1400 -#ifndef PNG_NO_WRITE_sBIT
 14.1401 -#  define PNG_WRITE_sBIT_SUPPORTED
 14.1402 -#  ifndef PNG_sBIT_SUPPORTED
 14.1403 -#    define PNG_sBIT_SUPPORTED
 14.1404 -#  endif
 14.1405 -#endif
 14.1406 -#ifndef PNG_NO_WRITE_sPLT
 14.1407 -#  define PNG_WRITE_sPLT_SUPPORTED
 14.1408 -#  ifndef PNG_sPLT_SUPPORTED
 14.1409 -#    define PNG_sPLT_SUPPORTED
 14.1410 -#  endif
 14.1411 -#endif
 14.1412 -#ifndef PNG_NO_WRITE_sRGB
 14.1413 -#  define PNG_WRITE_sRGB_SUPPORTED
 14.1414 -#  ifndef PNG_sRGB_SUPPORTED
 14.1415 -#    define PNG_sRGB_SUPPORTED
 14.1416 -#  endif
 14.1417 -#endif
 14.1418 -#ifndef PNG_NO_WRITE_tEXt
 14.1419 -#  define PNG_WRITE_tEXt_SUPPORTED
 14.1420 -#  ifndef PNG_tEXt_SUPPORTED
 14.1421 -#    define PNG_tEXt_SUPPORTED
 14.1422 -#  endif
 14.1423 -#endif
 14.1424 -#ifndef PNG_NO_WRITE_tIME
 14.1425 -#  define PNG_WRITE_tIME_SUPPORTED
 14.1426 -#  ifndef PNG_tIME_SUPPORTED
 14.1427 -#    define PNG_tIME_SUPPORTED
 14.1428 -#  endif
 14.1429 -#endif
 14.1430 -#ifndef PNG_NO_WRITE_tRNS
 14.1431 -#  define PNG_WRITE_tRNS_SUPPORTED
 14.1432 -#  ifndef PNG_tRNS_SUPPORTED
 14.1433 -#    define PNG_tRNS_SUPPORTED
 14.1434 -#  endif
 14.1435 -#endif
 14.1436 -#ifndef PNG_NO_WRITE_zTXt
 14.1437 -#  define PNG_WRITE_zTXt_SUPPORTED
 14.1438 -#  ifndef PNG_zTXt_SUPPORTED
 14.1439 -#    define PNG_zTXt_SUPPORTED
 14.1440 -#  endif
 14.1441 -#endif
 14.1442 -#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
 14.1443 -    defined(PNG_WRITE_zTXt_SUPPORTED)
 14.1444 -#  define PNG_WRITE_TEXT_SUPPORTED
 14.1445 -#  ifndef PNG_TEXT_SUPPORTED
 14.1446 -#    define PNG_TEXT_SUPPORTED
 14.1447 -#  endif
 14.1448 -#endif
 14.1449 -
 14.1450 -#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
 14.1451 -
 14.1452 -#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
 14.1453 -#  define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
 14.1454 -#  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
 14.1455 -#    define PNG_UNKNOWN_CHUNKS_SUPPORTED
 14.1456 -#  endif
 14.1457 -#endif
 14.1458 -
 14.1459 -#ifndef PNG_NO_HANDLE_AS_UNKNOWN
 14.1460 -#  ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
 14.1461 -#    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
 14.1462 -#  endif
 14.1463 -#endif
 14.1464 -#endif /* PNG_WRITE_SUPPORTED */
 14.1465 -
 14.1466 -/* Turn this off to disable png_read_png() and
 14.1467 - * png_write_png() and leave the row_pointers member
 14.1468 - * out of the info structure.
 14.1469 - */
 14.1470 -#ifndef PNG_NO_INFO_IMAGE
 14.1471 -#  define PNG_INFO_IMAGE_SUPPORTED
 14.1472 -#endif
 14.1473 -
 14.1474 -/* need the time information for reading tIME chunks */
 14.1475 -#if defined(PNG_tIME_SUPPORTED)
 14.1476 -#  if !defined(_WIN32_WCE)
 14.1477 -     /* "time.h" functions are not supported on WindowsCE */
 14.1478 -#    include <time.h>
 14.1479 +#ifndef PNG_CONST
 14.1480 +#  ifndef PNG_NO_CONST
 14.1481 +#    define PNG_CONST const
 14.1482 +#  else
 14.1483 +#    define PNG_CONST
 14.1484  #  endif
 14.1485  #endif
 14.1486  
 14.1487 @@ -1136,28 +434,29 @@
 14.1488   * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
 14.1489   * don't have to be exactly that size.  Some compilers dislike passing
 14.1490   * unsigned shorts as function parameters, so you may be better off using
 14.1491 - * unsigned int for png_uint_16.  Likewise, for 64-bit systems, you may
 14.1492 - * want to have unsigned int for png_uint_32 instead of unsigned long.
 14.1493 + * unsigned int for png_uint_16.
 14.1494   */
 14.1495  
 14.1496 +#if defined(INT_MAX) && (INT_MAX > 0x7ffffffeL)
 14.1497 +typedef unsigned int png_uint_32;
 14.1498 +typedef int png_int_32;
 14.1499 +#else
 14.1500  typedef unsigned long png_uint_32;
 14.1501  typedef long png_int_32;
 14.1502 +#endif
 14.1503  typedef unsigned short png_uint_16;
 14.1504  typedef short png_int_16;
 14.1505  typedef unsigned char png_byte;
 14.1506  
 14.1507 -/* This is usually size_t.  It is typedef'ed just in case you need it to
 14.1508 -   change (I'm not sure if you will or not, so I thought I'd be safe) */
 14.1509 -#ifdef PNG_SIZE_T
 14.1510 -   typedef PNG_SIZE_T png_size_t;
 14.1511 -#  define png_sizeof(x) png_convert_size(sizeof(x))
 14.1512 +#ifdef PNG_NO_SIZE_T
 14.1513 +typedef unsigned int png_size_t;
 14.1514  #else
 14.1515 -   typedef size_t png_size_t;
 14.1516 -#  define png_sizeof(x) sizeof(x)
 14.1517 +typedef size_t png_size_t;
 14.1518  #endif
 14.1519 +#define png_sizeof(x) (sizeof (x))
 14.1520  
 14.1521  /* The following is needed for medium model support.  It cannot be in the
 14.1522 - * PNG_INTERNAL section.  Needs modification for other compilers besides
 14.1523 + * pngpriv.h header.  Needs modification for other compilers besides
 14.1524   * MSC.  Model independent support declares all arrays and pointers to be
 14.1525   * large using the far keyword.  The zlib version used must also support
 14.1526   * model independent data.  As of version zlib 1.0.4, the necessary changes
 14.1527 @@ -1166,27 +465,28 @@
 14.1528   */
 14.1529  
 14.1530  /* Separate compiler dependencies (problem here is that zlib.h always
 14.1531 -   defines FAR. (SJT) */
 14.1532 + * defines FAR. (SJT)
 14.1533 + */
 14.1534  #ifdef __BORLANDC__
 14.1535  #  if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
 14.1536  #    define LDATA 1
 14.1537  #  else
 14.1538  #    define LDATA 0
 14.1539  #  endif
 14.1540 -   /* GRR:  why is Cygwin in here?  Cygwin is not Borland C... */
 14.1541 +  /* GRR:  why is Cygwin in here?  Cygwin is not Borland C... */
 14.1542  #  if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
 14.1543 -#    define PNG_MAX_MALLOC_64K
 14.1544 +#    define PNG_MAX_MALLOC_64K /* only used in build */
 14.1545  #    if (LDATA != 1)
 14.1546  #      ifndef FAR
 14.1547  #        define FAR __far
 14.1548  #      endif
 14.1549  #      define USE_FAR_KEYWORD
 14.1550  #    endif   /* LDATA != 1 */
 14.1551 -     /* Possibly useful for moving data out of default segment.
 14.1552 -      * Uncomment it if you want. Could also define FARDATA as
 14.1553 -      * const if your compiler supports it. (SJT)
 14.1554 -#    define FARDATA FAR
 14.1555 -      */
 14.1556 +         /* Possibly useful for moving data out of default segment.
 14.1557 +          * Uncomment it if you want. Could also define FARDATA as
 14.1558 +          * const if your compiler supports it. (SJT)
 14.1559 +#        define FARDATA FAR
 14.1560 +          */
 14.1561  #  endif  /* __WIN32__, __FLAT__, __CYGWIN__ */
 14.1562  #endif   /* __BORLANDC__ */
 14.1563  
 14.1564 @@ -1197,8 +497,8 @@
 14.1565   */
 14.1566  
 14.1567  /* MSC Medium model */
 14.1568 -#if defined(FAR)
 14.1569 -#  if defined(M_I86MM)
 14.1570 +#ifdef FAR
 14.1571 +#  ifdef M_I86MM
 14.1572  #    define USE_FAR_KEYWORD
 14.1573  #    define FARDATA FAR
 14.1574  #    include <dos.h>
 14.1575 @@ -1216,30 +516,37 @@
 14.1576  #endif
 14.1577  
 14.1578  /* Typedef for floating-point numbers that are converted
 14.1579 -   to fixed-point with a multiple of 100,000, e.g., int_gamma */
 14.1580 + * to fixed-point with a multiple of 100,000, e.g., gamma
 14.1581 + */
 14.1582  typedef png_int_32 png_fixed_point;
 14.1583  
 14.1584  /* Add typedefs for pointers */
 14.1585 -typedef void            FAR * png_voidp;
 14.1586 -typedef png_byte        FAR * png_bytep;
 14.1587 -typedef png_uint_32     FAR * png_uint_32p;
 14.1588 -typedef png_int_32      FAR * png_int_32p;
 14.1589 -typedef png_uint_16     FAR * png_uint_16p;
 14.1590 -typedef png_int_16      FAR * png_int_16p;
 14.1591 -typedef PNG_CONST char  FAR * png_const_charp;
 14.1592 -typedef char            FAR * png_charp;
 14.1593 -typedef png_fixed_point FAR * png_fixed_point_p;
 14.1594 +typedef void                      FAR * png_voidp;
 14.1595 +typedef PNG_CONST void            FAR * png_const_voidp;
 14.1596 +typedef png_byte                  FAR * png_bytep;
 14.1597 +typedef PNG_CONST png_byte        FAR * png_const_bytep;
 14.1598 +typedef png_uint_32               FAR * png_uint_32p;
 14.1599 +typedef PNG_CONST png_uint_32     FAR * png_const_uint_32p;
 14.1600 +typedef png_int_32                FAR * png_int_32p;
 14.1601 +typedef PNG_CONST png_int_32      FAR * png_const_int_32p;
 14.1602 +typedef png_uint_16               FAR * png_uint_16p;
 14.1603 +typedef PNG_CONST png_uint_16     FAR * png_const_uint_16p;
 14.1604 +typedef png_int_16                FAR * png_int_16p;
 14.1605 +typedef PNG_CONST png_int_16      FAR * png_const_int_16p;
 14.1606 +typedef char                      FAR * png_charp;
 14.1607 +typedef PNG_CONST char            FAR * png_const_charp;
 14.1608 +typedef png_fixed_point           FAR * png_fixed_point_p;
 14.1609 +typedef PNG_CONST png_fixed_point FAR * png_const_fixed_point_p;
 14.1610 +typedef png_size_t                FAR * png_size_tp;
 14.1611 +typedef PNG_CONST png_size_t      FAR * png_const_size_tp;
 14.1612  
 14.1613 -#ifndef PNG_NO_STDIO
 14.1614 -#if defined(_WIN32_WCE)
 14.1615 -typedef HANDLE                png_FILE_p;
 14.1616 -#else
 14.1617 -typedef FILE                * png_FILE_p;
 14.1618 -#endif
 14.1619 +#ifdef PNG_STDIO_SUPPORTED
 14.1620 +typedef FILE            * png_FILE_p;
 14.1621  #endif
 14.1622  
 14.1623  #ifdef PNG_FLOATING_POINT_SUPPORTED
 14.1624 -typedef double          FAR * png_doublep;
 14.1625 +typedef double           FAR * png_doublep;
 14.1626 +typedef PNG_CONST double FAR * png_const_doublep;
 14.1627  #endif
 14.1628  
 14.1629  /* Pointers to pointers; i.e. arrays */
 14.1630 @@ -1258,251 +565,32 @@
 14.1631  /* Pointers to pointers to pointers; i.e., pointer to array */
 14.1632  typedef char            FAR * FAR * FAR * png_charppp;
 14.1633  
 14.1634 -#if defined(PNG_1_0_X) || defined(PNG_1_2_X)
 14.1635 -/* SPC -  Is this stuff deprecated? */
 14.1636 -/* It'll be removed as of libpng-1.4.0 - GR-P */
 14.1637 -/* libpng typedefs for types in zlib. If zlib changes
 14.1638 - * or another compression library is used, then change these.
 14.1639 - * Eliminates need to change all the source files.
 14.1640 +/* png_alloc_size_t is guaranteed to be no smaller than png_size_t,
 14.1641 + * and no smaller than png_uint_32.  Casts from png_size_t or png_uint_32
 14.1642 + * to png_alloc_size_t are not necessary; in fact, it is recommended
 14.1643 + * not to use them at all so that the compiler can complain when something
 14.1644 + * turns out to be problematic.
 14.1645 + * Casts in the other direction (from png_alloc_size_t to png_size_t or
 14.1646 + * png_uint_32) should be explicitly applied; however, we do not expect
 14.1647 + * to encounter practical situations that require such conversions.
 14.1648   */
 14.1649 -typedef charf *         png_zcharp;
 14.1650 -typedef charf * FAR *   png_zcharpp;
 14.1651 -typedef z_stream FAR *  png_zstreamp;
 14.1652 -#endif /* (PNG_1_0_X) || defined(PNG_1_2_X) */
 14.1653 -
 14.1654 -/*
 14.1655 - * Define PNG_BUILD_DLL if the module being built is a Windows
 14.1656 - * LIBPNG DLL.
 14.1657 - *
 14.1658 - * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
 14.1659 - * It is equivalent to Microsoft predefined macro _DLL that is
 14.1660 - * automatically defined when you compile using the share
 14.1661 - * version of the CRT (C Run-Time library)
 14.1662 - *
 14.1663 - * The cygwin mods make this behavior a little different:
 14.1664 - * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
 14.1665 - * Define PNG_STATIC if you are building a static library for use with cygwin,
 14.1666 - *   -or- if you are building an application that you want to link to the
 14.1667 - *   static library.
 14.1668 - * PNG_USE_DLL is defined by default (no user action needed) unless one of
 14.1669 - *   the other flags is defined.
 14.1670 - */
 14.1671 -
 14.1672 -#if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
 14.1673 -#  define PNG_DLL
 14.1674 -#endif
 14.1675 -/* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
 14.1676 - * When building a static lib, default to no GLOBAL ARRAYS, but allow
 14.1677 - * command-line override
 14.1678 - */
 14.1679 -#if defined(__CYGWIN__)
 14.1680 -#  if !defined(PNG_STATIC)
 14.1681 -#    if defined(PNG_USE_GLOBAL_ARRAYS)
 14.1682 -#      undef PNG_USE_GLOBAL_ARRAYS
 14.1683 -#    endif
 14.1684 -#    if !defined(PNG_USE_LOCAL_ARRAYS)
 14.1685 -#      define PNG_USE_LOCAL_ARRAYS
 14.1686 -#    endif
 14.1687 +#if defined(__TURBOC__) && !defined(__FLAT__)
 14.1688 +   typedef unsigned long png_alloc_size_t;
 14.1689 +#else
 14.1690 +#  if defined(_MSC_VER) && defined(MAXSEG_64K)
 14.1691 +     typedef unsigned long    png_alloc_size_t;
 14.1692  #  else
 14.1693 -#    if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
 14.1694 -#      if defined(PNG_USE_GLOBAL_ARRAYS)
 14.1695 -#        undef PNG_USE_GLOBAL_ARRAYS
 14.1696 -#      endif
 14.1697 -#    endif
 14.1698 -#  endif
 14.1699 -#  if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
 14.1700 -#    define PNG_USE_LOCAL_ARRAYS
 14.1701 -#  endif
 14.1702 -#endif
 14.1703 -
 14.1704 -/* Do not use global arrays (helps with building DLL's)
 14.1705 - * They are no longer used in libpng itself, since version 1.0.5c,
 14.1706 - * but might be required for some pre-1.0.5c applications.
 14.1707 - */
 14.1708 -#if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
 14.1709 -#  if defined(PNG_NO_GLOBAL_ARRAYS) || \
 14.1710 -      (defined(__GNUC__) && defined(PNG_DLL)) || defined(_MSC_VER)
 14.1711 -#    define PNG_USE_LOCAL_ARRAYS
 14.1712 -#  else
 14.1713 -#    define PNG_USE_GLOBAL_ARRAYS
 14.1714 -#  endif
 14.1715 -#endif
 14.1716 -
 14.1717 -#if defined(__CYGWIN__)
 14.1718 -#  undef PNGAPI
 14.1719 -#  define PNGAPI __cdecl
 14.1720 -#  undef PNG_IMPEXP
 14.1721 -#  define PNG_IMPEXP
 14.1722 -#endif
 14.1723 -
 14.1724 -/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
 14.1725 - * you may get warnings regarding the linkage of png_zalloc and png_zfree.
 14.1726 - * Don't ignore those warnings; you must also reset the default calling
 14.1727 - * convention in your compiler to match your PNGAPI, and you must build
 14.1728 - * zlib and your applications the same way you build libpng.
 14.1729 - */
 14.1730 -
 14.1731 -#if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
 14.1732 -#  ifndef PNG_NO_MODULEDEF
 14.1733 -#    define PNG_NO_MODULEDEF
 14.1734 -#  endif
 14.1735 -#endif
 14.1736 -
 14.1737 -#if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
 14.1738 -#  define PNG_IMPEXP
 14.1739 -#endif
 14.1740 -
 14.1741 -#if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
 14.1742 -    (( defined(_Windows) || defined(_WINDOWS) || \
 14.1743 -       defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
 14.1744 -
 14.1745 -#  ifndef PNGAPI
 14.1746 -#     if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
 14.1747 -#        define PNGAPI __cdecl
 14.1748 -#     else
 14.1749 -#        define PNGAPI _cdecl
 14.1750 -#     endif
 14.1751 -#  endif
 14.1752 -
 14.1753 -#  if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
 14.1754 -       0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
 14.1755 -#     define PNG_IMPEXP
 14.1756 -#  endif
 14.1757 -
 14.1758 -#  if !defined(PNG_IMPEXP)
 14.1759 -
 14.1760 -#     define PNG_EXPORT_TYPE1(type,symbol)  PNG_IMPEXP type PNGAPI symbol
 14.1761 -#     define PNG_EXPORT_TYPE2(type,symbol)  type PNG_IMPEXP PNGAPI symbol
 14.1762 -
 14.1763 -      /* Borland/Microsoft */
 14.1764 -#     if defined(_MSC_VER) || defined(__BORLANDC__)
 14.1765 -#        if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
 14.1766 -#           define PNG_EXPORT PNG_EXPORT_TYPE1
 14.1767 -#        else
 14.1768 -#           define PNG_EXPORT PNG_EXPORT_TYPE2
 14.1769 -#           if defined(PNG_BUILD_DLL)
 14.1770 -#              define PNG_IMPEXP __export
 14.1771 -#           else
 14.1772 -#              define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
 14.1773 -                                                 VC++ */
 14.1774 -#           endif                             /* Exists in Borland C++ for
 14.1775 -                                                 C++ classes (== huge) */
 14.1776 -#        endif
 14.1777 -#     endif
 14.1778 -
 14.1779 -#     if !defined(PNG_IMPEXP)
 14.1780 -#        if defined(PNG_BUILD_DLL)
 14.1781 -#           define PNG_IMPEXP __declspec(dllexport)
 14.1782 -#        else
 14.1783 -#           define PNG_IMPEXP __declspec(dllimport)
 14.1784 -#        endif
 14.1785 -#     endif
 14.1786 -#  endif  /* PNG_IMPEXP */
 14.1787 -#else /* !(DLL || non-cygwin WINDOWS) */
 14.1788 -#   if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
 14.1789 -#      ifndef PNGAPI
 14.1790 -#         define PNGAPI _System
 14.1791 -#      endif
 14.1792 -#   else
 14.1793 -#      if 0 /* ... other platforms, with other meanings */
 14.1794 -#      endif
 14.1795 -#   endif
 14.1796 -#endif
 14.1797 -
 14.1798 -#ifndef PNGAPI
 14.1799 -#  define PNGAPI
 14.1800 -#endif
 14.1801 -#ifndef PNG_IMPEXP
 14.1802 -#  define PNG_IMPEXP
 14.1803 -#endif
 14.1804 -
 14.1805 -#ifdef PNG_BUILDSYMS
 14.1806 -#  ifndef PNG_EXPORT
 14.1807 -#    define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END
 14.1808 -#  endif
 14.1809 -#  ifdef PNG_USE_GLOBAL_ARRAYS
 14.1810 -#    ifndef PNG_EXPORT_VAR
 14.1811 -#      define PNG_EXPORT_VAR(type) PNG_DATA_EXPORT
 14.1812 +     /* This is an attempt to detect an old Windows system where (int) is
 14.1813 +      * actually 16 bits, in that case png_malloc must have an argument with a
 14.1814 +      * bigger size to accomodate the requirements of the library.
 14.1815 +      */
 14.1816 +#    if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) && \
 14.1817 +        (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL)
 14.1818 +       typedef DWORD         png_alloc_size_t;
 14.1819 +#    else
 14.1820 +       typedef png_size_t    png_alloc_size_t;
 14.1821  #    endif
 14.1822  #  endif
 14.1823  #endif
 14.1824  
 14.1825 -#ifndef PNG_EXPORT
 14.1826 -#  define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
 14.1827 -#endif
 14.1828 -
 14.1829 -#ifdef PNG_USE_GLOBAL_ARRAYS
 14.1830 -#  ifndef PNG_EXPORT_VAR
 14.1831 -#    define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
 14.1832 -#  endif
 14.1833 -#endif
 14.1834 -
 14.1835 -/* User may want to use these so they are not in PNG_INTERNAL. Any library
 14.1836 - * functions that are passed far data must be model independent.
 14.1837 - */
 14.1838 -
 14.1839 -#ifndef PNG_ABORT
 14.1840 -#  define PNG_ABORT() abort()
 14.1841 -#endif
 14.1842 -
 14.1843 -#ifdef PNG_SETJMP_SUPPORTED
 14.1844 -#  define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
 14.1845 -#else
 14.1846 -#  define png_jmpbuf(png_ptr) \
 14.1847 -   (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
 14.1848 -#endif
 14.1849 -
 14.1850 -#if defined(USE_FAR_KEYWORD)  /* memory model independent fns */
 14.1851 -/* use this to make far-to-near assignments */
 14.1852 -#  define CHECK   1
 14.1853 -#  define NOCHECK 0
 14.1854 -#  define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
 14.1855 -#  define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
 14.1856 -#  define png_snprintf _fsnprintf   /* Added to v 1.2.19 */
 14.1857 -#  define png_strlen  _fstrlen
 14.1858 -#  define png_memcmp  _fmemcmp    /* SJT: added */
 14.1859 -#  define png_memcpy  _fmemcpy
 14.1860 -#  define png_memset  _fmemset
 14.1861 -#else /* use the usual functions */
 14.1862 -#  define CVT_PTR(ptr)         (ptr)
 14.1863 -#  define CVT_PTR_NOCHECK(ptr) (ptr)
 14.1864 -#  ifndef PNG_NO_SNPRINTF
 14.1865 -#    ifdef _MSC_VER
 14.1866 -#      define png_snprintf _snprintf   /* Added to v 1.2.19 */
 14.1867 -#      define png_snprintf2 _snprintf
 14.1868 -#      define png_snprintf6 _snprintf
 14.1869 -#    else
 14.1870 -#      define png_snprintf snprintf   /* Added to v 1.2.19 */
 14.1871 -#      define png_snprintf2 snprintf
 14.1872 -#      define png_snprintf6 snprintf
 14.1873 -#    endif
 14.1874 -#  else
 14.1875 -     /* You don't have or don't want to use snprintf().  Caution: Using
 14.1876 -      * sprintf instead of snprintf exposes your application to accidental
 14.1877 -      * or malevolent buffer overflows.  If you don't have snprintf()
 14.1878 -      * as a general rule you should provide one (you can get one from
 14.1879 -      * Portable OpenSSH). */
 14.1880 -#    define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
 14.1881 -#    define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
 14.1882 -#    define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
 14.1883 -        sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
 14.1884 -#  endif
 14.1885 -#  define png_strlen  strlen
 14.1886 -#  define png_memcmp  memcmp      /* SJT: added */
 14.1887 -#  define png_memcpy  memcpy
 14.1888 -#  define png_memset  memset
 14.1889 -#endif
 14.1890 -/* End of memory model independent support */
 14.1891 -
 14.1892 -/* Just a little check that someone hasn't tried to define something
 14.1893 - * contradictory.
 14.1894 - */
 14.1895 -#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
 14.1896 -#  undef PNG_ZBUF_SIZE
 14.1897 -#  define PNG_ZBUF_SIZE 65536L
 14.1898 -#endif
 14.1899 -
 14.1900 -/* Added at libpng-1.2.8 */
 14.1901 -#endif /* PNG_VERSION_INFO_ONLY */
 14.1902 -
 14.1903  #endif /* PNGCONF_H */
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/VisualC/graphics/include/pnglibconf.h	Mon Jan 02 17:19:13 2012 -0500
    15.3 @@ -0,0 +1,180 @@
    15.4 +/* pnglibconf.h - library build configuration */
    15.5 +
    15.6 +/* libpng version 1.5.7 - December 15, 2011 */
    15.7 +
    15.8 +/* Copyright (c) 1998-2011 Glenn Randers-Pehrson */
    15.9 +
   15.10 +/* This code is released under the libpng license. */
   15.11 +/* For conditions of distribution and use, see the disclaimer */
   15.12 +/* and license in png.h */
   15.13 +
   15.14 +/* pnglibconf.h */
   15.15 +/* Machine generated file: DO NOT EDIT */
   15.16 +/* Derived from: scripts/pnglibconf.dfa */
   15.17 +#ifndef PNGLCONF_H
   15.18 +#define PNGLCONF_H
   15.19 +/* settings */
   15.20