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