diff options
author | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
commit | 959831f4ef5a3e797f576c3de08cd65032c997ad (patch) | |
tree | e7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/source/Irrlicht/libpng/pngpriv.h | |
parent | Add info about changes to Irrlicht. (diff) | |
download | SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2 SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz |
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/libpng/pngpriv.h | 3258 |
1 files changed, 1629 insertions, 1629 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/libpng/pngpriv.h b/libraries/irrlicht-1.8/source/Irrlicht/libpng/pngpriv.h index 5f751de..67e486c 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/libpng/pngpriv.h +++ b/libraries/irrlicht-1.8/source/Irrlicht/libpng/pngpriv.h | |||
@@ -1,1629 +1,1629 @@ | |||
1 | 1 | ||
2 | /* pngpriv.h - private declarations for use inside libpng | 2 | /* pngpriv.h - private declarations for use inside libpng |
3 | * | 3 | * |
4 | * For conditions of distribution and use, see copyright notice in png.h | 4 | * For conditions of distribution and use, see copyright notice in png.h |
5 | * Copyright (c) 1998-2011 Glenn Randers-Pehrson | 5 | * Copyright (c) 1998-2011 Glenn Randers-Pehrson |
6 | * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) | 6 | * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) |
7 | * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) | 7 | * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) |
8 | * | 8 | * |
9 | * Last changed in libpng 1.5.7 [December 15, 2011] | 9 | * Last changed in libpng 1.5.7 [December 15, 2011] |
10 | * | 10 | * |
11 | * This code is released under the libpng license. | 11 | * This code is released under the libpng license. |
12 | * For conditions of distribution and use, see the disclaimer | 12 | * For conditions of distribution and use, see the disclaimer |
13 | * and license in png.h | 13 | * and license in png.h |
14 | */ | 14 | */ |
15 | 15 | ||
16 | /* The symbols declared in this file (including the functions declared | 16 | /* The symbols declared in this file (including the functions declared |
17 | * as PNG_EXTERN) are PRIVATE. They are not part of the libpng public | 17 | * as PNG_EXTERN) are PRIVATE. They are not part of the libpng public |
18 | * interface, and are not recommended for use by regular applications. | 18 | * interface, and are not recommended for use by regular applications. |
19 | * Some of them may become public in the future; others may stay private, | 19 | * Some of them may become public in the future; others may stay private, |
20 | * change in an incompatible way, or even disappear. | 20 | * change in an incompatible way, or even disappear. |
21 | * Although the libpng users are not forbidden to include this header, | 21 | * Although the libpng users are not forbidden to include this header, |
22 | * they should be well aware of the issues that may arise from doing so. | 22 | * they should be well aware of the issues that may arise from doing so. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #ifndef PNGPRIV_H | 25 | #ifndef PNGPRIV_H |
26 | #define PNGPRIV_H | 26 | #define PNGPRIV_H |
27 | 27 | ||
28 | /* Feature Test Macros. The following are defined here to ensure that correctly | 28 | /* Feature Test Macros. The following are defined here to ensure that correctly |
29 | * implemented libraries reveal the APIs libpng needs to build and hide those | 29 | * implemented libraries reveal the APIs libpng needs to build and hide those |
30 | * that are not needed and potentially damaging to the compilation. | 30 | * that are not needed and potentially damaging to the compilation. |
31 | * | 31 | * |
32 | * Feature Test Macros must be defined before any system header is included (see | 32 | * Feature Test Macros must be defined before any system header is included (see |
33 | * POSIX 1003.1 2.8.2 "POSIX Symbols." | 33 | * POSIX 1003.1 2.8.2 "POSIX Symbols." |
34 | * | 34 | * |
35 | * These macros only have an effect if the operating system supports either | 35 | * These macros only have an effect if the operating system supports either |
36 | * POSIX 1003.1 or C99, or both. On other operating systems (particularly | 36 | * POSIX 1003.1 or C99, or both. On other operating systems (particularly |
37 | * Windows/Visual Studio) there is no effect; the OS specific tests below are | 37 | * Windows/Visual Studio) there is no effect; the OS specific tests below are |
38 | * still required (as of 2011-05-02.) | 38 | * still required (as of 2011-05-02.) |
39 | */ | 39 | */ |
40 | #define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */ | 40 | #define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */ |
41 | 41 | ||
42 | /* This is required for the definition of abort(), used as a last ditch | 42 | /* This is required for the definition of abort(), used as a last ditch |
43 | * error handler when all else fails. | 43 | * error handler when all else fails. |
44 | */ | 44 | */ |
45 | #include <stdlib.h> | 45 | #include <stdlib.h> |
46 | 46 | ||
47 | /* This is used to find 'offsetof', used below for alignment tests. */ | 47 | /* This is used to find 'offsetof', used below for alignment tests. */ |
48 | #include <stddef.h> | 48 | #include <stddef.h> |
49 | 49 | ||
50 | #define PNGLIB_BUILD /*libpng is being built, not used*/ | 50 | #define PNGLIB_BUILD /*libpng is being built, not used*/ |
51 | 51 | ||
52 | #ifdef PNG_USER_CONFIG | 52 | #ifdef PNG_USER_CONFIG |
53 | # include "pngusr.h" | 53 | # include "pngusr.h" |
54 | /* These should have been defined in pngusr.h */ | 54 | /* These should have been defined in pngusr.h */ |
55 | # ifndef PNG_USER_PRIVATEBUILD | 55 | # ifndef PNG_USER_PRIVATEBUILD |
56 | # define PNG_USER_PRIVATEBUILD "Custom libpng build" | 56 | # define PNG_USER_PRIVATEBUILD "Custom libpng build" |
57 | # endif | 57 | # endif |
58 | # ifndef PNG_USER_DLLFNAME_POSTFIX | 58 | # ifndef PNG_USER_DLLFNAME_POSTFIX |
59 | # define PNG_USER_DLLFNAME_POSTFIX "Cb" | 59 | # define PNG_USER_DLLFNAME_POSTFIX "Cb" |
60 | # endif | 60 | # endif |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | /* Is this a build of a DLL where compilation of the object modules requires | 63 | /* Is this a build of a DLL where compilation of the object modules requires |
64 | * different preprocessor settings to those required for a simple library? If | 64 | * different preprocessor settings to those required for a simple library? If |
65 | * so PNG_BUILD_DLL must be set. | 65 | * so PNG_BUILD_DLL must be set. |
66 | * | 66 | * |
67 | * If libpng is used inside a DLL but that DLL does not export the libpng APIs | 67 | * If libpng is used inside a DLL but that DLL does not export the libpng APIs |
68 | * PNG_BUILD_DLL must not be set. To avoid the code below kicking in build a | 68 | * PNG_BUILD_DLL must not be set. To avoid the code below kicking in build a |
69 | * static library of libpng then link the DLL against that. | 69 | * static library of libpng then link the DLL against that. |
70 | */ | 70 | */ |
71 | #ifndef PNG_BUILD_DLL | 71 | #ifndef PNG_BUILD_DLL |
72 | # ifdef DLL_EXPORT | 72 | # ifdef DLL_EXPORT |
73 | /* This is set by libtool when files are compiled for a DLL; libtool | 73 | /* This is set by libtool when files are compiled for a DLL; libtool |
74 | * always compiles twice, even on systems where it isn't necessary. Set | 74 | * always compiles twice, even on systems where it isn't necessary. Set |
75 | * PNG_BUILD_DLL in case it is necessary: | 75 | * PNG_BUILD_DLL in case it is necessary: |
76 | */ | 76 | */ |
77 | # define PNG_BUILD_DLL | 77 | # define PNG_BUILD_DLL |
78 | # else | 78 | # else |
79 | # ifdef _WINDLL | 79 | # ifdef _WINDLL |
80 | /* This is set by the Microsoft Visual Studio IDE in projects that | 80 | /* This is set by the Microsoft Visual Studio IDE in projects that |
81 | * build a DLL. It can't easily be removed from those projects (it | 81 | * build a DLL. It can't easily be removed from those projects (it |
82 | * isn't visible in the Visual Studio UI) so it is a fairly reliable | 82 | * isn't visible in the Visual Studio UI) so it is a fairly reliable |
83 | * indication that PNG_IMPEXP needs to be set to the DLL export | 83 | * indication that PNG_IMPEXP needs to be set to the DLL export |
84 | * attributes. | 84 | * attributes. |
85 | */ | 85 | */ |
86 | # define PNG_BUILD_DLL | 86 | # define PNG_BUILD_DLL |
87 | # else | 87 | # else |
88 | # ifdef __DLL__ | 88 | # ifdef __DLL__ |
89 | /* This is set by the Borland C system when compiling for a DLL | 89 | /* This is set by the Borland C system when compiling for a DLL |
90 | * (as above.) | 90 | * (as above.) |
91 | */ | 91 | */ |
92 | # define PNG_BUILD_DLL | 92 | # define PNG_BUILD_DLL |
93 | # else | 93 | # else |
94 | /* Add additional compiler cases here. */ | 94 | /* Add additional compiler cases here. */ |
95 | # endif | 95 | # endif |
96 | # endif | 96 | # endif |
97 | # endif | 97 | # endif |
98 | #endif /* Setting PNG_BUILD_DLL if required */ | 98 | #endif /* Setting PNG_BUILD_DLL if required */ |
99 | 99 | ||
100 | /* See pngconf.h for more details: the builder of the library may set this on | 100 | /* See pngconf.h for more details: the builder of the library may set this on |
101 | * the command line to the right thing for the specific compilation system or it | 101 | * the command line to the right thing for the specific compilation system or it |
102 | * may be automagically set above (at present we know of no system where it does | 102 | * may be automagically set above (at present we know of no system where it does |
103 | * need to be set on the command line.) | 103 | * need to be set on the command line.) |
104 | * | 104 | * |
105 | * PNG_IMPEXP must be set here when building the library to prevent pngconf.h | 105 | * PNG_IMPEXP must be set here when building the library to prevent pngconf.h |
106 | * setting it to the "import" setting for a DLL build. | 106 | * setting it to the "import" setting for a DLL build. |
107 | */ | 107 | */ |
108 | #ifndef PNG_IMPEXP | 108 | #ifndef PNG_IMPEXP |
109 | # ifdef PNG_BUILD_DLL | 109 | # ifdef PNG_BUILD_DLL |
110 | # define PNG_IMPEXP PNG_DLL_EXPORT | 110 | # define PNG_IMPEXP PNG_DLL_EXPORT |
111 | # else | 111 | # else |
112 | /* Not building a DLL, or the DLL doesn't require specific export | 112 | /* Not building a DLL, or the DLL doesn't require specific export |
113 | * definitions. | 113 | * definitions. |
114 | */ | 114 | */ |
115 | # define PNG_IMPEXP | 115 | # define PNG_IMPEXP |
116 | # endif | 116 | # endif |
117 | #endif | 117 | #endif |
118 | 118 | ||
119 | /* No warnings for private or deprecated functions in the build: */ | 119 | /* No warnings for private or deprecated functions in the build: */ |
120 | #ifndef PNG_DEPRECATED | 120 | #ifndef PNG_DEPRECATED |
121 | # define PNG_DEPRECATED | 121 | # define PNG_DEPRECATED |
122 | #endif | 122 | #endif |
123 | #ifndef PNG_PRIVATE | 123 | #ifndef PNG_PRIVATE |
124 | # define PNG_PRIVATE | 124 | # define PNG_PRIVATE |
125 | #endif | 125 | #endif |
126 | 126 | ||
127 | #include "png.h" | 127 | #include "png.h" |
128 | #include "pnginfo.h" | 128 | #include "pnginfo.h" |
129 | #include "pngstruct.h" | 129 | #include "pngstruct.h" |
130 | 130 | ||
131 | /* pngconf.h does not set PNG_DLL_EXPORT unless it is required, so: */ | 131 | /* pngconf.h does not set PNG_DLL_EXPORT unless it is required, so: */ |
132 | #ifndef PNG_DLL_EXPORT | 132 | #ifndef PNG_DLL_EXPORT |
133 | # define PNG_DLL_EXPORT | 133 | # define PNG_DLL_EXPORT |
134 | #endif | 134 | #endif |
135 | 135 | ||
136 | /* This is used for 16 bit gamma tables - only the top level pointers are const, | 136 | /* This is used for 16 bit gamma tables - only the top level pointers are const, |
137 | * this could be changed: | 137 | * this could be changed: |
138 | */ | 138 | */ |
139 | typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; | 139 | typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; |
140 | 140 | ||
141 | /* Added at libpng-1.2.9 */ | 141 | /* Added at libpng-1.2.9 */ |
142 | /* Moved to pngpriv.h at libpng-1.5.0 */ | 142 | /* Moved to pngpriv.h at libpng-1.5.0 */ |
143 | 143 | ||
144 | /* config.h is created by and PNG_CONFIGURE_LIBPNG is set by the "configure" | 144 | /* config.h is created by and PNG_CONFIGURE_LIBPNG is set by the "configure" |
145 | * script. We may need it here to get the correct configuration on things | 145 | * script. We may need it here to get the correct configuration on things |
146 | * like limits. | 146 | * like limits. |
147 | */ | 147 | */ |
148 | #ifdef PNG_CONFIGURE_LIBPNG | 148 | #ifdef PNG_CONFIGURE_LIBPNG |
149 | # ifdef HAVE_CONFIG_H | 149 | # ifdef HAVE_CONFIG_H |
150 | # include "config.h" | 150 | # include "config.h" |
151 | # endif | 151 | # endif |
152 | #endif | 152 | #endif |
153 | 153 | ||
154 | /* Moved to pngpriv.h at libpng-1.5.0 */ | 154 | /* Moved to pngpriv.h at libpng-1.5.0 */ |
155 | /* NOTE: some of these may have been used in external applications as | 155 | /* NOTE: some of these may have been used in external applications as |
156 | * these definitions were exposed in pngconf.h prior to 1.5. | 156 | * these definitions were exposed in pngconf.h prior to 1.5. |
157 | */ | 157 | */ |
158 | 158 | ||
159 | /* If you are running on a machine where you cannot allocate more | 159 | /* If you are running on a machine where you cannot allocate more |
160 | * than 64K of memory at once, uncomment this. While libpng will not | 160 | * than 64K of memory at once, uncomment this. While libpng will not |
161 | * normally need that much memory in a chunk (unless you load up a very | 161 | * normally need that much memory in a chunk (unless you load up a very |
162 | * large file), zlib needs to know how big of a chunk it can use, and | 162 | * large file), zlib needs to know how big of a chunk it can use, and |
163 | * libpng thus makes sure to check any memory allocation to verify it | 163 | * libpng thus makes sure to check any memory allocation to verify it |
164 | * will fit into memory. | 164 | * will fit into memory. |
165 | * | 165 | * |
166 | * zlib provides 'MAXSEG_64K' which, if defined, indicates the | 166 | * zlib provides 'MAXSEG_64K' which, if defined, indicates the |
167 | * same limit and pngconf.h (already included) sets the limit | 167 | * same limit and pngconf.h (already included) sets the limit |
168 | * if certain operating systems are detected. | 168 | * if certain operating systems are detected. |
169 | */ | 169 | */ |
170 | #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K) | 170 | #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K) |
171 | # define PNG_MAX_MALLOC_64K | 171 | # define PNG_MAX_MALLOC_64K |
172 | #endif | 172 | #endif |
173 | 173 | ||
174 | #ifndef PNG_UNUSED | 174 | #ifndef PNG_UNUSED |
175 | /* Unused formal parameter warnings are silenced using the following macro | 175 | /* Unused formal parameter warnings are silenced using the following macro |
176 | * which is expected to have no bad effects on performance (optimizing | 176 | * which is expected to have no bad effects on performance (optimizing |
177 | * compilers will probably remove it entirely). Note that if you replace | 177 | * compilers will probably remove it entirely). Note that if you replace |
178 | * it with something other than whitespace, you must include the terminating | 178 | * it with something other than whitespace, you must include the terminating |
179 | * semicolon. | 179 | * semicolon. |
180 | */ | 180 | */ |
181 | # define PNG_UNUSED(param) (void)param; | 181 | # define PNG_UNUSED(param) (void)param; |
182 | #endif | 182 | #endif |
183 | 183 | ||
184 | /* Just a little check that someone hasn't tried to define something | 184 | /* Just a little check that someone hasn't tried to define something |
185 | * contradictory. | 185 | * contradictory. |
186 | */ | 186 | */ |
187 | #if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K) | 187 | #if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K) |
188 | # undef PNG_ZBUF_SIZE | 188 | # undef PNG_ZBUF_SIZE |
189 | # define PNG_ZBUF_SIZE 65536L | 189 | # define PNG_ZBUF_SIZE 65536L |
190 | #endif | 190 | #endif |
191 | 191 | ||
192 | /* PNG_STATIC is used to mark internal file scope functions if they need to be | 192 | /* PNG_STATIC is used to mark internal file scope functions if they need to be |
193 | * accessed for implementation tests (see the code in tests/?*). | 193 | * accessed for implementation tests (see the code in tests/?*). |
194 | */ | 194 | */ |
195 | #ifndef PNG_STATIC | 195 | #ifndef PNG_STATIC |
196 | # define PNG_STATIC static | 196 | # define PNG_STATIC static |
197 | #endif | 197 | #endif |
198 | 198 | ||
199 | /* C99 restrict is used where possible, to do this 'restrict' is defined as | 199 | /* C99 restrict is used where possible, to do this 'restrict' is defined as |
200 | * empty if we can't be sure it is supported. configure builds have already | 200 | * empty if we can't be sure it is supported. configure builds have already |
201 | * done this work. | 201 | * done this work. |
202 | */ | 202 | */ |
203 | #ifdef PNG_CONFIGURE_LIBPNG | 203 | #ifdef PNG_CONFIGURE_LIBPNG |
204 | # define PNG_RESTRICT restrict | 204 | # define PNG_RESTRICT restrict |
205 | #else | 205 | #else |
206 | /* Modern compilers support restrict, but assume not for anything not | 206 | /* Modern compilers support restrict, but assume not for anything not |
207 | * recognized here: | 207 | * recognized here: |
208 | */ | 208 | */ |
209 | # if defined __GNUC__ || defined _MSC_VER || defined __WATCOMC__ | 209 | # if defined __GNUC__ || defined _MSC_VER || defined __WATCOMC__ |
210 | # define PNG_RESTRICT restrict | 210 | # define PNG_RESTRICT restrict |
211 | # else | 211 | # else |
212 | # define PNG_RESTRICT | 212 | # define PNG_RESTRICT |
213 | # endif | 213 | # endif |
214 | #endif | 214 | #endif |
215 | 215 | ||
216 | /* If warnings or errors are turned off the code is disabled or redirected here. | 216 | /* If warnings or errors are turned off the code is disabled or redirected here. |
217 | * From 1.5.4 functions have been added to allow very limited formatting of | 217 | * From 1.5.4 functions have been added to allow very limited formatting of |
218 | * error and warning messages - this code will also be disabled here. | 218 | * error and warning messages - this code will also be disabled here. |
219 | */ | 219 | */ |
220 | #ifdef PNG_WARNINGS_SUPPORTED | 220 | #ifdef PNG_WARNINGS_SUPPORTED |
221 | # define PNG_WARNING_PARAMETERS(p) png_warning_parameters p; | 221 | # define PNG_WARNING_PARAMETERS(p) png_warning_parameters p; |
222 | #else | 222 | #else |
223 | # define png_warning(s1,s2) ((void)(s1)) | 223 | # define png_warning(s1,s2) ((void)(s1)) |
224 | # define png_chunk_warning(s1,s2) ((void)(s1)) | 224 | # define png_chunk_warning(s1,s2) ((void)(s1)) |
225 | # define png_warning_parameter(p,number,string) ((void)0) | 225 | # define png_warning_parameter(p,number,string) ((void)0) |
226 | # define png_warning_parameter_unsigned(p,number,format,value) ((void)0) | 226 | # define png_warning_parameter_unsigned(p,number,format,value) ((void)0) |
227 | # define png_warning_parameter_signed(p,number,format,value) ((void)0) | 227 | # define png_warning_parameter_signed(p,number,format,value) ((void)0) |
228 | # define png_formatted_warning(pp,p,message) ((void)(pp)) | 228 | # define png_formatted_warning(pp,p,message) ((void)(pp)) |
229 | # define PNG_WARNING_PARAMETERS(p) | 229 | # define PNG_WARNING_PARAMETERS(p) |
230 | #endif | 230 | #endif |
231 | #ifndef PNG_ERROR_TEXT_SUPPORTED | 231 | #ifndef PNG_ERROR_TEXT_SUPPORTED |
232 | # define png_error(s1,s2) png_err(s1) | 232 | # define png_error(s1,s2) png_err(s1) |
233 | # define png_chunk_error(s1,s2) png_err(s1) | 233 | # define png_chunk_error(s1,s2) png_err(s1) |
234 | # define png_fixed_error(s1,s2) png_err(s1) | 234 | # define png_fixed_error(s1,s2) png_err(s1) |
235 | #endif | 235 | #endif |
236 | 236 | ||
237 | /* C allows up-casts from (void*) to any pointer and (const void*) to any | 237 | /* C allows up-casts from (void*) to any pointer and (const void*) to any |
238 | * pointer to a const object. C++ regards this as a type error and requires an | 238 | * pointer to a const object. C++ regards this as a type error and requires an |
239 | * explicit, static, cast and provides the static_cast<> rune to ensure that | 239 | * explicit, static, cast and provides the static_cast<> rune to ensure that |
240 | * const is not cast away. | 240 | * const is not cast away. |
241 | */ | 241 | */ |
242 | #ifdef __cplusplus | 242 | #ifdef __cplusplus |
243 | # define png_voidcast(type, value) static_cast<type>(value) | 243 | # define png_voidcast(type, value) static_cast<type>(value) |
244 | #else | 244 | #else |
245 | # define png_voidcast(type, value) (value) | 245 | # define png_voidcast(type, value) (value) |
246 | #endif /* __cplusplus */ | 246 | #endif /* __cplusplus */ |
247 | 247 | ||
248 | #ifndef PNG_EXTERN | 248 | #ifndef PNG_EXTERN |
249 | /* The functions exported by PNG_EXTERN are internal functions, which | 249 | /* The functions exported by PNG_EXTERN are internal functions, which |
250 | * aren't usually used outside the library (as far as I know), so it is | 250 | * aren't usually used outside the library (as far as I know), so it is |
251 | * debatable if they should be exported at all. In the future, when it | 251 | * debatable if they should be exported at all. In the future, when it |
252 | * is possible to have run-time registry of chunk-handling functions, | 252 | * is possible to have run-time registry of chunk-handling functions, |
253 | * some of these might be made available again. | 253 | * some of these might be made available again. |
254 | * | 254 | * |
255 | * 1.5.7: turned the use of 'extern' back on, since it is localized to pngpriv.h | 255 | * 1.5.7: turned the use of 'extern' back on, since it is localized to pngpriv.h |
256 | * it should be safe now (it is unclear why it was turned off.) | 256 | * it should be safe now (it is unclear why it was turned off.) |
257 | */ | 257 | */ |
258 | # define PNG_EXTERN extern | 258 | # define PNG_EXTERN extern |
259 | #endif | 259 | #endif |
260 | 260 | ||
261 | /* Some fixed point APIs are still required even if not exported because | 261 | /* Some fixed point APIs are still required even if not exported because |
262 | * they get used by the corresponding floating point APIs. This magic | 262 | * they get used by the corresponding floating point APIs. This magic |
263 | * deals with this: | 263 | * deals with this: |
264 | */ | 264 | */ |
265 | #ifdef PNG_FIXED_POINT_SUPPORTED | 265 | #ifdef PNG_FIXED_POINT_SUPPORTED |
266 | # define PNGFAPI PNGAPI | 266 | # define PNGFAPI PNGAPI |
267 | #else | 267 | #else |
268 | # define PNGFAPI /* PRIVATE */ | 268 | # define PNGFAPI /* PRIVATE */ |
269 | #endif | 269 | #endif |
270 | 270 | ||
271 | /* Other defines specific to compilers can go here. Try to keep | 271 | /* Other defines specific to compilers can go here. Try to keep |
272 | * them inside an appropriate ifdef/endif pair for portability. | 272 | * them inside an appropriate ifdef/endif pair for portability. |
273 | */ | 273 | */ |
274 | #if defined(PNG_FLOATING_POINT_SUPPORTED) ||\ | 274 | #if defined(PNG_FLOATING_POINT_SUPPORTED) ||\ |
275 | defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) | 275 | defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) |
276 | /* png.c requires the following ANSI-C constants if the conversion of | 276 | /* png.c requires the following ANSI-C constants if the conversion of |
277 | * floating point to ASCII is implemented therein: | 277 | * floating point to ASCII is implemented therein: |
278 | * | 278 | * |
279 | * DBL_DIG Maximum number of decimal digits (can be set to any constant) | 279 | * DBL_DIG Maximum number of decimal digits (can be set to any constant) |
280 | * DBL_MIN Smallest normalized fp number (can be set to an arbitrary value) | 280 | * DBL_MIN Smallest normalized fp number (can be set to an arbitrary value) |
281 | * DBL_MAX Maximum floating point number (can be set to an arbitrary value) | 281 | * DBL_MAX Maximum floating point number (can be set to an arbitrary value) |
282 | */ | 282 | */ |
283 | # include <float.h> | 283 | # include <float.h> |
284 | 284 | ||
285 | # if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \ | 285 | # if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \ |
286 | defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC) | 286 | defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC) |
287 | /* We need to check that <math.h> hasn't already been included earlier | 287 | /* We need to check that <math.h> hasn't already been included earlier |
288 | * as it seems it doesn't agree with <fp.h>, yet we should really use | 288 | * as it seems it doesn't agree with <fp.h>, yet we should really use |
289 | * <fp.h> if possible. | 289 | * <fp.h> if possible. |
290 | */ | 290 | */ |
291 | # if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__) | 291 | # if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__) |
292 | # include <fp.h> | 292 | # include <fp.h> |
293 | # endif | 293 | # endif |
294 | # else | 294 | # else |
295 | # include <math.h> | 295 | # include <math.h> |
296 | # endif | 296 | # endif |
297 | # if defined(_AMIGA) && defined(__SASC) && defined(_M68881) | 297 | # if defined(_AMIGA) && defined(__SASC) && defined(_M68881) |
298 | /* Amiga SAS/C: We must include builtin FPU functions when compiling using | 298 | /* Amiga SAS/C: We must include builtin FPU functions when compiling using |
299 | * MATH=68881 | 299 | * MATH=68881 |
300 | */ | 300 | */ |
301 | # include <m68881.h> | 301 | # include <m68881.h> |
302 | # endif | 302 | # endif |
303 | #endif | 303 | #endif |
304 | 304 | ||
305 | /* This provides the non-ANSI (far) memory allocation routines. */ | 305 | /* This provides the non-ANSI (far) memory allocation routines. */ |
306 | #if defined(__TURBOC__) && defined(__MSDOS__) | 306 | #if defined(__TURBOC__) && defined(__MSDOS__) |
307 | # include <mem.h> | 307 | # include <mem.h> |
308 | # include <alloc.h> | 308 | # include <alloc.h> |
309 | #endif | 309 | #endif |
310 | 310 | ||
311 | #if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \ | 311 | #if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \ |
312 | defined(_WIN32) || defined(__WIN32__) | 312 | defined(_WIN32) || defined(__WIN32__) |
313 | # include <windows.h> /* defines _WINDOWS_ macro */ | 313 | # include <windows.h> /* defines _WINDOWS_ macro */ |
314 | #endif | 314 | #endif |
315 | 315 | ||
316 | /* Moved here around 1.5.0beta36 from pngconf.h */ | 316 | /* Moved here around 1.5.0beta36 from pngconf.h */ |
317 | /* Users may want to use these so they are not private. Any library | 317 | /* Users may want to use these so they are not private. Any library |
318 | * functions that are passed far data must be model-independent. | 318 | * functions that are passed far data must be model-independent. |
319 | */ | 319 | */ |
320 | 320 | ||
321 | /* Memory model/platform independent fns */ | 321 | /* Memory model/platform independent fns */ |
322 | #ifndef PNG_ABORT | 322 | #ifndef PNG_ABORT |
323 | # ifdef _WINDOWS_ | 323 | # ifdef _WINDOWS_ |
324 | # define PNG_ABORT() ExitProcess(0) | 324 | # define PNG_ABORT() ExitProcess(0) |
325 | # else | 325 | # else |
326 | # define PNG_ABORT() abort() | 326 | # define PNG_ABORT() abort() |
327 | # endif | 327 | # endif |
328 | #endif | 328 | #endif |
329 | 329 | ||
330 | #ifdef USE_FAR_KEYWORD | 330 | #ifdef USE_FAR_KEYWORD |
331 | /* Use this to make far-to-near assignments */ | 331 | /* Use this to make far-to-near assignments */ |
332 | # define CHECK 1 | 332 | # define CHECK 1 |
333 | # define NOCHECK 0 | 333 | # define NOCHECK 0 |
334 | # define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) | 334 | # define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) |
335 | # define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) | 335 | # define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) |
336 | # define png_strlen _fstrlen | 336 | # define png_strlen _fstrlen |
337 | # define png_memcmp _fmemcmp /* SJT: added */ | 337 | # define png_memcmp _fmemcmp /* SJT: added */ |
338 | # define png_memcpy _fmemcpy | 338 | # define png_memcpy _fmemcpy |
339 | # define png_memset _fmemset | 339 | # define png_memset _fmemset |
340 | #else | 340 | #else |
341 | # ifdef _WINDOWS_ /* Favor Windows over C runtime fns */ | 341 | # ifdef _WINDOWS_ /* Favor Windows over C runtime fns */ |
342 | # define CVT_PTR(ptr) (ptr) | 342 | # define CVT_PTR(ptr) (ptr) |
343 | # define CVT_PTR_NOCHECK(ptr) (ptr) | 343 | # define CVT_PTR_NOCHECK(ptr) (ptr) |
344 | # define png_strlen lstrlenA | 344 | # define png_strlen lstrlenA |
345 | # define png_memcmp memcmp | 345 | # define png_memcmp memcmp |
346 | # define png_memcpy CopyMemory | 346 | # define png_memcpy CopyMemory |
347 | # define png_memset memset | 347 | # define png_memset memset |
348 | # else | 348 | # else |
349 | # define CVT_PTR(ptr) (ptr) | 349 | # define CVT_PTR(ptr) (ptr) |
350 | # define CVT_PTR_NOCHECK(ptr) (ptr) | 350 | # define CVT_PTR_NOCHECK(ptr) (ptr) |
351 | # define png_strlen strlen | 351 | # define png_strlen strlen |
352 | # define png_memcmp memcmp /* SJT: added */ | 352 | # define png_memcmp memcmp /* SJT: added */ |
353 | # define png_memcpy memcpy | 353 | # define png_memcpy memcpy |
354 | # define png_memset memset | 354 | # define png_memset memset |
355 | # endif | 355 | # endif |
356 | #endif | 356 | #endif |
357 | 357 | ||
358 | /* These macros may need to be architecture dependent. */ | 358 | /* These macros may need to be architecture dependent. */ |
359 | #define PNG_ALIGN_NONE 0 /* do not use data alignment */ | 359 | #define PNG_ALIGN_NONE 0 /* do not use data alignment */ |
360 | #define PNG_ALIGN_ALWAYS 1 /* assume unaligned accesses are OK */ | 360 | #define PNG_ALIGN_ALWAYS 1 /* assume unaligned accesses are OK */ |
361 | #ifdef offsetof | 361 | #ifdef offsetof |
362 | # define PNG_ALIGN_OFFSET 2 /* use offsetof to determine alignment */ | 362 | # define PNG_ALIGN_OFFSET 2 /* use offsetof to determine alignment */ |
363 | #else | 363 | #else |
364 | # define PNG_ALIGN_OFFSET -1 /* prevent the use of this */ | 364 | # define PNG_ALIGN_OFFSET -1 /* prevent the use of this */ |
365 | #endif | 365 | #endif |
366 | #define PNG_ALIGN_SIZE 3 /* use sizeof to determine alignment */ | 366 | #define PNG_ALIGN_SIZE 3 /* use sizeof to determine alignment */ |
367 | 367 | ||
368 | #ifndef PNG_ALIGN_TYPE | 368 | #ifndef PNG_ALIGN_TYPE |
369 | /* Default to using aligned access optimizations and requiring alignment to a | 369 | /* Default to using aligned access optimizations and requiring alignment to a |
370 | * multiple of the data type size. Override in a compiler specific fashion | 370 | * multiple of the data type size. Override in a compiler specific fashion |
371 | * if necessary by inserting tests here: | 371 | * if necessary by inserting tests here: |
372 | */ | 372 | */ |
373 | # define PNG_ALIGN_TYPE PNG_ALIGN_SIZE | 373 | # define PNG_ALIGN_TYPE PNG_ALIGN_SIZE |
374 | #endif | 374 | #endif |
375 | 375 | ||
376 | #if PNG_ALIGN_TYPE == PNG_ALIGN_SIZE | 376 | #if PNG_ALIGN_TYPE == PNG_ALIGN_SIZE |
377 | /* This is used because in some compiler implementations non-aligned | 377 | /* This is used because in some compiler implementations non-aligned |
378 | * structure members are supported, so the offsetof approach below fails. | 378 | * structure members are supported, so the offsetof approach below fails. |
379 | * Set PNG_ALIGN_TO_SIZE=0 for compiler combinations where unaligned access | 379 | * Set PNG_ALIGN_TO_SIZE=0 for compiler combinations where unaligned access |
380 | * is good for performance. Do not do this unless you have tested the result | 380 | * is good for performance. Do not do this unless you have tested the result |
381 | * and understand it. | 381 | * and understand it. |
382 | */ | 382 | */ |
383 | # define png_alignof(type) (sizeof (type)) | 383 | # define png_alignof(type) (sizeof (type)) |
384 | #else | 384 | #else |
385 | # if PNG_ALIGN_TYPE == PNG_ALIGN_OFFSET | 385 | # if PNG_ALIGN_TYPE == PNG_ALIGN_OFFSET |
386 | # define png_alignof(type) offsetof(struct{char c; type t;}, t) | 386 | # define png_alignof(type) offsetof(struct{char c; type t;}, t) |
387 | # else | 387 | # else |
388 | # if PNG_ALIGN_TYPE == PNG_ALIGN_ALWAYS | 388 | # if PNG_ALIGN_TYPE == PNG_ALIGN_ALWAYS |
389 | # define png_alignof(type) (1) | 389 | # define png_alignof(type) (1) |
390 | # endif | 390 | # endif |
391 | /* Else leave png_alignof undefined to prevent use thereof */ | 391 | /* Else leave png_alignof undefined to prevent use thereof */ |
392 | # endif | 392 | # endif |
393 | #endif | 393 | #endif |
394 | 394 | ||
395 | /* This implicitly assumes alignment is always to a power of 2. */ | 395 | /* This implicitly assumes alignment is always to a power of 2. */ |
396 | #ifdef png_alignof | 396 | #ifdef png_alignof |
397 | # define png_isaligned(ptr, type)\ | 397 | # define png_isaligned(ptr, type)\ |
398 | ((((const char*)ptr-(const char*)0) & (png_alignof(type)-1)) == 0) | 398 | ((((const char*)ptr-(const char*)0) & (png_alignof(type)-1)) == 0) |
399 | #else | 399 | #else |
400 | # define png_isaligned(ptr, type) 0 | 400 | # define png_isaligned(ptr, type) 0 |
401 | #endif | 401 | #endif |
402 | 402 | ||
403 | /* End of memory model/platform independent support */ | 403 | /* End of memory model/platform independent support */ |
404 | /* End of 1.5.0beta36 move from pngconf.h */ | 404 | /* End of 1.5.0beta36 move from pngconf.h */ |
405 | 405 | ||
406 | /* CONSTANTS and UTILITY MACROS | 406 | /* CONSTANTS and UTILITY MACROS |
407 | * These are used internally by libpng and not exposed in the API | 407 | * These are used internally by libpng and not exposed in the API |
408 | */ | 408 | */ |
409 | 409 | ||
410 | /* Various modes of operation. Note that after an init, mode is set to | 410 | /* Various modes of operation. Note that after an init, mode is set to |
411 | * zero automatically when the structure is created. Three of these | 411 | * zero automatically when the structure is created. Three of these |
412 | * are defined in png.h because they need to be visible to applications | 412 | * are defined in png.h because they need to be visible to applications |
413 | * that call png_set_unknown_chunk(). | 413 | * that call png_set_unknown_chunk(). |
414 | */ | 414 | */ |
415 | /* #define PNG_HAVE_IHDR 0x01 (defined in png.h) */ | 415 | /* #define PNG_HAVE_IHDR 0x01 (defined in png.h) */ |
416 | /* #define PNG_HAVE_PLTE 0x02 (defined in png.h) */ | 416 | /* #define PNG_HAVE_PLTE 0x02 (defined in png.h) */ |
417 | #define PNG_HAVE_IDAT 0x04 | 417 | #define PNG_HAVE_IDAT 0x04 |
418 | /* #define PNG_AFTER_IDAT 0x08 (defined in png.h) */ | 418 | /* #define PNG_AFTER_IDAT 0x08 (defined in png.h) */ |
419 | #define PNG_HAVE_IEND 0x10 | 419 | #define PNG_HAVE_IEND 0x10 |
420 | #define PNG_HAVE_gAMA 0x20 | 420 | #define PNG_HAVE_gAMA 0x20 |
421 | #define PNG_HAVE_cHRM 0x40 | 421 | #define PNG_HAVE_cHRM 0x40 |
422 | #define PNG_HAVE_sRGB 0x80 | 422 | #define PNG_HAVE_sRGB 0x80 |
423 | #define PNG_HAVE_CHUNK_HEADER 0x100 | 423 | #define PNG_HAVE_CHUNK_HEADER 0x100 |
424 | #define PNG_WROTE_tIME 0x200 | 424 | #define PNG_WROTE_tIME 0x200 |
425 | #define PNG_WROTE_INFO_BEFORE_PLTE 0x400 | 425 | #define PNG_WROTE_INFO_BEFORE_PLTE 0x400 |
426 | #define PNG_BACKGROUND_IS_GRAY 0x800 | 426 | #define PNG_BACKGROUND_IS_GRAY 0x800 |
427 | #define PNG_HAVE_PNG_SIGNATURE 0x1000 | 427 | #define PNG_HAVE_PNG_SIGNATURE 0x1000 |
428 | #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */ | 428 | #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */ |
429 | 429 | ||
430 | /* Flags for the transformations the PNG library does on the image data */ | 430 | /* Flags for the transformations the PNG library does on the image data */ |
431 | #define PNG_BGR 0x0001 | 431 | #define PNG_BGR 0x0001 |
432 | #define PNG_INTERLACE 0x0002 | 432 | #define PNG_INTERLACE 0x0002 |
433 | #define PNG_PACK 0x0004 | 433 | #define PNG_PACK 0x0004 |
434 | #define PNG_SHIFT 0x0008 | 434 | #define PNG_SHIFT 0x0008 |
435 | #define PNG_SWAP_BYTES 0x0010 | 435 | #define PNG_SWAP_BYTES 0x0010 |
436 | #define PNG_INVERT_MONO 0x0020 | 436 | #define PNG_INVERT_MONO 0x0020 |
437 | #define PNG_QUANTIZE 0x0040 | 437 | #define PNG_QUANTIZE 0x0040 |
438 | #define PNG_COMPOSE 0x0080 /* Was PNG_BACKGROUND */ | 438 | #define PNG_COMPOSE 0x0080 /* Was PNG_BACKGROUND */ |
439 | #define PNG_BACKGROUND_EXPAND 0x0100 | 439 | #define PNG_BACKGROUND_EXPAND 0x0100 |
440 | #define PNG_EXPAND_16 0x0200 /* Added to libpng 1.5.2 */ | 440 | #define PNG_EXPAND_16 0x0200 /* Added to libpng 1.5.2 */ |
441 | #define PNG_16_TO_8 0x0400 /* Becomes 'chop' in 1.5.4 */ | 441 | #define PNG_16_TO_8 0x0400 /* Becomes 'chop' in 1.5.4 */ |
442 | #define PNG_RGBA 0x0800 | 442 | #define PNG_RGBA 0x0800 |
443 | #define PNG_EXPAND 0x1000 | 443 | #define PNG_EXPAND 0x1000 |
444 | #define PNG_GAMMA 0x2000 | 444 | #define PNG_GAMMA 0x2000 |
445 | #define PNG_GRAY_TO_RGB 0x4000 | 445 | #define PNG_GRAY_TO_RGB 0x4000 |
446 | #define PNG_FILLER 0x8000 | 446 | #define PNG_FILLER 0x8000 |
447 | #define PNG_PACKSWAP 0x10000 | 447 | #define PNG_PACKSWAP 0x10000 |
448 | #define PNG_SWAP_ALPHA 0x20000 | 448 | #define PNG_SWAP_ALPHA 0x20000 |
449 | #define PNG_STRIP_ALPHA 0x40000 | 449 | #define PNG_STRIP_ALPHA 0x40000 |
450 | #define PNG_INVERT_ALPHA 0x80000 | 450 | #define PNG_INVERT_ALPHA 0x80000 |
451 | #define PNG_USER_TRANSFORM 0x100000 | 451 | #define PNG_USER_TRANSFORM 0x100000 |
452 | #define PNG_RGB_TO_GRAY_ERR 0x200000 | 452 | #define PNG_RGB_TO_GRAY_ERR 0x200000 |
453 | #define PNG_RGB_TO_GRAY_WARN 0x400000 | 453 | #define PNG_RGB_TO_GRAY_WARN 0x400000 |
454 | #define PNG_RGB_TO_GRAY 0x600000 /* two bits, RGB_TO_GRAY_ERR|WARN */ | 454 | #define PNG_RGB_TO_GRAY 0x600000 /* two bits, RGB_TO_GRAY_ERR|WARN */ |
455 | #define PNG_ENCODE_ALPHA 0x800000 /* Added to libpng-1.5.4 */ | 455 | #define PNG_ENCODE_ALPHA 0x800000 /* Added to libpng-1.5.4 */ |
456 | #define PNG_ADD_ALPHA 0x1000000 /* Added to libpng-1.2.7 */ | 456 | #define PNG_ADD_ALPHA 0x1000000 /* Added to libpng-1.2.7 */ |
457 | #define PNG_EXPAND_tRNS 0x2000000 /* Added to libpng-1.2.9 */ | 457 | #define PNG_EXPAND_tRNS 0x2000000 /* Added to libpng-1.2.9 */ |
458 | #define PNG_SCALE_16_TO_8 0x4000000 /* Added to libpng-1.5.4 */ | 458 | #define PNG_SCALE_16_TO_8 0x4000000 /* Added to libpng-1.5.4 */ |
459 | /* 0x8000000 unused */ | 459 | /* 0x8000000 unused */ |
460 | /* 0x10000000 unused */ | 460 | /* 0x10000000 unused */ |
461 | /* 0x20000000 unused */ | 461 | /* 0x20000000 unused */ |
462 | /* 0x40000000 unused */ | 462 | /* 0x40000000 unused */ |
463 | /* Flags for png_create_struct */ | 463 | /* Flags for png_create_struct */ |
464 | #define PNG_STRUCT_PNG 0x0001 | 464 | #define PNG_STRUCT_PNG 0x0001 |
465 | #define PNG_STRUCT_INFO 0x0002 | 465 | #define PNG_STRUCT_INFO 0x0002 |
466 | 466 | ||
467 | /* Scaling factor for filter heuristic weighting calculations */ | 467 | /* Scaling factor for filter heuristic weighting calculations */ |
468 | #define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT)) | 468 | #define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT)) |
469 | #define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT)) | 469 | #define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT)) |
470 | 470 | ||
471 | /* Flags for the png_ptr->flags rather than declaring a byte for each one */ | 471 | /* Flags for the png_ptr->flags rather than declaring a byte for each one */ |
472 | #define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001 | 472 | #define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001 |
473 | #define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002 | 473 | #define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002 |
474 | #define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004 | 474 | #define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004 |
475 | #define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008 | 475 | #define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008 |
476 | #define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010 | 476 | #define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010 |
477 | #define PNG_FLAG_ZLIB_FINISHED 0x0020 | 477 | #define PNG_FLAG_ZLIB_FINISHED 0x0020 |
478 | #define PNG_FLAG_ROW_INIT 0x0040 | 478 | #define PNG_FLAG_ROW_INIT 0x0040 |
479 | #define PNG_FLAG_FILLER_AFTER 0x0080 | 479 | #define PNG_FLAG_FILLER_AFTER 0x0080 |
480 | #define PNG_FLAG_CRC_ANCILLARY_USE 0x0100 | 480 | #define PNG_FLAG_CRC_ANCILLARY_USE 0x0100 |
481 | #define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200 | 481 | #define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200 |
482 | #define PNG_FLAG_CRC_CRITICAL_USE 0x0400 | 482 | #define PNG_FLAG_CRC_CRITICAL_USE 0x0400 |
483 | #define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800 | 483 | #define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800 |
484 | #define PNG_FLAG_ASSUME_sRGB 0x1000 /* Added to libpng-1.5.4 */ | 484 | #define PNG_FLAG_ASSUME_sRGB 0x1000 /* Added to libpng-1.5.4 */ |
485 | #define PNG_FLAG_OPTIMIZE_ALPHA 0x2000 /* Added to libpng-1.5.4 */ | 485 | #define PNG_FLAG_OPTIMIZE_ALPHA 0x2000 /* Added to libpng-1.5.4 */ |
486 | #define PNG_FLAG_DETECT_UNINITIALIZED 0x4000 /* Added to libpng-1.5.4 */ | 486 | #define PNG_FLAG_DETECT_UNINITIALIZED 0x4000 /* Added to libpng-1.5.4 */ |
487 | #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000 | 487 | #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000 |
488 | #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000 | 488 | #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000 |
489 | #define PNG_FLAG_LIBRARY_MISMATCH 0x20000 | 489 | #define PNG_FLAG_LIBRARY_MISMATCH 0x20000 |
490 | #define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000 | 490 | #define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000 |
491 | #define PNG_FLAG_STRIP_ERROR_TEXT 0x80000 | 491 | #define PNG_FLAG_STRIP_ERROR_TEXT 0x80000 |
492 | #define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000 | 492 | #define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000 |
493 | /* 0x200000 unused */ | 493 | /* 0x200000 unused */ |
494 | /* 0x400000 unused */ | 494 | /* 0x400000 unused */ |
495 | #define PNG_FLAG_BENIGN_ERRORS_WARN 0x800000 /* Added to libpng-1.4.0 */ | 495 | #define PNG_FLAG_BENIGN_ERRORS_WARN 0x800000 /* Added to libpng-1.4.0 */ |
496 | #define PNG_FLAG_ZTXT_CUSTOM_STRATEGY 0x1000000 /* 5 lines added */ | 496 | #define PNG_FLAG_ZTXT_CUSTOM_STRATEGY 0x1000000 /* 5 lines added */ |
497 | #define PNG_FLAG_ZTXT_CUSTOM_LEVEL 0x2000000 /* to libpng-1.5.4 */ | 497 | #define PNG_FLAG_ZTXT_CUSTOM_LEVEL 0x2000000 /* to libpng-1.5.4 */ |
498 | #define PNG_FLAG_ZTXT_CUSTOM_MEM_LEVEL 0x4000000 | 498 | #define PNG_FLAG_ZTXT_CUSTOM_MEM_LEVEL 0x4000000 |
499 | #define PNG_FLAG_ZTXT_CUSTOM_WINDOW_BITS 0x8000000 | 499 | #define PNG_FLAG_ZTXT_CUSTOM_WINDOW_BITS 0x8000000 |
500 | #define PNG_FLAG_ZTXT_CUSTOM_METHOD 0x10000000 | 500 | #define PNG_FLAG_ZTXT_CUSTOM_METHOD 0x10000000 |
501 | /* 0x20000000 unused */ | 501 | /* 0x20000000 unused */ |
502 | /* 0x40000000 unused */ | 502 | /* 0x40000000 unused */ |
503 | 503 | ||
504 | #define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \ | 504 | #define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \ |
505 | PNG_FLAG_CRC_ANCILLARY_NOWARN) | 505 | PNG_FLAG_CRC_ANCILLARY_NOWARN) |
506 | 506 | ||
507 | #define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \ | 507 | #define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \ |
508 | PNG_FLAG_CRC_CRITICAL_IGNORE) | 508 | PNG_FLAG_CRC_CRITICAL_IGNORE) |
509 | 509 | ||
510 | #define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \ | 510 | #define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \ |
511 | PNG_FLAG_CRC_CRITICAL_MASK) | 511 | PNG_FLAG_CRC_CRITICAL_MASK) |
512 | 512 | ||
513 | /* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib | 513 | /* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib |
514 | * can handle at once. This type need be no larger than 16 bits (so maximum of | 514 | * can handle at once. This type need be no larger than 16 bits (so maximum of |
515 | * 65535), this define allows us to discover how big it is, but limited by the | 515 | * 65535), this define allows us to discover how big it is, but limited by the |
516 | * maximuum for png_size_t. The value can be overriden in a library build | 516 | * maximuum for png_size_t. The value can be overriden in a library build |
517 | * (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably | 517 | * (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably |
518 | * lower value (e.g. 255 works). A lower value may help memory usage (slightly) | 518 | * lower value (e.g. 255 works). A lower value may help memory usage (slightly) |
519 | * and may even improve performance on some systems (and degrade it on others.) | 519 | * and may even improve performance on some systems (and degrade it on others.) |
520 | */ | 520 | */ |
521 | #ifndef ZLIB_IO_MAX | 521 | #ifndef ZLIB_IO_MAX |
522 | # define ZLIB_IO_MAX ((uInt)-1) | 522 | # define ZLIB_IO_MAX ((uInt)-1) |
523 | #endif | 523 | #endif |
524 | 524 | ||
525 | /* Save typing and make code easier to understand */ | 525 | /* Save typing and make code easier to understand */ |
526 | 526 | ||
527 | #define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \ | 527 | #define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \ |
528 | abs((int)((c1).green) - (int)((c2).green)) + \ | 528 | abs((int)((c1).green) - (int)((c2).green)) + \ |
529 | abs((int)((c1).blue) - (int)((c2).blue))) | 529 | abs((int)((c1).blue) - (int)((c2).blue))) |
530 | 530 | ||
531 | /* Added to libpng-1.2.6 JB */ | 531 | /* Added to libpng-1.2.6 JB */ |
532 | #define PNG_ROWBYTES(pixel_bits, width) \ | 532 | #define PNG_ROWBYTES(pixel_bits, width) \ |
533 | ((pixel_bits) >= 8 ? \ | 533 | ((pixel_bits) >= 8 ? \ |
534 | ((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \ | 534 | ((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \ |
535 | (( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) ) | 535 | (( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) ) |
536 | 536 | ||
537 | /* PNG_OUT_OF_RANGE returns true if value is outside the range | 537 | /* PNG_OUT_OF_RANGE returns true if value is outside the range |
538 | * ideal-delta..ideal+delta. Each argument is evaluated twice. | 538 | * ideal-delta..ideal+delta. Each argument is evaluated twice. |
539 | * "ideal" and "delta" should be constants, normally simple | 539 | * "ideal" and "delta" should be constants, normally simple |
540 | * integers, "value" a variable. Added to libpng-1.2.6 JB | 540 | * integers, "value" a variable. Added to libpng-1.2.6 JB |
541 | */ | 541 | */ |
542 | #define PNG_OUT_OF_RANGE(value, ideal, delta) \ | 542 | #define PNG_OUT_OF_RANGE(value, ideal, delta) \ |
543 | ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) ) | 543 | ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) ) |
544 | 544 | ||
545 | /* Conversions between fixed and floating point, only defined if | 545 | /* Conversions between fixed and floating point, only defined if |
546 | * required (to make sure the code doesn't accidentally use float | 546 | * required (to make sure the code doesn't accidentally use float |
547 | * when it is supposedly disabled.) | 547 | * when it is supposedly disabled.) |
548 | */ | 548 | */ |
549 | #ifdef PNG_FLOATING_POINT_SUPPORTED | 549 | #ifdef PNG_FLOATING_POINT_SUPPORTED |
550 | /* The floating point conversion can't overflow, though it can and | 550 | /* The floating point conversion can't overflow, though it can and |
551 | * does lose accuracy relative to the original fixed point value. | 551 | * does lose accuracy relative to the original fixed point value. |
552 | * In practice this doesn't matter because png_fixed_point only | 552 | * In practice this doesn't matter because png_fixed_point only |
553 | * stores numbers with very low precision. The png_ptr and s | 553 | * stores numbers with very low precision. The png_ptr and s |
554 | * arguments are unused by default but are there in case error | 554 | * arguments are unused by default but are there in case error |
555 | * checking becomes a requirement. | 555 | * checking becomes a requirement. |
556 | */ | 556 | */ |
557 | #define png_float(png_ptr, fixed, s) (.00001 * (fixed)) | 557 | #define png_float(png_ptr, fixed, s) (.00001 * (fixed)) |
558 | 558 | ||
559 | /* The fixed point conversion performs range checking and evaluates | 559 | /* The fixed point conversion performs range checking and evaluates |
560 | * its argument multiple times, so must be used with care. The | 560 | * its argument multiple times, so must be used with care. The |
561 | * range checking uses the PNG specification values for a signed | 561 | * range checking uses the PNG specification values for a signed |
562 | * 32 bit fixed point value except that the values are deliberately | 562 | * 32 bit fixed point value except that the values are deliberately |
563 | * rounded-to-zero to an integral value - 21474 (21474.83 is roughly | 563 | * rounded-to-zero to an integral value - 21474 (21474.83 is roughly |
564 | * (2^31-1) * 100000). 's' is a string that describes the value being | 564 | * (2^31-1) * 100000). 's' is a string that describes the value being |
565 | * converted. | 565 | * converted. |
566 | * | 566 | * |
567 | * NOTE: this macro will raise a png_error if the range check fails, | 567 | * NOTE: this macro will raise a png_error if the range check fails, |
568 | * therefore it is normally only appropriate to use this on values | 568 | * therefore it is normally only appropriate to use this on values |
569 | * that come from API calls or other sources where an out of range | 569 | * that come from API calls or other sources where an out of range |
570 | * error indicates a programming error, not a data error! | 570 | * error indicates a programming error, not a data error! |
571 | * | 571 | * |
572 | * NOTE: by default this is off - the macro is not used - because the | 572 | * NOTE: by default this is off - the macro is not used - because the |
573 | * function call saves a lot of code. | 573 | * function call saves a lot of code. |
574 | */ | 574 | */ |
575 | #ifdef PNG_FIXED_POINT_MACRO_SUPPORTED | 575 | #ifdef PNG_FIXED_POINT_MACRO_SUPPORTED |
576 | #define png_fixed(png_ptr, fp, s) ((fp) <= 21474 && (fp) >= -21474 ?\ | 576 | #define png_fixed(png_ptr, fp, s) ((fp) <= 21474 && (fp) >= -21474 ?\ |
577 | ((png_fixed_point)(100000 * (fp))) : (png_fixed_error(png_ptr, s),0)) | 577 | ((png_fixed_point)(100000 * (fp))) : (png_fixed_error(png_ptr, s),0)) |
578 | #else | 578 | #else |
579 | PNG_EXTERN png_fixed_point png_fixed PNGARG((png_structp png_ptr, double fp, | 579 | PNG_EXTERN png_fixed_point png_fixed PNGARG((png_structp png_ptr, double fp, |
580 | png_const_charp text)); | 580 | png_const_charp text)); |
581 | #endif | 581 | #endif |
582 | #endif | 582 | #endif |
583 | 583 | ||
584 | /* Constants for known chunk types. If you need to add a chunk, define the name | 584 | /* Constants for known chunk types. If you need to add a chunk, define the name |
585 | * here. For historical reasons these constants have the form png_<name>; i.e. | 585 | * here. For historical reasons these constants have the form png_<name>; i.e. |
586 | * the prefix is lower case. Please use decimal values as the parameters to | 586 | * the prefix is lower case. Please use decimal values as the parameters to |
587 | * match the ISO PNG specification and to avoid relying on the C locale | 587 | * match the ISO PNG specification and to avoid relying on the C locale |
588 | * interpretation of character values. | 588 | * interpretation of character values. |
589 | * | 589 | * |
590 | * Prior to 1.5.6 these constants were strings, as of 1.5.6 png_uint_32 values | 590 | * Prior to 1.5.6 these constants were strings, as of 1.5.6 png_uint_32 values |
591 | * are computed and a new macro (PNG_STRING_FROM_CHUNK) added to allow a string | 591 | * are computed and a new macro (PNG_STRING_FROM_CHUNK) added to allow a string |
592 | * to be generated if required. | 592 | * to be generated if required. |
593 | * | 593 | * |
594 | * PNG_32b correctly produces a value shifted by up to 24 bits, even on | 594 | * PNG_32b correctly produces a value shifted by up to 24 bits, even on |
595 | * architectures where (int) is only 16 bits. | 595 | * architectures where (int) is only 16 bits. |
596 | */ | 596 | */ |
597 | #define PNG_32b(b,s) ((png_uint_32)(b) << (s)) | 597 | #define PNG_32b(b,s) ((png_uint_32)(b) << (s)) |
598 | #define PNG_CHUNK(b1,b2,b3,b4) \ | 598 | #define PNG_CHUNK(b1,b2,b3,b4) \ |
599 | (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0)) | 599 | (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0)) |
600 | 600 | ||
601 | #define png_IHDR PNG_CHUNK( 73, 72, 68, 82) | 601 | #define png_IHDR PNG_CHUNK( 73, 72, 68, 82) |
602 | #define png_IDAT PNG_CHUNK( 73, 68, 65, 84) | 602 | #define png_IDAT PNG_CHUNK( 73, 68, 65, 84) |
603 | #define png_IEND PNG_CHUNK( 73, 69, 78, 68) | 603 | #define png_IEND PNG_CHUNK( 73, 69, 78, 68) |
604 | #define png_PLTE PNG_CHUNK( 80, 76, 84, 69) | 604 | #define png_PLTE PNG_CHUNK( 80, 76, 84, 69) |
605 | #define png_bKGD PNG_CHUNK( 98, 75, 71, 68) | 605 | #define png_bKGD PNG_CHUNK( 98, 75, 71, 68) |
606 | #define png_cHRM PNG_CHUNK( 99, 72, 82, 77) | 606 | #define png_cHRM PNG_CHUNK( 99, 72, 82, 77) |
607 | #define png_gAMA PNG_CHUNK(103, 65, 77, 65) | 607 | #define png_gAMA PNG_CHUNK(103, 65, 77, 65) |
608 | #define png_hIST PNG_CHUNK(104, 73, 83, 84) | 608 | #define png_hIST PNG_CHUNK(104, 73, 83, 84) |
609 | #define png_iCCP PNG_CHUNK(105, 67, 67, 80) | 609 | #define png_iCCP PNG_CHUNK(105, 67, 67, 80) |
610 | #define png_iTXt PNG_CHUNK(105, 84, 88, 116) | 610 | #define png_iTXt PNG_CHUNK(105, 84, 88, 116) |
611 | #define png_oFFs PNG_CHUNK(111, 70, 70, 115) | 611 | #define png_oFFs PNG_CHUNK(111, 70, 70, 115) |
612 | #define png_pCAL PNG_CHUNK(112, 67, 65, 76) | 612 | #define png_pCAL PNG_CHUNK(112, 67, 65, 76) |
613 | #define png_sCAL PNG_CHUNK(115, 67, 65, 76) | 613 | #define png_sCAL PNG_CHUNK(115, 67, 65, 76) |
614 | #define png_pHYs PNG_CHUNK(112, 72, 89, 115) | 614 | #define png_pHYs PNG_CHUNK(112, 72, 89, 115) |
615 | #define png_sBIT PNG_CHUNK(115, 66, 73, 84) | 615 | #define png_sBIT PNG_CHUNK(115, 66, 73, 84) |
616 | #define png_sPLT PNG_CHUNK(115, 80, 76, 84) | 616 | #define png_sPLT PNG_CHUNK(115, 80, 76, 84) |
617 | #define png_sRGB PNG_CHUNK(115, 82, 71, 66) | 617 | #define png_sRGB PNG_CHUNK(115, 82, 71, 66) |
618 | #define png_sTER PNG_CHUNK(115, 84, 69, 82) | 618 | #define png_sTER PNG_CHUNK(115, 84, 69, 82) |
619 | #define png_tEXt PNG_CHUNK(116, 69, 88, 116) | 619 | #define png_tEXt PNG_CHUNK(116, 69, 88, 116) |
620 | #define png_tIME PNG_CHUNK(116, 73, 77, 69) | 620 | #define png_tIME PNG_CHUNK(116, 73, 77, 69) |
621 | #define png_tRNS PNG_CHUNK(116, 82, 78, 83) | 621 | #define png_tRNS PNG_CHUNK(116, 82, 78, 83) |
622 | #define png_zTXt PNG_CHUNK(122, 84, 88, 116) | 622 | #define png_zTXt PNG_CHUNK(122, 84, 88, 116) |
623 | 623 | ||
624 | /* The following will work on (signed char*) strings, whereas the get_uint_32 | 624 | /* The following will work on (signed char*) strings, whereas the get_uint_32 |
625 | * macro will fail on top-bit-set values because of the sign extension. | 625 | * macro will fail on top-bit-set values because of the sign extension. |
626 | */ | 626 | */ |
627 | #define PNG_CHUNK_FROM_STRING(s)\ | 627 | #define PNG_CHUNK_FROM_STRING(s)\ |
628 | PNG_CHUNK(0xff&(s)[0], 0xff&(s)[1], 0xff&(s)[2], 0xff&(s)[3]) | 628 | PNG_CHUNK(0xff&(s)[0], 0xff&(s)[1], 0xff&(s)[2], 0xff&(s)[3]) |
629 | 629 | ||
630 | /* This uses (char), not (png_byte) to avoid warnings on systems where (char) is | 630 | /* This uses (char), not (png_byte) to avoid warnings on systems where (char) is |
631 | * signed and the argument is a (char[]) This macro will fail miserably on | 631 | * signed and the argument is a (char[]) This macro will fail miserably on |
632 | * systems where (char) is more than 8 bits. | 632 | * systems where (char) is more than 8 bits. |
633 | */ | 633 | */ |
634 | #define PNG_STRING_FROM_CHUNK(s,c)\ | 634 | #define PNG_STRING_FROM_CHUNK(s,c)\ |
635 | (void)(((char*)(s))[0]=(char)((c)>>24), ((char*)(s))[1]=(char)((c)>>16),\ | 635 | (void)(((char*)(s))[0]=(char)((c)>>24), ((char*)(s))[1]=(char)((c)>>16),\ |
636 | ((char*)(s))[2]=(char)((c)>>8), ((char*)(s))[3]=(char)((c))) | 636 | ((char*)(s))[2]=(char)((c)>>8), ((char*)(s))[3]=(char)((c))) |
637 | 637 | ||
638 | /* Do the same but terminate with a null character. */ | 638 | /* Do the same but terminate with a null character. */ |
639 | #define PNG_CSTRING_FROM_CHUNK(s,c)\ | 639 | #define PNG_CSTRING_FROM_CHUNK(s,c)\ |
640 | (void)(PNG_STRING_FROM_CHUNK(s,c), ((char*)(s))[4] = 0) | 640 | (void)(PNG_STRING_FROM_CHUNK(s,c), ((char*)(s))[4] = 0) |
641 | 641 | ||
642 | /* Test on flag values as defined in the spec (section 5.4): */ | 642 | /* Test on flag values as defined in the spec (section 5.4): */ |
643 | #define PNG_CHUNK_ANCILLIARY(c) (1 & ((c) >> 29)) | 643 | #define PNG_CHUNK_ANCILLIARY(c) (1 & ((c) >> 29)) |
644 | #define PNG_CHUNK_CRITICAL(c) (!PNG_CHUNK_ANCILLIARY(c)) | 644 | #define PNG_CHUNK_CRITICAL(c) (!PNG_CHUNK_ANCILLIARY(c)) |
645 | #define PNG_CHUNK_PRIVATE(c) (1 & ((c) >> 21)) | 645 | #define PNG_CHUNK_PRIVATE(c) (1 & ((c) >> 21)) |
646 | #define PNG_CHUNK_RESERVED(c) (1 & ((c) >> 13)) | 646 | #define PNG_CHUNK_RESERVED(c) (1 & ((c) >> 13)) |
647 | #define PNG_CHUNK_SAFE_TO_COPY(c) (1 & ((c) >> 5)) | 647 | #define PNG_CHUNK_SAFE_TO_COPY(c) (1 & ((c) >> 5)) |
648 | 648 | ||
649 | /* Gamma values (new at libpng-1.5.4): */ | 649 | /* Gamma values (new at libpng-1.5.4): */ |
650 | #define PNG_GAMMA_MAC_OLD 151724 /* Assume '1.8' is really 2.2/1.45! */ | 650 | #define PNG_GAMMA_MAC_OLD 151724 /* Assume '1.8' is really 2.2/1.45! */ |
651 | #define PNG_GAMMA_MAC_INVERSE 65909 | 651 | #define PNG_GAMMA_MAC_INVERSE 65909 |
652 | #define PNG_GAMMA_sRGB_INVERSE 45455 | 652 | #define PNG_GAMMA_sRGB_INVERSE 45455 |
653 | 653 | ||
654 | 654 | ||
655 | /* Inhibit C++ name-mangling for libpng functions but not for system calls. */ | 655 | /* Inhibit C++ name-mangling for libpng functions but not for system calls. */ |
656 | #ifdef __cplusplus | 656 | #ifdef __cplusplus |
657 | extern "C" { | 657 | extern "C" { |
658 | #endif /* __cplusplus */ | 658 | #endif /* __cplusplus */ |
659 | 659 | ||
660 | /* These functions are used internally in the code. They generally | 660 | /* These functions are used internally in the code. They generally |
661 | * shouldn't be used unless you are writing code to add or replace some | 661 | * shouldn't be used unless you are writing code to add or replace some |
662 | * functionality in libpng. More information about most functions can | 662 | * functionality in libpng. More information about most functions can |
663 | * be found in the files where the functions are located. | 663 | * be found in the files where the functions are located. |
664 | */ | 664 | */ |
665 | 665 | ||
666 | /* Check the user version string for compatibility, returns false if the version | 666 | /* Check the user version string for compatibility, returns false if the version |
667 | * numbers aren't compatible. | 667 | * numbers aren't compatible. |
668 | */ | 668 | */ |
669 | PNG_EXTERN int png_user_version_check(png_structp png_ptr, | 669 | PNG_EXTERN int png_user_version_check(png_structp png_ptr, |
670 | png_const_charp user_png_ver); | 670 | png_const_charp user_png_ver); |
671 | 671 | ||
672 | /* Allocate memory for an internal libpng struct */ | 672 | /* Allocate memory for an internal libpng struct */ |
673 | PNG_EXTERN PNG_FUNCTION(png_voidp,png_create_struct,PNGARG((int type)), | 673 | PNG_EXTERN PNG_FUNCTION(png_voidp,png_create_struct,PNGARG((int type)), |
674 | PNG_ALLOCATED); | 674 | PNG_ALLOCATED); |
675 | 675 | ||
676 | /* Free memory from internal libpng struct */ | 676 | /* Free memory from internal libpng struct */ |
677 | PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr)); | 677 | PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr)); |
678 | 678 | ||
679 | PNG_EXTERN PNG_FUNCTION(png_voidp,png_create_struct_2, | 679 | PNG_EXTERN PNG_FUNCTION(png_voidp,png_create_struct_2, |
680 | PNGARG((int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)), | 680 | PNGARG((int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)), |
681 | PNG_ALLOCATED); | 681 | PNG_ALLOCATED); |
682 | PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr, | 682 | PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr, |
683 | png_free_ptr free_fn, png_voidp mem_ptr)); | 683 | png_free_ptr free_fn, png_voidp mem_ptr)); |
684 | 684 | ||
685 | /* Free any memory that info_ptr points to and reset struct. */ | 685 | /* Free any memory that info_ptr points to and reset struct. */ |
686 | PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr, | 686 | PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr, |
687 | png_infop info_ptr)); | 687 | png_infop info_ptr)); |
688 | 688 | ||
689 | /* Function to allocate memory for zlib. PNGAPI is disallowed. */ | 689 | /* Function to allocate memory for zlib. PNGAPI is disallowed. */ |
690 | PNG_EXTERN PNG_FUNCTION(voidpf,png_zalloc,PNGARG((voidpf png_ptr, uInt items, | 690 | PNG_EXTERN PNG_FUNCTION(voidpf,png_zalloc,PNGARG((voidpf png_ptr, uInt items, |
691 | uInt size)),PNG_ALLOCATED); | 691 | uInt size)),PNG_ALLOCATED); |
692 | 692 | ||
693 | /* Function to free memory for zlib. PNGAPI is disallowed. */ | 693 | /* Function to free memory for zlib. PNGAPI is disallowed. */ |
694 | PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr)); | 694 | PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr)); |
695 | 695 | ||
696 | /* Next four functions are used internally as callbacks. PNGCBAPI is required | 696 | /* Next four functions are used internally as callbacks. PNGCBAPI is required |
697 | * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3, changed to | 697 | * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3, changed to |
698 | * PNGCBAPI at 1.5.0 | 698 | * PNGCBAPI at 1.5.0 |
699 | */ | 699 | */ |
700 | 700 | ||
701 | PNG_EXTERN void PNGCBAPI png_default_read_data PNGARG((png_structp png_ptr, | 701 | PNG_EXTERN void PNGCBAPI png_default_read_data PNGARG((png_structp png_ptr, |
702 | png_bytep data, png_size_t length)); | 702 | png_bytep data, png_size_t length)); |
703 | 703 | ||
704 | #ifdef PNG_PROGRESSIVE_READ_SUPPORTED | 704 | #ifdef PNG_PROGRESSIVE_READ_SUPPORTED |
705 | PNG_EXTERN void PNGCBAPI png_push_fill_buffer PNGARG((png_structp png_ptr, | 705 | PNG_EXTERN void PNGCBAPI png_push_fill_buffer PNGARG((png_structp png_ptr, |
706 | png_bytep buffer, png_size_t length)); | 706 | png_bytep buffer, png_size_t length)); |
707 | #endif | 707 | #endif |
708 | 708 | ||
709 | PNG_EXTERN void PNGCBAPI png_default_write_data PNGARG((png_structp png_ptr, | 709 | PNG_EXTERN void PNGCBAPI png_default_write_data PNGARG((png_structp png_ptr, |
710 | png_bytep data, png_size_t length)); | 710 | png_bytep data, png_size_t length)); |
711 | 711 | ||
712 | #ifdef PNG_WRITE_FLUSH_SUPPORTED | 712 | #ifdef PNG_WRITE_FLUSH_SUPPORTED |
713 | # ifdef PNG_STDIO_SUPPORTED | 713 | # ifdef PNG_STDIO_SUPPORTED |
714 | PNG_EXTERN void PNGCBAPI png_default_flush PNGARG((png_structp png_ptr)); | 714 | PNG_EXTERN void PNGCBAPI png_default_flush PNGARG((png_structp png_ptr)); |
715 | # endif | 715 | # endif |
716 | #endif | 716 | #endif |
717 | 717 | ||
718 | /* Reset the CRC variable */ | 718 | /* Reset the CRC variable */ |
719 | PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr)); | 719 | PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr)); |
720 | 720 | ||
721 | /* Write the "data" buffer to whatever output you are using */ | 721 | /* Write the "data" buffer to whatever output you are using */ |
722 | PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, | 722 | PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, |
723 | png_const_bytep data, png_size_t length)); | 723 | png_const_bytep data, png_size_t length)); |
724 | 724 | ||
725 | /* Read and check the PNG file signature */ | 725 | /* Read and check the PNG file signature */ |
726 | PNG_EXTERN void png_read_sig PNGARG((png_structp png_ptr, png_infop info_ptr)); | 726 | PNG_EXTERN void png_read_sig PNGARG((png_structp png_ptr, png_infop info_ptr)); |
727 | 727 | ||
728 | /* Read the chunk header (length + type name) */ | 728 | /* Read the chunk header (length + type name) */ |
729 | PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr)); | 729 | PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr)); |
730 | 730 | ||
731 | /* Read data from whatever input you are using into the "data" buffer */ | 731 | /* Read data from whatever input you are using into the "data" buffer */ |
732 | PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data, | 732 | PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data, |
733 | png_size_t length)); | 733 | png_size_t length)); |
734 | 734 | ||
735 | /* Read bytes into buf, and update png_ptr->crc */ | 735 | /* Read bytes into buf, and update png_ptr->crc */ |
736 | PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf, | 736 | PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf, |
737 | png_size_t length)); | 737 | png_size_t length)); |
738 | 738 | ||
739 | /* Decompress data in a chunk that uses compression */ | 739 | /* Decompress data in a chunk that uses compression */ |
740 | #if defined(PNG_READ_COMPRESSED_TEXT_SUPPORTED) | 740 | #if defined(PNG_READ_COMPRESSED_TEXT_SUPPORTED) |
741 | PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr, | 741 | PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr, |
742 | int comp_type, png_size_t chunklength, png_size_t prefix_length, | 742 | int comp_type, png_size_t chunklength, png_size_t prefix_length, |
743 | png_size_t *data_length)); | 743 | png_size_t *data_length)); |
744 | #endif | 744 | #endif |
745 | 745 | ||
746 | /* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */ | 746 | /* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */ |
747 | PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip)); | 747 | PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip)); |
748 | 748 | ||
749 | /* Read the CRC from the file and compare it to the libpng calculated CRC */ | 749 | /* Read the CRC from the file and compare it to the libpng calculated CRC */ |
750 | PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr)); | 750 | PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr)); |
751 | 751 | ||
752 | /* Calculate the CRC over a section of data. Note that we are only | 752 | /* Calculate the CRC over a section of data. Note that we are only |
753 | * passing a maximum of 64K on systems that have this as a memory limit, | 753 | * passing a maximum of 64K on systems that have this as a memory limit, |
754 | * since this is the maximum buffer size we can specify. | 754 | * since this is the maximum buffer size we can specify. |
755 | */ | 755 | */ |
756 | PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, | 756 | PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, |
757 | png_const_bytep ptr, png_size_t length)); | 757 | png_const_bytep ptr, png_size_t length)); |
758 | 758 | ||
759 | #ifdef PNG_WRITE_FLUSH_SUPPORTED | 759 | #ifdef PNG_WRITE_FLUSH_SUPPORTED |
760 | PNG_EXTERN void png_flush PNGARG((png_structp png_ptr)); | 760 | PNG_EXTERN void png_flush PNGARG((png_structp png_ptr)); |
761 | #endif | 761 | #endif |
762 | 762 | ||
763 | /* Write various chunks */ | 763 | /* Write various chunks */ |
764 | 764 | ||
765 | /* Write the IHDR chunk, and update the png_struct with the necessary | 765 | /* Write the IHDR chunk, and update the png_struct with the necessary |
766 | * information. | 766 | * information. |
767 | */ | 767 | */ |
768 | PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width, | 768 | PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width, |
769 | png_uint_32 height, | 769 | png_uint_32 height, |
770 | int bit_depth, int color_type, int compression_method, int filter_method, | 770 | int bit_depth, int color_type, int compression_method, int filter_method, |
771 | int interlace_method)); | 771 | int interlace_method)); |
772 | 772 | ||
773 | PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, | 773 | PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, |
774 | png_const_colorp palette, png_uint_32 num_pal)); | 774 | png_const_colorp palette, png_uint_32 num_pal)); |
775 | 775 | ||
776 | PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data, | 776 | PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data, |
777 | png_size_t length)); | 777 | png_size_t length)); |
778 | 778 | ||
779 | PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr)); | 779 | PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr)); |
780 | 780 | ||
781 | #ifdef PNG_WRITE_gAMA_SUPPORTED | 781 | #ifdef PNG_WRITE_gAMA_SUPPORTED |
782 | # ifdef PNG_FLOATING_POINT_SUPPORTED | 782 | # ifdef PNG_FLOATING_POINT_SUPPORTED |
783 | PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma)); | 783 | PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma)); |
784 | # endif | 784 | # endif |
785 | # ifdef PNG_FIXED_POINT_SUPPORTED | 785 | # ifdef PNG_FIXED_POINT_SUPPORTED |
786 | PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, | 786 | PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, |
787 | png_fixed_point file_gamma)); | 787 | png_fixed_point file_gamma)); |
788 | # endif | 788 | # endif |
789 | #endif | 789 | #endif |
790 | 790 | ||
791 | #ifdef PNG_WRITE_sBIT_SUPPORTED | 791 | #ifdef PNG_WRITE_sBIT_SUPPORTED |
792 | PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, | 792 | PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, |
793 | png_const_color_8p sbit, int color_type)); | 793 | png_const_color_8p sbit, int color_type)); |
794 | #endif | 794 | #endif |
795 | 795 | ||
796 | #ifdef PNG_WRITE_cHRM_SUPPORTED | 796 | #ifdef PNG_WRITE_cHRM_SUPPORTED |
797 | # ifdef PNG_FLOATING_POINT_SUPPORTED | 797 | # ifdef PNG_FLOATING_POINT_SUPPORTED |
798 | PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr, | 798 | PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr, |
799 | double white_x, double white_y, | 799 | double white_x, double white_y, |
800 | double red_x, double red_y, double green_x, double green_y, | 800 | double red_x, double red_y, double green_x, double green_y, |
801 | double blue_x, double blue_y)); | 801 | double blue_x, double blue_y)); |
802 | # endif | 802 | # endif |
803 | PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr, | 803 | PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr, |
804 | png_fixed_point int_white_x, png_fixed_point int_white_y, | 804 | png_fixed_point int_white_x, png_fixed_point int_white_y, |
805 | png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point | 805 | png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point |
806 | int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, | 806 | int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, |
807 | png_fixed_point int_blue_y)); | 807 | png_fixed_point int_blue_y)); |
808 | #endif | 808 | #endif |
809 | 809 | ||
810 | #ifdef PNG_WRITE_sRGB_SUPPORTED | 810 | #ifdef PNG_WRITE_sRGB_SUPPORTED |
811 | PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr, | 811 | PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr, |
812 | int intent)); | 812 | int intent)); |
813 | #endif | 813 | #endif |
814 | 814 | ||
815 | #ifdef PNG_WRITE_iCCP_SUPPORTED | 815 | #ifdef PNG_WRITE_iCCP_SUPPORTED |
816 | PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr, | 816 | PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr, |
817 | png_const_charp name, int compression_type, | 817 | png_const_charp name, int compression_type, |
818 | png_const_charp profile, int proflen)); | 818 | png_const_charp profile, int proflen)); |
819 | /* Note to maintainer: profile should be png_bytep */ | 819 | /* Note to maintainer: profile should be png_bytep */ |
820 | #endif | 820 | #endif |
821 | 821 | ||
822 | #ifdef PNG_WRITE_sPLT_SUPPORTED | 822 | #ifdef PNG_WRITE_sPLT_SUPPORTED |
823 | PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr, | 823 | PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr, |
824 | png_const_sPLT_tp palette)); | 824 | png_const_sPLT_tp palette)); |
825 | #endif | 825 | #endif |
826 | 826 | ||
827 | #ifdef PNG_WRITE_tRNS_SUPPORTED | 827 | #ifdef PNG_WRITE_tRNS_SUPPORTED |
828 | PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, | 828 | PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, |
829 | png_const_bytep trans, png_const_color_16p values, int number, | 829 | png_const_bytep trans, png_const_color_16p values, int number, |
830 | int color_type)); | 830 | int color_type)); |
831 | #endif | 831 | #endif |
832 | 832 | ||
833 | #ifdef PNG_WRITE_bKGD_SUPPORTED | 833 | #ifdef PNG_WRITE_bKGD_SUPPORTED |
834 | PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr, | 834 | PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr, |
835 | png_const_color_16p values, int color_type)); | 835 | png_const_color_16p values, int color_type)); |
836 | #endif | 836 | #endif |
837 | 837 | ||
838 | #ifdef PNG_WRITE_hIST_SUPPORTED | 838 | #ifdef PNG_WRITE_hIST_SUPPORTED |
839 | PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, | 839 | PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, |
840 | png_const_uint_16p hist, int num_hist)); | 840 | png_const_uint_16p hist, int num_hist)); |
841 | #endif | 841 | #endif |
842 | 842 | ||
843 | /* Chunks that have keywords */ | 843 | /* Chunks that have keywords */ |
844 | #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \ | 844 | #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \ |
845 | defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) | 845 | defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) |
846 | PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr, | 846 | PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr, |
847 | png_const_charp key, png_charpp new_key)); | 847 | png_const_charp key, png_charpp new_key)); |
848 | #endif | 848 | #endif |
849 | 849 | ||
850 | #ifdef PNG_WRITE_tEXt_SUPPORTED | 850 | #ifdef PNG_WRITE_tEXt_SUPPORTED |
851 | PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_const_charp key, | 851 | PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_const_charp key, |
852 | png_const_charp text, png_size_t text_len)); | 852 | png_const_charp text, png_size_t text_len)); |
853 | #endif | 853 | #endif |
854 | 854 | ||
855 | #ifdef PNG_WRITE_zTXt_SUPPORTED | 855 | #ifdef PNG_WRITE_zTXt_SUPPORTED |
856 | PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_const_charp key, | 856 | PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_const_charp key, |
857 | png_const_charp text, png_size_t text_len, int compression)); | 857 | png_const_charp text, png_size_t text_len, int compression)); |
858 | #endif | 858 | #endif |
859 | 859 | ||
860 | #ifdef PNG_WRITE_iTXt_SUPPORTED | 860 | #ifdef PNG_WRITE_iTXt_SUPPORTED |
861 | PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr, | 861 | PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr, |
862 | int compression, png_const_charp key, png_const_charp lang, | 862 | int compression, png_const_charp key, png_const_charp lang, |
863 | png_const_charp lang_key, png_const_charp text)); | 863 | png_const_charp lang_key, png_const_charp text)); |
864 | #endif | 864 | #endif |
865 | 865 | ||
866 | #ifdef PNG_TEXT_SUPPORTED /* Added at version 1.0.14 and 1.2.4 */ | 866 | #ifdef PNG_TEXT_SUPPORTED /* Added at version 1.0.14 and 1.2.4 */ |
867 | PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr, | 867 | PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr, |
868 | png_infop info_ptr, png_const_textp text_ptr, int num_text)); | 868 | png_infop info_ptr, png_const_textp text_ptr, int num_text)); |
869 | #endif | 869 | #endif |
870 | 870 | ||
871 | #ifdef PNG_WRITE_oFFs_SUPPORTED | 871 | #ifdef PNG_WRITE_oFFs_SUPPORTED |
872 | PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr, | 872 | PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr, |
873 | png_int_32 x_offset, png_int_32 y_offset, int unit_type)); | 873 | png_int_32 x_offset, png_int_32 y_offset, int unit_type)); |
874 | #endif | 874 | #endif |
875 | 875 | ||
876 | #ifdef PNG_WRITE_pCAL_SUPPORTED | 876 | #ifdef PNG_WRITE_pCAL_SUPPORTED |
877 | PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose, | 877 | PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose, |
878 | png_int_32 X0, png_int_32 X1, int type, int nparams, | 878 | png_int_32 X0, png_int_32 X1, int type, int nparams, |
879 | png_const_charp units, png_charpp params)); | 879 | png_const_charp units, png_charpp params)); |
880 | #endif | 880 | #endif |
881 | 881 | ||
882 | #ifdef PNG_WRITE_pHYs_SUPPORTED | 882 | #ifdef PNG_WRITE_pHYs_SUPPORTED |
883 | PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr, | 883 | PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr, |
884 | png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit, | 884 | png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit, |
885 | int unit_type)); | 885 | int unit_type)); |
886 | #endif | 886 | #endif |
887 | 887 | ||
888 | #ifdef PNG_WRITE_tIME_SUPPORTED | 888 | #ifdef PNG_WRITE_tIME_SUPPORTED |
889 | PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr, | 889 | PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr, |
890 | png_const_timep mod_time)); | 890 | png_const_timep mod_time)); |
891 | #endif | 891 | #endif |
892 | 892 | ||
893 | #ifdef PNG_WRITE_sCAL_SUPPORTED | 893 | #ifdef PNG_WRITE_sCAL_SUPPORTED |
894 | PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr, | 894 | PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr, |
895 | int unit, png_const_charp width, png_const_charp height)); | 895 | int unit, png_const_charp width, png_const_charp height)); |
896 | #endif | 896 | #endif |
897 | 897 | ||
898 | /* Called when finished processing a row of data */ | 898 | /* Called when finished processing a row of data */ |
899 | PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)); | 899 | PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)); |
900 | 900 | ||
901 | /* Internal use only. Called before first row of data */ | 901 | /* Internal use only. Called before first row of data */ |
902 | PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr)); | 902 | PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr)); |
903 | 903 | ||
904 | /* Combine a row of data, dealing with alpha, etc. if requested. 'row' is an | 904 | /* Combine a row of data, dealing with alpha, etc. if requested. 'row' is an |
905 | * array of png_ptr->width pixels. If the image is not interlaced or this | 905 | * array of png_ptr->width pixels. If the image is not interlaced or this |
906 | * is the final pass this just does a png_memcpy, otherwise the "display" flag | 906 | * is the final pass this just does a png_memcpy, otherwise the "display" flag |
907 | * is used to determine whether to copy pixels that are not in the current pass. | 907 | * is used to determine whether to copy pixels that are not in the current pass. |
908 | * | 908 | * |
909 | * Because 'png_do_read_interlace' (below) replicates pixels this allows this | 909 | * Because 'png_do_read_interlace' (below) replicates pixels this allows this |
910 | * function to achieve the documented 'blocky' appearance during interlaced read | 910 | * function to achieve the documented 'blocky' appearance during interlaced read |
911 | * if display is 1 and the 'sparkle' appearance, where existing pixels in 'row' | 911 | * if display is 1 and the 'sparkle' appearance, where existing pixels in 'row' |
912 | * are not changed if they are not in the current pass, when display is 0. | 912 | * are not changed if they are not in the current pass, when display is 0. |
913 | * | 913 | * |
914 | * 'display' must be 0 or 1, otherwise the memcpy will be done regardless. | 914 | * 'display' must be 0 or 1, otherwise the memcpy will be done regardless. |
915 | * | 915 | * |
916 | * The API always reads from the png_struct row buffer and always assumes that | 916 | * The API always reads from the png_struct row buffer and always assumes that |
917 | * it is full width (png_do_read_interlace has already been called.) | 917 | * it is full width (png_do_read_interlace has already been called.) |
918 | * | 918 | * |
919 | * This function is only ever used to write to row buffers provided by the | 919 | * This function is only ever used to write to row buffers provided by the |
920 | * caller of the relevant libpng API and the row must have already been | 920 | * caller of the relevant libpng API and the row must have already been |
921 | * transformed by the read transformations. | 921 | * transformed by the read transformations. |
922 | * | 922 | * |
923 | * The PNG_USE_COMPILE_TIME_MASKS option causes generation of pre-computed | 923 | * The PNG_USE_COMPILE_TIME_MASKS option causes generation of pre-computed |
924 | * bitmasks for use within the code, otherwise runtime generated masks are used. | 924 | * bitmasks for use within the code, otherwise runtime generated masks are used. |
925 | * The default is compile time masks. | 925 | * The default is compile time masks. |
926 | */ | 926 | */ |
927 | #ifndef PNG_USE_COMPILE_TIME_MASKS | 927 | #ifndef PNG_USE_COMPILE_TIME_MASKS |
928 | # define PNG_USE_COMPILE_TIME_MASKS 1 | 928 | # define PNG_USE_COMPILE_TIME_MASKS 1 |
929 | #endif | 929 | #endif |
930 | PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row, | 930 | PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row, |
931 | int display)); | 931 | int display)); |
932 | 932 | ||
933 | #ifdef PNG_READ_INTERLACING_SUPPORTED | 933 | #ifdef PNG_READ_INTERLACING_SUPPORTED |
934 | /* Expand an interlaced row: the 'row_info' describes the pass data that has | 934 | /* Expand an interlaced row: the 'row_info' describes the pass data that has |
935 | * been read in and must correspond to the pixels in 'row', the pixels are | 935 | * been read in and must correspond to the pixels in 'row', the pixels are |
936 | * expanded (moved apart) in 'row' to match the final layout, when doing this | 936 | * expanded (moved apart) in 'row' to match the final layout, when doing this |
937 | * the pixels are *replicated* to the intervening space. This is essential for | 937 | * the pixels are *replicated* to the intervening space. This is essential for |
938 | * the correct operation of png_combine_row, above. | 938 | * the correct operation of png_combine_row, above. |
939 | */ | 939 | */ |
940 | PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info, | 940 | PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info, |
941 | png_bytep row, int pass, png_uint_32 transformations)); | 941 | png_bytep row, int pass, png_uint_32 transformations)); |
942 | #endif | 942 | #endif |
943 | 943 | ||
944 | /* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */ | 944 | /* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */ |
945 | 945 | ||
946 | #ifdef PNG_WRITE_INTERLACING_SUPPORTED | 946 | #ifdef PNG_WRITE_INTERLACING_SUPPORTED |
947 | /* Grab pixels out of a row for an interlaced pass */ | 947 | /* Grab pixels out of a row for an interlaced pass */ |
948 | PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info, | 948 | PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info, |
949 | png_bytep row, int pass)); | 949 | png_bytep row, int pass)); |
950 | #endif | 950 | #endif |
951 | 951 | ||
952 | /* Unfilter a row: check the filter value before calling this, there is no point | 952 | /* Unfilter a row: check the filter value before calling this, there is no point |
953 | * calling it for PNG_FILTER_VALUE_NONE. | 953 | * calling it for PNG_FILTER_VALUE_NONE. |
954 | */ | 954 | */ |
955 | PNG_EXTERN void png_read_filter_row PNGARG((png_structp pp, png_row_infop row_info, | 955 | PNG_EXTERN void png_read_filter_row PNGARG((png_structp pp, png_row_infop row_info, |
956 | png_bytep row, png_const_bytep prev_row, int filter)); | 956 | png_bytep row, png_const_bytep prev_row, int filter)); |
957 | 957 | ||
958 | PNG_EXTERN void png_read_filter_row_up_neon PNGARG((png_row_infop row_info, | 958 | PNG_EXTERN void png_read_filter_row_up_neon PNGARG((png_row_infop row_info, |
959 | png_bytep row, png_const_bytep prev_row)); | 959 | png_bytep row, png_const_bytep prev_row)); |
960 | PNG_EXTERN void png_read_filter_row_sub3_neon PNGARG((png_row_infop row_info, | 960 | PNG_EXTERN void png_read_filter_row_sub3_neon PNGARG((png_row_infop row_info, |
961 | png_bytep row, png_const_bytep prev_row)); | 961 | png_bytep row, png_const_bytep prev_row)); |
962 | PNG_EXTERN void png_read_filter_row_sub4_neon PNGARG((png_row_infop row_info, | 962 | PNG_EXTERN void png_read_filter_row_sub4_neon PNGARG((png_row_infop row_info, |
963 | png_bytep row, png_const_bytep prev_row)); | 963 | png_bytep row, png_const_bytep prev_row)); |
964 | PNG_EXTERN void png_read_filter_row_avg3_neon PNGARG((png_row_infop row_info, | 964 | PNG_EXTERN void png_read_filter_row_avg3_neon PNGARG((png_row_infop row_info, |
965 | png_bytep row, png_const_bytep prev_row)); | 965 | png_bytep row, png_const_bytep prev_row)); |
966 | PNG_EXTERN void png_read_filter_row_avg4_neon PNGARG((png_row_infop row_info, | 966 | PNG_EXTERN void png_read_filter_row_avg4_neon PNGARG((png_row_infop row_info, |
967 | png_bytep row, png_const_bytep prev_row)); | 967 | png_bytep row, png_const_bytep prev_row)); |
968 | PNG_EXTERN void png_read_filter_row_paeth3_neon PNGARG((png_row_infop row_info, | 968 | PNG_EXTERN void png_read_filter_row_paeth3_neon PNGARG((png_row_infop row_info, |
969 | png_bytep row, png_const_bytep prev_row)); | 969 | png_bytep row, png_const_bytep prev_row)); |
970 | PNG_EXTERN void png_read_filter_row_paeth4_neon PNGARG((png_row_infop row_info, | 970 | PNG_EXTERN void png_read_filter_row_paeth4_neon PNGARG((png_row_infop row_info, |
971 | png_bytep row, png_const_bytep prev_row)); | 971 | png_bytep row, png_const_bytep prev_row)); |
972 | 972 | ||
973 | /* Choose the best filter to use and filter the row data */ | 973 | /* Choose the best filter to use and filter the row data */ |
974 | PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr, | 974 | PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr, |
975 | png_row_infop row_info)); | 975 | png_row_infop row_info)); |
976 | 976 | ||
977 | /* Finish a row while reading, dealing with interlacing passes, etc. */ | 977 | /* Finish a row while reading, dealing with interlacing passes, etc. */ |
978 | PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr)); | 978 | PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr)); |
979 | 979 | ||
980 | /* Initialize the row buffers, etc. */ | 980 | /* Initialize the row buffers, etc. */ |
981 | PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr)); | 981 | PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr)); |
982 | 982 | ||
983 | #ifdef PNG_READ_TRANSFORMS_SUPPORTED | 983 | #ifdef PNG_READ_TRANSFORMS_SUPPORTED |
984 | /* Optional call to update the users info structure */ | 984 | /* Optional call to update the users info structure */ |
985 | PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr, | 985 | PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr, |
986 | png_infop info_ptr)); | 986 | png_infop info_ptr)); |
987 | #endif | 987 | #endif |
988 | 988 | ||
989 | /* These are the functions that do the transformations */ | 989 | /* These are the functions that do the transformations */ |
990 | #ifdef PNG_READ_FILLER_SUPPORTED | 990 | #ifdef PNG_READ_FILLER_SUPPORTED |
991 | PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info, | 991 | PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info, |
992 | png_bytep row, png_uint_32 filler, png_uint_32 flags)); | 992 | png_bytep row, png_uint_32 filler, png_uint_32 flags)); |
993 | #endif | 993 | #endif |
994 | 994 | ||
995 | #ifdef PNG_READ_SWAP_ALPHA_SUPPORTED | 995 | #ifdef PNG_READ_SWAP_ALPHA_SUPPORTED |
996 | PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info, | 996 | PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info, |
997 | png_bytep row)); | 997 | png_bytep row)); |
998 | #endif | 998 | #endif |
999 | 999 | ||
1000 | #ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED | 1000 | #ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED |
1001 | PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info, | 1001 | PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info, |
1002 | png_bytep row)); | 1002 | png_bytep row)); |
1003 | #endif | 1003 | #endif |
1004 | 1004 | ||
1005 | #ifdef PNG_READ_INVERT_ALPHA_SUPPORTED | 1005 | #ifdef PNG_READ_INVERT_ALPHA_SUPPORTED |
1006 | PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info, | 1006 | PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info, |
1007 | png_bytep row)); | 1007 | png_bytep row)); |
1008 | #endif | 1008 | #endif |
1009 | 1009 | ||
1010 | #ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED | 1010 | #ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED |
1011 | PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info, | 1011 | PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info, |
1012 | png_bytep row)); | 1012 | png_bytep row)); |
1013 | #endif | 1013 | #endif |
1014 | 1014 | ||
1015 | #if defined(PNG_WRITE_FILLER_SUPPORTED) || \ | 1015 | #if defined(PNG_WRITE_FILLER_SUPPORTED) || \ |
1016 | defined(PNG_READ_STRIP_ALPHA_SUPPORTED) | 1016 | defined(PNG_READ_STRIP_ALPHA_SUPPORTED) |
1017 | PNG_EXTERN void png_do_strip_channel PNGARG((png_row_infop row_info, | 1017 | PNG_EXTERN void png_do_strip_channel PNGARG((png_row_infop row_info, |
1018 | png_bytep row, int at_start)); | 1018 | png_bytep row, int at_start)); |
1019 | #endif | 1019 | #endif |
1020 | 1020 | ||
1021 | #ifdef PNG_16BIT_SUPPORTED | 1021 | #ifdef PNG_16BIT_SUPPORTED |
1022 | #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) | 1022 | #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) |
1023 | PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, | 1023 | PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, |
1024 | png_bytep row)); | 1024 | png_bytep row)); |
1025 | #endif | 1025 | #endif |
1026 | #endif | 1026 | #endif |
1027 | 1027 | ||
1028 | #if defined(PNG_READ_PACKSWAP_SUPPORTED) || \ | 1028 | #if defined(PNG_READ_PACKSWAP_SUPPORTED) || \ |
1029 | defined(PNG_WRITE_PACKSWAP_SUPPORTED) | 1029 | defined(PNG_WRITE_PACKSWAP_SUPPORTED) |
1030 | PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, | 1030 | PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, |
1031 | png_bytep row)); | 1031 | png_bytep row)); |
1032 | #endif | 1032 | #endif |
1033 | 1033 | ||
1034 | #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED | 1034 | #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED |
1035 | PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, | 1035 | PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, |
1036 | png_row_infop row_info, png_bytep row)); | 1036 | png_row_infop row_info, png_bytep row)); |
1037 | #endif | 1037 | #endif |
1038 | 1038 | ||
1039 | #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED | 1039 | #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED |
1040 | PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info, | 1040 | PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info, |
1041 | png_bytep row)); | 1041 | png_bytep row)); |
1042 | #endif | 1042 | #endif |
1043 | 1043 | ||
1044 | #ifdef PNG_READ_PACK_SUPPORTED | 1044 | #ifdef PNG_READ_PACK_SUPPORTED |
1045 | PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, | 1045 | PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, |
1046 | png_bytep row)); | 1046 | png_bytep row)); |
1047 | #endif | 1047 | #endif |
1048 | 1048 | ||
1049 | #ifdef PNG_READ_SHIFT_SUPPORTED | 1049 | #ifdef PNG_READ_SHIFT_SUPPORTED |
1050 | PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, | 1050 | PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, |
1051 | png_bytep row, png_const_color_8p sig_bits)); | 1051 | png_bytep row, png_const_color_8p sig_bits)); |
1052 | #endif | 1052 | #endif |
1053 | 1053 | ||
1054 | #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) | 1054 | #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) |
1055 | PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, | 1055 | PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, |
1056 | png_bytep row)); | 1056 | png_bytep row)); |
1057 | #endif | 1057 | #endif |
1058 | 1058 | ||
1059 | #ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED | 1059 | #ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED |
1060 | PNG_EXTERN void png_do_scale_16_to_8 PNGARG((png_row_infop row_info, | 1060 | PNG_EXTERN void png_do_scale_16_to_8 PNGARG((png_row_infop row_info, |
1061 | png_bytep row)); | 1061 | png_bytep row)); |
1062 | #endif | 1062 | #endif |
1063 | 1063 | ||
1064 | #ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED | 1064 | #ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED |
1065 | PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, | 1065 | PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, |
1066 | png_bytep row)); | 1066 | png_bytep row)); |
1067 | #endif | 1067 | #endif |
1068 | 1068 | ||
1069 | #ifdef PNG_READ_QUANTIZE_SUPPORTED | 1069 | #ifdef PNG_READ_QUANTIZE_SUPPORTED |
1070 | PNG_EXTERN void png_do_quantize PNGARG((png_row_infop row_info, | 1070 | PNG_EXTERN void png_do_quantize PNGARG((png_row_infop row_info, |
1071 | png_bytep row, png_const_bytep palette_lookup, | 1071 | png_bytep row, png_const_bytep palette_lookup, |
1072 | png_const_bytep quantize_lookup)); | 1072 | png_const_bytep quantize_lookup)); |
1073 | 1073 | ||
1074 | # ifdef PNG_CORRECT_PALETTE_SUPPORTED | 1074 | # ifdef PNG_CORRECT_PALETTE_SUPPORTED |
1075 | PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr, | 1075 | PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr, |
1076 | png_colorp palette, int num_palette)); | 1076 | png_colorp palette, int num_palette)); |
1077 | # endif | 1077 | # endif |
1078 | #endif | 1078 | #endif |
1079 | 1079 | ||
1080 | #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) | 1080 | #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) |
1081 | PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, | 1081 | PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, |
1082 | png_bytep row)); | 1082 | png_bytep row)); |
1083 | #endif | 1083 | #endif |
1084 | 1084 | ||
1085 | #ifdef PNG_WRITE_PACK_SUPPORTED | 1085 | #ifdef PNG_WRITE_PACK_SUPPORTED |
1086 | PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info, | 1086 | PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info, |
1087 | png_bytep row, png_uint_32 bit_depth)); | 1087 | png_bytep row, png_uint_32 bit_depth)); |
1088 | #endif | 1088 | #endif |
1089 | 1089 | ||
1090 | #ifdef PNG_WRITE_SHIFT_SUPPORTED | 1090 | #ifdef PNG_WRITE_SHIFT_SUPPORTED |
1091 | PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, | 1091 | PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, |
1092 | png_bytep row, png_const_color_8p bit_depth)); | 1092 | png_bytep row, png_const_color_8p bit_depth)); |
1093 | #endif | 1093 | #endif |
1094 | 1094 | ||
1095 | #if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\ | 1095 | #if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\ |
1096 | defined(PNG_READ_ALPHA_MODE_SUPPORTED) | 1096 | defined(PNG_READ_ALPHA_MODE_SUPPORTED) |
1097 | PNG_EXTERN void png_do_compose PNGARG((png_row_infop row_info, | 1097 | PNG_EXTERN void png_do_compose PNGARG((png_row_infop row_info, |
1098 | png_bytep row, png_structp png_ptr)); | 1098 | png_bytep row, png_structp png_ptr)); |
1099 | #endif | 1099 | #endif |
1100 | 1100 | ||
1101 | #ifdef PNG_READ_GAMMA_SUPPORTED | 1101 | #ifdef PNG_READ_GAMMA_SUPPORTED |
1102 | PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, | 1102 | PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, |
1103 | png_bytep row, png_structp png_ptr)); | 1103 | png_bytep row, png_structp png_ptr)); |
1104 | #endif | 1104 | #endif |
1105 | 1105 | ||
1106 | #ifdef PNG_READ_ALPHA_MODE_SUPPORTED | 1106 | #ifdef PNG_READ_ALPHA_MODE_SUPPORTED |
1107 | PNG_EXTERN void png_do_encode_alpha PNGARG((png_row_infop row_info, | 1107 | PNG_EXTERN void png_do_encode_alpha PNGARG((png_row_infop row_info, |
1108 | png_bytep row, png_structp png_ptr)); | 1108 | png_bytep row, png_structp png_ptr)); |
1109 | #endif | 1109 | #endif |
1110 | 1110 | ||
1111 | #ifdef PNG_READ_EXPAND_SUPPORTED | 1111 | #ifdef PNG_READ_EXPAND_SUPPORTED |
1112 | PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info, | 1112 | PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info, |
1113 | png_bytep row, png_const_colorp palette, png_const_bytep trans, | 1113 | png_bytep row, png_const_colorp palette, png_const_bytep trans, |
1114 | int num_trans)); | 1114 | int num_trans)); |
1115 | PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info, | 1115 | PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info, |
1116 | png_bytep row, png_const_color_16p trans_color)); | 1116 | png_bytep row, png_const_color_16p trans_color)); |
1117 | #endif | 1117 | #endif |
1118 | 1118 | ||
1119 | #ifdef PNG_READ_EXPAND_16_SUPPORTED | 1119 | #ifdef PNG_READ_EXPAND_16_SUPPORTED |
1120 | PNG_EXTERN void png_do_expand_16 PNGARG((png_row_infop row_info, | 1120 | PNG_EXTERN void png_do_expand_16 PNGARG((png_row_infop row_info, |
1121 | png_bytep row)); | 1121 | png_bytep row)); |
1122 | #endif | 1122 | #endif |
1123 | 1123 | ||
1124 | /* The following decodes the appropriate chunks, and does error correction, | 1124 | /* The following decodes the appropriate chunks, and does error correction, |
1125 | * then calls the appropriate callback for the chunk if it is valid. | 1125 | * then calls the appropriate callback for the chunk if it is valid. |
1126 | */ | 1126 | */ |
1127 | 1127 | ||
1128 | /* Decode the IHDR chunk */ | 1128 | /* Decode the IHDR chunk */ |
1129 | PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr, | 1129 | PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr, |
1130 | png_uint_32 length)); | 1130 | png_uint_32 length)); |
1131 | PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr, | 1131 | PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr, |
1132 | png_uint_32 length)); | 1132 | png_uint_32 length)); |
1133 | PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr, | 1133 | PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr, |
1134 | png_uint_32 length)); | 1134 | png_uint_32 length)); |
1135 | 1135 | ||
1136 | #ifdef PNG_READ_bKGD_SUPPORTED | 1136 | #ifdef PNG_READ_bKGD_SUPPORTED |
1137 | PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr, | 1137 | PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr, |
1138 | png_uint_32 length)); | 1138 | png_uint_32 length)); |
1139 | #endif | 1139 | #endif |
1140 | 1140 | ||
1141 | #ifdef PNG_READ_cHRM_SUPPORTED | 1141 | #ifdef PNG_READ_cHRM_SUPPORTED |
1142 | PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr, | 1142 | PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr, |
1143 | png_uint_32 length)); | 1143 | png_uint_32 length)); |
1144 | #endif | 1144 | #endif |
1145 | 1145 | ||
1146 | #ifdef PNG_READ_gAMA_SUPPORTED | 1146 | #ifdef PNG_READ_gAMA_SUPPORTED |
1147 | PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr, | 1147 | PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr, |
1148 | png_uint_32 length)); | 1148 | png_uint_32 length)); |
1149 | #endif | 1149 | #endif |
1150 | 1150 | ||
1151 | #ifdef PNG_READ_hIST_SUPPORTED | 1151 | #ifdef PNG_READ_hIST_SUPPORTED |
1152 | PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr, | 1152 | PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr, |
1153 | png_uint_32 length)); | 1153 | png_uint_32 length)); |
1154 | #endif | 1154 | #endif |
1155 | 1155 | ||
1156 | #ifdef PNG_READ_iCCP_SUPPORTED | 1156 | #ifdef PNG_READ_iCCP_SUPPORTED |
1157 | PNG_EXTERN void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr, | 1157 | PNG_EXTERN void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr, |
1158 | png_uint_32 length)); | 1158 | png_uint_32 length)); |
1159 | #endif /* PNG_READ_iCCP_SUPPORTED */ | 1159 | #endif /* PNG_READ_iCCP_SUPPORTED */ |
1160 | 1160 | ||
1161 | #ifdef PNG_READ_iTXt_SUPPORTED | 1161 | #ifdef PNG_READ_iTXt_SUPPORTED |
1162 | PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr, | 1162 | PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr, |
1163 | png_uint_32 length)); | 1163 | png_uint_32 length)); |
1164 | #endif | 1164 | #endif |
1165 | 1165 | ||
1166 | #ifdef PNG_READ_oFFs_SUPPORTED | 1166 | #ifdef PNG_READ_oFFs_SUPPORTED |
1167 | PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr, | 1167 | PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr, |
1168 | png_uint_32 length)); | 1168 | png_uint_32 length)); |
1169 | #endif | 1169 | #endif |
1170 | 1170 | ||
1171 | #ifdef PNG_READ_pCAL_SUPPORTED | 1171 | #ifdef PNG_READ_pCAL_SUPPORTED |
1172 | PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr, | 1172 | PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr, |
1173 | png_uint_32 length)); | 1173 | png_uint_32 length)); |
1174 | #endif | 1174 | #endif |
1175 | 1175 | ||
1176 | #ifdef PNG_READ_pHYs_SUPPORTED | 1176 | #ifdef PNG_READ_pHYs_SUPPORTED |
1177 | PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr, | 1177 | PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr, |
1178 | png_uint_32 length)); | 1178 | png_uint_32 length)); |
1179 | #endif | 1179 | #endif |
1180 | 1180 | ||
1181 | #ifdef PNG_READ_sBIT_SUPPORTED | 1181 | #ifdef PNG_READ_sBIT_SUPPORTED |
1182 | PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr, | 1182 | PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr, |
1183 | png_uint_32 length)); | 1183 | png_uint_32 length)); |
1184 | #endif | 1184 | #endif |
1185 | 1185 | ||
1186 | #ifdef PNG_READ_sCAL_SUPPORTED | 1186 | #ifdef PNG_READ_sCAL_SUPPORTED |
1187 | PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr, | 1187 | PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr, |
1188 | png_uint_32 length)); | 1188 | png_uint_32 length)); |
1189 | #endif | 1189 | #endif |
1190 | 1190 | ||
1191 | #ifdef PNG_READ_sPLT_SUPPORTED | 1191 | #ifdef PNG_READ_sPLT_SUPPORTED |
1192 | PNG_EXTERN void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr, | 1192 | PNG_EXTERN void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr, |
1193 | png_uint_32 length)); | 1193 | png_uint_32 length)); |
1194 | #endif /* PNG_READ_sPLT_SUPPORTED */ | 1194 | #endif /* PNG_READ_sPLT_SUPPORTED */ |
1195 | 1195 | ||
1196 | #ifdef PNG_READ_sRGB_SUPPORTED | 1196 | #ifdef PNG_READ_sRGB_SUPPORTED |
1197 | PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr, | 1197 | PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr, |
1198 | png_uint_32 length)); | 1198 | png_uint_32 length)); |
1199 | #endif | 1199 | #endif |
1200 | 1200 | ||
1201 | #ifdef PNG_READ_tEXt_SUPPORTED | 1201 | #ifdef PNG_READ_tEXt_SUPPORTED |
1202 | PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr, | 1202 | PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr, |
1203 | png_uint_32 length)); | 1203 | png_uint_32 length)); |
1204 | #endif | 1204 | #endif |
1205 | 1205 | ||
1206 | #ifdef PNG_READ_tIME_SUPPORTED | 1206 | #ifdef PNG_READ_tIME_SUPPORTED |
1207 | PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr, | 1207 | PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr, |
1208 | png_uint_32 length)); | 1208 | png_uint_32 length)); |
1209 | #endif | 1209 | #endif |
1210 | 1210 | ||
1211 | #ifdef PNG_READ_tRNS_SUPPORTED | 1211 | #ifdef PNG_READ_tRNS_SUPPORTED |
1212 | PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr, | 1212 | PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr, |
1213 | png_uint_32 length)); | 1213 | png_uint_32 length)); |
1214 | #endif | 1214 | #endif |
1215 | 1215 | ||
1216 | #ifdef PNG_READ_zTXt_SUPPORTED | 1216 | #ifdef PNG_READ_zTXt_SUPPORTED |
1217 | PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr, | 1217 | PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr, |
1218 | png_uint_32 length)); | 1218 | png_uint_32 length)); |
1219 | #endif | 1219 | #endif |
1220 | 1220 | ||
1221 | #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED | 1221 | #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED |
1222 | PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr, | 1222 | PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr, |
1223 | png_infop info_ptr, png_uint_32 length)); | 1223 | png_infop info_ptr, png_uint_32 length)); |
1224 | #endif | 1224 | #endif |
1225 | 1225 | ||
1226 | PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr, | 1226 | PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr, |
1227 | png_uint_32 chunk_name)); | 1227 | png_uint_32 chunk_name)); |
1228 | 1228 | ||
1229 | #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED | 1229 | #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED |
1230 | /* Exactly as png_handle_as_unknown() except that the argument is a 32-bit chunk | 1230 | /* Exactly as png_handle_as_unknown() except that the argument is a 32-bit chunk |
1231 | * name, not a string. | 1231 | * name, not a string. |
1232 | */ | 1232 | */ |
1233 | PNG_EXTERN int png_chunk_unknown_handling PNGARG((png_structp png_ptr, | 1233 | PNG_EXTERN int png_chunk_unknown_handling PNGARG((png_structp png_ptr, |
1234 | png_uint_32 chunk_name)); | 1234 | png_uint_32 chunk_name)); |
1235 | #endif | 1235 | #endif |
1236 | 1236 | ||
1237 | /* Handle the transformations for reading and writing */ | 1237 | /* Handle the transformations for reading and writing */ |
1238 | #ifdef PNG_READ_TRANSFORMS_SUPPORTED | 1238 | #ifdef PNG_READ_TRANSFORMS_SUPPORTED |
1239 | PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr, | 1239 | PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr, |
1240 | png_row_infop row_info)); | 1240 | png_row_infop row_info)); |
1241 | #endif | 1241 | #endif |
1242 | #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED | 1242 | #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED |
1243 | PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr, | 1243 | PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr, |
1244 | png_row_infop row_info)); | 1244 | png_row_infop row_info)); |
1245 | #endif | 1245 | #endif |
1246 | 1246 | ||
1247 | #ifdef PNG_READ_TRANSFORMS_SUPPORTED | 1247 | #ifdef PNG_READ_TRANSFORMS_SUPPORTED |
1248 | PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr)); | 1248 | PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr)); |
1249 | #endif | 1249 | #endif |
1250 | 1250 | ||
1251 | #ifdef PNG_PROGRESSIVE_READ_SUPPORTED | 1251 | #ifdef PNG_PROGRESSIVE_READ_SUPPORTED |
1252 | PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr, | 1252 | PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr, |
1253 | png_infop info_ptr)); | 1253 | png_infop info_ptr)); |
1254 | PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr, | 1254 | PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr, |
1255 | png_infop info_ptr)); | 1255 | png_infop info_ptr)); |
1256 | PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr)); | 1256 | PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr)); |
1257 | PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr, | 1257 | PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr, |
1258 | png_uint_32 length)); | 1258 | png_uint_32 length)); |
1259 | PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr)); | 1259 | PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr)); |
1260 | PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr)); | 1260 | PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr)); |
1261 | PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr, | 1261 | PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr, |
1262 | png_bytep buffer, png_size_t buffer_length)); | 1262 | png_bytep buffer, png_size_t buffer_length)); |
1263 | PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr)); | 1263 | PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr)); |
1264 | PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr, | 1264 | PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr, |
1265 | png_bytep buffer, png_size_t buffer_length)); | 1265 | png_bytep buffer, png_size_t buffer_length)); |
1266 | PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr)); | 1266 | PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr)); |
1267 | PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr, | 1267 | PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr, |
1268 | png_infop info_ptr, png_uint_32 length)); | 1268 | png_infop info_ptr, png_uint_32 length)); |
1269 | PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr, | 1269 | PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr, |
1270 | png_infop info_ptr)); | 1270 | png_infop info_ptr)); |
1271 | PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr, | 1271 | PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr, |
1272 | png_infop info_ptr)); | 1272 | png_infop info_ptr)); |
1273 | PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row)); | 1273 | PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row)); |
1274 | PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr, | 1274 | PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr, |
1275 | png_infop info_ptr)); | 1275 | png_infop info_ptr)); |
1276 | PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr, | 1276 | PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr, |
1277 | png_infop info_ptr)); | 1277 | png_infop info_ptr)); |
1278 | PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr)); | 1278 | PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr)); |
1279 | # ifdef PNG_READ_tEXt_SUPPORTED | 1279 | # ifdef PNG_READ_tEXt_SUPPORTED |
1280 | PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr, | 1280 | PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr, |
1281 | png_infop info_ptr, png_uint_32 length)); | 1281 | png_infop info_ptr, png_uint_32 length)); |
1282 | PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr, | 1282 | PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr, |
1283 | png_infop info_ptr)); | 1283 | png_infop info_ptr)); |
1284 | # endif | 1284 | # endif |
1285 | # ifdef PNG_READ_zTXt_SUPPORTED | 1285 | # ifdef PNG_READ_zTXt_SUPPORTED |
1286 | PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr, | 1286 | PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr, |
1287 | png_infop info_ptr, png_uint_32 length)); | 1287 | png_infop info_ptr, png_uint_32 length)); |
1288 | PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr, | 1288 | PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr, |
1289 | png_infop info_ptr)); | 1289 | png_infop info_ptr)); |
1290 | # endif | 1290 | # endif |
1291 | # ifdef PNG_READ_iTXt_SUPPORTED | 1291 | # ifdef PNG_READ_iTXt_SUPPORTED |
1292 | PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr, | 1292 | PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr, |
1293 | png_infop info_ptr, png_uint_32 length)); | 1293 | png_infop info_ptr, png_uint_32 length)); |
1294 | PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr, | 1294 | PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr, |
1295 | png_infop info_ptr)); | 1295 | png_infop info_ptr)); |
1296 | # endif | 1296 | # endif |
1297 | 1297 | ||
1298 | #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ | 1298 | #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ |
1299 | 1299 | ||
1300 | #ifdef PNG_MNG_FEATURES_SUPPORTED | 1300 | #ifdef PNG_MNG_FEATURES_SUPPORTED |
1301 | PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info, | 1301 | PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info, |
1302 | png_bytep row)); | 1302 | png_bytep row)); |
1303 | PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info, | 1303 | PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info, |
1304 | png_bytep row)); | 1304 | png_bytep row)); |
1305 | #endif | 1305 | #endif |
1306 | 1306 | ||
1307 | /* Added at libpng version 1.4.0 */ | 1307 | /* Added at libpng version 1.4.0 */ |
1308 | #ifdef PNG_CHECK_cHRM_SUPPORTED | 1308 | #ifdef PNG_CHECK_cHRM_SUPPORTED |
1309 | PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr, | 1309 | PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr, |
1310 | png_fixed_point int_white_x, png_fixed_point int_white_y, | 1310 | png_fixed_point int_white_x, png_fixed_point int_white_y, |
1311 | png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point | 1311 | png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point |
1312 | int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, | 1312 | int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, |
1313 | png_fixed_point int_blue_y)); | 1313 | png_fixed_point int_blue_y)); |
1314 | #endif | 1314 | #endif |
1315 | 1315 | ||
1316 | #ifdef PNG_CHECK_cHRM_SUPPORTED | 1316 | #ifdef PNG_CHECK_cHRM_SUPPORTED |
1317 | /* Added at libpng version 1.2.34 and 1.4.0 */ | 1317 | /* Added at libpng version 1.2.34 and 1.4.0 */ |
1318 | /* Currently only used by png_check_cHRM_fixed */ | 1318 | /* Currently only used by png_check_cHRM_fixed */ |
1319 | PNG_EXTERN void png_64bit_product PNGARG((long v1, long v2, | 1319 | PNG_EXTERN void png_64bit_product PNGARG((long v1, long v2, |
1320 | unsigned long *hi_product, unsigned long *lo_product)); | 1320 | unsigned long *hi_product, unsigned long *lo_product)); |
1321 | #endif | 1321 | #endif |
1322 | 1322 | ||
1323 | #ifdef PNG_cHRM_SUPPORTED | 1323 | #ifdef PNG_cHRM_SUPPORTED |
1324 | /* Added at libpng version 1.5.5 */ | 1324 | /* Added at libpng version 1.5.5 */ |
1325 | typedef struct png_xy | 1325 | typedef struct png_xy |
1326 | { | 1326 | { |
1327 | png_fixed_point redx, redy; | 1327 | png_fixed_point redx, redy; |
1328 | png_fixed_point greenx, greeny; | 1328 | png_fixed_point greenx, greeny; |
1329 | png_fixed_point bluex, bluey; | 1329 | png_fixed_point bluex, bluey; |
1330 | png_fixed_point whitex, whitey; | 1330 | png_fixed_point whitex, whitey; |
1331 | } png_xy; | 1331 | } png_xy; |
1332 | 1332 | ||
1333 | typedef struct png_XYZ | 1333 | typedef struct png_XYZ |
1334 | { | 1334 | { |
1335 | png_fixed_point redX, redY, redZ; | 1335 | png_fixed_point redX, redY, redZ; |
1336 | png_fixed_point greenX, greenY, greenZ; | 1336 | png_fixed_point greenX, greenY, greenZ; |
1337 | png_fixed_point blueX, blueY, blueZ; | 1337 | png_fixed_point blueX, blueY, blueZ; |
1338 | } png_XYZ; | 1338 | } png_XYZ; |
1339 | 1339 | ||
1340 | /* The conversion APIs return 0 on success, non-zero on a parameter error. They | 1340 | /* The conversion APIs return 0 on success, non-zero on a parameter error. They |
1341 | * allow conversion between the above representations of a color encoding. When | 1341 | * allow conversion between the above representations of a color encoding. When |
1342 | * converting from XYZ end points to chromaticities the absolute magnitude of | 1342 | * converting from XYZ end points to chromaticities the absolute magnitude of |
1343 | * the end points is lost, when converting back the sum of the Y values of the | 1343 | * the end points is lost, when converting back the sum of the Y values of the |
1344 | * three end points will be 1.0 | 1344 | * three end points will be 1.0 |
1345 | */ | 1345 | */ |
1346 | PNG_EXTERN int png_xy_from_XYZ PNGARG((png_xy *xy, png_XYZ XYZ)); | 1346 | PNG_EXTERN int png_xy_from_XYZ PNGARG((png_xy *xy, png_XYZ XYZ)); |
1347 | PNG_EXTERN int png_XYZ_from_xy PNGARG((png_XYZ *XYZ, png_xy xy)); | 1347 | PNG_EXTERN int png_XYZ_from_xy PNGARG((png_XYZ *XYZ, png_xy xy)); |
1348 | PNG_EXTERN int png_XYZ_from_xy_checked PNGARG((png_structp png_ptr, | 1348 | PNG_EXTERN int png_XYZ_from_xy_checked PNGARG((png_structp png_ptr, |
1349 | png_XYZ *XYZ, png_xy xy)); | 1349 | png_XYZ *XYZ, png_xy xy)); |
1350 | #endif | 1350 | #endif |
1351 | 1351 | ||
1352 | /* Added at libpng version 1.4.0 */ | 1352 | /* Added at libpng version 1.4.0 */ |
1353 | PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr, | 1353 | PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr, |
1354 | png_uint_32 width, png_uint_32 height, int bit_depth, | 1354 | png_uint_32 width, png_uint_32 height, int bit_depth, |
1355 | int color_type, int interlace_type, int compression_type, | 1355 | int color_type, int interlace_type, int compression_type, |
1356 | int filter_type)); | 1356 | int filter_type)); |
1357 | 1357 | ||
1358 | /* Free all memory used by the read (old method - NOT DLL EXPORTED) */ | 1358 | /* Free all memory used by the read (old method - NOT DLL EXPORTED) */ |
1359 | PNG_EXTERN void png_read_destroy PNGARG((png_structp png_ptr, | 1359 | PNG_EXTERN void png_read_destroy PNGARG((png_structp png_ptr, |
1360 | png_infop info_ptr, png_infop end_info_ptr)); | 1360 | png_infop info_ptr, png_infop end_info_ptr)); |
1361 | 1361 | ||
1362 | /* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */ | 1362 | /* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */ |
1363 | PNG_EXTERN void png_write_destroy PNGARG((png_structp png_ptr)); | 1363 | PNG_EXTERN void png_write_destroy PNGARG((png_structp png_ptr)); |
1364 | 1364 | ||
1365 | #ifdef USE_FAR_KEYWORD /* memory model conversion function */ | 1365 | #ifdef USE_FAR_KEYWORD /* memory model conversion function */ |
1366 | PNG_EXTERN void *png_far_to_near PNGARG((png_structp png_ptr, png_voidp ptr, | 1366 | PNG_EXTERN void *png_far_to_near PNGARG((png_structp png_ptr, png_voidp ptr, |
1367 | int check)); | 1367 | int check)); |
1368 | #endif /* USE_FAR_KEYWORD */ | 1368 | #endif /* USE_FAR_KEYWORD */ |
1369 | 1369 | ||
1370 | #if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED) | 1370 | #if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED) |
1371 | PNG_EXTERN PNG_FUNCTION(void, png_fixed_error, (png_structp png_ptr, | 1371 | PNG_EXTERN PNG_FUNCTION(void, png_fixed_error, (png_structp png_ptr, |
1372 | png_const_charp name),PNG_NORETURN); | 1372 | png_const_charp name),PNG_NORETURN); |
1373 | #endif | 1373 | #endif |
1374 | 1374 | ||
1375 | /* Puts 'string' into 'buffer' at buffer[pos], taking care never to overwrite | 1375 | /* Puts 'string' into 'buffer' at buffer[pos], taking care never to overwrite |
1376 | * the end. Always leaves the buffer nul terminated. Never errors out (and | 1376 | * the end. Always leaves the buffer nul terminated. Never errors out (and |
1377 | * there is no error code.) | 1377 | * there is no error code.) |
1378 | */ | 1378 | */ |
1379 | PNG_EXTERN size_t png_safecat(png_charp buffer, size_t bufsize, size_t pos, | 1379 | PNG_EXTERN size_t png_safecat(png_charp buffer, size_t bufsize, size_t pos, |
1380 | png_const_charp string); | 1380 | png_const_charp string); |
1381 | 1381 | ||
1382 | /* Various internal functions to handle formatted warning messages, currently | 1382 | /* Various internal functions to handle formatted warning messages, currently |
1383 | * only implemented for warnings. | 1383 | * only implemented for warnings. |
1384 | */ | 1384 | */ |
1385 | #if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_TIME_RFC1123_SUPPORTED) | 1385 | #if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_TIME_RFC1123_SUPPORTED) |
1386 | /* Utility to dump an unsigned value into a buffer, given a start pointer and | 1386 | /* Utility to dump an unsigned value into a buffer, given a start pointer and |
1387 | * and end pointer (which should point just *beyond* the end of the buffer!) | 1387 | * and end pointer (which should point just *beyond* the end of the buffer!) |
1388 | * Returns the pointer to the start of the formatted string. This utility only | 1388 | * Returns the pointer to the start of the formatted string. This utility only |
1389 | * does unsigned values. | 1389 | * does unsigned values. |
1390 | */ | 1390 | */ |
1391 | PNG_EXTERN png_charp png_format_number(png_const_charp start, png_charp end, | 1391 | PNG_EXTERN png_charp png_format_number(png_const_charp start, png_charp end, |
1392 | int format, png_alloc_size_t number); | 1392 | int format, png_alloc_size_t number); |
1393 | 1393 | ||
1394 | /* Convenience macro that takes an array: */ | 1394 | /* Convenience macro that takes an array: */ |
1395 | #define PNG_FORMAT_NUMBER(buffer,format,number) \ | 1395 | #define PNG_FORMAT_NUMBER(buffer,format,number) \ |
1396 | png_format_number(buffer, buffer + (sizeof buffer), format, number) | 1396 | png_format_number(buffer, buffer + (sizeof buffer), format, number) |
1397 | 1397 | ||
1398 | /* Suggested size for a number buffer (enough for 64 bits and a sign!) */ | 1398 | /* Suggested size for a number buffer (enough for 64 bits and a sign!) */ |
1399 | #define PNG_NUMBER_BUFFER_SIZE 24 | 1399 | #define PNG_NUMBER_BUFFER_SIZE 24 |
1400 | 1400 | ||
1401 | /* These are the integer formats currently supported, the name is formed from | 1401 | /* These are the integer formats currently supported, the name is formed from |
1402 | * the standard printf(3) format string. | 1402 | * the standard printf(3) format string. |
1403 | */ | 1403 | */ |
1404 | #define PNG_NUMBER_FORMAT_u 1 /* chose unsigned API! */ | 1404 | #define PNG_NUMBER_FORMAT_u 1 /* chose unsigned API! */ |
1405 | #define PNG_NUMBER_FORMAT_02u 2 | 1405 | #define PNG_NUMBER_FORMAT_02u 2 |
1406 | #define PNG_NUMBER_FORMAT_d 1 /* chose signed API! */ | 1406 | #define PNG_NUMBER_FORMAT_d 1 /* chose signed API! */ |
1407 | #define PNG_NUMBER_FORMAT_02d 2 | 1407 | #define PNG_NUMBER_FORMAT_02d 2 |
1408 | #define PNG_NUMBER_FORMAT_x 3 | 1408 | #define PNG_NUMBER_FORMAT_x 3 |
1409 | #define PNG_NUMBER_FORMAT_02x 4 | 1409 | #define PNG_NUMBER_FORMAT_02x 4 |
1410 | #define PNG_NUMBER_FORMAT_fixed 5 /* choose the signed API */ | 1410 | #define PNG_NUMBER_FORMAT_fixed 5 /* choose the signed API */ |
1411 | #endif | 1411 | #endif |
1412 | 1412 | ||
1413 | #ifdef PNG_WARNINGS_SUPPORTED | 1413 | #ifdef PNG_WARNINGS_SUPPORTED |
1414 | /* New defines and members adding in libpng-1.5.4 */ | 1414 | /* New defines and members adding in libpng-1.5.4 */ |
1415 | # define PNG_WARNING_PARAMETER_SIZE 32 | 1415 | # define PNG_WARNING_PARAMETER_SIZE 32 |
1416 | # define PNG_WARNING_PARAMETER_COUNT 8 | 1416 | # define PNG_WARNING_PARAMETER_COUNT 8 |
1417 | 1417 | ||
1418 | /* An l-value of this type has to be passed to the APIs below to cache the | 1418 | /* An l-value of this type has to be passed to the APIs below to cache the |
1419 | * values of the parameters to a formatted warning message. | 1419 | * values of the parameters to a formatted warning message. |
1420 | */ | 1420 | */ |
1421 | typedef char png_warning_parameters[PNG_WARNING_PARAMETER_COUNT][ | 1421 | typedef char png_warning_parameters[PNG_WARNING_PARAMETER_COUNT][ |
1422 | PNG_WARNING_PARAMETER_SIZE]; | 1422 | PNG_WARNING_PARAMETER_SIZE]; |
1423 | 1423 | ||
1424 | PNG_EXTERN void png_warning_parameter(png_warning_parameters p, int number, | 1424 | PNG_EXTERN void png_warning_parameter(png_warning_parameters p, int number, |
1425 | png_const_charp string); | 1425 | png_const_charp string); |
1426 | /* Parameters are limited in size to PNG_WARNING_PARAMETER_SIZE characters, | 1426 | /* Parameters are limited in size to PNG_WARNING_PARAMETER_SIZE characters, |
1427 | * including the trailing '\0'. | 1427 | * including the trailing '\0'. |
1428 | */ | 1428 | */ |
1429 | PNG_EXTERN void png_warning_parameter_unsigned(png_warning_parameters p, | 1429 | PNG_EXTERN void png_warning_parameter_unsigned(png_warning_parameters p, |
1430 | int number, int format, png_alloc_size_t value); | 1430 | int number, int format, png_alloc_size_t value); |
1431 | /* Use png_alloc_size_t because it is an unsigned type as big as any we | 1431 | /* Use png_alloc_size_t because it is an unsigned type as big as any we |
1432 | * need to output. Use the following for a signed value. | 1432 | * need to output. Use the following for a signed value. |
1433 | */ | 1433 | */ |
1434 | PNG_EXTERN void png_warning_parameter_signed(png_warning_parameters p, | 1434 | PNG_EXTERN void png_warning_parameter_signed(png_warning_parameters p, |
1435 | int number, int format, png_int_32 value); | 1435 | int number, int format, png_int_32 value); |
1436 | 1436 | ||
1437 | PNG_EXTERN void png_formatted_warning(png_structp png_ptr, | 1437 | PNG_EXTERN void png_formatted_warning(png_structp png_ptr, |
1438 | png_warning_parameters p, png_const_charp message); | 1438 | png_warning_parameters p, png_const_charp message); |
1439 | /* 'message' follows the X/Open approach of using @1, @2 to insert | 1439 | /* 'message' follows the X/Open approach of using @1, @2 to insert |
1440 | * parameters previously supplied using the above functions. Errors in | 1440 | * parameters previously supplied using the above functions. Errors in |
1441 | * specifying the paramters will simple result in garbage substitutions. | 1441 | * specifying the paramters will simple result in garbage substitutions. |
1442 | */ | 1442 | */ |
1443 | #endif | 1443 | #endif |
1444 | 1444 | ||
1445 | /* ASCII to FP interfaces, currently only implemented if sCAL | 1445 | /* ASCII to FP interfaces, currently only implemented if sCAL |
1446 | * support is required. | 1446 | * support is required. |
1447 | */ | 1447 | */ |
1448 | #if defined(PNG_READ_sCAL_SUPPORTED) | 1448 | #if defined(PNG_READ_sCAL_SUPPORTED) |
1449 | /* MAX_DIGITS is actually the maximum number of characters in an sCAL | 1449 | /* MAX_DIGITS is actually the maximum number of characters in an sCAL |
1450 | * width or height, derived from the precision (number of significant | 1450 | * width or height, derived from the precision (number of significant |
1451 | * digits - a build time settable option) and assumpitions about the | 1451 | * digits - a build time settable option) and assumpitions about the |
1452 | * maximum ridiculous exponent. | 1452 | * maximum ridiculous exponent. |
1453 | */ | 1453 | */ |
1454 | #define PNG_sCAL_MAX_DIGITS (PNG_sCAL_PRECISION+1/*.*/+1/*E*/+10/*exponent*/) | 1454 | #define PNG_sCAL_MAX_DIGITS (PNG_sCAL_PRECISION+1/*.*/+1/*E*/+10/*exponent*/) |
1455 | 1455 | ||
1456 | #ifdef PNG_FLOATING_POINT_SUPPORTED | 1456 | #ifdef PNG_FLOATING_POINT_SUPPORTED |
1457 | PNG_EXTERN void png_ascii_from_fp PNGARG((png_structp png_ptr, png_charp ascii, | 1457 | PNG_EXTERN void png_ascii_from_fp PNGARG((png_structp png_ptr, png_charp ascii, |
1458 | png_size_t size, double fp, unsigned int precision)); | 1458 | png_size_t size, double fp, unsigned int precision)); |
1459 | #endif /* FLOATING_POINT */ | 1459 | #endif /* FLOATING_POINT */ |
1460 | 1460 | ||
1461 | #ifdef PNG_FIXED_POINT_SUPPORTED | 1461 | #ifdef PNG_FIXED_POINT_SUPPORTED |
1462 | PNG_EXTERN void png_ascii_from_fixed PNGARG((png_structp png_ptr, | 1462 | PNG_EXTERN void png_ascii_from_fixed PNGARG((png_structp png_ptr, |
1463 | png_charp ascii, png_size_t size, png_fixed_point fp)); | 1463 | png_charp ascii, png_size_t size, png_fixed_point fp)); |
1464 | #endif /* FIXED_POINT */ | 1464 | #endif /* FIXED_POINT */ |
1465 | #endif /* READ_sCAL */ | 1465 | #endif /* READ_sCAL */ |
1466 | 1466 | ||
1467 | #if defined(PNG_sCAL_SUPPORTED) || defined(PNG_pCAL_SUPPORTED) | 1467 | #if defined(PNG_sCAL_SUPPORTED) || defined(PNG_pCAL_SUPPORTED) |
1468 | /* An internal API to validate the format of a floating point number. | 1468 | /* An internal API to validate the format of a floating point number. |
1469 | * The result is the index of the next character. If the number is | 1469 | * The result is the index of the next character. If the number is |
1470 | * not valid it will be the index of a character in the supposed number. | 1470 | * not valid it will be the index of a character in the supposed number. |
1471 | * | 1471 | * |
1472 | * The format of a number is defined in the PNG extensions specification | 1472 | * The format of a number is defined in the PNG extensions specification |
1473 | * and this API is strictly conformant to that spec, not anyone elses! | 1473 | * and this API is strictly conformant to that spec, not anyone elses! |
1474 | * | 1474 | * |
1475 | * The format as a regular expression is: | 1475 | * The format as a regular expression is: |
1476 | * | 1476 | * |
1477 | * [+-]?[0-9]+.?([Ee][+-]?[0-9]+)? | 1477 | * [+-]?[0-9]+.?([Ee][+-]?[0-9]+)? |
1478 | * | 1478 | * |
1479 | * or: | 1479 | * or: |
1480 | * | 1480 | * |
1481 | * [+-]?.[0-9]+(.[0-9]+)?([Ee][+-]?[0-9]+)? | 1481 | * [+-]?.[0-9]+(.[0-9]+)?([Ee][+-]?[0-9]+)? |
1482 | * | 1482 | * |
1483 | * The complexity is that either integer or fraction must be present and the | 1483 | * The complexity is that either integer or fraction must be present and the |
1484 | * fraction is permitted to have no digits only if the integer is present. | 1484 | * fraction is permitted to have no digits only if the integer is present. |
1485 | * | 1485 | * |
1486 | * NOTE: The dangling E problem. | 1486 | * NOTE: The dangling E problem. |
1487 | * There is a PNG valid floating point number in the following: | 1487 | * There is a PNG valid floating point number in the following: |
1488 | * | 1488 | * |
1489 | * PNG floating point numb1.ers are not greedy. | 1489 | * PNG floating point numb1.ers are not greedy. |
1490 | * | 1490 | * |
1491 | * Working this out requires *TWO* character lookahead (because of the | 1491 | * Working this out requires *TWO* character lookahead (because of the |
1492 | * sign), the parser does not do this - it will fail at the 'r' - this | 1492 | * sign), the parser does not do this - it will fail at the 'r' - this |
1493 | * doesn't matter for PNG sCAL chunk values, but it requires more care | 1493 | * doesn't matter for PNG sCAL chunk values, but it requires more care |
1494 | * if the value were ever to be embedded in something more complex. Use | 1494 | * if the value were ever to be embedded in something more complex. Use |
1495 | * ANSI-C strtod if you need the lookahead. | 1495 | * ANSI-C strtod if you need the lookahead. |
1496 | */ | 1496 | */ |
1497 | /* State table for the parser. */ | 1497 | /* State table for the parser. */ |
1498 | #define PNG_FP_INTEGER 0 /* before or in integer */ | 1498 | #define PNG_FP_INTEGER 0 /* before or in integer */ |
1499 | #define PNG_FP_FRACTION 1 /* before or in fraction */ | 1499 | #define PNG_FP_FRACTION 1 /* before or in fraction */ |
1500 | #define PNG_FP_EXPONENT 2 /* before or in exponent */ | 1500 | #define PNG_FP_EXPONENT 2 /* before or in exponent */ |
1501 | #define PNG_FP_STATE 3 /* mask for the above */ | 1501 | #define PNG_FP_STATE 3 /* mask for the above */ |
1502 | #define PNG_FP_SAW_SIGN 4 /* Saw +/- in current state */ | 1502 | #define PNG_FP_SAW_SIGN 4 /* Saw +/- in current state */ |
1503 | #define PNG_FP_SAW_DIGIT 8 /* Saw a digit in current state */ | 1503 | #define PNG_FP_SAW_DIGIT 8 /* Saw a digit in current state */ |
1504 | #define PNG_FP_SAW_DOT 16 /* Saw a dot in current state */ | 1504 | #define PNG_FP_SAW_DOT 16 /* Saw a dot in current state */ |
1505 | #define PNG_FP_SAW_E 32 /* Saw an E (or e) in current state */ | 1505 | #define PNG_FP_SAW_E 32 /* Saw an E (or e) in current state */ |
1506 | #define PNG_FP_SAW_ANY 60 /* Saw any of the above 4 */ | 1506 | #define PNG_FP_SAW_ANY 60 /* Saw any of the above 4 */ |
1507 | 1507 | ||
1508 | /* These three values don't affect the parser. They are set but not used. | 1508 | /* These three values don't affect the parser. They are set but not used. |
1509 | */ | 1509 | */ |
1510 | #define PNG_FP_WAS_VALID 64 /* Preceding substring is a valid fp number */ | 1510 | #define PNG_FP_WAS_VALID 64 /* Preceding substring is a valid fp number */ |
1511 | #define PNG_FP_NEGATIVE 128 /* A negative number, including "-0" */ | 1511 | #define PNG_FP_NEGATIVE 128 /* A negative number, including "-0" */ |
1512 | #define PNG_FP_NONZERO 256 /* A non-zero value */ | 1512 | #define PNG_FP_NONZERO 256 /* A non-zero value */ |
1513 | #define PNG_FP_STICKY 448 /* The above three flags */ | 1513 | #define PNG_FP_STICKY 448 /* The above three flags */ |
1514 | 1514 | ||
1515 | /* This is available for the caller to store in 'state' if required. Do not | 1515 | /* This is available for the caller to store in 'state' if required. Do not |
1516 | * call the parser after setting it (the parser sometimes clears it.) | 1516 | * call the parser after setting it (the parser sometimes clears it.) |
1517 | */ | 1517 | */ |
1518 | #define PNG_FP_INVALID 512 /* Available for callers as a distinct value */ | 1518 | #define PNG_FP_INVALID 512 /* Available for callers as a distinct value */ |
1519 | 1519 | ||
1520 | /* Result codes for the parser (boolean - true meants ok, false means | 1520 | /* Result codes for the parser (boolean - true meants ok, false means |
1521 | * not ok yet.) | 1521 | * not ok yet.) |
1522 | */ | 1522 | */ |
1523 | #define PNG_FP_MAYBE 0 /* The number may be valid in the future */ | 1523 | #define PNG_FP_MAYBE 0 /* The number may be valid in the future */ |
1524 | #define PNG_FP_OK 1 /* The number is valid */ | 1524 | #define PNG_FP_OK 1 /* The number is valid */ |
1525 | 1525 | ||
1526 | /* Tests on the sticky non-zero and negative flags. To pass these checks | 1526 | /* Tests on the sticky non-zero and negative flags. To pass these checks |
1527 | * the state must also indicate that the whole number is valid - this is | 1527 | * the state must also indicate that the whole number is valid - this is |
1528 | * achieved by testing PNG_FP_SAW_DIGIT (see the implementation for why this | 1528 | * achieved by testing PNG_FP_SAW_DIGIT (see the implementation for why this |
1529 | * is equivalent to PNG_FP_OK above.) | 1529 | * is equivalent to PNG_FP_OK above.) |
1530 | */ | 1530 | */ |
1531 | #define PNG_FP_NZ_MASK (PNG_FP_SAW_DIGIT | PNG_FP_NEGATIVE | PNG_FP_NONZERO) | 1531 | #define PNG_FP_NZ_MASK (PNG_FP_SAW_DIGIT | PNG_FP_NEGATIVE | PNG_FP_NONZERO) |
1532 | /* NZ_MASK: the string is valid and a non-zero negative value */ | 1532 | /* NZ_MASK: the string is valid and a non-zero negative value */ |
1533 | #define PNG_FP_Z_MASK (PNG_FP_SAW_DIGIT | PNG_FP_NONZERO) | 1533 | #define PNG_FP_Z_MASK (PNG_FP_SAW_DIGIT | PNG_FP_NONZERO) |
1534 | /* Z MASK: the string is valid and a non-zero value. */ | 1534 | /* Z MASK: the string is valid and a non-zero value. */ |
1535 | /* PNG_FP_SAW_DIGIT: the string is valid. */ | 1535 | /* PNG_FP_SAW_DIGIT: the string is valid. */ |
1536 | #define PNG_FP_IS_ZERO(state) (((state) & PNG_FP_Z_MASK) == PNG_FP_SAW_DIGIT) | 1536 | #define PNG_FP_IS_ZERO(state) (((state) & PNG_FP_Z_MASK) == PNG_FP_SAW_DIGIT) |
1537 | #define PNG_FP_IS_POSITIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_Z_MASK) | 1537 | #define PNG_FP_IS_POSITIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_Z_MASK) |
1538 | #define PNG_FP_IS_NEGATIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_NZ_MASK) | 1538 | #define PNG_FP_IS_NEGATIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_NZ_MASK) |
1539 | 1539 | ||
1540 | /* The actual parser. This can be called repeatedly, it updates | 1540 | /* The actual parser. This can be called repeatedly, it updates |
1541 | * the index into the string and the state variable (which must | 1541 | * the index into the string and the state variable (which must |
1542 | * be initialzed to 0). It returns a result code, as above. There | 1542 | * be initialzed to 0). It returns a result code, as above. There |
1543 | * is no point calling the parser any more if it fails to advance to | 1543 | * is no point calling the parser any more if it fails to advance to |
1544 | * the end of the string - it is stuck on an invalid character (or | 1544 | * the end of the string - it is stuck on an invalid character (or |
1545 | * terminated by '\0'). | 1545 | * terminated by '\0'). |
1546 | * | 1546 | * |
1547 | * Note that the pointer will consume an E or even an E+ then leave | 1547 | * Note that the pointer will consume an E or even an E+ then leave |
1548 | * a 'maybe' state even though a preceding integer.fraction is valid. | 1548 | * a 'maybe' state even though a preceding integer.fraction is valid. |
1549 | * The PNG_FP_WAS_VALID flag indicates that a preceding substring was | 1549 | * The PNG_FP_WAS_VALID flag indicates that a preceding substring was |
1550 | * a valid number. It's possible to recover from this by calling | 1550 | * a valid number. It's possible to recover from this by calling |
1551 | * the parser again (from the start, with state 0) but with a string | 1551 | * the parser again (from the start, with state 0) but with a string |
1552 | * that omits the last character (i.e. set the size to the index of | 1552 | * that omits the last character (i.e. set the size to the index of |
1553 | * the problem character.) This has not been tested within libpng. | 1553 | * the problem character.) This has not been tested within libpng. |
1554 | */ | 1554 | */ |
1555 | PNG_EXTERN int png_check_fp_number PNGARG((png_const_charp string, | 1555 | PNG_EXTERN int png_check_fp_number PNGARG((png_const_charp string, |
1556 | png_size_t size, int *statep, png_size_tp whereami)); | 1556 | png_size_t size, int *statep, png_size_tp whereami)); |
1557 | 1557 | ||
1558 | /* This is the same but it checks a complete string and returns true | 1558 | /* This is the same but it checks a complete string and returns true |
1559 | * only if it just contains a floating point number. As of 1.5.4 this | 1559 | * only if it just contains a floating point number. As of 1.5.4 this |
1560 | * function also returns the state at the end of parsing the number if | 1560 | * function also returns the state at the end of parsing the number if |
1561 | * it was valid (otherwise it returns 0.) This can be used for testing | 1561 | * it was valid (otherwise it returns 0.) This can be used for testing |
1562 | * for negative or zero values using the sticky flag. | 1562 | * for negative or zero values using the sticky flag. |
1563 | */ | 1563 | */ |
1564 | PNG_EXTERN int png_check_fp_string PNGARG((png_const_charp string, | 1564 | PNG_EXTERN int png_check_fp_string PNGARG((png_const_charp string, |
1565 | png_size_t size)); | 1565 | png_size_t size)); |
1566 | #endif /* pCAL || sCAL */ | 1566 | #endif /* pCAL || sCAL */ |
1567 | 1567 | ||
1568 | #if defined(PNG_READ_GAMMA_SUPPORTED) ||\ | 1568 | #if defined(PNG_READ_GAMMA_SUPPORTED) ||\ |
1569 | defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED) | 1569 | defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED) |
1570 | /* Added at libpng version 1.5.0 */ | 1570 | /* Added at libpng version 1.5.0 */ |
1571 | /* This is a utility to provide a*times/div (rounded) and indicate | 1571 | /* This is a utility to provide a*times/div (rounded) and indicate |
1572 | * if there is an overflow. The result is a boolean - false (0) | 1572 | * if there is an overflow. The result is a boolean - false (0) |
1573 | * for overflow, true (1) if no overflow, in which case *res | 1573 | * for overflow, true (1) if no overflow, in which case *res |
1574 | * holds the result. | 1574 | * holds the result. |
1575 | */ | 1575 | */ |
1576 | PNG_EXTERN int png_muldiv PNGARG((png_fixed_point_p res, png_fixed_point a, | 1576 | PNG_EXTERN int png_muldiv PNGARG((png_fixed_point_p res, png_fixed_point a, |
1577 | png_int_32 multiplied_by, png_int_32 divided_by)); | 1577 | png_int_32 multiplied_by, png_int_32 divided_by)); |
1578 | #endif | 1578 | #endif |
1579 | 1579 | ||
1580 | #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED) | 1580 | #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED) |
1581 | /* Same deal, but issue a warning on overflow and return 0. */ | 1581 | /* Same deal, but issue a warning on overflow and return 0. */ |
1582 | PNG_EXTERN png_fixed_point png_muldiv_warn PNGARG((png_structp png_ptr, | 1582 | PNG_EXTERN png_fixed_point png_muldiv_warn PNGARG((png_structp png_ptr, |
1583 | png_fixed_point a, png_int_32 multiplied_by, png_int_32 divided_by)); | 1583 | png_fixed_point a, png_int_32 multiplied_by, png_int_32 divided_by)); |
1584 | #endif | 1584 | #endif |
1585 | 1585 | ||
1586 | #ifdef PNG_READ_GAMMA_SUPPORTED | 1586 | #ifdef PNG_READ_GAMMA_SUPPORTED |
1587 | /* Calculate a reciprocal - used for gamma values. This returns | 1587 | /* Calculate a reciprocal - used for gamma values. This returns |
1588 | * 0 if the argument is 0 in order to maintain an undefined value, | 1588 | * 0 if the argument is 0 in order to maintain an undefined value, |
1589 | * there are no warnings. | 1589 | * there are no warnings. |
1590 | */ | 1590 | */ |
1591 | PNG_EXTERN png_fixed_point png_reciprocal PNGARG((png_fixed_point a)); | 1591 | PNG_EXTERN png_fixed_point png_reciprocal PNGARG((png_fixed_point a)); |
1592 | 1592 | ||
1593 | /* The same but gives a reciprocal of the product of two fixed point | 1593 | /* The same but gives a reciprocal of the product of two fixed point |
1594 | * values. Accuracy is suitable for gamma calculations but this is | 1594 | * values. Accuracy is suitable for gamma calculations but this is |
1595 | * not exact - use png_muldiv for that. | 1595 | * not exact - use png_muldiv for that. |
1596 | */ | 1596 | */ |
1597 | PNG_EXTERN png_fixed_point png_reciprocal2 PNGARG((png_fixed_point a, | 1597 | PNG_EXTERN png_fixed_point png_reciprocal2 PNGARG((png_fixed_point a, |
1598 | png_fixed_point b)); | 1598 | png_fixed_point b)); |
1599 | #endif | 1599 | #endif |
1600 | 1600 | ||
1601 | #ifdef PNG_READ_GAMMA_SUPPORTED | 1601 | #ifdef PNG_READ_GAMMA_SUPPORTED |
1602 | /* Internal fixed point gamma correction. These APIs are called as | 1602 | /* Internal fixed point gamma correction. These APIs are called as |
1603 | * required to convert single values - they don't need to be fast, | 1603 | * required to convert single values - they don't need to be fast, |
1604 | * they are not used when processing image pixel values. | 1604 | * they are not used when processing image pixel values. |
1605 | * | 1605 | * |
1606 | * While the input is an 'unsigned' value it must actually be the | 1606 | * While the input is an 'unsigned' value it must actually be the |
1607 | * correct bit value - 0..255 or 0..65535 as required. | 1607 | * correct bit value - 0..255 or 0..65535 as required. |
1608 | */ | 1608 | */ |
1609 | PNG_EXTERN png_uint_16 png_gamma_correct PNGARG((png_structp png_ptr, | 1609 | PNG_EXTERN png_uint_16 png_gamma_correct PNGARG((png_structp png_ptr, |
1610 | unsigned int value, png_fixed_point gamma_value)); | 1610 | unsigned int value, png_fixed_point gamma_value)); |
1611 | PNG_EXTERN int png_gamma_significant PNGARG((png_fixed_point gamma_value)); | 1611 | PNG_EXTERN int png_gamma_significant PNGARG((png_fixed_point gamma_value)); |
1612 | PNG_EXTERN png_uint_16 png_gamma_16bit_correct PNGARG((unsigned int value, | 1612 | PNG_EXTERN png_uint_16 png_gamma_16bit_correct PNGARG((unsigned int value, |
1613 | png_fixed_point gamma_value)); | 1613 | png_fixed_point gamma_value)); |
1614 | PNG_EXTERN png_byte png_gamma_8bit_correct PNGARG((unsigned int value, | 1614 | PNG_EXTERN png_byte png_gamma_8bit_correct PNGARG((unsigned int value, |
1615 | png_fixed_point gamma_value)); | 1615 | png_fixed_point gamma_value)); |
1616 | PNG_EXTERN void png_destroy_gamma_table(png_structp png_ptr); | 1616 | PNG_EXTERN void png_destroy_gamma_table(png_structp png_ptr); |
1617 | PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr, | 1617 | PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr, |
1618 | int bit_depth)); | 1618 | int bit_depth)); |
1619 | #endif | 1619 | #endif |
1620 | 1620 | ||
1621 | /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ | 1621 | /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ |
1622 | 1622 | ||
1623 | #include "pngdebug.h" | 1623 | #include "pngdebug.h" |
1624 | 1624 | ||
1625 | #ifdef __cplusplus | 1625 | #ifdef __cplusplus |
1626 | } | 1626 | } |
1627 | #endif | 1627 | #endif |
1628 | 1628 | ||
1629 | #endif /* PNGPRIV_H */ | 1629 | #endif /* PNGPRIV_H */ |