Main Page   Class Hierarchy   Compound List   File List   Compound Members  

png.h

00001 
00002 /* png.h - header file for PNG reference library
00003  *
00004  * libpng version 1.0.5 - October 15, 1999
00005  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
00006  * Copyright (c) 1996, 1997 Andreas Dilger
00007  * Copyright (c) 1998, 1999 Glenn Randers-Pehrson
00008  *
00009  * Authors and maintainers:
00010  *  libpng versions 0.71, May 1995, through 0.89c, May 1996: Guy Schalnat
00011  *  libpng versions 0.90, December 1996, through 0.96, May 1997: Andreas Dilger
00012  *  libpng versions 0.97, January 1998, through 1.0.5 - October 15, 1999: Glenn
00013  *  See also "Contributing Authors", below.
00014  *
00015  * Y2K compliance in libpng:
00016  * =========================
00017  *    
00018  *    October 15, 1999
00019  *    
00020  *    Since the PNG Development group is an ad-hoc body, we can't make
00021  *    an official declaration.
00022  *    
00023  *    This is your unofficial assurance that libpng from version 0.71 and
00024  *    upward through 1.0.5 are Y2K compliant.  It is my belief that earlier
00025  *    versions were also Y2K compliant.
00026  *    
00027  *    Libpng only has three year fields.  One is a 2-byte unsigned integer
00028  *    that will hold years up to 65535.  The other two hold the date in text
00029  *    format, and will hold years up to 9999.
00030  *    
00031  *    The integer is
00032  *        "png_uint_16 year" in png_time_struct.
00033  *    
00034  *    The strings are
00035  *        "png_charp time_buffer" in png_struct and
00036  *        "near_time_buffer", which is a local character string in png.c.
00037  *    
00038  *    There are seven time-related functions:
00039  *        png.c: png_convert_to_rfc_1123() in png.c 
00040  *          (formerly png_convert_to_rfc_1152() in error)
00041  *        png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
00042  *        png_convert_from_time_t() in pngwrite.c
00043  *        png_get_tIME() in pngget.c
00044  *        png_handle_tIME() in pngrutil.c, called in pngread.c
00045  *        png_set_tIME() in pngset.c
00046  *        png_write_tIME() in pngwutil.c, called in pngwrite.c
00047  *    
00048  *    All handle dates properly in a Y2K environment.  The 
00049  *    png_convert_from_time_t() function calls gmtime() to convert from system
00050  *    clock time, which returns (year - 1900), which we properly convert to
00051  *    the full 4-digit year.  There is a possibility that applications using
00052  *    libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
00053  *    function, or that they are incorrectly passing only a 2-digit year
00054  *    instead of "year - 1900" into the png_convert_from_struct_tm() function,
00055  *    but this is not under our control.  The libpng documentation has always
00056  *    stated that it works with 4-digit years, and the APIs have been
00057  *    documented as such.
00058  *    
00059  *    The tIME chunk itself is also Y2K compliant.  It uses a 2-byte unsigned
00060  *    integer to hold the year, and can hold years as large as 65535.
00061  *    
00062  *    zlib, upon which libpng depends, is also Y2K compliant.  It contains
00063  *    no date-related code.
00064  *    
00065  *       Glenn Randers-Pehrson
00066  *       libpng maintainer
00067  *       PNG Development Group
00068  *
00069  * Note about libpng version numbers:
00070  *
00071  *    Due to various miscommunications, unforeseen code incompatibilities
00072  *    and occasional factors outside the authors' control, version numbering
00073  *    on the library has not always been consistent and straightforward.
00074  *    The following table summarizes matters since version 0.89c, which was
00075  *    the first widely used release:
00076  *
00077  *    source                   png.h    png.h   shared-lib
00078  *    version                  string     int   version
00079  *    -------                  ------   -----  ----------
00080  *    0.89c ("1.0 beta 3")     0.89        89  1.0.89
00081  *    0.90  ("1.0 beta 4")     0.90        90  0.90  [should have been 2.0.90]
00082  *    0.95  ("1.0 beta 5")     0.95        95  0.95  [should have been 2.0.95]
00083  *    0.96  ("1.0 beta 6")     0.96        96  0.96  [should have been 2.0.96]
00084  *    0.97b ("1.00.97 beta 7") 1.00.97     97  1.0.1 [should have been 2.0.97]
00085  *    0.97c                    0.97        97  2.0.97
00086  *    0.98                     0.98        98  2.0.98
00087  *    0.99                     0.99        98  2.0.99
00088  *    0.99a-m                  0.99        99  2.0.99
00089  *    1.00                     1.00       100  2.1.0 [100 should be 10000]
00090  *    1.0.0                    1.0.0      100  2.1.0 [100 should be 10000]
00091  *    1.0.1                    1.0.1    10001  2.1.0
00092  *    1.0.1a-e                 1.0.1a-e 10002  2.1.0.1a-e
00093  *    1.0.2                    1.0.2    10002  2.1.0.2
00094  *    1.0.2a-b                 1.0.2a-b 10003  2.1.0.2a-b
00095  *    1.0.3                    1.0.3    10003  2.1.0.3
00096  *    1.0.3a-d                 1.0.3a-d 10004  2.1.0.3a-d
00097  *    1.0.4                    1.0.4    10004  2.1.0.4
00098  *    1.0.4a-f                 1.0.4a-f 10005  2.1.0.4a-f
00099  *    1.0.5                    1.0.5    10005  2.1.0.5
00100  *
00101  *    Henceforth the source version will match the shared-library minor
00102  *    and patch numbers; the shared-library major version number will be
00103  *    used for changes in backward compatibility, as it is intended.  The
00104  *    PNG_PNGLIB_VER macro, which is not used within libpng but is available
00105  *    for applications, is an unsigned integer of the form xyyzz corresponding
00106  *    to the source version x.y.z (leading zeros in y and z).  Internal
00107  *    png-group versions (x.y.z[a-z]) will be given the next higher number.
00108  *
00109  * See libpng.txt or libpng.3 for more information.  The PNG specification
00110  * is available as RFC 2083 <ftp://ftp.uu.net/graphics/png/documents/>
00111  * and as a W3C Recommendation <http://www.w3.org/TR/REC.png.html>
00112  */
00113 
00114 /*
00115  * COPYRIGHT NOTICE:
00116  *
00117  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
00118  * (libpng versions 0.5, May 1995, through 0.89c, May 1996)
00119  * Copyright (c) 1996, 1997 Andreas Dilger
00120  * (libpng versions 0.90, December 1996, through 0.96, May 1997)
00121  * Copyright (c) 1998, 1999 Glenn Randers-Pehrson
00122  * (libpng versions 0.97, January 1998, through 1.0.5, October 15, 1999)
00123  *
00124  * For the purposes of this copyright and license, "Contributing Authors"
00125  * is defined as the following set of individuals:
00126  *
00127  *    John Bowler
00128  *    Kevin Bracey
00129  *    Sam Bushell
00130  *    Andreas Dilger
00131  *    Magnus Holmgren
00132  *    Tom Lane
00133  *    Dave Martindale
00134  *    Glenn Randers-Pehrson
00135  *    Greg Roelofs
00136  *    Guy Eric Schalnat
00137  *    Paul Schmidt
00138  *    Tom Tanner
00139  *    Willem van Schaik
00140  *    Tim Wegner
00141  *
00142  * The PNG Reference Library is supplied "AS IS".  The Contributing Authors
00143  * and Group 42, Inc. disclaim all warranties, expressed or implied,
00144  * including, without limitation, the warranties of merchantability and of
00145  * fitness for any purpose.  The Contributing Authors and Group 42, Inc.
00146  * assume no liability for direct, indirect, incidental, special, exemplary,
00147  * or consequential damages, which may result from the use of the PNG
00148  * Reference Library, even if advised of the possibility of such damage.
00149  *
00150  * Permission is hereby granted to use, copy, modify, and distribute this
00151  * source code, or portions hereof, for any purpose, without fee, subject
00152  * to the following restrictions:
00153  *
00154  * 1. The origin of this source code must not be
00155  *     misrepresented.
00156  *
00157  * 2. Altered versions must be plainly marked as such
00158  *    and must not be misrepresented as being the
00159  *    original source.
00160  *
00161  * 3. This Copyright notice may not be removed or
00162  *    altered from any source or altered source
00163  *    distribution.
00164  *
00165  * The Contributing Authors and Group 42, Inc. specifically permit, without
00166  * fee, and encourage the use of this source code as a component to
00167  * supporting the PNG file format in commercial products.  If you use this
00168  * source code in a product, acknowledgment is not required but would be
00169  * appreciated.
00170  */
00171 
00172 /*
00173  * A "png_get_copyright" function is available, for convenient use in "about"
00174  * boxes and the like:
00175  * 
00176  * printf("%s",png_get_copyright(NULL));
00177  * 
00178  * Also, the PNG logo (in PNG format, of course) is supplied in the
00179  * file "pngnow.png".
00180  */
00181 
00182 /*
00183  * Libpng is OSI Certified Open Source Software.  OSI Certified is a
00184  * certification mark of the Open Source Initiative.
00185  */
00186 
00187 /*
00188  * The contributing authors would like to thank all those who helped
00189  * with testing, bug fixes, and patience.  This wouldn't have been
00190  * possible without all of you.
00191  *
00192  * Thanks to Frank J. T. Wojcik for helping with the documentation.
00193  */
00194 
00195 #ifndef _PNG_H
00196 #define _PNG_H
00197 
00198 /* This is not the place to learn how to use libpng.  The file libpng.txt
00199  * describes how to use libpng, and the file example.c summarizes it
00200  * with some code on which to build.  This file is useful for looking
00201  * at the actual function definitions and structure components.
00202  */
00203 
00204 /* include the compression library's header */
00205 #include "zlib.h"
00206 
00207 /* include all user configurable info */
00208 #include "pngconf.h"
00209 
00210 /* Inhibit C++ name-mangling for libpng functions but not for system calls. */
00211 #ifdef __cplusplus
00212 extern "C" {
00213 #endif /* __cplusplus */
00214 
00215 /* This file is arranged in several sections.  The first section contains
00216  * structure and type definitions.  The second section contains the external
00217  * library functions, while the third has the internal library functions,
00218  * which applications aren't expected to use directly.
00219  */
00220 
00221 /* Version information for png.h - this should match the version in png.c */
00222 #define PNG_LIBPNG_VER_STRING "1.0.5"
00223 
00224 /* Careful here.  At one time, Guy wanted to use 082, but that would be octal.
00225  * We must not include leading zeros.
00226  * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
00227  * version 1.0.0 was mis-numbered 100 instead of 10000).  From
00228  * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=bugfix */
00229 #define PNG_LIBPNG_VER    10005  /* 1.0.5 */
00230 
00231 /* Note to maintainer: update this number in scripts/pngdef.pas as well */
00232 
00233 /* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
00234 #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
00235 /* Version information for C files, stored in png.c.  This had better match
00236  * the version above.
00237  */
00238 extern char png_libpng_ver[12];   /* need room for 99.99.99aa */
00239 
00240 /* Structures to facilitate easy interlacing.  See png.c for more details */
00241 extern int FARDATA png_pass_start[7];
00242 extern int FARDATA png_pass_inc[7];
00243 extern int FARDATA png_pass_ystart[7];
00244 extern int FARDATA png_pass_yinc[7];
00245 extern int FARDATA png_pass_mask[7];
00246 extern int FARDATA png_pass_dsp_mask[7];
00247 /* These aren't currently used.  If you need them, see png.c for more details
00248 extern int FARDATA png_pass_width[7];
00249 extern int FARDATA png_pass_height[7];
00250 */
00251 
00252 #endif /* PNG_NO_EXTERN */
00253 
00254 /* Three color definitions.  The order of the red, green, and blue, (and the
00255  * exact size) is not important, although the size of the fields need to
00256  * be png_byte or png_uint_16 (as defined below).
00257  */
00258 typedef struct png_color_struct
00259 {
00260    png_byte red;
00261    png_byte green;
00262    png_byte blue;
00263 } png_color;
00264 typedef png_color FAR * png_colorp;
00265 typedef png_color FAR * FAR * png_colorpp;
00266 
00267 typedef struct png_color_16_struct
00268 {
00269    png_byte index;    /* used for palette files */
00270    png_uint_16 red;   /* for use in red green blue files */
00271    png_uint_16 green;
00272    png_uint_16 blue;
00273    png_uint_16 gray;  /* for use in grayscale files */
00274 } png_color_16;
00275 typedef png_color_16 FAR * png_color_16p;
00276 typedef png_color_16 FAR * FAR * png_color_16pp;
00277 
00278 typedef struct png_color_8_struct
00279 {
00280    png_byte red;   /* for use in red green blue files */
00281    png_byte green;
00282    png_byte blue;
00283    png_byte gray;  /* for use in grayscale files */
00284    png_byte alpha; /* for alpha channel files */
00285 } png_color_8;
00286 typedef png_color_8 FAR * png_color_8p;
00287 typedef png_color_8 FAR * FAR * png_color_8pp;
00288 
00289 /* png_text holds the text in a PNG file, and whether they are compressed
00290    in the PNG file or not.  The "text" field points to a regular C string. */
00291 typedef struct png_text_struct
00292 {
00293    int compression;        /* compression value, see PNG_TEXT_COMPRESSION_ */
00294    png_charp key;          /* keyword, 1-79 character description of "text" */
00295    png_charp text;         /* comment, may be an empty string (ie "") */
00296    png_size_t text_length; /* length of "text" field */
00297 } png_text;
00298 typedef png_text FAR * png_textp;
00299 typedef png_text FAR * FAR * png_textpp;
00300 
00301 /* Supported compression types for text in PNG files (tEXt, and zTXt).
00302  * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */
00303 #define PNG_TEXT_COMPRESSION_NONE_WR -3
00304 #define PNG_TEXT_COMPRESSION_zTXt_WR -2
00305 #define PNG_TEXT_COMPRESSION_NONE    -1
00306 #define PNG_TEXT_COMPRESSION_zTXt     0
00307 #define PNG_TEXT_COMPRESSION_LAST     1  /* Not a valid value */
00308 
00309 /* png_time is a way to hold the time in an machine independent way.
00310  * Two conversions are provided, both from time_t and struct tm.  There
00311  * is no portable way to convert to either of these structures, as far
00312  * as I know.  If you know of a portable way, send it to me.  As a side
00313  * note - PNG is Year 2000 compliant!
00314  */
00315 typedef struct png_time_struct
00316 {
00317    png_uint_16 year; /* full year, as in, 1995 */
00318    png_byte month;   /* month of year, 1 - 12 */
00319    png_byte day;     /* day of month, 1 - 31 */
00320    png_byte hour;    /* hour of day, 0 - 23 */
00321    png_byte minute;  /* minute of hour, 0 - 59 */
00322    png_byte second;  /* second of minute, 0 - 60 (for leap seconds) */
00323 } png_time;
00324 typedef png_time FAR * png_timep;
00325 typedef png_time FAR * FAR * png_timepp;
00326 
00327 /* png_info is a structure that holds the information in a PNG file so
00328  * that the application can find out the characteristics of the image.
00329  * If you are reading the file, this structure will tell you what is
00330  * in the PNG file.  If you are writing the file, fill in the information
00331  * you want to put into the PNG file, then call png_write_info().
00332  * The names chosen should be very close to the PNG specification, so
00333  * consult that document for information about the meaning of each field.
00334  *
00335  * With libpng < 0.95, it was only possible to directly set and read the
00336  * the values in the png_info_struct, which meant that the contents and
00337  * order of the values had to remain fixed.  With libpng 0.95 and later,
00338  * however, there are now functions that abstract the contents of
00339  * png_info_struct from the application, so this makes it easier to use
00340  * libpng with dynamic libraries, and even makes it possible to use
00341  * libraries that don't have all of the libpng ancillary chunk-handing
00342  * functionality.
00343  *
00344  * In any case, the order of the parameters in png_info_struct should NOT
00345  * be changed for as long as possible to keep compatibility with applications
00346  * that use the old direct-access method with png_info_struct.
00347  */
00348 typedef struct png_info_struct
00349 {
00350    /* the following are necessary for every PNG file */
00351    png_uint_32 width;       /* width of image in pixels (from IHDR) */
00352    png_uint_32 height;      /* height of image in pixels (from IHDR) */
00353    png_uint_32 valid;       /* valid chunk data (see PNG_INFO_ below) */
00354    png_uint_32 rowbytes;    /* bytes needed to hold an untransformed row */
00355    png_colorp palette;      /* array of color values (valid & PNG_INFO_PLTE) */
00356    png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
00357    png_uint_16 num_trans;   /* number of transparent palette color (tRNS) */
00358    png_byte bit_depth;      /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
00359    png_byte color_type;     /* see PNG_COLOR_TYPE_ below (from IHDR) */
00360    png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
00361    png_byte filter_type;    /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
00362    png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
00363 
00364    /* The following is informational only on read, and not used on writes. */
00365    png_byte channels;       /* number of data channels per pixel (1, 3, 4)*/
00366    png_byte pixel_depth;    /* number of bits per pixel */
00367    png_byte spare_byte;     /* to align the data, and for future use */
00368    png_byte signature[8];   /* magic bytes read by libpng from start of file */
00369 
00370    /* The rest of the data is optional.  If you are reading, check the
00371     * valid field to see if the information in these are valid.  If you
00372     * are writing, set the valid field to those chunks you want written,
00373     * and initialize the appropriate fields below.
00374     */
00375 
00376 #if defined(PNG_READ_gAMA_SUPPORTED) || defined(PNG_WRITE_gAMA_SUPPORTED) || \
00377     defined(PNG_READ_GAMMA_SUPPORTED)
00378    /* The gAMA chunk describes the gamma characteristics of the system
00379     * on which the image was created, normally in the range [1.0, 2.5].
00380     * Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
00381     */
00382    float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
00383 #endif /* PNG_READ_gAMA_SUPPORTED || PNG_WRITE_gAMA_SUPPORTED */
00384 
00385 #if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED)
00386     /* GR-P, 0.96a */
00387     /* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
00388    png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */
00389 #endif /* PNG_READ_sRGB_SUPPORTED || PNG_WRITE_sRGB_SUPPORTED */
00390 
00391 #if defined(PNG_READ_tEXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
00392     defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_WRITE_zTXt_SUPPORTED)
00393    /* The tEXt and zTXt chunks contain human-readable textual data in
00394     * uncompressed and compressed forms, respectively.  The data in "text"
00395     * is an array of pointers to uncompressed, null-terminated C strings.
00396     * Each chunk has a keyword that describes the textual data contained
00397     * in that chunk.  Keywords are not required to be unique, and the text
00398     * string may be empty.  Any number of text chunks may be in an image.
00399     */
00400    int num_text; /* number of comments read/to write */
00401    int max_text; /* current size of text array */
00402    png_textp text; /* array of comments read/to write */
00403 #endif /* PNG_READ_OR_WRITE_tEXt_OR_zTXt_SUPPORTED */
00404 #if defined(PNG_READ_tIME_SUPPORTED) || defined(PNG_WRITE_tIME_SUPPORTED)
00405    /* The tIME chunk holds the last time the displayed image data was
00406     * modified.  See the png_time struct for the contents of this struct.
00407     */
00408    png_time mod_time;
00409 #endif /* PNG_READ_tIME_SUPPORTED || PNG_WRITE_tIME_SUPPORTED */
00410 #if defined(PNG_READ_sBIT_SUPPORTED) || defined(PNG_WRITE_sBIT_SUPPORTED)
00411    /* The sBIT chunk specifies the number of significant high-order bits
00412     * in the pixel data.  Values are in the range [1, bit_depth], and are
00413     * only specified for the channels in the pixel data.  The contents of
00414     * the low-order bits is not specified.  Data is valid if
00415     * (valid & PNG_INFO_sBIT) is non-zero.
00416     */
00417    png_color_8 sig_bit; /* significant bits in color channels */
00418 #endif /* PNG_READ_sBIT_SUPPORTED || PNG_WRITE_sBIT_SUPPORTED */
00419 #if defined(PNG_READ_tRNS_SUPPORTED) || defined(PNG_WRITE_tRNS_SUPPORTED) || \
00420     defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
00421    /* The tRNS chunk supplies transparency data for paletted images and
00422     * other image types that don't need a full alpha channel.  There are
00423     * "num_trans" transparency values for a paletted image, stored in the
00424     * same order as the palette colors, starting from index 0.  Values
00425     * for the data are in the range [0, 255], ranging from fully transparent
00426     * to fully opaque, respectively.  For non-paletted images, there is a
00427     * single color specified that should be treated as fully transparent.
00428     * Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
00429     */
00430    png_bytep trans; /* transparent values for paletted image */
00431    png_color_16 trans_values; /* transparent color for non-palette image */
00432 #endif /* PNG_READ_tRNS_SUPPORTED || PNG_WRITE_tRNS_SUPPORTED */
00433 #if defined(PNG_READ_bKGD_SUPPORTED) || defined(PNG_WRITE_bKGD_SUPPORTED) || \
00434     defined(PNG_READ_BACKGROUND_SUPPORTED)
00435    /* The bKGD chunk gives the suggested image background color if the
00436     * display program does not have its own background color and the image
00437     * is needs to composited onto a background before display.  The colors
00438     * in "background" are normally in the same color space/depth as the
00439     * pixel data.  Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
00440     */
00441    png_color_16 background;
00442 #endif /* PNG_READ_bKGD_SUPPORTED || PNG_WRITE_bKGD_SUPPORTED */
00443 #if defined(PNG_READ_oFFs_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
00444    /* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
00445     * and downwards from the top-left corner of the display, page, or other
00446     * application-specific co-ordinate space.  See the PNG_OFFSET_ defines
00447     * below for the unit types.  Valid if (valid & PNG_INFO_oFFs) non-zero.
00448     */
00449    png_uint_32 x_offset; /* x offset on page */
00450    png_uint_32 y_offset; /* y offset on page */
00451    png_byte offset_unit_type; /* offset units type */
00452 #endif /* PNG_READ_oFFs_SUPPORTED || PNG_WRITE_oFFs_SUPPORTED */
00453 #if defined(PNG_READ_pHYs_SUPPORTED) || defined(PNG_WRITE_pHYs_SUPPORTED)
00454    /* The pHYs chunk gives the physical pixel density of the image for
00455     * display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
00456     * defines below).  Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
00457     */
00458    png_uint_32 x_pixels_per_unit; /* horizontal pixel density */
00459    png_uint_32 y_pixels_per_unit; /* vertical pixel density */
00460    png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
00461 #endif /* PNG_READ_pHYs_SUPPORTED || PNG_WRITE_pHYs_SUPPORTED */
00462 #if defined(PNG_READ_hIST_SUPPORTED) || defined(PNG_WRITE_hIST_SUPPORTED)
00463    /* The hIST chunk contains the relative frequency or importance of the
00464     * various palette entries, so that a viewer can intelligently select a
00465     * reduced-color palette, if required.  Data is an array of "num_palette"
00466     * values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
00467     * is non-zero.
00468     */
00469    png_uint_16p hist;
00470 #endif /* PNG_READ_hIST_SUPPORTED || PNG_WRITE_hIST_SUPPORTED */
00471 #if defined(PNG_READ_cHRM_SUPPORTED) || defined(PNG_WRITE_cHRM_SUPPORTED)
00472    /* The cHRM chunk describes the CIE color characteristics of the monitor
00473     * on which the PNG was created.  This data allows the viewer to do gamut
00474     * mapping of the input image to ensure that the viewer sees the same
00475     * colors in the image as the creator.  Values are in the range
00476     * [0.0, 0.8].  Data valid if (valid & PNG_INFO_cHRM) non-zero.
00477     */
00478    float x_white;
00479    float y_white;
00480    float x_red;
00481    float y_red;
00482    float x_green;
00483    float y_green;
00484    float x_blue;
00485    float y_blue;
00486 #endif /* PNG_READ_cHRM_SUPPORTED || PNG_WRITE_cHRM_SUPPORTED */
00487 #if defined(PNG_READ_pCAL_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED)
00488    /* The pCAL chunk describes a transformation between the stored pixel
00489     * values and original physcical data values used to create the image.
00490     * The integer range [0, 2^bit_depth - 1] maps to the floating-point
00491     * range given by [pcal_X0, pcal_X1], and are further transformed by a
00492     * (possibly non-linear) transformation function given by "pcal_type"
00493     * and "pcal_params" into "pcal_units".  Please see the PNG_EQUATION_
00494     * defines below, and the PNG-Group's Scientific Visualization extension
00495     * chunks document png-scivis-19970203 for a complete description of the
00496     * transformations and how they should be implemented, as well as the
00497     * png-extensions document for a description of the ASCII parameter
00498     * strings.  Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
00499     */
00500    png_charp pcal_purpose;  /* pCAL chunk description string */
00501    png_int_32 pcal_X0;      /* minimum value */
00502    png_int_32 pcal_X1;      /* maximum value */
00503    png_charp pcal_units;    /* Latin-1 string giving physical units */
00504    png_charpp pcal_params;  /* ASCII strings containing parameter values */
00505    png_byte pcal_type;      /* equation type (see PNG_EQUATION_ below) */
00506    png_byte pcal_nparams;   /* number of parameters given in pcal_params */
00507 #endif /* PNG_READ_pCAL_SUPPORTED || PNG_WRITE_pCAL_SUPPORTED */
00508 } png_info;
00509 typedef png_info FAR * png_infop;
00510 typedef png_info FAR * FAR * png_infopp;
00511 
00512 /* Maximum positive integer used in PNG is (2^31)-1 */
00513 #define PNG_MAX_UINT ((png_uint_32)0x7fffffffL)
00514 
00515 /* These describe the color_type field in png_info. */
00516 /* color type masks */
00517 #define PNG_COLOR_MASK_PALETTE    1
00518 #define PNG_COLOR_MASK_COLOR      2
00519 #define PNG_COLOR_MASK_ALPHA      4
00520 
00521 /* color types.  Note that not all combinations are legal */
00522 #define PNG_COLOR_TYPE_GRAY 0
00523 #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
00524 #define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
00525 #define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
00526 #define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
00527 
00528 /* This is for compression type. PNG 1.0-1.2 only define the single type. */
00529 #define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */
00530 #define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE
00531 
00532 /* This is for filter type. PNG 1.0-1.2 only define the single type. */
00533 #define PNG_FILTER_TYPE_BASE      0 /* Single row per-byte filtering */
00534 #define PNG_FILTER_TYPE_DEFAULT   PNG_FILTER_TYPE_BASE
00535 
00536 /* These are for the interlacing type.  These values should NOT be changed. */
00537 #define PNG_INTERLACE_NONE        0 /* Non-interlaced image */
00538 #define PNG_INTERLACE_ADAM7       1 /* Adam7 interlacing */
00539 #define PNG_INTERLACE_LAST        2 /* Not a valid value */
00540 
00541 /* These are for the oFFs chunk.  These values should NOT be changed. */
00542 #define PNG_OFFSET_PIXEL          0 /* Offset in pixels */
00543 #define PNG_OFFSET_MICROMETER     1 /* Offset in micrometers (1/10^6 meter) */
00544 #define PNG_OFFSET_LAST           2 /* Not a valid value */
00545 
00546 /* These are for the pCAL chunk.  These values should NOT be changed. */
00547 #define PNG_EQUATION_LINEAR       0 /* Linear transformation */
00548 #define PNG_EQUATION_BASE_E       1 /* Exponential base e transform */
00549 #define PNG_EQUATION_ARBITRARY    2 /* Arbitrary base exponential transform */
00550 #define PNG_EQUATION_HYPERBOLIC   3 /* Hyperbolic sine transformation */
00551 #define PNG_EQUATION_LAST         4 /* Not a valid value */
00552 
00553 /* These are for the pHYs chunk.  These values should NOT be changed. */
00554 #define PNG_RESOLUTION_UNKNOWN    0 /* pixels/unknown unit (aspect ratio) */
00555 #define PNG_RESOLUTION_METER      1 /* pixels/meter */
00556 #define PNG_RESOLUTION_LAST       2 /* Not a valid value */
00557 
00558 /* These are for the sRGB chunk.  These values should NOT be changed. */
00559 #define PNG_sRGB_INTENT_SATURATION 0
00560 #define PNG_sRGB_INTENT_PERCEPTUAL 1
00561 #define PNG_sRGB_INTENT_ABSOLUTE   2
00562 #define PNG_sRGB_INTENT_RELATIVE   3
00563 #define PNG_sRGB_INTENT_LAST       4 /* Not a valid value */
00564                         
00565 
00566 
00567 /* These determine if an ancillary chunk's data has been successfully read
00568  * from the PNG header, or if the application has filled in the corresponding
00569  * data in the info_struct to be written into the output file.  The values
00570  * of the PNG_INFO_<chunk> defines should NOT be changed.
00571  */
00572 #define PNG_INFO_gAMA 0x0001
00573 #define PNG_INFO_sBIT 0x0002
00574 #define PNG_INFO_cHRM 0x0004
00575 #define PNG_INFO_PLTE 0x0008
00576 #define PNG_INFO_tRNS 0x0010
00577 #define PNG_INFO_bKGD 0x0020
00578 #define PNG_INFO_hIST 0x0040
00579 #define PNG_INFO_pHYs 0x0080
00580 #define PNG_INFO_oFFs 0x0100
00581 #define PNG_INFO_tIME 0x0200
00582 #define PNG_INFO_pCAL 0x0400
00583 #define PNG_INFO_sRGB 0x0800   /* GR-P, 0.96a */
00584 
00585 /* This is used for the transformation routines, as some of them
00586  * change these values for the row.  It also should enable using
00587  * the routines for other purposes.
00588  */
00589 typedef struct png_row_info_struct
00590 {
00591    png_uint_32 width; /* width of row */
00592    png_uint_32 rowbytes; /* number of bytes in row */
00593    png_byte color_type; /* color type of row */
00594    png_byte bit_depth; /* bit depth of row */
00595    png_byte channels; /* number of channels (1, 2, 3, or 4) */
00596    png_byte pixel_depth; /* bits per pixel (depth * channels) */
00597 } png_row_info;
00598 
00599 typedef png_row_info FAR * png_row_infop;
00600 typedef png_row_info FAR * FAR * png_row_infopp;
00601 
00602 /* These are the function types for the I/O functions and for the functions
00603  * that allow the user to override the default I/O functions with his or her
00604  * own.  The png_error_ptr type should match that of user-supplied warning
00605  * and error functions, while the png_rw_ptr type should match that of the
00606  * user read/write data functions.
00607  */
00608 typedef struct png_struct_def png_struct;
00609 typedef png_struct FAR * png_structp;
00610 
00611 typedef void (*png_error_ptr) PNGARG((png_structp, png_const_charp));
00612 typedef void (*png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t));
00613 typedef void (*png_flush_ptr) PNGARG((png_structp));
00614 typedef void (*png_read_status_ptr) PNGARG((png_structp, png_uint_32, int));
00615 typedef void (*png_write_status_ptr) PNGARG((png_structp, png_uint_32, int));
00616 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
00617 typedef void (*png_progressive_info_ptr) PNGARG((png_structp, png_infop));
00618 typedef void (*png_progressive_end_ptr) PNGARG((png_structp, png_infop));
00619 typedef void (*png_progressive_row_ptr) PNGARG((png_structp, png_bytep,
00620    png_uint_32, int));
00621 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
00622 
00623 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
00624     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
00625 typedef void (*png_user_transform_ptr) PNGARG((png_structp,
00626     png_row_infop, png_bytep));
00627 #endif /* PNG_READ|WRITE_USER_TRANSFORM_SUPPORTED */
00628 
00629 typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t));
00630 typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp));
00631 
00632 /* The structure that holds the information to read and write PNG files.
00633  * The only people who need to care about what is inside of this are the
00634  * people who will be modifying the library for their own special needs.
00635  * It should NOT be accessed directly by an application, except to store
00636  * the jmp_buf.
00637  */
00638 
00639 struct png_struct_def
00640 {
00641    jmp_buf jmpbuf;            /* used in png_error */
00642 
00643    png_error_ptr error_fn;    /* function for printing errors and aborting */
00644    png_error_ptr warning_fn;  /* function for printing warnings */
00645    png_voidp error_ptr;       /* user supplied struct for error functions */
00646    png_rw_ptr write_data_fn;  /* function for writing output data */
00647    png_rw_ptr read_data_fn;   /* function for reading input data */
00648    png_voidp io_ptr;          /* ptr to application struct for I/O functions*/
00649 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
00650    png_user_transform_ptr read_user_transform_fn; /* user read transform */
00651 #endif
00652 #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
00653    png_user_transform_ptr write_user_transform_fn; /* user write transform */
00654 #endif
00655 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
00656     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
00657    png_voidp user_transform_ptr; /* user supplied struct for user transform */
00658    png_byte user_transform_depth;    /* bit depth of user transformed pixels */
00659    png_byte user_transform_channels; /* channels in user transformed pixels */
00660 #endif
00661 
00662    png_uint_32 mode;          /* tells us where we are in the PNG file */
00663    png_uint_32 flags;         /* flags indicating various things to libpng */
00664    png_uint_32 transformations; /* which transformations to perform */
00665 
00666    z_stream zstream;          /* pointer to decompression structure (below) */
00667    png_bytep zbuf;            /* buffer for zlib */
00668    png_size_t zbuf_size;      /* size of zbuf */
00669    int zlib_level;            /* holds zlib compression level */
00670    int zlib_method;           /* holds zlib compression method */
00671    int zlib_window_bits;      /* holds zlib compression window bits */
00672    int zlib_mem_level;        /* holds zlib compression memory level */
00673    int zlib_strategy;         /* holds zlib compression strategy */
00674 
00675    png_uint_32 width;         /* width of image in pixels */
00676    png_uint_32 height;        /* height of image in pixels */
00677    png_uint_32 num_rows;      /* number of rows in current pass */
00678    png_uint_32 usr_width;     /* width of row at start of write */
00679    png_uint_32 rowbytes;      /* size of row in bytes */
00680    png_uint_32 irowbytes;     /* size of current interlaced row in bytes */
00681    png_uint_32 iwidth;        /* width of current interlaced row in pixels */
00682    png_uint_32 row_number;    /* current row in interlace pass */
00683    png_bytep prev_row;        /* buffer to save previous (unfiltered) row */
00684    png_bytep row_buf;         /* buffer to save current (unfiltered) row */
00685    png_bytep sub_row;         /* buffer to save "sub" row when filtering */
00686    png_bytep up_row;          /* buffer to save "up" row when filtering */
00687    png_bytep avg_row;         /* buffer to save "avg" row when filtering */
00688    png_bytep paeth_row;       /* buffer to save "Paeth" row when filtering */
00689    png_row_info row_info;     /* used for transformation routines */
00690 
00691    png_uint_32 idat_size;     /* current IDAT size for read */
00692    png_uint_32 crc;           /* current chunk CRC value */
00693    png_colorp palette;        /* palette from the input file */
00694    png_uint_16 num_palette;   /* number of color entries in palette */
00695    png_uint_16 num_trans;     /* number of transparency values */
00696    png_byte chunk_name[5];    /* null-terminated name of current chunk */
00697    png_byte compression;      /* file compression type (always 0) */
00698    png_byte filter;           /* file filter type (always 0) */
00699    png_byte interlaced;       /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
00700    png_byte pass;             /* current interlace pass (0 - 6) */
00701    png_byte do_filter;        /* row filter flags (see PNG_FILTER_ below ) */
00702    png_byte color_type;       /* color type of file */
00703    png_byte bit_depth;        /* bit depth of file */
00704    png_byte usr_bit_depth;    /* bit depth of users row */
00705    png_byte pixel_depth;      /* number of bits per pixel */
00706    png_byte channels;         /* number of channels in file */
00707    png_byte usr_channels;     /* channels at start of write */
00708    png_byte sig_bytes;        /* magic bytes read/written from start of file */
00709 
00710 #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
00711    png_uint_16 filler;           /* filler bytes for pixel expansion */
00712 #endif /* PNG_READ_FILLER_SUPPORTED */
00713 #if defined(PNG_READ_bKGD_SUPPORTED)
00714    png_byte background_gamma_type;
00715    float background_gamma;
00716    png_color_16 background;   /* background color in screen gamma space */
00717 #if defined(PNG_READ_GAMMA_SUPPORTED)
00718    png_color_16 background_1; /* background normalized to gamma 1.0 */
00719 #endif /* PNG_READ_GAMMA && PNG_READ_bKGD_SUPPORTED */
00720 #endif /* PNG_READ_bKGD_SUPPORTED */
00721 #if defined(PNG_WRITE_FLUSH_SUPPORTED)
00722    png_flush_ptr output_flush_fn;/* Function for flushing output */
00723    png_uint_32 flush_dist;    /* how many rows apart to flush, 0 - no flush */
00724    png_uint_32 flush_rows;    /* number of rows written since last flush */
00725 #endif /* PNG_WRITE_FLUSH_SUPPORTED */
00726 #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
00727    int gamma_shift;      /* number of "insignificant" bits 16-bit gamma */
00728    float gamma;          /* file gamma value */
00729    float screen_gamma;   /* screen gamma value (display_exponent) */
00730 #endif /* PNG_READ_GAMMA_SUPPORTED */
00731 #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
00732    png_bytep gamma_table;     /* gamma table for 8-bit depth files */
00733    png_bytep gamma_from_1;    /* converts from 1.0 to screen */
00734    png_bytep gamma_to_1;      /* converts from file to 1.0 */
00735    png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
00736    png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
00737    png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
00738 #endif /* PNG_READ_GAMMA_SUPPORTED || PNG_WRITE_GAMMA_SUPPORTED */
00739 #if defined(PNG_READ_GAMMA_SUPPORTED) || defined (PNG_READ_sBIT_SUPPORTED)
00740    png_color_8 sig_bit;       /* significant bits in each available channel */
00741 #endif /* PNG_READ_GAMMA_SUPPORTED || PNG_READ_sBIT_SUPPORTED */
00742 #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
00743    png_color_8 shift;         /* shift for significant bit tranformation */
00744 #endif /* PNG_READ_SHIFT_SUPPORTED || PNG_WRITE_SHIFT_SUPPORTED */
00745 #if defined(PNG_READ_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
00746  || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
00747    png_bytep trans;           /* transparency values for paletted files */
00748    png_color_16 trans_values; /* transparency values for non-paletted files */
00749 #endif /* PNG_READ|WRITE_tRNS_SUPPORTED||PNG_READ_EXPAND|BACKGROUND_SUPPORTED */
00750    png_read_status_ptr read_row_fn;   /* called after each row is decoded */
00751    png_write_status_ptr write_row_fn; /* called after each row is encoded */
00752 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
00753    png_progressive_info_ptr info_fn; /* called after header data fully read */
00754    png_progressive_row_ptr row_fn;   /* called after each prog. row is decoded */
00755    png_progressive_end_ptr end_fn;   /* called after image is complete */
00756    png_bytep save_buffer_ptr;        /* current location in save_buffer */
00757    png_bytep save_buffer;            /* buffer for previously read data */
00758    png_bytep current_buffer_ptr;     /* current location in current_buffer */
00759    png_bytep current_buffer;         /* buffer for recently used data */
00760    png_uint_32 push_length;          /* size of current input chunk */
00761    png_uint_32 skip_length;          /* bytes to skip in input data */
00762    png_size_t save_buffer_size;      /* amount of data now in save_buffer */
00763    png_size_t save_buffer_max;       /* total size of save_buffer */
00764    png_size_t buffer_size;           /* total amount of available input data */
00765    png_size_t current_buffer_size;   /* amount of data now in current_buffer */
00766    int process_mode;                 /* what push library is currently doing */
00767    int cur_palette;                  /* current push library palette index */
00768 #if defined(PNG_READ_tEXt_SUPPORTED) || defined(PNG_READ_zTXt_SUPPORTED)
00769    png_size_t current_text_size;     /* current size of text input data */
00770    png_size_t current_text_left;     /* how much text left to read in input */
00771    png_charp current_text;           /* current text chunk buffer */
00772    png_charp current_text_ptr;       /* current location in current_text */
00773 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_READ_tEXt/zTXt_SUPPORTED */
00774 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
00775 #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
00776 /* for the Borland special 64K segment handler */
00777    png_bytepp offset_table_ptr;
00778    png_bytep offset_table;
00779    png_uint_16 offset_table_number;
00780    png_uint_16 offset_table_count;
00781    png_uint_16 offset_table_count_free;
00782 #endif /* __TURBOC__&&!_Windows&&!__FLAT__ */
00783 #if defined(PNG_READ_DITHER_SUPPORTED)
00784    png_bytep palette_lookup;         /* lookup table for dithering */
00785    png_bytep dither_index;           /* index translation for palette files */
00786 #endif /* PNG_READ_DITHER_SUPPORTED */
00787 #if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_READ_hIST_SUPPORTED)
00788    png_uint_16p hist;                /* histogram */
00789 #endif
00790 #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
00791    png_byte heuristic_method;        /* heuristic for row filter selection */
00792    png_byte num_prev_filters;        /* number of weights for previous rows */
00793    png_bytep prev_filters;           /* filter type(s) of previous row(s) */
00794    png_uint_16p filter_weights;      /* weight(s) for previous line(s) */
00795    png_uint_16p inv_filter_weights;  /* 1/weight(s) for previous line(s) */
00796    png_uint_16p filter_costs;        /* relative filter calculation cost */
00797    png_uint_16p inv_filter_costs;    /* 1/relative filter calculation cost */
00798 #endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
00799 #if defined(PNG_TIME_RFC1123_SUPPORTED)
00800    png_charp time_buffer;            /* String to hold RFC 1123 time text */
00801 #endif /* PNG_TIME_RFC1123_SUPPORTED */
00802 #ifdef PNG_USER_MEM_SUPPORTED
00803    png_voidp mem_ptr;                /* user supplied struct for mem functions */
00804    png_malloc_ptr malloc_fn;         /* function for allocating memory */
00805    png_free_ptr free_fn;             /* function for freeing memory */
00806 #endif /* PNG_USER_MEM_SUPPORTED */
00807 #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
00808    png_byte rgb_to_gray_status;
00809    png_byte rgb_to_gray_red_coeff;
00810    png_byte rgb_to_gray_green_coeff;
00811    png_byte rgb_to_gray_blue_coeff;
00812 #endif
00813 #if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
00814     defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
00815    png_byte empty_plte_permitted;
00816 #endif
00817 };
00818 
00819 /* This prevents a compiler error in png_get_copyright() in png.c if png.c
00820 and png.h are both at * version 1.0.5
00821  */
00822 typedef png_structp version_1_0_5;
00823 
00824 typedef png_struct FAR * FAR * png_structpp;
00825 
00826 /* Here are the function definitions most commonly used.  This is not
00827  * the place to find out how to use libpng.  See libpng.txt for the
00828  * full explanation, see example.c for the summary.  This just provides
00829  * a simple one line of the use of each function.
00830  */
00831 
00832 /* Tell lib we have already handled the first <num_bytes> magic bytes.
00833  * Handling more than 8 bytes from the beginning of the file is an error.
00834  */
00835 extern PNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr,
00836    int num_bytes));
00837 
00838 /* Check sig[start] through sig[start + num_to_check - 1] to see if it's a
00839  * PNG file.  Returns zero if the supplied bytes match the 8-byte PNG
00840  * signature, and non-zero otherwise.  Having num_to_check == 0 or
00841  * start > 7 will always fail (ie return non-zero).
00842  */
00843 extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start,
00844    png_size_t num_to_check));
00845 
00846 /* Simple signature checking function.  This is the same as calling
00847  * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).
00848  */
00849 extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num));
00850 
00851 /* Allocate and initialize png_ptr struct for reading, and any other memory. */
00852 extern PNG_EXPORT(png_structp,png_create_read_struct)
00853    PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
00854    png_error_ptr error_fn, png_error_ptr warn_fn));
00855 
00856 /* Allocate and initialize png_ptr struct for writing, and any other memory */
00857 extern PNG_EXPORT(png_structp,png_create_write_struct)
00858    PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
00859    png_error_ptr error_fn, png_error_ptr warn_fn));
00860 
00861 #ifdef PNG_USER_MEM_SUPPORTED
00862 extern PNG_EXPORT(png_structp,png_create_read_struct_2)
00863    PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
00864    png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
00865    png_malloc_ptr malloc_fn, png_free_ptr free_fn));
00866 extern PNG_EXPORT(png_structp,png_create_write_struct_2)
00867    PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
00868    png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
00869    png_malloc_ptr malloc_fn, png_free_ptr free_fn));
00870 #endif
00871 
00872 /* Write a PNG chunk - size, type, (optional) data, CRC. */
00873 extern PNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr,
00874    png_bytep chunk_name, png_bytep data, png_size_t length));
00875 
00876 /* Write the start of a PNG chunk - length and chunk name. */
00877 extern PNG_EXPORT(void,png_write_chunk_start) PNGARG((png_structp png_ptr,
00878    png_bytep chunk_name, png_uint_32 length));
00879 
00880 /* Write the data of a PNG chunk started with png_write_chunk_start(). */
00881 extern PNG_EXPORT(void,png_write_chunk_data) PNGARG((png_structp png_ptr,
00882    png_bytep data, png_size_t length));
00883 
00884 /* Finish a chunk started with png_write_chunk_start() (includes CRC). */
00885 extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr));
00886 
00887 /* Allocate and initialize the info structure */
00888 extern PNG_EXPORT(png_infop,png_create_info_struct)
00889    PNGARG((png_structp png_ptr));
00890 
00891 /* Initialize the info structure (old interface - NOT DLL EXPORTED) */
00892 extern void png_info_init PNGARG((png_infop info_ptr));
00893 
00894 /* Writes all the PNG information before the image. */
00895 extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr,
00896    png_infop info_ptr));
00897 
00898 /* read the information before the actual image data. */
00899 extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr,
00900    png_infop info_ptr));
00901 
00902 #if defined(PNG_TIME_RFC1123_SUPPORTED)
00903 extern PNG_EXPORT(png_charp,png_convert_to_rfc1123)
00904    PNGARG((png_structp png_ptr, png_timep ptime));
00905 #endif /* PNG_TIME_RFC1123_SUPPORTED */
00906 
00907 #if defined(PNG_WRITE_tIME_SUPPORTED)
00908 /* convert from a struct tm to png_time */
00909 extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime,
00910    struct tm FAR * ttime));
00911 
00912 /* convert from time_t to png_time.  Uses gmtime() */
00913 extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime,
00914    time_t ttime));
00915 #endif /* PNG_WRITE_tIME_SUPPORTED */
00916 
00917 #if defined(PNG_READ_EXPAND_SUPPORTED)
00918 /* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */
00919 extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr));
00920 extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp png_ptr));
00921 extern PNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr));
00922 extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr));
00923 #endif /* PNG_READ_EXPAND_SUPPORTED */
00924 
00925 #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
00926 /* Use blue, green, red order for pixels. */
00927 extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr));
00928 #endif /* PNG_READ_BGR_SUPPORTED || PNG_WRITE_BGR_SUPPORTED */
00929 
00930 #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
00931 /* Expand the grayscale to 24-bit RGB if necessary. */
00932 extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr));
00933 #endif /* PNG_READ_GRAY_TO_RGB_SUPPORTED */
00934 
00935 #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
00936 /* Reduce RGB to grayscale. */
00937 extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr,
00938    int error_action, double red, double green ));
00939 extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp
00940    png_ptr));
00941 #endif /* PNG_READ_RGB_TO_GRAY_SUPPORTED */
00942 
00943 extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth,
00944    png_colorp palette));
00945 
00946 #if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
00947 extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr));
00948 #endif /* PNG_READ_STRIP_ALPHA_SUPPORTED */
00949 
00950 #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
00951     defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
00952 extern PNG_EXPORT(void,png_set_swap_alpha) PNGARG((png_structp png_ptr));
00953 #endif /* PNG_READ_SWAP_ALPHA_SUPPORTED || PNG_WRITE_SWAP_ALPHA_SUPPORTED */
00954 
00955 #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
00956     defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
00957 extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr));
00958 #endif /* PNG_READ_INVERT_ALPHA_SUPPORTED || PNG_WRITE_INVERT_ALPHA_SUPPORTED */
00959 
00960 #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
00961 /* Add a filler byte to 24-bit RGB images. */
00962 extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr,
00963    png_uint_32 filler, int flags));
00964 
00965 /* The values of the PNG_FILLER_ defines should NOT be changed */
00966 #define PNG_FILLER_BEFORE 0
00967 #define PNG_FILLER_AFTER 1
00968 #endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */
00969 
00970 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
00971 /* Swap bytes in 16-bit depth files. */
00972 extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr));
00973 #endif /* PNG_READ_SWAP_SUPPORTED || PNG_WRITE_SWAP_SUPPORTED */
00974 
00975 #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
00976 /* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */
00977 extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr));
00978 #endif /* PNG_READ_PACK_SUPPORTED || PNG_WRITE_PACK_SUPPORTED */
00979 
00980 #if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)
00981 /* Swap packing order of pixels in bytes. */
00982 extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr));
00983 #endif /* PNG_READ_PACKSWAP_SUPPORTED || PNG_WRITE_PACKSWAP_SUPPORTED */
00984 
00985 #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
00986 /* Converts files to legal bit depths. */
00987 extern PNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr,
00988    png_color_8p true_bits));
00989 #endif /* PNG_READ_SHIFT_SUPPORTED || PNG_WRITE_SHIFT_SUPPORTED */
00990 
00991 #if defined(PNG_READ_INTERLACING_SUPPORTED) || \
00992     defined(PNG_WRITE_INTERLACING_SUPPORTED)
00993 /* Have the code handle the interlacing.  Returns the number of passes. */
00994 extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr));
00995 #endif /* PNG_READ_INTERLACING_SUPPORTED || PNG_WRITE_INTERLACING_SUPPORTED */
00996 
00997 #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
00998 /* Invert monocrome files */
00999 extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr));
01000 #endif /* PNG_READ_INVERT_SUPPORTED || PNG_WRITE_INVERT_SUPPORTED */
01001 
01002 #if defined(PNG_READ_BACKGROUND_SUPPORTED)
01003 /* Handle alpha and tRNS by replacing with a background color. */
01004 extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr,
01005    png_color_16p background_color, int background_gamma_code,
01006    int need_expand, double background_gamma));
01007 #define PNG_BACKGROUND_GAMMA_UNKNOWN 0
01008 #define PNG_BACKGROUND_GAMMA_SCREEN  1
01009 #define PNG_BACKGROUND_GAMMA_FILE    2
01010 #define PNG_BACKGROUND_GAMMA_UNIQUE  3
01011 #endif /* PNG_READ_BACKGROUND_SUPPORTED */
01012 
01013 #if defined(PNG_READ_16_TO_8_SUPPORTED)
01014 /* strip the second byte of information from a 16-bit depth file. */
01015 extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr));
01016 #endif /* PNG_READ_16_TO_8_SUPPORTED */
01017 
01018 #if defined(PNG_READ_DITHER_SUPPORTED)
01019 /* Turn on dithering, and reduce the palette to the number of colors available. */
01020 extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr,
01021    png_colorp palette, int num_palette, int maximum_colors,
01022    png_uint_16p histogram, int full_dither));
01023 #endif /* PNG_READ_DITHER_SUPPORTED */
01024 
01025 #if defined(PNG_READ_GAMMA_SUPPORTED)
01026 /* Handle gamma correction. Screen_gamma=(display_exponent) */
01027 extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr,
01028    double screen_gamma, double default_file_gamma));
01029 #endif /* PNG_READ_GAMMA_SUPPORTED */
01030 
01031 #if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
01032     defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
01033 /* Permit or disallow empty PLTE (0: not permitted, 1: permitted) */
01034 extern PNG_EXPORT(void,png_permit_empty_plte) PNGARG((png_structp png_ptr,
01035    int empty_plte_permitted));
01036 #endif /* PNG_READ_EMPTY_PLTE_SUPPORTED */
01037 
01038 #if defined(PNG_WRITE_FLUSH_SUPPORTED)
01039 /* Set how many lines between output flushes - 0 for no flushing */
01040 extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows));
01041 
01042 /* Flush the current PNG output buffer */
01043 extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr));
01044 #endif /* PNG_WRITE_FLUSH_SUPPORTED */
01045 
01046 /* optional update palette with requested transformations */
01047 extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr));
01048 
01049 /* optional call to update the users info structure */
01050 extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr,
01051    png_infop info_ptr));
01052 
01053 /* read a one or more rows of image data.*/
01054 extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr,
01055    png_bytepp row, png_bytepp display_row, png_uint_32 num_rows));
01056 
01057 /* read a row of data.*/
01058 extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr,
01059    png_bytep row,
01060    png_bytep display_row));
01061 
01062 /* read the whole image into memory at once. */
01063 extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr,
01064    png_bytepp image));
01065 
01066 /* write a row of image data */
01067 extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr,
01068    png_bytep row));
01069 
01070 /* write a few rows of image data */
01071 extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr,
01072    png_bytepp row, png_uint_32 num_rows));
01073 
01074 /* write the image data */
01075 extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr,
01076    png_bytepp image));
01077 
01078 /* writes the end of the PNG file. */
01079 extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr,
01080    png_infop info_ptr));
01081 
01082 /* read the end of the PNG file. */
01083 extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr,
01084    png_infop info_ptr));
01085 
01086 /* free any memory associated with the png_info_struct */
01087 extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr,
01088    png_infopp info_ptr_ptr));
01089 
01090 /* free any memory associated with the png_struct and the png_info_structs */
01091 extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp
01092    png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr));
01093 
01094 /* free all memory used by the read (old method - NOT DLL EXPORTED) */
01095 extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
01096    png_infop end_info_ptr));
01097 
01098 /* free any memory associated with the png_struct and the png_info_structs */
01099 extern PNG_EXPORT(void,png_destroy_write_struct)
01100    PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr));
01101 
01102 /* free any memory used in info_ptr struct (old method - NOT DLL EXPORTED) */
01103 extern void png_write_destroy_info PNGARG((png_infop info_ptr));
01104 
01105 /* free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
01106 extern void png_write_destroy PNGARG((png_structp png_ptr));
01107 
01108 /* set the libpng method of handling chunk CRC errors */
01109 extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr,
01110    int crit_action, int ancil_action));
01111 
01112 /* Values for png_set_crc_action() to say how to handle CRC errors in
01113  * ancillary and critical chunks, and whether to use the data contained
01114  * therein.  Note that it is impossible to "discard" data in a critical
01115  * chunk.  For versions prior to 0.90, the action was always error/quit,
01116  * whereas in version 0.90 and later, the action for CRC errors in ancillary
01117  * chunks is warn/discard.  These values should NOT be changed.
01118  *
01119  *      value                       action:critical     action:ancillary
01120  */
01121 #define PNG_CRC_DEFAULT       0  /* error/quit          warn/discard data */
01122 #define PNG_CRC_ERROR_QUIT    1  /* error/quit          error/quit        */
01123 #define PNG_CRC_WARN_DISCARD  2  /* (INVALID)           warn/discard data */
01124 #define PNG_CRC_WARN_USE      3  /* warn/use data       warn/use data     */
01125 #define PNG_CRC_QUIET_USE     4  /* quiet/use data      quiet/use data    */
01126 #define PNG_CRC_NO_CHANGE     5  /* use current value   use current value */
01127 
01128 /* These functions give the user control over the scan-line filtering in
01129  * libpng and the compression methods used by zlib.  These functions are
01130  * mainly useful for testing, as the defaults should work with most users.
01131  * Those users who are tight on memory or want faster performance at the
01132  * expense of compression can modify them.  See the compression library
01133  * header file (zlib.h) for an explination of the compression functions.
01134  */
01135 
01136 /* set the filtering method(s) used by libpng.  Currently, the only valid
01137  * value for "method" is 0.
01138  */
01139 extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method,
01140    int filters));
01141 
01142 /* Flags for png_set_filter() to say which filters to use.  The flags
01143  * are chosen so that they don't conflict with real filter types
01144  * below, in case they are supplied instead of the #defined constants.
01145  * These values should NOT be changed.
01146  */
01147 #define PNG_NO_FILTERS     0x00
01148 #define PNG_FILTER_NONE    0x08
01149 #define PNG_FILTER_SUB     0x10
01150 #define PNG_FILTER_UP      0x20
01151 #define PNG_FILTER_AVG     0x40
01152 #define PNG_FILTER_PAETH   0x80
01153 #define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \
01154                          PNG_FILTER_AVG | PNG_FILTER_PAETH)
01155 
01156 /* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
01157  * These defines should NOT be changed.
01158  */
01159 #define PNG_FILTER_VALUE_NONE  0
01160 #define PNG_FILTER_VALUE_SUB   1
01161 #define PNG_FILTER_VALUE_UP    2
01162 #define PNG_FILTER_VALUE_AVG   3
01163 #define PNG_FILTER_VALUE_PAETH 4
01164 #define PNG_FILTER_VALUE_LAST  5
01165 
01166 #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* EXPERIMENTAL */
01167 /* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_
01168  * defines, either the default (minimum-sum-of-absolute-differences), or
01169  * the experimental method (weighted-minimum-sum-of-absolute-differences).
01170  *
01171  * Weights are factors >= 1.0, indicating how important it is to keep the
01172  * filter type consistent between rows.  Larger numbers mean the current
01173  * filter is that many times as likely to be the same as the "num_weights"
01174  * previous filters.  This is cumulative for each previous row with a weight.
01175  * There needs to be "num_weights" values in "filter_weights", or it can be
01176  * NULL if the weights aren't being specified.  Weights have no influence on
01177  * the selection of the first row filter.  Well chosen weights can (in theory)
01178  * improve the compression for a given image.
01179  *
01180  * Costs are factors >= 1.0 indicating the relative decoding costs of a
01181  * filter type.  Higher costs indicate more decoding expense, and are
01182  * therefore less likely to be selected over a filter with lower computational
01183  * costs.  There needs to be a value in "filter_costs" for each valid filter
01184  * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't
01185  * setting the costs.  Costs try to improve the speed of decompression without
01186  * unduly increasing the compressed image size.
01187  *
01188  * A negative weight or cost indicates the default value is to be used, and
01189  * values in the range [0.0, 1.0) indicate the value is to remain unchanged.
01190  * The default values for both weights and costs are currently 1.0, but may
01191  * change if good general weighting/cost heuristics can be found.  If both
01192  * the weights and costs are set to 1.0, this degenerates the WEIGHTED method
01193  * to the UNWEIGHTED method, but with added encoding time/computation.
01194  */
01195 extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr,
01196    int heuristic_method, int num_weights, png_doublep filter_weights,
01197    png_doublep filter_costs));
01198 #endif /*  PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
01199 
01200 /* Heuristic used for row filter selection.  These defines should NOT be
01201  * changed.
01202  */
01203 #define PNG_FILTER_HEURISTIC_DEFAULT    0  /* Currently "UNWEIGHTED" */
01204 #define PNG_FILTER_HEURISTIC_UNWEIGHTED 1  /* Used by libpng < 0.95 */
01205 #define PNG_FILTER_HEURISTIC_WEIGHTED   2  /* Experimental feature */
01206 #define PNG_FILTER_HEURISTIC_LAST       3  /* Not a valid value */
01207 
01208 /* Set the library compression level.  Currently, valid values range from
01209  * 0 - 9, corresponding directly to the zlib compression levels 0 - 9
01210  * (0 - no compression, 9 - "maximal" compression).  Note that tests have
01211  * shown that zlib compression levels 3-6 usually perform as well as level 9
01212  * for PNG images, and do considerably fewer caclulations.  In the future,
01213  * these values may not correspond directly to the zlib compression levels.
01214  */
01215 extern PNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr,
01216    int level));
01217 
01218 extern PNG_EXPORT(void,png_set_compression_mem_level)
01219    PNGARG((png_structp png_ptr, int mem_level));
01220 
01221 extern PNG_EXPORT(void,png_set_compression_strategy)
01222    PNGARG((png_structp png_ptr, int strategy));
01223 
01224 extern PNG_EXPORT(void,png_set_compression_window_bits)
01225    PNGARG((png_structp png_ptr, int window_bits));
01226 
01227 extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr,
01228    int method));
01229 
01230 /* These next functions are called for input/output, memory, and error
01231  * handling.  They are in the file pngrio.c, pngwio.c, and pngerror.c,
01232  * and call standard C I/O routines such as fread(), fwrite(), and
01233  * fprintf().  These functions can be made to use other I/O routines
01234  * at run time for those applications that need to handle I/O in a
01235  * different manner by calling png_set_???_fn().  See libpng.txt for
01236  * more information.
01237  */
01238 
01239 #if !defined(PNG_NO_STDIO)
01240 /* Initialize the input/output for the PNG file to the default functions. */
01241 extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, FILE *fp));
01242 #endif
01243 
01244 /* Replace the (error and abort), and warning functions with user
01245  * supplied functions.  If no messages are to be printed you must still
01246  * write and use replacement functions. The replacement error_fn should
01247  * still do a longjmp to the last setjmp location if you are using this
01248  * method of error handling.  If error_fn or warning_fn is NULL, the
01249  * default function will be used.
01250  */
01251 
01252 extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr,
01253    png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn));
01254 
01255 /* Return the user pointer associated with the error functions */
01256 extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr));
01257 
01258 /* Replace the default data output functions with a user supplied one(s).
01259  * If buffered output is not used, then output_flush_fn can be set to NULL.
01260  * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time
01261  * output_flush_fn will be ignored (and thus can be NULL).
01262  */
01263 extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr,
01264    png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));
01265 
01266 /* Replace the default data input function with a user supplied one. */
01267 extern PNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr,
01268    png_voidp io_ptr, png_rw_ptr read_data_fn));
01269 
01270 /* Return the user pointer associated with the I/O functions */
01271 extern PNG_EXPORT(png_voidp,png_get_io_ptr) PNGARG((png_structp png_ptr));
01272 
01273 extern PNG_EXPORT(void,png_set_read_status_fn) PNGARG((png_structp png_ptr,
01274    png_read_status_ptr read_row_fn));
01275 
01276 extern PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr,
01277    png_write_status_ptr write_row_fn));
01278 
01279 #ifdef PNG_USER_MEM_SUPPORTED
01280 /* Replace the default memory allocation functions with user supplied one(s). */
01281 extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr,
01282    png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn));
01283 
01284 /* Return the user pointer associated with the memory functions */
01285 extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr));
01286 #endif /* PNG_USER_MEM_SUPPORTED */
01287 
01288 #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
01289 extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp
01290    png_ptr, png_user_transform_ptr read_user_transform_fn));
01291 #endif
01292 
01293 #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
01294 extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp
01295    png_ptr, png_user_transform_ptr write_user_transform_fn));
01296 #endif
01297 
01298 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
01299     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
01300 extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp
01301    png_ptr, png_voidp user_transform_ptr, int user_transform_depth,
01302    int user_transform_channels));
01303 /* Return the user pointer associated with the user transform functions */
01304 extern PNG_EXPORT(png_voidp,png_get_user_transform_ptr)
01305    PNGARG((png_structp png_ptr));
01306 #endif
01307 
01308 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
01309 /* Sets the function callbacks for the push reader, and a pointer to a
01310  * user-defined structure available to the callback functions.
01311  */
01312 extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr,
01313    png_voidp progressive_ptr,
01314    png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
01315    png_progressive_end_ptr end_fn));
01316 
01317 /* returns the user pointer associated with the push read functions */
01318 extern PNG_EXPORT(png_voidp,png_get_progressive_ptr)
01319    PNGARG((png_structp png_ptr));
01320 
01321 /* function to be called when data becomes available */
01322 extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr,
01323    png_infop info_ptr, png_bytep buffer, png_size_t buffer_size));
01324 
01325 /* function that combines rows.  Not very much different than the
01326  * png_combine_row() call.  Is this even used?????
01327  */
01328 extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr,
01329    png_bytep old_row, png_bytep new_row));
01330 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
01331 
01332 extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr,
01333    png_uint_32 size));
01334 
01335 /* frees a pointer allocated by png_malloc() */
01336 extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));
01337 
01338 #ifdef PNG_USER_MEM_SUPPORTED
01339 extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr,
01340    png_uint_32 size));
01341 extern PNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr,
01342    png_voidp ptr));
01343 #endif /* PNG_USER_MEM_SUPPORTED */
01344 
01345 extern PNG_EXPORT(png_voidp,png_memcpy_check) PNGARG((png_structp png_ptr,
01346    png_voidp s1, png_voidp s2, png_uint_32 size));
01347 
01348 extern PNG_EXPORT(png_voidp,png_memset_check) PNGARG((png_structp png_ptr,
01349    png_voidp s1, int value, png_uint_32 size));
01350 
01351 #if defined(USE_FAR_KEYWORD)  /* memory model conversion function */
01352 extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
01353    int check));
01354 #endif /* USE_FAR_KEYWORD */
01355 
01356 /* Fatal error in PNG image of libpng - can't continue */
01357 extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr,
01358    png_const_charp error));
01359 
01360 /* The same, but the chunk name is prepended to the error string. */
01361 extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr,
01362    png_const_charp error));
01363 
01364 /* Non-fatal error in libpng.  Can continue, but may have a problem. */
01365 extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr,
01366    png_const_charp message));
01367 
01368 /* Non-fatal error in libpng, chunk name is prepended to message. */
01369 extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr,
01370    png_const_charp message));
01371 
01372 /* The png_set_<chunk> functions are for storing values in the png_info_struct.
01373  * Similarly, the png_get_<chunk> calls are used to read values from the
01374  * png_info_struct, either storing the parameters in the passed variables, or
01375  * setting pointers into the png_info_struct where the data is stored.  The
01376  * png_get_<chunk> functions return a non-zero value if the data was available
01377  * in info_ptr, or return zero and do not change any of the parameters if the
01378  * data was not available.
01379  *
01380  * These functions should be used instead of directly accessing png_info
01381  * to avoid problems with future changes in the size and internal layout of
01382  * png_info_struct.
01383  */
01384 /* Returns "flag" if chunk data is valid in info_ptr. */
01385 extern PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_structp png_ptr,
01386 png_infop info_ptr, png_uint_32 flag));
01387 
01388 /* Returns number of bytes needed to hold a transformed row. */
01389 extern PNG_EXPORT(png_uint_32,png_get_rowbytes) PNGARG((png_structp png_ptr,
01390 png_infop info_ptr));
01391 
01392 /* Returns number of color channels in image. */
01393 extern PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_structp png_ptr,
01394 png_infop info_ptr));
01395 
01396 #ifdef PNG_EASY_ACCESS_SUPPORTED
01397 /* Returns image width in pixels. */
01398 extern PNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_structp
01399 png_ptr, png_infop info_ptr));
01400 
01401 /* Returns image height in pixels. */
01402 extern PNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_structp
01403 png_ptr, png_infop info_ptr));
01404 
01405 /* Returns image bit_depth. */
01406 extern PNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_structp
01407 png_ptr, png_infop info_ptr));
01408 
01409 /* Returns image color_type. */
01410 extern PNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_structp
01411 png_ptr, png_infop info_ptr));
01412 
01413 /* Returns image filter_type. */
01414 extern PNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_structp
01415 png_ptr, png_infop info_ptr));
01416 
01417 /* Returns image interlace_type. */
01418 extern PNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_structp
01419 png_ptr, png_infop info_ptr));
01420 
01421 /* Returns image compression_type. */
01422 extern PNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_structp
01423 png_ptr, png_infop info_ptr));
01424 
01425 /* Returns image resolution in pixels per meter, from pHYs chunk data. */
01426 extern PNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_structp
01427 png_ptr, png_infop info_ptr));
01428 extern PNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_structp
01429 png_ptr, png_infop info_ptr));
01430 extern PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_structp
01431 png_ptr, png_infop info_ptr));
01432 
01433 /* Returns pixel aspect ratio, computed from pHYs chunk data.  */
01434 extern PNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_structp
01435 png_ptr, png_infop info_ptr));
01436 
01437 /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */
01438 extern PNG_EXPORT(png_uint_32, png_get_x_offset_pixels) PNGARG((png_structp
01439 png_ptr, png_infop info_ptr));
01440 extern PNG_EXPORT(png_uint_32, png_get_y_offset_pixels) PNGARG((png_structp
01441 png_ptr, png_infop info_ptr));
01442 extern PNG_EXPORT(png_uint_32, png_get_x_offset_microns) PNGARG((png_structp
01443 png_ptr, png_infop info_ptr));
01444 extern PNG_EXPORT(png_uint_32, png_get_y_offset_microns) PNGARG((png_structp
01445 png_ptr, png_infop info_ptr));
01446 
01447 #endif /* PNG_EASY_ACCESS_SUPPORTED */
01448 
01449 /* Returns pointer to signature string read from PNG header */
01450 extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr,
01451 png_infop info_ptr));
01452 
01453 #if defined(PNG_READ_bKGD_SUPPORTED)
01454 extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr,
01455    png_infop info_ptr, png_color_16p *background));
01456 #endif /* PNG_READ_bKGD_SUPPORTED */
01457 
01458 #if defined(PNG_READ_bKGD_SUPPORTED) || defined(PNG_WRITE_bKGD_SUPPORTED)
01459 extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr,
01460    png_infop info_ptr, png_color_16p background));
01461 #endif /* PNG_READ_bKGD_SUPPORTED || PNG_WRITE_bKGD_SUPPORTED */
01462 
01463 #if defined(PNG_READ_cHRM_SUPPORTED)
01464 extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr,
01465    png_infop info_ptr, double *white_x, double *white_y, double *red_x,
01466    double *red_y, double *green_x, double *green_y, double *blue_x,
01467    double *blue_y));
01468 #endif /* PNG_READ_cHRM_SUPPORTED */
01469 
01470 #if defined(PNG_READ_cHRM_SUPPORTED) || defined(PNG_WRITE_cHRM_SUPPORTED)
01471 extern PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr,
01472    png_infop info_ptr, double white_x, double white_y, double red_x,
01473    double red_y, double green_x, double green_y, double blue_x, double blue_y));
01474 #endif /* PNG_READ_cHRM_SUPPORTED || PNG_WRITE_cHRM_SUPPORTED */
01475 
01476 #if defined(PNG_READ_gAMA_SUPPORTED)
01477 extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr,
01478    png_infop info_ptr, double *file_gamma));
01479 #endif /* PNG_READ_gAMA_SUPPORTED */
01480 
01481 #if defined(PNG_READ_gAMA_SUPPORTED) || defined(PNG_WRITE_gAMA_SUPPORTED)
01482 extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr,
01483    png_infop info_ptr, double file_gamma));
01484 #endif /* PNG_READ_gAMA_SUPPORTED || PNG_WRITE_gAMA_SUPPORTED */
01485 
01486 #if defined(PNG_READ_hIST_SUPPORTED)
01487 extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr,
01488    png_infop info_ptr, png_uint_16p *hist));
01489 #endif /* PNG_READ_hIST_SUPPORTED */
01490 
01491 #if defined(PNG_READ_hIST_SUPPORTED) || defined(PNG_WRITE_hIST_SUPPORTED)
01492 extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr,
01493    png_infop info_ptr, png_uint_16p hist));
01494 #endif /* PNG_READ_hIST_SUPPORTED || PNG_WRITE_hIST_SUPPORTED */
01495 
01496 extern PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr,
01497    png_infop info_ptr, png_uint_32 *width, png_uint_32 *height,
01498    int *bit_depth, int *color_type, int *interlace_type,
01499    int *compression_type, int *filter_type));
01500   
01501 extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr,
01502    png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth,
01503    int color_type, int interlace_type, int compression_type, int filter_type));
01504 
01505 #if defined(PNG_READ_oFFs_SUPPORTED)
01506 extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr,
01507    png_infop info_ptr, png_uint_32 *offset_x, png_uint_32 *offset_y,
01508    int *unit_type));
01509 #endif /* PNG_READ_oFFs_SUPPORTED */
01510 
01511 #if defined(PNG_READ_oFFs_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
01512 extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr,
01513    png_infop info_ptr, png_uint_32 offset_x, png_uint_32 offset_y,
01514    int unit_type));
01515 #endif /* PNG_READ_oFFs_SUPPORTED || PNG_WRITE_oFFs_SUPPORTED */
01516 
01517 #if defined(PNG_READ_pCAL_SUPPORTED)
01518 extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr,
01519    png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1,
01520    int *type, int *nparams, png_charp *units, png_charpp *params));
01521 #endif /* PNG_READ_pCAL_SUPPORTED */
01522 
01523 #if defined(PNG_READ_pCAL_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED)
01524 extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr,
01525    png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1,
01526    int type, int nparams, png_charp units, png_charpp params));
01527 #endif /* PNG_READ_pCAL_SUPPORTED || PNG_WRITE_pCAL_SUPPORTED */
01528 
01529 #if defined(PNG_READ_pHYs_SUPPORTED)
01530 extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr,
01531    png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
01532 #endif /* PNG_READ_pHYs_SUPPORTED */
01533 
01534 #if defined(PNG_READ_pHYs_SUPPORTED) || defined(PNG_WRITE_pHYs_SUPPORTED)
01535 extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr,
01536    png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type));
01537 #endif /* PNG_READ_pHYs_SUPPORTED || PNG_WRITE_pHYs_SUPPORTED */
01538 
01539 extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr,
01540    png_infop info_ptr, png_colorp *palette, int *num_palette));
01541 
01542 extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr,
01543    png_infop info_ptr, png_colorp palette, int num_palette));
01544 
01545 #if defined(PNG_READ_sBIT_SUPPORTED)
01546 extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr,
01547    png_infop info_ptr, png_color_8p *sig_bit));
01548 #endif /* PNG_READ_sBIT_SUPPORTED */
01549 
01550 #if defined(PNG_READ_sBIT_SUPPORTED) || defined(PNG_WRITE_sBIT_SUPPORTED)
01551 extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr,
01552    png_infop info_ptr, png_color_8p sig_bit));
01553 #endif /* PNG_READ_sBIT_SUPPORTED || PNG_WRITE_sBIT_SUPPORTED */
01554 
01555 #if defined(PNG_READ_sRGB_SUPPORTED)
01556 extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr,
01557    png_infop info_ptr, int *intent));
01558 #endif /* PNG_READ_sRGB_SUPPORTED */
01559 
01560 #if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED)
01561 extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr,
01562    png_infop info_ptr, int intent));
01563 extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr,
01564    png_infop info_ptr, int intent));
01565 #endif /* PNG_READ_sRGB_SUPPORTED || PNG_WRITE_sRGB_SUPPORTED */
01566 
01567 #if defined(PNG_READ_tEXt_SUPPORTED) || defined(PNG_READ_zTXt_SUPPORTED)
01568 /* png_get_text also returns the number of text chunks in text_ptr */
01569 extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr,
01570    png_infop info_ptr, png_textp *text_ptr, int *num_text));
01571 #endif /* PNG_READ_tEXt_SUPPORTED || PNG_READ_zTXt_SUPPORTED */
01572 
01573 #if defined(PNG_READ_tEXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
01574     defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_WRITE_zTXt_SUPPORTED)
01575 extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr,
01576    png_infop info_ptr, png_textp text_ptr, int num_text));
01577 #endif /* PNG_READ_OR_WRITE_tEXt_OR_zTXt_SUPPORTED */
01578 
01579 #if defined(PNG_READ_tIME_SUPPORTED)
01580 extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr,
01581    png_infop info_ptr, png_timep *mod_time));
01582 #endif /* PNG_READ_tIME_SUPPORTED */
01583 
01584 #if defined(PNG_READ_tIME_SUPPORTED) || defined(PNG_WRITE_tIME_SUPPORTED)
01585 extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr,
01586    png_infop info_ptr, png_timep mod_time));
01587 #endif /* PNG_READ_tIME_SUPPORTED || PNG_WRITE_tIME_SUPPORTED */
01588 
01589 #if defined(PNG_READ_tRNS_SUPPORTED)
01590 extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr,
01591    png_infop info_ptr, png_bytep *trans, int *num_trans,
01592    png_color_16p *trans_values));
01593 #endif /* PNG_READ_tRNS_SUPPORTED */
01594 
01595 #if defined(PNG_READ_tRNS_SUPPORTED) || defined(PNG_WRITE_tRNS_SUPPORTED)
01596 extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
01597    png_infop info_ptr, png_bytep trans, int num_trans,
01598    png_color_16p trans_values));
01599 #endif /* PNG_READ_tRNS_SUPPORTED || PNG_WRITE_tRNS_SUPPORTED */
01600 
01601 /* Define PNG_DEBUG at compile time for debugging information.  Higher
01602  * numbers for PNG_DEBUG mean more debugging information.  This has
01603  * only been added since version 0.95 so it is not implemented throughout
01604  * libpng yet, but more support will be added as needed.
01605  */
01606 #ifdef PNG_DEBUG
01607 #if (PNG_DEBUG > 0)
01608 #ifndef PNG_DEBUG_FILE
01609 #define PNG_DEBUG_FILE stderr
01610 #endif /* PNG_DEBUG_FILE */
01611 
01612 #define png_debug(l,m)        if (PNG_DEBUG > l) \
01613                                  fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \
01614                                     (l==2 ? "\t\t":(l>2 ? "\t\t\t":""))))
01615 #define png_debug1(l,m,p1)    if (PNG_DEBUG > l) \
01616                                  fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \
01617                                     (l==2 ? "\t\t":(l>2 ? "\t\t\t":""))),p1)
01618 #define png_debug2(l,m,p1,p2) if (PNG_DEBUG > l) \
01619                                  fprintf(PNG_DEBUG_FILE,"%s"m,(l==1 ? "\t" : \
01620                                     (l==2 ? "\t\t":(l>2 ? "\t\t\t":""))),p1,p2)
01621 #endif /* (PNG_DEBUG > 0) */
01622 #endif /* PNG_DEBUG */
01623 #ifndef png_debug
01624 #define png_debug(l, m)
01625 #endif
01626 #ifndef png_debug1
01627 #define png_debug1(l, m, p1)
01628 #endif
01629 #ifndef png_debug2
01630 #define png_debug2(l, m, p1, p2)
01631 #endif
01632 
01633 extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr));
01634 extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr));
01635 
01636 #ifdef PNG_NO_EXTERN
01637 /* this only gets included in png.c */
01638 
01639 #define PNG_GET_HEADER \
01640 png_charp \
01641 png_get_header_version(png_structp png_ptr) \
01642 { \
01643    if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */ \
01644       return("\n libpng version 1.0.5 - October 15, 1999 (header)\n"); \
01645    return("\n libpng version 1.0.5 - October 15, 1999 (header)\n"); \
01646 }
01647 #endif
01648 
01649 #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
01650 /* With these routines we avoid an integer divide, which will be slower on
01651  * most machines.  However, it does take more operations than the corresponding
01652  * divide method, so it may be slower on a few RISC systems.  There are two
01653  * shifts (by 8 or 16 bits) and an addition, versus a single integer divide.
01654  *
01655  * Note that the rounding factors are NOT supposed to be the same!  128 and
01656  * 32768 are correct for the NODIV code; 127 and 32767 are correct for the
01657  * standard method.
01658  *
01659  * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ]
01660  */
01661 
01662  /* fg and bg should be in `gamma 1.0' space; alpha is the opacity          */
01663 
01664 #  define png_composite(composite, fg, alpha, bg)                            \
01665      { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) * (png_uint_16)(alpha) \
01666                         +        (png_uint_16)(bg)*(png_uint_16)(255 -       \
01667                         (png_uint_16)(alpha)) + (png_uint_16)128);           \
01668        (composite) = (png_byte)((temp + (temp >> 8)) >> 8); }
01669 
01670 #  define png_composite_16(composite, fg, alpha, bg)                         \
01671      { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) * (png_uint_32)(alpha) \
01672                         + (png_uint_32)(bg)*(png_uint_32)(65535L -           \
01673                         (png_uint_32)(alpha)) + (png_uint_32)32768L);        \
01674        (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
01675 
01676 #else  /* standard method using integer division */
01677 
01678 #  define png_composite(composite, fg, alpha, bg)                            \
01679      (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) +    \
01680        (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) +       \
01681        (png_uint_16)127) / 255)
01682 
01683 #  define png_composite_16(composite, fg, alpha, bg)                         \
01684      (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
01685        (png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) +      \
01686        (png_uint_32)32767) / (png_uint_32)65535L)
01687 
01688 #endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
01689 
01690 /* These next functions are used internally in the code.  They generally
01691  * shouldn't be used unless you are writing code to add or replace some
01692  * functionality in libpng.  More information about most functions can
01693  * be found in the files where the functions are located.
01694  */
01695 
01696 #if defined(PNG_INTERNAL)
01697 
01698 /* Various modes of operation.  Note that after an init, mode is set to
01699  * zero automatically when the structure is created.
01700  */
01701 #define PNG_BEFORE_IHDR       0x00
01702 #define PNG_HAVE_IHDR         0x01
01703 #define PNG_HAVE_PLTE         0x02
01704 #define PNG_HAVE_IDAT         0x04
01705 #define PNG_AFTER_IDAT        0x08
01706 #define PNG_HAVE_IEND         0x10
01707 #define PNG_HAVE_gAMA         0x20
01708 #define PNG_HAVE_cHRM         0x40
01709 #define PNG_HAVE_sRGB         0x80
01710 
01711 /* push model modes */
01712 #define PNG_READ_SIG_MODE   0
01713 #define PNG_READ_CHUNK_MODE 1
01714 #define PNG_READ_IDAT_MODE  2
01715 #define PNG_SKIP_MODE       3
01716 #define PNG_READ_tEXt_MODE  4
01717 #define PNG_READ_zTXt_MODE  5
01718 #define PNG_READ_DONE_MODE  6
01719 #define PNG_ERROR_MODE      7
01720 
01721 /* flags for the transformations the PNG library does on the image data */
01722 #define PNG_BGR                0x0001
01723 #define PNG_INTERLACE          0x0002
01724 #define PNG_PACK               0x0004
01725 #define PNG_SHIFT              0x0008
01726 #define PNG_SWAP_BYTES         0x0010
01727 #define PNG_INVERT_MONO        0x0020
01728 #define PNG_DITHER             0x0040
01729 #define PNG_BACKGROUND         0x0080
01730 #define PNG_BACKGROUND_EXPAND  0x0100
01731                           /*   0x0200 unused */
01732 #define PNG_16_TO_8            0x0400
01733 #define PNG_RGBA               0x0800
01734 #define PNG_EXPAND             0x1000
01735 #define PNG_GAMMA              0x2000
01736 #define PNG_GRAY_TO_RGB        0x4000
01737 #define PNG_FILLER             0x8000
01738 #define PNG_PACKSWAP          0x10000L
01739 #define PNG_SWAP_ALPHA        0x20000L
01740 #define PNG_STRIP_ALPHA       0x40000L
01741 #define PNG_INVERT_ALPHA      0x80000L
01742 #define PNG_USER_TRANSFORM   0x100000L
01743 #define PNG_RGB_TO_GRAY_ERR  0x200000L
01744 #define PNG_RGB_TO_GRAY_WARN 0x400000L
01745 #define PNG_RGB_TO_GRAY      0x600000L  /* two bits, RGB_TO_GRAY_ERR|WARN */
01746 
01747 /* flags for png_create_struct */
01748 #define PNG_STRUCT_PNG   0x0001
01749 #define PNG_STRUCT_INFO  0x0002
01750 
01751 /* Scaling factor for filter heuristic weighting calculations */
01752 #define PNG_WEIGHT_SHIFT 8
01753 #define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT))
01754 #define PNG_COST_SHIFT 3
01755 #define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))
01756 
01757 /* flags for the png_ptr->flags rather than declaring a byte for each one */
01758 #define PNG_FLAG_ZLIB_CUSTOM_STRATEGY     0x0001
01759 #define PNG_FLAG_ZLIB_CUSTOM_LEVEL        0x0002
01760 #define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL    0x0004
01761 #define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS  0x0008
01762 #define PNG_FLAG_ZLIB_CUSTOM_METHOD       0x0010
01763 #define PNG_FLAG_ZLIB_FINISHED            0x0020
01764 #define PNG_FLAG_ROW_INIT                 0x0040
01765 #define PNG_FLAG_FILLER_AFTER             0x0080
01766 #define PNG_FLAG_CRC_ANCILLARY_USE        0x0100
01767 #define PNG_FLAG_CRC_ANCILLARY_NOWARN     0x0200
01768 #define PNG_FLAG_CRC_CRITICAL_USE         0x0400
01769 #define PNG_FLAG_CRC_CRITICAL_IGNORE      0x0800
01770 #define PNG_FLAG_FREE_PALETTE             0x1000
01771 #define PNG_FLAG_FREE_TRANS               0x2000
01772 #define PNG_FLAG_FREE_HIST                0x4000
01773 #define PNG_FLAG_HAVE_CHUNK_HEADER        0x8000L
01774 #define PNG_FLAG_WROTE_tIME              0x10000L
01775 #define PNG_FLAG_BACKGROUND_IS_GRAY      0x20000L
01776 
01777 #define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
01778                                      PNG_FLAG_CRC_ANCILLARY_NOWARN)
01779 
01780 #define PNG_FLAG_CRC_CRITICAL_MASK  (PNG_FLAG_CRC_CRITICAL_USE | \
01781                                      PNG_FLAG_CRC_CRITICAL_IGNORE)
01782 
01783 #define PNG_FLAG_CRC_MASK           (PNG_FLAG_CRC_ANCILLARY_MASK | \
01784                                      PNG_FLAG_CRC_CRITICAL_MASK)
01785 
01786 /* save typing and make code easier to understand */
01787 #define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
01788    abs((int)((c1).green) - (int)((c2).green)) + \
01789    abs((int)((c1).blue) - (int)((c2).blue)))
01790 
01791 /* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
01792 #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
01793 /* place to hold the signature string for a PNG file. */
01794 extern png_byte FARDATA png_sig[8];
01795 
01796 /* Constant strings for known chunk types.  If you need to add a chunk,
01797  * add a string holding the name here.  See png.c for more details.  We
01798  * can't selectively include these, since we still check for chunk in the
01799  * wrong locations with these labels.
01800  */
01801 extern png_byte FARDATA png_IHDR[5];
01802 extern png_byte FARDATA png_IDAT[5];
01803 extern png_byte FARDATA png_IEND[5];
01804 extern png_byte FARDATA png_PLTE[5];
01805 extern png_byte FARDATA png_bKGD[5];
01806 extern png_byte FARDATA png_cHRM[5];
01807 extern png_byte FARDATA png_gAMA[5];
01808 extern png_byte FARDATA png_hIST[5];
01809 extern png_byte FARDATA png_oFFs[5];
01810 extern png_byte FARDATA png_pCAL[5];
01811 extern png_byte FARDATA png_pHYs[5];
01812 extern png_byte FARDATA png_sBIT[5];
01813 extern png_byte FARDATA png_sRGB[5];
01814 extern png_byte FARDATA png_tEXt[5];
01815 extern png_byte FARDATA png_tIME[5];
01816 extern png_byte FARDATA png_tRNS[5];
01817 extern png_byte FARDATA png_zTXt[5];
01818 
01819 #endif /* PNG_NO_EXTERN */
01820 
01821 /* Inline macros to do direct reads of bytes from the input buffer.  These
01822  * require that you are using an architecture that uses PNG byte ordering
01823  * (MSB first) and supports unaligned data storage.  I think that PowerPC
01824  * in big-endian mode and 680x0 are the only ones that will support this.
01825  * The x86 line of processors definitely do not.  The png_get_int_32()
01826  * routine also assumes we are using two's complement format for negative
01827  * values, which is almost certainly true.
01828  */
01829 #if defined(PNG_READ_BIG_ENDIAN_SUPPORTED)
01830 #if defined(PNG_READ_pCAL_SUPPORTED)
01831 #define png_get_int_32(buf) ( *((png_int_32p) (buf)))
01832 #endif /* PNG_READ_pCAL_SUPPORTED */
01833 #define png_get_uint_32(buf) ( *((png_uint_32p) (buf)))
01834 #define png_get_uint_16(buf) ( *((png_uint_16p) (buf)))
01835 #else
01836 #if defined(PNG_READ_pCAL_SUPPORTED)
01837 PNG_EXTERN png_int_32 png_get_int_32 PNGARG((png_bytep buf));
01838 #endif /* PNG_READ_pCAL_SUPPORTED */
01839 PNG_EXTERN png_uint_32 png_get_uint_32 PNGARG((png_bytep buf));
01840 PNG_EXTERN png_uint_16 png_get_uint_16 PNGARG((png_bytep buf));
01841 #endif /* PNG_READ_BIG_ENDIAN_SUPPORTED */
01842 
01843 /* Initialize png_ptr struct for reading, and allocate any other memory.
01844  * (old interface - NOT DLL EXPORTED).
01845  */
01846 extern void png_read_init PNGARG((png_structp png_ptr));
01847 
01848 /* Initialize png_ptr struct for writing, and allocate any other memory.
01849  * (old interface - NOT DLL EXPORTED).
01850  */
01851 extern void png_write_init PNGARG((png_structp png_ptr));
01852 
01853 /* allocate memory for an internal libpng struct */
01854 PNG_EXTERN png_voidp png_create_struct PNGARG((int type));
01855 
01856 /* free memory from internal libpng struct */
01857 PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));
01858 
01859 PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr
01860   malloc_fn));
01861 PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
01862    png_free_ptr free_fn));
01863 
01864 /* free any memory that info_ptr points to and reset struct. */
01865 PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
01866    png_infop info_ptr));
01867 
01868 /* Function to allocate memory for zlib. */
01869 PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
01870 
01871 /* function to free memory for zlib */
01872 PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
01873 
01874 /* reset the CRC variable */
01875 PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));
01876 
01877 /* Write the "data" buffer to whatever output you are using. */
01878 PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data,
01879    png_size_t length));
01880 
01881 /* Read data from whatever input you are using into the "data" buffer */
01882 PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
01883    png_size_t length));
01884 
01885 /* read bytes into buf, and update png_ptr->crc */
01886 PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
01887    png_size_t length));
01888 
01889 /* read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
01890 PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip));
01891 
01892 /* read the CRC from the file and compare it to the libpng calculated CRC */
01893 PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr));
01894 
01895 /* Calculate the CRC over a section of data.  Note that we are only
01896  * passing a maximum of 64K on systems that have this as a memory limit,
01897  * since this is the maximum buffer size we can specify.
01898  */
01899 PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
01900    png_size_t length));
01901 
01902 #if defined(PNG_WRITE_FLUSH_SUPPORTED)
01903 PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
01904 #endif
01905 
01906 /* Place a 32-bit number into a buffer in PNG byte order (big-endian).
01907  * The only currently known PNG chunks that use signed numbers are
01908  * the ancillary extension chunks, oFFs and pCAL.
01909  */
01910 PNG_EXTERN void png_save_uint_32 PNGARG((png_bytep buf, png_uint_32 i));
01911 
01912 #if defined(PNG_WRITE_pCAL_SUPPORTED)
01913 PNG_EXTERN void png_save_int_32 PNGARG((png_bytep buf, png_int_32 i));
01914 #endif
01915 
01916 /* Place a 16-bit number into a buffer in PNG byte order.
01917  * The parameter is declared unsigned int, not png_uint_16,
01918  * just to avoid potential problems on pre-ANSI C compilers.
01919  */
01920 PNG_EXTERN void png_save_uint_16 PNGARG((png_bytep buf, unsigned int i));
01921 
01922 /* simple function to write the signature */
01923 PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr));
01924 
01925 /* write various chunks */
01926 
01927 /* Write the IHDR chunk, and update the png_struct with the necessary
01928  * information.
01929  */
01930 PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
01931    png_uint_32 height,
01932    int bit_depth, int color_type, int compression_type, int filter_type,
01933    int interlace_type));
01934 
01935 PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,
01936    png_uint_32 num_pal));
01937 
01938 PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
01939    png_size_t length));
01940 
01941 PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr));
01942 
01943 #if defined(PNG_WRITE_gAMA_SUPPORTED)
01944 PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma));
01945 #endif
01946 
01947 #if defined(PNG_WRITE_sBIT_SUPPORTED)
01948 PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
01949    int color_type));
01950 #endif
01951 
01952 #if defined(PNG_WRITE_cHRM_SUPPORTED)
01953 PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr,
01954    double white_x, double white_y,
01955    double red_x, double red_y, double green_x, double green_y,
01956    double blue_x, double blue_y));
01957 #endif
01958 
01959 #if defined(PNG_WRITE_sRGB_SUPPORTED)
01960 PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,
01961    int intent));
01962 #endif
01963 
01964 #if defined(PNG_WRITE_tRNS_SUPPORTED)
01965 PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,
01966    png_color_16p values, int number, int color_type));
01967 #endif
01968 
01969 #if defined(PNG_WRITE_bKGD_SUPPORTED)
01970 PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr,
01971    png_color_16p values, int color_type));
01972 #endif
01973 
01974 #if defined(PNG_WRITE_hIST_SUPPORTED)
01975 PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,
01976    int num_hist));
01977 #endif
01978 
01979 #if defined(PNG_WRITE_tEXt_SUPPORTED) || defined(PNG_WRITE_zTXt_SUPPORTED) || \
01980     defined(PNG_WRITE_pCAL_SUPPORTED)
01981 PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,
01982    png_charp key, png_charpp new_key));
01983 #endif
01984 
01985 #if defined(PNG_WRITE_tEXt_SUPPORTED)
01986 PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,
01987    png_charp text, png_size_t text_len));
01988 #endif
01989 
01990 #if defined(PNG_WRITE_zTXt_SUPPORTED)
01991 PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,
01992    png_charp text, png_size_t text_len, int compression));
01993 #endif
01994 
01995 #if defined(PNG_WRITE_oFFs_SUPPORTED)
01996 PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
01997    png_uint_32 x_offset, png_uint_32 y_offset, int unit_type));
01998 #endif
01999 
02000 #if defined(PNG_WRITE_pCAL_SUPPORTED)
02001 PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose,
02002    png_int_32 X0, png_int_32 X1, int type, int nparams,
02003    png_charp units, png_charpp params));
02004 #endif
02005 
02006 #if defined(PNG_WRITE_pHYs_SUPPORTED)
02007 PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr,
02008    png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
02009    int unit_type));
02010 #endif
02011 
02012 #if defined(PNG_WRITE_tIME_SUPPORTED)
02013 PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
02014    png_timep mod_time));
02015 #endif
02016 
02017 /* Called when finished processing a row of data */
02018 PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr));
02019 
02020 /* Internal use only.   Called before first row of data */
02021 PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));
02022 
02023 #if defined(PNG_READ_GAMMA_SUPPORTED)
02024 PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr));
02025 #endif
02026 
02027 /* combine a row of data, dealing with alpha, etc. if requested */
02028 PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
02029    int mask));
02030 
02031 #if defined(PNG_READ_INTERLACING_SUPPORTED)
02032 /* expand an interlaced row */
02033 PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
02034    png_bytep row, int pass, png_uint_32 transformations));
02035 #endif
02036 
02037 #if defined(PNG_WRITE_INTERLACING_SUPPORTED)
02038 /* grab pixels out of a row for an interlaced pass */
02039 PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
02040    png_bytep row, int pass));
02041 #endif
02042 
02043 /* unfilter a row */
02044 PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr,
02045    png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter));
02046 
02047 /* Choose the best filter to use and filter the row data */
02048 PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr,
02049    png_row_infop row_info));
02050 
02051 /* Write out the filtered row. */
02052 PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr,
02053    png_bytep filtered_row));
02054 /* finish a row while reading, dealing with interlacing passes, etc. */
02055 PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr));
02056 
02057 /* initialize the row buffers, etc. */
02058 PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr));
02059 /* optional call to update the users info structure */
02060 PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,
02061    png_infop info_ptr));
02062 
02063 /* these are the functions that do the transformations */
02064 #if defined(PNG_READ_FILLER_SUPPORTED)
02065 PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,
02066    png_bytep row, png_uint_32 filler, png_uint_32 flags));
02067 #endif
02068 
02069 #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
02070 PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info,
02071    png_bytep row));
02072 #endif
02073 
02074 #if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
02075 PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info,
02076    png_bytep row));
02077 #endif
02078 
02079 #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
02080 PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info,
02081    png_bytep row));
02082 #endif
02083 
02084 #if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
02085 PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info,
02086    png_bytep row));
02087 #endif
02088 
02089 #if defined(PNG_WRITE_FILLER_SUPPORTED) || \
02090     defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
02091 PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info,
02092    png_bytep row, png_uint_32 flags));
02093 #endif
02094 
02095 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
02096 PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));
02097 #endif
02098 
02099 #if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)
02100 PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row));
02101 #endif
02102 
02103 #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
02104 PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop
02105    row_info, png_bytep row));
02106 #endif
02107 
02108 #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
02109 PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,
02110    png_bytep row));
02111 #endif
02112 
02113 #if defined(PNG_READ_PACK_SUPPORTED)
02114 PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));
02115 #endif
02116 
02117 #if defined(PNG_READ_SHIFT_SUPPORTED)
02118 PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row,
02119    png_color_8p sig_bits));
02120 #endif
02121 
02122 #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
02123 PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));
02124 #endif
02125 
02126 #if defined(PNG_READ_16_TO_8_SUPPORTED)
02127 PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));
02128 #endif
02129 
02130 #if defined(PNG_READ_DITHER_SUPPORTED)
02131 PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info,
02132    png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup));
02133 
02134 #  if defined(PNG_CORRECT_PALETTE_SUPPORTED)
02135 PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,
02136    png_colorp palette, int num_palette));
02137 #  endif
02138 #endif
02139 
02140 #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
02141 PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row));
02142 #endif
02143 
02144 #if defined(PNG_WRITE_PACK_SUPPORTED)
02145 PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info,
02146    png_bytep row, png_uint_32 bit_depth));
02147 #endif
02148 
02149 #if defined(PNG_WRITE_SHIFT_SUPPORTED)
02150 PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,
02151    png_color_8p bit_depth));
02152 #endif
02153 
02154 #if defined(PNG_READ_BACKGROUND_SUPPORTED)
02155 PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
02156    png_color_16p trans_values, png_color_16p background,
02157    png_color_16p background_1,
02158    png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
02159    png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
02160    png_uint_16pp gamma_16_to_1, int gamma_shift));
02161 #endif
02162 
02163 #if defined(PNG_READ_GAMMA_SUPPORTED)
02164 PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row,
02165    png_bytep gamma_table, png_uint_16pp gamma_16_table,
02166    int gamma_shift));
02167 #endif
02168 
02169 #if defined(PNG_READ_EXPAND_SUPPORTED)
02170 PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info,
02171    png_bytep row, png_colorp palette, png_bytep trans, int num_trans));
02172 PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,
02173    png_bytep row, png_color_16p trans_value));
02174 #endif
02175 
02176 /* The following decodes the appropriate chunks, and does error correction,
02177  * then calls the appropriate callback for the chunk if it is valid.
02178  */
02179 
02180 /* decode the IHDR chunk */
02181 PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,
02182    png_uint_32 length));
02183 PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,
02184    png_uint_32 length));
02185 PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr,
02186    png_uint_32 length));
02187 
02188 #if defined(PNG_READ_gAMA_SUPPORTED)
02189 PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,
02190    png_uint_32 length));
02191 #endif
02192 
02193 #if defined(PNG_READ_sBIT_SUPPORTED)
02194 PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,
02195    png_uint_32 length));
02196 #endif
02197 
02198 #if defined(PNG_READ_cHRM_SUPPORTED)
02199 PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,
02200    png_uint_32 length));
02201 #endif
02202 
02203 #if defined(PNG_READ_sRGB_SUPPORTED)
02204 PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr,
02205    png_uint_32 length));
02206 #endif
02207 
02208 #if defined(PNG_READ_tRNS_SUPPORTED)
02209 PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
02210    png_uint_32 length));
02211 #endif
02212 
02213 #if defined(PNG_READ_bKGD_SUPPORTED)
02214 PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,
02215    png_uint_32 length));
02216 #endif
02217 
02218 #if defined(PNG_READ_hIST_SUPPORTED)
02219 PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
02220    png_uint_32 length));
02221 #endif
02222 
02223 #if defined(PNG_READ_oFFs_SUPPORTED)
02224 PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,
02225    png_uint_32 length));
02226 #endif
02227 
02228 #if defined(PNG_READ_pCAL_SUPPORTED)
02229 PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
02230    png_uint_32 length));
02231 #endif
02232 
02233 #if defined(PNG_READ_pHYs_SUPPORTED)
02234 PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,
02235    png_uint_32 length));
02236 #endif
02237 
02238 #if defined(PNG_READ_tIME_SUPPORTED)
02239 PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,
02240    png_uint_32 length));
02241 #endif
02242 
02243 #if defined(PNG_READ_tEXt_SUPPORTED)
02244 PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
02245    png_uint_32 length));
02246 #endif
02247 
02248 #if defined(PNG_READ_zTXt_SUPPORTED)
02249 PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
02250    png_uint_32 length));
02251 #endif
02252 
02253 PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
02254    png_infop info_ptr, png_uint_32 length));
02255 
02256 PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,
02257    png_bytep chunk_name));
02258 
02259 /* handle the transformations for reading and writing */
02260 PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));
02261 PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr));
02262 
02263 PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr));
02264 
02265 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
02266 PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr,
02267    png_infop info_ptr));
02268 PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr,
02269    png_infop info_ptr));
02270 PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr));
02271 PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr,
02272    png_uint_32 length));
02273 PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr));
02274 PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr,
02275    png_bytep buffer, png_size_t length));
02276 PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr));
02277 PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr,
02278    png_bytep buffer, png_size_t buffer_length));
02279 PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr));
02280 PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr,
02281    png_bytep buffer, png_size_t buffer_length));
02282 PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr));
02283 PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr,
02284    png_infop info_ptr, png_uint_32 length));
02285 PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr,
02286    png_infop info_ptr));
02287 PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr,
02288    png_infop info_ptr));
02289 PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row));
02290 PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr,
02291    png_infop info_ptr));
02292 PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr,
02293    png_infop info_ptr));
02294 PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr));
02295 #if defined(PNG_READ_tEXt_SUPPORTED)
02296 PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr,
02297    png_infop info_ptr, png_uint_32 length));
02298 PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr,
02299    png_infop info_ptr));
02300 #endif
02301 #if defined(PNG_READ_zTXt_SUPPORTED)
02302 PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr,
02303    png_infop info_ptr, png_uint_32 length));
02304 PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr,
02305    png_infop info_ptr));
02306 #endif
02307 
02308 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
02309 
02310 #endif /* PNG_INTERNAL */
02311 
02312 #ifdef __cplusplus
02313 }
02314 #endif
02315 
02316 /* do not put anything past this line */
02317 #endif /* _PNG_H */

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000