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