OSDN Git Service

first
[psychlops/cpp.git] / psychlops / extension / FileFormat / PNG / png.h
1 \r
2 /* png.h - header file for PNG reference library\r
3  *\r
4  * libpng version 1.2.12 - June 27, 2006\r
5  * Copyright (c) 1998-2006 Glenn Randers-Pehrson\r
6  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)\r
7  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)\r
8  *\r
9  * Authors and maintainers:\r
10  *  libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat\r
11  *  libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger\r
12  *  libpng versions 0.97, January 1998, through 1.2.12 - June 27, 2006: Glenn\r
13  *  See also "Contributing Authors", below.\r
14  *\r
15  * Note about libpng version numbers:\r
16  *\r
17  *    Due to various miscommunications, unforeseen code incompatibilities\r
18  *    and occasional factors outside the authors' control, version numbering\r
19  *    on the library has not always been consistent and straightforward.\r
20  *    The following table summarizes matters since version 0.89c, which was\r
21  *    the first widely used release:\r
22  *\r
23  *    source                 png.h  png.h  shared-lib\r
24  *    version                string   int  version\r
25  *    -------                ------ -----  ----------\r
26  *    0.89c "1.0 beta 3"     0.89      89  1.0.89\r
27  *    0.90  "1.0 beta 4"     0.90      90  0.90  [should have been 2.0.90]\r
28  *    0.95  "1.0 beta 5"     0.95      95  0.95  [should have been 2.0.95]\r
29  *    0.96  "1.0 beta 6"     0.96      96  0.96  [should have been 2.0.96]\r
30  *    0.97b "1.00.97 beta 7" 1.00.97   97  1.0.1 [should have been 2.0.97]\r
31  *    0.97c                  0.97      97  2.0.97\r
32  *    0.98                   0.98      98  2.0.98\r
33  *    0.99                   0.99      98  2.0.99\r
34  *    0.99a-m                0.99      99  2.0.99\r
35  *    1.00                   1.00     100  2.1.0 [100 should be 10000]\r
36  *    1.0.0      (from here on, the   100  2.1.0 [100 should be 10000]\r
37  *    1.0.1       png.h string is   10001  2.1.0\r
38  *    1.0.1a-e    identical to the  10002  from here on, the shared library\r
39  *    1.0.2       source version)   10002  is 2.V where V is the source code\r
40  *    1.0.2a-b                      10003  version, except as noted.\r
41  *    1.0.3                         10003\r
42  *    1.0.3a-d                      10004\r
43  *    1.0.4                         10004\r
44  *    1.0.4a-f                      10005\r
45  *    1.0.5 (+ 2 patches)           10005\r
46  *    1.0.5a-d                      10006\r
47  *    1.0.5e-r                      10100 (not source compatible)\r
48  *    1.0.5s-v                      10006 (not binary compatible)\r
49  *    1.0.6 (+ 3 patches)           10006 (still binary incompatible)\r
50  *    1.0.6d-f                      10007 (still binary incompatible)\r
51  *    1.0.6g                        10007\r
52  *    1.0.6h                        10007  10.6h (testing xy.z so-numbering)\r
53  *    1.0.6i                        10007  10.6i\r
54  *    1.0.6j                        10007  2.1.0.6j (incompatible with 1.0.0)\r
55  *    1.0.7beta11-14        DLLNUM  10007  2.1.0.7beta11-14 (binary compatible)\r
56  *    1.0.7beta15-18           1    10007  2.1.0.7beta15-18 (binary compatible)\r
57  *    1.0.7rc1-2               1    10007  2.1.0.7rc1-2 (binary compatible)\r
58  *    1.0.7                    1    10007  (still compatible)\r
59  *    1.0.8beta1-4             1    10008  2.1.0.8beta1-4\r
60  *    1.0.8rc1                 1    10008  2.1.0.8rc1\r
61  *    1.0.8                    1    10008  2.1.0.8\r
62  *    1.0.9beta1-6             1    10009  2.1.0.9beta1-6\r
63  *    1.0.9rc1                 1    10009  2.1.0.9rc1\r
64  *    1.0.9beta7-10            1    10009  2.1.0.9beta7-10\r
65  *    1.0.9rc2                 1    10009  2.1.0.9rc2\r
66  *    1.0.9                    1    10009  2.1.0.9\r
67  *    1.0.10beta1              1    10010  2.1.0.10beta1\r
68  *    1.0.10rc1                1    10010  2.1.0.10rc1\r
69  *    1.0.10                   1    10010  2.1.0.10\r
70  *    1.0.11beta1-3            1    10011  2.1.0.11beta1-3\r
71  *    1.0.11rc1                1    10011  2.1.0.11rc1\r
72  *    1.0.11                   1    10011  2.1.0.11\r
73  *    1.0.12beta1-2            2    10012  2.1.0.12beta1-2\r
74  *    1.0.12rc1                2    10012  2.1.0.12rc1\r
75  *    1.0.12                   2    10012  2.1.0.12\r
76  *    1.1.0a-f                 -    10100  2.1.1.0a-f (branch abandoned)\r
77  *    1.2.0beta1-2             2    10200  2.1.2.0beta1-2\r
78  *    1.2.0beta3-5             3    10200  3.1.2.0beta3-5\r
79  *    1.2.0rc1                 3    10200  3.1.2.0rc1\r
80  *    1.2.0                    3    10200  3.1.2.0\r
81  *    1.2.1beta1-4             3    10201  3.1.2.1beta1-4\r
82  *    1.2.1rc1-2               3    10201  3.1.2.1rc1-2\r
83  *    1.2.1                    3    10201  3.1.2.1\r
84  *    1.2.2beta1-6            12    10202  12.so.0.1.2.2beta1-6\r
85  *    1.0.13beta1             10    10013  10.so.0.1.0.13beta1\r
86  *    1.0.13rc1               10    10013  10.so.0.1.0.13rc1\r
87  *    1.2.2rc1                12    10202  12.so.0.1.2.2rc1\r
88  *    1.0.13                  10    10013  10.so.0.1.0.13\r
89  *    1.2.2                   12    10202  12.so.0.1.2.2\r
90  *    1.2.3rc1-6              12    10203  12.so.0.1.2.3rc1-6\r
91  *    1.2.3                   12    10203  12.so.0.1.2.3\r
92  *    1.2.4beta1-3            13    10204  12.so.0.1.2.4beta1-3\r
93  *    1.0.14rc1               13    10014  10.so.0.1.0.14rc1\r
94  *    1.2.4rc1                13    10204  12.so.0.1.2.4rc1\r
95  *    1.0.14                  10    10014  10.so.0.1.0.14\r
96  *    1.2.4                   13    10204  12.so.0.1.2.4\r
97  *    1.2.5beta1-2            13    10205  12.so.0.1.2.5beta1-2\r
98  *    1.0.15rc1-3             10    10015  10.so.0.1.0.15rc1-3\r
99  *    1.2.5rc1-3              13    10205  12.so.0.1.2.5rc1-3\r
100  *    1.0.15                  10    10015  10.so.0.1.0.15\r
101  *    1.2.5                   13    10205  12.so.0.1.2.5\r
102  *    1.2.6beta1-4            13    10206  12.so.0.1.2.6beta1-4\r
103  *    1.0.16                  10    10016  10.so.0.1.0.16\r
104  *    1.2.6                   13    10206  12.so.0.1.2.6\r
105  *    1.2.7beta1-2            13    10207  12.so.0.1.2.7beta1-2\r
106  *    1.0.17rc1               10    10017  10.so.0.1.0.17rc1\r
107  *    1.2.7rc1                13    10207  12.so.0.1.2.7rc1\r
108  *    1.0.17                  10    10017  10.so.0.1.0.17\r
109  *    1.2.7                   13    10207  12.so.0.1.2.7\r
110  *    1.2.8beta1-5            13    10208  12.so.0.1.2.8beta1-5\r
111  *    1.0.18rc1-5             10    10018  10.so.0.1.0.18rc1-5\r
112  *    1.2.8rc1-5              13    10208  12.so.0.1.2.8rc1-5\r
113  *    1.0.18                  10    10018  10.so.0.1.0.18\r
114  *    1.2.8                   13    10208  12.so.0.1.2.8\r
115  *    1.2.9beta1-3            13    10209  12.so.0.1.2.9beta1-3\r
116  *    1.2.9beta4-11           13    10209  12.so.0.9[.0]\r
117  *    1.2.9rc1                13    10209  12.so.0.9[.0]\r
118  *    1.2.9                   13    10209  12.so.0.9[.0]\r
119  *    1.2.10beta1-8           13    10210  12.so.0.10[.0]\r
120  *    1.2.10rc1-3             13    10210  12.so.0.10[.0]\r
121  *    1.2.10                  13    10210  12.so.0.10[.0]\r
122  *    1.2.11beta1-4           13    10211  12.so.0.11[.0]\r
123  *    1.0.19rc1-5             10    10019  10.so.0.19[.0]\r
124  *    1.2.11rc1-5             13    10211  12.so.0.11[.0]\r
125  *    1.0.19                  10    10019  10.so.0.19[.0]\r
126  *    1.2.11                  13    10211  12.so.0.11[.0]\r
127  *    1.0.20                  10    10020  10.so.0.20[.0]\r
128  *    1.2.12                  13    10212  12.so.0.12[.0]\r
129  *\r
130  *    Henceforth the source version will match the shared-library major\r
131  *    and minor numbers; the shared-library major version number will be\r
132  *    used for changes in backward compatibility, as it is intended.  The\r
133  *    PNG_LIBPNG_VER macro, which is not used within libpng but is available\r
134  *    for applications, is an unsigned integer of the form xyyzz corresponding\r
135  *    to the source version x.y.z (leading zeros in y and z).  Beta versions\r
136  *    were given the previous public release number plus a letter, until\r
137  *    version 1.0.6j; from then on they were given the upcoming public\r
138  *    release number plus "betaNN" or "rcN".\r
139  *\r
140  *    Binary incompatibility exists only when applications make direct access\r
141  *    to the info_ptr or png_ptr members through png.h, and the compiled\r
142  *    application is loaded with a different version of the library.\r
143  *\r
144  *    DLLNUM will change each time there are forward or backward changes\r
145  *    in binary compatibility (e.g., when a new feature is added).\r
146  *\r
147  * See libpng.txt or libpng.3 for more information.  The PNG specification\r
148  * is available as a W3C Recommendation and as an ISO Specification,\r
149  * <http://www.w3.org/TR/2003/REC-PNG-20031110/\r
150  */\r
151 \r
152 /*\r
153  * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:\r
154  *\r
155  * If you modify libpng you may insert additional notices immediately following\r
156  * this sentence.\r
157  *\r
158  * libpng versions 1.2.6, August 15, 2004, through 1.2.12, June 27, 2006, are\r
159  * Copyright (c) 2004, 2006 Glenn Randers-Pehrson, and are\r
160  * distributed according to the same disclaimer and license as libpng-1.2.5\r
161  * with the following individual added to the list of Contributing Authors:\r
162  *\r
163  *    Cosmin Truta\r
164  *\r
165  * libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are\r
166  * Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are\r
167  * distributed according to the same disclaimer and license as libpng-1.0.6\r
168  * with the following individuals added to the list of Contributing Authors:\r
169  *\r
170  *    Simon-Pierre Cadieux\r
171  *    Eric S. Raymond\r
172  *    Gilles Vollant\r
173  *\r
174  * and with the following additions to the disclaimer:\r
175  *\r
176  *    There is no warranty against interference with your enjoyment of the\r
177  *    library or against infringement.  There is no warranty that our\r
178  *    efforts or the library will fulfill any of your particular purposes\r
179  *    or needs.  This library is provided with all faults, and the entire\r
180  *    risk of satisfactory quality, performance, accuracy, and effort is with\r
181  *    the user.\r
182  *\r
183  * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are\r
184  * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson, and are\r
185  * distributed according to the same disclaimer and license as libpng-0.96,\r
186  * with the following individuals added to the list of Contributing Authors:\r
187  *\r
188  *    Tom Lane\r
189  *    Glenn Randers-Pehrson\r
190  *    Willem van Schaik\r
191  *\r
192  * libpng versions 0.89, June 1996, through 0.96, May 1997, are\r
193  * Copyright (c) 1996, 1997 Andreas Dilger\r
194  * Distributed according to the same disclaimer and license as libpng-0.88,\r
195  * with the following individuals added to the list of Contributing Authors:\r
196  *\r
197  *    John Bowler\r
198  *    Kevin Bracey\r
199  *    Sam Bushell\r
200  *    Magnus Holmgren\r
201  *    Greg Roelofs\r
202  *    Tom Tanner\r
203  *\r
204  * libpng versions 0.5, May 1995, through 0.88, January 1996, are\r
205  * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.\r
206  *\r
207  * For the purposes of this copyright and license, "Contributing Authors"\r
208  * is defined as the following set of individuals:\r
209  *\r
210  *    Andreas Dilger\r
211  *    Dave Martindale\r
212  *    Guy Eric Schalnat\r
213  *    Paul Schmidt\r
214  *    Tim Wegner\r
215  *\r
216  * The PNG Reference Library is supplied "AS IS".  The Contributing Authors\r
217  * and Group 42, Inc. disclaim all warranties, expressed or implied,\r
218  * including, without limitation, the warranties of merchantability and of\r
219  * fitness for any purpose.  The Contributing Authors and Group 42, Inc.\r
220  * assume no liability for direct, indirect, incidental, special, exemplary,\r
221  * or consequential damages, which may result from the use of the PNG\r
222  * Reference Library, even if advised of the possibility of such damage.\r
223  *\r
224  * Permission is hereby granted to use, copy, modify, and distribute this\r
225  * source code, or portions hereof, for any purpose, without fee, subject\r
226  * to the following restrictions:\r
227  *\r
228  * 1. The origin of this source code must not be misrepresented.\r
229  *\r
230  * 2. Altered versions must be plainly marked as such and\r
231  * must not be misrepresented as being the original source.\r
232  *\r
233  * 3. This Copyright notice may not be removed or altered from\r
234  *    any source or altered source distribution.\r
235  *\r
236  * The Contributing Authors and Group 42, Inc. specifically permit, without\r
237  * fee, and encourage the use of this source code as a component to\r
238  * supporting the PNG file format in commercial products.  If you use this\r
239  * source code in a product, acknowledgment is not required but would be\r
240  * appreciated.\r
241  */\r
242 \r
243 /*\r
244  * A "png_get_copyright" function is available, for convenient use in "about"\r
245  * boxes and the like:\r
246  *\r
247  * printf("%s",png_get_copyright(NULL));\r
248  *\r
249  * Also, the PNG logo (in PNG format, of course) is supplied in the\r
250  * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).\r
251  */\r
252 \r
253 /*\r
254  * Libpng is OSI Certified Open Source Software.  OSI Certified is a\r
255  * certification mark of the Open Source Initiative.\r
256  */\r
257 \r
258 /*\r
259  * The contributing authors would like to thank all those who helped\r
260  * with testing, bug fixes, and patience.  This wouldn't have been\r
261  * possible without all of you.\r
262  *\r
263  * Thanks to Frank J. T. Wojcik for helping with the documentation.\r
264  */\r
265 \r
266 /*\r
267  * Y2K compliance in libpng:\r
268  * =========================\r
269  *\r
270  *    June 27, 2006\r
271  *\r
272  *    Since the PNG Development group is an ad-hoc body, we can't make\r
273  *    an official declaration.\r
274  *\r
275  *    This is your unofficial assurance that libpng from version 0.71 and\r
276  *    upward through 1.2.12 are Y2K compliant.  It is my belief that earlier\r
277  *    versions were also Y2K compliant.\r
278  *\r
279  *    Libpng only has three year fields.  One is a 2-byte unsigned integer\r
280  *    that will hold years up to 65535.  The other two hold the date in text\r
281  *    format, and will hold years up to 9999.\r
282  *\r
283  *    The integer is\r
284  *        "png_uint_16 year" in png_time_struct.\r
285  *\r
286  *    The strings are\r
287  *        "png_charp time_buffer" in png_struct and\r
288  *        "near_time_buffer", which is a local character string in png.c.\r
289  *\r
290  *    There are seven time-related functions:\r
291  *        png.c: png_convert_to_rfc_1123() in png.c\r
292  *          (formerly png_convert_to_rfc_1152() in error)\r
293  *        png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c\r
294  *        png_convert_from_time_t() in pngwrite.c\r
295  *        png_get_tIME() in pngget.c\r
296  *        png_handle_tIME() in pngrutil.c, called in pngread.c\r
297  *        png_set_tIME() in pngset.c\r
298  *        png_write_tIME() in pngwutil.c, called in pngwrite.c\r
299  *\r
300  *    All handle dates properly in a Y2K environment.  The\r
301  *    png_convert_from_time_t() function calls gmtime() to convert from system\r
302  *    clock time, which returns (year - 1900), which we properly convert to\r
303  *    the full 4-digit year.  There is a possibility that applications using\r
304  *    libpng are not passing 4-digit years into the png_convert_to_rfc_1123()\r
305  *    function, or that they are incorrectly passing only a 2-digit year\r
306  *    instead of "year - 1900" into the png_convert_from_struct_tm() function,\r
307  *    but this is not under our control.  The libpng documentation has always\r
308  *    stated that it works with 4-digit years, and the APIs have been\r
309  *    documented as such.\r
310  *\r
311  *    The tIME chunk itself is also Y2K compliant.  It uses a 2-byte unsigned\r
312  *    integer to hold the year, and can hold years as large as 65535.\r
313  *\r
314  *    zlib, upon which libpng depends, is also Y2K compliant.  It contains\r
315  *    no date-related code.\r
316  *\r
317  *       Glenn Randers-Pehrson\r
318  *       libpng maintainer\r
319  *       PNG Development Group\r
320  */\r
321 \r
322 #ifndef PNG_H\r
323 #define PNG_H\r
324 \r
325 /* This is not the place to learn how to use libpng.  The file libpng.txt\r
326  * describes how to use libpng, and the file example.c summarizes it\r
327  * with some code on which to build.  This file is useful for looking\r
328  * at the actual function definitions and structure components.\r
329  */\r
330 \r
331 /* Version information for png.h - this should match the version in png.c */\r
332 #define PNG_LIBPNG_VER_STRING "1.2.12"\r
333 #define PNG_HEADER_VERSION_STRING \\r
334    " libpng version 1.2.12 - June 27, 2006 (header)\n"\r
335 \r
336 #define PNG_LIBPNG_VER_SONUM   0\r
337 #define PNG_LIBPNG_VER_DLLNUM  13\r
338 \r
339 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */\r
340 #define PNG_LIBPNG_VER_MAJOR   1\r
341 #define PNG_LIBPNG_VER_MINOR   2\r
342 #define PNG_LIBPNG_VER_RELEASE 12\r
343 /* This should match the numeric part of the final component of\r
344  * PNG_LIBPNG_VER_STRING, omitting any leading zero: */\r
345 \r
346 #define PNG_LIBPNG_VER_BUILD  0\r
347 \r
348 /* Release Status */\r
349 #define PNG_LIBPNG_BUILD_ALPHA    1\r
350 #define PNG_LIBPNG_BUILD_BETA     2\r
351 #define PNG_LIBPNG_BUILD_RC       3\r
352 #define PNG_LIBPNG_BUILD_STABLE   4\r
353 #define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7\r
354   \r
355 /* Release-Specific Flags */\r
356 #define PNG_LIBPNG_BUILD_PATCH    8 /* Can be OR'ed with\r
357                                        PNG_LIBPNG_BUILD_STABLE only */\r
358 #define PNG_LIBPNG_BUILD_PRIVATE 16 /* Cannot be OR'ed with\r
359                                        PNG_LIBPNG_BUILD_SPECIAL */\r
360 #define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with\r
361                                        PNG_LIBPNG_BUILD_PRIVATE */\r
362 \r
363 #define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE\r
364 \r
365 /* Careful here.  At one time, Guy wanted to use 082, but that would be octal.\r
366  * We must not include leading zeros.\r
367  * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only\r
368  * version 1.0.0 was mis-numbered 100 instead of 10000).  From\r
369  * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release */\r
370 #define PNG_LIBPNG_VER 10212 /* 1.2.12 */\r
371 \r
372 #ifndef PNG_VERSION_INFO_ONLY\r
373 /* include the compression library's header */\r
374 #include "zlib.h"\r
375 #endif\r
376 \r
377 /* include all user configurable info, including optional assembler routines */\r
378 #include "pngconf.h"\r
379 \r
380 /*\r
381  * Added at libpng-1.2.8 */\r
382 /* Ref MSDN: Private as priority over Special\r
383  * VS_FF_PRIVATEBUILD File *was not* built using standard release\r
384  * procedures. If this value is given, the StringFileInfo block must\r
385  * contain a PrivateBuild string. \r
386  *\r
387  * VS_FF_SPECIALBUILD File *was* built by the original company using\r
388  * standard release procedures but is a variation of the standard\r
389  * file of the same version number. If this value is given, the\r
390  * StringFileInfo block must contain a SpecialBuild string. \r
391  */\r
392 \r
393 #if defined(PNG_USER_PRIVATEBUILD)\r
394 #  define PNG_LIBPNG_BUILD_TYPE \\r
395           (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE)\r
396 #else\r
397 #  if defined(PNG_LIBPNG_SPECIALBUILD)\r
398 #    define PNG_LIBPNG_BUILD_TYPE \\r
399             (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL)\r
400 #  else\r
401 #    define PNG_LIBPNG_BUILD_TYPE (PNG_LIBPNG_BUILD_BASE_TYPE)\r
402 #  endif\r
403 #endif\r
404 \r
405 #ifndef PNG_VERSION_INFO_ONLY\r
406 \r
407 /* Inhibit C++ name-mangling for libpng functions but not for system calls. */\r
408 #ifdef __cplusplus\r
409 extern "C" {\r
410 #endif /* __cplusplus */\r
411 \r
412 /* This file is arranged in several sections.  The first section contains\r
413  * structure and type definitions.  The second section contains the external\r
414  * library functions, while the third has the internal library functions,\r
415  * which applications aren't expected to use directly.\r
416  */\r
417 \r
418 #ifndef PNG_NO_TYPECAST_NULL\r
419 #define int_p_NULL                (int *)NULL\r
420 #define png_bytep_NULL            (png_bytep)NULL\r
421 #define png_bytepp_NULL           (png_bytepp)NULL\r
422 #define png_doublep_NULL          (png_doublep)NULL\r
423 #define png_error_ptr_NULL        (png_error_ptr)NULL\r
424 #define png_flush_ptr_NULL        (png_flush_ptr)NULL\r
425 #define png_free_ptr_NULL         (png_free_ptr)NULL\r
426 #define png_infopp_NULL           (png_infopp)NULL\r
427 #define png_malloc_ptr_NULL       (png_malloc_ptr)NULL\r
428 #define png_read_status_ptr_NULL  (png_read_status_ptr)NULL\r
429 #define png_rw_ptr_NULL           (png_rw_ptr)NULL\r
430 #define png_structp_NULL          (png_structp)NULL\r
431 #define png_uint_16p_NULL         (png_uint_16p)NULL\r
432 #define png_voidp_NULL            (png_voidp)NULL\r
433 #define png_write_status_ptr_NULL (png_write_status_ptr)NULL\r
434 #else\r
435 #define int_p_NULL                NULL\r
436 #define png_bytep_NULL            NULL\r
437 #define png_bytepp_NULL           NULL\r
438 #define png_doublep_NULL          NULL\r
439 #define png_error_ptr_NULL        NULL\r
440 #define png_flush_ptr_NULL        NULL\r
441 #define png_free_ptr_NULL         NULL\r
442 #define png_infopp_NULL           NULL\r
443 #define png_malloc_ptr_NULL       NULL\r
444 #define png_read_status_ptr_NULL  NULL\r
445 #define png_rw_ptr_NULL           NULL\r
446 #define png_structp_NULL          NULL\r
447 #define png_uint_16p_NULL         NULL\r
448 #define png_voidp_NULL            NULL\r
449 #define png_write_status_ptr_NULL NULL\r
450 #endif\r
451 \r
452 /* variables declared in png.c - only it needs to define PNG_NO_EXTERN */\r
453 #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)\r
454 /* Version information for C files, stored in png.c.  This had better match\r
455  * the version above.\r
456  */\r
457 #ifdef PNG_USE_GLOBAL_ARRAYS\r
458 PNG_EXPORT_VAR (const char) png_libpng_ver[18];\r
459   /* need room for 99.99.99beta99z */\r
460 #else\r
461 #define png_libpng_ver png_get_header_ver(NULL)\r
462 #endif\r
463 \r
464 #ifdef PNG_USE_GLOBAL_ARRAYS\r
465 /* This was removed in version 1.0.5c */\r
466 /* Structures to facilitate easy interlacing.  See png.c for more details */\r
467 PNG_EXPORT_VAR (const int FARDATA) png_pass_start[7];\r
468 PNG_EXPORT_VAR (const int FARDATA) png_pass_inc[7];\r
469 PNG_EXPORT_VAR (const int FARDATA) png_pass_ystart[7];\r
470 PNG_EXPORT_VAR (const int FARDATA) png_pass_yinc[7];\r
471 PNG_EXPORT_VAR (const int FARDATA) png_pass_mask[7];\r
472 PNG_EXPORT_VAR (const int FARDATA) png_pass_dsp_mask[7];\r
473 #ifdef PNG_USE_PNGGCCRD\r
474 PNG_EXPORT_VAR (const int FARDATA) png_pass_width[7];\r
475 #endif\r
476 /* This isn't currently used.  If you need it, see png.c for more details.\r
477 PNG_EXPORT_VAR (const int FARDATA) png_pass_height[7];\r
478 */\r
479 #endif\r
480 \r
481 #endif /* PNG_NO_EXTERN */\r
482 \r
483 /* Three color definitions.  The order of the red, green, and blue, (and the\r
484  * exact size) is not important, although the size of the fields need to\r
485  * be png_byte or png_uint_16 (as defined below).\r
486  */\r
487 typedef struct png_color_struct\r
488 {\r
489    png_byte red;\r
490    png_byte green;\r
491    png_byte blue;\r
492 } png_color;\r
493 typedef png_color FAR * png_colorp;\r
494 typedef png_color FAR * FAR * png_colorpp;\r
495 \r
496 typedef struct png_color_16_struct\r
497 {\r
498    png_byte index;    /* used for palette files */\r
499    png_uint_16 red;   /* for use in red green blue files */\r
500    png_uint_16 green;\r
501    png_uint_16 blue;\r
502    png_uint_16 gray;  /* for use in grayscale files */\r
503 } png_color_16;\r
504 typedef png_color_16 FAR * png_color_16p;\r
505 typedef png_color_16 FAR * FAR * png_color_16pp;\r
506 \r
507 typedef struct png_color_8_struct\r
508 {\r
509    png_byte red;   /* for use in red green blue files */\r
510    png_byte green;\r
511    png_byte blue;\r
512    png_byte gray;  /* for use in grayscale files */\r
513    png_byte alpha; /* for alpha channel files */\r
514 } png_color_8;\r
515 typedef png_color_8 FAR * png_color_8p;\r
516 typedef png_color_8 FAR * FAR * png_color_8pp;\r
517 \r
518 /*\r
519  * The following two structures are used for the in-core representation\r
520  * of sPLT chunks.\r
521  */\r
522 typedef struct png_sPLT_entry_struct\r
523 {\r
524    png_uint_16 red;\r
525    png_uint_16 green;\r
526    png_uint_16 blue;\r
527    png_uint_16 alpha;\r
528    png_uint_16 frequency;\r
529 } png_sPLT_entry;\r
530 typedef png_sPLT_entry FAR * png_sPLT_entryp;\r
531 typedef png_sPLT_entry FAR * FAR * png_sPLT_entrypp;\r
532 \r
533 /*  When the depth of the sPLT palette is 8 bits, the color and alpha samples\r
534  *  occupy the LSB of their respective members, and the MSB of each member\r
535  *  is zero-filled.  The frequency member always occupies the full 16 bits.\r
536  */\r
537 \r
538 typedef struct png_sPLT_struct\r
539 {\r
540    png_charp name;           /* palette name */\r
541    png_byte depth;           /* depth of palette samples */\r
542    png_sPLT_entryp entries;  /* palette entries */\r
543    png_int_32 nentries;      /* number of palette entries */\r
544 } png_sPLT_t;\r
545 typedef png_sPLT_t FAR * png_sPLT_tp;\r
546 typedef png_sPLT_t FAR * FAR * png_sPLT_tpp;\r
547 \r
548 #ifdef PNG_TEXT_SUPPORTED\r
549 /* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file,\r
550  * and whether that contents is compressed or not.  The "key" field\r
551  * points to a regular zero-terminated C string.  The "text", "lang", and\r
552  * "lang_key" fields can be regular C strings, empty strings, or NULL pointers.\r
553  * However, the * structure returned by png_get_text() will always contain\r
554  * regular zero-terminated C strings (possibly empty), never NULL pointers,\r
555  * so they can be safely used in printf() and other string-handling functions.\r
556  */\r
557 typedef struct png_text_struct\r
558 {\r
559    int  compression;       /* compression value:\r
560                              -1: tEXt, none\r
561                               0: zTXt, deflate\r
562                               1: iTXt, none\r
563                               2: iTXt, deflate  */\r
564    png_charp key;          /* keyword, 1-79 character description of "text" */\r
565    png_charp text;         /* comment, may be an empty string (ie "")\r
566                               or a NULL pointer */\r
567    png_size_t text_length; /* length of the text string */\r
568 #ifdef PNG_iTXt_SUPPORTED\r
569    png_size_t itxt_length; /* length of the itxt string */\r
570    png_charp lang;         /* language code, 0-79 characters\r
571                               or a NULL pointer */\r
572    png_charp lang_key;     /* keyword translated UTF-8 string, 0 or more\r
573                               chars or a NULL pointer */\r
574 #endif\r
575 } png_text;\r
576 typedef png_text FAR * png_textp;\r
577 typedef png_text FAR * FAR * png_textpp;\r
578 #endif\r
579 \r
580 /* Supported compression types for text in PNG files (tEXt, and zTXt).\r
581  * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */\r
582 #define PNG_TEXT_COMPRESSION_NONE_WR -3\r
583 #define PNG_TEXT_COMPRESSION_zTXt_WR -2\r
584 #define PNG_TEXT_COMPRESSION_NONE    -1\r
585 #define PNG_TEXT_COMPRESSION_zTXt     0\r
586 #define PNG_ITXT_COMPRESSION_NONE     1\r
587 #define PNG_ITXT_COMPRESSION_zTXt     2\r
588 #define PNG_TEXT_COMPRESSION_LAST     3  /* Not a valid value */\r
589 \r
590 /* png_time is a way to hold the time in an machine independent way.\r
591  * Two conversions are provided, both from time_t and struct tm.  There\r
592  * is no portable way to convert to either of these structures, as far\r
593  * as I know.  If you know of a portable way, send it to me.  As a side\r
594  * note - PNG has always been Year 2000 compliant!\r
595  */\r
596 typedef struct png_time_struct\r
597 {\r
598    png_uint_16 year; /* full year, as in, 1995 */\r
599    png_byte month;   /* month of year, 1 - 12 */\r
600    png_byte day;     /* day of month, 1 - 31 */\r
601    png_byte hour;    /* hour of day, 0 - 23 */\r
602    png_byte minute;  /* minute of hour, 0 - 59 */\r
603    png_byte second;  /* second of minute, 0 - 60 (for leap seconds) */\r
604 } png_time;\r
605 typedef png_time FAR * png_timep;\r
606 typedef png_time FAR * FAR * png_timepp;\r
607 \r
608 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)\r
609 /* png_unknown_chunk is a structure to hold queued chunks for which there is\r
610  * no specific support.  The idea is that we can use this to queue\r
611  * up private chunks for output even though the library doesn't actually\r
612  * know about their semantics.\r
613  */\r
614 typedef struct png_unknown_chunk_t\r
615 {\r
616     png_byte name[5];\r
617     png_byte *data;\r
618     png_size_t size;\r
619 \r
620     /* libpng-using applications should NOT directly modify this byte. */\r
621     png_byte location; /* mode of operation at read time */\r
622 }\r
623 png_unknown_chunk;\r
624 typedef png_unknown_chunk FAR * png_unknown_chunkp;\r
625 typedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp;\r
626 #endif\r
627 \r
628 /* png_info is a structure that holds the information in a PNG file so\r
629  * that the application can find out the characteristics of the image.\r
630  * If you are reading the file, this structure will tell you what is\r
631  * in the PNG file.  If you are writing the file, fill in the information\r
632  * you want to put into the PNG file, then call png_write_info().\r
633  * The names chosen should be very close to the PNG specification, so\r
634  * consult that document for information about the meaning of each field.\r
635  *\r
636  * With libpng < 0.95, it was only possible to directly set and read the\r
637  * the values in the png_info_struct, which meant that the contents and\r
638  * order of the values had to remain fixed.  With libpng 0.95 and later,\r
639  * however, there are now functions that abstract the contents of\r
640  * png_info_struct from the application, so this makes it easier to use\r
641  * libpng with dynamic libraries, and even makes it possible to use\r
642  * libraries that don't have all of the libpng ancillary chunk-handing\r
643  * functionality.\r
644  *\r
645  * In any case, the order of the parameters in png_info_struct should NOT\r
646  * be changed for as long as possible to keep compatibility with applications\r
647  * that use the old direct-access method with png_info_struct.\r
648  *\r
649  * The following members may have allocated storage attached that should be\r
650  * cleaned up before the structure is discarded: palette, trans, text,\r
651  * pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,\r
652  * splt_palettes, scal_unit, row_pointers, and unknowns.   By default, these\r
653  * are automatically freed when the info structure is deallocated, if they were\r
654  * allocated internally by libpng.  This behavior can be changed by means\r
655  * of the png_data_freer() function.\r
656  *\r
657  * More allocation details: all the chunk-reading functions that\r
658  * change these members go through the corresponding png_set_*\r
659  * functions.  A function to clear these members is available: see\r
660  * png_free_data().  The png_set_* functions do not depend on being\r
661  * able to point info structure members to any of the storage they are\r
662  * passed (they make their own copies), EXCEPT that the png_set_text\r
663  * functions use the same storage passed to them in the text_ptr or\r
664  * itxt_ptr structure argument, and the png_set_rows and png_set_unknowns\r
665  * functions do not make their own copies.\r
666  */\r
667 typedef struct png_info_struct\r
668 {\r
669    /* the following are necessary for every PNG file */\r
670    png_uint_32 width;       /* width of image in pixels (from IHDR) */\r
671    png_uint_32 height;      /* height of image in pixels (from IHDR) */\r
672    png_uint_32 valid;       /* valid chunk data (see PNG_INFO_ below) */\r
673    png_uint_32 rowbytes;    /* bytes needed to hold an untransformed row */\r
674    png_colorp palette;      /* array of color values (valid & PNG_INFO_PLTE) */\r
675    png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */\r
676    png_uint_16 num_trans;   /* number of transparent palette color (tRNS) */\r
677    png_byte bit_depth;      /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */\r
678    png_byte color_type;     /* see PNG_COLOR_TYPE_ below (from IHDR) */\r
679    /* The following three should have been named *_method not *_type */\r
680    png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */\r
681    png_byte filter_type;    /* must be PNG_FILTER_TYPE_BASE (from IHDR) */\r
682    png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */\r
683 \r
684    /* The following is informational only on read, and not used on writes. */\r
685    png_byte channels;       /* number of data channels per pixel (1, 2, 3, 4) */\r
686    png_byte pixel_depth;    /* number of bits per pixel */\r
687    png_byte spare_byte;     /* to align the data, and for future use */\r
688    png_byte signature[8];   /* magic bytes read by libpng from start of file */\r
689 \r
690    /* The rest of the data is optional.  If you are reading, check the\r
691     * valid field to see if the information in these are valid.  If you\r
692     * are writing, set the valid field to those chunks you want written,\r
693     * and initialize the appropriate fields below.\r
694     */\r
695 \r
696 #if defined(PNG_gAMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)\r
697    /* The gAMA chunk describes the gamma characteristics of the system\r
698     * on which the image was created, normally in the range [1.0, 2.5].\r
699     * Data is valid if (valid & PNG_INFO_gAMA) is non-zero.\r
700     */\r
701    float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */\r
702 #endif\r
703 \r
704 #if defined(PNG_sRGB_SUPPORTED)\r
705     /* GR-P, 0.96a */\r
706     /* Data valid if (valid & PNG_INFO_sRGB) non-zero. */\r
707    png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */\r
708 #endif\r
709 \r
710 #if defined(PNG_TEXT_SUPPORTED)\r
711    /* The tEXt, and zTXt chunks contain human-readable textual data in\r
712     * uncompressed, compressed, and optionally compressed forms, respectively.\r
713     * The data in "text" is an array of pointers to uncompressed,\r
714     * null-terminated C strings. Each chunk has a keyword that describes the\r
715     * textual data contained in that chunk.  Keywords are not required to be\r
716     * unique, and the text string may be empty.  Any number of text chunks may\r
717     * be in an image.\r
718     */\r
719    int num_text; /* number of comments read/to write */\r
720    int max_text; /* current size of text array */\r
721    png_textp text; /* array of comments read/to write */\r
722 #endif /* PNG_TEXT_SUPPORTED */\r
723 \r
724 #if defined(PNG_tIME_SUPPORTED)\r
725    /* The tIME chunk holds the last time the displayed image data was\r
726     * modified.  See the png_time struct for the contents of this struct.\r
727     */\r
728    png_time mod_time;\r
729 #endif\r
730 \r
731 #if defined(PNG_sBIT_SUPPORTED)\r
732    /* The sBIT chunk specifies the number of significant high-order bits\r
733     * in the pixel data.  Values are in the range [1, bit_depth], and are\r
734     * only specified for the channels in the pixel data.  The contents of\r
735     * the low-order bits is not specified.  Data is valid if\r
736     * (valid & PNG_INFO_sBIT) is non-zero.\r
737     */\r
738    png_color_8 sig_bit; /* significant bits in color channels */\r
739 #endif\r
740 \r
741 #if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \\r
742 defined(PNG_READ_BACKGROUND_SUPPORTED)\r
743    /* The tRNS chunk supplies transparency data for paletted images and\r
744     * other image types that don't need a full alpha channel.  There are\r
745     * "num_trans" transparency values for a paletted image, stored in the\r
746     * same order as the palette colors, starting from index 0.  Values\r
747     * for the data are in the range [0, 255], ranging from fully transparent\r
748     * to fully opaque, respectively.  For non-paletted images, there is a\r
749     * single color specified that should be treated as fully transparent.\r
750     * Data is valid if (valid & PNG_INFO_tRNS) is non-zero.\r
751     */\r
752    png_bytep trans; /* transparent values for paletted image */\r
753    png_color_16 trans_values; /* transparent color for non-palette image */\r
754 #endif\r
755 \r
756 #if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)\r
757    /* The bKGD chunk gives the suggested image background color if the\r
758     * display program does not have its own background color and the image\r
759     * is needs to composited onto a background before display.  The colors\r
760     * in "background" are normally in the same color space/depth as the\r
761     * pixel data.  Data is valid if (valid & PNG_INFO_bKGD) is non-zero.\r
762     */\r
763    png_color_16 background;\r
764 #endif\r
765 \r
766 #if defined(PNG_oFFs_SUPPORTED)\r
767    /* The oFFs chunk gives the offset in "offset_unit_type" units rightwards\r
768     * and downwards from the top-left corner of the display, page, or other\r
769     * application-specific co-ordinate space.  See the PNG_OFFSET_ defines\r
770     * below for the unit types.  Valid if (valid & PNG_INFO_oFFs) non-zero.\r
771     */\r
772    png_int_32 x_offset; /* x offset on page */\r
773    png_int_32 y_offset; /* y offset on page */\r
774    png_byte offset_unit_type; /* offset units type */\r
775 #endif\r
776 \r
777 #if defined(PNG_pHYs_SUPPORTED)\r
778    /* The pHYs chunk gives the physical pixel density of the image for\r
779     * display or printing in "phys_unit_type" units (see PNG_RESOLUTION_\r
780     * defines below).  Data is valid if (valid & PNG_INFO_pHYs) is non-zero.\r
781     */\r
782    png_uint_32 x_pixels_per_unit; /* horizontal pixel density */\r
783    png_uint_32 y_pixels_per_unit; /* vertical pixel density */\r
784    png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */\r
785 #endif\r
786 \r
787 #if defined(PNG_hIST_SUPPORTED)\r
788    /* The hIST chunk contains the relative frequency or importance of the\r
789     * various palette entries, so that a viewer can intelligently select a\r
790     * reduced-color palette, if required.  Data is an array of "num_palette"\r
791     * values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)\r
792     * is non-zero.\r
793     */\r
794    png_uint_16p hist;\r
795 #endif\r
796 \r
797 #ifdef PNG_cHRM_SUPPORTED\r
798    /* The cHRM chunk describes the CIE color characteristics of the monitor\r
799     * on which the PNG was created.  This data allows the viewer to do gamut\r
800     * mapping of the input image to ensure that the viewer sees the same\r
801     * colors in the image as the creator.  Values are in the range\r
802     * [0.0, 0.8].  Data valid if (valid & PNG_INFO_cHRM) non-zero.\r
803     */\r
804 #ifdef PNG_FLOATING_POINT_SUPPORTED\r
805    float x_white;\r
806    float y_white;\r
807    float x_red;\r
808    float y_red;\r
809    float x_green;\r
810    float y_green;\r
811    float x_blue;\r
812    float y_blue;\r
813 #endif\r
814 #endif\r
815 \r
816 #if defined(PNG_pCAL_SUPPORTED)\r
817    /* The pCAL chunk describes a transformation between the stored pixel\r
818     * values and original physical data values used to create the image.\r
819     * The integer range [0, 2^bit_depth - 1] maps to the floating-point\r
820     * range given by [pcal_X0, pcal_X1], and are further transformed by a\r
821     * (possibly non-linear) transformation function given by "pcal_type"\r
822     * and "pcal_params" into "pcal_units".  Please see the PNG_EQUATION_\r
823     * defines below, and the PNG-Group's PNG extensions document for a\r
824     * complete description of the transformations and how they should be\r
825     * implemented, and for a description of the ASCII parameter strings.\r
826     * Data values are valid if (valid & PNG_INFO_pCAL) non-zero.\r
827     */\r
828    png_charp pcal_purpose;  /* pCAL chunk description string */\r
829    png_int_32 pcal_X0;      /* minimum value */\r
830    png_int_32 pcal_X1;      /* maximum value */\r
831    png_charp pcal_units;    /* Latin-1 string giving physical units */\r
832    png_charpp pcal_params;  /* ASCII strings containing parameter values */\r
833    png_byte pcal_type;      /* equation type (see PNG_EQUATION_ below) */\r
834    png_byte pcal_nparams;   /* number of parameters given in pcal_params */\r
835 #endif\r
836 \r
837 /* New members added in libpng-1.0.6 */\r
838 #ifdef PNG_FREE_ME_SUPPORTED\r
839    png_uint_32 free_me;     /* flags items libpng is responsible for freeing */\r
840 #endif\r
841 \r
842 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)\r
843    /* storage for unknown chunks that the library doesn't recognize. */\r
844    png_unknown_chunkp unknown_chunks;\r
845    png_size_t unknown_chunks_num;\r
846 #endif\r
847 \r
848 #if defined(PNG_iCCP_SUPPORTED)\r
849    /* iCCP chunk data. */\r
850    png_charp iccp_name;     /* profile name */\r
851    png_charp iccp_profile;  /* International Color Consortium profile data */\r
852                             /* Note to maintainer: should be png_bytep */\r
853    png_uint_32 iccp_proflen;  /* ICC profile data length */\r
854    png_byte iccp_compression; /* Always zero */\r
855 #endif\r
856 \r
857 #if defined(PNG_sPLT_SUPPORTED)\r
858    /* data on sPLT chunks (there may be more than one). */\r
859    png_sPLT_tp splt_palettes;\r
860    png_uint_32 splt_palettes_num;\r
861 #endif\r
862 \r
863 #if defined(PNG_sCAL_SUPPORTED)\r
864    /* The sCAL chunk describes the actual physical dimensions of the\r
865     * subject matter of the graphic.  The chunk contains a unit specification\r
866     * a byte value, and two ASCII strings representing floating-point\r
867     * values.  The values are width and height corresponsing to one pixel\r
868     * in the image.  This external representation is converted to double\r
869     * here.  Data values are valid if (valid & PNG_INFO_sCAL) is non-zero.\r
870     */\r
871    png_byte scal_unit;         /* unit of physical scale */\r
872 #ifdef PNG_FLOATING_POINT_SUPPORTED\r
873    double scal_pixel_width;    /* width of one pixel */\r
874    double scal_pixel_height;   /* height of one pixel */\r
875 #endif\r
876 #ifdef PNG_FIXED_POINT_SUPPORTED\r
877    png_charp scal_s_width;     /* string containing height */\r
878    png_charp scal_s_height;    /* string containing width */\r
879 #endif\r
880 #endif\r
881 \r
882 #if defined(PNG_INFO_IMAGE_SUPPORTED)\r
883    /* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS) non-zero */\r
884    /* Data valid if (valid & PNG_INFO_IDAT) non-zero */\r
885    png_bytepp row_pointers;        /* the image bits */\r
886 #endif\r
887 \r
888 #if defined(PNG_FIXED_POINT_SUPPORTED) && defined(PNG_gAMA_SUPPORTED)\r
889    png_fixed_point int_gamma; /* gamma of image, if (valid & PNG_INFO_gAMA) */\r
890 #endif\r
891 \r
892 #if defined(PNG_cHRM_SUPPORTED) && defined(PNG_FIXED_POINT_SUPPORTED)\r
893    png_fixed_point int_x_white;\r
894    png_fixed_point int_y_white;\r
895    png_fixed_point int_x_red;\r
896    png_fixed_point int_y_red;\r
897    png_fixed_point int_x_green;\r
898    png_fixed_point int_y_green;\r
899    png_fixed_point int_x_blue;\r
900    png_fixed_point int_y_blue;\r
901 #endif\r
902 \r
903 } png_info;\r
904 \r
905 typedef png_info FAR * png_infop;\r
906 typedef png_info FAR * FAR * png_infopp;\r
907 \r
908 /* Maximum positive integer used in PNG is (2^31)-1 */\r
909 #define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)\r
910 #define PNG_UINT_32_MAX ((png_uint_32)(-1))\r
911 #define PNG_SIZE_MAX ((png_size_t)(-1))\r
912 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)\r
913 /* PNG_MAX_UINT is deprecated; use PNG_UINT_31_MAX instead. */\r
914 #define PNG_MAX_UINT PNG_UINT_31_MAX\r
915 #endif\r
916 \r
917 /* These describe the color_type field in png_info. */\r
918 /* color type masks */\r
919 #define PNG_COLOR_MASK_PALETTE    1\r
920 #define PNG_COLOR_MASK_COLOR      2\r
921 #define PNG_COLOR_MASK_ALPHA      4\r
922 \r
923 /* color types.  Note that not all combinations are legal */\r
924 #define PNG_COLOR_TYPE_GRAY 0\r
925 #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)\r
926 #define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)\r
927 #define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)\r
928 #define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)\r
929 /* aliases */\r
930 #define PNG_COLOR_TYPE_RGBA  PNG_COLOR_TYPE_RGB_ALPHA\r
931 #define PNG_COLOR_TYPE_GA  PNG_COLOR_TYPE_GRAY_ALPHA\r
932 \r
933 /* This is for compression type. PNG 1.0-1.2 only define the single type. */\r
934 #define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */\r
935 #define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE\r
936 \r
937 /* This is for filter type. PNG 1.0-1.2 only define the single type. */\r
938 #define PNG_FILTER_TYPE_BASE      0 /* Single row per-byte filtering */\r
939 #define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */\r
940 #define PNG_FILTER_TYPE_DEFAULT   PNG_FILTER_TYPE_BASE\r
941 \r
942 /* These are for the interlacing type.  These values should NOT be changed. */\r
943 #define PNG_INTERLACE_NONE        0 /* Non-interlaced image */\r
944 #define PNG_INTERLACE_ADAM7       1 /* Adam7 interlacing */\r
945 #define PNG_INTERLACE_LAST        2 /* Not a valid value */\r
946 \r
947 /* These are for the oFFs chunk.  These values should NOT be changed. */\r
948 #define PNG_OFFSET_PIXEL          0 /* Offset in pixels */\r
949 #define PNG_OFFSET_MICROMETER     1 /* Offset in micrometers (1/10^6 meter) */\r
950 #define PNG_OFFSET_LAST           2 /* Not a valid value */\r
951 \r
952 /* These are for the pCAL chunk.  These values should NOT be changed. */\r
953 #define PNG_EQUATION_LINEAR       0 /* Linear transformation */\r
954 #define PNG_EQUATION_BASE_E       1 /* Exponential base e transform */\r
955 #define PNG_EQUATION_ARBITRARY    2 /* Arbitrary base exponential transform */\r
956 #define PNG_EQUATION_HYPERBOLIC   3 /* Hyperbolic sine transformation */\r
957 #define PNG_EQUATION_LAST         4 /* Not a valid value */\r
958 \r
959 /* These are for the sCAL chunk.  These values should NOT be changed. */\r
960 #define PNG_SCALE_UNKNOWN         0 /* unknown unit (image scale) */\r
961 #define PNG_SCALE_METER           1 /* meters per pixel */\r
962 #define PNG_SCALE_RADIAN          2 /* radians per pixel */\r
963 #define PNG_SCALE_LAST            3 /* Not a valid value */\r
964 \r
965 /* These are for the pHYs chunk.  These values should NOT be changed. */\r
966 #define PNG_RESOLUTION_UNKNOWN    0 /* pixels/unknown unit (aspect ratio) */\r
967 #define PNG_RESOLUTION_METER      1 /* pixels/meter */\r
968 #define PNG_RESOLUTION_LAST       2 /* Not a valid value */\r
969 \r
970 /* These are for the sRGB chunk.  These values should NOT be changed. */\r
971 #define PNG_sRGB_INTENT_PERCEPTUAL 0\r
972 #define PNG_sRGB_INTENT_RELATIVE   1\r
973 #define PNG_sRGB_INTENT_SATURATION 2\r
974 #define PNG_sRGB_INTENT_ABSOLUTE   3\r
975 #define PNG_sRGB_INTENT_LAST       4 /* Not a valid value */\r
976 \r
977 /* This is for text chunks */\r
978 #define PNG_KEYWORD_MAX_LENGTH     79\r
979 \r
980 /* Maximum number of entries in PLTE/sPLT/tRNS arrays */\r
981 #define PNG_MAX_PALETTE_LENGTH    256\r
982 \r
983 /* These determine if an ancillary chunk's data has been successfully read\r
984  * from the PNG header, or if the application has filled in the corresponding\r
985  * data in the info_struct to be written into the output file.  The values\r
986  * of the PNG_INFO_<chunk> defines should NOT be changed.\r
987  */\r
988 #define PNG_INFO_gAMA 0x0001\r
989 #define PNG_INFO_sBIT 0x0002\r
990 #define PNG_INFO_cHRM 0x0004\r
991 #define PNG_INFO_PLTE 0x0008\r
992 #define PNG_INFO_tRNS 0x0010\r
993 #define PNG_INFO_bKGD 0x0020\r
994 #define PNG_INFO_hIST 0x0040\r
995 #define PNG_INFO_pHYs 0x0080\r
996 #define PNG_INFO_oFFs 0x0100\r
997 #define PNG_INFO_tIME 0x0200\r
998 #define PNG_INFO_pCAL 0x0400\r
999 #define PNG_INFO_sRGB 0x0800   /* GR-P, 0.96a */\r
1000 #define PNG_INFO_iCCP 0x1000   /* ESR, 1.0.6 */\r
1001 #define PNG_INFO_sPLT 0x2000   /* ESR, 1.0.6 */\r
1002 #define PNG_INFO_sCAL 0x4000   /* ESR, 1.0.6 */\r
1003 #define PNG_INFO_IDAT 0x8000L  /* ESR, 1.0.6 */\r
1004 \r
1005 /* This is used for the transformation routines, as some of them\r
1006  * change these values for the row.  It also should enable using\r
1007  * the routines for other purposes.\r
1008  */\r
1009 typedef struct png_row_info_struct\r
1010 {\r
1011    png_uint_32 width; /* width of row */\r
1012    png_uint_32 rowbytes; /* number of bytes in row */\r
1013    png_byte color_type; /* color type of row */\r
1014    png_byte bit_depth; /* bit depth of row */\r
1015    png_byte channels; /* number of channels (1, 2, 3, or 4) */\r
1016    png_byte pixel_depth; /* bits per pixel (depth * channels) */\r
1017 } png_row_info;\r
1018 \r
1019 typedef png_row_info FAR * png_row_infop;\r
1020 typedef png_row_info FAR * FAR * png_row_infopp;\r
1021 \r
1022 /* These are the function types for the I/O functions and for the functions\r
1023  * that allow the user to override the default I/O functions with his or her\r
1024  * own.  The png_error_ptr type should match that of user-supplied warning\r
1025  * and error functions, while the png_rw_ptr type should match that of the\r
1026  * user read/write data functions.\r
1027  */\r
1028 typedef struct png_struct_def png_struct;\r
1029 typedef png_struct FAR * png_structp;\r
1030 \r
1031 typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp));\r
1032 typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t));\r
1033 typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp));\r
1034 typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32,\r
1035    int));\r
1036 typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32,\r
1037    int));\r
1038 \r
1039 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED\r
1040 typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp, png_infop));\r
1041 typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop));\r
1042 typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep,\r
1043    png_uint_32, int));\r
1044 #endif\r
1045 \r
1046 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \\r
1047     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \\r
1048     defined(PNG_LEGACY_SUPPORTED)\r
1049 typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp,\r
1050     png_row_infop, png_bytep));\r
1051 #endif\r
1052 \r
1053 #if defined(PNG_USER_CHUNKS_SUPPORTED)\r
1054 typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp));\r
1055 #endif\r
1056 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)\r
1057 typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));\r
1058 #endif\r
1059 \r
1060 /* Transform masks for the high-level interface */\r
1061 #define PNG_TRANSFORM_IDENTITY       0x0000    /* read and write */\r
1062 #define PNG_TRANSFORM_STRIP_16       0x0001    /* read only */\r
1063 #define PNG_TRANSFORM_STRIP_ALPHA    0x0002    /* read only */\r
1064 #define PNG_TRANSFORM_PACKING        0x0004    /* read and write */\r
1065 #define PNG_TRANSFORM_PACKSWAP       0x0008    /* read and write */\r
1066 #define PNG_TRANSFORM_EXPAND         0x0010    /* read only */\r
1067 #define PNG_TRANSFORM_INVERT_MONO    0x0020    /* read and write */\r
1068 #define PNG_TRANSFORM_SHIFT          0x0040    /* read and write */\r
1069 #define PNG_TRANSFORM_BGR            0x0080    /* read and write */\r
1070 #define PNG_TRANSFORM_SWAP_ALPHA     0x0100    /* read and write */\r
1071 #define PNG_TRANSFORM_SWAP_ENDIAN    0x0200    /* read and write */\r
1072 #define PNG_TRANSFORM_INVERT_ALPHA   0x0400    /* read and write */\r
1073 #define PNG_TRANSFORM_STRIP_FILLER   0x0800    /* WRITE only */\r
1074 \r
1075 /* Flags for MNG supported features */\r
1076 #define PNG_FLAG_MNG_EMPTY_PLTE     0x01\r
1077 #define PNG_FLAG_MNG_FILTER_64      0x04\r
1078 #define PNG_ALL_MNG_FEATURES        0x05\r
1079 \r
1080 typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t));\r
1081 typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp));\r
1082 \r
1083 /* The structure that holds the information to read and write PNG files.\r
1084  * The only people who need to care about what is inside of this are the\r
1085  * people who will be modifying the library for their own special needs.\r
1086  * It should NOT be accessed directly by an application, except to store\r
1087  * the jmp_buf.\r
1088  */\r
1089 \r
1090 struct png_struct_def\r
1091 {\r
1092 #ifdef PNG_SETJMP_SUPPORTED\r
1093    jmp_buf jmpbuf;            /* used in png_error */\r
1094 #endif\r
1095    png_error_ptr error_fn;    /* function for printing errors and aborting */\r
1096    png_error_ptr warning_fn;  /* function for printing warnings */\r
1097    png_voidp error_ptr;       /* user supplied struct for error functions */\r
1098    png_rw_ptr write_data_fn;  /* function for writing output data */\r
1099    png_rw_ptr read_data_fn;   /* function for reading input data */\r
1100    png_voidp io_ptr;          /* ptr to application struct for I/O functions */\r
1101 \r
1102 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)\r
1103    png_user_transform_ptr read_user_transform_fn; /* user read transform */\r
1104 #endif\r
1105 \r
1106 #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)\r
1107    png_user_transform_ptr write_user_transform_fn; /* user write transform */\r
1108 #endif\r
1109 \r
1110 /* These were added in libpng-1.0.2 */\r
1111 #if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)\r
1112 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \\r
1113     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)\r
1114    png_voidp user_transform_ptr; /* user supplied struct for user transform */\r
1115    png_byte user_transform_depth;    /* bit depth of user transformed pixels */\r
1116    png_byte user_transform_channels; /* channels in user transformed pixels */\r
1117 #endif\r
1118 #endif\r
1119 \r
1120    png_uint_32 mode;          /* tells us where we are in the PNG file */\r
1121    png_uint_32 flags;         /* flags indicating various things to libpng */\r
1122    png_uint_32 transformations; /* which transformations to perform */\r
1123 \r
1124    z_stream zstream;          /* pointer to decompression structure (below) */\r
1125    png_bytep zbuf;            /* buffer for zlib */\r
1126    png_size_t zbuf_size;      /* size of zbuf */\r
1127    int zlib_level;            /* holds zlib compression level */\r
1128    int zlib_method;           /* holds zlib compression method */\r
1129    int zlib_window_bits;      /* holds zlib compression window bits */\r
1130    int zlib_mem_level;        /* holds zlib compression memory level */\r
1131    int zlib_strategy;         /* holds zlib compression strategy */\r
1132 \r
1133    png_uint_32 width;         /* width of image in pixels */\r
1134    png_uint_32 height;        /* height of image in pixels */\r
1135    png_uint_32 num_rows;      /* number of rows in current pass */\r
1136    png_uint_32 usr_width;     /* width of row at start of write */\r
1137    png_uint_32 rowbytes;      /* size of row in bytes */\r
1138    png_uint_32 irowbytes;     /* size of current interlaced row in bytes */\r
1139    png_uint_32 iwidth;        /* width of current interlaced row in pixels */\r
1140    png_uint_32 row_number;    /* current row in interlace pass */\r
1141    png_bytep prev_row;        /* buffer to save previous (unfiltered) row */\r
1142    png_bytep row_buf;         /* buffer to save current (unfiltered) row */\r
1143    png_bytep sub_row;         /* buffer to save "sub" row when filtering */\r
1144    png_bytep up_row;          /* buffer to save "up" row when filtering */\r
1145    png_bytep avg_row;         /* buffer to save "avg" row when filtering */\r
1146    png_bytep paeth_row;       /* buffer to save "Paeth" row when filtering */\r
1147    png_row_info row_info;     /* used for transformation routines */\r
1148 \r
1149    png_uint_32 idat_size;     /* current IDAT size for read */\r
1150    png_uint_32 crc;           /* current chunk CRC value */\r
1151    png_colorp palette;        /* palette from the input file */\r
1152    png_uint_16 num_palette;   /* number of color entries in palette */\r
1153    png_uint_16 num_trans;     /* number of transparency values */\r
1154    png_byte chunk_name[5];    /* null-terminated name of current chunk */\r
1155    png_byte compression;      /* file compression type (always 0) */\r
1156    png_byte filter;           /* file filter type (always 0) */\r
1157    png_byte interlaced;       /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */\r
1158    png_byte pass;             /* current interlace pass (0 - 6) */\r
1159    png_byte do_filter;        /* row filter flags (see PNG_FILTER_ below ) */\r
1160    png_byte color_type;       /* color type of file */\r
1161    png_byte bit_depth;        /* bit depth of file */\r
1162    png_byte usr_bit_depth;    /* bit depth of users row */\r
1163    png_byte pixel_depth;      /* number of bits per pixel */\r
1164    png_byte channels;         /* number of channels in file */\r
1165    png_byte usr_channels;     /* channels at start of write */\r
1166    png_byte sig_bytes;        /* magic bytes read/written from start of file */\r
1167 \r
1168 #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)\r
1169 #ifdef PNG_LEGACY_SUPPORTED\r
1170    png_byte filler;           /* filler byte for pixel expansion */\r
1171 #else\r
1172    png_uint_16 filler;           /* filler bytes for pixel expansion */\r
1173 #endif\r
1174 #endif\r
1175 \r
1176 #if defined(PNG_bKGD_SUPPORTED)\r
1177    png_byte background_gamma_type;\r
1178 #  ifdef PNG_FLOATING_POINT_SUPPORTED\r
1179    float background_gamma;\r
1180 #  endif\r
1181    png_color_16 background;   /* background color in screen gamma space */\r
1182 #if defined(PNG_READ_GAMMA_SUPPORTED)\r
1183    png_color_16 background_1; /* background normalized to gamma 1.0 */\r
1184 #endif\r
1185 #endif /* PNG_bKGD_SUPPORTED */\r
1186 \r
1187 #if defined(PNG_WRITE_FLUSH_SUPPORTED)\r
1188    png_flush_ptr output_flush_fn;/* Function for flushing output */\r
1189    png_uint_32 flush_dist;    /* how many rows apart to flush, 0 - no flush */\r
1190    png_uint_32 flush_rows;    /* number of rows written since last flush */\r
1191 #endif\r
1192 \r
1193 #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)\r
1194    int gamma_shift;      /* number of "insignificant" bits 16-bit gamma */\r
1195 #ifdef PNG_FLOATING_POINT_SUPPORTED\r
1196    float gamma;          /* file gamma value */\r
1197    float screen_gamma;   /* screen gamma value (display_exponent) */\r
1198 #endif\r
1199 #endif\r
1200 \r
1201 #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)\r
1202    png_bytep gamma_table;     /* gamma table for 8-bit depth files */\r
1203    png_bytep gamma_from_1;    /* converts from 1.0 to screen */\r
1204    png_bytep gamma_to_1;      /* converts from file to 1.0 */\r
1205    png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */\r
1206    png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */\r
1207    png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */\r
1208 #endif\r
1209 \r
1210 #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)\r
1211    png_color_8 sig_bit;       /* significant bits in each available channel */\r
1212 #endif\r
1213 \r
1214 #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)\r
1215    png_color_8 shift;         /* shift for significant bit tranformation */\r
1216 #endif\r
1217 \r
1218 #if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \\r
1219  || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)\r
1220    png_bytep trans;           /* transparency values for paletted files */\r
1221    png_color_16 trans_values; /* transparency values for non-paletted files */\r
1222 #endif\r
1223 \r
1224    png_read_status_ptr read_row_fn;   /* called after each row is decoded */\r
1225    png_write_status_ptr write_row_fn; /* called after each row is encoded */\r
1226 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED\r
1227    png_progressive_info_ptr info_fn; /* called after header data fully read */\r
1228    png_progressive_row_ptr row_fn;   /* called after each prog. row is decoded */\r
1229    png_progressive_end_ptr end_fn;   /* called after image is complete */\r
1230    png_bytep save_buffer_ptr;        /* current location in save_buffer */\r
1231    png_bytep save_buffer;            /* buffer for previously read data */\r
1232    png_bytep current_buffer_ptr;     /* current location in current_buffer */\r
1233    png_bytep current_buffer;         /* buffer for recently used data */\r
1234    png_uint_32 push_length;          /* size of current input chunk */\r
1235    png_uint_32 skip_length;          /* bytes to skip in input data */\r
1236    png_size_t save_buffer_size;      /* amount of data now in save_buffer */\r
1237    png_size_t save_buffer_max;       /* total size of save_buffer */\r
1238    png_size_t buffer_size;           /* total amount of available input data */\r
1239    png_size_t current_buffer_size;   /* amount of data now in current_buffer */\r
1240    int process_mode;                 /* what push library is currently doing */\r
1241    int cur_palette;                  /* current push library palette index */\r
1242 \r
1243 #  if defined(PNG_TEXT_SUPPORTED)\r
1244      png_size_t current_text_size;   /* current size of text input data */\r
1245      png_size_t current_text_left;   /* how much text left to read in input */\r
1246      png_charp current_text;         /* current text chunk buffer */\r
1247      png_charp current_text_ptr;     /* current location in current_text */\r
1248 #  endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */\r
1249 \r
1250 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */\r
1251 \r
1252 #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)\r
1253 /* for the Borland special 64K segment handler */\r
1254    png_bytepp offset_table_ptr;\r
1255    png_bytep offset_table;\r
1256    png_uint_16 offset_table_number;\r
1257    png_uint_16 offset_table_count;\r
1258    png_uint_16 offset_table_count_free;\r
1259 #endif\r
1260 \r
1261 #if defined(PNG_READ_DITHER_SUPPORTED)\r
1262    png_bytep palette_lookup;         /* lookup table for dithering */\r
1263    png_bytep dither_index;           /* index translation for palette files */\r
1264 #endif\r
1265 \r
1266 #if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED)\r
1267    png_uint_16p hist;                /* histogram */\r
1268 #endif\r
1269 \r
1270 #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)\r
1271    png_byte heuristic_method;        /* heuristic for row filter selection */\r
1272    png_byte num_prev_filters;        /* number of weights for previous rows */\r
1273    png_bytep prev_filters;           /* filter type(s) of previous row(s) */\r
1274    png_uint_16p filter_weights;      /* weight(s) for previous line(s) */\r
1275    png_uint_16p inv_filter_weights;  /* 1/weight(s) for previous line(s) */\r
1276    png_uint_16p filter_costs;        /* relative filter calculation cost */\r
1277    png_uint_16p inv_filter_costs;    /* 1/relative filter calculation cost */\r
1278 #endif\r
1279 \r
1280 #if defined(PNG_TIME_RFC1123_SUPPORTED)\r
1281    png_charp time_buffer;            /* String to hold RFC 1123 time text */\r
1282 #endif\r
1283 \r
1284 /* New members added in libpng-1.0.6 */\r
1285 \r
1286 #ifdef PNG_FREE_ME_SUPPORTED\r
1287    png_uint_32 free_me;       /* flags items libpng is responsible for freeing */\r
1288 #endif\r
1289 \r
1290 #if defined(PNG_USER_CHUNKS_SUPPORTED)\r
1291    png_voidp user_chunk_ptr;\r
1292    png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */\r
1293 #endif\r
1294 \r
1295 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)\r
1296    int num_chunk_list;\r
1297    png_bytep chunk_list;\r
1298 #endif\r
1299 \r
1300 /* New members added in libpng-1.0.3 */\r
1301 #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)\r
1302    png_byte rgb_to_gray_status;\r
1303    /* These were changed from png_byte in libpng-1.0.6 */\r
1304    png_uint_16 rgb_to_gray_red_coeff;\r
1305    png_uint_16 rgb_to_gray_green_coeff;\r
1306    png_uint_16 rgb_to_gray_blue_coeff;\r
1307 #endif\r
1308 \r
1309 /* New member added in libpng-1.0.4 (renamed in 1.0.9) */\r
1310 #if defined(PNG_MNG_FEATURES_SUPPORTED) || \\r
1311     defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \\r
1312     defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)\r
1313 /* changed from png_byte to png_uint_32 at version 1.2.0 */\r
1314 #ifdef PNG_1_0_X\r
1315    png_byte mng_features_permitted;\r
1316 #else\r
1317    png_uint_32 mng_features_permitted;\r
1318 #endif /* PNG_1_0_X */\r
1319 #endif\r
1320 \r
1321 /* New member added in libpng-1.0.7 */\r
1322 #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)\r
1323    png_fixed_point int_gamma;\r
1324 #endif\r
1325 \r
1326 /* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */\r
1327 #if defined(PNG_MNG_FEATURES_SUPPORTED)\r
1328    png_byte filter_type;\r
1329 #endif\r
1330 \r
1331 #if defined(PNG_1_0_X) || (defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD))\r
1332 /* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */\r
1333    png_uint_32 row_buf_size;\r
1334 #endif\r
1335 \r
1336 /* New members added in libpng-1.2.0 */\r
1337 #if !defined(PNG_1_0_X) && defined(PNG_ASSEMBLER_CODE_SUPPORTED)\r
1338    png_byte     mmx_bitdepth_threshold;\r
1339    png_uint_32  mmx_rowbytes_threshold;\r
1340    png_uint_32  asm_flags;\r
1341 #endif\r
1342 \r
1343 /* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */\r
1344 #ifdef PNG_USER_MEM_SUPPORTED\r
1345    png_voidp mem_ptr;                /* user supplied struct for mem functions */\r
1346    png_malloc_ptr malloc_fn;         /* function for allocating memory */\r
1347    png_free_ptr free_fn;             /* function for freeing memory */\r
1348 #endif\r
1349 \r
1350 /* New member added in libpng-1.0.13 and 1.2.0 */\r
1351    png_bytep big_row_buf;         /* buffer to save current (unfiltered) row */\r
1352 \r
1353 #if defined(PNG_READ_DITHER_SUPPORTED)\r
1354 /* The following three members were added at version 1.0.14 and 1.2.4 */\r
1355    png_bytep dither_sort;            /* working sort array */\r
1356    png_bytep index_to_palette;       /* where the original index currently is */\r
1357                                      /* in the palette */\r
1358    png_bytep palette_to_index;       /* which original index points to this */\r
1359                                      /* palette color */\r
1360 #endif\r
1361 \r
1362 /* New members added in libpng-1.0.16 and 1.2.6 */\r
1363    png_byte compression_type;\r
1364 \r
1365 #ifdef PNG_SET_USER_LIMITS_SUPPORTED\r
1366    png_uint_32 user_width_max;\r
1367    png_uint_32 user_height_max;\r
1368 #endif\r
1369 \r
1370 };\r
1371 \r
1372 \r
1373 /* This triggers a compiler error in png.c, if png.c and png.h\r
1374  * do not agree upon the version number.\r
1375  */\r
1376 typedef png_structp version_1_2_12;\r
1377 \r
1378 typedef png_struct FAR * FAR * png_structpp;\r
1379 \r
1380 /* Here are the function definitions most commonly used.  This is not\r
1381  * the place to find out how to use libpng.  See libpng.txt for the\r
1382  * full explanation, see example.c for the summary.  This just provides\r
1383  * a simple one line description of the use of each function.\r
1384  */\r
1385 \r
1386 /* Returns the version number of the library */\r
1387 extern PNG_EXPORT(png_uint_32,png_access_version_number) PNGARG((void));\r
1388 \r
1389 /* Tell lib we have already handled the first <num_bytes> magic bytes.\r
1390  * Handling more than 8 bytes from the beginning of the file is an error.\r
1391  */\r
1392 extern PNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr,\r
1393    int num_bytes));\r
1394 \r
1395 /* Check sig[start] through sig[start + num_to_check - 1] to see if it's a\r
1396  * PNG file.  Returns zero if the supplied bytes match the 8-byte PNG\r
1397  * signature, and non-zero otherwise.  Having num_to_check == 0 or\r
1398  * start > 7 will always fail (ie return non-zero).\r
1399  */\r
1400 extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start,\r
1401    png_size_t num_to_check));\r
1402 \r
1403 /* Simple signature checking function.  This is the same as calling\r
1404  * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).\r
1405  */\r
1406 extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num));\r
1407 \r
1408 /* Allocate and initialize png_ptr struct for reading, and any other memory. */\r
1409 extern PNG_EXPORT(png_structp,png_create_read_struct)\r
1410    PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,\r
1411    png_error_ptr error_fn, png_error_ptr warn_fn));\r
1412 \r
1413 /* Allocate and initialize png_ptr struct for writing, and any other memory */\r
1414 extern PNG_EXPORT(png_structp,png_create_write_struct)\r
1415    PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,\r
1416    png_error_ptr error_fn, png_error_ptr warn_fn));\r
1417 \r
1418 #ifdef PNG_WRITE_SUPPORTED\r
1419 extern PNG_EXPORT(png_uint_32,png_get_compression_buffer_size)\r
1420    PNGARG((png_structp png_ptr));\r
1421 #endif\r
1422 \r
1423 #ifdef PNG_WRITE_SUPPORTED\r
1424 extern PNG_EXPORT(void,png_set_compression_buffer_size)\r
1425    PNGARG((png_structp png_ptr, png_uint_32 size));\r
1426 #endif\r
1427 \r
1428 /* Reset the compression stream */\r
1429 extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr));\r
1430 \r
1431 /* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */\r
1432 #ifdef PNG_USER_MEM_SUPPORTED\r
1433 extern PNG_EXPORT(png_structp,png_create_read_struct_2)\r
1434    PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,\r
1435    png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,\r
1436    png_malloc_ptr malloc_fn, png_free_ptr free_fn));\r
1437 extern PNG_EXPORT(png_structp,png_create_write_struct_2)\r
1438    PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,\r
1439    png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,\r
1440    png_malloc_ptr malloc_fn, png_free_ptr free_fn));\r
1441 #endif\r
1442 \r
1443 /* Write a PNG chunk - size, type, (optional) data, CRC. */\r
1444 extern PNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr,\r
1445    png_bytep chunk_name, png_bytep data, png_size_t length));\r
1446 \r
1447 /* Write the start of a PNG chunk - length and chunk name. */\r
1448 extern PNG_EXPORT(void,png_write_chunk_start) PNGARG((png_structp png_ptr,\r
1449    png_bytep chunk_name, png_uint_32 length));\r
1450 \r
1451 /* Write the data of a PNG chunk started with png_write_chunk_start(). */\r
1452 extern PNG_EXPORT(void,png_write_chunk_data) PNGARG((png_structp png_ptr,\r
1453    png_bytep data, png_size_t length));\r
1454 \r
1455 /* Finish a chunk started with png_write_chunk_start() (includes CRC). */\r
1456 extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr));\r
1457 \r
1458 /* Allocate and initialize the info structure */\r
1459 extern PNG_EXPORT(png_infop,png_create_info_struct)\r
1460    PNGARG((png_structp png_ptr));\r
1461 \r
1462 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)\r
1463 /* Initialize the info structure (old interface - DEPRECATED) */\r
1464 extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr));\r
1465 #undef png_info_init\r
1466 #define png_info_init(info_ptr) png_info_init_3(&info_ptr,\\r
1467     png_sizeof(png_info));\r
1468 #endif\r
1469 \r
1470 extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr,\r
1471     png_size_t png_info_struct_size));\r
1472 \r
1473 /* Writes all the PNG information before the image. */\r
1474 extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr,\r
1475    png_infop info_ptr));\r
1476 extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr,\r
1477    png_infop info_ptr));\r
1478 \r
1479 #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED\r
1480 /* read the information before the actual image data. */\r
1481 extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr,\r
1482    png_infop info_ptr));\r
1483 #endif\r
1484 \r
1485 #if defined(PNG_TIME_RFC1123_SUPPORTED)\r
1486 extern PNG_EXPORT(png_charp,png_convert_to_rfc1123)\r
1487    PNGARG((png_structp png_ptr, png_timep ptime));\r
1488 #endif\r
1489 \r
1490 #if !defined(_WIN32_WCE)\r
1491 /* "time.h" functions are not supported on WindowsCE */\r
1492 #if defined(PNG_WRITE_tIME_SUPPORTED)\r
1493 /* convert from a struct tm to png_time */\r
1494 extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime,\r
1495    struct tm FAR * ttime));\r
1496 \r
1497 /* convert from time_t to png_time.  Uses gmtime() */\r
1498 extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime,\r
1499    time_t ttime));\r
1500 #endif /* PNG_WRITE_tIME_SUPPORTED */\r
1501 #endif /* _WIN32_WCE */\r
1502 \r
1503 #if defined(PNG_READ_EXPAND_SUPPORTED)\r
1504 /* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */\r
1505 extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr));\r
1506 #if !defined(PNG_1_0_X)\r
1507 extern PNG_EXPORT(void,png_set_expand_gray_1_2_4_to_8) PNGARG((png_structp\r
1508   png_ptr));\r
1509 #endif\r
1510 extern PNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr));\r
1511 extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr));\r
1512 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)\r
1513 /* Deprecated */\r
1514 extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp png_ptr));\r
1515 #endif\r
1516 #endif\r
1517 \r
1518 #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)\r
1519 /* Use blue, green, red order for pixels. */\r
1520 extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr));\r
1521 #endif\r
1522 \r
1523 #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)\r
1524 /* Expand the grayscale to 24-bit RGB if necessary. */\r
1525 extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr));\r
1526 #endif\r
1527 \r
1528 #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)\r
1529 /* Reduce RGB to grayscale. */\r
1530 #ifdef PNG_FLOATING_POINT_SUPPORTED\r
1531 extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr,\r
1532    int error_action, double red, double green ));\r
1533 #endif\r
1534 extern PNG_EXPORT(void,png_set_rgb_to_gray_fixed) PNGARG((png_structp png_ptr,\r
1535    int error_action, png_fixed_point red, png_fixed_point green ));\r
1536 extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp\r
1537    png_ptr));\r
1538 #endif\r
1539 \r
1540 extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth,\r
1541    png_colorp palette));\r
1542 \r
1543 #if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)\r
1544 extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr));\r
1545 #endif\r
1546 \r
1547 #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \\r
1548     defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)\r
1549 extern PNG_EXPORT(void,png_set_swap_alpha) PNGARG((png_structp png_ptr));\r
1550 #endif\r
1551 \r
1552 #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \\r
1553     defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)\r
1554 extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr));\r
1555 #endif\r
1556 \r
1557 #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)\r
1558 /* Add a filler byte to 8-bit Gray or 24-bit RGB images. */\r
1559 extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr,\r
1560    png_uint_32 filler, int flags));\r
1561 /* The values of the PNG_FILLER_ defines should NOT be changed */\r
1562 #define PNG_FILLER_BEFORE 0\r
1563 #define PNG_FILLER_AFTER 1\r
1564 /* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */\r
1565 #if !defined(PNG_1_0_X)\r
1566 extern PNG_EXPORT(void,png_set_add_alpha) PNGARG((png_structp png_ptr,\r
1567    png_uint_32 filler, int flags));\r
1568 #endif\r
1569 #endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */\r
1570 \r
1571 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)\r
1572 /* Swap bytes in 16-bit depth files. */\r
1573 extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr));\r
1574 #endif\r
1575 \r
1576 #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)\r
1577 /* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */\r
1578 extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr));\r
1579 #endif\r
1580 \r
1581 #if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)\r
1582 /* Swap packing order of pixels in bytes. */\r
1583 extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr));\r
1584 #endif\r
1585 \r
1586 #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)\r
1587 /* Converts files to legal bit depths. */\r
1588 extern PNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr,\r
1589    png_color_8p true_bits));\r
1590 #endif\r
1591 \r
1592 #if defined(PNG_READ_INTERLACING_SUPPORTED) || \\r
1593     defined(PNG_WRITE_INTERLACING_SUPPORTED)\r
1594 /* Have the code handle the interlacing.  Returns the number of passes. */\r
1595 extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr));\r
1596 #endif\r
1597 \r
1598 #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)\r
1599 /* Invert monochrome files */\r
1600 extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr));\r
1601 #endif\r
1602 \r
1603 #if defined(PNG_READ_BACKGROUND_SUPPORTED)\r
1604 /* Handle alpha and tRNS by replacing with a background color. */\r
1605 #ifdef PNG_FLOATING_POINT_SUPPORTED\r
1606 extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr,\r
1607    png_color_16p background_color, int background_gamma_code,\r
1608    int need_expand, double background_gamma));\r
1609 #endif\r
1610 #define PNG_BACKGROUND_GAMMA_UNKNOWN 0\r
1611 #define PNG_BACKGROUND_GAMMA_SCREEN  1\r
1612 #define PNG_BACKGROUND_GAMMA_FILE    2\r
1613 #define PNG_BACKGROUND_GAMMA_UNIQUE  3\r
1614 #endif\r
1615 \r
1616 #if defined(PNG_READ_16_TO_8_SUPPORTED)\r
1617 /* strip the second byte of information from a 16-bit depth file. */\r
1618 extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr));\r
1619 #endif\r
1620 \r
1621 #if defined(PNG_READ_DITHER_SUPPORTED)\r
1622 /* Turn on dithering, and reduce the palette to the number of colors available. */\r
1623 extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr,\r
1624    png_colorp palette, int num_palette, int maximum_colors,\r
1625    png_uint_16p histogram, int full_dither));\r
1626 #endif\r
1627 \r
1628 #if defined(PNG_READ_GAMMA_SUPPORTED)\r
1629 /* Handle gamma correction. Screen_gamma=(display_exponent) */\r
1630 #ifdef PNG_FLOATING_POINT_SUPPORTED\r
1631 extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr,\r
1632    double screen_gamma, double default_file_gamma));\r
1633 #endif\r
1634 #endif\r
1635 \r
1636 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)\r
1637 #if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \\r
1638     defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)\r
1639 /* Permit or disallow empty PLTE (0: not permitted, 1: permitted) */\r
1640 /* Deprecated and will be removed.  Use png_permit_mng_features() instead. */\r
1641 extern PNG_EXPORT(void,png_permit_empty_plte) PNGARG((png_structp png_ptr,\r
1642    int empty_plte_permitted));\r
1643 #endif\r
1644 #endif\r
1645 \r
1646 #if defined(PNG_WRITE_FLUSH_SUPPORTED)\r
1647 /* Set how many lines between output flushes - 0 for no flushing */\r
1648 extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows));\r
1649 /* Flush the current PNG output buffer */\r
1650 extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr));\r
1651 #endif\r
1652 \r
1653 /* optional update palette with requested transformations */\r
1654 extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr));\r
1655 \r
1656 /* optional call to update the users info structure */\r
1657 extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr,\r
1658    png_infop info_ptr));\r
1659 \r
1660 #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED\r
1661 /* read one or more rows of image data. */\r
1662 extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr,\r
1663    png_bytepp row, png_bytepp display_row, png_uint_32 num_rows));\r
1664 #endif\r
1665 \r
1666 #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED\r
1667 /* read a row of data. */\r
1668 extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr,\r
1669    png_bytep row,\r
1670    png_bytep display_row));\r
1671 #endif\r
1672 \r
1673 #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED\r
1674 /* read the whole image into memory at once. */\r
1675 extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr,\r
1676    png_bytepp image));\r
1677 #endif\r
1678 \r
1679 /* write a row of image data */\r
1680 extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr,\r
1681    png_bytep row));\r
1682 \r
1683 /* write a few rows of image data */\r
1684 extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr,\r
1685    png_bytepp row, png_uint_32 num_rows));\r
1686 \r
1687 /* write the image data */\r
1688 extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr,\r
1689    png_bytepp image));\r
1690 \r
1691 /* writes the end of the PNG file. */\r
1692 extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr,\r
1693    png_infop info_ptr));\r
1694 \r
1695 #ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED\r
1696 /* read the end of the PNG file. */\r
1697 extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr,\r
1698    png_infop info_ptr));\r
1699 #endif\r
1700 \r
1701 /* free any memory associated with the png_info_struct */\r
1702 extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr,\r
1703    png_infopp info_ptr_ptr));\r
1704 \r
1705 /* free any memory associated with the png_struct and the png_info_structs */\r
1706 extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp\r
1707    png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr));\r
1708 \r
1709 /* free all memory used by the read (old method - NOT DLL EXPORTED) */\r
1710 extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,\r
1711    png_infop end_info_ptr));\r
1712 \r
1713 /* free any memory associated with the png_struct and the png_info_structs */\r
1714 extern PNG_EXPORT(void,png_destroy_write_struct)\r
1715    PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr));\r
1716 \r
1717 /* free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */\r
1718 extern void png_write_destroy PNGARG((png_structp png_ptr));\r
1719 \r
1720 /* set the libpng method of handling chunk CRC errors */\r
1721 extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr,\r
1722    int crit_action, int ancil_action));\r
1723 \r
1724 /* Values for png_set_crc_action() to say how to handle CRC errors in\r
1725  * ancillary and critical chunks, and whether to use the data contained\r
1726  * therein.  Note that it is impossible to "discard" data in a critical\r
1727  * chunk.  For versions prior to 0.90, the action was always error/quit,\r
1728  * whereas in version 0.90 and later, the action for CRC errors in ancillary\r
1729  * chunks is warn/discard.  These values should NOT be changed.\r
1730  *\r
1731  *      value                       action:critical     action:ancillary\r
1732  */\r
1733 #define PNG_CRC_DEFAULT       0  /* error/quit          warn/discard data */\r
1734 #define PNG_CRC_ERROR_QUIT    1  /* error/quit          error/quit        */\r
1735 #define PNG_CRC_WARN_DISCARD  2  /* (INVALID)           warn/discard data */\r
1736 #define PNG_CRC_WARN_USE      3  /* warn/use data       warn/use data     */\r
1737 #define PNG_CRC_QUIET_USE     4  /* quiet/use data      quiet/use data    */\r
1738 #define PNG_CRC_NO_CHANGE     5  /* use current value   use current value */\r
1739 \r
1740 /* These functions give the user control over the scan-line filtering in\r
1741  * libpng and the compression methods used by zlib.  These functions are\r
1742  * mainly useful for testing, as the defaults should work with most users.\r
1743  * Those users who are tight on memory or want faster performance at the\r
1744  * expense of compression can modify them.  See the compression library\r
1745  * header file (zlib.h) for an explination of the compression functions.\r
1746  */\r
1747 \r
1748 /* set the filtering method(s) used by libpng.  Currently, the only valid\r
1749  * value for "method" is 0.\r
1750  */\r
1751 extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method,\r
1752    int filters));\r
1753 \r
1754 /* Flags for png_set_filter() to say which filters to use.  The flags\r
1755  * are chosen so that they don't conflict with real filter types\r
1756  * below, in case they are supplied instead of the #defined constants.\r
1757  * These values should NOT be changed.\r
1758  */\r
1759 #define PNG_NO_FILTERS     0x00\r
1760 #define PNG_FILTER_NONE    0x08\r
1761 #define PNG_FILTER_SUB     0x10\r
1762 #define PNG_FILTER_UP      0x20\r
1763 #define PNG_FILTER_AVG     0x40\r
1764 #define PNG_FILTER_PAETH   0x80\r
1765 #define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \\r
1766                          PNG_FILTER_AVG | PNG_FILTER_PAETH)\r
1767 \r
1768 /* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.\r
1769  * These defines should NOT be changed.\r
1770  */\r
1771 #define PNG_FILTER_VALUE_NONE  0\r
1772 #define PNG_FILTER_VALUE_SUB   1\r
1773 #define PNG_FILTER_VALUE_UP    2\r
1774 #define PNG_FILTER_VALUE_AVG   3\r
1775 #define PNG_FILTER_VALUE_PAETH 4\r
1776 #define PNG_FILTER_VALUE_LAST  5\r
1777 \r
1778 #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* EXPERIMENTAL */\r
1779 /* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_\r
1780  * defines, either the default (minimum-sum-of-absolute-differences), or\r
1781  * the experimental method (weighted-minimum-sum-of-absolute-differences).\r
1782  *\r
1783  * Weights are factors >= 1.0, indicating how important it is to keep the\r
1784  * filter type consistent between rows.  Larger numbers mean the current\r
1785  * filter is that many times as likely to be the same as the "num_weights"\r
1786  * previous filters.  This is cumulative for each previous row with a weight.\r
1787  * There needs to be "num_weights" values in "filter_weights", or it can be\r
1788  * NULL if the weights aren't being specified.  Weights have no influence on\r
1789  * the selection of the first row filter.  Well chosen weights can (in theory)\r
1790  * improve the compression for a given image.\r
1791  *\r
1792  * Costs are factors >= 1.0 indicating the relative decoding costs of a\r
1793  * filter type.  Higher costs indicate more decoding expense, and are\r
1794  * therefore less likely to be selected over a filter with lower computational\r
1795  * costs.  There needs to be a value in "filter_costs" for each valid filter\r
1796  * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't\r
1797  * setting the costs.  Costs try to improve the speed of decompression without\r
1798  * unduly increasing the compressed image size.\r
1799  *\r
1800  * A negative weight or cost indicates the default value is to be used, and\r
1801  * values in the range [0.0, 1.0) indicate the value is to remain unchanged.\r
1802  * The default values for both weights and costs are currently 1.0, but may\r
1803  * change if good general weighting/cost heuristics can be found.  If both\r
1804  * the weights and costs are set to 1.0, this degenerates the WEIGHTED method\r
1805  * to the UNWEIGHTED method, but with added encoding time/computation.\r
1806  */\r
1807 #ifdef PNG_FLOATING_POINT_SUPPORTED\r
1808 extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr,\r
1809    int heuristic_method, int num_weights, png_doublep filter_weights,\r
1810    png_doublep filter_costs));\r
1811 #endif\r
1812 #endif /*  PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */\r
1813 \r
1814 /* Heuristic used for row filter selection.  These defines should NOT be\r
1815  * changed.\r
1816  */\r
1817 #define PNG_FILTER_HEURISTIC_DEFAULT    0  /* Currently "UNWEIGHTED" */\r
1818 #define PNG_FILTER_HEURISTIC_UNWEIGHTED 1  /* Used by libpng < 0.95 */\r
1819 #define PNG_FILTER_HEURISTIC_WEIGHTED   2  /* Experimental feature */\r
1820 #define PNG_FILTER_HEURISTIC_LAST       3  /* Not a valid value */\r
1821 \r
1822 /* Set the library compression level.  Currently, valid values range from\r
1823  * 0 - 9, corresponding directly to the zlib compression levels 0 - 9\r
1824  * (0 - no compression, 9 - "maximal" compression).  Note that tests have\r
1825  * shown that zlib compression levels 3-6 usually perform as well as level 9\r
1826  * for PNG images, and do considerably fewer caclulations.  In the future,\r
1827  * these values may not correspond directly to the zlib compression levels.\r
1828  */\r
1829 extern PNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr,\r
1830    int level));\r
1831 \r
1832 extern PNG_EXPORT(void,png_set_compression_mem_level)\r
1833    PNGARG((png_structp png_ptr, int mem_level));\r
1834 \r
1835 extern PNG_EXPORT(void,png_set_compression_strategy)\r
1836    PNGARG((png_structp png_ptr, int strategy));\r
1837 \r
1838 extern PNG_EXPORT(void,png_set_compression_window_bits)\r
1839    PNGARG((png_structp png_ptr, int window_bits));\r
1840 \r
1841 extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr,\r
1842    int method));\r
1843 \r
1844 /* These next functions are called for input/output, memory, and error\r
1845  * handling.  They are in the file pngrio.c, pngwio.c, and pngerror.c,\r
1846  * and call standard C I/O routines such as fread(), fwrite(), and\r
1847  * fprintf().  These functions can be made to use other I/O routines\r
1848  * at run time for those applications that need to handle I/O in a\r
1849  * different manner by calling png_set_???_fn().  See libpng.txt for\r
1850  * more information.\r
1851  */\r
1852 \r
1853 #if !defined(PNG_NO_STDIO)\r
1854 /* Initialize the input/output for the PNG file to the default functions. */\r
1855 extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, png_FILE_p fp));\r
1856 #endif\r
1857 \r
1858 /* Replace the (error and abort), and warning functions with user\r
1859  * supplied functions.  If no messages are to be printed you must still\r
1860  * write and use replacement functions. The replacement error_fn should\r
1861  * still do a longjmp to the last setjmp location if you are using this\r
1862  * method of error handling.  If error_fn or warning_fn is NULL, the\r
1863  * default function will be used.\r
1864  */\r
1865 \r
1866 extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr,\r
1867    png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn));\r
1868 \r
1869 /* Return the user pointer associated with the error functions */\r
1870 extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr));\r
1871 \r
1872 /* Replace the default data output functions with a user supplied one(s).\r
1873  * If buffered output is not used, then output_flush_fn can be set to NULL.\r
1874  * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time\r
1875  * output_flush_fn will be ignored (and thus can be NULL).\r
1876  */\r
1877 extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr,\r
1878    png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));\r
1879 \r
1880 /* Replace the default data input function with a user supplied one. */\r
1881 extern PNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr,\r
1882    png_voidp io_ptr, png_rw_ptr read_data_fn));\r
1883 \r
1884 /* Return the user pointer associated with the I/O functions */\r
1885 extern PNG_EXPORT(png_voidp,png_get_io_ptr) PNGARG((png_structp png_ptr));\r
1886 \r
1887 extern PNG_EXPORT(void,png_set_read_status_fn) PNGARG((png_structp png_ptr,\r
1888    png_read_status_ptr read_row_fn));\r
1889 \r
1890 extern PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr,\r
1891    png_write_status_ptr write_row_fn));\r
1892 \r
1893 #ifdef PNG_USER_MEM_SUPPORTED\r
1894 /* Replace the default memory allocation functions with user supplied one(s). */\r
1895 extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr,\r
1896    png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn));\r
1897 /* Return the user pointer associated with the memory functions */\r
1898 extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr));\r
1899 #endif\r
1900 \r
1901 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \\r
1902     defined(PNG_LEGACY_SUPPORTED)\r
1903 extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp\r
1904    png_ptr, png_user_transform_ptr read_user_transform_fn));\r
1905 #endif\r
1906 \r
1907 #if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \\r
1908     defined(PNG_LEGACY_SUPPORTED)\r
1909 extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp\r
1910    png_ptr, png_user_transform_ptr write_user_transform_fn));\r
1911 #endif\r
1912 \r
1913 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \\r
1914     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \\r
1915     defined(PNG_LEGACY_SUPPORTED)\r
1916 extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp\r
1917    png_ptr, png_voidp user_transform_ptr, int user_transform_depth,\r
1918    int user_transform_channels));\r
1919 /* Return the user pointer associated with the user transform functions */\r
1920 extern PNG_EXPORT(png_voidp,png_get_user_transform_ptr)\r
1921    PNGARG((png_structp png_ptr));\r
1922 #endif\r
1923 \r
1924 #ifdef PNG_USER_CHUNKS_SUPPORTED\r
1925 extern PNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr,\r
1926    png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn));\r
1927 extern PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_structp\r
1928    png_ptr));\r
1929 #endif\r
1930 \r
1931 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED\r
1932 /* Sets the function callbacks for the push reader, and a pointer to a\r
1933  * user-defined structure available to the callback functions.\r
1934  */\r
1935 extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr,\r
1936    png_voidp progressive_ptr,\r
1937    png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,\r
1938    png_progressive_end_ptr end_fn));\r
1939 \r
1940 /* returns the user pointer associated with the push read functions */\r
1941 extern PNG_EXPORT(png_voidp,png_get_progressive_ptr)\r
1942    PNGARG((png_structp png_ptr));\r
1943 \r
1944 /* function to be called when data becomes available */\r
1945 extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr,\r
1946    png_infop info_ptr, png_bytep buffer, png_size_t buffer_size));\r
1947 \r
1948 /* function that combines rows.  Not very much different than the\r
1949  * png_combine_row() call.  Is this even used?????\r
1950  */\r
1951 extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr,\r
1952    png_bytep old_row, png_bytep new_row));\r
1953 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */\r
1954 \r
1955 extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr,\r
1956    png_uint_32 size));\r
1957 \r
1958 #if defined(PNG_1_0_X)\r
1959 #  define png_malloc_warn png_malloc\r
1960 #else\r
1961 /* Added at libpng version 1.2.4 */\r
1962 extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr,\r
1963    png_uint_32 size));\r
1964 #endif\r
1965 \r
1966 /* frees a pointer allocated by png_malloc() */\r
1967 extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));\r
1968 \r
1969 #if defined(PNG_1_0_X)\r
1970 /* Function to allocate memory for zlib. */\r
1971 extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items,\r
1972    uInt size));\r
1973 \r
1974 /* Function to free memory for zlib */\r
1975 extern PNG_EXPORT(void,png_zfree) PNGARG((voidpf png_ptr, voidpf ptr));\r
1976 #endif\r
1977 \r
1978 /* Free data that was allocated internally */\r
1979 extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr,\r
1980    png_infop info_ptr, png_uint_32 free_me, int num));\r
1981 #ifdef PNG_FREE_ME_SUPPORTED\r
1982 /* Reassign responsibility for freeing existing data, whether allocated\r
1983  * by libpng or by the application */\r
1984 extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr,\r
1985    png_infop info_ptr, int freer, png_uint_32 mask));\r
1986 #endif\r
1987 /* assignments for png_data_freer */\r
1988 #define PNG_DESTROY_WILL_FREE_DATA 1\r
1989 #define PNG_SET_WILL_FREE_DATA 1\r
1990 #define PNG_USER_WILL_FREE_DATA 2\r
1991 /* Flags for png_ptr->free_me and info_ptr->free_me */\r
1992 #define PNG_FREE_HIST 0x0008\r
1993 #define PNG_FREE_ICCP 0x0010\r
1994 #define PNG_FREE_SPLT 0x0020\r
1995 #define PNG_FREE_ROWS 0x0040\r
1996 #define PNG_FREE_PCAL 0x0080\r
1997 #define PNG_FREE_SCAL 0x0100\r
1998 #define PNG_FREE_UNKN 0x0200\r
1999 #define PNG_FREE_LIST 0x0400\r
2000 #define PNG_FREE_PLTE 0x1000\r
2001 #define PNG_FREE_TRNS 0x2000\r
2002 #define PNG_FREE_TEXT 0x4000\r
2003 #define PNG_FREE_ALL  0x7fff\r
2004 #define PNG_FREE_MUL  0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */\r
2005 \r
2006 #ifdef PNG_USER_MEM_SUPPORTED\r
2007 extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr,\r
2008    png_uint_32 size));\r
2009 extern PNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr,\r
2010    png_voidp ptr));\r
2011 #endif\r
2012 \r
2013 extern PNG_EXPORT(png_voidp,png_memcpy_check) PNGARG((png_structp png_ptr,\r
2014    png_voidp s1, png_voidp s2, png_uint_32 size));\r
2015 \r
2016 extern PNG_EXPORT(png_voidp,png_memset_check) PNGARG((png_structp png_ptr,\r
2017    png_voidp s1, int value, png_uint_32 size));\r
2018 \r
2019 #if defined(USE_FAR_KEYWORD)  /* memory model conversion function */\r
2020 extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,\r
2021    int check));\r
2022 #endif /* USE_FAR_KEYWORD */\r
2023 \r
2024 /* Fatal error in PNG image of libpng - can't continue */\r
2025 extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr,\r
2026    png_const_charp error_message));\r
2027 \r
2028 /* The same, but the chunk name is prepended to the error string. */\r
2029 extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr,\r
2030    png_const_charp error_message));\r
2031 \r
2032 /* Non-fatal error in libpng.  Can continue, but may have a problem. */\r
2033 extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr,\r
2034    png_const_charp warning_message));\r
2035 \r
2036 /* Non-fatal error in libpng, chunk name is prepended to message. */\r
2037 extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr,\r
2038    png_const_charp warning_message));\r
2039 \r
2040 /* The png_set_<chunk> functions are for storing values in the png_info_struct.\r
2041  * Similarly, the png_get_<chunk> calls are used to read values from the\r
2042  * png_info_struct, either storing the parameters in the passed variables, or\r
2043  * setting pointers into the png_info_struct where the data is stored.  The\r
2044  * png_get_<chunk> functions return a non-zero value if the data was available\r
2045  * in info_ptr, or return zero and do not change any of the parameters if the\r
2046  * data was not available.\r
2047  *\r
2048  * These functions should be used instead of directly accessing png_info\r
2049  * to avoid problems with future changes in the size and internal layout of\r
2050  * png_info_struct.\r
2051  */\r
2052 /* Returns "flag" if chunk data is valid in info_ptr. */\r
2053 extern PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_structp png_ptr,\r
2054 png_infop info_ptr, png_uint_32 flag));\r
2055 \r
2056 /* Returns number of bytes needed to hold a transformed row. */\r
2057 extern PNG_EXPORT(png_uint_32,png_get_rowbytes) PNGARG((png_structp png_ptr,\r
2058 png_infop info_ptr));\r
2059 \r
2060 #if defined(PNG_INFO_IMAGE_SUPPORTED)\r
2061 /* Returns row_pointers, which is an array of pointers to scanlines that was\r
2062 returned from png_read_png(). */\r
2063 extern PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_structp png_ptr,\r
2064 png_infop info_ptr));\r
2065 /* Set row_pointers, which is an array of pointers to scanlines for use\r
2066 by png_write_png(). */\r
2067 extern PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr,\r
2068    png_infop info_ptr, png_bytepp row_pointers));\r
2069 #endif\r
2070 \r
2071 /* Returns number of color channels in image. */\r
2072 extern PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_structp png_ptr,\r
2073 png_infop info_ptr));\r
2074 \r
2075 #ifdef PNG_EASY_ACCESS_SUPPORTED\r
2076 /* Returns image width in pixels. */\r
2077 extern PNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_structp\r
2078 png_ptr, png_infop info_ptr));\r
2079 \r
2080 /* Returns image height in pixels. */\r
2081 extern PNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_structp\r
2082 png_ptr, png_infop info_ptr));\r
2083 \r
2084 /* Returns image bit_depth. */\r
2085 extern PNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_structp\r
2086 png_ptr, png_infop info_ptr));\r
2087 \r
2088 /* Returns image color_type. */\r
2089 extern PNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_structp\r
2090 png_ptr, png_infop info_ptr));\r
2091 \r
2092 /* Returns image filter_type. */\r
2093 extern PNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_structp\r
2094 png_ptr, png_infop info_ptr));\r
2095 \r
2096 /* Returns image interlace_type. */\r
2097 extern PNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_structp\r
2098 png_ptr, png_infop info_ptr));\r
2099 \r
2100 /* Returns image compression_type. */\r
2101 extern PNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_structp\r
2102 png_ptr, png_infop info_ptr));\r
2103 \r
2104 /* Returns image resolution in pixels per meter, from pHYs chunk data. */\r
2105 extern PNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_structp\r
2106 png_ptr, png_infop info_ptr));\r
2107 extern PNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_structp\r
2108 png_ptr, png_infop info_ptr));\r
2109 extern PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_structp\r
2110 png_ptr, png_infop info_ptr));\r
2111 \r
2112 /* Returns pixel aspect ratio, computed from pHYs chunk data.  */\r
2113 #ifdef PNG_FLOATING_POINT_SUPPORTED\r
2114 extern PNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_structp\r
2115 png_ptr, png_infop info_ptr));\r
2116 #endif\r
2117 \r
2118 /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */\r
2119 extern PNG_EXPORT(png_int_32, png_get_x_offset_pixels) PNGARG((png_structp\r
2120 png_ptr, png_infop info_ptr));\r
2121 extern PNG_EXPORT(png_int_32, png_get_y_offset_pixels) PNGARG((png_structp\r
2122 png_ptr, png_infop info_ptr));\r
2123 extern PNG_EXPORT(png_int_32, png_get_x_offset_microns) PNGARG((png_structp\r
2124 png_ptr, png_infop info_ptr));\r
2125 extern PNG_EXPORT(png_int_32, png_get_y_offset_microns) PNGARG((png_structp\r
2126 png_ptr, png_infop info_ptr));\r
2127 \r
2128 #endif /* PNG_EASY_ACCESS_SUPPORTED */\r
2129 \r
2130 /* Returns pointer to signature string read from PNG header */\r
2131 extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr,\r
2132 png_infop info_ptr));\r
2133 \r
2134 #if defined(PNG_bKGD_SUPPORTED)\r
2135 extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr,\r
2136    png_infop info_ptr, png_color_16p *background));\r
2137 #endif\r
2138 \r
2139 #if defined(PNG_bKGD_SUPPORTED)\r
2140 extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr,\r
2141    png_infop info_ptr, png_color_16p background));\r
2142 #endif\r
2143 \r
2144 #if defined(PNG_cHRM_SUPPORTED)\r
2145 #ifdef PNG_FLOATING_POINT_SUPPORTED\r
2146 extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr,\r
2147    png_infop info_ptr, double *white_x, double *white_y, double *red_x,\r
2148    double *red_y, double *green_x, double *green_y, double *blue_x,\r
2149    double *blue_y));\r
2150 #endif\r
2151 #ifdef PNG_FIXED_POINT_SUPPORTED\r
2152 extern PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_structp png_ptr,\r
2153    png_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point\r
2154    *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y,\r
2155    png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point\r
2156    *int_blue_x, png_fixed_point *int_blue_y));\r
2157 #endif\r
2158 #endif\r
2159 \r
2160 #if defined(PNG_cHRM_SUPPORTED)\r
2161 #ifdef PNG_FLOATING_POINT_SUPPORTED\r
2162 extern PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr,\r
2163    png_infop info_ptr, double white_x, double white_y, double red_x,\r
2164    double red_y, double green_x, double green_y, double blue_x, double blue_y));\r
2165 #endif\r
2166 #ifdef PNG_FIXED_POINT_SUPPORTED\r
2167 extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr,\r
2168    png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y,\r
2169    png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point\r
2170    int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,\r
2171    png_fixed_point int_blue_y));\r
2172 #endif\r
2173 #endif\r
2174 \r
2175 #if defined(PNG_gAMA_SUPPORTED)\r
2176 #ifdef PNG_FLOATING_POINT_SUPPORTED\r
2177 extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr,\r
2178    png_infop info_ptr, double *file_gamma));\r
2179 #endif\r
2180 extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_structp png_ptr,\r
2181    png_infop info_ptr, png_fixed_point *int_file_gamma));\r
2182 #endif\r
2183 \r
2184 #if defined(PNG_gAMA_SUPPORTED)\r
2185 #ifdef PNG_FLOATING_POINT_SUPPORTED\r
2186 extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr,\r
2187    png_infop info_ptr, double file_gamma));\r
2188 #endif\r
2189 extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr,\r
2190    png_infop info_ptr, png_fixed_point int_file_gamma));\r
2191 #endif\r
2192 \r
2193 #if defined(PNG_hIST_SUPPORTED)\r
2194 extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr,\r
2195    png_infop info_ptr, png_uint_16p *hist));\r
2196 #endif\r
2197 \r
2198 #if defined(PNG_hIST_SUPPORTED)\r
2199 extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr,\r
2200    png_infop info_ptr, png_uint_16p hist));\r
2201 #endif\r
2202 \r
2203 extern PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr,\r
2204    png_infop info_ptr, png_uint_32 *width, png_uint_32 *height,\r
2205    int *bit_depth, int *color_type, int *interlace_method,\r
2206    int *compression_method, int *filter_method));\r
2207 \r
2208 extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr,\r
2209    png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth,\r
2210    int color_type, int interlace_method, int compression_method,\r
2211    int filter_method));\r
2212 \r
2213 #if defined(PNG_oFFs_SUPPORTED)\r
2214 extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr,\r
2215    png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,\r
2216    int *unit_type));\r
2217 #endif\r
2218 \r
2219 #if defined(PNG_oFFs_SUPPORTED)\r
2220 extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr,\r
2221    png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y,\r
2222    int unit_type));\r
2223 #endif\r
2224 \r
2225 #if defined(PNG_pCAL_SUPPORTED)\r
2226 extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr,\r
2227    png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1,\r
2228    int *type, int *nparams, png_charp *units, png_charpp *params));\r
2229 #endif\r
2230 \r
2231 #if defined(PNG_pCAL_SUPPORTED)\r
2232 extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr,\r
2233    png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1,\r
2234    int type, int nparams, png_charp units, png_charpp params));\r
2235 #endif\r
2236 \r
2237 #if defined(PNG_pHYs_SUPPORTED)\r
2238 extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr,\r
2239    png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));\r
2240 #endif\r
2241 \r
2242 #if defined(PNG_pHYs_SUPPORTED)\r
2243 extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr,\r
2244    png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type));\r
2245 #endif\r
2246 \r
2247 extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr,\r
2248    png_infop info_ptr, png_colorp *palette, int *num_palette));\r
2249 \r
2250 extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr,\r
2251    png_infop info_ptr, png_colorp palette, int num_palette));\r
2252 \r
2253 #if defined(PNG_sBIT_SUPPORTED)\r
2254 extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr,\r
2255    png_infop info_ptr, png_color_8p *sig_bit));\r
2256 #endif\r
2257 \r
2258 #if defined(PNG_sBIT_SUPPORTED)\r
2259 extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr,\r
2260    png_infop info_ptr, png_color_8p sig_bit));\r
2261 #endif\r
2262 \r
2263 #if defined(PNG_sRGB_SUPPORTED)\r
2264 extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr,\r
2265    png_infop info_ptr, int *intent));\r
2266 #endif\r
2267 \r
2268 #if defined(PNG_sRGB_SUPPORTED)\r
2269 extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr,\r
2270    png_infop info_ptr, int intent));\r
2271 extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr,\r
2272    png_infop info_ptr, int intent));\r
2273 #endif\r
2274 \r
2275 #if defined(PNG_iCCP_SUPPORTED)\r
2276 extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr,\r
2277    png_infop info_ptr, png_charpp name, int *compression_type,\r
2278    png_charpp profile, png_uint_32 *proflen));\r
2279    /* Note to maintainer: profile should be png_bytepp */\r
2280 #endif\r
2281 \r
2282 #if defined(PNG_iCCP_SUPPORTED)\r
2283 extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr,\r
2284    png_infop info_ptr, png_charp name, int compression_type,\r
2285    png_charp profile, png_uint_32 proflen));\r
2286    /* Note to maintainer: profile should be png_bytep */\r
2287 #endif\r
2288 \r
2289 #if defined(PNG_sPLT_SUPPORTED)\r
2290 extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr,\r
2291    png_infop info_ptr, png_sPLT_tpp entries));\r
2292 #endif\r
2293 \r
2294 #if defined(PNG_sPLT_SUPPORTED)\r
2295 extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr,\r
2296    png_infop info_ptr, png_sPLT_tp entries, int nentries));\r
2297 #endif\r
2298 \r
2299 #if defined(PNG_TEXT_SUPPORTED)\r
2300 /* png_get_text also returns the number of text chunks in *num_text */\r
2301 extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr,\r
2302    png_infop info_ptr, png_textp *text_ptr, int *num_text));\r
2303 #endif\r
2304 \r
2305 /*\r
2306  *  Note while png_set_text() will accept a structure whose text,\r
2307  *  language, and  translated keywords are NULL pointers, the structure\r
2308  *  returned by png_get_text will always contain regular\r
2309  *  zero-terminated C strings.  They might be empty strings but\r
2310  *  they will never be NULL pointers.\r
2311  */\r
2312 \r
2313 #if defined(PNG_TEXT_SUPPORTED)\r
2314 extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr,\r
2315    png_infop info_ptr, png_textp text_ptr, int num_text));\r
2316 #endif\r
2317 \r
2318 #if defined(PNG_tIME_SUPPORTED)\r
2319 extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr,\r
2320    png_infop info_ptr, png_timep *mod_time));\r
2321 #endif\r
2322 \r
2323 #if defined(PNG_tIME_SUPPORTED)\r
2324 extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr,\r
2325    png_infop info_ptr, png_timep mod_time));\r
2326 #endif\r
2327 \r
2328 #if defined(PNG_tRNS_SUPPORTED)\r
2329 extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr,\r
2330    png_infop info_ptr, png_bytep *trans, int *num_trans,\r
2331    png_color_16p *trans_values));\r
2332 #endif\r
2333 \r
2334 #if defined(PNG_tRNS_SUPPORTED)\r
2335 extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,\r
2336    png_infop info_ptr, png_bytep trans, int num_trans,\r
2337    png_color_16p trans_values));\r
2338 #endif\r
2339 \r
2340 #if defined(PNG_tRNS_SUPPORTED)\r
2341 #endif\r
2342 \r
2343 #if defined(PNG_sCAL_SUPPORTED)\r
2344 #ifdef PNG_FLOATING_POINT_SUPPORTED\r
2345 extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr,\r
2346    png_infop info_ptr, int *unit, double *width, double *height));\r
2347 #else\r
2348 #ifdef PNG_FIXED_POINT_SUPPORTED\r
2349 extern PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr,\r
2350    png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight));\r
2351 #endif\r
2352 #endif\r
2353 #endif /* PNG_sCAL_SUPPORTED */\r
2354 \r
2355 #if defined(PNG_sCAL_SUPPORTED)\r
2356 #ifdef PNG_FLOATING_POINT_SUPPORTED\r
2357 extern PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr,\r
2358    png_infop info_ptr, int unit, double width, double height));\r
2359 #else\r
2360 #ifdef PNG_FIXED_POINT_SUPPORTED\r
2361 extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr,\r
2362    png_infop info_ptr, int unit, png_charp swidth, png_charp sheight));\r
2363 #endif\r
2364 #endif\r
2365 #endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */\r
2366 \r
2367 #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)\r
2368 /* provide a list of chunks and how they are to be handled, if the built-in\r
2369    handling or default unknown chunk handling is not desired.  Any chunks not\r
2370    listed will be handled in the default manner.  The IHDR and IEND chunks\r
2371    must not be listed.\r
2372       keep = 0: follow default behavour\r
2373            = 1: do not keep\r
2374            = 2: keep only if safe-to-copy\r
2375            = 3: keep even if unsafe-to-copy\r
2376 */\r
2377 extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp\r
2378    png_ptr, int keep, png_bytep chunk_list, int num_chunks));\r
2379 extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr,\r
2380    png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns));\r
2381 extern PNG_EXPORT(void, png_set_unknown_chunk_location)\r
2382    PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location));\r
2383 extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp\r
2384    png_ptr, png_infop info_ptr, png_unknown_chunkpp entries));\r
2385 #endif\r
2386 #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED\r
2387 PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep\r
2388    chunk_name));\r
2389 #endif\r
2390 \r
2391 /* Png_free_data() will turn off the "valid" flag for anything it frees.\r
2392    If you need to turn it off for a chunk that your application has freed,\r
2393    you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); */\r
2394 extern PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr,\r
2395    png_infop info_ptr, int mask));\r
2396 \r
2397 #if defined(PNG_INFO_IMAGE_SUPPORTED)\r
2398 /* The "params" pointer is currently not used and is for future expansion. */\r
2399 extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr,\r
2400                         png_infop info_ptr,\r
2401                         int transforms,\r
2402                         png_voidp params));\r
2403 extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,\r
2404                         png_infop info_ptr,\r
2405                         int transforms,\r
2406                         png_voidp params));\r
2407 #endif\r
2408 \r
2409 /* Define PNG_DEBUG at compile time for debugging information.  Higher\r
2410  * numbers for PNG_DEBUG mean more debugging information.  This has\r
2411  * only been added since version 0.95 so it is not implemented throughout\r
2412  * libpng yet, but more support will be added as needed.\r
2413  */\r
2414 #ifdef PNG_DEBUG\r
2415 #if (PNG_DEBUG > 0)\r
2416 #if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)\r
2417 #include <crtdbg.h>\r
2418 #if (PNG_DEBUG > 1)\r
2419 #define png_debug(l,m)  _RPT0(_CRT_WARN,m)\r
2420 #define png_debug1(l,m,p1)  _RPT1(_CRT_WARN,m,p1)\r
2421 #define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m,p1,p2)\r
2422 #endif\r
2423 #else /* PNG_DEBUG_FILE || !_MSC_VER */\r
2424 #ifndef PNG_DEBUG_FILE\r
2425 #define PNG_DEBUG_FILE stderr\r
2426 #endif /* PNG_DEBUG_FILE */\r
2427 #if (PNG_DEBUG > 1)\r
2428 #define png_debug(l,m) \\r
2429 { \\r
2430      int num_tabs=l; \\r
2431      fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \\r
2432        (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \\r
2433 }\r
2434 #define png_debug1(l,m,p1) \\r
2435 { \\r
2436      int num_tabs=l; \\r
2437      fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \\r
2438        (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \\r
2439 }\r
2440 #define png_debug2(l,m,p1,p2) \\r
2441 { \\r
2442      int num_tabs=l; \\r
2443      fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \\r
2444        (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \\r
2445 }\r
2446 #endif /* (PNG_DEBUG > 1) */\r
2447 #endif /* _MSC_VER */\r
2448 #endif /* (PNG_DEBUG > 0) */\r
2449 #endif /* PNG_DEBUG */\r
2450 #ifndef png_debug\r
2451 #define png_debug(l, m)\r
2452 #endif\r
2453 #ifndef png_debug1\r
2454 #define png_debug1(l, m, p1)\r
2455 #endif\r
2456 #ifndef png_debug2\r
2457 #define png_debug2(l, m, p1, p2)\r
2458 #endif\r
2459 \r
2460 #if 0\r
2461 extern PNG_EXPORT(png_bytep,png_sig_bytes) PNGARG((void));\r
2462 #endif\r
2463 \r
2464 extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr));\r
2465 extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr));\r
2466 extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr));\r
2467 extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));\r
2468 \r
2469 #ifdef PNG_MNG_FEATURES_SUPPORTED\r
2470 extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp\r
2471    png_ptr, png_uint_32 mng_features_permitted));\r
2472 #endif\r
2473 \r
2474 /* For use in png_set_keep_unknown, added to version 1.2.6 */\r
2475 #define PNG_HANDLE_CHUNK_AS_DEFAULT   0\r
2476 #define PNG_HANDLE_CHUNK_NEVER        1\r
2477 #define PNG_HANDLE_CHUNK_IF_SAFE      2\r
2478 #define PNG_HANDLE_CHUNK_ALWAYS       3\r
2479 \r
2480 /* Added to version 1.2.0 */\r
2481 #if defined(PNG_ASSEMBLER_CODE_SUPPORTED)\r
2482 #define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED  0x01  /* not user-settable */\r
2483 #define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU    0x02  /* not user-settable */\r
2484 #define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW  0x04\r
2485 #define PNG_ASM_FLAG_MMX_READ_INTERLACE    0x08\r
2486 #define PNG_ASM_FLAG_MMX_READ_FILTER_SUB   0x10\r
2487 #define PNG_ASM_FLAG_MMX_READ_FILTER_UP    0x20\r
2488 #define PNG_ASM_FLAG_MMX_READ_FILTER_AVG   0x40\r
2489 #define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH 0x80\r
2490 #define PNG_ASM_FLAGS_INITIALIZED          0x80000000  /* not user-settable */\r
2491 \r
2492 #define PNG_MMX_READ_FLAGS ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW  \\r
2493                            | PNG_ASM_FLAG_MMX_READ_INTERLACE    \\r
2494                            | PNG_ASM_FLAG_MMX_READ_FILTER_SUB   \\r
2495                            | PNG_ASM_FLAG_MMX_READ_FILTER_UP    \\r
2496                            | PNG_ASM_FLAG_MMX_READ_FILTER_AVG   \\r
2497                            | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH )\r
2498 #define PNG_MMX_WRITE_FLAGS ( 0 )\r
2499 \r
2500 #define PNG_MMX_FLAGS ( PNG_ASM_FLAG_MMX_SUPPORT_COMPILED \\r
2501                       | PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU   \\r
2502                       | PNG_MMX_READ_FLAGS                \\r
2503                       | PNG_MMX_WRITE_FLAGS )\r
2504 \r
2505 #define PNG_SELECT_READ   1\r
2506 #define PNG_SELECT_WRITE  2\r
2507 \r
2508 #if !defined(PNG_1_0_X)\r
2509 /* pngget.c */\r
2510 extern PNG_EXPORT(png_uint_32,png_get_mmx_flagmask)\r
2511    PNGARG((int flag_select, int *compilerID));\r
2512 \r
2513 /* pngget.c */\r
2514 extern PNG_EXPORT(png_uint_32,png_get_asm_flagmask)\r
2515    PNGARG((int flag_select));\r
2516 \r
2517 /* pngget.c */\r
2518 extern PNG_EXPORT(png_uint_32,png_get_asm_flags)\r
2519    PNGARG((png_structp png_ptr));\r
2520 \r
2521 /* pngget.c */\r
2522 extern PNG_EXPORT(png_byte,png_get_mmx_bitdepth_threshold)\r
2523    PNGARG((png_structp png_ptr));\r
2524 \r
2525 /* pngget.c */\r
2526 extern PNG_EXPORT(png_uint_32,png_get_mmx_rowbytes_threshold)\r
2527    PNGARG((png_structp png_ptr));\r
2528 \r
2529 /* pngset.c */\r
2530 extern PNG_EXPORT(void,png_set_asm_flags)\r
2531    PNGARG((png_structp png_ptr, png_uint_32 asm_flags));\r
2532 \r
2533 /* pngset.c */\r
2534 extern PNG_EXPORT(void,png_set_mmx_thresholds)\r
2535    PNGARG((png_structp png_ptr, png_byte mmx_bitdepth_threshold,\r
2536    png_uint_32 mmx_rowbytes_threshold));\r
2537 \r
2538 #endif /* PNG_1_0_X */\r
2539 #endif /* PNG_ASSEMBLER_CODE_SUPPORTED */\r
2540 \r
2541 #if !defined(PNG_1_0_X)\r
2542 /* png.c, pnggccrd.c, or pngvcrd.c */\r
2543 extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));\r
2544 \r
2545 /* Strip the prepended error numbers ("#nnn ") from error and warning\r
2546  * messages before passing them to the error or warning handler. */\r
2547 #ifdef PNG_ERROR_NUMBERS_SUPPORTED\r
2548 extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp\r
2549    png_ptr, png_uint_32 strip_mode));\r
2550 #endif\r
2551 \r
2552 #endif /* PNG_1_0_X */\r
2553 \r
2554 /* Added at libpng-1.2.6 */\r
2555 #ifdef PNG_SET_USER_LIMITS_SUPPORTED\r
2556 extern PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp\r
2557    png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max));\r
2558 extern PNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_structp\r
2559    png_ptr));\r
2560 extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp\r
2561    png_ptr));\r
2562 #endif\r
2563 \r
2564 /* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */\r
2565 \r
2566 #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED\r
2567 /* With these routines we avoid an integer divide, which will be slower on\r
2568  * most machines.  However, it does take more operations than the corresponding\r
2569  * divide method, so it may be slower on a few RISC systems.  There are two\r
2570  * shifts (by 8 or 16 bits) and an addition, versus a single integer divide.\r
2571  *\r
2572  * Note that the rounding factors are NOT supposed to be the same!  128 and\r
2573  * 32768 are correct for the NODIV code; 127 and 32767 are correct for the\r
2574  * standard method.\r
2575  *\r
2576  * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ]\r
2577  */\r
2578 \r
2579  /* fg and bg should be in `gamma 1.0' space; alpha is the opacity          */\r
2580 \r
2581 #  define png_composite(composite, fg, alpha, bg)                            \\r
2582      { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) * (png_uint_16)(alpha) \\r
2583                         +        (png_uint_16)(bg)*(png_uint_16)(255 -       \\r
2584                         (png_uint_16)(alpha)) + (png_uint_16)128);           \\r
2585        (composite) = (png_byte)((temp + (temp >> 8)) >> 8); }\r
2586 \r
2587 #  define png_composite_16(composite, fg, alpha, bg)                         \\r
2588      { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) * (png_uint_32)(alpha) \\r
2589                         + (png_uint_32)(bg)*(png_uint_32)(65535L -           \\r
2590                         (png_uint_32)(alpha)) + (png_uint_32)32768L);        \\r
2591        (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }\r
2592 \r
2593 #else  /* standard method using integer division */\r
2594 \r
2595 #  define png_composite(composite, fg, alpha, bg)                            \\r
2596      (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) +    \\r
2597        (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) +       \\r
2598        (png_uint_16)127) / 255)\r
2599 \r
2600 #  define png_composite_16(composite, fg, alpha, bg)                         \\r
2601      (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \\r
2602        (png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) +      \\r
2603        (png_uint_32)32767) / (png_uint_32)65535L)\r
2604 \r
2605 #endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */\r
2606 \r
2607 /* Inline macros to do direct reads of bytes from the input buffer.  These\r
2608  * require that you are using an architecture that uses PNG byte ordering\r
2609  * (MSB first) and supports unaligned data storage.  I think that PowerPC\r
2610  * in big-endian mode and 680x0 are the only ones that will support this.\r
2611  * The x86 line of processors definitely do not.  The png_get_int_32()\r
2612  * routine also assumes we are using two's complement format for negative\r
2613  * values, which is almost certainly true.\r
2614  */\r
2615 #if defined(PNG_READ_BIG_ENDIAN_SUPPORTED)\r
2616 #  define png_get_uint_32(buf) ( *((png_uint_32p) (buf)))\r
2617 #  define png_get_uint_16(buf) ( *((png_uint_16p) (buf)))\r
2618 #  define png_get_int_32(buf)  ( *((png_int_32p)  (buf)))\r
2619 #else\r
2620 extern PNG_EXPORT(png_uint_32,png_get_uint_32) PNGARG((png_bytep buf));\r
2621 extern PNG_EXPORT(png_uint_16,png_get_uint_16) PNGARG((png_bytep buf));\r
2622 extern PNG_EXPORT(png_int_32,png_get_int_32) PNGARG((png_bytep buf));\r
2623 #endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */\r
2624 extern PNG_EXPORT(png_uint_32,png_get_uint_31)\r
2625   PNGARG((png_structp png_ptr, png_bytep buf));\r
2626 /* No png_get_int_16 -- may be added if there's a real need for it. */\r
2627 \r
2628 /* Place a 32-bit number into a buffer in PNG byte order (big-endian).\r
2629  */\r
2630 extern PNG_EXPORT(void,png_save_uint_32)\r
2631    PNGARG((png_bytep buf, png_uint_32 i));\r
2632 extern PNG_EXPORT(void,png_save_int_32)\r
2633    PNGARG((png_bytep buf, png_int_32 i));\r
2634 \r
2635 /* Place a 16-bit number into a buffer in PNG byte order.\r
2636  * The parameter is declared unsigned int, not png_uint_16,\r
2637  * just to avoid potential problems on pre-ANSI C compilers.\r
2638  */\r
2639 extern PNG_EXPORT(void,png_save_uint_16)\r
2640    PNGARG((png_bytep buf, unsigned int i));\r
2641 /* No png_save_int_16 -- may be added if there's a real need for it. */\r
2642 \r
2643 /* ************************************************************************* */\r
2644 \r
2645 /* These next functions are used internally in the code.  They generally\r
2646  * shouldn't be used unless you are writing code to add or replace some\r
2647  * functionality in libpng.  More information about most functions can\r
2648  * be found in the files where the functions are located.\r
2649  */\r
2650 \r
2651 #if defined(PNG_INTERNAL)\r
2652 \r
2653 /* Various modes of operation.  Note that after an init, mode is set to\r
2654  * zero automatically when the structure is created.\r
2655  */\r
2656 #define PNG_HAVE_IHDR               0x01\r
2657 #define PNG_HAVE_PLTE               0x02\r
2658 #define PNG_HAVE_IDAT               0x04\r
2659 #define PNG_AFTER_IDAT              0x08 /* Have complete zlib datastream */\r
2660 #define PNG_HAVE_IEND               0x10\r
2661 #define PNG_HAVE_gAMA               0x20\r
2662 #define PNG_HAVE_cHRM               0x40\r
2663 #define PNG_HAVE_sRGB               0x80\r
2664 #define PNG_HAVE_CHUNK_HEADER      0x100\r
2665 #define PNG_WROTE_tIME             0x200\r
2666 #define PNG_WROTE_INFO_BEFORE_PLTE 0x400\r
2667 #define PNG_BACKGROUND_IS_GRAY     0x800\r
2668 #define PNG_HAVE_PNG_SIGNATURE    0x1000\r
2669 #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */\r
2670 \r
2671 /* flags for the transformations the PNG library does on the image data */\r
2672 #define PNG_BGR                0x0001\r
2673 #define PNG_INTERLACE          0x0002\r
2674 #define PNG_PACK               0x0004\r
2675 #define PNG_SHIFT              0x0008\r
2676 #define PNG_SWAP_BYTES         0x0010\r
2677 #define PNG_INVERT_MONO        0x0020\r
2678 #define PNG_DITHER             0x0040\r
2679 #define PNG_BACKGROUND         0x0080\r
2680 #define PNG_BACKGROUND_EXPAND  0x0100\r
2681                           /*   0x0200 unused */\r
2682 #define PNG_16_TO_8            0x0400\r
2683 #define PNG_RGBA               0x0800\r
2684 #define PNG_EXPAND             0x1000\r
2685 #define PNG_GAMMA              0x2000\r
2686 #define PNG_GRAY_TO_RGB        0x4000\r
2687 #define PNG_FILLER             0x8000L\r
2688 #define PNG_PACKSWAP          0x10000L\r
2689 #define PNG_SWAP_ALPHA        0x20000L\r
2690 #define PNG_STRIP_ALPHA       0x40000L\r
2691 #define PNG_INVERT_ALPHA      0x80000L\r
2692 #define PNG_USER_TRANSFORM   0x100000L\r
2693 #define PNG_RGB_TO_GRAY_ERR  0x200000L\r
2694 #define PNG_RGB_TO_GRAY_WARN 0x400000L\r
2695 #define PNG_RGB_TO_GRAY      0x600000L  /* two bits, RGB_TO_GRAY_ERR|WARN */\r
2696                        /*    0x800000L     Unused */\r
2697 #define PNG_ADD_ALPHA       0x1000000L  /* Added to libpng-1.2.7 */\r
2698 #define PNG_EXPAND_tRNS     0x2000000L  /* Added to libpng-1.2.9 */\r
2699                        /*   0x4000000L  unused */\r
2700                        /*   0x8000000L  unused */\r
2701                        /*  0x10000000L  unused */\r
2702                        /*  0x20000000L  unused */\r
2703                        /*  0x40000000L  unused */\r
2704 \r
2705 /* flags for png_create_struct */\r
2706 #define PNG_STRUCT_PNG   0x0001\r
2707 #define PNG_STRUCT_INFO  0x0002\r
2708 \r
2709 /* Scaling factor for filter heuristic weighting calculations */\r
2710 #define PNG_WEIGHT_SHIFT 8\r
2711 #define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT))\r
2712 #define PNG_COST_SHIFT 3\r
2713 #define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))\r
2714 \r
2715 /* flags for the png_ptr->flags rather than declaring a byte for each one */\r
2716 #define PNG_FLAG_ZLIB_CUSTOM_STRATEGY     0x0001\r
2717 #define PNG_FLAG_ZLIB_CUSTOM_LEVEL        0x0002\r
2718 #define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL    0x0004\r
2719 #define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS  0x0008\r
2720 #define PNG_FLAG_ZLIB_CUSTOM_METHOD       0x0010\r
2721 #define PNG_FLAG_ZLIB_FINISHED            0x0020\r
2722 #define PNG_FLAG_ROW_INIT                 0x0040\r
2723 #define PNG_FLAG_FILLER_AFTER             0x0080\r
2724 #define PNG_FLAG_CRC_ANCILLARY_USE        0x0100\r
2725 #define PNG_FLAG_CRC_ANCILLARY_NOWARN     0x0200\r
2726 #define PNG_FLAG_CRC_CRITICAL_USE         0x0400\r
2727 #define PNG_FLAG_CRC_CRITICAL_IGNORE      0x0800\r
2728 #define PNG_FLAG_FREE_PLTE                0x1000\r
2729 #define PNG_FLAG_FREE_TRNS                0x2000\r
2730 #define PNG_FLAG_FREE_HIST                0x4000\r
2731 #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS      0x8000L\r
2732 #define PNG_FLAG_KEEP_UNSAFE_CHUNKS       0x10000L\r
2733 #define PNG_FLAG_LIBRARY_MISMATCH         0x20000L\r
2734 #define PNG_FLAG_STRIP_ERROR_NUMBERS      0x40000L\r
2735 #define PNG_FLAG_STRIP_ERROR_TEXT         0x80000L\r
2736 #define PNG_FLAG_MALLOC_NULL_MEM_OK       0x100000L\r
2737 #define PNG_FLAG_ADD_ALPHA                0x200000L  /* Added to libpng-1.2.8 */\r
2738 #define PNG_FLAG_STRIP_ALPHA              0x400000L  /* Added to libpng-1.2.8 */\r
2739                                   /*      0x800000L  unused */\r
2740                                   /*     0x1000000L  unused */\r
2741                                   /*     0x2000000L  unused */\r
2742                                   /*     0x4000000L  unused */\r
2743                                   /*     0x8000000L  unused */\r
2744                                   /*    0x10000000L  unused */\r
2745                                   /*    0x20000000L  unused */\r
2746                                   /*    0x40000000L  unused */\r
2747 \r
2748 #define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \\r
2749                                      PNG_FLAG_CRC_ANCILLARY_NOWARN)\r
2750 \r
2751 #define PNG_FLAG_CRC_CRITICAL_MASK  (PNG_FLAG_CRC_CRITICAL_USE | \\r
2752                                      PNG_FLAG_CRC_CRITICAL_IGNORE)\r
2753 \r
2754 #define PNG_FLAG_CRC_MASK           (PNG_FLAG_CRC_ANCILLARY_MASK | \\r
2755                                      PNG_FLAG_CRC_CRITICAL_MASK)\r
2756 \r
2757 /* save typing and make code easier to understand */\r
2758 \r
2759 #define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \\r
2760    abs((int)((c1).green) - (int)((c2).green)) + \\r
2761    abs((int)((c1).blue) - (int)((c2).blue)))\r
2762 \r
2763 /* Added to libpng-1.2.6 JB */\r
2764 #define PNG_ROWBYTES(pixel_bits, width) \\r
2765     ((pixel_bits) >= 8 ? \\r
2766     ((width) * (((png_uint_32)(pixel_bits)) >> 3)) : \\r
2767     (( ((width) * ((png_uint_32)(pixel_bits))) + 7) >> 3) )\r
2768 \r
2769 /* PNG_OUT_OF_RANGE returns true if value is outside the range\r
2770    ideal-delta..ideal+delta.  Each argument is evaluated twice.\r
2771    "ideal" and "delta" should be constants, normally simple\r
2772    integers, "value" a variable. Added to libpng-1.2.6 JB */\r
2773 #define PNG_OUT_OF_RANGE(value, ideal, delta) \\r
2774         ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )\r
2775 \r
2776 /* variables declared in png.c - only it needs to define PNG_NO_EXTERN */\r
2777 #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)\r
2778 /* place to hold the signature string for a PNG file. */\r
2779 #ifdef PNG_USE_GLOBAL_ARRAYS\r
2780    PNG_EXPORT_VAR (const png_byte FARDATA) png_sig[8];\r
2781 #else\r
2782 #if 0\r
2783 #define png_sig png_sig_bytes(NULL)\r
2784 #endif\r
2785 #endif\r
2786 #endif /* PNG_NO_EXTERN */\r
2787 \r
2788 /* Constant strings for known chunk types.  If you need to add a chunk,\r
2789  * define the name here, and add an invocation of the macro in png.c and\r
2790  * wherever it's needed.\r
2791  */\r
2792 #define PNG_IHDR const png_byte png_IHDR[5] = { 73,  72,  68,  82, '\0'}\r
2793 #define PNG_IDAT const png_byte png_IDAT[5] = { 73,  68,  65,  84, '\0'}\r
2794 #define PNG_IEND const png_byte png_IEND[5] = { 73,  69,  78,  68, '\0'}\r
2795 #define PNG_PLTE const png_byte png_PLTE[5] = { 80,  76,  84,  69, '\0'}\r
2796 #define PNG_bKGD const png_byte png_bKGD[5] = { 98,  75,  71,  68, '\0'}\r
2797 #define PNG_cHRM const png_byte png_cHRM[5] = { 99,  72,  82,  77, '\0'}\r
2798 #define PNG_gAMA const png_byte png_gAMA[5] = {103,  65,  77,  65, '\0'}\r
2799 #define PNG_hIST const png_byte png_hIST[5] = {104,  73,  83,  84, '\0'}\r
2800 #define PNG_iCCP const png_byte png_iCCP[5] = {105,  67,  67,  80, '\0'}\r
2801 #define PNG_iTXt const png_byte png_iTXt[5] = {105,  84,  88, 116, '\0'}\r
2802 #define PNG_oFFs const png_byte png_oFFs[5] = {111,  70,  70, 115, '\0'}\r
2803 #define PNG_pCAL const png_byte png_pCAL[5] = {112,  67,  65,  76, '\0'}\r
2804 #define PNG_sCAL const png_byte png_sCAL[5] = {115,  67,  65,  76, '\0'}\r
2805 #define PNG_pHYs const png_byte png_pHYs[5] = {112,  72,  89, 115, '\0'}\r
2806 #define PNG_sBIT const png_byte png_sBIT[5] = {115,  66,  73,  84, '\0'}\r
2807 #define PNG_sPLT const png_byte png_sPLT[5] = {115,  80,  76,  84, '\0'}\r
2808 #define PNG_sRGB const png_byte png_sRGB[5] = {115,  82,  71,  66, '\0'}\r
2809 #define PNG_tEXt const png_byte png_tEXt[5] = {116,  69,  88, 116, '\0'}\r
2810 #define PNG_tIME const png_byte png_tIME[5] = {116,  73,  77,  69, '\0'}\r
2811 #define PNG_tRNS const png_byte png_tRNS[5] = {116,  82,  78,  83, '\0'}\r
2812 #define PNG_zTXt const png_byte png_zTXt[5] = {122,  84,  88, 116, '\0'}\r
2813 \r
2814 #ifdef PNG_USE_GLOBAL_ARRAYS\r
2815 PNG_EXPORT_VAR (const png_byte FARDATA) png_IHDR[5];\r
2816 PNG_EXPORT_VAR (const png_byte FARDATA) png_IDAT[5];\r
2817 PNG_EXPORT_VAR (const png_byte FARDATA) png_IEND[5];\r
2818 PNG_EXPORT_VAR (const png_byte FARDATA) png_PLTE[5];\r
2819 PNG_EXPORT_VAR (const png_byte FARDATA) png_bKGD[5];\r
2820 PNG_EXPORT_VAR (const png_byte FARDATA) png_cHRM[5];\r
2821 PNG_EXPORT_VAR (const png_byte FARDATA) png_gAMA[5];\r
2822 PNG_EXPORT_VAR (const png_byte FARDATA) png_hIST[5];\r
2823 PNG_EXPORT_VAR (const png_byte FARDATA) png_iCCP[5];\r
2824 PNG_EXPORT_VAR (const png_byte FARDATA) png_iTXt[5];\r
2825 PNG_EXPORT_VAR (const png_byte FARDATA) png_oFFs[5];\r
2826 PNG_EXPORT_VAR (const png_byte FARDATA) png_pCAL[5];\r
2827 PNG_EXPORT_VAR (const png_byte FARDATA) png_sCAL[5];\r
2828 PNG_EXPORT_VAR (const png_byte FARDATA) png_pHYs[5];\r
2829 PNG_EXPORT_VAR (const png_byte FARDATA) png_sBIT[5];\r
2830 PNG_EXPORT_VAR (const png_byte FARDATA) png_sPLT[5];\r
2831 PNG_EXPORT_VAR (const png_byte FARDATA) png_sRGB[5];\r
2832 PNG_EXPORT_VAR (const png_byte FARDATA) png_tEXt[5];\r
2833 PNG_EXPORT_VAR (const png_byte FARDATA) png_tIME[5];\r
2834 PNG_EXPORT_VAR (const png_byte FARDATA) png_tRNS[5];\r
2835 PNG_EXPORT_VAR (const png_byte FARDATA) png_zTXt[5];\r
2836 #endif /* PNG_USE_GLOBAL_ARRAYS */\r
2837 \r
2838 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)\r
2839 /* Initialize png_ptr struct for reading, and allocate any other memory.\r
2840  * (old interface - DEPRECATED - use png_create_read_struct instead).\r
2841  */\r
2842 extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr));\r
2843 #undef png_read_init\r
2844 #define png_read_init(png_ptr) png_read_init_3(&png_ptr, \\r
2845     PNG_LIBPNG_VER_STRING,  png_sizeof(png_struct));\r
2846 #endif\r
2847 \r
2848 extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr,\r
2849     png_const_charp user_png_ver, png_size_t png_struct_size));\r
2850 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)\r
2851 extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr,\r
2852     png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t\r
2853     png_info_size));\r
2854 #endif\r
2855 \r
2856 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)\r
2857 /* Initialize png_ptr struct for writing, and allocate any other memory.\r
2858  * (old interface - DEPRECATED - use png_create_write_struct instead).\r
2859  */\r
2860 extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr));\r
2861 #undef png_write_init\r
2862 #define png_write_init(png_ptr) png_write_init_3(&png_ptr, \\r
2863     PNG_LIBPNG_VER_STRING, png_sizeof(png_struct));\r
2864 #endif\r
2865 \r
2866 extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr,\r
2867     png_const_charp user_png_ver, png_size_t png_struct_size));\r
2868 extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr,\r
2869     png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t\r
2870     png_info_size));\r
2871 \r
2872 /* Allocate memory for an internal libpng struct */\r
2873 PNG_EXTERN png_voidp png_create_struct PNGARG((int type));\r
2874 \r
2875 /* Free memory from internal libpng struct */\r
2876 PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));\r
2877 \r
2878 PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr\r
2879   malloc_fn, png_voidp mem_ptr));\r
2880 PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,\r
2881    png_free_ptr free_fn, png_voidp mem_ptr));\r
2882 \r
2883 /* Free any memory that info_ptr points to and reset struct. */\r
2884 PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,\r
2885    png_infop info_ptr));\r
2886 \r
2887 #ifndef PNG_1_0_X\r
2888 /* Function to allocate memory for zlib. */\r
2889 PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));\r
2890 \r
2891 /* Function to free memory for zlib */\r
2892 PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));\r
2893 \r
2894 #ifdef PNG_SIZE_T\r
2895 /* Function to convert a sizeof an item to png_sizeof item */\r
2896    PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size));\r
2897 #endif\r
2898 \r
2899 /* Next four functions are used internally as callbacks.  PNGAPI is required\r
2900  * but not PNG_EXPORT.  PNGAPI added at libpng version 1.2.3. */\r
2901 \r
2902 PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr,\r
2903    png_bytep data, png_size_t length));\r
2904 \r
2905 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED\r
2906 PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr,\r
2907    png_bytep buffer, png_size_t length));\r
2908 #endif\r
2909 \r
2910 PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr,\r
2911    png_bytep data, png_size_t length));\r
2912 \r
2913 #if defined(PNG_WRITE_FLUSH_SUPPORTED)\r
2914 #if !defined(PNG_NO_STDIO)\r
2915 PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr));\r
2916 #endif\r
2917 #endif\r
2918 #else /* PNG_1_0_X */\r
2919 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED\r
2920 PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr,\r
2921    png_bytep buffer, png_size_t length));\r
2922 #endif\r
2923 #endif /* PNG_1_0_X */\r
2924 \r
2925 /* Reset the CRC variable */\r
2926 PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));\r
2927 \r
2928 /* Write the "data" buffer to whatever output you are using. */\r
2929 PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data,\r
2930    png_size_t length));\r
2931 \r
2932 /* Read data from whatever input you are using into the "data" buffer */\r
2933 PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data,\r
2934    png_size_t length));\r
2935 \r
2936 /* Read bytes into buf, and update png_ptr->crc */\r
2937 PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,\r
2938    png_size_t length));\r
2939 \r
2940 /* Decompress data in a chunk that uses compression */\r
2941 #if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \\r
2942     defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)\r
2943 PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr,\r
2944    int comp_type, png_charp chunkdata, png_size_t chunklength,\r
2945    png_size_t prefix_length, png_size_t *data_length));\r
2946 #endif\r
2947 \r
2948 /* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */\r
2949 PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip));\r
2950 \r
2951 /* Read the CRC from the file and compare it to the libpng calculated CRC */\r
2952 PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr));\r
2953 \r
2954 /* Calculate the CRC over a section of data.  Note that we are only\r
2955  * passing a maximum of 64K on systems that have this as a memory limit,\r
2956  * since this is the maximum buffer size we can specify.\r
2957  */\r
2958 PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,\r
2959    png_size_t length));\r
2960 \r
2961 #if defined(PNG_WRITE_FLUSH_SUPPORTED)\r
2962 PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));\r
2963 #endif\r
2964 \r
2965 /* simple function to write the signature */\r
2966 PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr));\r
2967 \r
2968 /* write various chunks */\r
2969 \r
2970 /* Write the IHDR chunk, and update the png_struct with the necessary\r
2971  * information.\r
2972  */\r
2973 PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,\r
2974    png_uint_32 height,\r
2975    int bit_depth, int color_type, int compression_method, int filter_method,\r
2976    int interlace_method));\r
2977 \r
2978 PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,\r
2979    png_uint_32 num_pal));\r
2980 \r
2981 PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,\r
2982    png_size_t length));\r
2983 \r
2984 PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr));\r
2985 \r
2986 #if defined(PNG_WRITE_gAMA_SUPPORTED)\r
2987 #ifdef PNG_FLOATING_POINT_SUPPORTED\r
2988 PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma));\r
2989 #endif\r
2990 #ifdef PNG_FIXED_POINT_SUPPORTED\r
2991 PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, png_fixed_point\r
2992     file_gamma));\r
2993 #endif\r
2994 #endif\r
2995 \r
2996 #if defined(PNG_WRITE_sBIT_SUPPORTED)\r
2997 PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,\r
2998    int color_type));\r
2999 #endif\r
3000 \r
3001 #if defined(PNG_WRITE_cHRM_SUPPORTED)\r
3002 #ifdef PNG_FLOATING_POINT_SUPPORTED\r
3003 PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr,\r
3004    double white_x, double white_y,\r
3005    double red_x, double red_y, double green_x, double green_y,\r
3006    double blue_x, double blue_y));\r
3007 #endif\r
3008 #ifdef PNG_FIXED_POINT_SUPPORTED\r
3009 PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr,\r
3010    png_fixed_point int_white_x, png_fixed_point int_white_y,\r
3011    png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point\r
3012    int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,\r
3013    png_fixed_point int_blue_y));\r
3014 #endif\r
3015 #endif\r
3016 \r
3017 #if defined(PNG_WRITE_sRGB_SUPPORTED)\r
3018 PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,\r
3019    int intent));\r
3020 #endif\r
3021 \r
3022 #if defined(PNG_WRITE_iCCP_SUPPORTED)\r
3023 PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,\r
3024    png_charp name, int compression_type,\r
3025    png_charp profile, int proflen));\r
3026    /* Note to maintainer: profile should be png_bytep */\r
3027 #endif\r
3028 \r
3029 #if defined(PNG_WRITE_sPLT_SUPPORTED)\r
3030 PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr,\r
3031    png_sPLT_tp palette));\r
3032 #endif\r
3033 \r
3034 #if defined(PNG_WRITE_tRNS_SUPPORTED)\r
3035 PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,\r
3036    png_color_16p values, int number, int color_type));\r
3037 #endif\r
3038 \r
3039 #if defined(PNG_WRITE_bKGD_SUPPORTED)\r
3040 PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr,\r
3041    png_color_16p values, int color_type));\r
3042 #endif\r
3043 \r
3044 #if defined(PNG_WRITE_hIST_SUPPORTED)\r
3045 PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,\r
3046    int num_hist));\r
3047 #endif\r
3048 \r
3049 #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \\r
3050     defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)\r
3051 PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,\r
3052    png_charp key, png_charpp new_key));\r
3053 #endif\r
3054 \r
3055 #if defined(PNG_WRITE_tEXt_SUPPORTED)\r
3056 PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,\r
3057    png_charp text, png_size_t text_len));\r
3058 #endif\r
3059 \r
3060 #if defined(PNG_WRITE_zTXt_SUPPORTED)\r
3061 PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,\r
3062    png_charp text, png_size_t text_len, int compression));\r
3063 #endif\r
3064 \r
3065 #if defined(PNG_WRITE_iTXt_SUPPORTED)\r
3066 PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr,\r
3067    int compression, png_charp key, png_charp lang, png_charp lang_key,\r
3068    png_charp text));\r
3069 #endif\r
3070 \r
3071 #if defined(PNG_TEXT_SUPPORTED)  /* Added at version 1.0.14 and 1.2.4 */\r
3072 PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr,\r
3073    png_infop info_ptr, png_textp text_ptr, int num_text));\r
3074 #endif\r
3075 \r
3076 #if defined(PNG_WRITE_oFFs_SUPPORTED)\r
3077 PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,\r
3078    png_int_32 x_offset, png_int_32 y_offset, int unit_type));\r
3079 #endif\r
3080 \r
3081 #if defined(PNG_WRITE_pCAL_SUPPORTED)\r
3082 PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose,\r
3083    png_int_32 X0, png_int_32 X1, int type, int nparams,\r
3084    png_charp units, png_charpp params));\r
3085 #endif\r
3086 \r
3087 #if defined(PNG_WRITE_pHYs_SUPPORTED)\r
3088 PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr,\r
3089    png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,\r
3090    int unit_type));\r
3091 #endif\r
3092 \r
3093 #if defined(PNG_WRITE_tIME_SUPPORTED)\r
3094 PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,\r
3095    png_timep mod_time));\r
3096 #endif\r
3097 \r
3098 #if defined(PNG_WRITE_sCAL_SUPPORTED)\r
3099 #if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)\r
3100 PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,\r
3101    int unit, double width, double height));\r
3102 #else\r
3103 #ifdef PNG_FIXED_POINT_SUPPORTED\r
3104 PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr,\r
3105    int unit, png_charp width, png_charp height));\r
3106 #endif\r
3107 #endif\r
3108 #endif\r
3109 \r
3110 /* Called when finished processing a row of data */\r
3111 PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr));\r
3112 \r
3113 /* Internal use only.   Called before first row of data */\r
3114 PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));\r
3115 \r
3116 #if defined(PNG_READ_GAMMA_SUPPORTED)\r
3117 PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr));\r
3118 #endif\r
3119 \r
3120 /* combine a row of data, dealing with alpha, etc. if requested */\r
3121 PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,\r
3122    int mask));\r
3123 \r
3124 #if defined(PNG_READ_INTERLACING_SUPPORTED)\r
3125 /* expand an interlaced row */\r
3126 /* OLD pre-1.0.9 interface:\r
3127 PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,\r
3128    png_bytep row, int pass, png_uint_32 transformations));\r
3129  */\r
3130 PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));\r
3131 #endif\r
3132 \r
3133 /* GRR TO DO (2.0 or whenever):  simplify other internal calling interfaces */\r
3134 \r
3135 #if defined(PNG_WRITE_INTERLACING_SUPPORTED)\r
3136 /* grab pixels out of a row for an interlaced pass */\r
3137 PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,\r
3138    png_bytep row, int pass));\r
3139 #endif\r
3140 \r
3141 /* unfilter a row */\r
3142 PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr,\r
3143    png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter));\r
3144 \r
3145 /* Choose the best filter to use and filter the row data */\r
3146 PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr,\r
3147    png_row_infop row_info));\r
3148 \r
3149 /* Write out the filtered row. */\r
3150 PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr,\r
3151    png_bytep filtered_row));\r
3152 /* finish a row while reading, dealing with interlacing passes, etc. */\r
3153 PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr));\r
3154 \r
3155 /* initialize the row buffers, etc. */\r
3156 PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr));\r
3157 /* optional call to update the users info structure */\r
3158 PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,\r
3159    png_infop info_ptr));\r
3160 \r
3161 /* these are the functions that do the transformations */\r
3162 #if defined(PNG_READ_FILLER_SUPPORTED)\r
3163 PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,\r
3164    png_bytep row, png_uint_32 filler, png_uint_32 flags));\r
3165 #endif\r
3166 \r
3167 #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)\r
3168 PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info,\r
3169    png_bytep row));\r
3170 #endif\r
3171 \r
3172 #if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)\r
3173 PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info,\r
3174    png_bytep row));\r
3175 #endif\r
3176 \r
3177 #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)\r
3178 PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info,\r
3179    png_bytep row));\r
3180 #endif\r
3181 \r
3182 #if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)\r
3183 PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info,\r
3184    png_bytep row));\r
3185 #endif\r
3186 \r
3187 #if defined(PNG_WRITE_FILLER_SUPPORTED) || \\r
3188     defined(PNG_READ_STRIP_ALPHA_SUPPORTED)\r
3189 PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info,\r
3190    png_bytep row, png_uint_32 flags));\r
3191 #endif\r
3192 \r
3193 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)\r
3194 PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));\r
3195 #endif\r
3196 \r
3197 #if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)\r
3198 PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row));\r
3199 #endif\r
3200 \r
3201 #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)\r
3202 PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop\r
3203    row_info, png_bytep row));\r
3204 #endif\r
3205 \r
3206 #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)\r
3207 PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,\r
3208    png_bytep row));\r
3209 #endif\r
3210 \r
3211 #if defined(PNG_READ_PACK_SUPPORTED)\r
3212 PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));\r
3213 #endif\r
3214 \r
3215 #if defined(PNG_READ_SHIFT_SUPPORTED)\r
3216 PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row,\r
3217    png_color_8p sig_bits));\r
3218 #endif\r
3219 \r
3220 #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)\r
3221 PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));\r
3222 #endif\r
3223 \r
3224 #if defined(PNG_READ_16_TO_8_SUPPORTED)\r
3225 PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));\r
3226 #endif\r
3227 \r
3228 #if defined(PNG_READ_DITHER_SUPPORTED)\r
3229 PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info,\r
3230    png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup));\r
3231 \r
3232 #  if defined(PNG_CORRECT_PALETTE_SUPPORTED)\r
3233 PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,\r
3234    png_colorp palette, int num_palette));\r
3235 #  endif\r
3236 #endif\r
3237 \r
3238 #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)\r
3239 PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row));\r
3240 #endif\r
3241 \r
3242 #if defined(PNG_WRITE_PACK_SUPPORTED)\r
3243 PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info,\r
3244    png_bytep row, png_uint_32 bit_depth));\r
3245 #endif\r
3246 \r
3247 #if defined(PNG_WRITE_SHIFT_SUPPORTED)\r
3248 PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,\r
3249    png_color_8p bit_depth));\r
3250 #endif\r
3251 \r
3252 #if defined(PNG_READ_BACKGROUND_SUPPORTED)\r
3253 #if defined(PNG_READ_GAMMA_SUPPORTED)\r
3254 PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,\r
3255    png_color_16p trans_values, png_color_16p background,\r
3256    png_color_16p background_1,\r
3257    png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,\r
3258    png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,\r
3259    png_uint_16pp gamma_16_to_1, int gamma_shift));\r
3260 #else\r
3261 PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,\r
3262    png_color_16p trans_values, png_color_16p background));\r
3263 #endif\r
3264 #endif\r
3265 \r
3266 #if defined(PNG_READ_GAMMA_SUPPORTED)\r
3267 PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row,\r
3268    png_bytep gamma_table, png_uint_16pp gamma_16_table,\r
3269    int gamma_shift));\r
3270 #endif\r
3271 \r
3272 #if defined(PNG_READ_EXPAND_SUPPORTED)\r
3273 PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info,\r
3274    png_bytep row, png_colorp palette, png_bytep trans, int num_trans));\r
3275 PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,\r
3276    png_bytep row, png_color_16p trans_value));\r
3277 #endif\r
3278 \r
3279 /* The following decodes the appropriate chunks, and does error correction,\r
3280  * then calls the appropriate callback for the chunk if it is valid.\r
3281  */\r
3282 \r
3283 /* decode the IHDR chunk */\r
3284 PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3285    png_uint_32 length));\r
3286 PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3287    png_uint_32 length));\r
3288 PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3289    png_uint_32 length));\r
3290 \r
3291 #if defined(PNG_READ_bKGD_SUPPORTED)\r
3292 PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3293    png_uint_32 length));\r
3294 #endif\r
3295 \r
3296 #if defined(PNG_READ_cHRM_SUPPORTED)\r
3297 PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3298    png_uint_32 length));\r
3299 #endif\r
3300 \r
3301 #if defined(PNG_READ_gAMA_SUPPORTED)\r
3302 PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3303    png_uint_32 length));\r
3304 #endif\r
3305 \r
3306 #if defined(PNG_READ_hIST_SUPPORTED)\r
3307 PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3308    png_uint_32 length));\r
3309 #endif\r
3310 \r
3311 #if defined(PNG_READ_iCCP_SUPPORTED)\r
3312 extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3313    png_uint_32 length));\r
3314 #endif /* PNG_READ_iCCP_SUPPORTED */\r
3315 \r
3316 #if defined(PNG_READ_iTXt_SUPPORTED)\r
3317 PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3318    png_uint_32 length));\r
3319 #endif\r
3320 \r
3321 #if defined(PNG_READ_oFFs_SUPPORTED)\r
3322 PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3323    png_uint_32 length));\r
3324 #endif\r
3325 \r
3326 #if defined(PNG_READ_pCAL_SUPPORTED)\r
3327 PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3328    png_uint_32 length));\r
3329 #endif\r
3330 \r
3331 #if defined(PNG_READ_pHYs_SUPPORTED)\r
3332 PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3333    png_uint_32 length));\r
3334 #endif\r
3335 \r
3336 #if defined(PNG_READ_sBIT_SUPPORTED)\r
3337 PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3338    png_uint_32 length));\r
3339 #endif\r
3340 \r
3341 #if defined(PNG_READ_sCAL_SUPPORTED)\r
3342 PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3343    png_uint_32 length));\r
3344 #endif\r
3345 \r
3346 #if defined(PNG_READ_sPLT_SUPPORTED)\r
3347 extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3348    png_uint_32 length));\r
3349 #endif /* PNG_READ_sPLT_SUPPORTED */\r
3350 \r
3351 #if defined(PNG_READ_sRGB_SUPPORTED)\r
3352 PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3353    png_uint_32 length));\r
3354 #endif\r
3355 \r
3356 #if defined(PNG_READ_tEXt_SUPPORTED)\r
3357 PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3358    png_uint_32 length));\r
3359 #endif\r
3360 \r
3361 #if defined(PNG_READ_tIME_SUPPORTED)\r
3362 PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3363    png_uint_32 length));\r
3364 #endif\r
3365 \r
3366 #if defined(PNG_READ_tRNS_SUPPORTED)\r
3367 PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3368    png_uint_32 length));\r
3369 #endif\r
3370 \r
3371 #if defined(PNG_READ_zTXt_SUPPORTED)\r
3372 PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,\r
3373    png_uint_32 length));\r
3374 #endif\r
3375 \r
3376 PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,\r
3377    png_infop info_ptr, png_uint_32 length));\r
3378 \r
3379 PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,\r
3380    png_bytep chunk_name));\r
3381 \r
3382 /* handle the transformations for reading and writing */\r
3383 PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));\r
3384 PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr));\r
3385 \r
3386 PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr));\r
3387 \r
3388 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED\r
3389 PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr,\r
3390    png_infop info_ptr));\r
3391 PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr,\r
3392    png_infop info_ptr));\r
3393 PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr));\r
3394 PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr,\r
3395    png_uint_32 length));\r
3396 PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr));\r
3397 PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr));\r
3398 PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr,\r
3399    png_bytep buffer, png_size_t buffer_length));\r
3400 PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr));\r
3401 PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr,\r
3402    png_bytep buffer, png_size_t buffer_length));\r
3403 PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr));\r
3404 PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr,\r
3405    png_infop info_ptr, png_uint_32 length));\r
3406 PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr,\r
3407    png_infop info_ptr));\r
3408 PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr,\r
3409    png_infop info_ptr));\r
3410 PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row));\r
3411 PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr,\r
3412    png_infop info_ptr));\r
3413 PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr,\r
3414    png_infop info_ptr));\r
3415 PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr));\r
3416 #if defined(PNG_READ_tEXt_SUPPORTED)\r
3417 PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr,\r
3418    png_infop info_ptr, png_uint_32 length));\r
3419 PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr,\r
3420    png_infop info_ptr));\r
3421 #endif\r
3422 #if defined(PNG_READ_zTXt_SUPPORTED)\r
3423 PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr,\r
3424    png_infop info_ptr, png_uint_32 length));\r
3425 PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr,\r
3426    png_infop info_ptr));\r
3427 #endif\r
3428 #if defined(PNG_READ_iTXt_SUPPORTED)\r
3429 PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr,\r
3430    png_infop info_ptr, png_uint_32 length));\r
3431 PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr,\r
3432    png_infop info_ptr));\r
3433 #endif\r
3434 \r
3435 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */\r
3436 \r
3437 #ifdef PNG_MNG_FEATURES_SUPPORTED\r
3438 PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,\r
3439    png_bytep row));\r
3440 PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,\r
3441    png_bytep row));\r
3442 #endif\r
3443 \r
3444 #if defined(PNG_ASSEMBLER_CODE_SUPPORTED)\r
3445 /* png.c */ /* PRIVATE */\r
3446 PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr));\r
3447 #endif\r
3448 \r
3449 #if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)\r
3450 PNG_EXTERN png_uint_32 png_get_pixels_per_inch PNGARG((png_structp png_ptr,\r
3451 png_infop info_ptr));\r
3452 \r
3453 PNG_EXTERN png_uint_32 png_get_x_pixels_per_inch PNGARG((png_structp png_ptr,\r
3454 png_infop info_ptr));\r
3455 \r
3456 PNG_EXTERN png_uint_32 png_get_y_pixels_per_inch PNGARG((png_structp png_ptr,\r
3457 png_infop info_ptr));\r
3458 \r
3459 PNG_EXTERN float png_get_x_offset_inches PNGARG((png_structp png_ptr,\r
3460 png_infop info_ptr));\r
3461 \r
3462 PNG_EXTERN float png_get_y_offset_inches PNGARG((png_structp png_ptr,\r
3463 png_infop info_ptr));\r
3464 \r
3465 #if defined(PNG_pHYs_SUPPORTED)\r
3466 PNG_EXTERN png_uint_32 png_get_pHYs_dpi PNGARG((png_structp png_ptr,\r
3467 png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));\r
3468 #endif /* PNG_pHYs_SUPPORTED */\r
3469 #endif  /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */\r
3470 \r
3471 /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */\r
3472 \r
3473 #endif /* PNG_INTERNAL */\r
3474 \r
3475 #ifdef __cplusplus\r
3476 }\r
3477 #endif\r
3478 \r
3479 #endif /* PNG_VERSION_INFO_ONLY */\r
3480 /* do not put anything past this line */\r
3481 #endif /* PNG_H */\r