Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: third_party/libpng/png.h

Issue 1591483003: XFA: Upgrade libpng to 1.6.20. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: rebase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libpng/README.pdfium ('k') | third_party/libpng/png.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* png.h - header file for PNG reference library 2 /* png.h - header file for PNG reference library
3 * 3 *
4 * libpng version 1.6.3 - July 18, 2013 4 * libpng version 1.6.20, December 3, 2015
5 * Copyright (c) 1998-2013 Glenn Randers-Pehrson 5 *
6 * Copyright (c) 1998-2015 Glenn Randers-Pehrson
6 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 7 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
8 * 9 *
9 * This code is released under the libpng license (See LICENSE, below) 10 * This code is released under the libpng license (See LICENSE, below)
10 * 11 *
11 * Authors and maintainers: 12 * Authors and maintainers:
12 * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat 13 * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
13 * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger 14 * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
14 * libpng versions 0.97, January 1998, through 1.6.3 - July 18, 2013: Glenn 15 * libpng versions 0.97, January 1998, through 1.6.20, December 3, 2015:
16 * Glenn Randers-Pehrson.
15 * See also "Contributing Authors", below. 17 * See also "Contributing Authors", below.
16 *
17 * Note about libpng version numbers:
18 *
19 * Due to various miscommunications, unforeseen code incompatibilities
20 * and occasional factors outside the authors' control, version numbering
21 * on the library has not always been consistent and straightforward.
22 * The following table summarizes matters since version 0.89c, which was
23 * the first widely used release:
24 *
25 * source png.h png.h shared-lib
26 * version string int version
27 * ------- ------ ----- ----------
28 * 0.89c "1.0 beta 3" 0.89 89 1.0.89
29 * 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90]
30 * 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95]
31 * 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96]
32 * 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97]
33 * 0.97c 0.97 97 2.0.97
34 * 0.98 0.98 98 2.0.98
35 * 0.99 0.99 98 2.0.99
36 * 0.99a-m 0.99 99 2.0.99
37 * 1.00 1.00 100 2.1.0 [100 should be 10000]
38 * 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000]
39 * 1.0.1 png.h string is 10001 2.1.0
40 * 1.0.1a-e identical to the 10002 from here on, the shared library
41 * 1.0.2 source version) 10002 is 2.V where V is the source code
42 * 1.0.2a-b 10003 version, except as noted.
43 * 1.0.3 10003
44 * 1.0.3a-d 10004
45 * 1.0.4 10004
46 * 1.0.4a-f 10005
47 * 1.0.5 (+ 2 patches) 10005
48 * 1.0.5a-d 10006
49 * 1.0.5e-r 10100 (not source compatible)
50 * 1.0.5s-v 10006 (not binary compatible)
51 * 1.0.6 (+ 3 patches) 10006 (still binary incompatible)
52 * 1.0.6d-f 10007 (still binary incompatible)
53 * 1.0.6g 10007
54 * 1.0.6h 10007 10.6h (testing xy.z so-numbering)
55 * 1.0.6i 10007 10.6i
56 * 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0)
57 * 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible)
58 * 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible)
59 * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible)
60 * 1.0.7 1 10007 (still compatible)
61 * 1.0.8beta1-4 1 10008 2.1.0.8beta1-4
62 * 1.0.8rc1 1 10008 2.1.0.8rc1
63 * 1.0.8 1 10008 2.1.0.8
64 * 1.0.9beta1-6 1 10009 2.1.0.9beta1-6
65 * 1.0.9rc1 1 10009 2.1.0.9rc1
66 * 1.0.9beta7-10 1 10009 2.1.0.9beta7-10
67 * 1.0.9rc2 1 10009 2.1.0.9rc2
68 * 1.0.9 1 10009 2.1.0.9
69 * 1.0.10beta1 1 10010 2.1.0.10beta1
70 * 1.0.10rc1 1 10010 2.1.0.10rc1
71 * 1.0.10 1 10010 2.1.0.10
72 * 1.0.11beta1-3 1 10011 2.1.0.11beta1-3
73 * 1.0.11rc1 1 10011 2.1.0.11rc1
74 * 1.0.11 1 10011 2.1.0.11
75 * 1.0.12beta1-2 2 10012 2.1.0.12beta1-2
76 * 1.0.12rc1 2 10012 2.1.0.12rc1
77 * 1.0.12 2 10012 2.1.0.12
78 * 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned)
79 * 1.2.0beta1-2 2 10200 2.1.2.0beta1-2
80 * 1.2.0beta3-5 3 10200 3.1.2.0beta3-5
81 * 1.2.0rc1 3 10200 3.1.2.0rc1
82 * 1.2.0 3 10200 3.1.2.0
83 * 1.2.1beta1-4 3 10201 3.1.2.1beta1-4
84 * 1.2.1rc1-2 3 10201 3.1.2.1rc1-2
85 * 1.2.1 3 10201 3.1.2.1
86 * 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6
87 * 1.0.13beta1 10 10013 10.so.0.1.0.13beta1
88 * 1.0.13rc1 10 10013 10.so.0.1.0.13rc1
89 * 1.2.2rc1 12 10202 12.so.0.1.2.2rc1
90 * 1.0.13 10 10013 10.so.0.1.0.13
91 * 1.2.2 12 10202 12.so.0.1.2.2
92 * 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6
93 * 1.2.3 12 10203 12.so.0.1.2.3
94 * 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3
95 * 1.0.14rc1 13 10014 10.so.0.1.0.14rc1
96 * 1.2.4rc1 13 10204 12.so.0.1.2.4rc1
97 * 1.0.14 10 10014 10.so.0.1.0.14
98 * 1.2.4 13 10204 12.so.0.1.2.4
99 * 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2
100 * 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3
101 * 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3
102 * 1.0.15 10 10015 10.so.0.1.0.15
103 * 1.2.5 13 10205 12.so.0.1.2.5
104 * 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4
105 * 1.0.16 10 10016 10.so.0.1.0.16
106 * 1.2.6 13 10206 12.so.0.1.2.6
107 * 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2
108 * 1.0.17rc1 10 10017 12.so.0.1.0.17rc1
109 * 1.2.7rc1 13 10207 12.so.0.1.2.7rc1
110 * 1.0.17 10 10017 12.so.0.1.0.17
111 * 1.2.7 13 10207 12.so.0.1.2.7
112 * 1.2.8beta1-5 13 10208 12.so.0.1.2.8beta1-5
113 * 1.0.18rc1-5 10 10018 12.so.0.1.0.18rc1-5
114 * 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5
115 * 1.0.18 10 10018 12.so.0.1.0.18
116 * 1.2.8 13 10208 12.so.0.1.2.8
117 * 1.2.9beta1-3 13 10209 12.so.0.1.2.9beta1-3
118 * 1.2.9beta4-11 13 10209 12.so.0.9[.0]
119 * 1.2.9rc1 13 10209 12.so.0.9[.0]
120 * 1.2.9 13 10209 12.so.0.9[.0]
121 * 1.2.10beta1-7 13 10210 12.so.0.10[.0]
122 * 1.2.10rc1-2 13 10210 12.so.0.10[.0]
123 * 1.2.10 13 10210 12.so.0.10[.0]
124 * 1.4.0beta1-5 14 10400 14.so.0.0[.0]
125 * 1.2.11beta1-4 13 10211 12.so.0.11[.0]
126 * 1.4.0beta7-8 14 10400 14.so.0.0[.0]
127 * 1.2.11 13 10211 12.so.0.11[.0]
128 * 1.2.12 13 10212 12.so.0.12[.0]
129 * 1.4.0beta9-14 14 10400 14.so.0.0[.0]
130 * 1.2.13 13 10213 12.so.0.13[.0]
131 * 1.4.0beta15-36 14 10400 14.so.0.0[.0]
132 * 1.4.0beta37-87 14 10400 14.so.14.0[.0]
133 * 1.4.0rc01 14 10400 14.so.14.0[.0]
134 * 1.4.0beta88-109 14 10400 14.so.14.0[.0]
135 * 1.4.0rc02-08 14 10400 14.so.14.0[.0]
136 * 1.4.0 14 10400 14.so.14.0[.0]
137 * 1.4.1beta01-03 14 10401 14.so.14.1[.0]
138 * 1.4.1rc01 14 10401 14.so.14.1[.0]
139 * 1.4.1beta04-12 14 10401 14.so.14.1[.0]
140 * 1.4.1 14 10401 14.so.14.1[.0]
141 * 1.4.2 14 10402 14.so.14.2[.0]
142 * 1.4.3 14 10403 14.so.14.3[.0]
143 * 1.4.4 14 10404 14.so.14.4[.0]
144 * 1.5.0beta01-58 15 10500 15.so.15.0[.0]
145 * 1.5.0rc01-07 15 10500 15.so.15.0[.0]
146 * 1.5.0 15 10500 15.so.15.0[.0]
147 * 1.5.1beta01-11 15 10501 15.so.15.1[.0]
148 * 1.5.1rc01-02 15 10501 15.so.15.1[.0]
149 * 1.5.1 15 10501 15.so.15.1[.0]
150 * 1.5.2beta01-03 15 10502 15.so.15.2[.0]
151 * 1.5.2rc01-03 15 10502 15.so.15.2[.0]
152 * 1.5.2 15 10502 15.so.15.2[.0]
153 * 1.5.3beta01-10 15 10503 15.so.15.3[.0]
154 * 1.5.3rc01-02 15 10503 15.so.15.3[.0]
155 * 1.5.3beta11 15 10503 15.so.15.3[.0]
156 * 1.5.3 [omitted]
157 * 1.5.4beta01-08 15 10504 15.so.15.4[.0]
158 * 1.5.4rc01 15 10504 15.so.15.4[.0]
159 * 1.5.4 15 10504 15.so.15.4[.0]
160 * 1.5.5beta01-08 15 10505 15.so.15.5[.0]
161 * 1.5.5rc01 15 10505 15.so.15.5[.0]
162 * 1.5.5 15 10505 15.so.15.5[.0]
163 * 1.5.6beta01-07 15 10506 15.so.15.6[.0]
164 * 1.5.6rc01-03 15 10506 15.so.15.6[.0]
165 * 1.5.6 15 10506 15.so.15.6[.0]
166 * 1.5.7beta01-05 15 10507 15.so.15.7[.0]
167 * 1.5.7rc01-03 15 10507 15.so.15.7[.0]
168 * 1.5.7 15 10507 15.so.15.7[.0]
169 * 1.6.0beta01-40 16 10600 16.so.16.0[.0]
170 * 1.6.0rc01-08 16 10600 16.so.16.0[.0]
171 * 1.6.0 16 10600 16.so.16.0[.0]
172 * 1.6.1beta01-09 16 10601 16.so.16.1[.0]
173 * 1.6.1rc01 16 10601 16.so.16.1[.0]
174 * 1.6.1 16 10601 16.so.16.1[.0]
175 * 1.6.2beta01 16 10602 16.so.16.2[.0]
176 * 1.6.2rc01-06 16 10602 16.so.16.2[.0]
177 * 1.6.2 16 10602 16.so.16.2[.0]
178 * 1.6.3beta01-11 16 10603 16.so.16.3[.0]
179 * 1.6.3rc01 16 10603 16.so.16.3[.0]
180 * 1.6.3 16 10603 16.so.16.3[.0]
181 *
182 * Henceforth the source version will match the shared-library major
183 * and minor numbers; the shared-library major version number will be
184 * used for changes in backward compatibility, as it is intended. The
185 * PNG_LIBPNG_VER macro, which is not used within libpng but is available
186 * for applications, is an unsigned integer of the form xyyzz corresponding
187 * to the source version x.y.z (leading zeros in y and z). Beta versions
188 * were given the previous public release number plus a letter, until
189 * version 1.0.6j; from then on they were given the upcoming public
190 * release number plus "betaNN" or "rcNN".
191 *
192 * Binary incompatibility exists only when applications make direct access
193 * to the info_ptr or png_ptr members through png.h, and the compiled
194 * application is loaded with a different version of the library.
195 *
196 * DLLNUM will change each time there are forward or backward changes
197 * in binary compatibility (e.g., when a new feature is added).
198 *
199 * See libpng-manual.txt or libpng.3 for more information. The PNG
200 * specification is available as a W3C Recommendation and as an ISO
201 * Specification, <http://www.w3.org/TR/2003/REC-PNG-20031110/
202 */ 18 */
203 19
204 /* 20 /*
205 * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: 21 * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
206 * 22 *
207 * If you modify libpng you may insert additional notices immediately following 23 * If you modify libpng you may insert additional notices immediately following
208 * this sentence. 24 * this sentence.
209 * 25 *
210 * This code is released under the libpng license. 26 * This code is released under the libpng license.
211 * 27 *
212 * libpng versions 1.2.6, August 15, 2004, through 1.6.3, July 18, 2013, are 28 * libpng versions 1.0.7, July 1, 2000, through 1.6.20, December 3, 2015, are
213 * Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are 29 * Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
214 * distributed according to the same disclaimer and license as libpng-1.2.5 30 * derived from libpng-1.0.6, and are distributed according to the same
215 * with the following individual added to the list of Contributing Authors: 31 * disclaimer and license as libpng-1.0.6 with the following individuals
216 * 32 * added to the list of Contributing Authors:
217 * Cosmin Truta
218 *
219 * libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are
220 * Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
221 * distributed according to the same disclaimer and license as libpng-1.0.6
222 * with the following individuals added to the list of Contributing Authors:
223 * 33 *
224 * Simon-Pierre Cadieux 34 * Simon-Pierre Cadieux
225 * Eric S. Raymond 35 * Eric S. Raymond
36 * Mans Rullgard
37 * Cosmin Truta
226 * Gilles Vollant 38 * Gilles Vollant
39 * James Yu
227 * 40 *
228 * and with the following additions to the disclaimer: 41 * and with the following additions to the disclaimer:
229 * 42 *
230 * There is no warranty against interference with your enjoyment of the 43 * There is no warranty against interference with your enjoyment of the
231 * library or against infringement. There is no warranty that our 44 * library or against infringement. There is no warranty that our
232 * efforts or the library will fulfill any of your particular purposes 45 * efforts or the library will fulfill any of your particular purposes
233 * or needs. This library is provided with all faults, and the entire 46 * or needs. This library is provided with all faults, and the entire
234 * risk of satisfactory quality, performance, accuracy, and effort is with 47 * risk of satisfactory quality, performance, accuracy, and effort is with
235 * the user. 48 * the user.
236 * 49 *
237 * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are 50 * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
238 * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson, and are 51 * Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
239 * distributed according to the same disclaimer and license as libpng-0.96, 52 * libpng-0.96, and are distributed according to the same disclaimer and
240 * with the following individuals added to the list of Contributing Authors: 53 * license as libpng-0.96, with the following individuals added to the list
54 * of Contributing Authors:
241 * 55 *
242 * Tom Lane 56 * Tom Lane
243 * Glenn Randers-Pehrson 57 * Glenn Randers-Pehrson
244 * Willem van Schaik 58 * Willem van Schaik
245 * 59 *
246 * libpng versions 0.89, June 1996, through 0.96, May 1997, are 60 * libpng versions 0.89, June 1996, through 0.96, May 1997, are
247 * Copyright (c) 1996, 1997 Andreas Dilger 61 * Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
248 * Distributed according to the same disclaimer and license as libpng-0.88, 62 * and are distributed according to the same disclaimer and license as
249 * with the following individuals added to the list of Contributing Authors: 63 * libpng-0.88, with the following individuals added to the list of
64 * Contributing Authors:
250 * 65 *
251 * John Bowler 66 * John Bowler
252 * Kevin Bracey 67 * Kevin Bracey
253 * Sam Bushell 68 * Sam Bushell
254 * Magnus Holmgren 69 * Magnus Holmgren
255 * Greg Roelofs 70 * Greg Roelofs
256 * Tom Tanner 71 * Tom Tanner
257 * 72 *
258 * libpng versions 0.5, May 1995, through 0.88, January 1996, are 73 * libpng versions 0.5, May 1995, through 0.88, January 1996, are
259 * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. 74 * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
260 * 75 *
261 * For the purposes of this copyright and license, "Contributing Authors" 76 * For the purposes of this copyright and license, "Contributing Authors"
262 * is defined as the following set of individuals: 77 * is defined as the following set of individuals:
263 * 78 *
264 * Andreas Dilger 79 * Andreas Dilger
265 * Dave Martindale 80 * Dave Martindale
266 * Guy Eric Schalnat 81 * Guy Eric Schalnat
267 * Paul Schmidt 82 * Paul Schmidt
268 * Tim Wegner 83 * Tim Wegner
269 * 84 *
270 * The PNG Reference Library is supplied "AS IS". The Contributing Authors 85 * The PNG Reference Library is supplied "AS IS". The Contributing Authors
271 * and Group 42, Inc. disclaim all warranties, expressed or implied, 86 * and Group 42, Inc. disclaim all warranties, expressed or implied,
272 * including, without limitation, the warranties of merchantability and of 87 * including, without limitation, the warranties of merchantability and of
273 * fitness for any purpose. The Contributing Authors and Group 42, Inc. 88 * fitness for any purpose. The Contributing Authors and Group 42, Inc.
274 * assume no liability for direct, indirect, incidental, special, exemplary, 89 * assume no liability for direct, indirect, incidental, special, exemplary,
275 * or consequential damages, which may result from the use of the PNG 90 * or consequential damages, which may result from the use of the PNG
276 * Reference Library, even if advised of the possibility of such damage. 91 * Reference Library, even if advised of the possibility of such damage.
277 * 92 *
278 * Permission is hereby granted to use, copy, modify, and distribute this 93 * Permission is hereby granted to use, copy, modify, and distribute this
279 * source code, or portions hereof, for any purpose, without fee, subject 94 * source code, or portions hereof, for any purpose, without fee, subject
280 * to the following restrictions: 95 * to the following restrictions:
281 * 96 *
282 * 1. The origin of this source code must not be misrepresented. 97 * 1. The origin of this source code must not be misrepresented.
283 * 98 *
284 * 2. Altered versions must be plainly marked as such and must not 99 * 2. Altered versions must be plainly marked as such and must not
285 * be misrepresented as being the original source. 100 * be misrepresented as being the original source.
286 * 101 *
287 * 3. This Copyright notice may not be removed or altered from 102 * 3. This Copyright notice may not be removed or altered from any
288 * any source or altered source distribution. 103 * source or altered source distribution.
289 * 104 *
290 * The Contributing Authors and Group 42, Inc. specifically permit, without 105 * The Contributing Authors and Group 42, Inc. specifically permit, without
291 * fee, and encourage the use of this source code as a component to 106 * fee, and encourage the use of this source code as a component to
292 * supporting the PNG file format in commercial products. If you use this 107 * supporting the PNG file format in commercial products. If you use this
293 * source code in a product, acknowledgment is not required but would be 108 * source code in a product, acknowledgment is not required but would be
294 * appreciated. 109 * appreciated.
110 *
111 * END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
295 */ 112 */
296 113
297 /* 114 /*
298 * A "png_get_copyright" function is available, for convenient use in "about" 115 * A "png_get_copyright" function is available, for convenient use in "about"
299 * boxes and the like: 116 * boxes and the like:
300 * 117 *
301 * printf("%s", png_get_copyright(NULL)); 118 * printf("%s", png_get_copyright(NULL));
302 * 119 *
303 * Also, the PNG logo (in PNG format, of course) is supplied in the 120 * Also, the PNG logo (in PNG format, of course) is supplied in the
304 * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31). 121 * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
305 */ 122 */
306 123
307 /* 124 /*
308 * Libpng is OSI Certified Open Source Software. OSI Certified is a 125 * Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
309 * certification mark of the Open Source Initiative. 126 * a certification mark of the Open Source Initiative. OSI has not addressed
127 * the additional disclaimers inserted at version 1.0.7.
310 */ 128 */
311 129
312 /* 130 /*
313 * The contributing authors would like to thank all those who helped 131 * The contributing authors would like to thank all those who helped
314 * with testing, bug fixes, and patience. This wouldn't have been 132 * with testing, bug fixes, and patience. This wouldn't have been
315 * possible without all of you. 133 * possible without all of you.
316 * 134 *
317 * Thanks to Frank J. T. Wojcik for helping with the documentation. 135 * Thanks to Frank J. T. Wojcik for helping with the documentation.
318 */ 136 */
319 137
138 /* Note about libpng version numbers:
139 *
140 * Due to various miscommunications, unforeseen code incompatibilities
141 * and occasional factors outside the authors' control, version numbering
142 * on the library has not always been consistent and straightforward.
143 * The following table summarizes matters since version 0.89c, which was
144 * the first widely used release:
145 *
146 * source png.h png.h shared-lib
147 * version string int version
148 * ------- ------ ----- ----------
149 * 0.89c "1.0 beta 3" 0.89 89 1.0.89
150 * 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90]
151 * 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95]
152 * 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96]
153 * 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97]
154 * 0.97c 0.97 97 2.0.97
155 * 0.98 0.98 98 2.0.98
156 * 0.99 0.99 98 2.0.99
157 * 0.99a-m 0.99 99 2.0.99
158 * 1.00 1.00 100 2.1.0 [100 should be 10000]
159 * 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000]
160 * 1.0.1 png.h string is 10001 2.1.0
161 * 1.0.1a-e identical to the 10002 from here on, the shared library
162 * 1.0.2 source version) 10002 is 2.V where V is the source code
163 * 1.0.2a-b 10003 version, except as noted.
164 * 1.0.3 10003
165 * 1.0.3a-d 10004
166 * 1.0.4 10004
167 * 1.0.4a-f 10005
168 * 1.0.5 (+ 2 patches) 10005
169 * 1.0.5a-d 10006
170 * 1.0.5e-r 10100 (not source compatible)
171 * 1.0.5s-v 10006 (not binary compatible)
172 * 1.0.6 (+ 3 patches) 10006 (still binary incompatible)
173 * 1.0.6d-f 10007 (still binary incompatible)
174 * 1.0.6g 10007
175 * 1.0.6h 10007 10.6h (testing xy.z so-numbering)
176 * 1.0.6i 10007 10.6i
177 * 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0)
178 * 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible)
179 * 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible)
180 * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible)
181 * 1.0.7 1 10007 (still compatible)
182 * ...
183 * 1.0.19 10 10019 10.so.0.19[.0]
184 * ...
185 * 1.2.53 13 10253 12.so.0.53[.0]
186 * ...
187 * 1.5.23 15 10523 15.so.15.23[.0]
188 * ...
189 * 1.6.20 16 10620 16.so.16.20[.0]
190 *
191 * Henceforth the source version will match the shared-library major
192 * and minor numbers; the shared-library major version number will be
193 * used for changes in backward compatibility, as it is intended. The
194 * PNG_LIBPNG_VER macro, which is not used within libpng but is available
195 * for applications, is an unsigned integer of the form xyyzz corresponding
196 * to the source version x.y.z (leading zeros in y and z). Beta versions
197 * were given the previous public release number plus a letter, until
198 * version 1.0.6j; from then on they were given the upcoming public
199 * release number plus "betaNN" or "rcNN".
200 *
201 * Binary incompatibility exists only when applications make direct access
202 * to the info_ptr or png_ptr members through png.h, and the compiled
203 * application is loaded with a different version of the library.
204 *
205 * DLLNUM will change each time there are forward or backward changes
206 * in binary compatibility (e.g., when a new feature is added).
207 *
208 * See libpng.txt or libpng.3 for more information. The PNG specification
209 * is available as a W3C Recommendation and as an ISO Specification,
210 * <http://www.w3.org/TR/2003/REC-PNG-20031110/
211 */
212
320 /* 213 /*
321 * Y2K compliance in libpng: 214 * Y2K compliance in libpng:
322 * ========================= 215 * =========================
323 * 216 *
324 * July 18, 2013 217 * December 3, 2015
325 * 218 *
326 * Since the PNG Development group is an ad-hoc body, we can't make 219 * Since the PNG Development group is an ad-hoc body, we can't make
327 * an official declaration. 220 * an official declaration.
328 * 221 *
329 * This is your unofficial assurance that libpng from version 0.71 and 222 * This is your unofficial assurance that libpng from version 0.71 and
330 * upward through 1.6.3 are Y2K compliant. It is my belief that 223 * upward through 1.6.20 are Y2K compliant. It is my belief that
331 * earlier versions were also Y2K compliant. 224 * earlier versions were also Y2K compliant.
332 * 225 *
333 * Libpng only has two year fields. One is a 2-byte unsigned integer 226 * Libpng only has two year fields. One is a 2-byte unsigned integer
334 * that will hold years up to 65535. The other, which is deprecated, 227 * that will hold years up to 65535. The other, which is deprecated,
335 * holds the date in text format, and will hold years up to 9999. 228 * holds the date in text format, and will hold years up to 9999.
336 * 229 *
337 * The integer is 230 * The integer is
338 * "png_uint_16 year" in png_time_struct. 231 * "png_uint_16 year" in png_time_struct.
339 * 232 *
340 * The string is 233 * The string is
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 * libpng maintainer 266 * libpng maintainer
374 * PNG Development Group 267 * PNG Development Group
375 */ 268 */
376 269
377 #ifndef PNG_H 270 #ifndef PNG_H
378 #define PNG_H 271 #define PNG_H
379 272
380 /* This is not the place to learn how to use libpng. The file libpng-manual.txt 273 /* This is not the place to learn how to use libpng. The file libpng-manual.txt
381 * describes how to use libpng, and the file example.c summarizes it 274 * describes how to use libpng, and the file example.c summarizes it
382 * with some code on which to build. This file is useful for looking 275 * with some code on which to build. This file is useful for looking
383 * at the actual function definitions and structure components. 276 * at the actual function definitions and structure components. If that
277 * file has been stripped from your copy of libpng, you can find it at
278 * <http://www.libpng.org/pub/png/libpng-manual.txt>
384 * 279 *
385 * If you just need to read a PNG file and don't want to read the documentation 280 * If you just need to read a PNG file and don't want to read the documentation
386 * skip to the end of this file and read the section entitled 'simplified API'. 281 * skip to the end of this file and read the section entitled 'simplified API'.
387 */ 282 */
388 283
389 /* Sunliang.liu add 20100319 for avoid name conflict. */
390 #define png_set_sig_bytes FOXIT_png_set_sig_bytes
391 #define png_sig_cmp FOXIT_png_sig_cmp
392 #define png_create_info_struct FOXIT_png_create_info_struct
393 #define png_destroy_info_struct FOXIT_png_destroy_info_struct
394 #define png_info_init_3 FOXIT_png_info_init_3
395 #define png_data_freer FOXIT_png_data_freer
396 #define png_free_data FOXIT_png_free_data
397 #define png_info_destroy FOXIT_png_info_destroy
398 #define png_get_io_ptr FOXIT_png_get_io_ptr
399 #define png_init_io FOXIT_png_init_io
400 #define png_convert_to_rfc1123 FOXIT_png_convert_to_rfc1123
401 #define png_get_copyright FOXIT_png_get_copyright
402 #define png_get_libpng_ver FOXIT_png_get_libpng_ver
403 #define png_get_header_ver FOXIT_png_get_header_ver
404 #define png_get_header_version FOXIT_png_get_header_version
405 #define png_handle_as_unknown FOXIT_png_handle_as_unknown
406 #define png_reset_zstream FOXIT_png_reset_zstream
407 #define png_access_version_number FOXIT_png_access_version_number
408 #define png_mmx_support FOXIT_png_mmx_support
409 #define png_create_read_struct FOXIT_png_create_read_struct
410 #define png_create_read_struct_2 FOXIT_png_create_read_struct_2
411 #define png_create_write_struct FOXIT_png_create_write_struct
412 #define png_create_write_struct_2 FOXIT_png_create_write_struct_2
413 #define png_get_compression_buffer_size FOXIT_png_get_compression_buffer_size
414 #define png_set_compression_buffer_size FOXIT_png_set_compression_buffer_size
415 #define png_set_longjmp_fn FOXIT_png_set_longjmp_fn
416 #define png_longjmp FOXIT_png_longjmp
417 #define png_write_sig FOXIT_png_write_sig
418 #define png_write_chunk FOXIT_png_write_chunk
419 #define png_write_chunk_start FOXIT_png_write_chunk_start
420 #define png_write_chunk_data FOXIT_png_write_chunk_data
421 #define png_write_chunk_end FOXIT_png_write_chunk_end
422 #define png_write_info_before_PLTE FOXIT_png_write_info_before_PLTE
423 #define png_write_info FOXIT_png_write_info
424 #define png_read_info FOXIT_png_read_info
425 #define png_convert_to_rfc1123_buffer FOXIT_png_convert_to_rfc1123_buffer
426 #define png_convert_from_struct_tm FOXIT_png_convert_from_struct_tm
427 #define png_convert_from_time_t FOXIT_png_convert_from_time_t
428 #define png_set_expand FOXIT_png_set_expand
429 #define png_set_expand_gray_1_2_4_to_8 FOXIT_png_set_expand_gray_1_2_4_to_8
430 #define png_set_palette_to_rgb FOXIT_png_set_palette_to_rgb
431 #define png_set_tRNS_to_alpha FOXIT_png_set_tRNS_to_alpha
432 #define png_set_expand_16 FOXIT_png_set_expand_16
433 #define png_set_bgr FOXIT_png_set_bgr
434 #define png_set_gray_to_rgb FOXIT_png_set_gray_to_rgb
435 #define png_set_rgb_to_gray FOXIT_png_set_rgb_to_gray
436 #define png_set_rgb_to_gray_fixed FOXIT_png_set_rgb_to_gray_fixed
437 #define png_get_rgb_to_gray_status FOXIT_png_get_rgb_to_gray_status
438 #define png_build_grayscale_palette FOXIT_png_build_grayscale_palette
439 #define png_set_alpha_mode FOXIT_png_set_alpha_mode
440 #define png_set_alpha_mode_fixed FOXIT_png_set_alpha_mode_fixed
441 #define png_set_strip_alpha FOXIT_png_set_strip_alpha
442 #define png_set_swap_alpha FOXIT_png_set_swap_alpha
443 #define png_set_invert_alpha FOXIT_png_set_invert_alpha
444 #define png_set_filler FOXIT_png_set_filler
445 #define png_set_add_alpha FOXIT_png_set_add_alpha
446 #define png_set_swap FOXIT_png_set_swap
447 #define png_set_packing FOXIT_png_set_packing
448 #define png_set_packswap FOXIT_png_set_packswap
449 #define png_set_shift FOXIT_png_set_shift
450 #define png_set_interlace_handling FOXIT_png_set_interlace_handling
451 #define png_set_invert_mono FOXIT_png_set_invert_mono
452 #define png_set_background FOXIT_png_set_background
453 #define png_set_background_fixed FOXIT_png_set_background_fixed
454 #define png_set_scale_16 FOXIT_png_set_scale_16
455 #define png_set_quantize FOXIT_png_set_quantize
456 #define png_set_gamma FOXIT_png_set_gamma
457 #define png_set_gamma_fixed FOXIT_png_set_gamma_fixed
458 #define png_set_flush FOXIT_png_set_flush
459 #define png_write_flush FOXIT_png_write_flush
460 #define png_start_read_image FOXIT_png_start_read_image
461 #define png_read_update_info FOXIT_png_read_update_info
462 #define png_read_rows FOXIT_png_read_rows
463 #define png_read_row FOXIT_png_read_row
464 #define png_read_image FOXIT_png_read_image
465 #define png_write_row FOXIT_png_write_row
466 #define png_write_rows FOXIT_png_write_rows
467 #define png_write_image FOXIT_png_write_image
468 #define png_write_end FOXIT_png_write_end
469 #define png_read_end FOXIT_png_read_end
470 #define png_destroy_read_struct FOXIT_png_destroy_read_struct
471 #define png_destroy_write_struct FOXIT_png_destroy_write_struct
472 #define png_set_crc_action FOXIT_png_set_crc_action
473 #define png_set_filter FOXIT_png_set_filter
474 #define png_set_filter_heuristics FOXIT_png_set_filter_heuristics
475 #define png_set_filter_heuristics_fixed FOXIT_png_set_filter_heuristics_fixed
476 #define png_set_compression_level FOXIT_png_set_compression_level
477 #define png_set_compression_mem_level FOXIT_png_set_compression_mem_level
478 #define png_set_compression_strategy FOXIT_png_set_compression_strategy
479 #define png_set_compression_window_bits FOXIT_png_set_compression_window_bits
480 #define png_set_compression_method FOXIT_png_set_compression_method
481 #define png_set_text_compression_level FOXIT_png_set_text_compression_level
482 #define png_set_text_compression_mem_level FOXIT_png_set_text_compression_mem_le vel
483 #define png_set_text_compression_strategy FOXIT_png_set_text_compression_strateg y
484 #define png_set_text_compression_window_bits FOXIT_png_set_text_compression_wind ow_bits
485 #define png_set_text_compression_method FOXIT_png_set_text_compression_method
486 #define png_set_error_fn FOXIT_png_set_error_fn
487 #define png_get_error_ptr FOXIT_png_get_error_ptr
488 #define png_set_write_fn FOXIT_png_set_write_fn
489 #define png_set_read_fn FOXIT_png_set_read_fn
490 #define png_set_read_status_fn FOXIT_png_set_read_status_fn
491 #define png_set_write_status_fn FOXIT_png_set_write_status_fn
492 #define png_set_read_user_transform_fn FOXIT_png_set_read_user_transform_fn
493 #define png_set_write_user_transform_fn FOXIT_png_set_write_user_transform_fn
494 #define png_set_user_transform_info FOXIT_png_set_user_transform_info
495 #define png_get_user_transform_ptr FOXIT_png_get_user_transform_ptr
496 #define png_get_current_row_number FOXIT_png_get_current_row_number
497 #define png_get_current_pass_number FOXIT_png_get_current_pass_number
498 #define png_set_read_user_chunk_fn FOXIT_png_set_read_user_chunk_fn
499 #define png_get_user_chunk_ptr FOXIT_png_get_user_chunk_ptr
500 #define png_set_progressive_read_fn FOXIT_png_set_progressive_read_fn
501 #define png_get_progressive_ptr FOXIT_png_get_progressive_ptr
502 #define png_process_data FOXIT_png_process_data
503 #define png_process_data_pause FOXIT_png_process_data_pause
504 #define png_process_data_skip FOXIT_png_process_data_skip
505 #define png_progressive_combine_row FOXIT_png_progressive_combine_row
506 #define png_calloc FOXIT_png_calloc
507 #define png_error FOXIT_png_error
508 #define png_chunk_error FOXIT_png_chunk_error
509 #define png_err FOXIT_png_err
510 #define png_warning FOXIT_png_warning
511 #define png_chunk_warning FOXIT_png_chunk_warning
512 #define png_benign_error FOXIT_png_benign_error
513 #define png_chunk_benign_error FOXIT_png_chunk_benign_error
514 #define png_set_benign_errors FOXIT_png_set_benign_errors
515 #define png_get_valid FOXIT_png_get_valid
516 #define png_get_rowbytes FOXIT_png_get_rowbytes
517 #define png_get_rows FOXIT_png_get_rows
518 #define png_set_rows FOXIT_png_set_rows
519 #define png_get_channels FOXIT_png_get_channels
520 #define png_get_image_width FOXIT_png_get_image_width
521 #define png_get_image_height FOXIT_png_get_image_height
522 #define png_get_bit_depth FOXIT_png_get_bit_depth
523 #define png_get_color_type FOXIT_png_get_color_type
524 #define png_get_filter_type FOXIT_png_get_filter_type
525 #define png_get_interlace_type FOXIT_png_get_interlace_type
526 #define png_get_compression_type FOXIT_png_get_compression_type
527 #define png_get_pixels_per_meter FOXIT_png_get_pixels_per_meter
528 #define png_get_x_pixels_per_meter FOXIT_png_get_x_pixels_per_meter
529 #define png_get_y_pixels_per_meter FOXIT_png_get_y_pixels_per_meter
530 #define png_get_pixel_aspect_ratio FOXIT_png_get_pixel_aspect_ratio
531 #define png_get_pixel_aspect_ratio_fixed FOXIT_png_get_pixel_aspect_ratio_fixed
532 #define png_get_x_offset_pixels FOXIT_png_get_x_offset_pixels
533 #define png_get_y_offset_pixels FOXIT_png_get_y_offset_pixels
534 #define png_get_x_offset_microns FOXIT_png_get_x_offset_microns
535 #define png_get_y_offset_microns FOXIT_png_get_y_offset_microns
536 #define png_get_signature FOXIT_png_get_signature
537 #define png_get_bKGD FOXIT_png_get_bKGD
538 #define png_set_bKGD FOXIT_png_set_bKGD
539 #define png_get_cHRM FOXIT_png_get_cHRM
540 #define png_get_cHRM_XYZ FOXIT_png_get_cHRM_XYZ
541 #define png_get_cHRM_fixed FOXIT_png_get_cHRM_fixed
542 #define png_get_cHRM_XYZ_fixed FOXIT_png_get_cHRM_XYZ_fixed
543 #define png_set_cHRM FOXIT_png_set_cHRM
544 #define png_set_cHRM_XYZ FOXIT_png_set_cHRM_XYZ
545 #define png_set_cHRM_fixed FOXIT_png_set_cHRM_fixed
546 #define png_set_cHRM_XYZ_fixed FOXIT_png_set_cHRM_XYZ_fixed
547 #define png_get_gAMA FOXIT_png_get_gAMA
548 #define png_set_gAMA FOXIT_png_set_gAMA
549 #define png_set_gAMA_fixed FOXIT_png_set_gAMA_fixed
550 #define png_get_hIST FOXIT_png_get_hIST
551 #define png_set_hIST FOXIT_png_set_hIST
552 #define png_get_IHDR FOXIT_png_get_IHDR
553 #define png_set_IHDR FOXIT_png_set_IHDR
554 #define png_get_oFFs FOXIT_png_get_oFFs
555 #define png_set_oFFs FOXIT_png_set_oFFs
556 #define png_get_pCAL FOXIT_png_get_pCAL
557 #define png_set_pCAL FOXIT_png_set_pCAL
558 #define png_set_pHYs FOXIT_png_set_pHYs
559 #define png_get_PLTE FOXIT_png_get_PLTE
560 #define png_set_PLTE FOXIT_png_set_PLTE
561 #define png_get_sBIT FOXIT_png_get_sBIT
562 #define png_set_sBIT FOXIT_png_set_sBIT
563 #define png_get_sRGB FOXIT_png_get_sRGB
564 #define png_set_sRGB FOXIT_png_set_sRGB
565 #define png_set_sRGB_gAMA_and_cHRM FOXIT_png_set_sRGB_gAMA_and_cHRM
566 #define png_get_iCCP FOXIT_png_get_iCCP
567 #define png_set_iCCP FOXIT_png_set_iCCP
568 #define png_get_sPLT FOXIT_png_get_sPLT
569 #define png_set_sPLT FOXIT_png_set_sPLT
570 #define png_get_text FOXIT_png_get_text
571 #define png_set_text FOXIT_png_set_text
572 #define png_get_tIME FOXIT_png_get_tIME
573 #define png_set_tIME FOXIT_png_set_tIME
574 #define png_get_tRNS FOXIT_png_get_tRNS
575 #define png_set_tRNS FOXIT_png_set_tRNS
576 #define png_get_sCAL FOXIT_png_get_sCAL
577 #define png_get_sCAL_fixed FOXIT_png_get_sCAL_fixed
578 #define png_get_sCAL_s FOXIT_png_get_sCAL_s
579 #define png_set_sCAL FOXIT_png_set_sCAL
580 #define png_set_sCAL_s FOXIT_png_set_sCAL_s
581 #define png_set_keep_unknown_chunks FOXIT_png_set_keep_unknown_chunks
582 #define png_set_unknown_chunks FOXIT_png_set_unknown_chunks
583 #define png_set_unknown_chunk_location FOXIT_png_set_unknown_chunk_location
584 #define png_get_unknown_chunks FOXIT_png_get_unknown_chunks
585 #define png_set_invalid FOXIT_png_set_invalid
586 #define png_read_png FOXIT_png_read_png
587 #define png_write_png FOXIT_png_write_png
588 #define png_permit_mng_features FOXIT_png_permit_mng_features
589 #define png_set_strip_error_numbers FOXIT_png_set_strip_error_numbers
590 #define png_set_user_limits FOXIT_png_set_user_limits
591 #define png_get_user_width_max FOXIT_png_get_user_width_max
592 #define png_get_user_height_max FOXIT_png_get_user_height_max
593 #define png_set_chunk_cache_max FOXIT_png_set_chunk_cache_max
594 #define png_get_chunk_cache_max FOXIT_png_get_chunk_cache_max
595 #define png_set_chunk_malloc_max FOXIT_png_set_chunk_malloc_max
596 #define png_get_chunk_malloc_max FOXIT_png_get_chunk_malloc_max
597 #define png_get_pixels_per_inch FOXIT_png_get_pixels_per_inch
598 #define png_get_x_pixels_per_inch FOXIT_png_get_x_pixels_per_inch
599 #define png_get_y_pixels_per_inch FOXIT_png_get_y_pixels_per_inch
600 #define png_get_x_offset_inches FOXIT_png_get_x_offset_inches
601 #define png_get_x_offset_inches_fixed FOXIT_png_get_x_offset_inches_fixed
602 #define png_get_y_offset_inches FOXIT_png_get_y_offset_inches
603 #define png_get_y_offset_inches_fixed FOXIT_png_get_y_offset_inches_fixed
604 #define png_get_pHYs_dpi FOXIT_png_get_pHYs_dpi
605 #define png_get_io_state FOXIT_png_get_io_state
606 #define png_get_io_chunk_name FOXIT_png_get_io_chunk_name
607 #define png_get_io_chunk_type FOXIT_png_get_io_chunk_type
608 #define png_get_uint_31 FOXIT_png_get_uint_31
609 #define png_get_uint_32 FOXIT_png_get_uint_32
610 #define png_get_uint_16 FOXIT_png_get_uint_16
611 #define png_get_int_32 FOXIT_png_get_int_32
612 #define png_save_uint_32 FOXIT_png_save_uint_32
613 #define png_save_int_32 FOXIT_png_save_int_32
614 #define png_save_uint_16 FOXIT_png_save_uint_16
615 #define png_image_begin_read_from_file FOXIT_png_image_begin_read_from_file
616 #define png_image_begin_read_from_stdio FOXIT_png_image_begin_read_from_stdio
617 #define png_image_begin_read_from_memory FOXIT_png_image_begin_read_from_memory
618 #define png_image_finish_read FOXIT_png_image_finish_read
619 #define png_image_free FOXIT_png_image_free
620 #define png_image_write_to_file FOXIT_png_image_write_to_file
621 #define png_image_write_to_stdio FOXIT_png_image_write_to_stdio
622 #define png_set_check_for_invalid_index FOXIT_png_set_check_for_invalid_index
623 #define png_get_palette_max FOXIT_png_get_palette_max
624 #define png_set_option FOXIT_png_set_option
625
626 #define png_set_strip_16 FOXIT_png_set_strip_16
627 #define png_64bit_product FOXIT_png_64bit_product
628 #define png_check_cHRM_fixed FOXIT_png_check_cHRM_fixed
629 #define png_free FOXIT_png_free
630 #define png_free_default FOXIT_png_free_default
631 #define png_get_mem_ptr FOXIT_png_get_mem_ptr
632 #define png_malloc FOXIT_png_malloc
633 #define png_malloc_default FOXIT_png_malloc_default
634 #define png_malloc_warn FOXIT_png_malloc_warn
635 #define png_memcpy_check FOXIT_png_memcpy_check
636 #define png_memset_check FOXIT_png_memset_check
637 #define png_pass_dsp_mask FOXIT_png_pass_dsp_mask
638 #define png_pass_inc FOXIT_png_pass_inc
639 #define png_pass_mask FOXIT_png_pass_mask
640 #define png_pass_start FOXIT_png_pass_start
641 #define png_pass_yinc FOXIT_png_pass_yinc
642 #define png_pass_ystart FOXIT_png_pass_ystart
643 #define png_set_mem_fn FOXIT_png_set_mem_fn
644
645 /* Version information for png.h - this should match the version in png.c */ 284 /* Version information for png.h - this should match the version in png.c */
646 #define PNG_LIBPNG_VER_STRING "1.6.3" 285 #define PNG_LIBPNG_VER_STRING "1.6.20"
647 #define PNG_HEADER_VERSION_STRING \ 286 #define PNG_HEADER_VERSION_STRING \
648 " libpng version 1.6.3 - July 18, 2013\n" 287 " libpng version 1.6.20 - December 3, 2015\n"
649 288
650 #define PNG_LIBPNG_VER_SONUM 16 289 #define PNG_LIBPNG_VER_SONUM 16
651 #define PNG_LIBPNG_VER_DLLNUM 16 290 #define PNG_LIBPNG_VER_DLLNUM 16
652 291
653 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ 292 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
654 #define PNG_LIBPNG_VER_MAJOR 1 293 #define PNG_LIBPNG_VER_MAJOR 1
655 #define PNG_LIBPNG_VER_MINOR 6 294 #define PNG_LIBPNG_VER_MINOR 6
656 #define PNG_LIBPNG_VER_RELEASE 3 295 #define PNG_LIBPNG_VER_RELEASE 20
657 296
658 /* This should match the numeric part of the final component of 297 /* This should match the numeric part of the final component of
659 * PNG_LIBPNG_VER_STRING, omitting any leading zero: 298 * PNG_LIBPNG_VER_STRING, omitting any leading zero:
660 */ 299 */
661 300
662 #define PNG_LIBPNG_VER_BUILD 0 301 #define PNG_LIBPNG_VER_BUILD 0
663 302
664 /* Release Status */ 303 /* Release Status */
665 #define PNG_LIBPNG_BUILD_ALPHA 1 304 #define PNG_LIBPNG_BUILD_ALPHA 1
666 #define PNG_LIBPNG_BUILD_BETA 2 305 #define PNG_LIBPNG_BUILD_BETA 2
(...skipping 10 matching lines...) Expand all
677 PNG_LIBPNG_BUILD_PRIVATE */ 316 PNG_LIBPNG_BUILD_PRIVATE */
678 317
679 #define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE 318 #define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
680 319
681 /* Careful here. At one time, Guy wanted to use 082, but that would be octal. 320 /* Careful here. At one time, Guy wanted to use 082, but that would be octal.
682 * We must not include leading zeros. 321 * We must not include leading zeros.
683 * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only 322 * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
684 * version 1.0.0 was mis-numbered 100 instead of 10000). From 323 * version 1.0.0 was mis-numbered 100 instead of 10000). From
685 * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release 324 * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
686 */ 325 */
687 #define PNG_LIBPNG_VER 10603 /* 1.6.3 */ 326 #define PNG_LIBPNG_VER 10620 /* 1.6.20 */
688 327
689 /* Library configuration: these options cannot be changed after 328 /* Library configuration: these options cannot be changed after
690 * the library has been built. 329 * the library has been built.
691 */ 330 */
692 #ifndef PNGLCONF_H 331 #ifndef PNGLCONF_H
693 /* If pnglibconf.h is missing, you can 332 /* If pnglibconf.h is missing, you can
694 * copy scripts/pnglibconf.h.prebuilt to pnglibconf.h 333 * copy scripts/pnglibconf.h.prebuilt to pnglibconf.h
695 */ 334 */
696 # include "pnglibconf.h" 335 # include "pnglibconf.h"
697 #endif 336 #endif
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 extern "C" { 373 extern "C" {
735 #endif /* __cplusplus */ 374 #endif /* __cplusplus */
736 375
737 /* Version information for C files, stored in png.c. This had better match 376 /* Version information for C files, stored in png.c. This had better match
738 * the version above. 377 * the version above.
739 */ 378 */
740 #define png_libpng_ver png_get_header_ver(NULL) 379 #define png_libpng_ver png_get_header_ver(NULL)
741 380
742 /* This file is arranged in several sections: 381 /* This file is arranged in several sections:
743 * 382 *
744 * 1. Any configuration options that can be specified by for the application 383 * 1. [omitted]
384 * 2. Any configuration options that can be specified by for the application
745 * code when it is built. (Build time configuration is in pnglibconf.h) 385 * code when it is built. (Build time configuration is in pnglibconf.h)
746 * 2. Type definitions (base types are defined in pngconf.h), structure 386 * 3. Type definitions (base types are defined in pngconf.h), structure
747 * definitions. 387 * definitions.
748 * 3. Exported library functions. 388 * 4. Exported library functions.
749 * 4. Simplified API. 389 * 5. Simplified API.
390 * 6. Implementation options.
750 * 391 *
751 * The library source code has additional files (principally pngpriv.h) that 392 * The library source code has additional files (principally pngpriv.h) that
752 * allow configuration of the library. 393 * allow configuration of the library.
753 */ 394 */
754 /* Section 1: run time configuration 395
396 /* Section 1: [omitted] */
397
398 /* Section 2: run time configuration
755 * See pnglibconf.h for build time configuration 399 * See pnglibconf.h for build time configuration
756 * 400 *
757 * Run time configuration allows the application to choose between 401 * Run time configuration allows the application to choose between
758 * implementations of certain arithmetic APIs. The default is set 402 * implementations of certain arithmetic APIs. The default is set
759 * at build time and recorded in pnglibconf.h, but it is safe to 403 * at build time and recorded in pnglibconf.h, but it is safe to
760 * override these (and only these) settings. Note that this won't 404 * override these (and only these) settings. Note that this won't
761 * change what the library does, only application code, and the 405 * change what the library does, only application code, and the
762 * settings can (and probably should) be made on a per-file basis 406 * settings can (and probably should) be made on a per-file basis
763 * by setting the #defines before including png.h 407 * by setting the #defines before including png.h
764 * 408 *
765 * Use macros to read integers from PNG data or use the exported 409 * Use macros to read integers from PNG data or use the exported
766 * functions? 410 * functions?
767 * PNG_USE_READ_MACROS: use the macros (see below) Note that 411 * PNG_USE_READ_MACROS: use the macros (see below) Note that
768 * the macros evaluate their argument multiple times. 412 * the macros evaluate their argument multiple times.
769 * PNG_NO_USE_READ_MACROS: call the relevant library function. 413 * PNG_NO_USE_READ_MACROS: call the relevant library function.
770 * 414 *
771 * Use the alternative algorithm for compositing alpha samples that 415 * Use the alternative algorithm for compositing alpha samples that
772 * does not use division? 416 * does not use division?
773 * PNG_READ_COMPOSITE_NODIV_SUPPORTED: use the 'no division' 417 * PNG_READ_COMPOSITE_NODIV_SUPPORTED: use the 'no division'
774 * algorithm. 418 * algorithm.
775 * PNG_NO_READ_COMPOSITE_NODIV: use the 'division' algorithm. 419 * PNG_NO_READ_COMPOSITE_NODIV: use the 'division' algorithm.
776 * 420 *
777 * How to handle benign errors if PNG_ALLOW_BENIGN_ERRORS is 421 * How to handle benign errors if PNG_ALLOW_BENIGN_ERRORS is
778 * false? 422 * false?
779 * PNG_ALLOW_BENIGN_ERRORS: map calls to the benign error 423 * PNG_ALLOW_BENIGN_ERRORS: map calls to the benign error
780 * APIs to png_warning. 424 * APIs to png_warning.
781 * Otherwise the calls are mapped to png_error. 425 * Otherwise the calls are mapped to png_error.
782 */ 426 */
783 427
784 /* Section 2: type definitions, including structures and compile time 428 /* Section 3: type definitions, including structures and compile time
785 * constants. 429 * constants.
786 * See pngconf.h for base types that vary by machine/system 430 * See pngconf.h for base types that vary by machine/system
787 */ 431 */
788 432
789 /* This triggers a compiler error in png.c, if png.c and png.h 433 /* This triggers a compiler error in png.c, if png.c and png.h
790 * do not agree upon the version number. 434 * do not agree upon the version number.
791 */ 435 */
792 typedef char* png_libpng_version_1_6_3; 436 typedef char* png_libpng_version_1_6_20;
793 437
794 /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. 438 /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
795 * 439 *
796 * png_struct is the cache of information used while reading or writing a single 440 * png_struct is the cache of information used while reading or writing a single
797 * PNG file. One of these is always required, although the simplified API 441 * PNG file. One of these is always required, although the simplified API
798 * (below) hides the creation and destruction of it. 442 * (below) hides the creation and destruction of it.
799 */ 443 */
800 typedef struct png_struct_def png_struct; 444 typedef struct png_struct_def png_struct;
801 typedef const png_struct * png_const_structp; 445 typedef const png_struct * png_const_structp;
802 typedef png_struct * png_structp; 446 typedef png_struct * png_structp;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 png_byte month; /* month of year, 1 - 12 */ 608 png_byte month; /* month of year, 1 - 12 */
965 png_byte day; /* day of month, 1 - 31 */ 609 png_byte day; /* day of month, 1 - 31 */
966 png_byte hour; /* hour of day, 0 - 23 */ 610 png_byte hour; /* hour of day, 0 - 23 */
967 png_byte minute; /* minute of hour, 0 - 59 */ 611 png_byte minute; /* minute of hour, 0 - 59 */
968 png_byte second; /* second of minute, 0 - 60 (for leap seconds) */ 612 png_byte second; /* second of minute, 0 - 60 (for leap seconds) */
969 } png_time; 613 } png_time;
970 typedef png_time * png_timep; 614 typedef png_time * png_timep;
971 typedef const png_time * png_const_timep; 615 typedef const png_time * png_const_timep;
972 typedef png_time * * png_timepp; 616 typedef png_time * * png_timepp;
973 617
974 #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED 618 #if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) ||\
619 defined(PNG_USER_CHUNKS_SUPPORTED)
975 /* png_unknown_chunk is a structure to hold queued chunks for which there is 620 /* png_unknown_chunk is a structure to hold queued chunks for which there is
976 * no specific support. The idea is that we can use this to queue 621 * no specific support. The idea is that we can use this to queue
977 * up private chunks for output even though the library doesn't actually 622 * up private chunks for output even though the library doesn't actually
978 * know about their semantics. 623 * know about their semantics.
979 * 624 *
980 * The data in the structure is set by libpng on read and used on write. 625 * The data in the structure is set by libpng on read and used on write.
981 */ 626 */
982 typedef struct png_unknown_chunk_t 627 typedef struct png_unknown_chunk_t
983 { 628 {
984 png_byte name[5]; /* Textual chunk name with '\0' terminator */ 629 png_byte name[5]; /* Textual chunk name with '\0' terminator */
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 #define PNG_INFO_bKGD 0x0020 742 #define PNG_INFO_bKGD 0x0020
1098 #define PNG_INFO_hIST 0x0040 743 #define PNG_INFO_hIST 0x0040
1099 #define PNG_INFO_pHYs 0x0080 744 #define PNG_INFO_pHYs 0x0080
1100 #define PNG_INFO_oFFs 0x0100 745 #define PNG_INFO_oFFs 0x0100
1101 #define PNG_INFO_tIME 0x0200 746 #define PNG_INFO_tIME 0x0200
1102 #define PNG_INFO_pCAL 0x0400 747 #define PNG_INFO_pCAL 0x0400
1103 #define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */ 748 #define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */
1104 #define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */ 749 #define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */
1105 #define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */ 750 #define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
1106 #define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */ 751 #define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
752 #if INT_MAX >= 0x8000 /* else this might break */
1107 #define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */ 753 #define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */
754 #endif
1108 755
1109 /* This is used for the transformation routines, as some of them 756 /* This is used for the transformation routines, as some of them
1110 * change these values for the row. It also should enable using 757 * change these values for the row. It also should enable using
1111 * the routines for other purposes. 758 * the routines for other purposes.
1112 */ 759 */
1113 typedef struct png_row_info_struct 760 typedef struct png_row_info_struct
1114 { 761 {
1115 png_uint_32 width; /* width of row */ 762 png_uint_32 width; /* width of row */
1116 png_size_t rowbytes; /* number of bytes in row */ 763 png_size_t rowbytes; /* number of bytes in row */
1117 png_byte color_type; /* color type of row */ 764 png_byte color_type; /* color type of row */
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 #define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */ 848 #define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */
1202 #define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */ 849 #define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */
1203 #define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* write only */ 850 #define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* write only */
1204 /* Added to libpng-1.2.34 */ 851 /* Added to libpng-1.2.34 */
1205 #define PNG_TRANSFORM_STRIP_FILLER_BEFORE PNG_TRANSFORM_STRIP_FILLER 852 #define PNG_TRANSFORM_STRIP_FILLER_BEFORE PNG_TRANSFORM_STRIP_FILLER
1206 #define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* write only */ 853 #define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* write only */
1207 /* Added to libpng-1.4.0 */ 854 /* Added to libpng-1.4.0 */
1208 #define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */ 855 #define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */
1209 /* Added to libpng-1.5.4 */ 856 /* Added to libpng-1.5.4 */
1210 #define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */ 857 #define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */
858 #if INT_MAX >= 0x8000 /* else this might break */
1211 #define PNG_TRANSFORM_SCALE_16 0x8000 /* read only */ 859 #define PNG_TRANSFORM_SCALE_16 0x8000 /* read only */
860 #endif
1212 861
1213 /* Flags for MNG supported features */ 862 /* Flags for MNG supported features */
1214 #define PNG_FLAG_MNG_EMPTY_PLTE 0x01 863 #define PNG_FLAG_MNG_EMPTY_PLTE 0x01
1215 #define PNG_FLAG_MNG_FILTER_64 0x04 864 #define PNG_FLAG_MNG_FILTER_64 0x04
1216 #define PNG_ALL_MNG_FEATURES 0x05 865 #define PNG_ALL_MNG_FEATURES 0x05
1217 866
1218 /* NOTE: prior to 1.5 these functions had no 'API' style declaration, 867 /* NOTE: prior to 1.5 these functions had no 'API' style declaration,
1219 * this allowed the zlib default functions to be used on Windows 868 * this allowed the zlib default functions to be used on Windows
1220 * platforms. In 1.5 the zlib default malloc (which just calls malloc and 869 * platforms. In 1.5 the zlib default malloc (which just calls malloc and
1221 * ignores the first argument) should be completely compatible with the 870 * ignores the first argument) should be completely compatible with the
1222 * following. 871 * following.
1223 */ 872 */
1224 typedef PNG_CALLBACK(png_voidp, *png_malloc_ptr, (png_structp, 873 typedef PNG_CALLBACK(png_voidp, *png_malloc_ptr, (png_structp,
1225 png_alloc_size_t)); 874 png_alloc_size_t));
1226 typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp)); 875 typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp));
1227 876
1228 /* Section 3: exported functions 877 /* Section 4: exported functions
1229 * Here are the function definitions most commonly used. This is not 878 * Here are the function definitions most commonly used. This is not
1230 * the place to find out how to use libpng. See libpng-manual.txt for the 879 * the place to find out how to use libpng. See libpng-manual.txt for the
1231 * full explanation, see example.c for the summary. This just provides 880 * full explanation, see example.c for the summary. This just provides
1232 * a simple one line description of the use of each function. 881 * a simple one line description of the use of each function.
1233 * 882 *
1234 * The PNG_EXPORT() and PNG_EXPORTA() macros used below are defined in 883 * The PNG_EXPORT() and PNG_EXPORTA() macros used below are defined in
1235 * pngconf.h and in the *.dfn files in the scripts directory. 884 * pngconf.h and in the *.dfn files in the scripts directory.
1236 * 885 *
1237 * PNG_EXPORT(ordinal, type, name, (args)); 886 * PNG_EXPORT(ordinal, type, name, (args));
1238 * 887 *
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 png_const_timep ptime)); 1043 png_const_timep ptime));
1395 #endif 1044 #endif
1396 1045
1397 #ifdef PNG_CONVERT_tIME_SUPPORTED 1046 #ifdef PNG_CONVERT_tIME_SUPPORTED
1398 /* Convert from a struct tm to png_time */ 1047 /* Convert from a struct tm to png_time */
1399 PNG_EXPORT(24, void, png_convert_from_struct_tm, (png_timep ptime, 1048 PNG_EXPORT(24, void, png_convert_from_struct_tm, (png_timep ptime,
1400 const struct tm * ttime)); 1049 const struct tm * ttime));
1401 1050
1402 /* Convert from time_t to png_time. Uses gmtime() */ 1051 /* Convert from time_t to png_time. Uses gmtime() */
1403 PNG_EXPORT(25, void, png_convert_from_time_t, (png_timep ptime, time_t ttime)); 1052 PNG_EXPORT(25, void, png_convert_from_time_t, (png_timep ptime, time_t ttime));
1404 #endif /* PNG_CONVERT_tIME_SUPPORTED */ 1053 #endif /* CONVERT_tIME */
1405 1054
1406 #ifdef PNG_READ_EXPAND_SUPPORTED 1055 #ifdef PNG_READ_EXPAND_SUPPORTED
1407 /* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */ 1056 /* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */
1408 PNG_EXPORT(26, void, png_set_expand, (png_structrp png_ptr)); 1057 PNG_EXPORT(26, void, png_set_expand, (png_structrp png_ptr));
1409 PNG_EXPORT(27, void, png_set_expand_gray_1_2_4_to_8, (png_structrp png_ptr)); 1058 PNG_EXPORT(27, void, png_set_expand_gray_1_2_4_to_8, (png_structrp png_ptr));
1410 PNG_EXPORT(28, void, png_set_palette_to_rgb, (png_structrp png_ptr)); 1059 PNG_EXPORT(28, void, png_set_palette_to_rgb, (png_structrp png_ptr));
1411 PNG_EXPORT(29, void, png_set_tRNS_to_alpha, (png_structrp png_ptr)); 1060 PNG_EXPORT(29, void, png_set_tRNS_to_alpha, (png_structrp png_ptr));
1412 #endif 1061 #endif
1413 1062
1414 #ifdef PNG_READ_EXPAND_16_SUPPORTED 1063 #ifdef PNG_READ_EXPAND_16_SUPPORTED
(...skipping 28 matching lines...) Expand all
1443 PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structrp 1092 PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structrp
1444 png_ptr)); 1093 png_ptr));
1445 #endif 1094 #endif
1446 1095
1447 #ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED 1096 #ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
1448 PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth, 1097 PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth,
1449 png_colorp palette)); 1098 png_colorp palette));
1450 #endif 1099 #endif
1451 1100
1452 #ifdef PNG_READ_ALPHA_MODE_SUPPORTED 1101 #ifdef PNG_READ_ALPHA_MODE_SUPPORTED
1453 /* How the alpha channel is interpreted - this affects how the color channels of 1102 /* How the alpha channel is interpreted - this affects how the color channels
1454 * a PNG file are returned when an alpha channel, or tRNS chunk in a palette 1103 * of a PNG file are returned to the calling application when an alpha channel,
1455 * file, is present. 1104 * or a tRNS chunk in a palette file, is present.
1456 * 1105 *
1457 * This has no effect on the way pixels are written into a PNG output 1106 * This has no effect on the way pixels are written into a PNG output
1458 * datastream. The color samples in a PNG datastream are never premultiplied 1107 * datastream. The color samples in a PNG datastream are never premultiplied
1459 * with the alpha samples. 1108 * with the alpha samples.
1460 * 1109 *
1461 * The default is to return data according to the PNG specification: the alpha 1110 * The default is to return data according to the PNG specification: the alpha
1462 * channel is a linear measure of the contribution of the pixel to the 1111 * channel is a linear measure of the contribution of the pixel to the
1463 * corresponding composited pixel. The gamma encoded color channels must be 1112 * corresponding composited pixel, and the color channels are unassociated
1464 * scaled according to the contribution and to do this it is necessary to undo 1113 * (not premultiplied). The gamma encoded color channels must be scaled
1114 * according to the contribution and to do this it is necessary to undo
1465 * the encoding, scale the color values, perform the composition and reencode 1115 * the encoding, scale the color values, perform the composition and reencode
1466 * the values. This is the 'PNG' mode. 1116 * the values. This is the 'PNG' mode.
1467 * 1117 *
1468 * The alternative is to 'associate' the alpha with the color information by 1118 * The alternative is to 'associate' the alpha with the color information by
1469 * storing color channel values that have been scaled by the alpha. The 1119 * storing color channel values that have been scaled by the alpha.
1470 * advantage is that the color channels can be resampled (the image can be 1120 * image. These are the 'STANDARD', 'ASSOCIATED' or 'PREMULTIPLIED' modes
1471 * scaled) in this form. The disadvantage is that normal practice is to store 1121 * (the latter being the two common names for associated alpha color channels).
1472 * linear, not (gamma) encoded, values and this requires 16-bit channels for
1473 * still images rather than the 8-bit channels that are just about sufficient if
1474 * gamma encoding is used. In addition all non-transparent pixel values,
1475 * including completely opaque ones, must be gamma encoded to produce the final
1476 * image. This is the 'STANDARD', 'ASSOCIATED' or 'PREMULTIPLIED' mode (the
1477 * latter being the two common names for associated alpha color channels.)
1478 * 1122 *
1479 * Since it is not necessary to perform arithmetic on opaque color values so 1123 * For the 'OPTIMIZED' mode, a pixel is treated as opaque only if the alpha
1480 * long as they are not to be resampled and are in the final color space it is 1124 * value is equal to the maximum value.
1481 * possible to optimize the handling of alpha by storing the opaque pixels in
1482 * the PNG format (adjusted for the output color space) while storing partially
1483 * opaque pixels in the standard, linear, format. The accuracy required for
1484 * standard alpha composition is relatively low, because the pixels are
1485 * isolated, therefore typically the accuracy loss in storing 8-bit linear
1486 * values is acceptable. (This is not true if the alpha channel is used to
1487 * simulate transparency over large areas - use 16 bits or the PNG mode in
1488 * this case!) This is the 'OPTIMIZED' mode. For this mode a pixel is
1489 * treated as opaque only if the alpha value is equal to the maximum value.
1490 * 1125 *
1491 * The final choice is to gamma encode the alpha channel as well. This is 1126 * The final choice is to gamma encode the alpha channel as well. This is
1492 * broken because, in practice, no implementation that uses this choice 1127 * broken because, in practice, no implementation that uses this choice
1493 * correctly undoes the encoding before handling alpha composition. Use this 1128 * correctly undoes the encoding before handling alpha composition. Use this
1494 * choice only if other serious errors in the software or hardware you use 1129 * choice only if other serious errors in the software or hardware you use
1495 * mandate it; the typical serious error is for dark halos to appear around 1130 * mandate it; the typical serious error is for dark halos to appear around
1496 * opaque areas of the composited PNG image because of arithmetic overflow. 1131 * opaque areas of the composited PNG image because of arithmetic overflow.
1497 * 1132 *
1498 * The API function png_set_alpha_mode specifies which of these choices to use 1133 * The API function png_set_alpha_mode specifies which of these choices to use
1499 * with an enumerated 'mode' value and the gamma of the required output: 1134 * with an enumerated 'mode' value and the gamma of the required output:
1500 */ 1135 */
1501 #define PNG_ALPHA_PNG 0 /* according to the PNG standard */ 1136 #define PNG_ALPHA_PNG 0 /* according to the PNG standard */
1502 #define PNG_ALPHA_STANDARD 1 /* according to Porter/Duff */ 1137 #define PNG_ALPHA_STANDARD 1 /* according to Porter/Duff */
1503 #define PNG_ALPHA_ASSOCIATED 1 /* as above; this is the normal practice */ 1138 #define PNG_ALPHA_ASSOCIATED 1 /* as above; this is the normal practice */
1504 #define PNG_ALPHA_PREMULTIPLIED 1 /* as above */ 1139 #define PNG_ALPHA_PREMULTIPLIED 1 /* as above */
1505 #define PNG_ALPHA_OPTIMIZED 2 /* 'PNG' for opaque pixels, else 'STANDARD' */ 1140 #define PNG_ALPHA_OPTIMIZED 2 /* 'PNG' for opaque pixels, else 'STANDARD' */
1506 #define PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */ 1141 #define PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */
1507 1142
1508 PNG_FP_EXPORT(227, void, png_set_alpha_mode, (png_structrp png_ptr, int mode, 1143 PNG_FP_EXPORT(227, void, png_set_alpha_mode, (png_structrp png_ptr, int mode,
1509 double output_gamma)) 1144 double output_gamma))
1510 PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structrp png_ptr, 1145 PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structrp png_ptr,
1511 int mode, png_fixed_point output_gamma)) 1146 int mode, png_fixed_point output_gamma))
1512 #endif 1147 #endif
1513 1148
1514 #if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED) 1149 #if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED)
1515 /* The output_gamma value is a screen gamma in libpng terminology: it expresses 1150 /* The output_gamma value is a screen gamma in libpng terminology: it expresses
1516 * how to decode the output values, not how they are encoded. The values used 1151 * how to decode the output values, not how they are encoded.
1517 * correspond to the normal numbers used to describe the overall gamma of a
1518 * computer display system; for example 2.2 for an sRGB conformant system. The
1519 * values are scaled by 100000 in the _fixed version of the API (so 220000 for
1520 * sRGB.)
1521 *
1522 * The inverse of the value is always used to provide a default for the PNG file
1523 * encoding if it has no gAMA chunk and if png_set_gamma() has not been called
1524 * to override the PNG gamma information.
1525 *
1526 * When the ALPHA_OPTIMIZED mode is selected the output gamma is used to encode
1527 * opaque pixels however pixels with lower alpha values are not encoded,
1528 * regardless of the output gamma setting.
1529 *
1530 * When the standard Porter Duff handling is requested with mode 1 the output
1531 * encoding is set to be linear and the output_gamma value is only relevant
1532 * as a default for input data that has no gamma information. The linear output
1533 * encoding will be overridden if png_set_gamma() is called - the results may be
1534 * highly unexpected!
1535 *
1536 * The following numbers are derived from the sRGB standard and the research
1537 * behind it. sRGB is defined to be approximated by a PNG gAMA chunk value of
1538 * 0.45455 (1/2.2) for PNG. The value implicitly includes any viewing
1539 * correction required to take account of any differences in the color
1540 * environment of the original scene and the intended display environment; the
1541 * value expresses how to *decode* the image for display, not how the original
1542 * data was *encoded*.
1543 *
1544 * sRGB provides a peg for the PNG standard by defining a viewing environment.
1545 * sRGB itself, and earlier TV standards, actually use a more complex transform
1546 * (a linear portion then a gamma 2.4 power law) than PNG can express. (PNG is
1547 * limited to simple power laws.) By saying that an image for direct display on
1548 * an sRGB conformant system should be stored with a gAMA chunk value of 45455
1549 * (11.3.3.2 and 11.3.3.5 of the ISO PNG specification) the PNG specification
1550 * makes it possible to derive values for other display systems and
1551 * environments.
1552 *
1553 * The Mac value is deduced from the sRGB based on an assumption that the actual
1554 * extra viewing correction used in early Mac display systems was implemented as
1555 * a power 1.45 lookup table.
1556 *
1557 * Any system where a programmable lookup table is used or where the behavior of
1558 * the final display device characteristics can be changed requires system
1559 * specific code to obtain the current characteristic. However this can be
1560 * difficult and most PNG gamma correction only requires an approximate value.
1561 *
1562 * By default, if png_set_alpha_mode() is not called, libpng assumes that all
1563 * values are unencoded, linear, values and that the output device also has a
1564 * linear characteristic. This is only very rarely correct - it is invariably
1565 * better to call png_set_alpha_mode() with PNG_DEFAULT_sRGB than rely on the
1566 * default if you don't know what the right answer is!
1567 *
1568 * The special value PNG_GAMMA_MAC_18 indicates an older Mac system (pre Mac OS
1569 * 10.6) which used a correction table to implement a somewhat lower gamma on an
1570 * otherwise sRGB system.
1571 *
1572 * Both these values are reserved (not simple gamma values) in order to allow
1573 * more precise correction internally in the future.
1574 *
1575 * NOTE: the following values can be passed to either the fixed or floating
1576 * point APIs, but the floating point API will also accept floating point
1577 * values.
1578 */ 1152 */
1579 #define PNG_DEFAULT_sRGB -1 /* sRGB gamma and color space */ 1153 #define PNG_DEFAULT_sRGB -1 /* sRGB gamma and color space */
1580 #define PNG_GAMMA_MAC_18 -2 /* Old Mac '1.8' gamma and color space */ 1154 #define PNG_GAMMA_MAC_18 -2 /* Old Mac '1.8' gamma and color space */
1581 #define PNG_GAMMA_sRGB 220000 /* Television standards--matches sRGB gamma */ 1155 #define PNG_GAMMA_sRGB 220000 /* Television standards--matches sRGB gamma */
1582 #define PNG_GAMMA_LINEAR PNG_FP_1 /* Linear */ 1156 #define PNG_GAMMA_LINEAR PNG_FP_1 /* Linear */
1583 #endif 1157 #endif
1584 1158
1585 /* The following are examples of calls to png_set_alpha_mode to achieve the 1159 /* The following are examples of calls to png_set_alpha_mode to achieve the
1586 * required overall gamma correction and, where necessary, alpha 1160 * required overall gamma correction and, where necessary, alpha
1587 * premultiplication. 1161 * premultiplication.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) 1240 defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
1667 PNG_EXPORT(37, void, png_set_swap_alpha, (png_structrp png_ptr)); 1241 PNG_EXPORT(37, void, png_set_swap_alpha, (png_structrp png_ptr));
1668 #endif 1242 #endif
1669 1243
1670 #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ 1244 #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
1671 defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) 1245 defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
1672 PNG_EXPORT(38, void, png_set_invert_alpha, (png_structrp png_ptr)); 1246 PNG_EXPORT(38, void, png_set_invert_alpha, (png_structrp png_ptr));
1673 #endif 1247 #endif
1674 1248
1675 #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) 1249 #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
1676 /* Add a filler byte to 8-bit Gray or 24-bit RGB images. */ 1250 /* Add a filler byte to 8-bit or 16-bit Gray or 24-bit or 48-bit RGB images. */
1677 PNG_EXPORT(39, void, png_set_filler, (png_structrp png_ptr, png_uint_32 filler, 1251 PNG_EXPORT(39, void, png_set_filler, (png_structrp png_ptr, png_uint_32 filler,
1678 int flags)); 1252 int flags));
1679 /* The values of the PNG_FILLER_ defines should NOT be changed */ 1253 /* The values of the PNG_FILLER_ defines should NOT be changed */
1680 # define PNG_FILLER_BEFORE 0 1254 # define PNG_FILLER_BEFORE 0
1681 # define PNG_FILLER_AFTER 1 1255 # define PNG_FILLER_AFTER 1
1682 /* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */ 1256 /* Add an alpha byte to 8-bit or 16-bit Gray or 24-bit or 48-bit RGB images. */
1683 PNG_EXPORT(40, void, png_set_add_alpha, (png_structrp png_ptr, 1257 PNG_EXPORT(40, void, png_set_add_alpha, (png_structrp png_ptr,
1684 png_uint_32 filler, int flags)); 1258 png_uint_32 filler, int flags));
1685 #endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */ 1259 #endif /* READ_FILLER || WRITE_FILLER */
1686 1260
1687 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) 1261 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
1688 /* Swap bytes in 16-bit depth files. */ 1262 /* Swap bytes in 16-bit depth files. */
1689 PNG_EXPORT(41, void, png_set_swap, (png_structrp png_ptr)); 1263 PNG_EXPORT(41, void, png_set_swap, (png_structrp png_ptr));
1690 #endif 1264 #endif
1691 1265
1692 #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) 1266 #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
1693 /* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */ 1267 /* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */
1694 PNG_EXPORT(42, void, png_set_packing, (png_structrp png_ptr)); 1268 PNG_EXPORT(42, void, png_set_packing, (png_structrp png_ptr));
1695 #endif 1269 #endif
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 * 1439 *
1866 * value action:critical action:ancillary 1440 * value action:critical action:ancillary
1867 */ 1441 */
1868 #define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */ 1442 #define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */
1869 #define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */ 1443 #define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */
1870 #define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */ 1444 #define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */
1871 #define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */ 1445 #define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */
1872 #define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */ 1446 #define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */
1873 #define PNG_CRC_NO_CHANGE 5 /* use current value use current value */ 1447 #define PNG_CRC_NO_CHANGE 5 /* use current value use current value */
1874 1448
1449 #ifdef PNG_WRITE_SUPPORTED
1875 /* These functions give the user control over the scan-line filtering in 1450 /* These functions give the user control over the scan-line filtering in
1876 * libpng and the compression methods used by zlib. These functions are 1451 * libpng and the compression methods used by zlib. These functions are
1877 * mainly useful for testing, as the defaults should work with most users. 1452 * mainly useful for testing, as the defaults should work with most users.
1878 * Those users who are tight on memory or want faster performance at the 1453 * Those users who are tight on memory or want faster performance at the
1879 * expense of compression can modify them. See the compression library 1454 * expense of compression can modify them. See the compression library
1880 * header file (zlib.h) for an explination of the compression functions. 1455 * header file (zlib.h) for an explination of the compression functions.
1881 */ 1456 */
1882 1457
1883 /* Set the filtering method(s) used by libpng. Currently, the only valid 1458 /* Set the filtering method(s) used by libpng. Currently, the only valid
1884 * value for "method" is 0. 1459 * value for "method" is 0.
1885 */ 1460 */
1886 PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method, 1461 PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method,
1887 int filters)); 1462 int filters));
1463 #endif /* WRITE */
1888 1464
1889 /* Flags for png_set_filter() to say which filters to use. The flags 1465 /* Flags for png_set_filter() to say which filters to use. The flags
1890 * are chosen so that they don't conflict with real filter types 1466 * are chosen so that they don't conflict with real filter types
1891 * below, in case they are supplied instead of the #defined constants. 1467 * below, in case they are supplied instead of the #defined constants.
1892 * These values should NOT be changed. 1468 * These values should NOT be changed.
1893 */ 1469 */
1894 #define PNG_NO_FILTERS 0x00 1470 #define PNG_NO_FILTERS 0x00
1895 #define PNG_FILTER_NONE 0x08 1471 #define PNG_FILTER_NONE 0x08
1896 #define PNG_FILTER_SUB 0x10 1472 #define PNG_FILTER_SUB 0x10
1897 #define PNG_FILTER_UP 0x20 1473 #define PNG_FILTER_UP 0x20
1898 #define PNG_FILTER_AVG 0x40 1474 #define PNG_FILTER_AVG 0x40
1899 #define PNG_FILTER_PAETH 0x80 1475 #define PNG_FILTER_PAETH 0x80
1900 #define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \ 1476 #define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \
1901 PNG_FILTER_AVG | PNG_FILTER_PAETH) 1477 PNG_FILTER_AVG | PNG_FILTER_PAETH)
1902 1478
1903 /* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now. 1479 /* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
1904 * These defines should NOT be changed. 1480 * These defines should NOT be changed.
1905 */ 1481 */
1906 #define PNG_FILTER_VALUE_NONE 0 1482 #define PNG_FILTER_VALUE_NONE 0
1907 #define PNG_FILTER_VALUE_SUB 1 1483 #define PNG_FILTER_VALUE_SUB 1
1908 #define PNG_FILTER_VALUE_UP 2 1484 #define PNG_FILTER_VALUE_UP 2
1909 #define PNG_FILTER_VALUE_AVG 3 1485 #define PNG_FILTER_VALUE_AVG 3
1910 #define PNG_FILTER_VALUE_PAETH 4 1486 #define PNG_FILTER_VALUE_PAETH 4
1911 #define PNG_FILTER_VALUE_LAST 5 1487 #define PNG_FILTER_VALUE_LAST 5
1912 1488
1913 #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* EXPERIMENTAL */ 1489 #ifdef PNG_WRITE_SUPPORTED
1914 /* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_ 1490 #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* DEPRECATED */
1915 * defines, either the default (minimum-sum-of-absolute-differences), or
1916 * the experimental method (weighted-minimum-sum-of-absolute-differences).
1917 *
1918 * Weights are factors >= 1.0, indicating how important it is to keep the
1919 * filter type consistent between rows. Larger numbers mean the current
1920 * filter is that many times as likely to be the same as the "num_weights"
1921 * previous filters. This is cumulative for each previous row with a weight.
1922 * There needs to be "num_weights" values in "filter_weights", or it can be
1923 * NULL if the weights aren't being specified. Weights have no influence on
1924 * the selection of the first row filter. Well chosen weights can (in theory)
1925 * improve the compression for a given image.
1926 *
1927 * Costs are factors >= 1.0 indicating the relative decoding costs of a
1928 * filter type. Higher costs indicate more decoding expense, and are
1929 * therefore less likely to be selected over a filter with lower computational
1930 * costs. There needs to be a value in "filter_costs" for each valid filter
1931 * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't
1932 * setting the costs. Costs try to improve the speed of decompression without
1933 * unduly increasing the compressed image size.
1934 *
1935 * A negative weight or cost indicates the default value is to be used, and
1936 * values in the range [0.0, 1.0) indicate the value is to remain unchanged.
1937 * The default values for both weights and costs are currently 1.0, but may
1938 * change if good general weighting/cost heuristics can be found. If both
1939 * the weights and costs are set to 1.0, this degenerates the WEIGHTED method
1940 * to the UNWEIGHTED method, but with added encoding time/computation.
1941 */
1942 PNG_FP_EXPORT(68, void, png_set_filter_heuristics, (png_structrp png_ptr, 1491 PNG_FP_EXPORT(68, void, png_set_filter_heuristics, (png_structrp png_ptr,
1943 int heuristic_method, int num_weights, png_const_doublep filter_weights, 1492 int heuristic_method, int num_weights, png_const_doublep filter_weights,
1944 png_const_doublep filter_costs)) 1493 png_const_doublep filter_costs))
1945 PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed, 1494 PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed,
1946 (png_structrp png_ptr, int heuristic_method, int num_weights, 1495 (png_structrp png_ptr, int heuristic_method, int num_weights,
1947 png_const_fixed_point_p filter_weights, 1496 png_const_fixed_point_p filter_weights,
1948 png_const_fixed_point_p filter_costs)) 1497 png_const_fixed_point_p filter_costs))
1949 #endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ 1498 #endif /* WRITE_WEIGHTED_FILTER */
1950 1499
1951 /* Heuristic used for row filter selection. These defines should NOT be 1500 /* The following are no longer used and will be removed from libpng-1.7: */
1952 * changed.
1953 */
1954 #define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */ 1501 #define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */
1955 #define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */ 1502 #define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */
1956 #define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */ 1503 #define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */
1957 #define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */ 1504 #define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */
1958 1505
1959 #ifdef PNG_WRITE_SUPPORTED
1960 /* Set the library compression level. Currently, valid values range from 1506 /* Set the library compression level. Currently, valid values range from
1961 * 0 - 9, corresponding directly to the zlib compression levels 0 - 9 1507 * 0 - 9, corresponding directly to the zlib compression levels 0 - 9
1962 * (0 - no compression, 9 - "maximal" compression). Note that tests have 1508 * (0 - no compression, 9 - "maximal" compression). Note that tests have
1963 * shown that zlib compression levels 3-6 usually perform as well as level 9 1509 * shown that zlib compression levels 3-6 usually perform as well as level 9
1964 * for PNG images, and do considerably fewer caclulations. In the future, 1510 * for PNG images, and do considerably fewer caclulations. In the future,
1965 * these values may not correspond directly to the zlib compression levels. 1511 * these values may not correspond directly to the zlib compression levels.
1966 */ 1512 */
1513 #ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
1967 PNG_EXPORT(69, void, png_set_compression_level, (png_structrp png_ptr, 1514 PNG_EXPORT(69, void, png_set_compression_level, (png_structrp png_ptr,
1968 int level)); 1515 int level));
1969 1516
1970 PNG_EXPORT(70, void, png_set_compression_mem_level, (png_structrp png_ptr, 1517 PNG_EXPORT(70, void, png_set_compression_mem_level, (png_structrp png_ptr,
1971 int mem_level)); 1518 int mem_level));
1972 1519
1973 PNG_EXPORT(71, void, png_set_compression_strategy, (png_structrp png_ptr, 1520 PNG_EXPORT(71, void, png_set_compression_strategy, (png_structrp png_ptr,
1974 int strategy)); 1521 int strategy));
1975 1522
1976 /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a 1523 /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a
1977 * smaller value of window_bits if it can do so safely. 1524 * smaller value of window_bits if it can do so safely.
1978 */ 1525 */
1979 PNG_EXPORT(72, void, png_set_compression_window_bits, (png_structrp png_ptr, 1526 PNG_EXPORT(72, void, png_set_compression_window_bits, (png_structrp png_ptr,
1980 int window_bits)); 1527 int window_bits));
1981 1528
1982 PNG_EXPORT(73, void, png_set_compression_method, (png_structrp png_ptr, 1529 PNG_EXPORT(73, void, png_set_compression_method, (png_structrp png_ptr,
1983 int method)); 1530 int method));
1984 #endif 1531 #endif /* WRITE_CUSTOMIZE_COMPRESSION */
1985 1532
1986 #ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED 1533 #ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
1987 /* Also set zlib parameters for compressing non-IDAT chunks */ 1534 /* Also set zlib parameters for compressing non-IDAT chunks */
1988 PNG_EXPORT(222, void, png_set_text_compression_level, (png_structrp png_ptr, 1535 PNG_EXPORT(222, void, png_set_text_compression_level, (png_structrp png_ptr,
1989 int level)); 1536 int level));
1990 1537
1991 PNG_EXPORT(223, void, png_set_text_compression_mem_level, (png_structrp png_ptr, 1538 PNG_EXPORT(223, void, png_set_text_compression_mem_level, (png_structrp png_ptr,
1992 int mem_level)); 1539 int mem_level));
1993 1540
1994 PNG_EXPORT(224, void, png_set_text_compression_strategy, (png_structrp png_ptr, 1541 PNG_EXPORT(224, void, png_set_text_compression_strategy, (png_structrp png_ptr,
1995 int strategy)); 1542 int strategy));
1996 1543
1997 /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a 1544 /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a
1998 * smaller value of window_bits if it can do so safely. 1545 * smaller value of window_bits if it can do so safely.
1999 */ 1546 */
2000 PNG_EXPORT(225, void, png_set_text_compression_window_bits, 1547 PNG_EXPORT(225, void, png_set_text_compression_window_bits,
2001 (png_structrp png_ptr, int window_bits)); 1548 (png_structrp png_ptr, int window_bits));
2002 1549
2003 PNG_EXPORT(226, void, png_set_text_compression_method, (png_structrp png_ptr, 1550 PNG_EXPORT(226, void, png_set_text_compression_method, (png_structrp png_ptr,
2004 int method)); 1551 int method));
2005 #endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED */ 1552 #endif /* WRITE_CUSTOMIZE_ZTXT_COMPRESSION */
1553 #endif /* WRITE */
2006 1554
2007 /* These next functions are called for input/output, memory, and error 1555 /* These next functions are called for input/output, memory, and error
2008 * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c, 1556 * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c,
2009 * and call standard C I/O routines such as fread(), fwrite(), and 1557 * and call standard C I/O routines such as fread(), fwrite(), and
2010 * fprintf(). These functions can be made to use other I/O routines 1558 * fprintf(). These functions can be made to use other I/O routines
2011 * at run time for those applications that need to handle I/O in a 1559 * at run time for those applications that need to handle I/O in a
2012 * different manner by calling png_set_???_fn(). See libpng-manual.txt for 1560 * different manner by calling png_set_???_fn(). See libpng-manual.txt for
2013 * more information. 1561 * more information.
2014 */ 1562 */
2015 1563
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 * PNG_HANDLE_AS_UNKNOWN_SUPPORTED is set then it is possible to set known 1654 * PNG_HANDLE_AS_UNKNOWN_SUPPORTED is set then it is possible to set known
2107 * chunks to be treated as unknown, however in this case the callback must do 1655 * chunks to be treated as unknown, however in this case the callback must do
2108 * any processing required by the chunk (e.g. by calling the appropriate 1656 * any processing required by the chunk (e.g. by calling the appropriate
2109 * png_set_ APIs.) 1657 * png_set_ APIs.)
2110 * 1658 *
2111 * There is no write support - on write, by default, all the chunks in the 1659 * There is no write support - on write, by default, all the chunks in the
2112 * 'unknown' list are written in the specified position. 1660 * 'unknown' list are written in the specified position.
2113 * 1661 *
2114 * The integer return from the callback function is interpreted thus: 1662 * The integer return from the callback function is interpreted thus:
2115 * 1663 *
2116 * negative: An error occured, png_chunk_error will be called. 1664 * negative: An error occurred; png_chunk_error will be called.
2117 * zero: The chunk was not handled, the chunk will be saved. A critical 1665 * zero: The chunk was not handled, the chunk will be saved. A critical
2118 * chunk will cause an error at this point unless it is to be saved. 1666 * chunk will cause an error at this point unless it is to be saved.
2119 * positive: The chunk was handled, libpng will ignore/discard it. 1667 * positive: The chunk was handled, libpng will ignore/discard it.
2120 * 1668 *
2121 * See "INTERACTION WTIH USER CHUNK CALLBACKS" below for important notes about 1669 * See "INTERACTION WTIH USER CHUNK CALLBACKS" below for important notes about
2122 * how this behavior will change in libpng 1.7 1670 * how this behavior will change in libpng 1.7
2123 */ 1671 */
2124 PNG_EXPORT(88, void, png_set_read_user_chunk_fn, (png_structrp png_ptr, 1672 PNG_EXPORT(88, void, png_set_read_user_chunk_fn, (png_structrp png_ptr,
2125 png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)); 1673 png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn));
2126 #endif 1674 #endif
(...skipping 28 matching lines...) Expand all
2155 PNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structrp, int save)); 1703 PNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structrp, int save));
2156 1704
2157 /* A function which may be called *only* outside (after) a call to 1705 /* A function which may be called *only* outside (after) a call to
2158 * png_process_data. It returns the number of bytes of data to skip in the 1706 * png_process_data. It returns the number of bytes of data to skip in the
2159 * input. Normally it will return 0, but if it returns a non-zero value the 1707 * input. Normally it will return 0, but if it returns a non-zero value the
2160 * application must skip than number of bytes of input data and pass the 1708 * application must skip than number of bytes of input data and pass the
2161 * following data to the next call to png_process_data. 1709 * following data to the next call to png_process_data.
2162 */ 1710 */
2163 PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp)); 1711 PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp));
2164 1712
2165 #ifdef PNG_READ_INTERLACING_SUPPORTED
2166 /* Function that combines rows. 'new_row' is a flag that should come from 1713 /* Function that combines rows. 'new_row' is a flag that should come from
2167 * the callback and be non-NULL if anything needs to be done; the library 1714 * the callback and be non-NULL if anything needs to be done; the library
2168 * stores its own version of the new data internally and ignores the passed 1715 * stores its own version of the new data internally and ignores the passed
2169 * in value. 1716 * in value.
2170 */ 1717 */
2171 PNG_EXPORT(93, void, png_progressive_combine_row, (png_const_structrp png_ptr, 1718 PNG_EXPORT(93, void, png_progressive_combine_row, (png_const_structrp png_ptr,
2172 png_bytep old_row, png_const_bytep new_row)); 1719 png_bytep old_row, png_const_bytep new_row));
2173 #endif /* PNG_READ_INTERLACING_SUPPORTED */ 1720 #endif /* PROGRESSIVE_READ */
2174 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
2175 1721
2176 PNG_EXPORTA(94, png_voidp, png_malloc, (png_const_structrp png_ptr, 1722 PNG_EXPORTA(94, png_voidp, png_malloc, (png_const_structrp png_ptr,
2177 png_alloc_size_t size), PNG_ALLOCATED); 1723 png_alloc_size_t size), PNG_ALLOCATED);
2178 /* Added at libpng version 1.4.0 */ 1724 /* Added at libpng version 1.4.0 */
2179 PNG_EXPORTA(95, png_voidp, png_calloc, (png_const_structrp png_ptr, 1725 PNG_EXPORTA(95, png_voidp, png_calloc, (png_const_structrp png_ptr,
2180 png_alloc_size_t size), PNG_ALLOCATED); 1726 png_alloc_size_t size), PNG_ALLOCATED);
2181 1727
2182 /* Added at libpng version 1.2.4 */ 1728 /* Added at libpng version 1.2.4 */
2183 PNG_EXPORTA(96, png_voidp, png_malloc_warn, (png_const_structrp png_ptr, 1729 PNG_EXPORTA(96, png_voidp, png_malloc_warn, (png_const_structrp png_ptr,
2184 png_alloc_size_t size), PNG_ALLOCATED); 1730 png_alloc_size_t size), PNG_ALLOCATED);
2185 1731
2186 /* Frees a pointer allocated by png_malloc() */ 1732 /* Frees a pointer allocated by png_malloc() */
2187 PNG_EXPORT(97, void, png_free, (png_const_structrp png_ptr, png_voidp ptr)); 1733 PNG_EXPORT(97, void, png_free, (png_const_structrp png_ptr, png_voidp ptr));
2188 1734
2189 /* Free data that was allocated internally */ 1735 /* Free data that was allocated internally */
2190 PNG_EXPORT(98, void, png_free_data, (png_const_structrp png_ptr, 1736 PNG_EXPORT(98, void, png_free_data, (png_const_structrp png_ptr,
2191 png_inforp info_ptr, png_uint_32 free_me, int num)); 1737 png_inforp info_ptr, png_uint_32 free_me, int num));
2192 1738
2193 /* Reassign responsibility for freeing existing data, whether allocated 1739 /* Reassign responsibility for freeing existing data, whether allocated
2194 * by libpng or by the application; this works on the png_info structure passed 1740 * by libpng or by the application; this works on the png_info structure passed
2195 * in, it does not change the state for other png_info structures. 1741 * in, it does not change the state for other png_info structures.
2196 * 1742 *
2197 * It is unlikely that this function works correctly as of 1.6.0 and using it 1743 * It is unlikely that this function works correctly as of 1.6.0 and using it
2198 * may result either in memory leaks or double free of allocated data. 1744 * may result either in memory leaks or double free of allocated data.
2199 */ 1745 */
2200 PNG_EXPORTA(99, void, png_data_freer, (png_const_structrp png_ptr, 1746 PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
2201 png_inforp info_ptr, int freer, png_uint_32 mask), PNG_DEPRECATED); 1747 png_inforp info_ptr, int freer, png_uint_32 mask));
2202 1748
2203 /* Assignments for png_data_freer */ 1749 /* Assignments for png_data_freer */
2204 #define PNG_DESTROY_WILL_FREE_DATA 1 1750 #define PNG_DESTROY_WILL_FREE_DATA 1
2205 #define PNG_SET_WILL_FREE_DATA 1 1751 #define PNG_SET_WILL_FREE_DATA 1
2206 #define PNG_USER_WILL_FREE_DATA 2 1752 #define PNG_USER_WILL_FREE_DATA 2
2207 /* Flags for png_ptr->free_me and info_ptr->free_me */ 1753 /* Flags for png_ptr->free_me and info_ptr->free_me */
2208 #define PNG_FREE_HIST 0x0008 1754 #define PNG_FREE_HIST 0x0008
2209 #define PNG_FREE_ICCP 0x0010 1755 #define PNG_FREE_ICCP 0x0010
2210 #define PNG_FREE_SPLT 0x0020 1756 #define PNG_FREE_SPLT 0x0020
2211 #define PNG_FREE_ROWS 0x0040 1757 #define PNG_FREE_ROWS 0x0040
(...skipping 21 matching lines...) Expand all
2233 PNG_EXPORTA(102, void, png_error, (png_const_structrp png_ptr, 1779 PNG_EXPORTA(102, void, png_error, (png_const_structrp png_ptr,
2234 png_const_charp error_message), PNG_NORETURN); 1780 png_const_charp error_message), PNG_NORETURN);
2235 1781
2236 /* The same, but the chunk name is prepended to the error string. */ 1782 /* The same, but the chunk name is prepended to the error string. */
2237 PNG_EXPORTA(103, void, png_chunk_error, (png_const_structrp png_ptr, 1783 PNG_EXPORTA(103, void, png_chunk_error, (png_const_structrp png_ptr,
2238 png_const_charp error_message), PNG_NORETURN); 1784 png_const_charp error_message), PNG_NORETURN);
2239 1785
2240 #else 1786 #else
2241 /* Fatal error in PNG image of libpng - can't continue */ 1787 /* Fatal error in PNG image of libpng - can't continue */
2242 PNG_EXPORTA(104, void, png_err, (png_const_structrp png_ptr), PNG_NORETURN); 1788 PNG_EXPORTA(104, void, png_err, (png_const_structrp png_ptr), PNG_NORETURN);
1789 # define png_error(s1,s2) png_err(s1)
1790 # define png_chunk_error(s1,s2) png_err(s1)
2243 #endif 1791 #endif
2244 1792
2245 #ifdef PNG_WARNINGS_SUPPORTED 1793 #ifdef PNG_WARNINGS_SUPPORTED
2246 /* Non-fatal error in libpng. Can continue, but may have a problem. */ 1794 /* Non-fatal error in libpng. Can continue, but may have a problem. */
2247 PNG_EXPORT(105, void, png_warning, (png_const_structrp png_ptr, 1795 PNG_EXPORT(105, void, png_warning, (png_const_structrp png_ptr,
2248 png_const_charp warning_message)); 1796 png_const_charp warning_message));
2249 1797
2250 /* Non-fatal error in libpng, chunk name is prepended to message. */ 1798 /* Non-fatal error in libpng, chunk name is prepended to message. */
2251 PNG_EXPORT(106, void, png_chunk_warning, (png_const_structrp png_ptr, 1799 PNG_EXPORT(106, void, png_chunk_warning, (png_const_structrp png_ptr,
2252 png_const_charp warning_message)); 1800 png_const_charp warning_message));
1801 #else
1802 # define png_warning(s1,s2) ((void)(s1))
1803 # define png_chunk_warning(s1,s2) ((void)(s1))
2253 #endif 1804 #endif
2254 1805
2255 #ifdef PNG_BENIGN_ERRORS_SUPPORTED 1806 #ifdef PNG_BENIGN_ERRORS_SUPPORTED
2256 /* Benign error in libpng. Can continue, but may have a problem. 1807 /* Benign error in libpng. Can continue, but may have a problem.
2257 * User can choose whether to handle as a fatal error or as a warning. */ 1808 * User can choose whether to handle as a fatal error or as a warning. */
2258 PNG_EXPORT(107, void, png_benign_error, (png_const_structrp png_ptr, 1809 PNG_EXPORT(107, void, png_benign_error, (png_const_structrp png_ptr,
2259 png_const_charp warning_message)); 1810 png_const_charp warning_message));
2260 1811
2261 #ifdef PNG_READ_SUPPORTED 1812 #ifdef PNG_READ_SUPPORTED
2262 /* Same, chunk name is prepended to message (only during read) */ 1813 /* Same, chunk name is prepended to message (only during read) */
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
2360 /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ 1911 /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */
2361 PNG_EXPORT(126, png_int_32, png_get_x_offset_pixels, 1912 PNG_EXPORT(126, png_int_32, png_get_x_offset_pixels,
2362 (png_const_structrp png_ptr, png_const_inforp info_ptr)); 1913 (png_const_structrp png_ptr, png_const_inforp info_ptr));
2363 PNG_EXPORT(127, png_int_32, png_get_y_offset_pixels, 1914 PNG_EXPORT(127, png_int_32, png_get_y_offset_pixels,
2364 (png_const_structrp png_ptr, png_const_inforp info_ptr)); 1915 (png_const_structrp png_ptr, png_const_inforp info_ptr));
2365 PNG_EXPORT(128, png_int_32, png_get_x_offset_microns, 1916 PNG_EXPORT(128, png_int_32, png_get_x_offset_microns,
2366 (png_const_structrp png_ptr, png_const_inforp info_ptr)); 1917 (png_const_structrp png_ptr, png_const_inforp info_ptr));
2367 PNG_EXPORT(129, png_int_32, png_get_y_offset_microns, 1918 PNG_EXPORT(129, png_int_32, png_get_y_offset_microns,
2368 (png_const_structrp png_ptr, png_const_inforp info_ptr)); 1919 (png_const_structrp png_ptr, png_const_inforp info_ptr));
2369 1920
2370 #endif /* PNG_EASY_ACCESS_SUPPORTED */ 1921 #endif /* EASY_ACCESS */
2371 1922
2372 #ifdef PNG_READ_SUPPORTED 1923 #ifdef PNG_READ_SUPPORTED
2373 /* Returns pointer to signature string read from PNG header */ 1924 /* Returns pointer to signature string read from PNG header */
2374 PNG_EXPORT(130, png_const_bytep, png_get_signature, (png_const_structrp png_ptr, 1925 PNG_EXPORT(130, png_const_bytep, png_get_signature, (png_const_structrp png_ptr,
2375 png_const_inforp info_ptr)); 1926 png_const_inforp info_ptr));
2376 #endif 1927 #endif
2377 1928
2378 #ifdef PNG_bKGD_SUPPORTED 1929 #ifdef PNG_bKGD_SUPPORTED
2379 PNG_EXPORT(131, png_uint_32, png_get_bKGD, (png_const_structrp png_ptr, 1930 PNG_EXPORT(131, png_uint_32, png_get_bKGD, (png_const_structrp png_ptr,
2380 png_inforp info_ptr, png_color_16p *background)); 1931 png_inforp info_ptr, png_color_16p *background));
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
2612 png_charpp swidth, png_charpp sheight)); 2163 png_charpp swidth, png_charpp sheight));
2613 2164
2614 PNG_FP_EXPORT(170, void, png_set_sCAL, (png_const_structrp png_ptr, 2165 PNG_FP_EXPORT(170, void, png_set_sCAL, (png_const_structrp png_ptr,
2615 png_inforp info_ptr, int unit, double width, double height)) 2166 png_inforp info_ptr, int unit, double width, double height))
2616 PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, (png_const_structrp png_ptr, 2167 PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, (png_const_structrp png_ptr,
2617 png_inforp info_ptr, int unit, png_fixed_point width, 2168 png_inforp info_ptr, int unit, png_fixed_point width,
2618 png_fixed_point height)) 2169 png_fixed_point height))
2619 PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr, 2170 PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr,
2620 png_inforp info_ptr, int unit, 2171 png_inforp info_ptr, int unit,
2621 png_const_charp swidth, png_const_charp sheight)); 2172 png_const_charp swidth, png_const_charp sheight));
2622 #endif /* PNG_sCAL_SUPPORTED */ 2173 #endif /* sCAL */
2623 2174
2624 #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED 2175 #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
2625 /* Provide the default handling for all unknown chunks or, optionally, for 2176 /* Provide the default handling for all unknown chunks or, optionally, for
2626 * specific unknown chunks. 2177 * specific unknown chunks.
2627 * 2178 *
2628 * NOTE: prior to 1.6.0 the handling specified for particular chunks on read was 2179 * NOTE: prior to 1.6.0 the handling specified for particular chunks on read was
2629 * ignored and the default was used, the per-chunk setting only had an effect on 2180 * ignored and the default was used, the per-chunk setting only had an effect on
2630 * write. If you wish to have chunk-specific handling on read in code that must 2181 * write. If you wish to have chunk-specific handling on read in code that must
2631 * work on earlier versions you must use a user chunk callback to specify the 2182 * work on earlier versions you must use a user chunk callback to specify the
2632 * desired handling (keep or discard.) 2183 * desired handling (keep or discard.)
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
2753 2304
2754 /* Png_free_data() will turn off the "valid" flag for anything it frees. 2305 /* Png_free_data() will turn off the "valid" flag for anything it frees.
2755 * If you need to turn it off for a chunk that your application has freed, 2306 * If you need to turn it off for a chunk that your application has freed,
2756 * you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); 2307 * you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK);
2757 */ 2308 */
2758 PNG_EXPORT(177, void, png_set_invalid, (png_const_structrp png_ptr, 2309 PNG_EXPORT(177, void, png_set_invalid, (png_const_structrp png_ptr,
2759 png_inforp info_ptr, int mask)); 2310 png_inforp info_ptr, int mask));
2760 2311
2761 #ifdef PNG_INFO_IMAGE_SUPPORTED 2312 #ifdef PNG_INFO_IMAGE_SUPPORTED
2762 /* The "params" pointer is currently not used and is for future expansion. */ 2313 /* The "params" pointer is currently not used and is for future expansion. */
2314 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
2763 PNG_EXPORT(178, void, png_read_png, (png_structrp png_ptr, png_inforp info_ptr, 2315 PNG_EXPORT(178, void, png_read_png, (png_structrp png_ptr, png_inforp info_ptr,
2764 int transforms, png_voidp params)); 2316 int transforms, png_voidp params));
2317 #endif
2318 #ifdef PNG_WRITE_SUPPORTED
2765 PNG_EXPORT(179, void, png_write_png, (png_structrp png_ptr, png_inforp info_ptr, 2319 PNG_EXPORT(179, void, png_write_png, (png_structrp png_ptr, png_inforp info_ptr,
2766 int transforms, png_voidp params)); 2320 int transforms, png_voidp params));
2767 #endif 2321 #endif
2322 #endif
2768 2323
2769 PNG_EXPORT(180, png_const_charp, png_get_copyright, 2324 PNG_EXPORT(180, png_const_charp, png_get_copyright,
2770 (png_const_structrp png_ptr)); 2325 (png_const_structrp png_ptr));
2771 PNG_EXPORT(181, png_const_charp, png_get_header_ver, 2326 PNG_EXPORT(181, png_const_charp, png_get_header_ver,
2772 (png_const_structrp png_ptr)); 2327 (png_const_structrp png_ptr));
2773 PNG_EXPORT(182, png_const_charp, png_get_header_version, 2328 PNG_EXPORT(182, png_const_charp, png_get_header_version,
2774 (png_const_structrp png_ptr)); 2329 (png_const_structrp png_ptr));
2775 PNG_EXPORT(183, png_const_charp, png_get_libpng_ver, 2330 PNG_EXPORT(183, png_const_charp, png_get_libpng_ver,
2776 (png_const_structrp png_ptr)); 2331 (png_const_structrp png_ptr));
2777 2332
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2836 png_const_inforp info_ptr)) 2391 png_const_inforp info_ptr))
2837 #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ 2392 #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */
2838 PNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed, 2393 PNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed,
2839 (png_const_structrp png_ptr, png_const_inforp info_ptr)) 2394 (png_const_structrp png_ptr, png_const_inforp info_ptr))
2840 #endif 2395 #endif
2841 2396
2842 # ifdef PNG_pHYs_SUPPORTED 2397 # ifdef PNG_pHYs_SUPPORTED
2843 PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_const_structrp png_ptr, 2398 PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_const_structrp png_ptr,
2844 png_const_inforp info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, 2399 png_const_inforp info_ptr, png_uint_32 *res_x, png_uint_32 *res_y,
2845 int *unit_type)); 2400 int *unit_type));
2846 # endif /* PNG_pHYs_SUPPORTED */ 2401 # endif /* pHYs */
2847 #endif /* PNG_INCH_CONVERSIONS_SUPPORTED */ 2402 #endif /* INCH_CONVERSIONS */
2848 2403
2849 /* Added in libpng-1.4.0 */ 2404 /* Added in libpng-1.4.0 */
2850 #ifdef PNG_IO_STATE_SUPPORTED 2405 #ifdef PNG_IO_STATE_SUPPORTED
2851 PNG_EXPORT(199, png_uint_32, png_get_io_state, (png_const_structrp png_ptr)); 2406 PNG_EXPORT(199, png_uint_32, png_get_io_state, (png_const_structrp png_ptr));
2852 2407
2853 /* Removed from libpng 1.6; use png_get_io_chunk_type. */ 2408 /* Removed from libpng 1.6; use png_get_io_chunk_type. */
2854 PNG_REMOVED(200, png_const_bytep, png_get_io_chunk_name, (png_structrp png_ptr), 2409 PNG_REMOVED(200, png_const_bytep, png_get_io_chunk_name, (png_structrp png_ptr),
2855 PNG_DEPRECATED) 2410 PNG_DEPRECATED)
2856 2411
2857 PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type, 2412 PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type,
2858 (png_const_structrp png_ptr)); 2413 (png_const_structrp png_ptr));
2859 2414
2860 /* The flags returned by png_get_io_state() are the following: */ 2415 /* The flags returned by png_get_io_state() are the following: */
2861 # define PNG_IO_NONE 0x0000 /* no I/O at this moment */ 2416 # define PNG_IO_NONE 0x0000 /* no I/O at this moment */
2862 # define PNG_IO_READING 0x0001 /* currently reading */ 2417 # define PNG_IO_READING 0x0001 /* currently reading */
2863 # define PNG_IO_WRITING 0x0002 /* currently writing */ 2418 # define PNG_IO_WRITING 0x0002 /* currently writing */
2864 # define PNG_IO_SIGNATURE 0x0010 /* currently at the file signature */ 2419 # define PNG_IO_SIGNATURE 0x0010 /* currently at the file signature */
2865 # define PNG_IO_CHUNK_HDR 0x0020 /* currently at the chunk header */ 2420 # define PNG_IO_CHUNK_HDR 0x0020 /* currently at the chunk header */
2866 # define PNG_IO_CHUNK_DATA 0x0040 /* currently at the chunk data */ 2421 # define PNG_IO_CHUNK_DATA 0x0040 /* currently at the chunk data */
2867 # define PNG_IO_CHUNK_CRC 0x0080 /* currently at the chunk crc */ 2422 # define PNG_IO_CHUNK_CRC 0x0080 /* currently at the chunk crc */
2868 # define PNG_IO_MASK_OP 0x000f /* current operation: reading/writing */ 2423 # define PNG_IO_MASK_OP 0x000f /* current operation: reading/writing */
2869 # define PNG_IO_MASK_LOC 0x00f0 /* current location: sig/hdr/data/crc */ 2424 # define PNG_IO_MASK_LOC 0x00f0 /* current location: sig/hdr/data/crc */
2870 #endif /* ?PNG_IO_STATE_SUPPORTED */ 2425 #endif /* IO_STATE */
2871 2426
2872 /* Interlace support. The following macros are always defined so that if 2427 /* Interlace support. The following macros are always defined so that if
2873 * libpng interlace handling is turned off the macros may be used to handle 2428 * libpng interlace handling is turned off the macros may be used to handle
2874 * interlaced images within the application. 2429 * interlaced images within the application.
2875 */ 2430 */
2876 #define PNG_INTERLACE_ADAM7_PASSES 7 2431 #define PNG_INTERLACE_ADAM7_PASSES 7
2877 2432
2878 /* Two macros to return the first row and first column of the original, 2433 /* Two macros to return the first row and first column of the original,
2879 * full, image which appears in a given pass. 'pass' is in the range 0 2434 * full, image which appears in a given pass. 'pass' is in the range 0
2880 * to 6 and the result is in the range 0 to 7. 2435 * to 6 and the result is in the range 0 to 7.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2944 * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ] 2499 * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ]
2945 */ 2500 */
2946 2501
2947 /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */ 2502 /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */
2948 2503
2949 # define png_composite(composite, fg, alpha, bg) \ 2504 # define png_composite(composite, fg, alpha, bg) \
2950 { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \ 2505 { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \
2951 * (png_uint_16)(alpha) \ 2506 * (png_uint_16)(alpha) \
2952 + (png_uint_16)(bg)*(png_uint_16)(255 \ 2507 + (png_uint_16)(bg)*(png_uint_16)(255 \
2953 - (png_uint_16)(alpha)) + 128); \ 2508 - (png_uint_16)(alpha)) + 128); \
2954 (composite) = (png_byte)((temp + (temp >> 8)) >> 8); } 2509 (composite) = (png_byte)(((temp + (temp >> 8)) >> 8) & 0xff); }
2955 2510
2956 # define png_composite_16(composite, fg, alpha, bg) \ 2511 # define png_composite_16(composite, fg, alpha, bg) \
2957 { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \ 2512 { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \
2958 * (png_uint_32)(alpha) \ 2513 * (png_uint_32)(alpha) \
2959 + (png_uint_32)(bg)*(65535 \ 2514 + (png_uint_32)(bg)*(65535 \
2960 - (png_uint_32)(alpha)) + 32768); \ 2515 - (png_uint_32)(alpha)) + 32768); \
2961 (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); } 2516 (composite) = (png_uint_16)(0xffff & ((temp + (temp >> 16)) >> 16)); }
2962 2517
2963 #else /* Standard method using integer division */ 2518 #else /* Standard method using integer division */
2964 2519
2965 # define png_composite(composite, fg, alpha, bg) \ 2520 # define png_composite(composite, fg, alpha, bg) \
2966 (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \ 2521 (composite) = \
2967 (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \ 2522 (png_byte)(0xff & (((png_uint_16)(fg) * (png_uint_16)(alpha) + \
2968 127) / 255) 2523 (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
2524 127) / 255))
2969 2525
2970 # define png_composite_16(composite, fg, alpha, bg) \ 2526 # define png_composite_16(composite, fg, alpha, bg) \
2971 (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \ 2527 (composite) = \
2972 (png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) + \ 2528 (png_uint_16)(0xffff & (((png_uint_32)(fg) * (png_uint_32)(alpha) + \
2973 32767) / 65535) 2529 (png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) + \
2974 #endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */ 2530 32767) / 65535))
2531 #endif /* READ_COMPOSITE_NODIV */
2975 2532
2976 #ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED 2533 #ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED
2977 PNG_EXPORT(201, png_uint_32, png_get_uint_32, (png_const_bytep buf)); 2534 PNG_EXPORT(201, png_uint_32, png_get_uint_32, (png_const_bytep buf));
2978 PNG_EXPORT(202, png_uint_16, png_get_uint_16, (png_const_bytep buf)); 2535 PNG_EXPORT(202, png_uint_16, png_get_uint_16, (png_const_bytep buf));
2979 PNG_EXPORT(203, png_int_32, png_get_int_32, (png_const_bytep buf)); 2536 PNG_EXPORT(203, png_int_32, png_get_int_32, (png_const_bytep buf));
2980 #endif 2537 #endif
2981 2538
2982 PNG_EXPORT(204, png_uint_32, png_get_uint_31, (png_const_structrp png_ptr, 2539 PNG_EXPORT(204, png_uint_32, png_get_uint_31, (png_const_structrp png_ptr,
2983 png_const_bytep buf)); 2540 png_const_bytep buf));
2984 /* No png_get_int_16 -- may be added if there's a real need for it. */ 2541 /* No png_get_int_16 -- may be added if there's a real need for it. */
(...skipping 29 matching lines...) Expand all
3014 /* From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the 2571 /* From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
3015 * function) incorrectly returned a value of type png_uint_32. 2572 * function) incorrectly returned a value of type png_uint_32.
3016 */ 2573 */
3017 # define PNG_get_uint_16(buf) \ 2574 # define PNG_get_uint_16(buf) \
3018 ((png_uint_16) \ 2575 ((png_uint_16) \
3019 (((unsigned int)(*(buf)) << 8) + \ 2576 (((unsigned int)(*(buf)) << 8) + \
3020 ((unsigned int)(*((buf) + 1))))) 2577 ((unsigned int)(*((buf) + 1)))))
3021 2578
3022 # define PNG_get_int_32(buf) \ 2579 # define PNG_get_int_32(buf) \
3023 ((png_int_32)((*(buf) & 0x80) \ 2580 ((png_int_32)((*(buf) & 0x80) \
3024 ? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffffL) + 1)) \ 2581 ? -((png_int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \
3025 : (png_int_32)png_get_uint_32(buf))) 2582 : (png_int_32)png_get_uint_32(buf)))
3026 2583
3027 /* If PNG_PREFIX is defined the same thing as below happens in pnglibconf.h, 2584 /* If PNG_PREFIX is defined the same thing as below happens in pnglibconf.h,
3028 * but defining a macro name prefixed with PNG_PREFIX. 2585 * but defining a macro name prefixed with PNG_PREFIX.
3029 */ 2586 */
3030 # ifndef PNG_PREFIX 2587 # ifndef PNG_PREFIX
3031 # define png_get_uint_32(buf) PNG_get_uint_32(buf) 2588 # define png_get_uint_32(buf) PNG_get_uint_32(buf)
3032 # define png_get_uint_16(buf) PNG_get_uint_16(buf) 2589 # define png_get_uint_16(buf) PNG_get_uint_16(buf)
3033 # define png_get_int_32(buf) PNG_get_int_32(buf) 2590 # define png_get_int_32(buf) PNG_get_int_32(buf)
3034 # endif 2591 # endif
3035 #else 2592 #else
3036 # ifdef PNG_PREFIX 2593 # ifdef PNG_PREFIX
3037 /* No macros; revert to the (redefined) function */ 2594 /* No macros; revert to the (redefined) function */
3038 # define PNG_get_uint_32 (png_get_uint_32) 2595 # define PNG_get_uint_32 (png_get_uint_32)
3039 # define PNG_get_uint_16 (png_get_uint_16) 2596 # define PNG_get_uint_16 (png_get_uint_16)
3040 # define PNG_get_int_32 (png_get_int_32) 2597 # define PNG_get_int_32 (png_get_int_32)
3041 # endif 2598 # endif
3042 #endif 2599 #endif
3043 2600
2601 #ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
2602 PNG_EXPORT(242, void, png_set_check_for_invalid_index,
2603 (png_structrp png_ptr, int allowed));
2604 # ifdef PNG_GET_PALETTE_MAX_SUPPORTED
2605 PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
2606 png_const_infop info_ptr));
2607 # endif
2608 #endif /* CHECK_FOR_INVALID_INDEX */
2609
3044 /******************************************************************************* 2610 /*******************************************************************************
3045 * SIMPLIFIED API 2611 * Section 5: SIMPLIFIED API
3046 ******************************************************************************* 2612 *******************************************************************************
3047 * 2613 *
3048 * Please read the documentation in libpng-manual.txt (TODO: write said 2614 * Please read the documentation in libpng-manual.txt (TODO: write said
3049 * documentation) if you don't understand what follows. 2615 * documentation) if you don't understand what follows.
3050 * 2616 *
3051 * The simplified API hides the details of both libpng and the PNG file format 2617 * The simplified API hides the details of both libpng and the PNG file format
3052 * itself. It allows PNG files to be read into a very limited number of 2618 * itself. It allows PNG files to be read into a very limited number of
3053 * in-memory bitmap formats or to be written from the same formats. If these 2619 * in-memory bitmap formats or to be written from the same formats. If these
3054 * formats do not accomodate your needs then you can, and should, use the more 2620 * formats do not accomodate your needs then you can, and should, use the more
3055 * sophisticated APIs above - these support a wide variety of in-memory formats 2621 * sophisticated APIs above - these support a wide variety of in-memory formats
3056 * and a wide variety of sophisticated transformations to those formats as well 2622 * and a wide variety of sophisticated transformations to those formats as well
3057 * as a wide variety of APIs to manipulate ancillary information. 2623 * as a wide variety of APIs to manipulate ancillary information.
3058 * 2624 *
3059 * To read a PNG file using the simplified API: 2625 * To read a PNG file using the simplified API:
3060 * 2626 *
3061 * 1) Declare a 'png_image' structure (see below) on the stack and set the 2627 * 1) Declare a 'png_image' structure (see below) on the stack, set the
3062 * version field to PNG_IMAGE_VERSION. 2628 * version field to PNG_IMAGE_VERSION and the 'opaque' pointer to NULL
2629 * (this is REQUIRED, your program may crash if you don't do it.)
3063 * 2) Call the appropriate png_image_begin_read... function. 2630 * 2) Call the appropriate png_image_begin_read... function.
3064 * 3) Set the png_image 'format' member to the required sample format. 2631 * 3) Set the png_image 'format' member to the required sample format.
3065 * 4) Allocate a buffer for the image and, if required, the color-map. 2632 * 4) Allocate a buffer for the image and, if required, the color-map.
3066 * 5) Call png_image_finish_read to read the image and, if required, the 2633 * 5) Call png_image_finish_read to read the image and, if required, the
3067 * color-map into your buffers. 2634 * color-map into your buffers.
3068 * 2635 *
3069 * There are no restrictions on the format of the PNG input itself; all valid 2636 * There are no restrictions on the format of the PNG input itself; all valid
3070 * color types, bit depths, and interlace methods are acceptable, and the 2637 * color types, bit depths, and interlace methods are acceptable, and the
3071 * input image is transformed as necessary to the requested in-memory format 2638 * input image is transformed as necessary to the requested in-memory format
3072 * during the png_image_finish_read() step. The only caveat is that if you 2639 * during the png_image_finish_read() step. The only caveat is that if you
3073 * request a color-mapped image from a PNG that is full-color or makes 2640 * request a color-mapped image from a PNG that is full-color or makes
3074 * complex use of an alpha channel the transformation is extremely lossy and the 2641 * complex use of an alpha channel the transformation is extremely lossy and the
3075 * result may look terrible. 2642 * result may look terrible.
3076 * 2643 *
3077 * To write a PNG file using the simplified API: 2644 * To write a PNG file using the simplified API:
3078 * 2645 *
3079 * 1) Declare a 'png_image' structure on the stack and memset() it to all zero. 2646 * 1) Declare a 'png_image' structure on the stack and memset() it to all zero.
3080 * 2) Initialize the members of the structure that describe the image, setting 2647 * 2) Initialize the members of the structure that describe the image, setting
3081 * the 'format' member to the format of the image samples. 2648 * the 'format' member to the format of the image samples.
3082 * 3) Call the appropriate png_image_write... function with a pointer to the 2649 * 3) Call the appropriate png_image_write... function with a pointer to the
3083 * image and, if necessary, the color-map to write the PNG data. 2650 * image and, if necessary, the color-map to write the PNG data.
3084 * 2651 *
3085 * png_image is a structure that describes the in-memory format of an image 2652 * png_image is a structure that describes the in-memory format of an image
3086 * when it is being read or defines the in-memory format of an image that you 2653 * when it is being read or defines the in-memory format of an image that you
3087 * need to write: 2654 * need to write:
3088 */ 2655 */
2656 #if defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \
2657 defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
2658
3089 #define PNG_IMAGE_VERSION 1 2659 #define PNG_IMAGE_VERSION 1
3090 2660
3091 typedef struct png_control *png_controlp; 2661 typedef struct png_control *png_controlp;
3092 typedef struct 2662 typedef struct
3093 { 2663 {
3094 png_controlp opaque; /* Initialize to NULL, free with png_image_free */ 2664 png_controlp opaque; /* Initialize to NULL, free with png_image_free */
3095 png_uint_32 version; /* Set to PNG_IMAGE_VERSION */ 2665 png_uint_32 version; /* Set to PNG_IMAGE_VERSION */
3096 png_uint_32 width; /* Image width in pixels (columns) */ 2666 png_uint_32 width; /* Image width in pixels (columns) */
3097 png_uint_32 height; /* Image height in pixels (rows) */ 2667 png_uint_32 height; /* Image height in pixels (rows) */
3098 png_uint_32 format; /* Image format as defined below */ 2668 png_uint_32 format; /* Image format as defined below */
3099 png_uint_32 flags; /* A bit mask containing informational flags */ 2669 png_uint_32 flags; /* A bit mask containing informational flags */
3100 png_uint_32 colormap_entries; 2670 png_uint_32 colormap_entries;
3101 /* Number of entries in the color-map */ 2671 /* Number of entries in the color-map */
3102 2672
3103 /* In the event of an error or warning the following field will be set to a 2673 /* In the event of an error or warning the following field will be set to a
3104 * non-zero value and the 'message' field will contain a '\0' terminated 2674 * non-zero value and the 'message' field will contain a '\0' terminated
3105 * string with the libpng error or warning message. If both warnings and 2675 * string with the libpng error or warning message. If both warnings and
3106 * an error were encountered, only the error is recorded. If there 2676 * an error were encountered, only the error is recorded. If there
3107 * are multiple warnings, only the first one is recorded. 2677 * are multiple warnings, only the first one is recorded.
3108 * 2678 *
3109 * The upper 30 bits of this value are reserved, the low two bits contain 2679 * The upper 30 bits of this value are reserved, the low two bits contain
3110 * a value as follows: 2680 * a value as follows:
3111 */ 2681 */
3112 # define PNG_IMAGE_WARNING 1 2682 # define PNG_IMAGE_WARNING 1
3113 # define PNG_IMAGE_ERROR 2 2683 # define PNG_IMAGE_ERROR 2
3114 /* 2684 /*
3115 * The result is a two bit code such that a value more than 1 indicates 2685 * The result is a two-bit code such that a value more than 1 indicates
3116 * a failure in the API just called: 2686 * a failure in the API just called:
3117 * 2687 *
3118 * 0 - no warning or error 2688 * 0 - no warning or error
3119 * 1 - warning 2689 * 1 - warning
3120 * 2 - error 2690 * 2 - error
3121 * 3 - error preceded by warning 2691 * 3 - error preceded by warning
3122 */ 2692 */
3123 # define PNG_IMAGE_FAILED(png_cntrl) ((((png_cntrl).warning_or_error)&0x03)>1) 2693 # define PNG_IMAGE_FAILED(png_cntrl) ((((png_cntrl).warning_or_error)&0x03)>1)
3124 2694
3125 png_uint_32 warning_or_error; 2695 png_uint_32 warning_or_error;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
3178 * valid. Formats can be built up from the flag values or you can use one of 2748 * valid. Formats can be built up from the flag values or you can use one of
3179 * the predefined values below. When testing formats always use the FORMAT_FLAG 2749 * the predefined values below. When testing formats always use the FORMAT_FLAG
3180 * macros to test for individual features - future versions of the library may 2750 * macros to test for individual features - future versions of the library may
3181 * add new flags. 2751 * add new flags.
3182 * 2752 *
3183 * When reading or writing color-mapped images the format should be set to the 2753 * When reading or writing color-mapped images the format should be set to the
3184 * format of the entries in the color-map then png_image_{read,write}_colormap 2754 * format of the entries in the color-map then png_image_{read,write}_colormap
3185 * called to read or write the color-map and set the format correctly for the 2755 * called to read or write the color-map and set the format correctly for the
3186 * image data. Do not set the PNG_FORMAT_FLAG_COLORMAP bit directly! 2756 * image data. Do not set the PNG_FORMAT_FLAG_COLORMAP bit directly!
3187 * 2757 *
3188 * NOTE: libpng can be built with particular features disabled, if you see 2758 * NOTE: libpng can be built with particular features disabled. If you see
3189 * compiler errors because the definition of one of the following flags has been 2759 * compiler errors because the definition of one of the following flags has been
3190 * compiled out it is because libpng does not have the required support. It is 2760 * compiled out it is because libpng does not have the required support. It is
3191 * possible, however, for the libpng configuration to enable the format on just 2761 * possible, however, for the libpng configuration to enable the format on just
3192 * read or just write; in that case you may see an error at run time. You can 2762 * read or just write; in that case you may see an error at run time. You can
3193 * guard against this by checking for the definition of the appropriate 2763 * guard against this by checking for the definition of the appropriate
3194 * "_SUPPORTED" macro, one of: 2764 * "_SUPPORTED" macro, one of:
3195 * 2765 *
3196 * PNG_SIMPLIFIED_{READ,WRITE}_{BGR,AFIRST}_SUPPORTED 2766 * PNG_SIMPLIFIED_{READ,WRITE}_{BGR,AFIRST}_SUPPORTED
3197 */ 2767 */
3198 #define PNG_FORMAT_FLAG_ALPHA 0x01U /* format with an alpha channel */ 2768 #define PNG_FORMAT_FLAG_ALPHA 0x01U /* format with an alpha channel */
3199 #define PNG_FORMAT_FLAG_COLOR 0x02U /* color format: otherwise grayscale */ 2769 #define PNG_FORMAT_FLAG_COLOR 0x02U /* color format: otherwise grayscale */
3200 #define PNG_FORMAT_FLAG_LINEAR 0x04U /* 2 byte channels else 1 byte */ 2770 #define PNG_FORMAT_FLAG_LINEAR 0x04U /* 2-byte channels else 1-byte */
3201 #define PNG_FORMAT_FLAG_COLORMAP 0x08U /* image data is color-mapped */ 2771 #define PNG_FORMAT_FLAG_COLORMAP 0x08U /* image data is color-mapped */
3202 2772
3203 #ifdef PNG_FORMAT_BGR_SUPPORTED 2773 #ifdef PNG_FORMAT_BGR_SUPPORTED
3204 # define PNG_FORMAT_FLAG_BGR 0x10U /* BGR colors, else order is RGB */ 2774 # define PNG_FORMAT_FLAG_BGR 0x10U /* BGR colors, else order is RGB */
3205 #endif 2775 #endif
3206 2776
3207 #ifdef PNG_FORMAT_AFIRST_SUPPORTED 2777 #ifdef PNG_FORMAT_AFIRST_SUPPORTED
3208 # define PNG_FORMAT_FLAG_AFIRST 0x20U /* alpha channel comes first */ 2778 # define PNG_FORMAT_FLAG_AFIRST 0x20U /* alpha channel comes first */
3209 #endif 2779 #endif
3210 2780
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
3390 #ifdef PNG_STDIO_SUPPORTED 2960 #ifdef PNG_STDIO_SUPPORTED
3391 PNG_EXPORT(234, int, png_image_begin_read_from_file, (png_imagep image, 2961 PNG_EXPORT(234, int, png_image_begin_read_from_file, (png_imagep image,
3392 const char *file_name)); 2962 const char *file_name));
3393 /* The named file is opened for read and the image header is filled in 2963 /* The named file is opened for read and the image header is filled in
3394 * from the PNG header in the file. 2964 * from the PNG header in the file.
3395 */ 2965 */
3396 2966
3397 PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image, 2967 PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image,
3398 FILE* file)); 2968 FILE* file));
3399 /* The PNG header is read from the stdio FILE object. */ 2969 /* The PNG header is read from the stdio FILE object. */
3400 #endif /* PNG_STDIO_SUPPORTED */ 2970 #endif /* STDIO */
3401 2971
3402 PNG_EXPORT(236, int, png_image_begin_read_from_memory, (png_imagep image, 2972 PNG_EXPORT(236, int, png_image_begin_read_from_memory, (png_imagep image,
3403 png_const_voidp memory, png_size_t size)); 2973 png_const_voidp memory, png_size_t size));
3404 /* The PNG header is read from the given memory buffer. */ 2974 /* The PNG header is read from the given memory buffer. */
3405 2975
3406 PNG_EXPORT(237, int, png_image_finish_read, (png_imagep image, 2976 PNG_EXPORT(237, int, png_image_finish_read, (png_imagep image,
3407 png_const_colorp background, void *buffer, png_int_32 row_stride, 2977 png_const_colorp background, void *buffer, png_int_32 row_stride,
3408 void *colormap)); 2978 void *colormap));
3409 /* Finish reading the image into the supplied buffer and clean up the 2979 /* Finish reading the image into the supplied buffer and clean up the
3410 * png_image structure. 2980 * png_image structure.
(...skipping 24 matching lines...) Expand all
3435 * colormap must be supplied when PNG_FORMAT_FLAG_COLORMAP is set. It must 3005 * colormap must be supplied when PNG_FORMAT_FLAG_COLORMAP is set. It must
3436 * be at least the size (in bytes) returned by PNG_IMAGE_COLORMAP_SIZE. 3006 * be at least the size (in bytes) returned by PNG_IMAGE_COLORMAP_SIZE.
3437 * image->colormap_entries will be updated to the actual number of entries 3007 * image->colormap_entries will be updated to the actual number of entries
3438 * written to the colormap; this may be less than the original value. 3008 * written to the colormap; this may be less than the original value.
3439 */ 3009 */
3440 3010
3441 PNG_EXPORT(238, void, png_image_free, (png_imagep image)); 3011 PNG_EXPORT(238, void, png_image_free, (png_imagep image));
3442 /* Free any data allocated by libpng in image->opaque, setting the pointer to 3012 /* Free any data allocated by libpng in image->opaque, setting the pointer to
3443 * NULL. May be called at any time after the structure is initialized. 3013 * NULL. May be called at any time after the structure is initialized.
3444 */ 3014 */
3445 #endif /* PNG_SIMPLIFIED_READ_SUPPORTED */ 3015 #endif /* SIMPLIFIED_READ */
3446 3016
3447 #ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED 3017 #ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
3448 #ifdef PNG_STDIO_SUPPORTED 3018 #ifdef PNG_STDIO_SUPPORTED
3449 /* WRITE APIS 3019 /* WRITE APIS
3450 * ---------- 3020 * ----------
3451 * For write you must initialize a png_image structure to describe the image to 3021 * For write you must initialize a png_image structure to describe the image to
3452 * be written. To do this use memset to set the whole structure to 0 then 3022 * be written. To do this use memset to set the whole structure to 0 then
3453 * initialize fields describing your image. 3023 * initialize fields describing your image.
3454 * 3024 *
3455 * version: must be set to PNG_IMAGE_VERSION 3025 * version: must be set to PNG_IMAGE_VERSION
(...skipping 21 matching lines...) Expand all
3477 * gamma encoded according to the sRGB specification, otherwise a 16-bit linear 3047 * gamma encoded according to the sRGB specification, otherwise a 16-bit linear
3478 * encoded PNG file is written. 3048 * encoded PNG file is written.
3479 * 3049 *
3480 * With color-mapped data formats the colormap parameter point to a color-map 3050 * With color-mapped data formats the colormap parameter point to a color-map
3481 * with at least image->colormap_entries encoded in the specified format. If 3051 * with at least image->colormap_entries encoded in the specified format. If
3482 * the format is linear the written PNG color-map will be converted to sRGB 3052 * the format is linear the written PNG color-map will be converted to sRGB
3483 * regardless of the convert_to_8_bit flag. 3053 * regardless of the convert_to_8_bit flag.
3484 * 3054 *
3485 * With all APIs row_stride is handled as in the read APIs - it is the spacing 3055 * With all APIs row_stride is handled as in the read APIs - it is the spacing
3486 * from one row to the next in component sized units (1 or 2 bytes) and if 3056 * from one row to the next in component sized units (1 or 2 bytes) and if
3487 * negative indicates a bottom-up row layout in the buffer. 3057 * negative indicates a bottom-up row layout in the buffer. If row_stride is ze ro,
3058 * libpng will calculate it for you from the image width and number of channels.
3488 * 3059 *
3489 * Note that the write API does not support interlacing or sub-8-bit pixels. 3060 * Note that the write API does not support interlacing, sub-8-bit pixels, index ed
3061 * PNG (color_type 3) or most ancillary chunks.
3490 */ 3062 */
3491 #endif /* PNG_STDIO_SUPPORTED */ 3063 #endif /* STDIO */
3492 #endif /* PNG_SIMPLIFIED_WRITE_SUPPORTED */ 3064 #endif /* SIMPLIFIED_WRITE */
3493 /******************************************************************************* 3065 /*******************************************************************************
3494 * END OF SIMPLIFIED API 3066 * END OF SIMPLIFIED API
3495 ******************************************************************************/ 3067 ******************************************************************************/
3496 3068 #endif /* SIMPLIFIED_{READ|WRITE} */
3497 #ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
3498 PNG_EXPORT(242, void, png_set_check_for_invalid_index,
3499 (png_structrp png_ptr, int allowed));
3500 # ifdef PNG_GET_PALETTE_MAX_SUPPORTED
3501 PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
3502 png_const_infop info_ptr));
3503 # endif
3504 #endif /* CHECK_FOR_INVALID_INDEX */
3505 3069
3506 /******************************************************************************* 3070 /*******************************************************************************
3507 * IMPLEMENTATION OPTIONS 3071 * Section 6: IMPLEMENTATION OPTIONS
3508 ******************************************************************************* 3072 *******************************************************************************
3509 * 3073 *
3510 * Support for arbitrary implementation-specific optimizations. The API allows 3074 * Support for arbitrary implementation-specific optimizations. The API allows
3511 * particular options to be turned on or off. 'Option' is the number of the 3075 * particular options to be turned on or off. 'Option' is the number of the
3512 * option and 'onoff' is 0 (off) or non-0 (on). The value returned is given 3076 * option and 'onoff' is 0 (off) or non-0 (on). The value returned is given
3513 * by the PNG_OPTION_ defines below. 3077 * by the PNG_OPTION_ defines below.
3514 * 3078 *
3515 * HARDWARE: normally hardware capabilites, such as the Intel SSE instructions, 3079 * HARDWARE: normally hardware capabilites, such as the Intel SSE instructions,
3516 * are detected at run time, however sometimes it may be impossible 3080 * are detected at run time, however sometimes it may be impossible
3517 * to do this in user mode, in which case it is necessary to discover 3081 * to do this in user mode, in which case it is necessary to discover
3518 * the capabilities in an OS specific way. Such capabilities are 3082 * the capabilities in an OS specific way. Such capabilities are
3519 * listed here when libpng has support for them and must be turned 3083 * listed here when libpng has support for them and must be turned
3520 * ON by the application if present. 3084 * ON by the application if present.
3521 * 3085 *
3522 * SOFTWARE: sometimes software optimizations actually result in performance 3086 * SOFTWARE: sometimes software optimizations actually result in performance
3523 * decrease on some architectures or systems, or with some sets of 3087 * decrease on some architectures or systems, or with some sets of
3524 * PNG images. 'Software' options allow such optimizations to be 3088 * PNG images. 'Software' options allow such optimizations to be
3525 * selected at run time. 3089 * selected at run time.
3526 */ 3090 */
3527 #ifdef PNG_SET_OPTION_SUPPORTED 3091 #ifdef PNG_SET_OPTION_SUPPORTED
3528 #ifdef PNG_ARM_NEON_API_SUPPORTED 3092 #ifdef PNG_ARM_NEON_API_SUPPORTED
3529 # define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */ 3093 # define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */
3530 #endif 3094 #endif
3531 #define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */ 3095 #define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */
3532 #define PNG_OPTION_NEXT 4 /* Next option - numbers must be even */ 3096 #define PNG_SKIP_sRGB_CHECK_PROFILE 4 /* SOFTWARE: Check ICC profile for sRGB */
3097 #define PNG_OPTION_NEXT 6 /* Next option - numbers must be even */
3533 3098
3534 /* Return values: NOTE: there are four values and 'off' is *not* zero */ 3099 /* Return values: NOTE: there are four values and 'off' is *not* zero */
3535 #define PNG_OPTION_UNSET 0 /* Unset - defaults to off */ 3100 #define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
3536 #define PNG_OPTION_INVALID 1 /* Option number out of range */ 3101 #define PNG_OPTION_INVALID 1 /* Option number out of range */
3537 #define PNG_OPTION_OFF 2 3102 #define PNG_OPTION_OFF 2
3538 #define PNG_OPTION_ON 3 3103 #define PNG_OPTION_ON 3
3539 3104
3540 PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option, 3105 PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
3541 int onoff)); 3106 int onoff));
3542 #endif 3107 #endif /* SET_OPTION */
3543 3108
3544 /******************************************************************************* 3109 /*******************************************************************************
3545 * END OF HARDWARE OPTIONS 3110 * END OF HARDWARE AND SOFTWARE OPTIONS
3546 ******************************************************************************/ 3111 ******************************************************************************/
3547 3112
3548 /* Maintainer: Put new public prototypes here ^, in libpng.3, and project 3113 /* Maintainer: Put new public prototypes here ^, in libpng.3, in project
3549 * defs, scripts/pnglibconf.h, and scripts/pnglibconf.h.prebuilt 3114 * defs, and in scripts/symbols.def.
3550 */ 3115 */
3551 3116
3552 /* The last ordinal number (this is the *last* one already used; the next 3117 /* The last ordinal number (this is the *last* one already used; the next
3553 * one to use is one more than this.) Maintainer, remember to add an entry to 3118 * one to use is one more than this.)
3554 * scripts/symbols.def as well.
3555 */ 3119 */
3556 #ifdef PNG_EXPORT_LAST_ORDINAL 3120 #ifdef PNG_EXPORT_LAST_ORDINAL
3557 PNG_EXPORT_LAST_ORDINAL(244); 3121 PNG_EXPORT_LAST_ORDINAL(244);
3558 #endif 3122 #endif
3559 3123
3560 #ifdef __cplusplus 3124 #ifdef __cplusplus
3561 } 3125 }
3562 #endif 3126 #endif
3563 3127
3564 #endif /* PNG_VERSION_INFO_ONLY */ 3128 #endif /* PNG_VERSION_INFO_ONLY */
3565 /* Do not put anything past this line */ 3129 /* Do not put anything past this line */
3566 #endif /* PNG_H */ 3130 #endif /* PNG_H */
OLDNEW
« no previous file with comments | « third_party/libpng/README.pdfium ('k') | third_party/libpng/png.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698