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