Navit SVN

/work/compile/navit/src/navit/support/libpng/png.h

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