Back to index

plt-scheme  4.2.1
png.h
Go to the documentation of this file.
00001 /* png.h - header file for PNG reference library
00002  *
00003  * libpng version 1.2.5 - October 3, 2002
00004  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
00005  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
00006  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
00007  *
00008  * Authors and maintainers:
00009  *  libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
00010  *  libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
00011  *  libpng versions 0.97, January 1998, through 1.2.5 - October 3, 2002: Glenn
00012  *  See also "Contributing Authors", below.
00013  *
00014  * Note about libpng version numbers:
00015  *
00016  *    Due to various miscommunications, unforeseen code incompatibilities
00017  *    and occasional factors outside the authors' control, version numbering
00018  *    on the library has not always been consistent and straightforward.
00019  *    The following table summarizes matters since version 0.89c, which was
00020  *    the first widely used release:
00021  *
00022  *    source                 png.h  png.h  shared-lib
00023  *    version                string   int  version
00024  *    -------                ------ -----  ----------
00025  *    0.89c "1.0 beta 3"     0.89      89  1.0.89
00026  *    0.90  "1.0 beta 4"     0.90      90  0.90  [should have been 2.0.90]
00027  *    0.95  "1.0 beta 5"     0.95      95  0.95  [should have been 2.0.95]
00028  *    0.96  "1.0 beta 6"     0.96      96  0.96  [should have been 2.0.96]
00029  *    0.97b "1.00.97 beta 7" 1.00.97   97  1.0.1 [should have been 2.0.97]
00030  *    0.97c                  0.97      97  2.0.97
00031  *    0.98                   0.98      98  2.0.98
00032  *    0.99                   0.99      98  2.0.99
00033  *    0.99a-m                0.99      99  2.0.99
00034  *    1.00                   1.00     100  2.1.0 [100 should be 10000]
00035  *    1.0.0      (from here on, the   100  2.1.0 [100 should be 10000]
00036  *    1.0.1       png.h string is   10001  2.1.0
00037  *    1.0.1a-e    identical to the  10002  from here on, the shared library
00038  *    1.0.2       source version)   10002  is 2.V where V is the source code
00039  *    1.0.2a-b                      10003  version, except as noted.
00040  *    1.0.3                         10003
00041  *    1.0.3a-d                      10004
00042  *    1.0.4                         10004
00043  *    1.0.4a-f                      10005
00044  *    1.0.5 (+ 2 patches)           10005
00045  *    1.0.5a-d                      10006
00046  *    1.0.5e-r                      10100 (not source compatible)
00047  *    1.0.5s-v                      10006 (not binary compatible)
00048  *    1.0.6 (+ 3 patches)           10006 (still binary incompatible)
00049  *    1.0.6d-f                      10007 (still binary incompatible)
00050  *    1.0.6g                        10007
00051  *    1.0.6h                        10007  10.6h (testing xy.z so-numbering)
00052  *    1.0.6i                        10007  10.6i
00053  *    1.0.6j                        10007  2.1.0.6j (incompatible with 1.0.0)
00054  *    1.0.7beta11-14        DLLNUM  10007  2.1.0.7beta11-14 (binary compatible)
00055  *    1.0.7beta15-18           1    10007  2.1.0.7beta15-18 (binary compatible)
00056  *    1.0.7rc1-2               1    10007  2.1.0.7rc1-2 (binary compatible)
00057  *    1.0.7                    1    10007  (still compatible)
00058  *    1.0.8beta1-4             1    10008  2.1.0.8beta1-4
00059  *    1.0.8rc1                 1    10008  2.1.0.8rc1
00060  *    1.0.8                    1    10008  2.1.0.8
00061  *    1.0.9beta1-6             1    10009  2.1.0.9beta1-6
00062  *    1.0.9rc1                 1    10009  2.1.0.9rc1
00063  *    1.0.9beta7-10            1    10009  2.1.0.9beta7-10
00064  *    1.0.9rc2                 1    10009  2.1.0.9rc2
00065  *    1.0.9                    1    10009  2.1.0.9
00066  *    1.0.10beta1              1    10010  2.1.0.10beta1
00067  *    1.0.10rc1                1    10010  2.1.0.10rc1
00068  *    1.0.10                   1    10010  2.1.0.10
00069  *    1.0.11beta1-3            1    10011  2.1.0.11beta1-3
00070  *    1.0.11rc1                1    10011  2.1.0.11rc1
00071  *    1.0.11                   1    10011  2.1.0.11
00072  *    1.0.12beta1-2            2    10012  2.1.0.12beta1-2
00073  *    1.0.12rc1                2    10012  2.1.0.12rc1
00074  *    1.0.12                   2    10012  2.1.0.12
00075  *    1.1.0a-f                 -    10100  2.1.1.0a-f (branch abandoned)
00076  *    1.2.0beta1-2             2    10200  2.1.2.0beta1-2
00077  *    1.2.0beta3-5             3    10200  3.1.2.0beta3-5
00078  *    1.2.0rc1                 3    10200  3.1.2.0rc1
00079  *    1.2.0                    3    10200  3.1.2.0
00080  *    1.2.1beta1-4             3    10201  3.1.2.1beta1-4
00081  *    1.2.1rc1-2               3    10201  3.1.2.1rc1-2
00082  *    1.2.1                    3    10201  3.1.2.1
00083  *    1.2.2beta1-6            12    10202  12.so.0.1.2.2beta1-6
00084  *    1.0.13beta1             10    10013  10.so.0.1.0.13beta1
00085  *    1.0.13rc1               10    10013  10.so.0.1.0.13rc1
00086  *    1.2.2rc1                12    10202  12.so.0.1.2.2rc1
00087  *    1.0.13                  10    10013  10.so.0.1.0.13
00088  *    1.2.2                   12    10202  12.so.0.1.2.2
00089  *    1.2.3rc1-6              12    10203  12.so.0.1.2.3rc1-6
00090  *    1.2.3                   12    10203  12.so.0.1.2.3
00091  *    1.2.4beta1-3            13    10204  12.so.0.1.2.4beta1-3
00092  *    1.0.14rc1               13    10014  10.so.0.1.0.14rc1
00093  *    1.2.4rc1                13    10204  12.so.0.1.2.4rc1
00094  *    1.0.14                  10    10014  10.so.0.1.0.14
00095  *    1.2.4                   13    10204  12.so.0.1.2.4
00096  *    1.2.5beta1-2            13    10205  12.so.0.1.2.5beta1-2
00097  *    1.0.15rc1-3             10    10015  10.so.0.1.0.15rc1-3
00098  *    1.2.5rc1-3              13    10205  12.so.0.1.2.5rc1-3
00099  *    1.0.15                  10    10015  10.so.0.1.0.15
00100  *    1.2.5                   13    10205  12.so.0.1.2.5
00101  *
00102  *    Henceforth the source version will match the shared-library major
00103  *    and minor numbers; the shared-library major version number will be
00104  *    used for changes in backward compatibility, as it is intended.  The
00105  *    PNG_LIBPNG_VER macro, which is not used within libpng but is available
00106  *    for applications, is an unsigned integer of the form xyyzz corresponding
00107  *    to the source version x.y.z (leading zeros in y and z).  Beta versions
00108  *    were given the previous public release number plus a letter, until
00109  *    version 1.0.6j; from then on they were given the upcoming public
00110  *    release number plus "betaNN" or "rcN".
00111  *
00112  *    Binary incompatibility exists only when applications make direct access
00113  *    to the info_ptr or png_ptr members through png.h, and the compiled
00114  *    application is loaded with a different version of the library.
00115  *
00116  *    DLLNUM will change each time there are forward or backward changes
00117  *    in binary compatibility (e.g., when a new feature is added).
00118  *
00119  * See libpng.txt or libpng.3 for more information.  The PNG specification
00120  * is available as RFC 2083 <ftp://ftp.uu.net/graphics/png/documents/>
00121  * and as a W3C Recommendation <http://www.w3.org/TR/REC.png.html>
00122  */
00123 
00124 /*
00125  * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
00126  *
00127  * If you modify libpng you may insert additional notices immediately following
00128  * this sentence.
00129  *
00130  * libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are
00131  * Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
00132  * distributed according to the same disclaimer and license as libpng-1.0.6
00133  * with the following individuals added to the list of Contributing Authors
00134  *
00135  *    Simon-Pierre Cadieux
00136  *    Eric S. Raymond
00137  *    Gilles Vollant
00138  *
00139  * and with the following additions to the disclaimer:
00140  *
00141  *    There is no warranty against interference with your enjoyment of the
00142  *    library or against infringement.  There is no warranty that our
00143  *    efforts or the library will fulfill any of your particular purposes
00144  *    or needs.  This library is provided with all faults, and the entire
00145  *    risk of satisfactory quality, performance, accuracy, and effort is with
00146  *    the user.
00147  *
00148  * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
00149  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
00150  * Distributed according to the same disclaimer and license as libpng-0.96,
00151  * with the following individuals added to the list of Contributing Authors:
00152  *
00153  *    Tom Lane
00154  *    Glenn Randers-Pehrson
00155  *    Willem van Schaik
00156  *
00157  * libpng versions 0.89, June 1996, through 0.96, May 1997, are
00158  * Copyright (c) 1996, 1997 Andreas Dilger
00159  * Distributed according to the same disclaimer and license as libpng-0.88,
00160  * with the following individuals added to the list of Contributing Authors:
00161  *
00162  *    John Bowler
00163  *    Kevin Bracey
00164  *    Sam Bushell
00165  *    Magnus Holmgren
00166  *    Greg Roelofs
00167  *    Tom Tanner
00168  *
00169  * libpng versions 0.5, May 1995, through 0.88, January 1996, are
00170  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
00171  *
00172  * For the purposes of this copyright and license, "Contributing Authors"
00173  * is defined as the following set of individuals:
00174  *
00175  *    Andreas Dilger
00176  *    Dave Martindale
00177  *    Guy Eric Schalnat
00178  *    Paul Schmidt
00179  *    Tim Wegner
00180  *
00181  * The PNG Reference Library is supplied "AS IS".  The Contributing Authors
00182  * and Group 42, Inc. disclaim all warranties, expressed or implied,
00183  * including, without limitation, the warranties of merchantability and of
00184  * fitness for any purpose.  The Contributing Authors and Group 42, Inc.
00185  * assume no liability for direct, indirect, incidental, special, exemplary,
00186  * or consequential damages, which may result from the use of the PNG
00187  * Reference Library, even if advised of the possibility of such damage.
00188  *
00189  * Permission is hereby granted to use, copy, modify, and distribute this
00190  * source code, or portions hereof, for any purpose, without fee, subject
00191  * to the following restrictions:
00192  *
00193  * 1. The origin of this source code must not be misrepresented.
00194  *
00195  * 2. Altered versions must be plainly marked as such and
00196  * must not be misrepresented as being the original source.
00197  *
00198  * 3. This Copyright notice may not be removed or altered from
00199  *    any source or altered source distribution.
00200  *
00201  * The Contributing Authors and Group 42, Inc. specifically permit, without
00202  * fee, and encourage the use of this source code as a component to
00203  * supporting the PNG file format in commercial products.  If you use this
00204  * source code in a product, acknowledgment is not required but would be
00205  * appreciated.
00206  */
00207 
00208 /*
00209  * A "png_get_copyright" function is available, for convenient use in "about"
00210  * boxes and the like:
00211  *
00212  * printf("%s",png_get_copyright(NULL));
00213  *
00214  * Also, the PNG logo (in PNG format, of course) is supplied in the
00215  * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
00216  */
00217 
00218 /*
00219  * Libpng is OSI Certified Open Source Software.  OSI Certified is a
00220  * certification mark of the Open Source Initiative.
00221  */
00222 
00223 /*
00224  * The contributing authors would like to thank all those who helped
00225  * with testing, bug fixes, and patience.  This wouldn't have been
00226  * possible without all of you.
00227  *
00228  * Thanks to Frank J. T. Wojcik for helping with the documentation.
00229  */
00230 
00231 /*
00232  * Y2K compliance in libpng:
00233  * =========================
00234  *
00235  *    October 3, 2002
00236  *
00237  *    Since the PNG Development group is an ad-hoc body, we can't make
00238  *    an official declaration.
00239  *
00240  *    This is your unofficial assurance that libpng from version 0.71 and
00241  *    upward through 1.2.5 are Y2K compliant.  It is my belief that earlier
00242  *    versions were also Y2K compliant.
00243  *
00244  *    Libpng only has three year fields.  One is a 2-byte unsigned integer
00245  *    that will hold years up to 65535.  The other two hold the date in text
00246  *    format, and will hold years up to 9999.
00247  *
00248  *    The integer is
00249  *        "png_uint_16 year" in png_time_struct.
00250  *
00251  *    The strings are
00252  *        "png_charp time_buffer" in png_struct and
00253  *        "near_time_buffer", which is a local character string in png.c.
00254  *
00255  *    There are seven time-related functions:
00256  *        png.c: png_convert_to_rfc_1123() in png.c
00257  *          (formerly png_convert_to_rfc_1152() in error)
00258  *        png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
00259  *        png_convert_from_time_t() in pngwrite.c
00260  *        png_get_tIME() in pngget.c
00261  *        png_handle_tIME() in pngrutil.c, called in pngread.c
00262  *        png_set_tIME() in pngset.c
00263  *        png_write_tIME() in pngwutil.c, called in pngwrite.c
00264  *
00265  *    All handle dates properly in a Y2K environment.  The
00266  *    png_convert_from_time_t() function calls gmtime() to convert from system
00267  *    clock time, which returns (year - 1900), which we properly convert to
00268  *    the full 4-digit year.  There is a possibility that applications using
00269  *    libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
00270  *    function, or that they are incorrectly passing only a 2-digit year
00271  *    instead of "year - 1900" into the png_convert_from_struct_tm() function,
00272  *    but this is not under our control.  The libpng documentation has always
00273  *    stated that it works with 4-digit years, and the APIs have been
00274  *    documented as such.
00275  *
00276  *    The tIME chunk itself is also Y2K compliant.  It uses a 2-byte unsigned
00277  *    integer to hold the year, and can hold years as large as 65535.
00278  *
00279  *    zlib, upon which libpng depends, is also Y2K compliant.  It contains
00280  *    no date-related code.
00281  *
00282  *       Glenn Randers-Pehrson
00283  *       libpng maintainer
00284  *       PNG Development Group
00285  */
00286 
00287 #ifndef PNG_H
00288 #define PNG_H
00289 
00290 /* This is not the place to learn how to use libpng.  The file libpng.txt
00291  * describes how to use libpng, and the file example.c summarizes it
00292  * with some code on which to build.  This file is useful for looking
00293  * at the actual function definitions and structure components.
00294  */
00295 
00296 /* Version information for png.h - this should match the version in png.c */
00297 #define PNG_LIBPNG_VER_STRING "1.2.5"
00298 
00299 #define PNG_LIBPNG_VER_SONUM   0
00300 #define PNG_LIBPNG_VER_DLLNUM  %DLLNUM%
00301 
00302 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
00303 #define PNG_LIBPNG_VER_MAJOR   1
00304 #define PNG_LIBPNG_VER_MINOR   2
00305 #define PNG_LIBPNG_VER_RELEASE 5
00306 /* This should match the numeric part of the final component of
00307  * PNG_LIBPNG_VER_STRING, omitting any leading zero: */
00308 
00309 #define PNG_LIBPNG_VER_BUILD  0
00310 
00311 #define PNG_LIBPNG_BUILD_ALPHA    1
00312 #define PNG_LIBPNG_BUILD_BETA     2
00313 #define PNG_LIBPNG_BUILD_RC       3
00314 #define PNG_LIBPNG_BUILD_STABLE   4
00315 #define PNG_LIBPNG_BUILD_TYPEMASK 7
00316 #define PNG_LIBPNG_BUILD_PATCH    8 /* Can be OR'ed with STABLE only */
00317 #define PNG_LIBPNG_BUILD_TYPE 4
00318 
00319 /* Careful here.  At one time, Guy wanted to use 082, but that would be octal.
00320  * We must not include leading zeros.
00321  * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
00322  * version 1.0.0 was mis-numbered 100 instead of 10000).  From
00323  * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release */
00324 #define PNG_LIBPNG_VER 10205 /* 1.2.5 */
00325 
00326 #ifndef PNG_VERSION_INFO_ONLY
00327 
00328 /* include the compression library's header */
00329 #include "zlib.h"
00330 
00331 /* include all user configurable info, including optional assembler routines */
00332 #include "pngconf.h"
00333 
00334 /* Inhibit C++ name-mangling for libpng functions but not for system calls. */
00335 #ifdef __cplusplus
00336 extern "C" {
00337 #endif /* __cplusplus */
00338 
00339 /* This file is arranged in several sections.  The first section contains
00340  * structure and type definitions.  The second section contains the external
00341  * library functions, while the third has the internal library functions,
00342  * which applications aren't expected to use directly.
00343  */
00344 
00345 #ifndef PNG_NO_TYPECAST_NULL
00346 #define int_p_NULL                (int *)NULL
00347 #define png_bytep_NULL            (png_bytep)NULL
00348 #define png_bytepp_NULL           (png_bytepp)NULL
00349 #define png_doublep_NULL          (png_doublep)NULL
00350 #define png_error_ptr_NULL        (png_error_ptr)NULL
00351 #define png_flush_ptr_NULL        (png_flush_ptr)NULL
00352 #define png_free_ptr_NULL         (png_free_ptr)NULL
00353 #define png_infopp_NULL           (png_infopp)NULL
00354 #define png_malloc_ptr_NULL       (png_malloc_ptr)NULL
00355 #define png_read_status_ptr_NULL  (png_read_status_ptr)NULL
00356 #define png_rw_ptr_NULL           (png_rw_ptr)NULL
00357 #define png_structp_NULL          (png_structp)NULL
00358 #define png_uint_16p_NULL         (png_uint_16p)NULL
00359 #define png_voidp_NULL            (png_voidp)NULL
00360 #define png_write_status_ptr_NULL (png_write_status_ptr)NULL
00361 #else
00362 #define int_p_NULL                NULL
00363 #define png_bytep_NULL            NULL
00364 #define png_bytepp_NULL           NULL
00365 #define png_doublep_NULL          NULL
00366 #define png_error_ptr_NULL        NULL
00367 #define png_flush_ptr_NULL        NULL
00368 #define png_free_ptr_NULL         NULL
00369 #define png_infopp_NULL           NULL
00370 #define png_malloc_ptr_NULL       NULL
00371 #define png_read_status_ptr_NULL  NULL
00372 #define png_rw_ptr_NULL           NULL
00373 #define png_structp_NULL          NULL
00374 #define png_uint_16p_NULL         NULL
00375 #define png_voidp_NULL            NULL
00376 #define png_write_status_ptr_NULL NULL
00377 #endif
00378 
00379 /* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
00380 #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
00381 /* Version information for C files, stored in png.c.  This had better match
00382  * the version above.
00383  */
00384 #ifdef PNG_USE_GLOBAL_ARRAYS
00385 PNG_EXPORT_VAR (const char) png_libpng_ver[18];
00386   /* need room for 99.99.99beta99z */
00387 #else
00388 #define png_libpng_ver png_get_header_ver(NULL)
00389 #endif
00390 
00391 #ifdef PNG_USE_GLOBAL_ARRAYS
00392 /* This was removed in version 1.0.5c */
00393 /* Structures to facilitate easy interlacing.  See png.c for more details */
00394 PNG_EXPORT_VAR (const int FARDATA) png_pass_start[7];
00395 PNG_EXPORT_VAR (const int FARDATA) png_pass_inc[7];
00396 PNG_EXPORT_VAR (const int FARDATA) png_pass_ystart[7];
00397 PNG_EXPORT_VAR (const int FARDATA) png_pass_yinc[7];
00398 PNG_EXPORT_VAR (const int FARDATA) png_pass_mask[7];
00399 PNG_EXPORT_VAR (const int FARDATA) png_pass_dsp_mask[7];
00400 #ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
00401 PNG_EXPORT_VAR (const int FARDATA) png_pass_width[7];
00402 #endif
00403 /* This isn't currently used.  If you need it, see png.c for more details.
00404 PNG_EXPORT_VAR (const int FARDATA) png_pass_height[7];
00405 */
00406 #endif
00407 
00408 #endif /* PNG_NO_EXTERN */
00409 
00410 /* Three color definitions.  The order of the red, green, and blue, (and the
00411  * exact size) is not important, although the size of the fields need to
00412  * be png_byte or png_uint_16 (as defined below).
00413  */
00414 typedef struct png_color_struct
00415 {
00416    png_byte red;
00417    png_byte green;
00418    png_byte blue;
00419 } png_color;
00420 typedef png_color FAR * png_colorp;
00421 typedef png_color FAR * FAR * png_colorpp;
00422 
00423 typedef struct png_color_16_struct
00424 {
00425    png_byte index;    /* used for palette files */
00426    png_uint_16 red;   /* for use in red green blue files */
00427    png_uint_16 green;
00428    png_uint_16 blue;
00429    png_uint_16 gray;  /* for use in grayscale files */
00430 } png_color_16;
00431 typedef png_color_16 FAR * png_color_16p;
00432 typedef png_color_16 FAR * FAR * png_color_16pp;
00433 
00434 typedef struct png_color_8_struct
00435 {
00436    png_byte red;   /* for use in red green blue files */
00437    png_byte green;
00438    png_byte blue;
00439    png_byte gray;  /* for use in grayscale files */
00440    png_byte alpha; /* for alpha channel files */
00441 } png_color_8;
00442 typedef png_color_8 FAR * png_color_8p;
00443 typedef png_color_8 FAR * FAR * png_color_8pp;
00444 
00445 /*
00446  * The following two structures are used for the in-core representation
00447  * of sPLT chunks.
00448  */
00449 typedef struct png_sPLT_entry_struct
00450 {
00451    png_uint_16 red;
00452    png_uint_16 green;
00453    png_uint_16 blue;
00454    png_uint_16 alpha;
00455    png_uint_16 frequency;
00456 } png_sPLT_entry;
00457 typedef png_sPLT_entry FAR * png_sPLT_entryp;
00458 typedef png_sPLT_entry FAR * FAR * png_sPLT_entrypp;
00459 
00460 /*  When the depth of the sPLT palette is 8 bits, the color and alpha samples
00461  *  occupy the LSB of their respective members, and the MSB of each member
00462  *  is zero-filled.  The frequency member always occupies the full 16 bits.
00463  */
00464 
00465 typedef struct png_sPLT_struct
00466 {
00467    png_charp name;           /* palette name */
00468    png_byte depth;           /* depth of palette samples */
00469    png_sPLT_entryp entries;  /* palette entries */
00470    png_int_32 nentries;      /* number of palette entries */
00471 } png_sPLT_t;
00472 typedef png_sPLT_t FAR * png_sPLT_tp;
00473 typedef png_sPLT_t FAR * FAR * png_sPLT_tpp;
00474 
00475 #ifdef PNG_TEXT_SUPPORTED
00476 /* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file,
00477  * and whether that contents is compressed or not.  The "key" field
00478  * points to a regular zero-terminated C string.  The "text", "lang", and
00479  * "lang_key" fields can be regular C strings, empty strings, or NULL pointers.
00480  * However, the * structure returned by png_get_text() will always contain
00481  * regular zero-terminated C strings (possibly empty), never NULL pointers,
00482  * so they can be safely used in printf() and other string-handling functions.
00483  */
00484 typedef struct png_text_struct
00485 {
00486    int  compression;       /* compression value:
00487                              -1: tEXt, none
00488                               0: zTXt, deflate
00489                               1: iTXt, none
00490                               2: iTXt, deflate  */
00491    png_charp key;          /* keyword, 1-79 character description of "text" */
00492    png_charp text;         /* comment, may be an empty string (ie "")
00493                               or a NULL pointer */
00494    png_size_t text_length; /* length of the text string */
00495 #ifdef PNG_iTXt_SUPPORTED
00496    png_size_t itxt_length; /* length of the itxt string */
00497    png_charp lang;         /* language code, 0-79 characters
00498                               or a NULL pointer */
00499    png_charp lang_key;     /* keyword translated UTF-8 string, 0 or more
00500                               chars or a NULL pointer */
00501 #endif
00502 } png_text;
00503 typedef png_text FAR * png_textp;
00504 typedef png_text FAR * FAR * png_textpp;
00505 #endif
00506 
00507 /* Supported compression types for text in PNG files (tEXt, and zTXt).
00508  * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */
00509 #define PNG_TEXT_COMPRESSION_NONE_WR -3
00510 #define PNG_TEXT_COMPRESSION_zTXt_WR -2
00511 #define PNG_TEXT_COMPRESSION_NONE    -1
00512 #define PNG_TEXT_COMPRESSION_zTXt     0
00513 #define PNG_ITXT_COMPRESSION_NONE     1
00514 #define PNG_ITXT_COMPRESSION_zTXt     2
00515 #define PNG_TEXT_COMPRESSION_LAST     3  /* Not a valid value */
00516 
00517 /* png_time is a way to hold the time in an machine independent way.
00518  * Two conversions are provided, both from time_t and struct tm.  There
00519  * is no portable way to convert to either of these structures, as far
00520  * as I know.  If you know of a portable way, send it to me.  As a side
00521  * note - PNG has always been Year 2000 compliant!
00522  */
00523 typedef struct png_time_struct
00524 {
00525    png_uint_16 year; /* full year, as in, 1995 */
00526    png_byte month;   /* month of year, 1 - 12 */
00527    png_byte day;     /* day of month, 1 - 31 */
00528    png_byte hour;    /* hour of day, 0 - 23 */
00529    png_byte minute;  /* minute of hour, 0 - 59 */
00530    png_byte second;  /* second of minute, 0 - 60 (for leap seconds) */
00531 } png_time;
00532 typedef png_time FAR * png_timep;
00533 typedef png_time FAR * FAR * png_timepp;
00534 
00535 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
00536 /* png_unknown_chunk is a structure to hold queued chunks for which there is
00537  * no specific support.  The idea is that we can use this to queue
00538  * up private chunks for output even though the library doesn't actually
00539  * know about their semantics.
00540  */
00541 typedef struct png_unknown_chunk_t
00542 {
00543     png_byte name[5];
00544     png_byte *data;
00545     png_size_t size;
00546 
00547     /* libpng-using applications should NOT directly modify this byte. */
00548     png_byte location; /* mode of operation at read time */
00549 }
00550 png_unknown_chunk;
00551 typedef png_unknown_chunk FAR * png_unknown_chunkp;
00552 typedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp;
00553 #endif
00554 
00555 /* png_info is a structure that holds the information in a PNG file so
00556  * that the application can find out the characteristics of the image.
00557  * If you are reading the file, this structure will tell you what is
00558  * in the PNG file.  If you are writing the file, fill in the information
00559  * you want to put into the PNG file, then call png_write_info().
00560  * The names chosen should be very close to the PNG specification, so
00561  * consult that document for information about the meaning of each field.
00562  *
00563  * With libpng < 0.95, it was only possible to directly set and read the
00564  * the values in the png_info_struct, which meant that the contents and
00565  * order of the values had to remain fixed.  With libpng 0.95 and later,
00566  * however, there are now functions that abstract the contents of
00567  * png_info_struct from the application, so this makes it easier to use
00568  * libpng with dynamic libraries, and even makes it possible to use
00569  * libraries that don't have all of the libpng ancillary chunk-handing
00570  * functionality.
00571  *
00572  * In any case, the order of the parameters in png_info_struct should NOT
00573  * be changed for as long as possible to keep compatibility with applications
00574  * that use the old direct-access method with png_info_struct.
00575  *
00576  * The following members may have allocated storage attached that should be
00577  * cleaned up before the structure is discarded: palette, trans, text,
00578  * pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
00579  * splt_palettes, scal_unit, row_pointers, and unknowns.   By default, these
00580  * are automatically freed when the info structure is deallocated, if they were
00581  * allocated internally by libpng.  This behavior can be changed by means
00582  * of the png_data_freer() function.
00583  *
00584  * More allocation details: all the chunk-reading functions that
00585  * change these members go through the corresponding png_set_*
00586  * functions.  A function to clear these members is available: see
00587  * png_free_data().  The png_set_* functions do not depend on being
00588  * able to point info structure members to any of the storage they are
00589  * passed (they make their own copies), EXCEPT that the png_set_text
00590  * functions use the same storage passed to them in the text_ptr or
00591  * itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
00592  * functions do not make their own copies.
00593  */
00594 typedef struct png_info_struct
00595 {
00596    /* the following are necessary for every PNG file */
00597    png_uint_32 width;       /* width of image in pixels (from IHDR) */
00598    png_uint_32 height;      /* height of image in pixels (from IHDR) */
00599    png_uint_32 valid;       /* valid chunk data (see PNG_INFO_ below) */
00600    png_uint_32 rowbytes;    /* bytes needed to hold an untransformed row */
00601    png_colorp palette;      /* array of color values (valid & PNG_INFO_PLTE) */
00602    png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
00603    png_uint_16 num_trans;   /* number of transparent palette color (tRNS) */
00604    png_byte bit_depth;      /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
00605    png_byte color_type;     /* see PNG_COLOR_TYPE_ below (from IHDR) */
00606    /* The following three should have been named *_method not *_type */
00607    png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
00608    png_byte filter_type;    /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
00609    png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
00610 
00611    /* The following is informational only on read, and not used on writes. */
00612    png_byte channels;       /* number of data channels per pixel (1, 2, 3, 4) */
00613    png_byte pixel_depth;    /* number of bits per pixel */
00614    png_byte spare_byte;     /* to align the data, and for future use */
00615    png_byte signature[8];   /* magic bytes read by libpng from start of file */
00616 
00617    /* The rest of the data is optional.  If you are reading, check the
00618     * valid field to see if the information in these are valid.  If you
00619     * are writing, set the valid field to those chunks you want written,
00620     * and initialize the appropriate fields below.
00621     */
00622 
00623 #if defined(PNG_gAMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
00624    /* The gAMA chunk describes the gamma characteristics of the system
00625     * on which the image was created, normally in the range [1.0, 2.5].
00626     * Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
00627     */
00628    float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
00629 #endif
00630 
00631 #if defined(PNG_sRGB_SUPPORTED)
00632     /* GR-P, 0.96a */
00633     /* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
00634    png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */
00635 #endif
00636 
00637 #if defined(PNG_TEXT_SUPPORTED)
00638    /* The tEXt, and zTXt chunks contain human-readable textual data in
00639     * uncompressed, compressed, and optionally compressed forms, respectively.
00640     * The data in "text" is an array of pointers to uncompressed,
00641     * null-terminated C strings. Each chunk has a keyword that describes the
00642     * textual data contained in that chunk.  Keywords are not required to be
00643     * unique, and the text string may be empty.  Any number of text chunks may
00644     * be in an image.
00645     */
00646    int num_text; /* number of comments read/to write */
00647    int max_text; /* current size of text array */
00648    png_textp text; /* array of comments read/to write */
00649 #endif /* PNG_TEXT_SUPPORTED */
00650 
00651 #if defined(PNG_tIME_SUPPORTED)
00652    /* The tIME chunk holds the last time the displayed image data was
00653     * modified.  See the png_time struct for the contents of this struct.
00654     */
00655    png_time mod_time;
00656 #endif
00657 
00658 #if defined(PNG_sBIT_SUPPORTED)
00659    /* The sBIT chunk specifies the number of significant high-order bits
00660     * in the pixel data.  Values are in the range [1, bit_depth], and are
00661     * only specified for the channels in the pixel data.  The contents of
00662     * the low-order bits is not specified.  Data is valid if
00663     * (valid & PNG_INFO_sBIT) is non-zero.
00664     */
00665    png_color_8 sig_bit; /* significant bits in color channels */
00666 #endif
00667 
00668 #if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
00669 defined(PNG_READ_BACKGROUND_SUPPORTED)
00670    /* The tRNS chunk supplies transparency data for paletted images and
00671     * other image types that don't need a full alpha channel.  There are
00672     * "num_trans" transparency values for a paletted image, stored in the
00673     * same order as the palette colors, starting from index 0.  Values
00674     * for the data are in the range [0, 255], ranging from fully transparent
00675     * to fully opaque, respectively.  For non-paletted images, there is a
00676     * single color specified that should be treated as fully transparent.
00677     * Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
00678     */
00679    png_bytep trans; /* transparent values for paletted image */
00680    png_color_16 trans_values; /* transparent color for non-palette image */
00681 #endif
00682 
00683 #if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
00684    /* The bKGD chunk gives the suggested image background color if the
00685     * display program does not have its own background color and the image
00686     * is needs to composited onto a background before display.  The colors
00687     * in "background" are normally in the same color space/depth as the
00688     * pixel data.  Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
00689     */
00690    png_color_16 background;
00691 #endif
00692 
00693 #if defined(PNG_oFFs_SUPPORTED)
00694    /* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
00695     * and downwards from the top-left corner of the display, page, or other
00696     * application-specific co-ordinate space.  See the PNG_OFFSET_ defines
00697     * below for the unit types.  Valid if (valid & PNG_INFO_oFFs) non-zero.
00698     */
00699    png_int_32 x_offset; /* x offset on page */
00700    png_int_32 y_offset; /* y offset on page */
00701    png_byte offset_unit_type; /* offset units type */
00702 #endif
00703 
00704 #if defined(PNG_pHYs_SUPPORTED)
00705    /* The pHYs chunk gives the physical pixel density of the image for
00706     * display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
00707     * defines below).  Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
00708     */
00709    png_uint_32 x_pixels_per_unit; /* horizontal pixel density */
00710    png_uint_32 y_pixels_per_unit; /* vertical pixel density */
00711    png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
00712 #endif
00713 
00714 #if defined(PNG_hIST_SUPPORTED)
00715    /* The hIST chunk contains the relative frequency or importance of the
00716     * various palette entries, so that a viewer can intelligently select a
00717     * reduced-color palette, if required.  Data is an array of "num_palette"
00718     * values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
00719     * is non-zero.
00720     */
00721    png_uint_16p hist;
00722 #endif
00723 
00724 #ifdef PNG_cHRM_SUPPORTED
00725    /* The cHRM chunk describes the CIE color characteristics of the monitor
00726     * on which the PNG was created.  This data allows the viewer to do gamut
00727     * mapping of the input image to ensure that the viewer sees the same
00728     * colors in the image as the creator.  Values are in the range
00729     * [0.0, 0.8].  Data valid if (valid & PNG_INFO_cHRM) non-zero.
00730     */
00731 #ifdef PNG_FLOATING_POINT_SUPPORTED
00732    float x_white;
00733    float y_white;
00734    float x_red;
00735    float y_red;
00736    float x_green;
00737    float y_green;
00738    float x_blue;
00739    float y_blue;
00740 #endif
00741 #endif
00742 
00743 #if defined(PNG_pCAL_SUPPORTED)
00744    /* The pCAL chunk describes a transformation between the stored pixel
00745     * values and original physical data values used to create the image.
00746     * The integer range [0, 2^bit_depth - 1] maps to the floating-point
00747     * range given by [pcal_X0, pcal_X1], and are further transformed by a
00748     * (possibly non-linear) transformation function given by "pcal_type"
00749     * and "pcal_params" into "pcal_units".  Please see the PNG_EQUATION_
00750     * defines below, and the PNG-Group's PNG extensions document for a
00751     * complete description of the transformations and how they should be
00752     * implemented, and for a description of the ASCII parameter strings.
00753     * Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
00754     */
00755    png_charp pcal_purpose;  /* pCAL chunk description string */
00756    png_int_32 pcal_X0;      /* minimum value */
00757    png_int_32 pcal_X1;      /* maximum value */
00758    png_charp pcal_units;    /* Latin-1 string giving physical units */
00759    png_charpp pcal_params;  /* ASCII strings containing parameter values */
00760    png_byte pcal_type;      /* equation type (see PNG_EQUATION_ below) */
00761    png_byte pcal_nparams;   /* number of parameters given in pcal_params */
00762 #endif
00763 
00764 /* New members added in libpng-1.0.6 */
00765 #ifdef PNG_FREE_ME_SUPPORTED
00766    png_uint_32 free_me;     /* flags items libpng is responsible for freeing */
00767 #endif
00768 
00769 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
00770    /* storage for unknown chunks that the library doesn't recognize. */
00771    png_unknown_chunkp unknown_chunks;
00772    png_size_t unknown_chunks_num;
00773 #endif
00774 
00775 #if defined(PNG_iCCP_SUPPORTED)
00776    /* iCCP chunk data. */
00777    png_charp iccp_name;     /* profile name */
00778    png_charp iccp_profile;  /* International Color Consortium profile data */
00779                             /* Note to maintainer: should be png_bytep */
00780    png_uint_32 iccp_proflen;  /* ICC profile data length */
00781    png_byte iccp_compression; /* Always zero */
00782 #endif
00783 
00784 #if defined(PNG_sPLT_SUPPORTED)
00785    /* data on sPLT chunks (there may be more than one). */
00786    png_sPLT_tp splt_palettes;
00787    png_uint_32 splt_palettes_num;
00788 #endif
00789 
00790 #if defined(PNG_sCAL_SUPPORTED)
00791    /* The sCAL chunk describes the actual physical dimensions of the
00792     * subject matter of the graphic.  The chunk contains a unit specification
00793     * a byte value, and two ASCII strings representing floating-point
00794     * values.  The values are width and height corresponsing to one pixel
00795     * in the image.  This external representation is converted to double
00796     * here.  Data values are valid if (valid & PNG_INFO_sCAL) is non-zero.
00797     */
00798    png_byte scal_unit;         /* unit of physical scale */
00799 #ifdef PNG_FLOATING_POINT_SUPPORTED
00800    double scal_pixel_width;    /* width of one pixel */
00801    double scal_pixel_height;   /* height of one pixel */
00802 #endif
00803 #ifdef PNG_FIXED_POINT_SUPPORTED
00804    png_charp scal_s_width;     /* string containing height */
00805    png_charp scal_s_height;    /* string containing width */
00806 #endif
00807 #endif
00808 
00809 #if defined(PNG_INFO_IMAGE_SUPPORTED)
00810    /* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS) non-zero */
00811    /* Data valid if (valid & PNG_INFO_IDAT) non-zero */
00812    png_bytepp row_pointers;        /* the image bits */
00813 #endif
00814 
00815 #if defined(PNG_FIXED_POINT_SUPPORTED) && defined(PNG_gAMA_SUPPORTED)
00816    png_fixed_point int_gamma; /* gamma of image, if (valid & PNG_INFO_gAMA) */
00817 #endif
00818 
00819 #if defined(PNG_cHRM_SUPPORTED) && defined(PNG_FIXED_POINT_SUPPORTED)
00820    png_fixed_point int_x_white;
00821    png_fixed_point int_y_white;
00822    png_fixed_point int_x_red;
00823    png_fixed_point int_y_red;
00824    png_fixed_point int_x_green;
00825    png_fixed_point int_y_green;
00826    png_fixed_point int_x_blue;
00827    png_fixed_point int_y_blue;
00828 #endif
00829 
00830 } png_info;
00831 
00832 typedef png_info FAR * png_infop;
00833 typedef png_info FAR * FAR * png_infopp;
00834 
00835 /* Maximum positive integer used in PNG is (2^31)-1 */
00836 #define PNG_MAX_UINT ((png_uint_32)0x7fffffffL)
00837 
00838 /* These describe the color_type field in png_info. */
00839 /* color type masks */
00840 #define PNG_COLOR_MASK_PALETTE    1
00841 #define PNG_COLOR_MASK_COLOR      2
00842 #define PNG_COLOR_MASK_ALPHA      4
00843 
00844 /* color types.  Note that not all combinations are legal */
00845 #define PNG_COLOR_TYPE_GRAY 0
00846 #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
00847 #define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
00848 #define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
00849 #define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
00850 /* aliases */
00851 #define PNG_COLOR_TYPE_RGBA  PNG_COLOR_TYPE_RGB_ALPHA
00852 #define PNG_COLOR_TYPE_GA  PNG_COLOR_TYPE_GRAY_ALPHA
00853 
00854 /* This is for compression type. PNG 1.0-1.2 only define the single type. */
00855 #define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */
00856 #define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE
00857 
00858 /* This is for filter type. PNG 1.0-1.2 only define the single type. */
00859 #define PNG_FILTER_TYPE_BASE      0 /* Single row per-byte filtering */
00860 #define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */
00861 #define PNG_FILTER_TYPE_DEFAULT   PNG_FILTER_TYPE_BASE
00862 
00863 /* These are for the interlacing type.  These values should NOT be changed. */
00864 #define PNG_INTERLACE_NONE        0 /* Non-interlaced image */
00865 #define PNG_INTERLACE_ADAM7       1 /* Adam7 interlacing */
00866 #define PNG_INTERLACE_LAST        2 /* Not a valid value */
00867 
00868 /* These are for the oFFs chunk.  These values should NOT be changed. */
00869 #define PNG_OFFSET_PIXEL          0 /* Offset in pixels */
00870 #define PNG_OFFSET_MICROMETER     1 /* Offset in micrometers (1/10^6 meter) */
00871 #define PNG_OFFSET_LAST           2 /* Not a valid value */
00872 
00873 /* These are for the pCAL chunk.  These values should NOT be changed. */
00874 #define PNG_EQUATION_LINEAR       0 /* Linear transformation */
00875 #define PNG_EQUATION_BASE_E       1 /* Exponential base e transform */
00876 #define PNG_EQUATION_ARBITRARY    2 /* Arbitrary base exponential transform */
00877 #define PNG_EQUATION_HYPERBOLIC   3 /* Hyperbolic sine transformation */
00878 #define PNG_EQUATION_LAST         4 /* Not a valid value */
00879 
00880 /* These are for the sCAL chunk.  These values should NOT be changed. */
00881 #define PNG_SCALE_UNKNOWN         0 /* unknown unit (image scale) */
00882 #define PNG_SCALE_METER           1 /* meters per pixel */
00883 #define PNG_SCALE_RADIAN          2 /* radians per pixel */
00884 #define PNG_SCALE_LAST            3 /* Not a valid value */
00885 
00886 /* These are for the pHYs chunk.  These values should NOT be changed. */
00887 #define PNG_RESOLUTION_UNKNOWN    0 /* pixels/unknown unit (aspect ratio) */
00888 #define PNG_RESOLUTION_METER      1 /* pixels/meter */
00889 #define PNG_RESOLUTION_LAST       2 /* Not a valid value */
00890 
00891 /* These are for the sRGB chunk.  These values should NOT be changed. */
00892 #define PNG_sRGB_INTENT_PERCEPTUAL 0
00893 #define PNG_sRGB_INTENT_RELATIVE   1
00894 #define PNG_sRGB_INTENT_SATURATION 2
00895 #define PNG_sRGB_INTENT_ABSOLUTE   3
00896 #define PNG_sRGB_INTENT_LAST       4 /* Not a valid value */
00897 
00898 /* This is for text chunks */
00899 #define PNG_KEYWORD_MAX_LENGTH     79
00900 
00901 /* Maximum number of entries in PLTE/sPLT/tRNS arrays */
00902 #define PNG_MAX_PALETTE_LENGTH    256
00903 
00904 /* These determine if an ancillary chunk's data has been successfully read
00905  * from the PNG header, or if the application has filled in the corresponding
00906  * data in the info_struct to be written into the output file.  The values
00907  * of the PNG_INFO_<chunk> defines should NOT be changed.
00908  */
00909 #define PNG_INFO_gAMA 0x0001
00910 #define PNG_INFO_sBIT 0x0002
00911 #define PNG_INFO_cHRM 0x0004
00912 #define PNG_INFO_PLTE 0x0008
00913 #define PNG_INFO_tRNS 0x0010
00914 #define PNG_INFO_bKGD 0x0020
00915 #define PNG_INFO_hIST 0x0040
00916 #define PNG_INFO_pHYs 0x0080
00917 #define PNG_INFO_oFFs 0x0100
00918 #define PNG_INFO_tIME 0x0200
00919 #define PNG_INFO_pCAL 0x0400
00920 #define PNG_INFO_sRGB 0x0800   /* GR-P, 0.96a */
00921 #define PNG_INFO_iCCP 0x1000   /* ESR, 1.0.6 */
00922 #define PNG_INFO_sPLT 0x2000   /* ESR, 1.0.6 */
00923 #define PNG_INFO_sCAL 0x4000   /* ESR, 1.0.6 */
00924 #define PNG_INFO_IDAT 0x8000L  /* ESR, 1.0.6 */
00925 
00926 /* This is used for the transformation routines, as some of them
00927  * change these values for the row.  It also should enable using
00928  * the routines for other purposes.
00929  */
00930 typedef struct png_row_info_struct
00931 {
00932    png_uint_32 width; /* width of row */
00933    png_uint_32 rowbytes; /* number of bytes in row */
00934    png_byte color_type; /* color type of row */
00935    png_byte bit_depth; /* bit depth of row */
00936    png_byte channels; /* number of channels (1, 2, 3, or 4) */
00937    png_byte pixel_depth; /* bits per pixel (depth * channels) */
00938 } png_row_info;
00939 
00940 typedef png_row_info FAR * png_row_infop;
00941 typedef png_row_info FAR * FAR * png_row_infopp;
00942 
00943 /* These are the function types for the I/O functions and for the functions
00944  * that allow the user to override the default I/O functions with his or her
00945  * own.  The png_error_ptr type should match that of user-supplied warning
00946  * and error functions, while the png_rw_ptr type should match that of the
00947  * user read/write data functions.
00948  */
00949 typedef struct png_struct_def png_struct;
00950 typedef png_struct FAR * png_structp;
00951 
00952 typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp));
00953 typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t));
00954 typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp));
00955 typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32,
00956    int));
00957 typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32,
00958    int));
00959 
00960 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
00961 typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp, png_infop));
00962 typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop));
00963 typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep,
00964    png_uint_32, int));
00965 #endif
00966 
00967 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
00968     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
00969     defined(PNG_LEGACY_SUPPORTED)
00970 typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp,
00971     png_row_infop, png_bytep));
00972 #endif
00973 
00974 #if defined(PNG_USER_CHUNKS_SUPPORTED)
00975 typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp));
00976 #endif
00977 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
00978 typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
00979 #endif
00980 
00981 /* Transform masks for the high-level interface */
00982 #define PNG_TRANSFORM_IDENTITY       0x0000    /* read and write */
00983 #define PNG_TRANSFORM_STRIP_16       0x0001    /* read only */
00984 #define PNG_TRANSFORM_STRIP_ALPHA    0x0002    /* read only */
00985 #define PNG_TRANSFORM_PACKING        0x0004    /* read and write */
00986 #define PNG_TRANSFORM_PACKSWAP       0x0008    /* read and write */
00987 #define PNG_TRANSFORM_EXPAND         0x0010    /* read only */
00988 #define PNG_TRANSFORM_INVERT_MONO    0x0020    /* read and write */
00989 #define PNG_TRANSFORM_SHIFT          0x0040    /* read and write */
00990 #define PNG_TRANSFORM_BGR            0x0080    /* read and write */
00991 #define PNG_TRANSFORM_SWAP_ALPHA     0x0100    /* read and write */
00992 #define PNG_TRANSFORM_SWAP_ENDIAN    0x0200    /* read and write */
00993 #define PNG_TRANSFORM_INVERT_ALPHA   0x0400    /* read and write */
00994 #define PNG_TRANSFORM_STRIP_FILLER   0x0800    /* WRITE only */
00995 
00996 /* Flags for MNG supported features */
00997 #define PNG_FLAG_MNG_EMPTY_PLTE     0x01
00998 #define PNG_FLAG_MNG_FILTER_64      0x04
00999 #define PNG_ALL_MNG_FEATURES        0x05
01000 
01001 typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t));
01002 typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp));
01003 
01004 /* The structure that holds the information to read and write PNG files.
01005  * The only people who need to care about what is inside of this are the
01006  * people who will be modifying the library for their own special needs.
01007  * It should NOT be accessed directly by an application, except to store
01008  * the jmp_buf.
01009  */
01010 
01011 struct png_struct_def
01012 {
01013 #ifdef PNG_SETJMP_SUPPORTED
01014    jmp_buf jmpbuf;            /* used in png_error */
01015 #endif
01016    png_error_ptr error_fn;    /* function for printing errors and aborting */
01017    png_error_ptr warning_fn;  /* function for printing warnings */
01018    png_voidp error_ptr;       /* user supplied struct for error functions */
01019    png_rw_ptr write_data_fn;  /* function for writing output data */
01020    png_rw_ptr read_data_fn;   /* function for reading input data */
01021    png_voidp io_ptr;          /* ptr to application struct for I/O functions */
01022 
01023 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
01024    png_user_transform_ptr read_user_transform_fn; /* user read transform */
01025 #endif
01026 
01027 #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
01028    png_user_transform_ptr write_user_transform_fn; /* user write transform */
01029 #endif
01030 
01031 /* These were added in libpng-1.0.2 */
01032 #if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
01033 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
01034     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
01035    png_voidp user_transform_ptr; /* user supplied struct for user transform */
01036    png_byte user_transform_depth;    /* bit depth of user transformed pixels */
01037    png_byte user_transform_channels; /* channels in user transformed pixels */
01038 #endif
01039 #endif
01040 
01041    png_uint_32 mode;          /* tells us where we are in the PNG file */
01042    png_uint_32 flags;         /* flags indicating various things to libpng */
01043    png_uint_32 transformations; /* which transformations to perform */
01044 
01045    z_stream zstream;          /* pointer to decompression structure (below) */
01046    png_bytep zbuf;            /* buffer for zlib */
01047    png_size_t zbuf_size;      /* size of zbuf */
01048    int zlib_level;            /* holds zlib compression level */
01049    int zlib_method;           /* holds zlib compression method */
01050    int zlib_window_bits;      /* holds zlib compression window bits */
01051    int zlib_mem_level;        /* holds zlib compression memory level */
01052    int zlib_strategy;         /* holds zlib compression strategy */
01053 
01054    png_uint_32 width;         /* width of image in pixels */
01055    png_uint_32 height;        /* height of image in pixels */
01056    png_uint_32 num_rows;      /* number of rows in current pass */
01057    png_uint_32 usr_width;     /* width of row at start of write */
01058    png_uint_32 rowbytes;      /* size of row in bytes */
01059    png_uint_32 irowbytes;     /* size of current interlaced row in bytes */
01060    png_uint_32 iwidth;        /* width of current interlaced row in pixels */
01061    png_uint_32 row_number;    /* current row in interlace pass */
01062    png_bytep prev_row;        /* buffer to save previous (unfiltered) row */
01063    png_bytep row_buf;         /* buffer to save current (unfiltered) row */
01064    png_bytep sub_row;         /* buffer to save "sub" row when filtering */
01065    png_bytep up_row;          /* buffer to save "up" row when filtering */
01066    png_bytep avg_row;         /* buffer to save "avg" row when filtering */
01067    png_bytep paeth_row;       /* buffer to save "Paeth" row when filtering */
01068    png_row_info row_info;     /* used for transformation routines */
01069 
01070    png_uint_32 idat_size;     /* current IDAT size for read */
01071    png_uint_32 crc;           /* current chunk CRC value */
01072    png_colorp palette;        /* palette from the input file */
01073    png_uint_16 num_palette;   /* number of color entries in palette */
01074    png_uint_16 num_trans;     /* number of transparency values */
01075    png_byte chunk_name[5];    /* null-terminated name of current chunk */
01076    png_byte compression;      /* file compression type (always 0) */
01077    png_byte filter;           /* file filter type (always 0) */
01078    png_byte interlaced;       /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
01079    png_byte pass;             /* current interlace pass (0 - 6) */
01080    png_byte do_filter;        /* row filter flags (see PNG_FILTER_ below ) */
01081    png_byte color_type;       /* color type of file */
01082    png_byte bit_depth;        /* bit depth of file */
01083    png_byte usr_bit_depth;    /* bit depth of users row */
01084    png_byte pixel_depth;      /* number of bits per pixel */
01085    png_byte channels;         /* number of channels in file */
01086    png_byte usr_channels;     /* channels at start of write */
01087    png_byte sig_bytes;        /* magic bytes read/written from start of file */
01088 
01089 #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
01090 #ifdef PNG_LEGACY_SUPPORTED
01091    png_byte filler;           /* filler byte for pixel expansion */
01092 #else
01093    png_uint_16 filler;           /* filler bytes for pixel expansion */
01094 #endif
01095 #endif
01096 
01097 #if defined(PNG_bKGD_SUPPORTED)
01098    png_byte background_gamma_type;
01099 #  ifdef PNG_FLOATING_POINT_SUPPORTED
01100    float background_gamma;
01101 #  endif
01102    png_color_16 background;   /* background color in screen gamma space */
01103 #if defined(PNG_READ_GAMMA_SUPPORTED)
01104    png_color_16 background_1; /* background normalized to gamma 1.0 */
01105 #endif
01106 #endif /* PNG_bKGD_SUPPORTED */
01107 
01108 #if defined(PNG_WRITE_FLUSH_SUPPORTED)
01109    png_flush_ptr output_flush_fn;/* Function for flushing output */
01110    png_uint_32 flush_dist;    /* how many rows apart to flush, 0 - no flush */
01111    png_uint_32 flush_rows;    /* number of rows written since last flush */
01112 #endif
01113 
01114 #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
01115    int gamma_shift;      /* number of "insignificant" bits 16-bit gamma */
01116 #ifdef PNG_FLOATING_POINT_SUPPORTED
01117    float gamma;          /* file gamma value */
01118    float screen_gamma;   /* screen gamma value (display_exponent) */
01119 #endif
01120 #endif
01121 
01122 #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
01123    png_bytep gamma_table;     /* gamma table for 8-bit depth files */
01124    png_bytep gamma_from_1;    /* converts from 1.0 to screen */
01125    png_bytep gamma_to_1;      /* converts from file to 1.0 */
01126    png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
01127    png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
01128    png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
01129 #endif
01130 
01131 #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
01132    png_color_8 sig_bit;       /* significant bits in each available channel */
01133 #endif
01134 
01135 #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
01136    png_color_8 shift;         /* shift for significant bit tranformation */
01137 #endif
01138 
01139 #if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
01140  || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
01141    png_bytep trans;           /* transparency values for paletted files */
01142    png_color_16 trans_values; /* transparency values for non-paletted files */
01143 #endif
01144 
01145    png_read_status_ptr read_row_fn;   /* called after each row is decoded */
01146    png_write_status_ptr write_row_fn; /* called after each row is encoded */
01147 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
01148    png_progressive_info_ptr info_fn; /* called after header data fully read */
01149    png_progressive_row_ptr row_fn;   /* called after each prog. row is decoded */
01150    png_progressive_end_ptr end_fn;   /* called after image is complete */
01151    png_bytep save_buffer_ptr;        /* current location in save_buffer */
01152    png_bytep save_buffer;            /* buffer for previously read data */
01153    png_bytep current_buffer_ptr;     /* current location in current_buffer */
01154    png_bytep current_buffer;         /* buffer for recently used data */
01155    png_uint_32 push_length;          /* size of current input chunk */
01156    png_uint_32 skip_length;          /* bytes to skip in input data */
01157    png_size_t save_buffer_size;      /* amount of data now in save_buffer */
01158    png_size_t save_buffer_max;       /* total size of save_buffer */
01159    png_size_t buffer_size;           /* total amount of available input data */
01160    png_size_t current_buffer_size;   /* amount of data now in current_buffer */
01161    int process_mode;                 /* what push library is currently doing */
01162    int cur_palette;                  /* current push library palette index */
01163 
01164 #  if defined(PNG_TEXT_SUPPORTED)
01165      png_size_t current_text_size;   /* current size of text input data */
01166      png_size_t current_text_left;   /* how much text left to read in input */
01167      png_charp current_text;         /* current text chunk buffer */
01168      png_charp current_text_ptr;     /* current location in current_text */
01169 #  endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */
01170 
01171 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
01172 
01173 #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
01174 /* for the Borland special 64K segment handler */
01175    png_bytepp offset_table_ptr;
01176    png_bytep offset_table;
01177    png_uint_16 offset_table_number;
01178    png_uint_16 offset_table_count;
01179    png_uint_16 offset_table_count_free;
01180 #endif
01181 
01182 #if defined(PNG_READ_DITHER_SUPPORTED)
01183    png_bytep palette_lookup;         /* lookup table for dithering */
01184    png_bytep dither_index;           /* index translation for palette files */
01185 #endif
01186 
01187 #if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
01188    png_uint_16p hist;                /* histogram */
01189 #endif
01190 
01191 #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
01192    png_byte heuristic_method;        /* heuristic for row filter selection */
01193    png_byte num_prev_filters;        /* number of weights for previous rows */
01194    png_bytep prev_filters;           /* filter type(s) of previous row(s) */
01195    png_uint_16p filter_weights;      /* weight(s) for previous line(s) */
01196    png_uint_16p inv_filter_weights;  /* 1/weight(s) for previous line(s) */
01197    png_uint_16p filter_costs;        /* relative filter calculation cost */
01198    png_uint_16p inv_filter_costs;    /* 1/relative filter calculation cost */
01199 #endif
01200 
01201 #if defined(PNG_TIME_RFC1123_SUPPORTED)
01202    png_charp time_buffer;            /* String to hold RFC 1123 time text */
01203 #endif
01204 
01205 /* New members added in libpng-1.0.6 */
01206 
01207 #ifdef PNG_FREE_ME_SUPPORTED
01208    png_uint_32 free_me;       /* flags items libpng is responsible for freeing */
01209 #endif
01210 
01211 #if defined(PNG_USER_CHUNKS_SUPPORTED)
01212    png_voidp user_chunk_ptr;
01213    png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
01214 #endif
01215 
01216 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
01217    int num_chunk_list;
01218    png_bytep chunk_list;
01219 #endif
01220 
01221 /* New members added in libpng-1.0.3 */
01222 #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
01223    png_byte rgb_to_gray_status;
01224    /* These were changed from png_byte in libpng-1.0.6 */
01225    png_uint_16 rgb_to_gray_red_coeff;
01226    png_uint_16 rgb_to_gray_green_coeff;
01227    png_uint_16 rgb_to_gray_blue_coeff;
01228 #endif
01229 
01230 /* New member added in libpng-1.0.4 (renamed in 1.0.9) */
01231 #if defined(PNG_MNG_FEATURES_SUPPORTED) || \
01232     defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
01233     defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
01234 /* changed from png_byte to png_uint_32 at version 1.2.0 */
01235 #ifdef PNG_1_0_X
01236    png_byte mng_features_permitted;
01237 #else
01238    png_uint_32 mng_features_permitted;
01239 #endif /* PNG_1_0_X */
01240 #endif
01241 
01242 /* New member added in libpng-1.0.7 */
01243 #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
01244    png_fixed_point int_gamma;
01245 #endif
01246 
01247 /* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
01248 #if defined(PNG_MNG_FEATURES_SUPPORTED)
01249    png_byte filter_type;
01250 #endif
01251 
01252 #if defined(PNG_1_0_X) || (defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD))
01253 /* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */
01254    png_uint_32 row_buf_size;
01255 #endif
01256 
01257 /* New members added in libpng-1.2.0 */
01258 #if !defined(PNG_1_0_X) && defined(PNG_ASSEMBLER_CODE_SUPPORTED)
01259    png_byte     mmx_bitdepth_threshold;
01260    png_uint_32  mmx_rowbytes_threshold;
01261    png_uint_32  asm_flags;
01262 #endif
01263 
01264 /* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
01265 #ifdef PNG_USER_MEM_SUPPORTED
01266    png_voidp mem_ptr;                /* user supplied struct for mem functions */
01267    png_malloc_ptr malloc_fn;         /* function for allocating memory */
01268    png_free_ptr free_fn;             /* function for freeing memory */
01269 #endif
01270 
01271 /* New member added in libpng-1.0.13 and 1.2.0 */
01272    png_bytep big_row_buf;         /* buffer to save current (unfiltered) row */
01273 
01274 #if defined(PNG_READ_DITHER_SUPPORTED)
01275 /* The following three members were added at version 1.0.14 and 1.2.4 */
01276    png_bytep dither_sort;            /* working sort array */
01277    png_bytep index_to_palette;       /* where the original index currently is */
01278                                      /* in the palette */
01279    png_bytep palette_to_index;       /* which original index points to this */
01280                                      /* palette color */
01281 #endif
01282 
01283 };
01284 
01285 
01286 /* This prevents a compiler error in png.c if png.c and png.h are both at
01287    version 1.2.5
01288  */
01289 typedef png_structp version_1_2_5;
01290 
01291 typedef png_struct FAR * FAR * png_structpp;
01292 
01293 /* Here are the function definitions most commonly used.  This is not
01294  * the place to find out how to use libpng.  See libpng.txt for the
01295  * full explanation, see example.c for the summary.  This just provides
01296  * a simple one line description of the use of each function.
01297  */
01298 
01299 /* Returns the version number of the library */
01300 extern PNG_EXPORT(png_uint_32,png_access_version_number) PNGARG((void));
01301 
01302 /* Tell lib we have already handled the first <num_bytes> magic bytes.
01303  * Handling more than 8 bytes from the beginning of the file is an error.
01304  */
01305 extern PNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr,
01306    int num_bytes));
01307 
01308 /* Check sig[start] through sig[start + num_to_check - 1] to see if it's a
01309  * PNG file.  Returns zero if the supplied bytes match the 8-byte PNG
01310  * signature, and non-zero otherwise.  Having num_to_check == 0 or
01311  * start > 7 will always fail (ie return non-zero).
01312  */
01313 extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start,
01314    png_size_t num_to_check));
01315 
01316 /* Simple signature checking function.  This is the same as calling
01317  * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).
01318  */
01319 extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num));
01320 
01321 /* Allocate and initialize png_ptr struct for reading, and any other memory. */
01322 extern PNG_EXPORT(png_structp,png_create_read_struct)
01323    PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
01324    png_error_ptr error_fn, png_error_ptr warn_fn));
01325 
01326 /* Allocate and initialize png_ptr struct for writing, and any other memory */
01327 extern PNG_EXPORT(png_structp,png_create_write_struct)
01328    PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
01329    png_error_ptr error_fn, png_error_ptr warn_fn));
01330 
01331 extern PNG_EXPORT(png_uint_32,png_get_compression_buffer_size)
01332    PNGARG((png_structp png_ptr));
01333 
01334 extern PNG_EXPORT(void,png_set_compression_buffer_size)
01335    PNGARG((png_structp png_ptr, png_uint_32 size));
01336 
01337 /* Reset the compression stream */
01338 extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr));
01339 
01340 /* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */
01341 #ifdef PNG_USER_MEM_SUPPORTED
01342 extern PNG_EXPORT(png_structp,png_create_read_struct_2)
01343    PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
01344    png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
01345    png_malloc_ptr malloc_fn, png_free_ptr free_fn));
01346 extern PNG_EXPORT(png_structp,png_create_write_struct_2)
01347    PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
01348    png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
01349    png_malloc_ptr malloc_fn, png_free_ptr free_fn));
01350 #endif
01351 
01352 /* Write a PNG chunk - size, type, (optional) data, CRC. */
01353 extern PNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr,
01354    png_bytep chunk_name, png_bytep data, png_size_t length));
01355 
01356 /* Write the start of a PNG chunk - length and chunk name. */
01357 extern PNG_EXPORT(void,png_write_chunk_start) PNGARG((png_structp png_ptr,
01358    png_bytep chunk_name, png_uint_32 length));
01359 
01360 /* Write the data of a PNG chunk started with png_write_chunk_start(). */
01361 extern PNG_EXPORT(void,png_write_chunk_data) PNGARG((png_structp png_ptr,
01362    png_bytep data, png_size_t length));
01363 
01364 /* Finish a chunk started with png_write_chunk_start() (includes CRC). */
01365 extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr));
01366 
01367 /* Allocate and initialize the info structure */
01368 extern PNG_EXPORT(png_infop,png_create_info_struct)
01369    PNGARG((png_structp png_ptr));
01370 
01371 /* Initialize the info structure (old interface - DEPRECATED) */
01372 extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr));
01373 #undef png_info_init
01374 #define png_info_init(info_ptr) png_info_init_3(&info_ptr, sizeof(png_info));
01375 extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr,
01376     png_size_t png_info_struct_size));
01377 
01378 /* Writes all the PNG information before the image. */
01379 extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr,
01380    png_infop info_ptr));
01381 extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr,
01382    png_infop info_ptr));
01383 
01384 /* read the information before the actual image data. */
01385 extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr,
01386    png_infop info_ptr));
01387 
01388 #if defined(PNG_TIME_RFC1123_SUPPORTED)
01389 extern PNG_EXPORT(png_charp,png_convert_to_rfc1123)
01390    PNGARG((png_structp png_ptr, png_timep ptime));
01391 #endif
01392 
01393 #if !defined(_WIN32_WCE)
01394 /* "time.h" functions are not supported on WindowsCE */
01395 #if defined(PNG_WRITE_tIME_SUPPORTED)
01396 /* convert from a struct tm to png_time */
01397 extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime,
01398    struct tm FAR * ttime));
01399 
01400 /* convert from time_t to png_time.  Uses gmtime() */
01401 extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime,
01402    time_t ttime));
01403 #endif /* PNG_WRITE_tIME_SUPPORTED */
01404 #endif /* _WIN32_WCE */
01405 
01406 #if defined(PNG_READ_EXPAND_SUPPORTED)
01407 /* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */
01408 extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr));
01409 extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp png_ptr));
01410 extern PNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr));
01411 extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr));
01412 #endif
01413 
01414 #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
01415 /* Use blue, green, red order for pixels. */
01416 extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr));
01417 #endif
01418 
01419 #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
01420 /* Expand the grayscale to 24-bit RGB if necessary. */
01421 extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr));
01422 #endif
01423 
01424 #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
01425 /* Reduce RGB to grayscale. */
01426 #ifdef PNG_FLOATING_POINT_SUPPORTED
01427 extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr,
01428    int error_action, double red, double green ));
01429 #endif
01430 extern PNG_EXPORT(void,png_set_rgb_to_gray_fixed) PNGARG((png_structp png_ptr,
01431    int error_action, png_fixed_point red, png_fixed_point green ));
01432 extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp
01433    png_ptr));
01434 #endif
01435 
01436 extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth,
01437    png_colorp palette));
01438 
01439 #if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
01440 extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr));
01441 #endif
01442 
01443 #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
01444     defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
01445 extern PNG_EXPORT(void,png_set_swap_alpha) PNGARG((png_structp png_ptr));
01446 #endif
01447 
01448 #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
01449     defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
01450 extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr));
01451 #endif
01452 
01453 #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
01454 /* Add a filler byte to 24-bit RGB images. */
01455 extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr,
01456    png_uint_32 filler, int flags));
01457 /* The values of the PNG_FILLER_ defines should NOT be changed */
01458 #define PNG_FILLER_BEFORE 0
01459 #define PNG_FILLER_AFTER 1
01460 #endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */
01461 
01462 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
01463 /* Swap bytes in 16-bit depth files. */
01464 extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr));
01465 #endif
01466 
01467 #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
01468 /* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */
01469 extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr));
01470 #endif
01471 
01472 #if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)
01473 /* Swap packing order of pixels in bytes. */
01474 extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr));
01475 #endif
01476 
01477 #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
01478 /* Converts files to legal bit depths. */
01479 extern PNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr,
01480    png_color_8p true_bits));
01481 #endif
01482 
01483 #if defined(PNG_READ_INTERLACING_SUPPORTED) || \
01484     defined(PNG_WRITE_INTERLACING_SUPPORTED)
01485 /* Have the code handle the interlacing.  Returns the number of passes. */
01486 extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr));
01487 #endif
01488 
01489 #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
01490 /* Invert monochrome files */
01491 extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr));
01492 #endif
01493 
01494 #if defined(PNG_READ_BACKGROUND_SUPPORTED)
01495 /* Handle alpha and tRNS by replacing with a background color. */
01496 #ifdef PNG_FLOATING_POINT_SUPPORTED
01497 extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr,
01498    png_color_16p background_color, int background_gamma_code,
01499    int need_expand, double background_gamma));
01500 #endif
01501 #define PNG_BACKGROUND_GAMMA_UNKNOWN 0
01502 #define PNG_BACKGROUND_GAMMA_SCREEN  1
01503 #define PNG_BACKGROUND_GAMMA_FILE    2
01504 #define PNG_BACKGROUND_GAMMA_UNIQUE  3
01505 #endif
01506 
01507 #if defined(PNG_READ_16_TO_8_SUPPORTED)
01508 /* strip the second byte of information from a 16-bit depth file. */
01509 extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr));
01510 #endif
01511 
01512 #if defined(PNG_READ_DITHER_SUPPORTED)
01513 /* Turn on dithering, and reduce the palette to the number of colors available. */
01514 extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr,
01515    png_colorp palette, int num_palette, int maximum_colors,
01516    png_uint_16p histogram, int full_dither));
01517 #endif
01518 
01519 #if defined(PNG_READ_GAMMA_SUPPORTED)
01520 /* Handle gamma correction. Screen_gamma=(display_exponent) */
01521 #ifdef PNG_FLOATING_POINT_SUPPORTED
01522 extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr,
01523    double screen_gamma, double default_file_gamma));
01524 #endif
01525 #endif
01526 
01527 #if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
01528     defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
01529 /* Permit or disallow empty PLTE (0: not permitted, 1: permitted) */
01530 /* Deprecated and will be removed.  Use png_permit_mng_features() instead. */
01531 extern PNG_EXPORT(void,png_permit_empty_plte) PNGARG((png_structp png_ptr,
01532    int empty_plte_permitted));
01533 #endif
01534 
01535 #if defined(PNG_WRITE_FLUSH_SUPPORTED)
01536 /* Set how many lines between output flushes - 0 for no flushing */
01537 extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows));
01538 /* Flush the current PNG output buffer */
01539 extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr));
01540 #endif
01541 
01542 /* optional update palette with requested transformations */
01543 extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr));
01544 
01545 /* optional call to update the users info structure */
01546 extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr,
01547    png_infop info_ptr));
01548 
01549 /* read one or more rows of image data. */
01550 extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr,
01551    png_bytepp row, png_bytepp display_row, png_uint_32 num_rows));
01552 
01553 /* read a row of data. */
01554 extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr,
01555    png_bytep row,
01556    png_bytep display_row));
01557 
01558 /* read the whole image into memory at once. */
01559 extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr,
01560    png_bytepp image));
01561 
01562 /* write a row of image data */
01563 extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr,
01564    png_bytep row));
01565 
01566 /* write a few rows of image data */
01567 extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr,
01568    png_bytepp row, png_uint_32 num_rows));
01569 
01570 /* write the image data */
01571 extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr,
01572    png_bytepp image));
01573 
01574 /* writes the end of the PNG file. */
01575 extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr,
01576    png_infop info_ptr));
01577 
01578 /* read the end of the PNG file. */
01579 extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr,
01580    png_infop info_ptr));
01581 
01582 /* free any memory associated with the png_info_struct */
01583 extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr,
01584    png_infopp info_ptr_ptr));
01585 
01586 /* free any memory associated with the png_struct and the png_info_structs */
01587 extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp
01588    png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr));
01589 
01590 /* free all memory used by the read (old method - NOT DLL EXPORTED) */
01591 extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
01592    png_infop end_info_ptr));
01593 
01594 /* free any memory associated with the png_struct and the png_info_structs */
01595 extern PNG_EXPORT(void,png_destroy_write_struct)
01596    PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr));
01597 
01598 /* free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
01599 extern void png_write_destroy PNGARG((png_structp png_ptr));
01600 
01601 /* set the libpng method of handling chunk CRC errors */
01602 extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr,
01603    int crit_action, int ancil_action));
01604 
01605 /* Values for png_set_crc_action() to say how to handle CRC errors in
01606  * ancillary and critical chunks, and whether to use the data contained
01607  * therein.  Note that it is impossible to "discard" data in a critical
01608  * chunk.  For versions prior to 0.90, the action was always error/quit,
01609  * whereas in version 0.90 and later, the action for CRC errors in ancillary
01610  * chunks is warn/discard.  These values should NOT be changed.
01611  *
01612  *      value                       action:critical     action:ancillary
01613  */
01614 #define PNG_CRC_DEFAULT       0  /* error/quit          warn/discard data */
01615 #define PNG_CRC_ERROR_QUIT    1  /* error/quit          error/quit        */
01616 #define PNG_CRC_WARN_DISCARD  2  /* (INVALID)           warn/discard data */
01617 #define PNG_CRC_WARN_USE      3  /* warn/use data       warn/use data     */
01618 #define PNG_CRC_QUIET_USE     4  /* quiet/use data      quiet/use data    */
01619 #define PNG_CRC_NO_CHANGE     5  /* use current value   use current value */
01620 
01621 /* These functions give the user control over the scan-line filtering in
01622  * libpng and the compression methods used by zlib.  These functions are
01623  * mainly useful for testing, as the defaults should work with most users.
01624  * Those users who are tight on memory or want faster performance at the
01625  * expense of compression can modify them.  See the compression library
01626  * header file (zlib.h) for an explination of the compression functions.
01627  */
01628 
01629 /* set the filtering method(s) used by libpng.  Currently, the only valid
01630  * value for "method" is 0.
01631  */
01632 extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method,
01633    int filters));
01634 
01635 /* Flags for png_set_filter() to say which filters to use.  The flags
01636  * are chosen so that they don't conflict with real filter types
01637  * below, in case they are supplied instead of the #defined constants.
01638  * These values should NOT be changed.
01639  */
01640 #define PNG_NO_FILTERS     0x00
01641 #define PNG_FILTER_NONE    0x08
01642 #define PNG_FILTER_SUB     0x10
01643 #define PNG_FILTER_UP      0x20
01644 #define PNG_FILTER_AVG     0x40
01645 #define PNG_FILTER_PAETH   0x80
01646 #define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \
01647                          PNG_FILTER_AVG | PNG_FILTER_PAETH)
01648 
01649 /* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
01650  * These defines should NOT be changed.
01651  */
01652 #define PNG_FILTER_VALUE_NONE  0
01653 #define PNG_FILTER_VALUE_SUB   1
01654 #define PNG_FILTER_VALUE_UP    2
01655 #define PNG_FILTER_VALUE_AVG   3
01656 #define PNG_FILTER_VALUE_PAETH 4
01657 #define PNG_FILTER_VALUE_LAST  5
01658 
01659 #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* EXPERIMENTAL */
01660 /* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_
01661  * defines, either the default (minimum-sum-of-absolute-differences), or
01662  * the experimental method (weighted-minimum-sum-of-absolute-differences).
01663  *
01664  * Weights are factors >= 1.0, indicating how important it is to keep the
01665  * filter type consistent between rows.  Larger numbers mean the current
01666  * filter is that many times as likely to be the same as the "num_weights"
01667  * previous filters.  This is cumulative for each previous row with a weight.
01668  * There needs to be "num_weights" values in "filter_weights", or it can be
01669  * NULL if the weights aren't being specified.  Weights have no influence on
01670  * the selection of the first row filter.  Well chosen weights can (in theory)
01671  * improve the compression for a given image.
01672  *
01673  * Costs are factors >= 1.0 indicating the relative decoding costs of a
01674  * filter type.  Higher costs indicate more decoding expense, and are
01675  * therefore less likely to be selected over a filter with lower computational
01676  * costs.  There needs to be a value in "filter_costs" for each valid filter
01677  * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't
01678  * setting the costs.  Costs try to improve the speed of decompression without
01679  * unduly increasing the compressed image size.
01680  *
01681  * A negative weight or cost indicates the default value is to be used, and
01682  * values in the range [0.0, 1.0) indicate the value is to remain unchanged.
01683  * The default values for both weights and costs are currently 1.0, but may
01684  * change if good general weighting/cost heuristics can be found.  If both
01685  * the weights and costs are set to 1.0, this degenerates the WEIGHTED method
01686  * to the UNWEIGHTED method, but with added encoding time/computation.
01687  */
01688 #ifdef PNG_FLOATING_POINT_SUPPORTED
01689 extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr,
01690    int heuristic_method, int num_weights, png_doublep filter_weights,
01691    png_doublep filter_costs));
01692 #endif
01693 #endif /*  PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
01694 
01695 /* Heuristic used for row filter selection.  These defines should NOT be
01696  * changed.
01697  */
01698 #define PNG_FILTER_HEURISTIC_DEFAULT    0  /* Currently "UNWEIGHTED" */
01699 #define PNG_FILTER_HEURISTIC_UNWEIGHTED 1  /* Used by libpng < 0.95 */
01700 #define PNG_FILTER_HEURISTIC_WEIGHTED   2  /* Experimental feature */
01701 #define PNG_FILTER_HEURISTIC_LAST       3  /* Not a valid value */
01702 
01703 /* Set the library compression level.  Currently, valid values range from
01704  * 0 - 9, corresponding directly to the zlib compression levels 0 - 9
01705  * (0 - no compression, 9 - "maximal" compression).  Note that tests have
01706  * shown that zlib compression levels 3-6 usually perform as well as level 9
01707  * for PNG images, and do considerably fewer caclulations.  In the future,
01708  * these values may not correspond directly to the zlib compression levels.
01709  */
01710 extern PNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr,
01711    int level));
01712 
01713 extern PNG_EXPORT(void,png_set_compression_mem_level)
01714    PNGARG((png_structp png_ptr, int mem_level));
01715 
01716 extern PNG_EXPORT(void,png_set_compression_strategy)
01717    PNGARG((png_structp png_ptr, int strategy));
01718 
01719 extern PNG_EXPORT(void,png_set_compression_window_bits)
01720    PNGARG((png_structp png_ptr, int window_bits));
01721 
01722 extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr,
01723    int method));
01724 
01725 /* These next functions are called for input/output, memory, and error
01726  * handling.  They are in the file pngrio.c, pngwio.c, and pngerror.c,
01727  * and call standard C I/O routines such as fread(), fwrite(), and
01728  * fprintf().  These functions can be made to use other I/O routines
01729  * at run time for those applications that need to handle I/O in a
01730  * different manner by calling png_set_???_fn().  See libpng.txt for
01731  * more information.
01732  */
01733 
01734 #if !defined(PNG_NO_STDIO)
01735 /* Initialize the input/output for the PNG file to the default functions. */
01736 extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, png_FILE_p fp));
01737 #endif
01738 
01739 /* Replace the (error and abort), and warning functions with user
01740  * supplied functions.  If no messages are to be printed you must still
01741  * write and use replacement functions. The replacement error_fn should
01742  * still do a longjmp to the last setjmp location if you are using this
01743  * method of error handling.  If error_fn or warning_fn is NULL, the
01744  * default function will be used.
01745  */
01746 
01747 extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr,
01748    png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn));
01749 
01750 /* Return the user pointer associated with the error functions */
01751 extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr));
01752 
01753 /* Replace the default data output functions with a user supplied one(s).
01754  * If buffered output is not used, then output_flush_fn can be set to NULL.
01755  * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time
01756  * output_flush_fn will be ignored (and thus can be NULL).
01757  */
01758 extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr,
01759    png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));
01760 
01761 /* Replace the default data input function with a user supplied one. */
01762 extern PNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr,
01763    png_voidp io_ptr, png_rw_ptr read_data_fn));
01764 
01765 /* Return the user pointer associated with the I/O functions */
01766 extern PNG_EXPORT(png_voidp,png_get_io_ptr) PNGARG((png_structp png_ptr));
01767 
01768 extern PNG_EXPORT(void,png_set_read_status_fn) PNGARG((png_structp png_ptr,
01769    png_read_status_ptr read_row_fn));
01770 
01771 extern PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr,
01772    png_write_status_ptr write_row_fn));
01773 
01774 #ifdef PNG_USER_MEM_SUPPORTED
01775 /* Replace the default memory allocation functions with user supplied one(s). */
01776 extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr,
01777    png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn));
01778 /* Return the user pointer associated with the memory functions */
01779 extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr));
01780 #endif
01781 
01782 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
01783     defined(PNG_LEGACY_SUPPORTED)
01784 extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp
01785    png_ptr, png_user_transform_ptr read_user_transform_fn));
01786 #endif
01787 
01788 #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
01789     defined(PNG_LEGACY_SUPPORTED)
01790 extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp
01791    png_ptr, png_user_transform_ptr write_user_transform_fn));
01792 #endif
01793 
01794 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
01795     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
01796     defined(PNG_LEGACY_SUPPORTED)
01797 extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp
01798    png_ptr, png_voidp user_transform_ptr, int user_transform_depth,
01799    int user_transform_channels));
01800 /* Return the user pointer associated with the user transform functions */
01801 extern PNG_EXPORT(png_voidp,png_get_user_transform_ptr)
01802    PNGARG((png_structp png_ptr));
01803 #endif
01804 
01805 #ifdef PNG_USER_CHUNKS_SUPPORTED
01806 extern PNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr,
01807    png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn));
01808 extern PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_structp
01809    png_ptr));
01810 #endif
01811 
01812 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
01813 /* Sets the function callbacks for the push reader, and a pointer to a
01814  * user-defined structure available to the callback functions.
01815  */
01816 extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr,
01817    png_voidp progressive_ptr,
01818    png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
01819    png_progressive_end_ptr end_fn));
01820 
01821 /* returns the user pointer associated with the push read functions */
01822 extern PNG_EXPORT(png_voidp,png_get_progressive_ptr)
01823    PNGARG((png_structp png_ptr));
01824 
01825 /* function to be called when data becomes available */
01826 extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr,
01827    png_infop info_ptr, png_bytep buffer, png_size_t buffer_size));
01828 
01829 /* function that combines rows.  Not very much different than the
01830  * png_combine_row() call.  Is this even used?????
01831  */
01832 extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr,
01833    png_bytep old_row, png_bytep new_row));
01834 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
01835 
01836 extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr,
01837    png_uint_32 size));
01838 
01839 #if defined(PNG_1_0_X)
01840 #  define png_malloc_warn png_malloc
01841 #else
01842 /* Added at libpng version 1.2.4 */
01843 extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr,
01844    png_uint_32 size));
01845 #endif
01846 
01847 /* frees a pointer allocated by png_malloc() */
01848 extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));
01849 
01850 #if defined(PNG_1_0_X)
01851 /* Function to allocate memory for zlib. */
01852 extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items,
01853    uInt size));
01854 
01855 /* Function to free memory for zlib */
01856 extern PNG_EXPORT(void,png_zfree) PNGARG((voidpf png_ptr, voidpf ptr));
01857 #endif
01858 
01859 /* Free data that was allocated internally */
01860 extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr,
01861    png_infop info_ptr, png_uint_32 free_me, int num));
01862 #ifdef PNG_FREE_ME_SUPPORTED
01863 /* Reassign responsibility for freeing existing data, whether allocated
01864  * by libpng or by the application */
01865 extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr,
01866    png_infop info_ptr, int freer, png_uint_32 mask));
01867 #endif
01868 /* assignments for png_data_freer */
01869 #define PNG_DESTROY_WILL_FREE_DATA 1
01870 #define PNG_SET_WILL_FREE_DATA 1
01871 #define PNG_USER_WILL_FREE_DATA 2
01872 /* Flags for png_ptr->free_me and info_ptr->free_me */
01873 #define PNG_FREE_HIST 0x0008
01874 #define PNG_FREE_ICCP 0x0010
01875 #define PNG_FREE_SPLT 0x0020
01876 #define PNG_FREE_ROWS 0x0040
01877 #define PNG_FREE_PCAL 0x0080
01878 #define PNG_FREE_SCAL 0x0100
01879 #define PNG_FREE_UNKN 0x0200
01880 #define PNG_FREE_LIST 0x0400
01881 #define PNG_FREE_PLTE 0x1000
01882 #define PNG_FREE_TRNS 0x2000
01883 #define PNG_FREE_TEXT 0x4000
01884 #define PNG_FREE_ALL  0x7fff
01885 #define PNG_FREE_MUL  0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
01886 
01887 #ifdef PNG_USER_MEM_SUPPORTED
01888 extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr,
01889    png_uint_32 size));
01890 extern PNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr,
01891    png_voidp ptr));
01892 #endif
01893 
01894 extern PNG_EXPORT(png_voidp,png_memcpy_check) PNGARG((png_structp png_ptr,
01895    png_voidp s1, png_voidp s2, png_uint_32 size));
01896 
01897 extern PNG_EXPORT(png_voidp,png_memset_check) PNGARG((png_structp png_ptr,
01898    png_voidp s1, int value, png_uint_32 size));
01899 
01900 #if defined(USE_FAR_KEYWORD)  /* memory model conversion function */
01901 extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
01902    int check));
01903 #endif /* USE_FAR_KEYWORD */
01904 
01905 /* Fatal error in PNG image of libpng - can't continue */
01906 extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr,
01907    png_const_charp error_message));
01908 
01909 /* The same, but the chunk name is prepended to the error string. */
01910 extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr,
01911    png_const_charp error_message));
01912 
01913 /* Non-fatal error in libpng.  Can continue, but may have a problem. */
01914 extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr,
01915    png_const_charp warning_message));
01916 
01917 /* Non-fatal error in libpng, chunk name is prepended to message. */
01918 extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr,
01919    png_const_charp warning_message));
01920 
01921 /* The png_set_<chunk> functions are for storing values in the png_info_struct.
01922  * Similarly, the png_get_<chunk> calls are used to read values from the
01923  * png_info_struct, either storing the parameters in the passed variables, or
01924  * setting pointers into the png_info_struct where the data is stored.  The
01925  * png_get_<chunk> functions return a non-zero value if the data was available
01926  * in info_ptr, or return zero and do not change any of the parameters if the
01927  * data was not available.
01928  *
01929  * These functions should be used instead of directly accessing png_info
01930  * to avoid problems with future changes in the size and internal layout of
01931  * png_info_struct.
01932  */
01933 /* Returns "flag" if chunk data is valid in info_ptr. */
01934 extern PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_structp png_ptr,
01935 png_infop info_ptr, png_uint_32 flag));
01936 
01937 /* Returns number of bytes needed to hold a transformed row. */
01938 extern PNG_EXPORT(png_uint_32,png_get_rowbytes) PNGARG((png_structp png_ptr,
01939 png_infop info_ptr));
01940 
01941 #if defined(PNG_INFO_IMAGE_SUPPORTED)
01942 /* Returns row_pointers, which is an array of pointers to scanlines that was
01943 returned from png_read_png(). */
01944 extern PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_structp png_ptr,
01945 png_infop info_ptr));
01946 /* Set row_pointers, which is an array of pointers to scanlines for use
01947 by png_write_png(). */
01948 extern PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr,
01949    png_infop info_ptr, png_bytepp row_pointers));
01950 #endif
01951 
01952 /* Returns number of color channels in image. */
01953 extern PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_structp png_ptr,
01954 png_infop info_ptr));
01955 
01956 #ifdef PNG_EASY_ACCESS_SUPPORTED
01957 /* Returns image width in pixels. */
01958 extern PNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_structp
01959 png_ptr, png_infop info_ptr));
01960 
01961 /* Returns image height in pixels. */
01962 extern PNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_structp
01963 png_ptr, png_infop info_ptr));
01964 
01965 /* Returns image bit_depth. */
01966 extern PNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_structp
01967 png_ptr, png_infop info_ptr));
01968 
01969 /* Returns image color_type. */
01970 extern PNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_structp
01971 png_ptr, png_infop info_ptr));
01972 
01973 /* Returns image filter_type. */
01974 extern PNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_structp
01975 png_ptr, png_infop info_ptr));
01976 
01977 /* Returns image interlace_type. */
01978 extern PNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_structp
01979 png_ptr, png_infop info_ptr));
01980 
01981 /* Returns image compression_type. */
01982 extern PNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_structp
01983 png_ptr, png_infop info_ptr));
01984 
01985 /* Returns image resolution in pixels per meter, from pHYs chunk data. */
01986 extern PNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_structp
01987 png_ptr, png_infop info_ptr));
01988 extern PNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_structp
01989 png_ptr, png_infop info_ptr));
01990 extern PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_structp
01991 png_ptr, png_infop info_ptr));
01992 
01993 /* Returns pixel aspect ratio, computed from pHYs chunk data.  */
01994 #ifdef PNG_FLOATING_POINT_SUPPORTED
01995 extern PNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_structp
01996 png_ptr, png_infop info_ptr));
01997 #endif
01998 
01999 /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */
02000 extern PNG_EXPORT(png_int_32, png_get_x_offset_pixels) PNGARG((png_structp
02001 png_ptr, png_infop info_ptr));
02002 extern PNG_EXPORT(png_int_32, png_get_y_offset_pixels) PNGARG((png_structp
02003 png_ptr, png_infop info_ptr));
02004 extern PNG_EXPORT(png_int_32, png_get_x_offset_microns) PNGARG((png_structp
02005 png_ptr, png_infop info_ptr));
02006 extern PNG_EXPORT(png_int_32, png_get_y_offset_microns) PNGARG((png_structp
02007 png_ptr, png_infop info_ptr));
02008 
02009 #endif /* PNG_EASY_ACCESS_SUPPORTED */
02010 
02011 /* Returns pointer to signature string read from PNG header */
02012 extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr,
02013 png_infop info_ptr));
02014 
02015 #if defined(PNG_bKGD_SUPPORTED)
02016 extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr,
02017    png_infop info_ptr, png_color_16p *background));
02018 #endif
02019 
02020 #if defined(PNG_bKGD_SUPPORTED)
02021 extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr,
02022    png_infop info_ptr, png_color_16p background));
02023 #endif
02024 
02025 #if defined(PNG_cHRM_SUPPORTED)
02026 #ifdef PNG_FLOATING_POINT_SUPPORTED
02027 extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr,
02028    png_infop info_ptr, double *white_x, double *white_y, double *red_x,
02029    double *red_y, double *green_x, double *green_y, double *blue_x,
02030    double *blue_y));
02031 #endif
02032 #ifdef PNG_FIXED_POINT_SUPPORTED
02033 extern PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_structp png_ptr,
02034    png_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point
02035    *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y,
02036    png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point
02037    *int_blue_x, png_fixed_point *int_blue_y));
02038 #endif
02039 #endif
02040 
02041 #if defined(PNG_cHRM_SUPPORTED)
02042 #ifdef PNG_FLOATING_POINT_SUPPORTED
02043 extern PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr,
02044    png_infop info_ptr, double white_x, double white_y, double red_x,
02045    double red_y, double green_x, double green_y, double blue_x, double blue_y));
02046 #endif
02047 #ifdef PNG_FIXED_POINT_SUPPORTED
02048 extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr,
02049    png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y,
02050    png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
02051    int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
02052    png_fixed_point int_blue_y));
02053 #endif
02054 #endif
02055 
02056 #if defined(PNG_gAMA_SUPPORTED)
02057 #ifdef PNG_FLOATING_POINT_SUPPORTED
02058 extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr,
02059    png_infop info_ptr, double *file_gamma));
02060 #endif
02061 extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_structp png_ptr,
02062    png_infop info_ptr, png_fixed_point *int_file_gamma));
02063 #endif
02064 
02065 #if defined(PNG_gAMA_SUPPORTED)
02066 #ifdef PNG_FLOATING_POINT_SUPPORTED
02067 extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr,
02068    png_infop info_ptr, double file_gamma));
02069 #endif
02070 extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr,
02071    png_infop info_ptr, png_fixed_point int_file_gamma));
02072 #endif
02073 
02074 #if defined(PNG_hIST_SUPPORTED)
02075 extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr,
02076    png_infop info_ptr, png_uint_16p *hist));
02077 #endif
02078 
02079 #if defined(PNG_hIST_SUPPORTED)
02080 extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr,
02081    png_infop info_ptr, png_uint_16p hist));
02082 #endif
02083 
02084 extern PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr,
02085    png_infop info_ptr, png_uint_32 *width, png_uint_32 *height,
02086    int *bit_depth, int *color_type, int *interlace_method,
02087    int *compression_method, int *filter_method));
02088 
02089 extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr,
02090    png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth,
02091    int color_type, int interlace_method, int compression_method,
02092    int filter_method));
02093 
02094 #if defined(PNG_oFFs_SUPPORTED)
02095 extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr,
02096    png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,
02097    int *unit_type));
02098 #endif
02099 
02100 #if defined(PNG_oFFs_SUPPORTED)
02101 extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr,
02102    png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y,
02103    int unit_type));
02104 #endif
02105 
02106 #if defined(PNG_pCAL_SUPPORTED)
02107 extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr,
02108    png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1,
02109    int *type, int *nparams, png_charp *units, png_charpp *params));
02110 #endif
02111 
02112 #if defined(PNG_pCAL_SUPPORTED)
02113 extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr,
02114    png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1,
02115    int type, int nparams, png_charp units, png_charpp params));
02116 #endif
02117 
02118 #if defined(PNG_pHYs_SUPPORTED)
02119 extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr,
02120    png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
02121 #endif
02122 
02123 #if defined(PNG_pHYs_SUPPORTED)
02124 extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr,
02125    png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type));
02126 #endif
02127 
02128 extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr,
02129    png_infop info_ptr, png_colorp *palette, int *num_palette));
02130 
02131 extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr,
02132    png_infop info_ptr, png_colorp palette, int num_palette));
02133 
02134 #if defined(PNG_sBIT_SUPPORTED)
02135 extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr,
02136    png_infop info_ptr, png_color_8p *sig_bit));
02137 #endif
02138 
02139 #if defined(PNG_sBIT_SUPPORTED)
02140 extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr,
02141    png_infop info_ptr, png_color_8p sig_bit));
02142 #endif
02143 
02144 #if defined(PNG_sRGB_SUPPORTED)
02145 extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr,
02146    png_infop info_ptr, int *intent));
02147 #endif
02148 
02149 #if defined(PNG_sRGB_SUPPORTED)
02150 extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr,
02151    png_infop info_ptr, int intent));
02152 extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr,
02153    png_infop info_ptr, int intent));
02154 #endif
02155 
02156 #if defined(PNG_iCCP_SUPPORTED)
02157 extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr,
02158    png_infop info_ptr, png_charpp name, int *compression_type,
02159    png_charpp profile, png_uint_32 *proflen));
02160    /* Note to maintainer: profile should be png_bytepp */
02161 #endif
02162 
02163 #if defined(PNG_iCCP_SUPPORTED)
02164 extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr,
02165    png_infop info_ptr, png_charp name, int compression_type,
02166    png_charp profile, png_uint_32 proflen));
02167    /* Note to maintainer: profile should be png_bytep */
02168 #endif
02169 
02170 #if defined(PNG_sPLT_SUPPORTED)
02171 extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr,
02172    png_infop info_ptr, png_sPLT_tpp entries));
02173 #endif
02174 
02175 #if defined(PNG_sPLT_SUPPORTED)
02176 extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr,
02177    png_infop info_ptr, png_sPLT_tp entries, int nentries));
02178 #endif
02179 
02180 #if defined(PNG_TEXT_SUPPORTED)
02181 /* png_get_text also returns the number of text chunks in *num_text */
02182 extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr,
02183    png_infop info_ptr, png_textp *text_ptr, int *num_text));
02184 #endif
02185 
02186 /*
02187  *  Note while png_set_text() will accept a structure whose text,
02188  *  language, and  translated keywords are NULL pointers, the structure
02189  *  returned by png_get_text will always contain regular
02190  *  zero-terminated C strings.  They might be empty strings but
02191  *  they will never be NULL pointers.
02192  */
02193 
02194 #if defined(PNG_TEXT_SUPPORTED)
02195 extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr,
02196    png_infop info_ptr, png_textp text_ptr, int num_text));
02197 #endif
02198 
02199 #if defined(PNG_tIME_SUPPORTED)
02200 extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr,
02201    png_infop info_ptr, png_timep *mod_time));
02202 #endif
02203 
02204 #if defined(PNG_tIME_SUPPORTED)
02205 extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr,
02206    png_infop info_ptr, png_timep mod_time));
02207 #endif
02208 
02209 #if defined(PNG_tRNS_SUPPORTED)
02210 extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr,
02211    png_infop info_ptr, png_bytep *trans, int *num_trans,
02212    png_color_16p *trans_values));
02213 #endif
02214 
02215 #if defined(PNG_tRNS_SUPPORTED)
02216 extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
02217    png_infop info_ptr, png_bytep trans, int num_trans,
02218    png_color_16p trans_values));
02219 #endif
02220 
02221 #if defined(PNG_tRNS_SUPPORTED)
02222 #endif
02223 
02224 #if defined(PNG_sCAL_SUPPORTED)
02225 #ifdef PNG_FLOATING_POINT_SUPPORTED
02226 extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr,
02227    png_infop info_ptr, int *unit, double *width, double *height));
02228 #else
02229 #ifdef PNG_FIXED_POINT_SUPPORTED
02230 extern PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr,
02231    png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight));
02232 #endif
02233 #endif
02234 #endif /* PNG_sCAL_SUPPORTED */
02235 
02236 #if defined(PNG_sCAL_SUPPORTED)
02237 #ifdef PNG_FLOATING_POINT_SUPPORTED
02238 extern PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr,
02239    png_infop info_ptr, int unit, double width, double height));
02240 #endif
02241 #ifdef PNG_FIXED_POINT_SUPPORTED
02242 extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr,
02243    png_infop info_ptr, int unit, png_charp swidth, png_charp sheight));
02244 #endif
02245 #endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */
02246 
02247 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
02248 /* provide a list of chunks and how they are to be handled, if the built-in
02249    handling or default unknown chunk handling is not desired.  Any chunks not
02250    listed will be handled in the default manner.  The IHDR and IEND chunks
02251    must not be listed.
02252       keep = 0: follow default behavour
02253            = 1: do not keep
02254            = 2: keep only if safe-to-copy
02255            = 3: keep even if unsafe-to-copy
02256 */
02257 extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp
02258    png_ptr, int keep, png_bytep chunk_list, int num_chunks));
02259 extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr,
02260    png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns));
02261 extern PNG_EXPORT(void, png_set_unknown_chunk_location)
02262    PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location));
02263 extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp
02264    png_ptr, png_infop info_ptr, png_unknown_chunkpp entries));
02265 #endif
02266 #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
02267 PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep
02268    chunk_name));
02269 #endif
02270 
02271 /* Png_free_data() will turn off the "valid" flag for anything it frees.
02272    If you need to turn it off for a chunk that your application has freed,
02273    you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); */
02274 extern PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr,
02275    png_infop info_ptr, int mask));
02276 
02277 #if defined(PNG_INFO_IMAGE_SUPPORTED)
02278 /* The "params" pointer is currently not used and is for future expansion. */
02279 extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr,
02280                         png_infop info_ptr,
02281                         int transforms,
02282                         png_voidp params));
02283 extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
02284                         png_infop info_ptr,
02285                         int transforms,
02286                         png_voidp params));
02287 #endif
02288 
02289 /* Define PNG_DEBUG at compile time for debugging information.  Higher
02290  * numbers for PNG_DEBUG mean more debugging information.  This has
02291  * only been added since version 0.95 so it is not implemented throughout
02292  * libpng yet, but more support will be added as needed.
02293  */
02294 #ifdef PNG_DEBUG
02295 #if (PNG_DEBUG > 0)
02296 #if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
02297 #include <crtdbg.h>
02298 #if (PNG_DEBUG > 1)
02299 #define png_debug(l,m)  _RPT0(_CRT_WARN,m)
02300 #define png_debug1(l,m,p1)  _RPT1(_CRT_WARN,m,p1)
02301 #define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m,p1,p2)
02302 #endif
02303 #else /* PNG_DEBUG_FILE || !_MSC_VER */
02304 #ifndef PNG_DEBUG_FILE
02305 #define PNG_DEBUG_FILE stderr
02306 #endif /* PNG_DEBUG_FILE */
02307 #if (PNG_DEBUG > 1)
02308 #define png_debug(l,m) \
02309 { \
02310      int num_tabs=l; \
02311      fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
02312        (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
02313 }
02314 #define png_debug1(l,m,p1) \
02315 { \
02316      int num_tabs=l; \
02317      fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
02318        (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
02319 }
02320 #define png_debug2(l,m,p1,p2) \
02321 { \
02322      int num_tabs=l; \
02323      fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
02324        (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
02325 }
02326 #endif /* (PNG_DEBUG > 1) */
02327 #endif /* _MSC_VER */
02328 #endif /* (PNG_DEBUG > 0) */
02329 #endif /* PNG_DEBUG */
02330 #ifndef png_debug
02331 #define png_debug(l, m)
02332 #endif
02333 #ifndef png_debug1
02334 #define png_debug1(l, m, p1)
02335 #endif
02336 #ifndef png_debug2
02337 #define png_debug2(l, m, p1, p2)
02338 #endif
02339 
02340 extern PNG_EXPORT(png_bytep,png_sig_bytes) PNGARG((void));
02341 
02342 extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr));
02343 extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr));
02344 extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr));
02345 extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));
02346 
02347 #ifdef PNG_MNG_FEATURES_SUPPORTED
02348 extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp
02349    png_ptr, png_uint_32 mng_features_permitted));
02350 #endif
02351 
02352 /* Added to version 1.2.0 */
02353 #if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
02354 #define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED  0x01  /* not user-settable */
02355 #define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU    0x02  /* not user-settable */
02356 #define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW  0x04
02357 #define PNG_ASM_FLAG_MMX_READ_INTERLACE    0x08
02358 #define PNG_ASM_FLAG_MMX_READ_FILTER_SUB   0x10
02359 #define PNG_ASM_FLAG_MMX_READ_FILTER_UP    0x20
02360 #define PNG_ASM_FLAG_MMX_READ_FILTER_AVG   0x40
02361 #define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH 0x80
02362 #define PNG_ASM_FLAGS_INITIALIZED          0x80000000  /* not user-settable */
02363 
02364 #define PNG_MMX_READ_FLAGS ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW  \
02365                            | PNG_ASM_FLAG_MMX_READ_INTERLACE    \
02366                            | PNG_ASM_FLAG_MMX_READ_FILTER_SUB   \
02367                            | PNG_ASM_FLAG_MMX_READ_FILTER_UP    \
02368                            | PNG_ASM_FLAG_MMX_READ_FILTER_AVG   \
02369                            | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH )
02370 #define PNG_MMX_WRITE_FLAGS ( 0 )
02371 
02372 #define PNG_MMX_FLAGS ( PNG_ASM_FLAG_MMX_SUPPORT_COMPILED \
02373                       | PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU   \
02374                       | PNG_MMX_READ_FLAGS                \
02375                       | PNG_MMX_WRITE_FLAGS )
02376 
02377 #define PNG_SELECT_READ   1
02378 #define PNG_SELECT_WRITE  2
02379 
02380 
02381 #if !defined(PNG_1_0_X)
02382 /* pngget.c */
02383 extern PNG_EXPORT(png_uint_32,png_get_mmx_flagmask)
02384    PNGARG((int flag_select, int *compilerID));
02385 
02386 /* pngget.c */
02387 extern PNG_EXPORT(png_uint_32,png_get_asm_flagmask)
02388    PNGARG((int flag_select));
02389 
02390 /* pngget.c */
02391 extern PNG_EXPORT(png_uint_32,png_get_asm_flags)
02392    PNGARG((png_structp png_ptr));
02393 
02394 /* pngget.c */
02395 extern PNG_EXPORT(png_byte,png_get_mmx_bitdepth_threshold)
02396    PNGARG((png_structp png_ptr));
02397 
02398 /* pngget.c */
02399 extern PNG_EXPORT(png_uint_32,png_get_mmx_rowbytes_threshold)
02400    PNGARG((png_structp png_ptr));
02401 
02402 /* pngset.c */
02403 extern PNG_EXPORT(void,png_set_asm_flags)
02404    PNGARG((png_structp png_ptr, png_uint_32 asm_flags));
02405 
02406 /* pngset.c */
02407 extern PNG_EXPORT(void,png_set_mmx_thresholds)
02408    PNGARG((png_structp png_ptr, png_byte mmx_bitdepth_threshold,
02409    png_uint_32 mmx_rowbytes_threshold));
02410 
02411 #endif /* PNG_1_0_X */
02412 #endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
02413 
02414 #if !defined(PNG_1_0_X)
02415 /* png.c, pnggccrd.c, or pngvcrd.c */
02416 extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));
02417 
02418 /* Strip the prepended error numbers ("#nnn ") from error and warning
02419  * messages before passing them to the error or warning handler. */
02420 #ifdef PNG_ERROR_NUMBERS_SUPPORTED
02421 extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp
02422    png_ptr, png_uint_32 strip_mode));
02423 #endif
02424 #endif /* PNG_1_0_X */
02425 
02426 /* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
02427 
02428 #define PNG_HEADER_VERSION_STRING \
02429    " libpng version 1.2.5 - October 3, 2002 (header)\n"
02430 
02431 #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
02432 /* With these routines we avoid an integer divide, which will be slower on
02433  * most machines.  However, it does take more operations than the corresponding
02434  * divide method, so it may be slower on a few RISC systems.  There are two
02435  * shifts (by 8 or 16 bits) and an addition, versus a single integer divide.
02436  *
02437  * Note that the rounding factors are NOT supposed to be the same!  128 and
02438  * 32768 are correct for the NODIV code; 127 and 32767 are correct for the
02439  * standard method.
02440  *
02441  * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ]
02442  */
02443 
02444  /* fg and bg should be in `gamma 1.0' space; alpha is the opacity          */
02445 
02446 #  define png_composite(composite, fg, alpha, bg)                            \
02447      { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) * (png_uint_16)(alpha) \
02448                         +        (png_uint_16)(bg)*(png_uint_16)(255 -       \
02449                         (png_uint_16)(alpha)) + (png_uint_16)128);           \
02450        (composite) = (png_byte)((temp + (temp >> 8)) >> 8); }
02451 
02452 #  define png_composite_16(composite, fg, alpha, bg)                         \
02453      { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) * (png_uint_32)(alpha) \
02454                         + (png_uint_32)(bg)*(png_uint_32)(65535L -           \
02455                         (png_uint_32)(alpha)) + (png_uint_32)32768L);        \
02456        (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
02457 
02458 #else  /* standard method using integer division */
02459 
02460 #  define png_composite(composite, fg, alpha, bg)                            \
02461      (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) +    \
02462        (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) +       \
02463        (png_uint_16)127) / 255)
02464 
02465 #  define png_composite_16(composite, fg, alpha, bg)                         \
02466      (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
02467        (png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) +      \
02468        (png_uint_32)32767) / (png_uint_32)65535L)
02469 
02470 #endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
02471 
02472 /* These next functions are used internally in the code.  They generally
02473  * shouldn't be used unless you are writing code to add or replace some
02474  * functionality in libpng.  More information about most functions can
02475  * be found in the files where the functions are located.
02476  */
02477 
02478 #if defined(PNG_INTERNAL)
02479 
02480 /* Various modes of operation.  Note that after an init, mode is set to
02481  * zero automatically when the structure is created.
02482  */
02483 #define PNG_HAVE_IHDR               0x01
02484 #define PNG_HAVE_PLTE               0x02
02485 #define PNG_HAVE_IDAT               0x04
02486 #define PNG_AFTER_IDAT              0x08
02487 #define PNG_HAVE_IEND               0x10
02488 #define PNG_HAVE_gAMA               0x20
02489 #define PNG_HAVE_cHRM               0x40
02490 #define PNG_HAVE_sRGB               0x80
02491 #define PNG_HAVE_CHUNK_HEADER      0x100
02492 #define PNG_WROTE_tIME             0x200
02493 #define PNG_WROTE_INFO_BEFORE_PLTE 0x400
02494 #define PNG_BACKGROUND_IS_GRAY     0x800
02495 #define PNG_HAVE_PNG_SIGNATURE    0x1000
02496 
02497 /* flags for the transformations the PNG library does on the image data */
02498 #define PNG_BGR                0x0001
02499 #define PNG_INTERLACE          0x0002
02500 #define PNG_PACK               0x0004
02501 #define PNG_SHIFT              0x0008
02502 #define PNG_SWAP_BYTES         0x0010
02503 #define PNG_INVERT_MONO        0x0020
02504 #define PNG_DITHER             0x0040
02505 #define PNG_BACKGROUND         0x0080
02506 #define PNG_BACKGROUND_EXPAND  0x0100
02507                           /*   0x0200 unused */
02508 #define PNG_16_TO_8            0x0400
02509 #define PNG_RGBA               0x0800
02510 #define PNG_EXPAND             0x1000
02511 #define PNG_GAMMA              0x2000
02512 #define PNG_GRAY_TO_RGB        0x4000
02513 #define PNG_FILLER             0x8000L
02514 #define PNG_PACKSWAP          0x10000L
02515 #define PNG_SWAP_ALPHA        0x20000L
02516 #define PNG_STRIP_ALPHA       0x40000L
02517 #define PNG_INVERT_ALPHA      0x80000L
02518 #define PNG_USER_TRANSFORM   0x100000L
02519 #define PNG_RGB_TO_GRAY_ERR  0x200000L
02520 #define PNG_RGB_TO_GRAY_WARN 0x400000L
02521 #define PNG_RGB_TO_GRAY      0x600000L  /* two bits, RGB_TO_GRAY_ERR|WARN */
02522 
02523 /* flags for png_create_struct */
02524 #define PNG_STRUCT_PNG   0x0001
02525 #define PNG_STRUCT_INFO  0x0002
02526 
02527 /* Scaling factor for filter heuristic weighting calculations */
02528 #define PNG_WEIGHT_SHIFT 8
02529 #define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT))
02530 #define PNG_COST_SHIFT 3
02531 #define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))
02532 
02533 /* flags for the png_ptr->flags rather than declaring a byte for each one */
02534 #define PNG_FLAG_ZLIB_CUSTOM_STRATEGY     0x0001
02535 #define PNG_FLAG_ZLIB_CUSTOM_LEVEL        0x0002
02536 #define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL    0x0004
02537 #define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS  0x0008
02538 #define PNG_FLAG_ZLIB_CUSTOM_METHOD       0x0010
02539 #define PNG_FLAG_ZLIB_FINISHED            0x0020
02540 #define PNG_FLAG_ROW_INIT                 0x0040
02541 #define PNG_FLAG_FILLER_AFTER             0x0080
02542 #define PNG_FLAG_CRC_ANCILLARY_USE        0x0100
02543 #define PNG_FLAG_CRC_ANCILLARY_NOWARN     0x0200
02544 #define PNG_FLAG_CRC_CRITICAL_USE         0x0400
02545 #define PNG_FLAG_CRC_CRITICAL_IGNORE      0x0800
02546 #define PNG_FLAG_FREE_PLTE                0x1000
02547 #define PNG_FLAG_FREE_TRNS                0x2000
02548 #define PNG_FLAG_FREE_HIST                0x4000
02549 #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS      0x8000L
02550 #define PNG_FLAG_KEEP_UNSAFE_CHUNKS       0x10000L
02551 #define PNG_FLAG_LIBRARY_MISMATCH         0x20000L
02552 #define PNG_FLAG_STRIP_ERROR_NUMBERS      0x40000L
02553 #define PNG_FLAG_STRIP_ERROR_TEXT         0x80000L
02554 #define PNG_FLAG_MALLOC_NULL_MEM_OK       0x100000L
02555 
02556 /* For use in png_set_keep_unknown, png_handle_as_unknown */
02557 #define HANDLE_CHUNK_AS_DEFAULT   0
02558 #define HANDLE_CHUNK_NEVER        1
02559 #define HANDLE_CHUNK_IF_SAFE      2
02560 #define HANDLE_CHUNK_ALWAYS       3
02561 
02562 #define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
02563                                      PNG_FLAG_CRC_ANCILLARY_NOWARN)
02564 
02565 #define PNG_FLAG_CRC_CRITICAL_MASK  (PNG_FLAG_CRC_CRITICAL_USE | \
02566                                      PNG_FLAG_CRC_CRITICAL_IGNORE)
02567 
02568 #define PNG_FLAG_CRC_MASK           (PNG_FLAG_CRC_ANCILLARY_MASK | \
02569                                      PNG_FLAG_CRC_CRITICAL_MASK)
02570 
02571 /* save typing and make code easier to understand */
02572 #define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
02573    abs((int)((c1).green) - (int)((c2).green)) + \
02574    abs((int)((c1).blue) - (int)((c2).blue)))
02575 
02576 /* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
02577 #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
02578 /* place to hold the signature string for a PNG file. */
02579 #ifdef PNG_USE_GLOBAL_ARRAYS
02580    PNG_EXPORT_VAR (const png_byte FARDATA) png_sig[8];
02581 #else
02582 #define png_sig png_sig_bytes(NULL)
02583 #endif
02584 #endif /* PNG_NO_EXTERN */
02585 
02586 /* Constant strings for known chunk types.  If you need to add a chunk,
02587  * define the name here, and add an invocation of the macro in png.c and
02588  * wherever it's needed.
02589  */
02590 #define PNG_IHDR const png_byte png_IHDR[5] = { 73,  72,  68,  82, '\0'}
02591 #define PNG_IDAT const png_byte png_IDAT[5] = { 73,  68,  65,  84, '\0'}
02592 #define PNG_IEND const png_byte png_IEND[5] = { 73,  69,  78,  68, '\0'}
02593 #define PNG_PLTE const png_byte png_PLTE[5] = { 80,  76,  84,  69, '\0'}
02594 #define PNG_bKGD const png_byte png_bKGD[5] = { 98,  75,  71,  68, '\0'}
02595 #define PNG_cHRM const png_byte png_cHRM[5] = { 99,  72,  82,  77, '\0'}
02596 #define PNG_gAMA const png_byte png_gAMA[5] = {103,  65,  77,  65, '\0'}
02597 #define PNG_hIST const png_byte png_hIST[5] = {104,  73,  83,  84, '\0'}
02598 #define PNG_iCCP const png_byte png_iCCP[5] = {105,  67,  67,  80, '\0'}
02599 #define PNG_iTXt const png_byte png_iTXt[5] = {105,  84,  88, 116, '\0'}
02600 #define PNG_oFFs const png_byte png_oFFs[5] = {111,  70,  70, 115, '\0'}
02601 #define PNG_pCAL const png_byte png_pCAL[5] = {112,  67,  65,  76, '\0'}
02602 #define PNG_sCAL const png_byte png_sCAL[5] = {115,  67,  65,  76, '\0'}
02603 #define PNG_pHYs const png_byte png_pHYs[5] = {112,  72,  89, 115, '\0'}
02604 #define PNG_sBIT const png_byte png_sBIT[5] = {115,  66,  73,  84, '\0'}
02605 #define PNG_sPLT const png_byte png_sPLT[5] = {115,  80,  76,  84, '\0'}
02606 #define PNG_sRGB const png_byte png_sRGB[5] = {115,  82,  71,  66, '\0'}
02607 #define PNG_tEXt const png_byte png_tEXt[5] = {116,  69,  88, 116, '\0'}
02608 #define PNG_tIME const png_byte png_tIME[5] = {116,  73,  77,  69, '\0'}
02609 #define PNG_tRNS const png_byte png_tRNS[5] = {116,  82,  78,  83, '\0'}
02610 #define PNG_zTXt const png_byte png_zTXt[5] = {122,  84,  88, 116, '\0'}
02611 
02612 #ifdef PNG_USE_GLOBAL_ARRAYS
02613 PNG_EXPORT_VAR (const png_byte FARDATA) png_IHDR[5];
02614 PNG_EXPORT_VAR (const png_byte FARDATA) png_IDAT[5];
02615 PNG_EXPORT_VAR (const png_byte FARDATA) png_IEND[5];
02616 PNG_EXPORT_VAR (const png_byte FARDATA) png_PLTE[5];
02617 PNG_EXPORT_VAR (const png_byte FARDATA) png_bKGD[5];
02618 PNG_EXPORT_VAR (const png_byte FARDATA) png_cHRM[5];
02619 PNG_EXPORT_VAR (const png_byte FARDATA) png_gAMA[5];
02620 PNG_EXPORT_VAR (const png_byte FARDATA) png_hIST[5];
02621 PNG_EXPORT_VAR (const png_byte FARDATA) png_iCCP[5];
02622 PNG_EXPORT_VAR (const png_byte FARDATA) png_iTXt[5];
02623 PNG_EXPORT_VAR (const png_byte FARDATA) png_oFFs[5];
02624 PNG_EXPORT_VAR (const png_byte FARDATA) png_pCAL[5];
02625 PNG_EXPORT_VAR (const png_byte FARDATA) png_sCAL[5];
02626 PNG_EXPORT_VAR (const png_byte FARDATA) png_pHYs[5];
02627 PNG_EXPORT_VAR (const png_byte FARDATA) png_sBIT[5];
02628 PNG_EXPORT_VAR (const png_byte FARDATA) png_sPLT[5];
02629 PNG_EXPORT_VAR (const png_byte FARDATA) png_sRGB[5];
02630 PNG_EXPORT_VAR (const png_byte FARDATA) png_tEXt[5];
02631 PNG_EXPORT_VAR (const png_byte FARDATA) png_tIME[5];
02632 PNG_EXPORT_VAR (const png_byte FARDATA) png_tRNS[5];
02633 PNG_EXPORT_VAR (const png_byte FARDATA) png_zTXt[5];
02634 #endif /* PNG_USE_GLOBAL_ARRAYS */
02635 
02636 
02637 /* Inline macros to do direct reads of bytes from the input buffer.  These
02638  * require that you are using an architecture that uses PNG byte ordering
02639  * (MSB first) and supports unaligned data storage.  I think that PowerPC
02640  * in big-endian mode and 680x0 are the only ones that will support this.
02641  * The x86 line of processors definitely do not.  The png_get_int_32()
02642  * routine also assumes we are using two's complement format for negative
02643  * values, which is almost certainly true.
02644  */
02645 #if defined(PNG_READ_BIG_ENDIAN_SUPPORTED)
02646 #  if defined(PNG_pCAL_SUPPORTED) || defined(PNG_oFFs_SUPPORTED)
02647 #    define png_get_int_32(buf) ( *((png_int_32p) (buf)))
02648 #  endif
02649 #  define png_get_uint_32(buf) ( *((png_uint_32p) (buf)))
02650 #  define png_get_uint_16(buf) ( *((png_uint_16p) (buf)))
02651 #else
02652 #  if defined(PNG_pCAL_SUPPORTED) || defined(PNG_oFFs_SUPPORTED)
02653 PNG_EXTERN png_int_32 png_get_int_32 PNGARG((png_bytep buf));
02654 #  endif
02655 PNG_EXTERN png_uint_32 png_get_uint_32 PNGARG((png_bytep buf));
02656 PNG_EXTERN png_uint_16 png_get_uint_16 PNGARG((png_bytep buf));
02657 #endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */
02658 
02659 /* Initialize png_ptr struct for reading, and allocate any other memory.
02660  * (old interface - DEPRECATED - use png_create_read_struct instead).
02661  */
02662 extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr));
02663 #undef png_read_init
02664 #define png_read_init(png_ptr) png_read_init_3(&png_ptr, \
02665     PNG_LIBPNG_VER_STRING,  sizeof(png_struct));
02666 extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr,
02667     png_const_charp user_png_ver, png_size_t png_struct_size));
02668 extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr,
02669     png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
02670     png_info_size));
02671 
02672 /* Initialize png_ptr struct for writing, and allocate any other memory.
02673  * (old interface - DEPRECATED - use png_create_write_struct instead).
02674  */
02675 extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr));
02676 #undef png_write_init
02677 #define png_write_init(png_ptr) png_write_init_3(&png_ptr, \
02678     PNG_LIBPNG_VER_STRING, sizeof(png_struct));
02679 extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr,
02680     png_const_charp user_png_ver, png_size_t png_struct_size));
02681 extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr,
02682     png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
02683     png_info_size));
02684 
02685 /* Allocate memory for an internal libpng struct */
02686 PNG_EXTERN png_voidp png_create_struct PNGARG((int type));
02687 
02688 /* Free memory from internal libpng struct */
02689 PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));
02690 
02691 PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr
02692   malloc_fn, png_voidp mem_ptr));
02693 PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
02694    png_free_ptr free_fn, png_voidp mem_ptr));
02695 
02696 /* Free any memory that info_ptr points to and reset struct. */
02697 PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
02698    png_infop info_ptr));
02699 
02700 #ifndef PNG_1_0_X
02701 /* Function to allocate memory for zlib. */
02702 PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
02703 
02704 /* Function to free memory for zlib */
02705 PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
02706 
02707 /* Next four functions are used internally as callbacks.  PNGAPI is required
02708  * but not PNG_EXPORT.  PNGAPI added at libpng version 1.2.3. */
02709 
02710 PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr,
02711    png_bytep data, png_size_t length));
02712 
02713 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
02714 PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr,
02715    png_bytep buffer, png_size_t length));
02716 #endif
02717 
02718 PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr,
02719    png_bytep data, png_size_t length));
02720 
02721 #if defined(PNG_WRITE_FLUSH_SUPPORTED)
02722 #if !defined(PNG_NO_STDIO)
02723 PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr));
02724 #endif
02725 #endif
02726 #else /* PNG_1_0_X */
02727 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
02728 PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr,
02729    png_bytep buffer, png_size_t length));
02730 #endif
02731 #endif /* PNG_1_0_X */
02732 
02733 /* Reset the CRC variable */
02734 PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));
02735 
02736 /* Write the "data" buffer to whatever output you are using. */
02737 PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data,
02738    png_size_t length));
02739 
02740 /* Read data from whatever input you are using into the "data" buffer */
02741 PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
02742    png_size_t length));
02743 
02744 /* Read bytes into buf, and update png_ptr->crc */
02745 PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
02746    png_size_t length));
02747 
02748 /* Decompress data in a chunk that uses compression */
02749 #if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \
02750     defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
02751 PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr,
02752    int comp_type, png_charp chunkdata, png_size_t chunklength,
02753    png_size_t prefix_length, png_size_t *data_length));
02754 #endif
02755 
02756 /* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
02757 PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip));
02758 
02759 /* Read the CRC from the file and compare it to the libpng calculated CRC */
02760 PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr));
02761 
02762 /* Calculate the CRC over a section of data.  Note that we are only
02763  * passing a maximum of 64K on systems that have this as a memory limit,
02764  * since this is the maximum buffer size we can specify.
02765  */
02766 PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
02767    png_size_t length));
02768 
02769 #if defined(PNG_WRITE_FLUSH_SUPPORTED)
02770 PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
02771 #endif
02772 
02773 
02774 /* Place a 32-bit number into a buffer in PNG byte order (big-endian).
02775  * The only currently known PNG chunks that use signed numbers are
02776  * the ancillary extension chunks, oFFs and pCAL.
02777  */
02778 PNG_EXTERN void png_save_uint_32 PNGARG((png_bytep buf, png_uint_32 i));
02779 
02780 #if defined(PNG_WRITE_pCAL_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
02781 PNG_EXTERN void png_save_int_32 PNGARG((png_bytep buf, png_int_32 i));
02782 #endif
02783 
02784 /* Place a 16-bit number into a buffer in PNG byte order.
02785  * The parameter is declared unsigned int, not png_uint_16,
02786  * just to avoid potential problems on pre-ANSI C compilers.
02787  */
02788 PNG_EXTERN void png_save_uint_16 PNGARG((png_bytep buf, unsigned int i));
02789 
02790 /* simple function to write the signature */
02791 PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr));
02792 
02793 /* write various chunks */
02794 
02795 /* Write the IHDR chunk, and update the png_struct with the necessary
02796  * information.
02797  */
02798 PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
02799    png_uint_32 height,
02800    int bit_depth, int color_type, int compression_method, int filter_method,
02801    int interlace_method));
02802 
02803 PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,
02804    png_uint_32 num_pal));
02805 
02806 PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
02807    png_size_t length));
02808 
02809 PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr));
02810 
02811 #if defined(PNG_WRITE_gAMA_SUPPORTED)
02812 #ifdef PNG_FLOATING_POINT_SUPPORTED
02813 PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma));
02814 #endif
02815 #ifdef PNG_FIXED_POINT_SUPPORTED
02816 PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, png_fixed_point
02817     file_gamma));
02818 #endif
02819 #endif
02820 
02821 #if defined(PNG_WRITE_sBIT_SUPPORTED)
02822 PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
02823    int color_type));
02824 #endif
02825 
02826 #if defined(PNG_WRITE_cHRM_SUPPORTED)
02827 #ifdef PNG_FLOATING_POINT_SUPPORTED
02828 PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr,
02829    double white_x, double white_y,
02830    double red_x, double red_y, double green_x, double green_y,
02831    double blue_x, double blue_y));
02832 #endif
02833 #ifdef PNG_FIXED_POINT_SUPPORTED
02834 PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr,
02835    png_fixed_point int_white_x, png_fixed_point int_white_y,
02836    png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
02837    int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
02838    png_fixed_point int_blue_y));
02839 #endif
02840 #endif
02841 
02842 #if defined(PNG_WRITE_sRGB_SUPPORTED)
02843 PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,
02844    int intent));
02845 #endif
02846 
02847 #if defined(PNG_WRITE_iCCP_SUPPORTED)
02848 PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,
02849    png_charp name, int compression_type,
02850    png_charp profile, int proflen));
02851    /* Note to maintainer: profile should be png_bytep */
02852 #endif
02853 
02854 #if defined(PNG_WRITE_sPLT_SUPPORTED)
02855 PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr,
02856    png_sPLT_tp palette));
02857 #endif
02858 
02859 #if defined(PNG_WRITE_tRNS_SUPPORTED)
02860 PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,
02861    png_color_16p values, int number, int color_type));
02862 #endif
02863 
02864 #if defined(PNG_WRITE_bKGD_SUPPORTED)
02865 PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr,
02866    png_color_16p values, int color_type));
02867 #endif
02868 
02869 #if defined(PNG_WRITE_hIST_SUPPORTED)
02870 PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,
02871    int num_hist));
02872 #endif
02873 
02874 #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
02875     defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
02876 PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,
02877    png_charp key, png_charpp new_key));
02878 #endif
02879 
02880 #if defined(PNG_WRITE_tEXt_SUPPORTED)
02881 PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,
02882    png_charp text, png_size_t text_len));
02883 #endif
02884 
02885 #if defined(PNG_WRITE_zTXt_SUPPORTED)
02886 PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,
02887    png_charp text, png_size_t text_len, int compression));
02888 #endif
02889 
02890 #if defined(PNG_WRITE_iTXt_SUPPORTED)
02891 PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr,
02892    int compression, png_charp key, png_charp lang, png_charp lang_key,
02893    png_charp text));
02894 #endif
02895 
02896 #if defined(PNG_TEXT_SUPPORTED)  /* Added at version 1.0.14 and 1.2.4 */
02897 PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr,
02898    png_infop info_ptr, png_textp text_ptr, int num_text));
02899 #endif
02900 
02901 #if defined(PNG_WRITE_oFFs_SUPPORTED)
02902 PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
02903    png_int_32 x_offset, png_int_32 y_offset, int unit_type));
02904 #endif
02905 
02906 #if defined(PNG_WRITE_pCAL_SUPPORTED)
02907 PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose,
02908    png_int_32 X0, png_int_32 X1, int type, int nparams,
02909    png_charp units, png_charpp params));
02910 #endif
02911 
02912 #if defined(PNG_WRITE_pHYs_SUPPORTED)
02913 PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr,
02914    png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
02915    int unit_type));
02916 #endif
02917 
02918 #if defined(PNG_WRITE_tIME_SUPPORTED)
02919 PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
02920    png_timep mod_time));
02921 #endif
02922 
02923 #if defined(PNG_WRITE_sCAL_SUPPORTED)
02924 #if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
02925 PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,
02926    int unit, double width, double height));
02927 #else
02928 #ifdef PNG_FIXED_POINT_SUPPORTED
02929 PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr,
02930    int unit, png_charp width, png_charp height));
02931 #endif
02932 #endif
02933 #endif
02934 
02935 /* Called when finished processing a row of data */
02936 PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr));
02937 
02938 /* Internal use only.   Called before first row of data */
02939 PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));
02940 
02941 #if defined(PNG_READ_GAMMA_SUPPORTED)
02942 PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr));
02943 #endif
02944 
02945 /* combine a row of data, dealing with alpha, etc. if requested */
02946 PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
02947    int mask));
02948 
02949 #if defined(PNG_READ_INTERLACING_SUPPORTED)
02950 /* expand an interlaced row */
02951 /* OLD pre-1.0.9 interface:
02952 PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
02953    png_bytep row, int pass, png_uint_32 transformations));
02954  */
02955 PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));
02956 #endif
02957 
02958 /* GRR TO DO (2.0 or whenever):  simplify other internal calling interfaces */
02959 
02960 #if defined(PNG_WRITE_INTERLACING_SUPPORTED)
02961 /* grab pixels out of a row for an interlaced pass */
02962 PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
02963    png_bytep row, int pass));
02964 #endif
02965 
02966 /* unfilter a row */
02967 PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr,
02968    png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter));
02969 
02970 /* Choose the best filter to use and filter the row data */
02971 PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr,
02972    png_row_infop row_info));
02973 
02974 /* Write out the filtered row. */
02975 PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr,
02976    png_bytep filtered_row));
02977 /* finish a row while reading, dealing with interlacing passes, etc. */
02978 PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr));
02979 
02980 /* initialize the row buffers, etc. */
02981 PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr));
02982 /* optional call to update the users info structure */
02983 PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,
02984    png_infop info_ptr));
02985 
02986 /* these are the functions that do the transformations */
02987 #if defined(PNG_READ_FILLER_SUPPORTED)
02988 PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,
02989    png_bytep row, png_uint_32 filler, png_uint_32 flags));
02990 #endif
02991 
02992 #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
02993 PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info,
02994    png_bytep row));
02995 #endif
02996 
02997 #if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
02998 PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info,
02999    png_bytep row));
03000 #endif
03001 
03002 #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
03003 PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info,
03004    png_bytep row));
03005 #endif
03006 
03007 #if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
03008 PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info,
03009    png_bytep row));
03010 #endif
03011 
03012 #if defined(PNG_WRITE_FILLER_SUPPORTED) || \
03013     defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
03014 PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info,
03015    png_bytep row, png_uint_32 flags));
03016 #endif
03017 
03018 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
03019 PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));
03020 #endif
03021 
03022 #if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)
03023 PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row));
03024 #endif
03025 
03026 #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
03027 PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop
03028    row_info, png_bytep row));
03029 #endif
03030 
03031 #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
03032 PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,
03033    png_bytep row));
03034 #endif
03035 
03036 #if defined(PNG_READ_PACK_SUPPORTED)
03037 PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));
03038 #endif
03039 
03040 #if defined(PNG_READ_SHIFT_SUPPORTED)
03041 PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row,
03042    png_color_8p sig_bits));
03043 #endif
03044 
03045 #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
03046 PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));
03047 #endif
03048 
03049 #if defined(PNG_READ_16_TO_8_SUPPORTED)
03050 PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));
03051 #endif
03052 
03053 #if defined(PNG_READ_DITHER_SUPPORTED)
03054 PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info,
03055    png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup));
03056 
03057 #  if defined(PNG_CORRECT_PALETTE_SUPPORTED)
03058 PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,
03059    png_colorp palette, int num_palette));
03060 #  endif
03061 #endif
03062 
03063 #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
03064 PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row));
03065 #endif
03066 
03067 #if defined(PNG_WRITE_PACK_SUPPORTED)
03068 PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info,
03069    png_bytep row, png_uint_32 bit_depth));
03070 #endif
03071 
03072 #if defined(PNG_WRITE_SHIFT_SUPPORTED)
03073 PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,
03074    png_color_8p bit_depth));
03075 #endif
03076 
03077 #if defined(PNG_READ_BACKGROUND_SUPPORTED)
03078 #if defined(PNG_READ_GAMMA_SUPPORTED)
03079 PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
03080    png_color_16p trans_values, png_color_16p background,
03081    png_color_16p background_1,
03082    png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
03083    png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
03084    png_uint_16pp gamma_16_to_1, int gamma_shift));
03085 #else
03086 PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
03087    png_color_16p trans_values, png_color_16p background));
03088 #endif
03089 #endif
03090 
03091 #if defined(PNG_READ_GAMMA_SUPPORTED)
03092 PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row,
03093    png_bytep gamma_table, png_uint_16pp gamma_16_table,
03094    int gamma_shift));
03095 #endif
03096 
03097 #if defined(PNG_READ_EXPAND_SUPPORTED)
03098 PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info,
03099    png_bytep row, png_colorp palette, png_bytep trans, int num_trans));
03100 PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,
03101    png_bytep row, png_color_16p trans_value));
03102 #endif
03103 
03104 /* The following decodes the appropriate chunks, and does error correction,
03105  * then calls the appropriate callback for the chunk if it is valid.
03106  */
03107 
03108 /* decode the IHDR chunk */
03109 PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,
03110    png_uint_32 length));
03111 PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,
03112    png_uint_32 length));
03113 PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr,
03114    png_uint_32 length));
03115 
03116 #if defined(PNG_READ_bKGD_SUPPORTED)
03117 PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,
03118    png_uint_32 length));
03119 #endif
03120 
03121 #if defined(PNG_READ_cHRM_SUPPORTED)
03122 PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,
03123    png_uint_32 length));
03124 #endif
03125 
03126 #if defined(PNG_READ_gAMA_SUPPORTED)
03127 PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,
03128    png_uint_32 length));
03129 #endif
03130 
03131 #if defined(PNG_READ_hIST_SUPPORTED)
03132 PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
03133    png_uint_32 length));
03134 #endif
03135 
03136 #if defined(PNG_READ_iCCP_SUPPORTED)
03137 extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,
03138    png_uint_32 length));
03139 #endif /* PNG_READ_iCCP_SUPPORTED */
03140 
03141 #if defined(PNG_READ_iTXt_SUPPORTED)
03142 PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
03143    png_uint_32 length));
03144 #endif
03145 
03146 #if defined(PNG_READ_oFFs_SUPPORTED)
03147 PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,
03148    png_uint_32 length));
03149 #endif
03150 
03151 #if defined(PNG_READ_pCAL_SUPPORTED)
03152 PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
03153    png_uint_32 length));
03154 #endif
03155 
03156 #if defined(PNG_READ_pHYs_SUPPORTED)
03157 PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,
03158    png_uint_32 length));
03159 #endif
03160 
03161 #if defined(PNG_READ_sBIT_SUPPORTED)
03162 PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,
03163    png_uint_32 length));
03164 #endif
03165 
03166 #if defined(PNG_READ_sCAL_SUPPORTED)
03167 PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
03168    png_uint_32 length));
03169 #endif
03170 
03171 #if defined(PNG_READ_sPLT_SUPPORTED)
03172 extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,
03173    png_uint_32 length));
03174 #endif /* PNG_READ_sPLT_SUPPORTED */
03175 
03176 #if defined(PNG_READ_sRGB_SUPPORTED)
03177 PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr,
03178    png_uint_32 length));
03179 #endif
03180 
03181 #if defined(PNG_READ_tEXt_SUPPORTED)
03182 PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
03183    png_uint_32 length));
03184 #endif
03185 
03186 #if defined(PNG_READ_tIME_SUPPORTED)
03187 PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,
03188    png_uint_32 length));
03189 #endif
03190 
03191 #if defined(PNG_READ_tRNS_SUPPORTED)
03192 PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
03193    png_uint_32 length));
03194 #endif
03195 
03196 #if defined(PNG_READ_zTXt_SUPPORTED)
03197 PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
03198    png_uint_32 length));
03199 #endif
03200 
03201 PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
03202    png_infop info_ptr, png_uint_32 length));
03203 
03204 PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,
03205    png_bytep chunk_name));
03206 
03207 /* handle the transformations for reading and writing */
03208 PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));
03209 PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr));
03210 
03211 PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr));
03212 
03213 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
03214 PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr,
03215    png_infop info_ptr));
03216 PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr,
03217    png_infop info_ptr));
03218 PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr));
03219 PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr,
03220    png_uint_32 length));
03221 PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr));
03222 PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr));
03223 PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr,
03224    png_bytep buffer, png_size_t buffer_length));
03225 PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr));
03226 PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr,
03227    png_bytep buffer, png_size_t buffer_length));
03228 PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr));
03229 PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr,
03230    png_infop info_ptr, png_uint_32 length));
03231 PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr,
03232    png_infop info_ptr));
03233 PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr,
03234    png_infop info_ptr));
03235 PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row));
03236 PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr,
03237    png_infop info_ptr));
03238 PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr,
03239    png_infop info_ptr));
03240 PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr));
03241 #if defined(PNG_READ_tEXt_SUPPORTED)
03242 PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr,
03243    png_infop info_ptr, png_uint_32 length));
03244 PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr,
03245    png_infop info_ptr));
03246 #endif
03247 #if defined(PNG_READ_zTXt_SUPPORTED)
03248 PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr,
03249    png_infop info_ptr, png_uint_32 length));
03250 PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr,
03251    png_infop info_ptr));
03252 #endif
03253 #if defined(PNG_READ_iTXt_SUPPORTED)
03254 PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr,
03255    png_infop info_ptr, png_uint_32 length));
03256 PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr,
03257    png_infop info_ptr));
03258 #endif
03259 
03260 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
03261 
03262 #ifdef PNG_MNG_FEATURES_SUPPORTED
03263 PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,
03264    png_bytep row));
03265 PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
03266    png_bytep row));
03267 #endif
03268 
03269 #if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
03270 /* png.c */ /* PRIVATE */
03271 PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr));
03272 #endif
03273 /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
03274 
03275 #endif /* PNG_INTERNAL */
03276 
03277 #ifdef __cplusplus
03278 }
03279 #endif
03280 
03281 #endif /* PNG_VERSION_INFO_ONLY */
03282 /* do not put anything past this line */
03283 #endif /* PNG_H */