src/3rdparty/libpng/png.h

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