ReactOS 0.4.16-dev-2610-ge2c92c0
png.h
Go to the documentation of this file.
1/* png.h - header file for PNG reference library
2 *
3 * libpng version 1.6.54
4 *
5 * Copyright (c) 2018-2026 Cosmin Truta
6 * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
7 * Copyright (c) 1996-1997 Andreas Dilger
8 * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
9 *
10 * This code is released under the libpng license. (See LICENSE, below.)
11 *
12 * Authors and maintainers:
13 * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
14 * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
15 * libpng versions 0.97, January 1998, through 1.6.35, July 2018:
16 * Glenn Randers-Pehrson
17 * libpng versions 1.6.36, December 2018, through 1.6.54, January 2026:
18 * Cosmin Truta
19 * See also "Contributing Authors", below.
20 */
21
22/*
23 * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
24 * =========================================
25 *
26 * PNG Reference Library License version 2
27 * ---------------------------------------
28 *
29 * * Copyright (c) 1995-2026 The PNG Reference Library Authors.
30 * * Copyright (c) 2018-2026 Cosmin Truta.
31 * * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
32 * * Copyright (c) 1996-1997 Andreas Dilger.
33 * * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
34 *
35 * The software is supplied "as is", without warranty of any kind,
36 * express or implied, including, without limitation, the warranties
37 * of merchantability, fitness for a particular purpose, title, and
38 * non-infringement. In no event shall the Copyright owners, or
39 * anyone distributing the software, be liable for any damages or
40 * other liability, whether in contract, tort or otherwise, arising
41 * from, out of, or in connection with the software, or the use or
42 * other dealings in the software, even if advised of the possibility
43 * of such damage.
44 *
45 * Permission is hereby granted to use, copy, modify, and distribute
46 * this software, or portions hereof, for any purpose, without fee,
47 * subject to the following restrictions:
48 *
49 * 1. The origin of this software must not be misrepresented; you
50 * must not claim that you wrote the original software. If you
51 * use this software in a product, an acknowledgment in the product
52 * documentation would be appreciated, but is not required.
53 *
54 * 2. Altered source versions must be plainly marked as such, and must
55 * not be misrepresented as being the original software.
56 *
57 * 3. This Copyright notice may not be removed or altered from any
58 * source or altered source distribution.
59 *
60 *
61 * PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)
62 * -----------------------------------------------------------------------
63 *
64 * libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are
65 * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
66 * derived from libpng-1.0.6, and are distributed according to the same
67 * disclaimer and license as libpng-1.0.6 with the following individuals
68 * added to the list of Contributing Authors:
69 *
70 * Simon-Pierre Cadieux
71 * Eric S. Raymond
72 * Mans Rullgard
73 * Cosmin Truta
74 * Gilles Vollant
75 * James Yu
76 * Mandar Sahastrabuddhe
77 * Google Inc.
78 * Vadim Barkov
79 *
80 * and with the following additions to the disclaimer:
81 *
82 * There is no warranty against interference with your enjoyment of
83 * the library or against infringement. There is no warranty that our
84 * efforts or the library will fulfill any of your particular purposes
85 * or needs. This library is provided with all faults, and the entire
86 * risk of satisfactory quality, performance, accuracy, and effort is
87 * with the user.
88 *
89 * Some files in the "contrib" directory and some configure-generated
90 * files that are distributed with libpng have other copyright owners, and
91 * are released under other open source licenses.
92 *
93 * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
94 * Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
95 * libpng-0.96, and are distributed according to the same disclaimer and
96 * license as libpng-0.96, with the following individuals added to the
97 * list of Contributing Authors:
98 *
99 * Tom Lane
100 * Glenn Randers-Pehrson
101 * Willem van Schaik
102 *
103 * libpng versions 0.89, June 1996, through 0.96, May 1997, are
104 * Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
105 * and are distributed according to the same disclaimer and license as
106 * libpng-0.88, with the following individuals added to the list of
107 * Contributing Authors:
108 *
109 * John Bowler
110 * Kevin Bracey
111 * Sam Bushell
112 * Magnus Holmgren
113 * Greg Roelofs
114 * Tom Tanner
115 *
116 * Some files in the "scripts" directory have other copyright owners,
117 * but are released under this license.
118 *
119 * libpng versions 0.5, May 1995, through 0.88, January 1996, are
120 * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
121 *
122 * For the purposes of this copyright and license, "Contributing Authors"
123 * is defined as the following set of individuals:
124 *
125 * Andreas Dilger
126 * Dave Martindale
127 * Guy Eric Schalnat
128 * Paul Schmidt
129 * Tim Wegner
130 *
131 * The PNG Reference Library is supplied "AS IS". The Contributing
132 * Authors and Group 42, Inc. disclaim all warranties, expressed or
133 * implied, including, without limitation, the warranties of
134 * merchantability and of fitness for any purpose. The Contributing
135 * Authors and Group 42, Inc. assume no liability for direct, indirect,
136 * incidental, special, exemplary, or consequential damages, which may
137 * result from the use of the PNG Reference Library, even if advised of
138 * the possibility of such damage.
139 *
140 * Permission is hereby granted to use, copy, modify, and distribute this
141 * source code, or portions hereof, for any purpose, without fee, subject
142 * to the following restrictions:
143 *
144 * 1. The origin of this source code must not be misrepresented.
145 *
146 * 2. Altered versions must be plainly marked as such and must not
147 * be misrepresented as being the original source.
148 *
149 * 3. This Copyright notice may not be removed or altered from any
150 * source or altered source distribution.
151 *
152 * The Contributing Authors and Group 42, Inc. specifically permit,
153 * without fee, and encourage the use of this source code as a component
154 * to supporting the PNG file format in commercial products. If you use
155 * this source code in a product, acknowledgment is not required but would
156 * be appreciated.
157 *
158 * END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
159 *
160 * TRADEMARK
161 * =========
162 *
163 * The name "libpng" has not been registered by the Copyright owners
164 * as a trademark in any jurisdiction. However, because libpng has
165 * been distributed and maintained world-wide, continually since 1995,
166 * the Copyright owners claim "common-law trademark protection" in any
167 * jurisdiction where common-law trademark is recognized.
168 */
169
170/*
171 * A "png_get_copyright" function is available, for convenient use in "about"
172 * boxes and the like:
173 *
174 * printf("%s", png_get_copyright(NULL));
175 *
176 * Also, the PNG logo (in PNG format, of course) is supplied in the
177 * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
178 */
179
180/*
181 * The contributing authors would like to thank all those who helped
182 * with testing, bug fixes, and patience. This wouldn't have been
183 * possible without all of you.
184 *
185 * Thanks to Frank J. T. Wojcik for helping with the documentation.
186 */
187
188/* Note about libpng version numbers:
189 *
190 * Due to various miscommunications, unforeseen code incompatibilities
191 * and occasional factors outside the authors' control, version numbering
192 * on the library has not always been consistent and straightforward.
193 * The following table summarizes matters since version 0.89c, which was
194 * the first widely used release:
195 *
196 * source png.h png.h shared-lib
197 * version string int version
198 * ------- ------ ----- ----------
199 * 0.89c "1.0 beta 3" 0.89 89 1.0.89
200 * 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90]
201 * 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95]
202 * 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96]
203 * 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97]
204 * 0.97c 0.97 97 2.0.97
205 * 0.98 0.98 98 2.0.98
206 * 0.99 0.99 98 2.0.99
207 * 0.99a-m 0.99 99 2.0.99
208 * 1.00 1.00 100 2.1.0 [100 should be 10000]
209 * 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000]
210 * 1.0.1 png.h string is 10001 2.1.0
211 * 1.0.1a-e identical to the 10002 from here on, the shared library
212 * 1.0.2 source version) 10002 is 2.V where V is the source code
213 * 1.0.2a-b 10003 version, except as noted.
214 * 1.0.3 10003
215 * 1.0.3a-d 10004
216 * 1.0.4 10004
217 * 1.0.4a-f 10005
218 * 1.0.5 (+ 2 patches) 10005
219 * 1.0.5a-d 10006
220 * 1.0.5e-r 10100 (not source compatible)
221 * 1.0.5s-v 10006 (not binary compatible)
222 * 1.0.6 (+ 3 patches) 10006 (still binary incompatible)
223 * 1.0.6d-f 10007 (still binary incompatible)
224 * 1.0.6g 10007
225 * 1.0.6h 10007 10.6h (testing xy.z so-numbering)
226 * 1.0.6i 10007 10.6i
227 * 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0)
228 * 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible)
229 * 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible)
230 * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible)
231 * 1.0.7 1 10007 (still compatible)
232 * ...
233 * 1.0.69 10 10069 10.so.0.69[.0]
234 * ...
235 * 1.2.59 13 10259 12.so.0.59[.0]
236 * ...
237 * 1.4.20 14 10420 14.so.0.20[.0]
238 * ...
239 * 1.5.30 15 10530 15.so.15.30[.0]
240 * ...
241 * 1.6.54 16 10654 16.so.16.54[.0]
242 *
243 * Henceforth the source version will match the shared-library major and
244 * minor numbers; the shared-library major version number will be used for
245 * changes in backward compatibility, as it is intended.
246 * The PNG_LIBPNG_VER macro, which is not used within libpng but is
247 * available for applications, is an unsigned integer of the form XYYZZ
248 * corresponding to the source version X.Y.Z (leading zeros in Y and Z).
249 * Beta versions were given the previous public release number plus a
250 * letter, until version 1.0.6j; from then on they were given the upcoming
251 * public release number plus "betaNN" or "rcNN".
252 *
253 * Binary incompatibility exists only when applications make direct access
254 * to the info_ptr or png_ptr members through png.h, and the compiled
255 * application is loaded with a different version of the library.
256 *
257 * See libpng.txt or libpng.3 for more information. The PNG specification
258 * is available as a W3C Recommendation and as an ISO/IEC Standard; see
259 * <https://www.w3.org/TR/2003/REC-PNG-20031110/>
260 */
261
262#ifndef PNG_H
263#define PNG_H
264
265/* This is not the place to learn how to use libpng. The file libpng-manual.txt
266 * describes how to use libpng, and the file example.c summarizes it
267 * with some code on which to build. This file is useful for looking
268 * at the actual function definitions and structure components. If that
269 * file has been stripped from your copy of libpng, you can find it at
270 * <http://www.libpng.org/pub/png/libpng-manual.txt>
271 *
272 * If you just need to read a PNG file and don't want to read the documentation
273 * skip to the end of this file and read the section entitled 'simplified API'.
274 */
275
276/* Version information for png.h - this should match the version in png.c */
277#define PNG_LIBPNG_VER_STRING "1.6.54"
278#define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n"
279
280/* The versions of shared library builds should stay in sync, going forward */
281#define PNG_LIBPNG_VER_SHAREDLIB 16
282#define PNG_LIBPNG_VER_SONUM PNG_LIBPNG_VER_SHAREDLIB /* [Deprecated] */
283#define PNG_LIBPNG_VER_DLLNUM PNG_LIBPNG_VER_SHAREDLIB /* [Deprecated] */
284
285/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
286#define PNG_LIBPNG_VER_MAJOR 1
287#define PNG_LIBPNG_VER_MINOR 6
288#define PNG_LIBPNG_VER_RELEASE 54
289
290/* This should be zero for a public release, or non-zero for a
291 * development version.
292 */
293#define PNG_LIBPNG_VER_BUILD 0
294
295/* Release Status */
296#define PNG_LIBPNG_BUILD_ALPHA 1
297#define PNG_LIBPNG_BUILD_BETA 2
298#define PNG_LIBPNG_BUILD_RC 3
299#define PNG_LIBPNG_BUILD_STABLE 4
300#define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7
301
302/* Release-Specific Flags */
303#define PNG_LIBPNG_BUILD_PATCH 8 /* Can be OR'ed with
304 PNG_LIBPNG_BUILD_STABLE only */
305#define PNG_LIBPNG_BUILD_PRIVATE 16 /* Cannot be OR'ed with
306 PNG_LIBPNG_BUILD_SPECIAL */
307#define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
308 PNG_LIBPNG_BUILD_PRIVATE */
309
310#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
311
312/* Careful here. At one time, Guy wanted to use 082, but that
313 * would be octal. We must not include leading zeros.
314 * Versions 0.7 through 1.0.0 were in the range 0 to 100 here
315 * (only version 1.0.0 was mis-numbered 100 instead of 10000).
316 * From version 1.0.1 it is:
317 * XXYYZZ, where XX=major, YY=minor, ZZ=release
318 */
319#define PNG_LIBPNG_VER 10654 /* 1.6.54 */
320
321/* Library configuration: these options cannot be changed after
322 * the library has been built.
323 */
324#ifndef PNGLCONF_H
325/* If pnglibconf.h is missing, you can
326 * copy scripts/pnglibconf.h.prebuilt to pnglibconf.h
327 */
328# include "pnglibconf.h"
329#endif
330
331#ifndef PNG_VERSION_INFO_ONLY
332/* Machine specific configuration. */
333# include "pngconf.h"
334#endif
335
336/*
337 * Added at libpng-1.2.8
338 *
339 * Ref MSDN: Private as priority over Special
340 * VS_FF_PRIVATEBUILD File *was not* built using standard release
341 * procedures. If this value is given, the StringFileInfo block must
342 * contain a PrivateBuild string.
343 *
344 * VS_FF_SPECIALBUILD File *was* built by the original company using
345 * standard release procedures but is a variation of the standard
346 * file of the same version number. If this value is given, the
347 * StringFileInfo block must contain a SpecialBuild string.
348 */
349
350#ifdef PNG_USER_PRIVATEBUILD /* From pnglibconf.h */
351# define PNG_LIBPNG_BUILD_TYPE \
352 (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE)
353#else
354# ifdef PNG_LIBPNG_SPECIALBUILD
355# define PNG_LIBPNG_BUILD_TYPE \
356 (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL)
357# else
358# define PNG_LIBPNG_BUILD_TYPE (PNG_LIBPNG_BUILD_BASE_TYPE)
359# endif
360#endif
361
362#ifndef PNG_VERSION_INFO_ONLY
363
364/* Inhibit C++ name-mangling for libpng functions but not for system calls. */
365#ifdef __cplusplus
366extern "C" {
367#endif /* __cplusplus */
368
369/* Version information for C files, stored in png.c. This had better match
370 * the version above.
371 */
372#define png_libpng_ver png_get_header_ver(NULL)
373
374/* This file is arranged in several sections:
375 *
376 * 1. [omitted]
377 * 2. Any configuration options that can be specified by for the application
378 * code when it is built. (Build time configuration is in pnglibconf.h)
379 * 3. Type definitions (base types are defined in pngconf.h), structure
380 * definitions.
381 * 4. Exported library functions.
382 * 5. Simplified API.
383 * 6. Implementation options.
384 *
385 * The library source code has additional files (principally pngpriv.h) that
386 * allow configuration of the library.
387 */
388
389/* Section 1: [omitted] */
390
391/* Section 2: run time configuration
392 * See pnglibconf.h for build time configuration
393 *
394 * Run time configuration allows the application to choose between
395 * implementations of certain arithmetic APIs. The default is set
396 * at build time and recorded in pnglibconf.h, but it is safe to
397 * override these (and only these) settings. Note that this won't
398 * change what the library does, only application code, and the
399 * settings can (and probably should) be made on a per-file basis
400 * by setting the #defines before including png.h
401 *
402 * Use macros to read integers from PNG data or use the exported
403 * functions?
404 * PNG_USE_READ_MACROS: use the macros (see below) Note that
405 * the macros evaluate their argument multiple times.
406 * PNG_NO_USE_READ_MACROS: call the relevant library function.
407 *
408 * Use the alternative algorithm for compositing alpha samples that
409 * does not use division?
410 * PNG_READ_COMPOSITE_NODIV_SUPPORTED: use the 'no division'
411 * algorithm.
412 * PNG_NO_READ_COMPOSITE_NODIV: use the 'division' algorithm.
413 *
414 * How to handle benign errors if PNG_ALLOW_BENIGN_ERRORS is
415 * false?
416 * PNG_ALLOW_BENIGN_ERRORS: map calls to the benign error
417 * APIs to png_warning.
418 * Otherwise the calls are mapped to png_error.
419 */
420
421/* Section 3: type definitions, including structures and compile time
422 * constants.
423 * See pngconf.h for base types that vary by machine/system
424 */
425
426/* This triggers a compiler error in png.c, if png.c and png.h
427 * do not agree upon the version number.
428 */
429typedef char *png_libpng_version_1_6_54;
430
431/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
432 *
433 * png_struct is the cache of information used while reading or writing a single
434 * PNG file. One of these is always required, although the simplified API
435 * (below) hides the creation and destruction of it.
436 */
438typedef const png_struct * png_const_structp;
439typedef png_struct * png_structp;
440typedef png_struct * * png_structpp;
441
442/* png_info contains information read from or to be written to a PNG file. One
443 * or more of these must exist while reading or creating a PNG file. The
444 * information is not used by libpng during read but is used to control what
445 * gets written when a PNG file is created. "png_get_" function calls read
446 * information during read and "png_set_" functions calls write information
447 * when creating a PNG.
448 * been moved into a separate header file that is not accessible to
449 * applications. Read libpng-manual.txt or libpng.3 for more info.
450 */
451typedef struct png_info_def png_info;
452typedef png_info * png_infop;
453typedef const png_info * png_const_infop;
454typedef png_info * * png_infopp;
455
456/* Types with names ending 'p' are pointer types. The corresponding types with
457 * names ending 'rp' are identical pointer types except that the pointer is
458 * marked 'restrict', which means that it is the only pointer to the object
459 * passed to the function. Applications should not use the 'restrict' types;
460 * it is always valid to pass 'p' to a pointer with a function argument of the
461 * corresponding 'rp' type. Different compilers have different rules with
462 * regard to type matching in the presence of 'restrict'. For backward
463 * compatibility libpng callbacks never have 'restrict' in their parameters and,
464 * consequentially, writing portable application code is extremely difficult if
465 * an attempt is made to use 'restrict'.
466 */
471
472/* Three color definitions. The order of the red, green, and blue, (and the
473 * exact size) is not important, although the size of the fields need to
474 * be png_byte or png_uint_16 (as defined below).
475 */
476typedef struct png_color_struct
478 png_byte red;
479 png_byte green;
480 png_byte blue;
482typedef png_color * png_colorp;
484typedef png_color * * png_colorpp;
488 png_byte index; /* used for palette files */
489 png_uint_16 red; /* for use in red green blue files */
490 png_uint_16 green;
491 png_uint_16 blue;
492 png_uint_16 gray; /* for use in grayscale files */
496typedef png_color_16 * * png_color_16pp;
498typedef struct png_color_8_struct
500 png_byte red; /* for use in red green blue files */
501 png_byte green;
502 png_byte blue;
503 png_byte gray; /* for use in grayscale files */
504 png_byte alpha; /* for alpha channel files */
506typedef png_color_8 * png_color_8p;
507typedef const png_color_8 * png_const_color_8p;
508typedef png_color_8 * * png_color_8pp;
509
510/*
511 * The following two structures are used for the in-core representation
512 * of sPLT chunks.
513 */
516 png_uint_16 red;
517 png_uint_16 green;
518 png_uint_16 blue;
519 png_uint_16 alpha;
520 png_uint_16 frequency;
525
526/* When the depth of the sPLT palette is 8 bits, the color and alpha samples
527 * occupy the LSB of their respective members, and the MSB of each member
528 * is zero-filled. The frequency member always occupies the full 16 bits.
529 */
531typedef struct png_sPLT_struct
533 png_charp name; /* palette name */
534 png_byte depth; /* depth of palette samples */
535 png_sPLT_entryp entries; /* palette entries */
536 png_int_32 nentries; /* number of palette entries */
538typedef png_sPLT_t * png_sPLT_tp;
539typedef const png_sPLT_t * png_const_sPLT_tp;
540typedef png_sPLT_t * * png_sPLT_tpp;
541
542#ifdef PNG_TEXT_SUPPORTED
543/* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file,
544 * and whether that contents is compressed or not. The "key" field
545 * points to a regular zero-terminated C string. The "text" fields can be a
546 * regular C string, an empty string, or a NULL pointer.
547 * However, the structure returned by png_get_text() will always contain
548 * the "text" field as a regular zero-terminated C string (possibly
549 * empty), never a NULL pointer, so it can be safely used in printf() and
550 * other string-handling functions. Note that the "itxt_length", "lang", and
551 * "lang_key" members of the structure only exist when the library is built
552 * with iTXt chunk support. Prior to libpng-1.4.0 the library was built by
553 * default without iTXt support. Also note that when iTXt *is* supported,
554 * the "lang" and "lang_key" fields contain NULL pointers when the
555 * "compression" field contains * PNG_TEXT_COMPRESSION_NONE or
556 * PNG_TEXT_COMPRESSION_zTXt. Note that the "compression value" is not the
557 * same as what appears in the PNG tEXt/zTXt/iTXt chunk's "compression flag"
558 * which is always 0 or 1, or its "compression method" which is always 0.
559 */
560typedef struct png_text_struct
561{
562 int compression; /* compression value:
563 -1: tEXt, none
564 0: zTXt, deflate
565 1: iTXt, none
566 2: iTXt, deflate */
567 png_charp key; /* keyword, 1-79 character description of "text" */
568 png_charp text; /* comment, may be an empty string (ie "")
569 or a NULL pointer */
570 size_t text_length; /* length of the text string */
571 size_t itxt_length; /* length of the itxt string */
572 png_charp lang; /* language code, 0-79 characters
573 or a NULL pointer */
574 png_charp lang_key; /* keyword translated UTF-8 string, 0 or more
575 chars or a NULL pointer */
577typedef png_text * png_textp;
578typedef const png_text * png_const_textp;
579typedef png_text * * png_textpp;
580#endif
582/* Supported compression types for text in PNG files (tEXt, and zTXt).
583 * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */
584#define PNG_TEXT_COMPRESSION_NONE_WR -3
585#define PNG_TEXT_COMPRESSION_zTXt_WR -2
586#define PNG_TEXT_COMPRESSION_NONE -1
587#define PNG_TEXT_COMPRESSION_zTXt 0
588#define PNG_ITXT_COMPRESSION_NONE 1
589#define PNG_ITXT_COMPRESSION_zTXt 2
590#define PNG_TEXT_COMPRESSION_LAST 3 /* Not a valid value */
591
592/* png_time is a way to hold the time in an machine independent way.
593 * Two conversions are provided, both from time_t and struct tm. There
594 * is no portable way to convert to either of these structures, as far
595 * as I know. If you know of a portable way, send it to me. As a side
596 * note - PNG has always been Year 2000 compliant!
597 */
598typedef struct png_time_struct
600 png_uint_16 year; /* full year, as in, 1995 */
601 png_byte month; /* month of year, 1 - 12 */
602 png_byte day; /* day of month, 1 - 31 */
603 png_byte hour; /* hour of day, 0 - 23 */
604 png_byte minute; /* minute of hour, 0 - 59 */
605 png_byte second; /* second of minute, 0 - 60 (for leap seconds) */
607typedef png_time * png_timep;
608typedef const png_time * png_const_timep;
609typedef png_time * * png_timepp;
610
611#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) ||\
612 defined(PNG_USER_CHUNKS_SUPPORTED)
613/* png_unknown_chunk is a structure to hold queued chunks for which there is
614 * no specific support. The idea is that we can use this to queue
615 * up private chunks for output even though the library doesn't actually
616 * know about their semantics.
618 * The data in the structure is set by libpng on read and used on write.
619 */
622 png_byte name[5]; /* Textual chunk name with '\0' terminator */
623 png_byte *data; /* Data, should not be modified on read! */
624 size_t size;
625
626 /* On write 'location' must be set using the flag values listed below.
627 * Notice that on read it is set by libpng however the values stored have
628 * more bits set than are listed below. Always treat the value as a
629 * bitmask. On write set only one bit - setting multiple bits may cause the
630 * chunk to be written in multiple places.
631 */
632 png_byte location; /* mode of operation at read time */
639#endif
641/* Flag values for the unknown chunk location byte. */
642#define PNG_HAVE_IHDR 0x01
643#define PNG_HAVE_PLTE 0x02
644#define PNG_AFTER_IDAT 0x08
646/* Maximum positive integer used in PNG is (2^31)-1 */
647#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
648#define PNG_UINT_32_MAX ((png_uint_32)(-1))
649#define PNG_SIZE_MAX ((size_t)(-1))
650
651/* These are constants for fixed point values encoded in the
652 * PNG specification manner (x100000)
653 */
654#define PNG_FP_1 100000
655#define PNG_FP_HALF 50000
656#define PNG_FP_MAX ((png_fixed_point)0x7fffffffL)
657#define PNG_FP_MIN (-PNG_FP_MAX)
659/* These describe the color_type field in png_info. */
660/* color type masks */
661#define PNG_COLOR_MASK_PALETTE 1
662#define PNG_COLOR_MASK_COLOR 2
663#define PNG_COLOR_MASK_ALPHA 4
665/* color types. Note that not all combinations are legal */
666#define PNG_COLOR_TYPE_GRAY 0
667#define PNG_COLOR_TYPE_PALETTE (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
668#define PNG_COLOR_TYPE_RGB (PNG_COLOR_MASK_COLOR)
669#define PNG_COLOR_TYPE_RGB_ALPHA (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
670#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
671/* aliases */
672#define PNG_COLOR_TYPE_RGBA PNG_COLOR_TYPE_RGB_ALPHA
673#define PNG_COLOR_TYPE_GA PNG_COLOR_TYPE_GRAY_ALPHA
675/* This is for compression type. PNG 1.0-1.2 only define the single type. */
676#define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */
677#define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE
679/* This is for filter type. PNG 1.0-1.2 only define the single type. */
680#define PNG_FILTER_TYPE_BASE 0 /* Single row per-byte filtering */
681#define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */
682#define PNG_FILTER_TYPE_DEFAULT PNG_FILTER_TYPE_BASE
684/* These are for the interlacing type. These values should NOT be changed. */
685#define PNG_INTERLACE_NONE 0 /* Non-interlaced image */
686#define PNG_INTERLACE_ADAM7 1 /* Adam7 interlacing */
687#define PNG_INTERLACE_LAST 2 /* Not a valid value */
689/* These are for the oFFs chunk. These values should NOT be changed. */
690#define PNG_OFFSET_PIXEL 0 /* Offset in pixels */
691#define PNG_OFFSET_MICROMETER 1 /* Offset in micrometers (1/10^6 meter) */
692#define PNG_OFFSET_LAST 2 /* Not a valid value */
694/* These are for the pCAL chunk. These values should NOT be changed. */
695#define PNG_EQUATION_LINEAR 0 /* Linear transformation */
696#define PNG_EQUATION_BASE_E 1 /* Exponential base e transform */
697#define PNG_EQUATION_ARBITRARY 2 /* Arbitrary base exponential transform */
698#define PNG_EQUATION_HYPERBOLIC 3 /* Hyperbolic sine transformation */
699#define PNG_EQUATION_LAST 4 /* Not a valid value */
701/* These are for the sCAL chunk. These values should NOT be changed. */
702#define PNG_SCALE_UNKNOWN 0 /* unknown unit (image scale) */
703#define PNG_SCALE_METER 1 /* meters per pixel */
704#define PNG_SCALE_RADIAN 2 /* radians per pixel */
705#define PNG_SCALE_LAST 3 /* Not a valid value */
707/* These are for the pHYs chunk. These values should NOT be changed. */
708#define PNG_RESOLUTION_UNKNOWN 0 /* pixels/unknown unit (aspect ratio) */
709#define PNG_RESOLUTION_METER 1 /* pixels/meter */
710#define PNG_RESOLUTION_LAST 2 /* Not a valid value */
712/* These are for the sRGB chunk. These values should NOT be changed. */
713#define PNG_sRGB_INTENT_PERCEPTUAL 0
714#define PNG_sRGB_INTENT_RELATIVE 1
715#define PNG_sRGB_INTENT_SATURATION 2
716#define PNG_sRGB_INTENT_ABSOLUTE 3
717#define PNG_sRGB_INTENT_LAST 4 /* Not a valid value */
718
719/* This is for text chunks */
720#define PNG_KEYWORD_MAX_LENGTH 79
721
722/* Maximum number of entries in PLTE/sPLT/tRNS arrays */
723#define PNG_MAX_PALETTE_LENGTH 256
724
725/* These determine if an ancillary chunk's data has been successfully read
726 * from the PNG header, or if the application has filled in the corresponding
727 * data in the info_struct to be written into the output file. The values
728 * of the PNG_INFO_<chunk> defines should NOT be changed.
729 */
730#define PNG_INFO_gAMA 0x0001U
731#define PNG_INFO_sBIT 0x0002U
732#define PNG_INFO_cHRM 0x0004U
733#define PNG_INFO_PLTE 0x0008U
734#define PNG_INFO_tRNS 0x0010U
735#define PNG_INFO_bKGD 0x0020U
736#define PNG_INFO_hIST 0x0040U
737#define PNG_INFO_pHYs 0x0080U
738#define PNG_INFO_oFFs 0x0100U
739#define PNG_INFO_tIME 0x0200U
740#define PNG_INFO_pCAL 0x0400U
741#define PNG_INFO_sRGB 0x0800U /* GR-P, 0.96a */
742#define PNG_INFO_iCCP 0x1000U /* ESR, 1.0.6 */
743#define PNG_INFO_sPLT 0x2000U /* ESR, 1.0.6 */
744#define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */
745#define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */
746#define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */
747#define PNG_INFO_cICP 0x20000U /* PNGv3: 1.6.45 */
748#define PNG_INFO_cLLI 0x40000U /* PNGv3: 1.6.45 */
749#define PNG_INFO_mDCV 0x80000U /* PNGv3: 1.6.45 */
750/* APNG: these chunks are stored as unknown, these flags are never set
751 * however they are provided as a convenience for implementors of APNG and
752 * avoids any merge conflicts.
753 *
754 * Private chunks: these chunk names violate the chunk name recommendations
755 * because the chunk definitions have no signature and because the private
756 * chunks with these names have been reserved. Private definitions should
757 * avoid them.
758 */
759#define PNG_INFO_acTL 0x100000U /* PNGv3: 1.6.45: unknown */
760#define PNG_INFO_fcTL 0x200000U /* PNGv3: 1.6.45: unknown */
761#define PNG_INFO_fdAT 0x400000U /* PNGv3: 1.6.45: unknown */
762
763/* This is used for the transformation routines, as some of them
764 * change these values for the row. It also should enable using
765 * the routines for other purposes.
766 */
769 png_uint_32 width; /* width of row */
770 size_t rowbytes; /* number of bytes in row */
771 png_byte color_type; /* color type of row */
772 png_byte bit_depth; /* bit depth of row */
773 png_byte channels; /* number of channels (1, 2, 3, or 4) */
774 png_byte pixel_depth; /* bits per pixel (depth * channels) */
776
778typedef png_row_info * * png_row_infopp;
779
780/* These are the function types for the I/O functions and for the functions
781 * that allow the user to override the default I/O functions with his or her
782 * own. The png_error_ptr type should match that of user-supplied warning
783 * and error functions, while the png_rw_ptr type should match that of the
784 * user read/write data functions. Note that the 'write' function must not
785 * modify the buffer it is passed. The 'read' function, on the other hand, is
786 * expected to return the read data in the buffer.
787 */
788typedef PNG_CALLBACK(void, *png_error_ptr,
790typedef PNG_CALLBACK(void, *png_rw_ptr,
792typedef PNG_CALLBACK(void, *png_flush_ptr,
793 (png_structp));
794typedef PNG_CALLBACK(void, *png_read_status_ptr,
795 (png_structp, png_uint_32, int));
796typedef PNG_CALLBACK(void, *png_write_status_ptr,
798
799#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
800typedef PNG_CALLBACK(void, *png_progressive_info_ptr,
802typedef PNG_CALLBACK(void, *png_progressive_end_ptr,
804
805/* The following callback receives png_uint_32 row_number, int pass for the
806 * png_bytep data of the row. When transforming an interlaced image the
807 * row number is the row number within the sub-image of the interlace pass, so
808 * the value will increase to the height of the sub-image (not the full image)
809 * then reset to 0 for the next pass.
810 *
811 * Use PNG_ROW_FROM_PASS_ROW(row, pass) and PNG_COL_FROM_PASS_COL(col, pass) to
812 * find the output pixel (x,y) given an interlaced sub-image pixel
813 * (row,col,pass). (See below for these macros.)
814 */
815typedef PNG_CALLBACK(void, *png_progressive_row_ptr,
817#endif
819#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
820 defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
821typedef PNG_CALLBACK(void, *png_user_transform_ptr,
823#endif
824
825#ifdef PNG_USER_CHUNKS_SUPPORTED
826typedef PNG_CALLBACK(int, *png_user_chunk_ptr,
828#endif
829#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
830/* not used anywhere */
831/* typedef PNG_CALLBACK(void, *png_unknown_chunk_ptr, (png_structp)); */
832#endif
833
834#ifdef PNG_SETJMP_SUPPORTED
835/* This must match the function definition in <setjmp.h>, and the application
836 * must include this before png.h to obtain the definition of jmp_buf. The
837 * function is required to be PNG_NORETURN, but this is not checked. If the
838 * function does return the application will crash via an abort() or similar
839 * system level call.
840 *
841 * If you get a warning here while building the library you may need to make
842 * changes to ensure that pnglibconf.h records the calling convention used by
843 * your compiler. This may be very difficult - try using a different compiler
844 * to build the library!
845 */
846PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), (jmp_buf, int), typedef);
847#endif
849/* Transform masks for the high-level interface */
850#define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */
851#define PNG_TRANSFORM_STRIP_16 0x0001 /* read only */
852#define PNG_TRANSFORM_STRIP_ALPHA 0x0002 /* read only */
853#define PNG_TRANSFORM_PACKING 0x0004 /* read and write */
854#define PNG_TRANSFORM_PACKSWAP 0x0008 /* read and write */
855#define PNG_TRANSFORM_EXPAND 0x0010 /* read only */
856#define PNG_TRANSFORM_INVERT_MONO 0x0020 /* read and write */
857#define PNG_TRANSFORM_SHIFT 0x0040 /* read and write */
858#define PNG_TRANSFORM_BGR 0x0080 /* read and write */
859#define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */
860#define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */
861#define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */
862#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* write only */
863/* Added to libpng-1.2.34 */
864#define PNG_TRANSFORM_STRIP_FILLER_BEFORE PNG_TRANSFORM_STRIP_FILLER
865#define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* write only */
866/* Added to libpng-1.4.0 */
867#define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */
868/* Added to libpng-1.5.4 */
869#define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */
870#if ~0U > 0xffffU /* or else this might break on a 16-bit machine */
871#define PNG_TRANSFORM_SCALE_16 0x8000 /* read only */
872#endif
874/* Flags for MNG supported features */
875#define PNG_FLAG_MNG_EMPTY_PLTE 0x01
876#define PNG_FLAG_MNG_FILTER_64 0x04
877#define PNG_ALL_MNG_FEATURES 0x05
878
879/* NOTE: prior to 1.5 these functions had no 'API' style declaration,
880 * this allowed the zlib default functions to be used on Windows
881 * platforms. In 1.5 the zlib default malloc (which just calls malloc and
882 * ignores the first argument) should be completely compatible with the
883 * following.
884 */
885typedef PNG_CALLBACK(png_voidp, *png_malloc_ptr,
887typedef PNG_CALLBACK(void, *png_free_ptr,
889
890/* Section 4: exported functions
891 * Here are the function definitions most commonly used. This is not
892 * the place to find out how to use libpng. See libpng-manual.txt for the
893 * full explanation, see example.c for the summary. This just provides
894 * a simple one line description of the use of each function.
895 *
896 * The PNG_EXPORT() and PNG_EXPORTA() macros used below are defined in
897 * pngconf.h and in the *.dfn files in the scripts directory.
898 *
899 * PNG_EXPORT(ordinal, type, name, (args));
900 *
901 * ordinal: ordinal that is used while building
902 * *.def files. The ordinal value is only
903 * relevant when preprocessing png.h with
904 * the *.dfn files for building symbol table
905 * entries, and are removed by pngconf.h.
906 * type: return type of the function
907 * name: function name
908 * args: function arguments, with types
909 *
910 * When we wish to append attributes to a function prototype we use
911 * the PNG_EXPORTA() macro instead.
912 *
913 * PNG_EXPORTA(ordinal, type, name, (args), attributes);
914 *
915 * ordinal, type, name, and args: same as in PNG_EXPORT().
916 * attributes: function attributes
917 */
918
919/* Returns the version number of the library */
921 (void));
922
923/* Tell lib we have already handled the first <num_bytes> magic bytes.
924 * Handling more than 8 bytes from the beginning of the file is an error.
925 */
926PNG_EXPORT(2, void, png_set_sig_bytes,
927 (png_structrp png_ptr, int num_bytes));
928
929/* Check sig[start] through sig[start + num_to_check - 1] to see if it's a
930 * PNG file. Returns zero if the supplied bytes match the 8-byte PNG
931 * signature, and non-zero otherwise. Having num_to_check == 0 or
932 * start > 7 will always fail (i.e. return non-zero).
933 */
934PNG_EXPORT(3, int, png_sig_cmp,
935 (png_const_bytep sig, size_t start, size_t num_to_check));
936
937/* Simple signature checking function. This is the same as calling
938 * png_check_sig(sig, n) := (png_sig_cmp(sig, 0, n) == 0).
939 */
940#define png_check_sig(sig, n) (png_sig_cmp((sig), 0, (n)) == 0) /* DEPRECATED */
941
942/* Allocate and initialize png_ptr struct for reading, and any other memory. */
943PNG_EXPORTA(4, png_structp, png_create_read_struct,
944 (png_const_charp user_png_ver,
945 png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn),
947
948/* Allocate and initialize png_ptr struct for writing, and any other memory */
949PNG_EXPORTA(5, png_structp, png_create_write_struct,
950 (png_const_charp user_png_ver,
951 png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn),
953
954PNG_EXPORT(6, size_t, png_get_compression_buffer_size,
956
957PNG_EXPORT(7, void, png_set_compression_buffer_size,
958 (png_structrp png_ptr, size_t size));
959
960/* Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp
961 * match up.
962 */
963#ifdef PNG_SETJMP_SUPPORTED
964/* This function returns the jmp_buf built in to *png_ptr. It must be
965 * supplied with an appropriate 'longjmp' function to use on that jmp_buf
966 * unless the default error function is overridden in which case NULL is
967 * acceptable. The size of the jmp_buf is checked against the actual size
968 * allocated by the library - the call will return NULL on a mismatch
969 * indicating an ABI mismatch.
970 */
971PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn,
972 (png_structrp png_ptr, png_longjmp_ptr longjmp_fn, size_t jmp_buf_size));
973# define png_jmpbuf(png_ptr) \
974 (*png_set_longjmp_fn((png_ptr), longjmp, (sizeof (jmp_buf))))
975#else
976# define png_jmpbuf(png_ptr) \
977 (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP)
978#endif
979/* This function should be used by libpng applications in place of
980 * longjmp(png_ptr->jmpbuf, val). If longjmp_fn() has been set, it
981 * will use it; otherwise it will call PNG_ABORT(). This function was
982 * added in libpng-1.5.0.
983 */
984PNG_EXPORTA(9, void, png_longjmp,
988#ifdef PNG_READ_SUPPORTED
989/* Reset the compression stream */
990PNG_EXPORTA(10, int, png_reset_zstream,
993#endif
995/* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */
996#ifdef PNG_USER_MEM_SUPPORTED
997PNG_EXPORTA(11, png_structp, png_create_read_struct_2,
998 (png_const_charp user_png_ver,
999 png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn,
1000 png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn),
1002PNG_EXPORTA(12, png_structp, png_create_write_struct_2,
1003 (png_const_charp user_png_ver,
1004 png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn,
1005 png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn),
1007#endif
1008
1009/* Write the PNG file signature. */
1010PNG_EXPORT(13, void, png_write_sig,
1012
1013/* Write a PNG chunk - size, type, (optional) data, CRC. */
1014PNG_EXPORT(14, void, png_write_chunk,
1017
1018/* Write the start of a PNG chunk - length and chunk name. */
1019PNG_EXPORT(15, void, png_write_chunk_start,
1022
1023/* Write the data of a PNG chunk started with png_write_chunk_start(). */
1024PNG_EXPORT(16, void, png_write_chunk_data,
1027
1028/* Finish a chunk started with png_write_chunk_start() (includes CRC). */
1029PNG_EXPORT(17, void, png_write_chunk_end,
1031
1032/* Allocate and initialize the info structure */
1033PNG_EXPORTA(18, png_infop, png_create_info_struct,
1036
1037/* DEPRECATED: this function allowed init structures to be created using the
1038 * default allocation method (typically malloc). Use is deprecated in 1.6.0 and
1039 * the API will be removed in the future.
1040 */
1041PNG_EXPORTA(19, void, png_info_init_3,
1042 (png_infopp info_ptr, size_t png_info_struct_size),
1044
1045/* Writes all the PNG information before the image. */
1046PNG_EXPORT(20, void, png_write_info_before_PLTE,
1048PNG_EXPORT(21, void, png_write_info,
1051#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
1052/* Read the information before the actual image data. */
1053PNG_EXPORT(22, void, png_read_info,
1055#endif
1056
1057#ifdef PNG_TIME_RFC1123_SUPPORTED
1058 /* Convert to a US string format: there is no localization support in this
1059 * routine. The original implementation used a 29 character buffer in
1060 * png_struct, this will be removed in future versions.
1062#if PNG_LIBPNG_VER < 10700
1063/* To do: remove this from libpng17 (and from libpng17/png.c and pngstruct.h) */
1064PNG_EXPORTA(23, png_const_charp, png_convert_to_rfc1123,
1067#endif
1068PNG_EXPORT(241, int, png_convert_to_rfc1123_buffer,
1069 (char out[29], png_const_timep ptime));
1070#endif
1072#ifdef PNG_CONVERT_tIME_SUPPORTED
1073/* Convert from a struct tm to png_time */
1074PNG_EXPORT(24, void, png_convert_from_struct_tm,
1075 (png_timep ptime, const struct tm * ttime));
1076
1077/* Convert from time_t to png_time. Uses gmtime() */
1078PNG_EXPORT(25, void, png_convert_from_time_t,
1079 (png_timep ptime, time_t ttime));
1080#endif /* CONVERT_tIME */
1082#ifdef PNG_READ_EXPAND_SUPPORTED
1083/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */
1084PNG_EXPORT(26, void, png_set_expand,
1086PNG_EXPORT(27, void, png_set_expand_gray_1_2_4_to_8,
1088PNG_EXPORT(28, void, png_set_palette_to_rgb,
1090PNG_EXPORT(29, void, png_set_tRNS_to_alpha,
1092#endif
1093
1094#ifdef PNG_READ_EXPAND_16_SUPPORTED
1095/* Expand to 16-bit channels, forces conversion of palette to RGB and expansion
1096 * of a tRNS chunk if present.
1097 */
1098PNG_EXPORT(221, void, png_set_expand_16,
1100#endif
1102#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
1103/* Use blue, green, red order for pixels. */
1104PNG_EXPORT(30, void, png_set_bgr,
1106#endif
1108#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
1109/* Expand the grayscale to 24-bit RGB if necessary. */
1110PNG_EXPORT(31, void, png_set_gray_to_rgb,
1112#endif
1114#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
1115/* Reduce RGB to grayscale. */
1116#define PNG_ERROR_ACTION_NONE 1
1117#define PNG_ERROR_ACTION_WARN 2
1118#define PNG_ERROR_ACTION_ERROR 3
1119#define PNG_RGB_TO_GRAY_DEFAULT (-1)/*for red/green coefficients*/
1120
1121PNG_FP_EXPORT(32, void, png_set_rgb_to_gray,
1123 int error_action, double red, double green))
1127
1128PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status,
1130#endif
1131
1132#ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
1133PNG_EXPORT(35, void, png_build_grayscale_palette,
1134 (int bit_depth, png_colorp palette));
1135#endif
1136
1137#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
1138/* How the alpha channel is interpreted - this affects how the color channels
1139 * of a PNG file are returned to the calling application when an alpha channel,
1140 * or a tRNS chunk in a palette file, is present.
1141 *
1142 * This has no effect on the way pixels are written into a PNG output
1143 * datastream. The color samples in a PNG datastream are never premultiplied
1144 * with the alpha samples.
1145 *
1146 * The default is to return data according to the PNG specification: the alpha
1147 * channel is a linear measure of the contribution of the pixel to the
1148 * corresponding composited pixel, and the color channels are unassociated
1149 * (not premultiplied). The gamma encoded color channels must be scaled
1150 * according to the contribution and to do this it is necessary to undo
1151 * the encoding, scale the color values, perform the composition and re-encode
1152 * the values. This is the 'PNG' mode.
1153 *
1154 * The alternative is to 'associate' the alpha with the color information by
1155 * storing color channel values that have been scaled by the alpha.
1156 * image. These are the 'STANDARD', 'ASSOCIATED' or 'PREMULTIPLIED' modes
1157 * (the latter being the two common names for associated alpha color channels).
1158 *
1159 * For the 'OPTIMIZED' mode, a pixel is treated as opaque only if the alpha
1160 * value is equal to the maximum value.
1161 *
1162 * The final choice is to gamma encode the alpha channel as well. This is
1163 * broken because, in practice, no implementation that uses this choice
1164 * correctly undoes the encoding before handling alpha composition. Use this
1165 * choice only if other serious errors in the software or hardware you use
1166 * mandate it; the typical serious error is for dark halos to appear around
1167 * opaque areas of the composited PNG image because of arithmetic overflow.
1168 *
1169 * The API function png_set_alpha_mode specifies which of these choices to use
1170 * with an enumerated 'mode' value and the gamma of the required output:
1172#define PNG_ALPHA_PNG 0 /* according to the PNG standard */
1173#define PNG_ALPHA_STANDARD 1 /* according to Porter/Duff */
1174#define PNG_ALPHA_ASSOCIATED 1 /* as above; this is the normal practice */
1175#define PNG_ALPHA_PREMULTIPLIED 1 /* as above */
1176#define PNG_ALPHA_OPTIMIZED 2 /* 'PNG' for opaque pixels, else 'STANDARD' */
1177#define PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */
1179PNG_FP_EXPORT(227, void, png_set_alpha_mode,
1180 (png_structrp png_ptr, int mode, double output_gamma))
1182 (png_structrp png_ptr, int mode, png_fixed_point output_gamma))
1183#endif
1184
1185#if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED)
1186/* The output_gamma value is a screen gamma in libpng terminology: it expresses
1187 * how to decode the output values, not how they are encoded.
1189#define PNG_DEFAULT_sRGB -1 /* sRGB gamma and color space */
1190#define PNG_GAMMA_MAC_18 -2 /* Old Mac '1.8' gamma and color space */
1191#define PNG_GAMMA_sRGB 220000 /* Television standards--matches sRGB gamma */
1192#define PNG_GAMMA_LINEAR PNG_FP_1 /* Linear */
1193#endif
1194
1195/* The following are examples of calls to png_set_alpha_mode to achieve the
1196 * required overall gamma correction and, where necessary, alpha
1197 * premultiplication.
1198 *
1199 * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB);
1200 * This is the default libpng handling of the alpha channel - it is not
1201 * pre-multiplied into the color components. In addition the call states
1202 * that the output is for a sRGB system and causes all PNG files without gAMA
1203 * chunks to be assumed to be encoded using sRGB.
1204 *
1205 * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC);
1206 * In this case the output is assumed to be something like an sRGB conformant
1207 * display preceded by a power-law lookup table of power 1.45. This is how
1208 * early Mac systems behaved.
1209 *
1210 * png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_GAMMA_LINEAR);
1211 * This is the classic Jim Blinn approach and will work in academic
1212 * environments where everything is done by the book. It has the shortcoming
1213 * of assuming that input PNG data with no gamma information is linear - this
1214 * is unlikely to be correct unless the PNG files where generated locally.
1215 * Most of the time the output precision will be so low as to show
1216 * significant banding in dark areas of the image.
1217 *
1218 * png_set_expand_16(pp);
1219 * png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_DEFAULT_sRGB);
1220 * This is a somewhat more realistic Jim Blinn inspired approach. PNG files
1221 * are assumed to have the sRGB encoding if not marked with a gamma value and
1222 * the output is always 16 bits per component. This permits accurate scaling
1223 * and processing of the data. If you know that your input PNG files were
1224 * generated locally you might need to replace PNG_DEFAULT_sRGB with the
1225 * correct value for your system.
1226 *
1227 * png_set_alpha_mode(pp, PNG_ALPHA_OPTIMIZED, PNG_DEFAULT_sRGB);
1228 * If you just need to composite the PNG image onto an existing background
1229 * and if you control the code that does this you can use the optimization
1230 * setting. In this case you just copy completely opaque pixels to the
1231 * output. For pixels that are not completely transparent (you just skip
1232 * those) you do the composition math using png_composite or png_composite_16
1233 * below then encode the resultant 8-bit or 16-bit values to match the output
1234 * encoding.
1235 *
1236 * Other cases
1237 * If neither the PNG nor the standard linear encoding work for you because
1238 * of the software or hardware you use then you have a big problem. The PNG
1239 * case will probably result in halos around the image. The linear encoding
1240 * will probably result in a washed out, too bright, image (it's actually too
1241 * contrasty.) Try the ALPHA_OPTIMIZED mode above - this will probably
1242 * substantially reduce the halos. Alternatively try:
1243 *
1244 * png_set_alpha_mode(pp, PNG_ALPHA_BROKEN, PNG_DEFAULT_sRGB);
1245 * This option will also reduce the halos, but there will be slight dark
1246 * halos round the opaque parts of the image where the background is light.
1247 * In the OPTIMIZED mode the halos will be light halos where the background
1248 * is dark. Take your pick - the halos are unavoidable unless you can get
1249 * your hardware/software fixed! (The OPTIMIZED approach is slightly
1250 * faster.)
1251 *
1252 * When the default gamma of PNG files doesn't match the output gamma.
1253 * If you have PNG files with no gamma information png_set_alpha_mode allows
1254 * you to provide a default gamma, but it also sets the output gamma to the
1255 * matching value. If you know your PNG files have a gamma that doesn't
1256 * match the output you can take advantage of the fact that
1257 * png_set_alpha_mode always sets the output gamma but only sets the PNG
1258 * default if it is not already set:
1259 *
1260 * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB);
1261 * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC);
1262 * The first call sets both the default and the output gamma values, the
1263 * second call overrides the output gamma without changing the default. This
1264 * is easier than achieving the same effect with png_set_gamma. You must use
1265 * PNG_ALPHA_PNG for the first call - internal checking in png_set_alpha will
1266 * fire if more than one call to png_set_alpha_mode and png_set_background is
1267 * made in the same read operation, however multiple calls with PNG_ALPHA_PNG
1268 * are ignored.
1270
1271#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
1272PNG_EXPORT(36, void, png_set_strip_alpha,
1274#endif
1276#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
1277 defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
1278PNG_EXPORT(37, void, png_set_swap_alpha,
1280#endif
1282#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
1283 defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
1284PNG_EXPORT(38, void, png_set_invert_alpha,
1286#endif
1288#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
1289/* Add a filler byte to 8-bit or 16-bit Gray or 24-bit or 48-bit RGB images. */
1290PNG_EXPORT(39, void, png_set_filler,
1292/* The values of the PNG_FILLER_ defines should NOT be changed */
1293# define PNG_FILLER_BEFORE 0
1294# define PNG_FILLER_AFTER 1
1295/* Add an alpha byte to 8-bit or 16-bit Gray or 24-bit or 48-bit RGB images. */
1296PNG_EXPORT(40, void, png_set_add_alpha,
1298#endif /* READ_FILLER || WRITE_FILLER */
1300#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
1301/* Swap bytes in 16-bit depth files. */
1302PNG_EXPORT(41, void, png_set_swap,
1304#endif
1306#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
1307/* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */
1308PNG_EXPORT(42, void, png_set_packing,
1310#endif
1311
1312#if defined(PNG_READ_PACKSWAP_SUPPORTED) || \
1313 defined(PNG_WRITE_PACKSWAP_SUPPORTED)
1314/* Swap packing order of pixels in bytes. */
1315PNG_EXPORT(43, void, png_set_packswap,
1317#endif
1319#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
1320/* Converts files to legal bit depths. */
1321PNG_EXPORT(44, void, png_set_shift,
1323#endif
1324
1325#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
1326 defined(PNG_WRITE_INTERLACING_SUPPORTED)
1327/* Have the code handle the interlacing. Returns the number of passes.
1328 * MUST be called before png_read_update_info or png_start_read_image,
1329 * otherwise it will not have the desired effect. Note that it is still
1330 * necessary to call png_read_row or png_read_rows png_get_image_height
1331 * times for each pass.
1332*/
1333PNG_EXPORT(45, int, png_set_interlace_handling,
1335#endif
1337#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
1338/* Invert monochrome files */
1339PNG_EXPORT(46, void, png_set_invert_mono,
1341#endif
1342
1343#ifdef PNG_READ_BACKGROUND_SUPPORTED
1344/* Handle alpha and tRNS by replacing with a background color. Prior to
1345 * libpng-1.5.4 this API must not be called before the PNG file header has been
1346 * read. Doing so will result in unexpected behavior and possible warnings or
1347 * errors if the PNG file contains a bKGD chunk.
1348 */
1349PNG_FP_EXPORT(47, void, png_set_background,
1352 int need_expand, double background_gamma))
1356 int need_expand, png_fixed_point background_gamma))
1357#endif
1358#ifdef PNG_READ_BACKGROUND_SUPPORTED
1359# define PNG_BACKGROUND_GAMMA_UNKNOWN 0
1360# define PNG_BACKGROUND_GAMMA_SCREEN 1
1361# define PNG_BACKGROUND_GAMMA_FILE 2
1362# define PNG_BACKGROUND_GAMMA_UNIQUE 3
1363#endif
1365#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
1366/* Scale a 16-bit depth file down to 8-bit, accurately. */
1367PNG_EXPORT(229, void, png_set_scale_16,
1369#endif
1370
1371#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
1372#define PNG_READ_16_TO_8_SUPPORTED /* Name prior to 1.5.4 */
1373/* Strip the second byte of information from a 16-bit depth file. */
1374PNG_EXPORT(48, void, png_set_strip_16,
1376#endif
1377
1378#ifdef PNG_READ_QUANTIZE_SUPPORTED
1379/* Turn on quantizing, and reduce the palette to the number of colors
1380 * available.
1381 */
1382PNG_EXPORT(49, void, png_set_quantize,
1384 png_colorp palette, int num_palette, int maximum_colors,
1385 png_const_uint_16p histogram, int full_quantize));
1386#endif
1387
1388#ifdef PNG_READ_GAMMA_SUPPORTED
1389/* The threshold on gamma processing is configurable but hard-wired into the
1390 * library. The following is the floating point variant.
1391 */
1392#define PNG_GAMMA_THRESHOLD (PNG_GAMMA_THRESHOLD_FIXED*.00001)
1393
1394/* Handle gamma correction. Screen_gamma=(display_exponent).
1395 * NOTE: this API simply sets the screen and file gamma values. It will
1396 * therefore override the value for gamma in a PNG file if it is called after
1397 * the file header has been read - use with care - call before reading the PNG
1398 * file for best results!
1399 *
1400 * These routines accept the same gamma values as png_set_alpha_mode (described
1401 * above). The PNG_GAMMA_ defines and PNG_DEFAULT_sRGB can be passed to either
1402 * API (floating point or fixed.) Notice, however, that the 'file_gamma' value
1403 * is the inverse of a 'screen gamma' value.
1404 */
1405PNG_FP_EXPORT(50, void, png_set_gamma,
1407 double screen_gamma, double override_file_gamma))
1410 png_fixed_point screen_gamma, png_fixed_point override_file_gamma))
1411#endif
1413#ifdef PNG_WRITE_FLUSH_SUPPORTED
1414/* Set how many lines between output flushes - 0 for no flushing */
1415PNG_EXPORT(51, void, png_set_flush,
1416 (png_structrp png_ptr, int nrows));
1417/* Flush the current PNG output buffer */
1418PNG_EXPORT(52, void, png_write_flush,
1420#endif
1421
1422/* Optional update palette with requested transformations */
1423PNG_EXPORT(53, void, png_start_read_image,
1425
1426/* Optional call to update the users info structure */
1427PNG_EXPORT(54, void, png_read_update_info,
1430#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
1431/* Read one or more rows of image data. */
1432PNG_EXPORT(55, void, png_read_rows,
1435#endif
1437#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
1438/* Read a row of data. */
1439PNG_EXPORT(56, void, png_read_row,
1441#endif
1443#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
1444/* Read the whole image into memory at once. */
1445PNG_EXPORT(57, void, png_read_image,
1447#endif
1448
1449/* Write a row of image data */
1450PNG_EXPORT(58, void, png_write_row,
1452
1453/* Write a few rows of image data: (*row) is not written; however, the type
1454 * is declared as writeable to maintain compatibility with previous versions
1455 * of libpng and to allow the 'display_row' array from read_rows to be passed
1456 * unchanged to write_rows.
1457 */
1458PNG_EXPORT(59, void, png_write_rows,
1460
1461/* Write the image data */
1462PNG_EXPORT(60, void, png_write_image,
1464
1465/* Write the end of the PNG file. */
1466PNG_EXPORT(61, void, png_write_end,
1469#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
1470/* Read the end of the PNG file. */
1471PNG_EXPORT(62, void, png_read_end,
1473#endif
1474
1475/* Free any memory associated with the png_info_struct */
1476PNG_EXPORT(63, void, png_destroy_info_struct,
1478
1479/* Free any memory associated with the png_struct and the png_info_structs */
1480PNG_EXPORT(64, void, png_destroy_read_struct,
1481 (png_structpp png_ptr_ptr,
1482 png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr));
1483
1484/* Free any memory associated with the png_struct and the png_info_structs */
1485PNG_EXPORT(65, void, png_destroy_write_struct,
1486 (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr));
1487
1488/* Set the libpng method of handling chunk CRC errors */
1489PNG_EXPORT(66, void, png_set_crc_action,
1490 (png_structrp png_ptr, int crit_action, int ancil_action));
1491
1492/* Values for png_set_crc_action() say how to handle CRC errors in
1493 * ancillary and critical chunks, and whether to use the data contained
1494 * therein. Note that it is impossible to "discard" data in a critical
1495 * chunk. For versions prior to 0.90, the action was always error/quit,
1496 * whereas in version 0.90 and later, the action for CRC errors in ancillary
1497 * chunks is warn/discard. These values should NOT be changed.
1499 * value action:critical action:ancillary
1501#define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */
1502#define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */
1503#define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */
1504#define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */
1505#define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */
1506#define PNG_CRC_NO_CHANGE 5 /* use current value use current value */
1507
1508#ifdef PNG_WRITE_SUPPORTED
1509/* These functions give the user control over the scan-line filtering in
1510 * libpng and the compression methods used by zlib. These functions are
1511 * mainly useful for testing, as the defaults should work with most users.
1512 * Those users who are tight on memory or want faster performance at the
1513 * expense of compression can modify them. See the compression library
1514 * header file (zlib.h) for an explanation of the compression functions.
1515 */
1516
1517/* Set the filtering method(s) used by libpng. Currently, the only valid
1518 * value for "method" is 0.
1519 */
1520PNG_EXPORT(67, void, png_set_filter,
1521 (png_structrp png_ptr, int method, int filters));
1522#endif /* WRITE */
1523
1524/* Flags for png_set_filter() to say which filters to use. The flags
1525 * are chosen so that they don't conflict with real filter types
1526 * below, in case they are supplied instead of the #defined constants.
1527 * These values should NOT be changed.
1529#define PNG_NO_FILTERS 0x00
1530#define PNG_FILTER_NONE 0x08
1531#define PNG_FILTER_SUB 0x10
1532#define PNG_FILTER_UP 0x20
1533#define PNG_FILTER_AVG 0x40
1534#define PNG_FILTER_PAETH 0x80
1535#define PNG_FAST_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP)
1536#define PNG_ALL_FILTERS (PNG_FAST_FILTERS | PNG_FILTER_AVG | PNG_FILTER_PAETH)
1537
1538/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
1539 * These defines should NOT be changed.
1541#define PNG_FILTER_VALUE_NONE 0
1542#define PNG_FILTER_VALUE_SUB 1
1543#define PNG_FILTER_VALUE_UP 2
1544#define PNG_FILTER_VALUE_AVG 3
1545#define PNG_FILTER_VALUE_PAETH 4
1546#define PNG_FILTER_VALUE_LAST 5
1548#ifdef PNG_WRITE_SUPPORTED
1549#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* DEPRECATED */
1550PNG_FP_EXPORT(68, void, png_set_filter_heuristics,
1554 png_const_doublep filter_costs))
1559 png_const_fixed_point_p filter_costs))
1560#endif /* WRITE_WEIGHTED_FILTER */
1562/* The following are no longer used and will be removed from libpng-1.7: */
1563#define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */
1564#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */
1565#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */
1566#define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */
1567
1568/* Set the library compression level. Currently, valid values range from
1569 * 0 - 9, corresponding directly to the zlib compression levels 0 - 9
1570 * (0 - no compression, 9 - "maximal" compression). Note that tests have
1571 * shown that zlib compression levels 3-6 usually perform as well as level 9
1572 * for PNG images, and do considerably fewer calculations. In the future,
1573 * these values may not correspond directly to the zlib compression levels.
1574 */
1575#ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
1576PNG_EXPORT(69, void, png_set_compression_level,
1577 (png_structrp png_ptr, int level));
1578
1579PNG_EXPORT(70, void, png_set_compression_mem_level,
1580 (png_structrp png_ptr, int mem_level));
1581
1582PNG_EXPORT(71, void, png_set_compression_strategy,
1583 (png_structrp png_ptr, int strategy));
1584
1585/* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a
1586 * smaller value of window_bits if it can do so safely.
1587 */
1588PNG_EXPORT(72, void, png_set_compression_window_bits,
1589 (png_structrp png_ptr, int window_bits));
1590
1591PNG_EXPORT(73, void, png_set_compression_method,
1592 (png_structrp png_ptr, int method));
1593#endif /* WRITE_CUSTOMIZE_COMPRESSION */
1595#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
1596/* Also set zlib parameters for compressing non-IDAT chunks */
1597PNG_EXPORT(222, void, png_set_text_compression_level,
1598 (png_structrp png_ptr, int level));
1599
1600PNG_EXPORT(223, void, png_set_text_compression_mem_level,
1601 (png_structrp png_ptr, int mem_level));
1602
1603PNG_EXPORT(224, void, png_set_text_compression_strategy,
1604 (png_structrp png_ptr, int strategy));
1605
1606/* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a
1607 * smaller value of window_bits if it can do so safely.
1608 */
1609PNG_EXPORT(225, void, png_set_text_compression_window_bits,
1610 (png_structrp png_ptr, int window_bits));
1611
1612PNG_EXPORT(226, void, png_set_text_compression_method,
1613 (png_structrp png_ptr, int method));
1614#endif /* WRITE_CUSTOMIZE_ZTXT_COMPRESSION */
1615#endif /* WRITE */
1616
1617/* These next functions are called for input/output, memory, and error
1618 * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c,
1619 * and call standard C I/O routines such as fread(), fwrite(), and
1620 * fprintf(). These functions can be made to use other I/O routines
1621 * at run time for those applications that need to handle I/O in a
1622 * different manner by calling png_set_???_fn(). See libpng-manual.txt for
1623 * more information.
1624 */
1626#ifdef PNG_STDIO_SUPPORTED
1627/* Initialize the input/output for the PNG file to the default functions. */
1628PNG_EXPORT(74, void, png_init_io,
1629 (png_structrp png_ptr, FILE *fp));
1630#endif
1631
1632/* Replace the (error and abort), and warning functions with user
1633 * supplied functions. If no messages are to be printed you must still
1634 * write and use replacement functions. The replacement error_fn should
1635 * still do a longjmp to the last setjmp location if you are using this
1636 * method of error handling. If error_fn or warning_fn is NULL, the
1637 * default function will be used.
1638 */
1639
1640PNG_EXPORT(75, void, png_set_error_fn,
1642 png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn));
1643
1644/* Return the user pointer associated with the error functions */
1645PNG_EXPORT(76, png_voidp, png_get_error_ptr,
1647
1648/* Replace the default data output functions with a user supplied one(s).
1649 * If buffered output is not used, then output_flush_fn can be set to NULL.
1650 * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time
1651 * output_flush_fn will be ignored (and thus can be NULL).
1652 * It is probably a mistake to use NULL for output_flush_fn if
1653 * write_data_fn is not also NULL unless you have built libpng with
1654 * PNG_WRITE_FLUSH_SUPPORTED undefined, because in this case libpng's
1655 * default flush function, which uses the standard *FILE structure, will
1656 * be used.
1657 */
1658PNG_EXPORT(77, void, png_set_write_fn,
1660 png_voidp io_ptr,
1661 png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));
1662
1663/* Replace the default data input function with a user supplied one. */
1664PNG_EXPORT(78, void, png_set_read_fn,
1666 png_voidp io_ptr, png_rw_ptr read_data_fn));
1667
1668/* Return the user pointer associated with the I/O functions */
1671
1672PNG_EXPORT(80, void, png_set_read_status_fn,
1673 (png_structrp png_ptr, png_read_status_ptr read_row_fn));
1674
1675PNG_EXPORT(81, void, png_set_write_status_fn,
1676 (png_structrp png_ptr, png_write_status_ptr write_row_fn));
1678#ifdef PNG_USER_MEM_SUPPORTED
1679/* Replace the default memory allocation functions with user supplied one(s). */
1680PNG_EXPORT(82, void, png_set_mem_fn,
1682 png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn));
1683/* Return the user pointer associated with the memory functions */
1684PNG_EXPORT(83, png_voidp, png_get_mem_ptr,
1686#endif
1687
1688#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
1689PNG_EXPORT(84, void, png_set_read_user_transform_fn,
1690 (png_structrp png_ptr, png_user_transform_ptr read_user_transform_fn));
1691#endif
1692
1693#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
1694PNG_EXPORT(85, void, png_set_write_user_transform_fn,
1695 (png_structrp png_ptr, png_user_transform_ptr write_user_transform_fn));
1696#endif
1697
1698#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
1699PNG_EXPORT(86, void, png_set_user_transform_info,
1701 png_voidp user_transform_ptr,
1702 int user_transform_depth, int user_transform_channels));
1703/* Return the user pointer associated with the user transform functions */
1704PNG_EXPORT(87, png_voidp, png_get_user_transform_ptr,
1706#endif
1707
1708#ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED
1709/* Return information about the row currently being processed. Note that these
1710 * APIs do not fail but will return unexpected results if called outside a user
1711 * transform callback. Also note that when transforming an interlaced image the
1712 * row number is the row number within the sub-image of the interlace pass, so
1713 * the value will increase to the height of the sub-image (not the full image)
1714 * then reset to 0 for the next pass.
1715 *
1716 * Use PNG_ROW_FROM_PASS_ROW(row, pass) and PNG_COL_FROM_PASS_COL(col, pass) to
1717 * find the output pixel (x,y) given an interlaced sub-image pixel
1718 * (row,col,pass). (See below for these macros.)
1720PNG_EXPORT(217, png_uint_32, png_get_current_row_number,
1722PNG_EXPORT(218, png_byte, png_get_current_pass_number,
1724#endif
1725
1726#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
1727/* This callback is called only for *unknown* chunks. If
1728 * PNG_HANDLE_AS_UNKNOWN_SUPPORTED is set then it is possible to set known
1729 * chunks to be treated as unknown, however in this case the callback must do
1730 * any processing required by the chunk (e.g. by calling the appropriate
1731 * png_set_ APIs.)
1732 *
1733 * There is no write support - on write, by default, all the chunks in the
1734 * 'unknown' list are written in the specified position.
1735 *
1736 * The integer return from the callback function is interpreted thus:
1737 *
1738 * negative: An error occurred; png_chunk_error will be called.
1739 * zero: The chunk was not handled, the chunk will be saved. A critical
1740 * chunk will cause an error at this point unless it is to be saved.
1741 * positive: The chunk was handled, libpng will ignore/discard it.
1742 *
1743 * See "INTERACTION WITH USER CHUNK CALLBACKS" below for important notes about
1744 * how this behavior will change in libpng 1.7
1745 */
1746PNG_EXPORT(88, void, png_set_read_user_chunk_fn,
1748 png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn));
1749#endif
1750
1751#ifdef PNG_USER_CHUNKS_SUPPORTED
1752PNG_EXPORT(89, png_voidp, png_get_user_chunk_ptr,
1754#endif
1755
1756#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
1757/* Sets the function callbacks for the push reader, and a pointer to a
1758 * user-defined structure available to the callback functions.
1759 */
1760PNG_EXPORT(90, void, png_set_progressive_read_fn,
1762 png_voidp progressive_ptr, png_progressive_info_ptr info_fn,
1763 png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn));
1764
1765/* Returns the user pointer associated with the push read functions */
1766PNG_EXPORT(91, png_voidp, png_get_progressive_ptr,
1768
1769/* Function to be called when data becomes available */
1770PNG_EXPORT(92, void, png_process_data,
1773
1774/* A function which may be called *only* within png_process_data to stop the
1775 * processing of any more data. The function returns the number of bytes
1776 * remaining, excluding any that libpng has cached internally. A subsequent
1777 * call to png_process_data must supply these bytes again. If the argument
1778 * 'save' is set to true the routine will first save all the pending data and
1779 * will always return 0.
1780 */
1781PNG_EXPORT(219, size_t, png_process_data_pause,
1782 (png_structrp, int save));
1783
1784/* A function which may be called *only* outside (after) a call to
1785 * png_process_data. It returns the number of bytes of data to skip in the
1786 * input. Normally it will return 0, but if it returns a non-zero value the
1787 * application must skip than number of bytes of input data and pass the
1788 * following data to the next call to png_process_data.
1789 */
1790PNG_EXPORT(220, png_uint_32, png_process_data_skip,
1791 (png_structrp));
1792
1793/* Function that combines rows. 'new_row' is a flag that should come from
1794 * the callback and be non-NULL if anything needs to be done; the library
1795 * stores its own version of the new data internally and ignores the passed
1796 * in value.
1797 */
1798PNG_EXPORT(93, void, png_progressive_combine_row,
1800 png_bytep old_row, png_const_bytep new_row));
1801#endif /* PROGRESSIVE_READ */
1802
1803PNG_EXPORTA(94, png_voidp, png_malloc,
1806/* Added at libpng version 1.4.0 */
1807PNG_EXPORTA(95, png_voidp, png_calloc,
1810
1811/* Added at libpng version 1.2.4 */
1812PNG_EXPORTA(96, png_voidp, png_malloc_warn,
1815
1816/* Frees a pointer allocated by png_malloc() */
1817PNG_EXPORT(97, void, png_free,
1819
1820/* Free data that was allocated internally */
1821PNG_EXPORT(98, void, png_free_data,
1823 png_uint_32 free_me, int num));
1824
1825/* Reassign the responsibility for freeing existing data, whether allocated
1826 * by libpng or by the application; this works on the png_info structure passed
1827 * in, without changing the state for other png_info structures.
1828 */
1829PNG_EXPORT(99, void, png_data_freer,
1831 int freer, png_uint_32 mask));
1833/* Assignments for png_data_freer */
1834#define PNG_DESTROY_WILL_FREE_DATA 1
1835#define PNG_SET_WILL_FREE_DATA 1
1836#define PNG_USER_WILL_FREE_DATA 2
1837/* Flags for png_ptr->free_me and info_ptr->free_me */
1838#define PNG_FREE_HIST 0x0008U
1839#define PNG_FREE_ICCP 0x0010U
1840#define PNG_FREE_SPLT 0x0020U
1841#define PNG_FREE_ROWS 0x0040U
1842#define PNG_FREE_PCAL 0x0080U
1843#define PNG_FREE_SCAL 0x0100U
1844#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
1845# define PNG_FREE_UNKN 0x0200U
1846#endif
1847/* PNG_FREE_LIST 0x0400U removed in 1.6.0 because it is ignored */
1848#define PNG_FREE_PLTE 0x1000U
1849#define PNG_FREE_TRNS 0x2000U
1850#define PNG_FREE_TEXT 0x4000U
1851#define PNG_FREE_EXIF 0x8000U /* Added at libpng-1.6.31 */
1852#define PNG_FREE_ALL 0xffffU
1853#define PNG_FREE_MUL 0x4220U /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
1854
1855#ifdef PNG_USER_MEM_SUPPORTED
1856PNG_EXPORTA(100, png_voidp, png_malloc_default,
1859PNG_EXPORTA(101, void, png_free_default,
1862#endif
1864#ifdef PNG_ERROR_TEXT_SUPPORTED
1865/* Fatal error in PNG image of libpng - can't continue */
1866PNG_EXPORTA(102, void, png_error,
1869
1870/* The same, but the chunk name is prepended to the error string. */
1871PNG_EXPORTA(103, void, png_chunk_error,
1873 PNG_NORETURN);
1874
1875#else
1876/* Fatal error in PNG image of libpng - can't continue */
1877PNG_EXPORTA(104, void, png_err,
1879 PNG_NORETURN);
1880# define png_error(s1,s2) png_err(s1)
1881# define png_chunk_error(s1,s2) png_err(s1)
1882#endif
1884#ifdef PNG_WARNINGS_SUPPORTED
1885/* Non-fatal error in libpng. Can continue, but may have a problem. */
1886PNG_EXPORT(105, void, png_warning,
1888
1889/* Non-fatal error in libpng, chunk name is prepended to message. */
1890PNG_EXPORT(106, void, png_chunk_warning,
1891 (png_const_structrp png_ptr, png_const_charp warning_message));
1892#else
1893# define png_warning(s1,s2) ((void)(s1))
1894# define png_chunk_warning(s1,s2) ((void)(s1))
1895#endif
1896
1897#ifdef PNG_BENIGN_ERRORS_SUPPORTED
1898/* Benign error in libpng. Can continue, but may have a problem.
1899 * User can choose whether to handle as a fatal error or as a warning. */
1900PNG_EXPORT(107, void, png_benign_error,
1901 (png_const_structrp png_ptr, png_const_charp warning_message));
1903#ifdef PNG_READ_SUPPORTED
1904/* Same, chunk name is prepended to message (only during read) */
1905PNG_EXPORT(108, void, png_chunk_benign_error,
1907#endif
1908
1909PNG_EXPORT(109, void, png_set_benign_errors,
1910 (png_structrp png_ptr, int allowed));
1911#else
1912# ifdef PNG_ALLOW_BENIGN_ERRORS
1913# define png_benign_error png_warning
1914# define png_chunk_benign_error png_chunk_warning
1915# else
1916# define png_benign_error png_error
1917# define png_chunk_benign_error png_chunk_error
1918# endif
1919#endif
1920
1921/* The png_set_<chunk> functions are for storing values in the png_info_struct.
1922 * Similarly, the png_get_<chunk> calls are used to read values from the
1923 * png_info_struct, either storing the parameters in the passed variables, or
1924 * setting pointers into the png_info_struct where the data is stored. The
1925 * png_get_<chunk> functions return a non-zero value if the data was available
1926 * in info_ptr, or return zero and do not change any of the parameters if the
1927 * data was not available.
1928 *
1929 * These functions should be used instead of directly accessing png_info
1930 * to avoid problems with future changes in the size and internal layout of
1931 * png_info_struct.
1932 */
1933/* Returns "flag" if chunk data is valid in info_ptr. */
1934PNG_EXPORT(110, png_uint_32, png_get_valid,
1936
1937/* Returns number of bytes needed to hold a transformed row. */
1938PNG_EXPORT(111, size_t, png_get_rowbytes,
1940
1941#ifdef PNG_INFO_IMAGE_SUPPORTED
1942/* Returns row_pointers, which is an array of pointers to scanlines that was
1943 * returned from png_read_png().
1944 */
1945PNG_EXPORT(112, png_bytepp, png_get_rows,
1947
1948/* Set row_pointers, which is an array of pointers to scanlines for use
1949 * by png_write_png().
1950 */
1951PNG_EXPORT(113, void, png_set_rows,
1953#endif
1954
1955/* Returns number of color channels in image. */
1956PNG_EXPORT(114, png_byte, png_get_channels,
1959#ifdef PNG_EASY_ACCESS_SUPPORTED
1960/* Returns image width in pixels. */
1961PNG_EXPORT(115, png_uint_32, png_get_image_width,
1963
1964/* Returns image height in pixels. */
1965PNG_EXPORT(116, png_uint_32, png_get_image_height,
1967
1968/* Returns image bit_depth. */
1969PNG_EXPORT(117, png_byte, png_get_bit_depth,
1971
1972/* Returns image color_type. */
1973PNG_EXPORT(118, png_byte, png_get_color_type,
1975
1976/* Returns image filter_type. */
1977PNG_EXPORT(119, png_byte, png_get_filter_type,
1979
1980/* Returns image interlace_type. */
1981PNG_EXPORT(120, png_byte, png_get_interlace_type,
1983
1984/* Returns image compression_type. */
1985PNG_EXPORT(121, png_byte, png_get_compression_type,
1987
1988/* Returns image resolution in pixels per meter, from pHYs chunk data. */
1989PNG_EXPORT(122, png_uint_32, png_get_pixels_per_meter,
1991PNG_EXPORT(123, png_uint_32, png_get_x_pixels_per_meter,
1993PNG_EXPORT(124, png_uint_32, png_get_y_pixels_per_meter,
1995
1996/* Returns pixel aspect ratio, computed from pHYs chunk data. */
1997PNG_FP_EXPORT(125, float, png_get_pixel_aspect_ratio,
2001
2002/* Returns image x, y offset in pixels or microns, from oFFs chunk data. */
2003PNG_EXPORT(126, png_int_32, png_get_x_offset_pixels,
2005PNG_EXPORT(127, png_int_32, png_get_y_offset_pixels,
2007PNG_EXPORT(128, png_int_32, png_get_x_offset_microns,
2009PNG_EXPORT(129, png_int_32, png_get_y_offset_microns,
2011
2012#endif /* EASY_ACCESS */
2014#ifdef PNG_READ_SUPPORTED
2015/* Returns pointer to signature string read from PNG header */
2016PNG_EXPORT(130, png_const_bytep, png_get_signature,
2018#endif
2019
2020#ifdef PNG_bKGD_SUPPORTED
2021PNG_EXPORT(131, png_uint_32, png_get_bKGD,
2023 png_color_16p *background));
2024#endif
2025
2026#ifdef PNG_bKGD_SUPPORTED
2027PNG_EXPORT(132, void, png_set_bKGD,
2029 png_const_color_16p background));
2030#endif
2031
2032#ifdef PNG_cHRM_SUPPORTED
2033PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM,
2035 double *white_x, double *white_y,
2036 double *red_x, double *red_y,
2037 double *green_x, double *green_y,
2038 double *blue_x, double *blue_y))
2041 double *red_X, double *red_Y, double *red_Z,
2042 double *green_X, double *green_Y, double *green_Z,
2043 double *blue_X, double *blue_Y, double *blue_Z))
2044PNG_FIXED_EXPORT(134, png_uint_32, png_get_cHRM_fixed,
2057 png_fixed_point *int_blue_Z))
2058#endif
2059
2060#ifdef PNG_cHRM_SUPPORTED
2061PNG_FP_EXPORT(135, void, png_set_cHRM,
2063 double white_x, double white_y,
2064 double red_x, double red_y,
2065 double green_x, double green_y,
2066 double blue_x, double blue_y))
2069 double red_X, double red_Y, double red_Z,
2070 double green_X, double green_Y, double green_Z,
2071 double blue_X, double blue_Y, double blue_Z))
2072PNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed,
2085 png_fixed_point int_blue_Z))
2086#endif
2087
2088#ifdef PNG_cICP_SUPPORTED
2089PNG_EXPORT(250, png_uint_32, png_get_cICP,
2091 png_bytep colour_primaries, png_bytep transfer_function,
2092 png_bytep matrix_coefficients, png_bytep video_full_range_flag));
2093#endif
2094
2095#ifdef PNG_cICP_SUPPORTED
2096PNG_EXPORT(251, void, png_set_cICP,
2098 png_byte colour_primaries, png_byte transfer_function,
2099 png_byte matrix_coefficients, png_byte video_full_range_flag));
2100#endif
2101
2102#ifdef PNG_cLLI_SUPPORTED
2103PNG_FP_EXPORT(252, png_uint_32, png_get_cLLI,
2105 double *maximum_content_light_level,
2106 double *maximum_frame_average_light_level))
2109 /* The values below are in cd/m2 (nits) and are scaled by 10,000; not
2110 * 100,000 as in the case of png_fixed_point.
2111 */
2113 png_uint_32p maximum_frame_average_light_level_scaled_by_10000))
2114#endif
2115
2116#ifdef PNG_cLLI_SUPPORTED
2117PNG_FP_EXPORT(254, void, png_set_cLLI,
2119 double maximum_content_light_level,
2120 double maximum_frame_average_light_level))
2123 /* The values below are in cd/m2 (nits) and are scaled by 10,000; not
2124 * 100,000 as in the case of png_fixed_point.
2125 */
2127 png_uint_32 maximum_frame_average_light_level_scaled_by_10000))
2128#endif
2129
2130#ifdef PNG_eXIf_SUPPORTED
2131PNG_EXPORT(246, png_uint_32, png_get_eXIf,
2133PNG_EXPORT(247, void, png_set_eXIf,
2135
2136PNG_EXPORT(248, png_uint_32, png_get_eXIf_1,
2138 png_uint_32 *num_exif, png_bytep *exif));
2139PNG_EXPORT(249, void, png_set_eXIf_1,
2141 png_uint_32 num_exif, png_bytep exif));
2142#endif
2143
2144#ifdef PNG_gAMA_SUPPORTED
2145PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA,
2147 double *file_gamma))
2150 png_fixed_point *int_file_gamma))
2151#endif
2152
2153#ifdef PNG_gAMA_SUPPORTED
2154PNG_FP_EXPORT(139, void, png_set_gAMA,
2156 double file_gamma))
2159 png_fixed_point int_file_gamma))
2160#endif
2161
2162#ifdef PNG_hIST_SUPPORTED
2163PNG_EXPORT(141, png_uint_32, png_get_hIST,
2165PNG_EXPORT(142, void, png_set_hIST,
2167#endif
2168
2169PNG_EXPORT(143, png_uint_32, png_get_IHDR,
2172 int *bit_depth, int *color_type,
2173 int *interlace_method, int *compression_method, int *filter_method));
2174
2175PNG_EXPORT(144, void, png_set_IHDR,
2178 int bit_depth, int color_type,
2179 int interlace_method, int compression_method, int filter_method));
2180
2181#ifdef PNG_mDCV_SUPPORTED
2182PNG_FP_EXPORT(256, png_uint_32, png_get_mDCV,
2184 /* The chromaticities of the mastering display. As cHRM, but independent of
2185 * the encoding endpoints in cHRM, or cICP, or iCCP. These values will
2186 * always be in the range 0 to 1.3107.
2187 */
2188 double *white_x, double *white_y,
2189 double *red_x, double *red_y,
2190 double *green_x, double *green_y,
2191 double *blue_x, double *blue_y,
2192 /* Mastering display luminance in cd/m2 (nits). */
2193 double *mastering_display_maximum_luminance,
2194 double *mastering_display_minimum_luminance))
2202 /* Mastering display luminance in cd/m2 (nits) multiplied (scaled) by
2203 * 10,000.
2204 */
2206 png_uint_32p mastering_display_minimum_luminance_scaled_by_10000))
2207#endif
2208
2209#ifdef PNG_mDCV_SUPPORTED
2210PNG_FP_EXPORT(258, void, png_set_mDCV,
2212 /* The chromaticities of the mastering display. As cHRM, but independent of
2213 * the encoding endpoints in cHRM, or cICP, or iCCP.
2214 */
2215 double white_x, double white_y,
2216 double red_x, double red_y,
2217 double green_x, double green_y,
2218 double blue_x, double blue_y,
2219 /* Mastering display luminance in cd/m2 (nits). */
2220 double mastering_display_maximum_luminance,
2221 double mastering_display_minimum_luminance))
2222
2225 /* The admissible range of these values is not the full range of a PNG
2226 * fixed point value. Negative values cannot be encoded and the maximum
2227 * value is about 1.3 */
2232 /* These are PNG unsigned 4 byte values: 31-bit unsigned values. The MSB
2233 * must be zero.
2234 */
2236 png_uint_32 mastering_display_minimum_luminance_scaled_by_10000))
2237#endif
2238
2239#ifdef PNG_oFFs_SUPPORTED
2240PNG_EXPORT(145, png_uint_32, png_get_oFFs,
2242 png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type));
2243#endif
2244
2245#ifdef PNG_oFFs_SUPPORTED
2246PNG_EXPORT(146, void, png_set_oFFs,
2248 png_int_32 offset_x, png_int_32 offset_y, int unit_type));
2249#endif
2250
2251#ifdef PNG_pCAL_SUPPORTED
2252PNG_EXPORT(147, png_uint_32, png_get_pCAL,
2254 png_charp *purpose, png_int_32 *X0, png_int_32 *X1,
2255 int *type, int *nparams, png_charp *units, png_charpp *params));
2256#endif
2257
2258#ifdef PNG_pCAL_SUPPORTED
2259PNG_EXPORT(148, void, png_set_pCAL,
2261 png_const_charp purpose, png_int_32 X0, png_int_32 X1,
2262 int type, int nparams, png_const_charp units, png_charpp params));
2263#endif
2264
2265#ifdef PNG_pHYs_SUPPORTED
2266PNG_EXPORT(149, png_uint_32, png_get_pHYs,
2268 png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
2269#endif
2270
2271#ifdef PNG_pHYs_SUPPORTED
2272PNG_EXPORT(150, void, png_set_pHYs,
2274 png_uint_32 res_x, png_uint_32 res_y, int unit_type));
2275#endif
2276
2277PNG_EXPORT(151, png_uint_32, png_get_PLTE,
2279 png_colorp *palette, int *num_palette));
2280
2281PNG_EXPORT(152, void, png_set_PLTE,
2283 png_const_colorp palette, int num_palette));
2284
2285#ifdef PNG_sBIT_SUPPORTED
2286PNG_EXPORT(153, png_uint_32, png_get_sBIT,
2288 png_color_8p *sig_bit));
2289#endif
2290
2291#ifdef PNG_sBIT_SUPPORTED
2292PNG_EXPORT(154, void, png_set_sBIT,
2294 png_const_color_8p sig_bit));
2295#endif
2296
2297#ifdef PNG_sRGB_SUPPORTED
2298PNG_EXPORT(155, png_uint_32, png_get_sRGB,
2300 int *file_srgb_intent));
2301#endif
2302
2303#ifdef PNG_sRGB_SUPPORTED
2304PNG_EXPORT(156, void, png_set_sRGB,
2305 (png_const_structrp png_ptr, png_inforp info_ptr, int srgb_intent));
2306PNG_EXPORT(157, void, png_set_sRGB_gAMA_and_cHRM,
2307 (png_const_structrp png_ptr, png_inforp info_ptr, int srgb_intent));
2308#endif
2309
2310#ifdef PNG_iCCP_SUPPORTED
2311PNG_EXPORT(158, png_uint_32, png_get_iCCP,
2313 png_charpp name, int *compression_type,
2314 png_bytepp profile, png_uint_32 *proflen));
2315#endif
2316
2317#ifdef PNG_iCCP_SUPPORTED
2318PNG_EXPORT(159, void, png_set_iCCP,
2320 png_const_charp name, int compression_type,
2322#endif
2323
2324#ifdef PNG_sPLT_SUPPORTED
2325PNG_EXPORT(160, int, png_get_sPLT,
2327 png_sPLT_tpp entries));
2328#endif
2329
2330#ifdef PNG_sPLT_SUPPORTED
2331PNG_EXPORT(161, void, png_set_sPLT,
2333 png_const_sPLT_tp entries, int nentries));
2334#endif
2336#ifdef PNG_TEXT_SUPPORTED
2337/* png_get_text also returns the number of text chunks in *num_text */
2338PNG_EXPORT(162, int, png_get_text,
2340 png_textp *text_ptr, int *num_text));
2341#endif
2342
2343/* Note while png_set_text() will accept a structure whose text,
2344 * language, and translated keywords are NULL pointers, the structure
2345 * returned by png_get_text will always contain regular
2346 * zero-terminated C strings. They might be empty strings but
2347 * they will never be NULL pointers.
2349
2350#ifdef PNG_TEXT_SUPPORTED
2351PNG_EXPORT(163, void, png_set_text,
2353 png_const_textp text_ptr, int num_text));
2354#endif
2355
2356#ifdef PNG_tIME_SUPPORTED
2357PNG_EXPORT(164, png_uint_32, png_get_tIME,
2359 png_timep *mod_time));
2360#endif
2361
2362#ifdef PNG_tIME_SUPPORTED
2363PNG_EXPORT(165, void, png_set_tIME,
2365 png_const_timep mod_time));
2366#endif
2367
2368#ifdef PNG_tRNS_SUPPORTED
2369PNG_EXPORT(166, png_uint_32, png_get_tRNS,
2371 png_bytep *trans_alpha, int *num_trans,
2372 png_color_16p *trans_color));
2373#endif
2374
2375#ifdef PNG_tRNS_SUPPORTED
2376PNG_EXPORT(167, void, png_set_tRNS,
2378 png_const_bytep trans_alpha, int num_trans,
2379 png_const_color_16p trans_color));
2380#endif
2381
2382#ifdef PNG_sCAL_SUPPORTED
2383PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL,
2385 int *unit, double *width, double *height))
2386#if defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) || \
2387 defined(PNG_FLOATING_POINT_SUPPORTED)
2388/* NOTE: this API is currently implemented using floating point arithmetic,
2389 * consequently it can only be used on systems with floating point support.
2390 * In any case the range of values supported by png_fixed_point is small and it
2391 * is highly recommended that png_get_sCAL_s be used instead.
2396#endif
2397PNG_EXPORT(169, png_uint_32, png_get_sCAL_s,
2399 int *unit, png_charpp swidth, png_charpp sheight));
2400
2401PNG_FP_EXPORT(170, void, png_set_sCAL,
2403 int unit, double width, double height))
2407PNG_EXPORT(171, void, png_set_sCAL_s,
2409 int unit, png_const_charp swidth, png_const_charp sheight));
2410#endif /* sCAL */
2411
2412#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
2413/* Provide the default handling for all unknown chunks or, optionally, for
2414 * specific unknown chunks.
2415 *
2416 * NOTE: prior to 1.6.0 the handling specified for particular chunks on read was
2417 * ignored and the default was used, the per-chunk setting only had an effect on
2418 * write. If you wish to have chunk-specific handling on read in code that must
2419 * work on earlier versions you must use a user chunk callback to specify the
2420 * desired handling (keep or discard.)
2421 *
2422 * The 'keep' parameter is a PNG_HANDLE_CHUNK_ value as listed below. The
2423 * parameter is interpreted as follows:
2424 *
2425 * READ:
2426 * PNG_HANDLE_CHUNK_AS_DEFAULT:
2427 * Known chunks: do normal libpng processing, do not keep the chunk (but
2428 * see the comments below about PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
2429 * Unknown chunks: for a specific chunk use the global default, when used
2430 * as the default discard the chunk data.
2431 * PNG_HANDLE_CHUNK_NEVER:
2432 * Discard the chunk data.
2433 * PNG_HANDLE_CHUNK_IF_SAFE:
2434 * Keep the chunk data if the chunk is not critical else raise a chunk
2435 * error.
2436 * PNG_HANDLE_CHUNK_ALWAYS:
2437 * Keep the chunk data.
2438 *
2439 * If the chunk data is saved it can be retrieved using png_get_unknown_chunks,
2440 * below. Notice that specifying "AS_DEFAULT" as a global default is equivalent
2441 * to specifying "NEVER", however when "AS_DEFAULT" is used for specific chunks
2442 * it simply resets the behavior to the libpng default.
2443 *
2444 * INTERACTION WITH USER CHUNK CALLBACKS:
2445 * The per-chunk handling is always used when there is a png_user_chunk_ptr
2446 * callback and the callback returns 0; the chunk is then always stored *unless*
2447 * it is critical and the per-chunk setting is other than ALWAYS. Notice that
2448 * the global default is *not* used in this case. (In effect the per-chunk
2449 * value is incremented to at least IF_SAFE.)
2450 *
2451 * IMPORTANT NOTE: this behavior will change in libpng 1.7 - the global and
2452 * per-chunk defaults will be honored. If you want to preserve the current
2453 * behavior when your callback returns 0 you must set PNG_HANDLE_CHUNK_IF_SAFE
2454 * as the default - if you don't do this libpng 1.6 will issue a warning.
2455 *
2456 * If you want unhandled unknown chunks to be discarded in libpng 1.6 and
2457 * earlier simply return '1' (handled).
2458 *
2459 * PNG_HANDLE_AS_UNKNOWN_SUPPORTED:
2460 * If this is *not* set known chunks will always be handled by libpng and
2461 * will never be stored in the unknown chunk list. Known chunks listed to
2462 * png_set_keep_unknown_chunks will have no effect. If it is set then known
2463 * chunks listed with a keep other than AS_DEFAULT will *never* be processed
2464 * by libpng, in addition critical chunks must either be processed by the
2465 * callback or saved.
2466 *
2467 * The IHDR and IEND chunks must not be listed. Because this turns off the
2468 * default handling for chunks that would otherwise be recognized the
2469 * behavior of libpng transformations may well become incorrect!
2470 *
2471 * WRITE:
2472 * When writing chunks the options only apply to the chunks specified by
2473 * png_set_unknown_chunks (below), libpng will *always* write known chunks
2474 * required by png_set_ calls and will always write the core critical chunks
2475 * (as required for PLTE).
2476 *
2477 * Each chunk in the png_set_unknown_chunks list is looked up in the
2478 * png_set_keep_unknown_chunks list to find the keep setting, this is then
2479 * interpreted as follows:
2480 *
2481 * PNG_HANDLE_CHUNK_AS_DEFAULT:
2482 * Write safe-to-copy chunks and write other chunks if the global
2483 * default is set to _ALWAYS, otherwise don't write this chunk.
2484 * PNG_HANDLE_CHUNK_NEVER:
2485 * Do not write the chunk.
2486 * PNG_HANDLE_CHUNK_IF_SAFE:
2487 * Write the chunk if it is safe-to-copy, otherwise do not write it.
2488 * PNG_HANDLE_CHUNK_ALWAYS:
2489 * Write the chunk.
2490 *
2491 * Note that the default behavior is effectively the opposite of the read case -
2492 * in read unknown chunks are not stored by default, in write they are written
2493 * by default. Also the behavior of PNG_HANDLE_CHUNK_IF_SAFE is very different
2494 * - on write the safe-to-copy bit is checked, on read the critical bit is
2495 * checked and on read if the chunk is critical an error will be raised.
2496 *
2497 * num_chunks:
2498 * ===========
2499 * If num_chunks is positive, then the "keep" parameter specifies the manner
2500 * for handling only those chunks appearing in the chunk_list array,
2501 * otherwise the chunk list array is ignored.
2502 *
2503 * If num_chunks is 0 the "keep" parameter specifies the default behavior for
2504 * unknown chunks, as described above.
2505 *
2506 * If num_chunks is negative, then the "keep" parameter specifies the manner
2507 * for handling all unknown chunks plus all chunks recognized by libpng
2508 * except for the IHDR, PLTE, tRNS, IDAT, and IEND chunks (which continue to
2509 * be processed by libpng.
2510 */
2511#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
2512PNG_EXPORT(172, void, png_set_keep_unknown_chunks,
2514 int keep, png_const_bytep chunk_list, int num_chunks));
2515#endif /* HANDLE_AS_UNKNOWN */
2516
2517/* The "keep" PNG_HANDLE_CHUNK_ parameter for the specified chunk is returned;
2518 * the result is therefore true (non-zero) if special handling is required,
2519 * false for the default handling.
2520 */
2521PNG_EXPORT(173, int, png_handle_as_unknown,
2523#endif /* SET_UNKNOWN_CHUNKS */
2524
2525#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
2526PNG_EXPORT(174, void, png_set_unknown_chunks,
2528 png_const_unknown_chunkp unknowns, int num_unknowns));
2529 /* NOTE: prior to 1.6.0 this routine set the 'location' field of the added
2530 * unknowns to the location currently stored in the png_struct. This is
2531 * invariably the wrong value on write. To fix this call the following API
2532 * for each chunk in the list with the correct location. If you know your
2533 * code won't be compiled on earlier versions you can rely on
2534 * png_set_unknown_chunks(write-ptr, png_get_unknown_chunks(read-ptr)) doing
2535 * the correct thing.
2536 */
2537
2538PNG_EXPORT(175, void, png_set_unknown_chunk_location,
2540 int chunk, int location));
2541
2542PNG_EXPORT(176, int, png_get_unknown_chunks,
2544 png_unknown_chunkpp entries));
2545#endif
2546
2547/* Png_free_data() will turn off the "valid" flag for anything it frees.
2548 * If you need to turn it off for a chunk that your application has freed,
2549 * you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK);
2550 */
2551PNG_EXPORT(177, void, png_set_invalid,
2553
2554#ifdef PNG_INFO_IMAGE_SUPPORTED
2555/* The "params" pointer is currently not used and is for future expansion. */
2556#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
2557PNG_EXPORT(178, void, png_read_png,
2559 int transforms, png_voidp params));
2560#endif
2561#ifdef PNG_WRITE_SUPPORTED
2562PNG_EXPORT(179, void, png_write_png,
2564 int transforms, png_voidp params));
2565#endif
2566#endif
2576
2577#ifdef PNG_MNG_FEATURES_SUPPORTED
2578PNG_EXPORT(184, png_uint_32, png_permit_mng_features,
2579 (png_structrp png_ptr, png_uint_32 mng_features_permitted));
2580#endif
2582/* For use in png_set_keep_unknown, added to version 1.2.6 */
2583#define PNG_HANDLE_CHUNK_AS_DEFAULT 0
2584#define PNG_HANDLE_CHUNK_NEVER 1
2585#define PNG_HANDLE_CHUNK_IF_SAFE 2
2586#define PNG_HANDLE_CHUNK_ALWAYS 3
2587#define PNG_HANDLE_CHUNK_LAST 4
2588
2589/* Strip the prepended error numbers ("#nnn ") from error and warning
2590 * messages before passing them to the error or warning handler.
2591 */
2592#ifdef PNG_ERROR_NUMBERS_SUPPORTED
2593PNG_EXPORT(185, void, png_set_strip_error_numbers,
2594 (png_structrp png_ptr, png_uint_32 strip_mode));
2595#endif
2597/* Added in libpng-1.2.6 */
2598#ifdef PNG_SET_USER_LIMITS_SUPPORTED
2599PNG_EXPORT(186, void, png_set_user_limits,
2601 png_uint_32 user_width_max, png_uint_32 user_height_max));
2602PNG_EXPORT(187, png_uint_32, png_get_user_width_max,
2604PNG_EXPORT(188, png_uint_32, png_get_user_height_max,
2606/* Added in libpng-1.4.0 */
2607PNG_EXPORT(189, void, png_set_chunk_cache_max,
2608 (png_structrp png_ptr, png_uint_32 user_chunk_cache_max));
2609PNG_EXPORT(190, png_uint_32, png_get_chunk_cache_max,
2611/* Added in libpng-1.4.1 */
2612PNG_EXPORT(191, void, png_set_chunk_malloc_max,
2613 (png_structrp png_ptr, png_alloc_size_t user_chunk_cache_max));
2614PNG_EXPORT(192, png_alloc_size_t, png_get_chunk_malloc_max,
2616#endif
2617
2618#if defined(PNG_INCH_CONVERSIONS_SUPPORTED)
2619PNG_EXPORT(193, png_uint_32, png_get_pixels_per_inch,
2621
2622PNG_EXPORT(194, png_uint_32, png_get_x_pixels_per_inch,
2624
2625PNG_EXPORT(195, png_uint_32, png_get_y_pixels_per_inch,
2627
2628PNG_FP_EXPORT(196, float, png_get_x_offset_inches,
2630#ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */
2633#endif
2634
2635PNG_FP_EXPORT(197, float, png_get_y_offset_inches,
2637#ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */
2640#endif
2641
2642# ifdef PNG_pHYs_SUPPORTED
2643PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi,
2645 png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
2646# endif /* pHYs */
2647#endif /* INCH_CONVERSIONS */
2649/* Added in libpng-1.4.0 */
2650#ifdef PNG_IO_STATE_SUPPORTED
2651PNG_EXPORT(199, png_uint_32, png_get_io_state,
2653
2654/* Removed from libpng 1.6; use png_get_io_chunk_type. */
2655PNG_REMOVED(200, png_const_bytep, png_get_io_chunk_name,
2658
2662/* The flags returned by png_get_io_state() are the following: */
2663# define PNG_IO_NONE 0x0000 /* no I/O at this moment */
2664# define PNG_IO_READING 0x0001 /* currently reading */
2665# define PNG_IO_WRITING 0x0002 /* currently writing */
2666# define PNG_IO_SIGNATURE 0x0010 /* currently at the file signature */
2667# define PNG_IO_CHUNK_HDR 0x0020 /* currently at the chunk header */
2668# define PNG_IO_CHUNK_DATA 0x0040 /* currently at the chunk data */
2669# define PNG_IO_CHUNK_CRC 0x0080 /* currently at the chunk crc */
2670# define PNG_IO_MASK_OP 0x000f /* current operation: reading/writing */
2671# define PNG_IO_MASK_LOC 0x00f0 /* current location: sig/hdr/data/crc */
2672#endif /* IO_STATE */
2673
2674/* Interlace support. The following macros are always defined so that if
2675 * libpng interlace handling is turned off the macros may be used to handle
2676 * interlaced images within the application.
2677 */
2678#define PNG_INTERLACE_ADAM7_PASSES 7
2679
2680/* Two macros to return the first row and first column of the original,
2681 * full, image which appears in a given pass. 'pass' is in the range 0
2682 * to 6 and the result is in the range 0 to 7.
2683 */
2684#define PNG_PASS_START_ROW(pass) (((1&~(pass))<<(3-((pass)>>1)))&7)
2685#define PNG_PASS_START_COL(pass) (((1& (pass))<<(3-(((pass)+1)>>1)))&7)
2686
2687/* A macro to return the offset between pixels in the output row for a pair of
2688 * pixels in the input - effectively the inverse of the 'COL_SHIFT' macro that
2689 * follows. Note that ROW_OFFSET is the offset from one row to the next whereas
2690 * COL_OFFSET is from one column to the next, within a row.
2691 */
2692#define PNG_PASS_ROW_OFFSET(pass) ((pass)>2?(8>>(((pass)-1)>>1)):8)
2693#define PNG_PASS_COL_OFFSET(pass) (1<<((7-(pass))>>1))
2694
2695/* Two macros to help evaluate the number of rows or columns in each
2696 * pass. This is expressed as a shift - effectively log2 of the number or
2697 * rows or columns in each 8x8 tile of the original image.
2698 */
2699#define PNG_PASS_ROW_SHIFT(pass) ((pass)>2?(8-(pass))>>1:3)
2700#define PNG_PASS_COL_SHIFT(pass) ((pass)>1?(7-(pass))>>1:3)
2701
2702/* Hence two macros to determine the number of rows or columns in a given
2703 * pass of an image given its height or width. In fact these macros may
2704 * return non-zero even though the sub-image is empty, because the other
2705 * dimension may be empty for a small image.
2707#define PNG_PASS_ROWS(height, pass) (((height)+(((1<<PNG_PASS_ROW_SHIFT(pass))\
2708 -1)-PNG_PASS_START_ROW(pass)))>>PNG_PASS_ROW_SHIFT(pass))
2709#define PNG_PASS_COLS(width, pass) (((width)+(((1<<PNG_PASS_COL_SHIFT(pass))\
2710 -1)-PNG_PASS_START_COL(pass)))>>PNG_PASS_COL_SHIFT(pass))
2711
2712/* For the reader row callbacks (both progressive and sequential) it is
2713 * necessary to find the row in the output image given a row in an interlaced
2714 * image, so two more macros:
2716#define PNG_ROW_FROM_PASS_ROW(y_in, pass) \
2717 (((y_in)<<PNG_PASS_ROW_SHIFT(pass))+PNG_PASS_START_ROW(pass))
2718#define PNG_COL_FROM_PASS_COL(x_in, pass) \
2719 (((x_in)<<PNG_PASS_COL_SHIFT(pass))+PNG_PASS_START_COL(pass))
2720
2721/* Two macros which return a boolean (0 or 1) saying whether the given row
2722 * or column is in a particular pass. These use a common utility macro that
2723 * returns a mask for a given pass - the offset 'off' selects the row or
2724 * column version. The mask has the appropriate bit set for each column in
2725 * the tile.
2726 */
2727#define PNG_PASS_MASK(pass,off) ( \
2728 ((0x110145AF>>(((7-(off))-(pass))<<2)) & 0xF) | \
2729 ((0x01145AF0>>(((7-(off))-(pass))<<2)) & 0xF0))
2731#define PNG_ROW_IN_INTERLACE_PASS(y, pass) \
2732 ((PNG_PASS_MASK(pass,0) >> ((y)&7)) & 1)
2733#define PNG_COL_IN_INTERLACE_PASS(x, pass) \
2734 ((PNG_PASS_MASK(pass,1) >> ((x)&7)) & 1)
2735
2736#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
2737/* With these routines we avoid an integer divide, which will be slower on
2738 * most machines. However, it does take more operations than the corresponding
2739 * divide method, so it may be slower on a few RISC systems. There are two
2740 * shifts (by 8 or 16 bits) and an addition, versus a single integer divide.
2741 *
2742 * Note that the rounding factors are NOT supposed to be the same! 128 and
2743 * 32768 are correct for the NODIV code; 127 and 32767 are correct for the
2744 * standard method.
2745 *
2746 * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ]
2747 */
2749 /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */
2750
2751# define png_composite(composite, fg, alpha, bg) \
2752 { \
2753 png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \
2754 * (png_uint_16)(alpha) \
2755 + (png_uint_16)(bg)*(png_uint_16)(255 \
2756 - (png_uint_16)(alpha)) + 128); \
2757 (composite) = (png_byte)(((temp + (temp >> 8)) >> 8) & 0xff); \
2758 }
2759
2760# define png_composite_16(composite, fg, alpha, bg) \
2761 { \
2762 png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \
2763 * (png_uint_32)(alpha) \
2764 + (png_uint_32)(bg)*(65535 \
2765 - (png_uint_32)(alpha)) + 32768); \
2766 (composite) = (png_uint_16)(0xffff & ((temp + (temp >> 16)) >> 16)); \
2767 }
2768
2769#else /* Standard method using integer division */
2770
2771# define png_composite(composite, fg, alpha, bg) \
2772 (composite) = \
2773 (png_byte)(0xff & (((png_uint_16)(fg) * (png_uint_16)(alpha) + \
2774 (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
2775 127) / 255))
2776
2777# define png_composite_16(composite, fg, alpha, bg) \
2778 (composite) = \
2779 (png_uint_16)(0xffff & (((png_uint_32)(fg) * (png_uint_32)(alpha) + \
2780 (png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) + \
2781 32767) / 65535))
2782#endif /* READ_COMPOSITE_NODIV */
2783
2784#ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED
2787PNG_EXPORT(202, png_uint_16, png_get_uint_16,
2789PNG_EXPORT(203, png_int_32, png_get_int_32,
2791#endif
2792
2793PNG_EXPORT(204, png_uint_32, png_get_uint_31,
2795/* No png_get_int_16 -- may be added if there's a real need for it. */
2797/* Place a 32-bit number into a buffer in PNG byte order (big-endian). */
2798#ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED
2799PNG_EXPORT(205, void, png_save_uint_32,
2801#endif
2802#ifdef PNG_SAVE_INT_32_SUPPORTED
2803PNG_EXPORT(206, void, png_save_int_32,
2804 (png_bytep buf, png_int_32 i));
2805#endif
2806
2807/* Place a 16-bit number into a buffer in PNG byte order.
2808 * The parameter is declared unsigned int, not png_uint_16,
2809 * just to avoid potential problems on pre-ANSI C compilers.
2810 */
2811#ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED
2812PNG_EXPORT(207, void, png_save_uint_16,
2813 (png_bytep buf, unsigned int i));
2814/* No png_save_int_16 -- may be added if there's a real need for it. */
2815#endif
2816
2817#ifdef PNG_USE_READ_MACROS
2818/* Inline macros to do direct reads of bytes from the input buffer.
2819 * The png_get_int_32() routine assumes we are using two's complement
2820 * format for negative values, which is almost certainly true.
2821 */
2822# define PNG_get_uint_32(buf) \
2823 (((png_uint_32)(*(buf)) << 24) + \
2824 ((png_uint_32)(*((buf) + 1)) << 16) + \
2825 ((png_uint_32)(*((buf) + 2)) << 8) + \
2826 ((png_uint_32)(*((buf) + 3))))
2827
2828 /* From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
2829 * function) incorrectly returned a value of type png_uint_32.
2830 */
2831# define PNG_get_uint_16(buf) \
2832 ((png_uint_16) \
2833 (((unsigned int)(*(buf)) << 8) + \
2834 ((unsigned int)(*((buf) + 1)))))
2835
2836# define PNG_get_int_32(buf) \
2837 ((png_int_32)((*(buf) & 0x80) \
2838 ? -((png_int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \
2839 : (png_int_32)png_get_uint_32(buf)))
2840
2841/* If PNG_PREFIX is defined the same thing as below happens in pnglibconf.h,
2842 * but defining a macro name prefixed with PNG_PREFIX.
2844# ifndef PNG_PREFIX
2845# define png_get_uint_32(buf) PNG_get_uint_32(buf)
2846# define png_get_uint_16(buf) PNG_get_uint_16(buf)
2847# define png_get_int_32(buf) PNG_get_int_32(buf)
2848# endif
2849#else
2850# ifdef PNG_PREFIX
2851 /* No macros; revert to the (redefined) function */
2852# define PNG_get_uint_32 (png_get_uint_32)
2853# define PNG_get_uint_16 (png_get_uint_16)
2854# define PNG_get_int_32 (png_get_int_32)
2855# endif
2856#endif
2857
2858#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
2859PNG_EXPORT(242, void, png_set_check_for_invalid_index,
2860 (png_structrp png_ptr, int allowed));
2861# ifdef PNG_GET_PALETTE_MAX_SUPPORTED
2862PNG_EXPORT(243, int, png_get_palette_max,
2864# endif
2865#endif /* CHECK_FOR_INVALID_INDEX */
2866
2867/*******************************************************************************
2868 * Section 5: SIMPLIFIED API
2869 *******************************************************************************
2870 *
2871 * Please read the documentation in libpng-manual.txt (TODO: write said
2872 * documentation) if you don't understand what follows.
2873 *
2874 * The simplified API hides the details of both libpng and the PNG file format
2875 * itself. It allows PNG files to be read into a very limited number of
2876 * in-memory bitmap formats or to be written from the same formats. If these
2877 * formats do not accommodate your needs then you can, and should, use the more
2878 * sophisticated APIs above - these support a wide variety of in-memory formats
2879 * and a wide variety of sophisticated transformations to those formats as well
2880 * as a wide variety of APIs to manipulate ancillary information.
2881 *
2882 * To read a PNG file using the simplified API:
2883 *
2884 * 1) Declare a 'png_image' structure (see below) on the stack, set the
2885 * version field to PNG_IMAGE_VERSION and the 'opaque' pointer to NULL
2886 * (this is REQUIRED, your program may crash if you don't do it.)
2887 * 2) Call the appropriate png_image_begin_read... function.
2888 * 3) Set the png_image 'format' member to the required sample format.
2889 * 4) Allocate a buffer for the image and, if required, the color-map.
2890 * 5) Call png_image_finish_read to read the image and, if required, the
2891 * color-map into your buffers.
2892 *
2893 * There are no restrictions on the format of the PNG input itself; all valid
2894 * color types, bit depths, and interlace methods are acceptable, and the
2895 * input image is transformed as necessary to the requested in-memory format
2896 * during the png_image_finish_read() step. The only caveat is that if you
2897 * request a color-mapped image from a PNG that is full-color or makes
2898 * complex use of an alpha channel the transformation is extremely lossy and the
2899 * result may look terrible.
2900 *
2901 * To write a PNG file using the simplified API:
2902 *
2903 * 1) Declare a 'png_image' structure on the stack and memset() it to all zero.
2904 * 2) Initialize the members of the structure that describe the image, setting
2905 * the 'format' member to the format of the image samples.
2906 * 3) Call the appropriate png_image_write... function with a pointer to the
2907 * image and, if necessary, the color-map to write the PNG data.
2908 *
2909 * png_image is a structure that describes the in-memory format of an image
2910 * when it is being read or defines the in-memory format of an image that you
2911 * need to write:
2912 */
2913#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \
2914 defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
2916#define PNG_IMAGE_VERSION 1
2917
2918typedef struct png_control *png_controlp;
2919typedef struct
2921 png_controlp opaque; /* Initialize to NULL, free with png_image_free */
2922 png_uint_32 version; /* Set to PNG_IMAGE_VERSION */
2923 png_uint_32 width; /* Image width in pixels (columns) */
2924 png_uint_32 height; /* Image height in pixels (rows) */
2925 png_uint_32 format; /* Image format as defined below */
2926 png_uint_32 flags; /* A bit mask containing informational flags */
2927 png_uint_32 colormap_entries;
2928 /* Number of entries in the color-map */
2929
2930 /* In the event of an error or warning the following field will be set to a
2931 * non-zero value and the 'message' field will contain a '\0' terminated
2932 * string with the libpng error or warning message. If both warnings and
2933 * an error were encountered, only the error is recorded. If there
2934 * are multiple warnings, only the first one is recorded.
2935 *
2936 * The upper 30 bits of this value are reserved, the low two bits contain
2937 * a value as follows:
2938 */
2939# define PNG_IMAGE_WARNING 1
2940# define PNG_IMAGE_ERROR 2
2941 /*
2942 * The result is a two-bit code such that a value more than 1 indicates
2943 * a failure in the API just called:
2944 *
2945 * 0 - no warning or error
2946 * 1 - warning
2947 * 2 - error
2948 * 3 - error preceded by warning
2950# define PNG_IMAGE_FAILED(png_cntrl) ((((png_cntrl).warning_or_error)&0x03)>1)
2952 png_uint_32 warning_or_error;
2953
2954 char message[64];
2956
2957/* The samples of the image have one to four channels whose components have
2958 * original values in the range 0 to 1.0:
2959 *
2960 * 1: A single gray or luminance channel (G).
2961 * 2: A gray/luminance channel and an alpha channel (GA).
2962 * 3: Three red, green, blue color channels (RGB).
2963 * 4: Three color channels and an alpha channel (RGBA).
2964 *
2965 * The components are encoded in one of two ways:
2966 *
2967 * a) As a small integer, value 0..255, contained in a single byte. For the
2968 * alpha channel the original value is simply value/255. For the color or
2969 * luminance channels the value is encoded according to the sRGB specification
2970 * and matches the 8-bit format expected by typical display devices.
2971 *
2972 * The color/gray channels are not scaled (pre-multiplied) by the alpha
2973 * channel and are suitable for passing to color management software.
2974 *
2975 * b) As a value in the range 0..65535, contained in a 2-byte integer. All
2976 * channels can be converted to the original value by dividing by 65535; all
2977 * channels are linear. Color channels use the RGB encoding (RGB end-points) of
2978 * the sRGB specification. This encoding is identified by the
2979 * PNG_FORMAT_FLAG_LINEAR flag below.
2980 *
2981 * When the simplified API needs to convert between sRGB and linear colorspaces,
2982 * the actual sRGB transfer curve defined in the sRGB specification (see the
2983 * article at <https://en.wikipedia.org/wiki/SRGB>) is used, not the gamma=1/2.2
2984 * approximation used elsewhere in libpng.
2985 *
2986 * When an alpha channel is present it is expected to denote pixel coverage
2987 * of the color or luminance channels and is returned as an associated alpha
2988 * channel: the color/gray channels are scaled (pre-multiplied) by the alpha
2989 * value.
2990 *
2991 * The samples are either contained directly in the image data, between 1 and 8
2992 * bytes per pixel according to the encoding, or are held in a color-map indexed
2993 * by bytes in the image data. In the case of a color-map the color-map entries
2994 * are individual samples, encoded as above, and the image data has one byte per
2995 * pixel to select the relevant sample from the color-map.
2996 */
2997
2998/* PNG_FORMAT_*
2999 *
3000 * #defines to be used in png_image::format. Each #define identifies a
3001 * particular layout of sample data and, if present, alpha values. There are
3002 * separate defines for each of the two component encodings.
3003 *
3004 * A format is built up using single bit flag values. All combinations are
3005 * valid. Formats can be built up from the flag values or you can use one of
3006 * the predefined values below. When testing formats always use the FORMAT_FLAG
3007 * macros to test for individual features - future versions of the library may
3008 * add new flags.
3009 *
3010 * When reading or writing color-mapped images the format should be set to the
3011 * format of the entries in the color-map then png_image_{read,write}_colormap
3012 * called to read or write the color-map and set the format correctly for the
3013 * image data. Do not set the PNG_FORMAT_FLAG_COLORMAP bit directly!
3014 *
3015 * NOTE: libpng can be built with particular features disabled. If you see
3016 * compiler errors because the definition of one of the following flags has been
3017 * compiled out it is because libpng does not have the required support. It is
3018 * possible, however, for the libpng configuration to enable the format on just
3019 * read or just write; in that case you may see an error at run time. You can
3020 * guard against this by checking for the definition of the appropriate
3021 * "_SUPPORTED" macro, one of:
3023 * PNG_SIMPLIFIED_{READ,WRITE}_{BGR,AFIRST}_SUPPORTED
3025#define PNG_FORMAT_FLAG_ALPHA 0x01U /* format with an alpha channel */
3026#define PNG_FORMAT_FLAG_COLOR 0x02U /* color format: otherwise grayscale */
3027#define PNG_FORMAT_FLAG_LINEAR 0x04U /* 2-byte channels else 1-byte */
3028#define PNG_FORMAT_FLAG_COLORMAP 0x08U /* image data is color-mapped */
3029
3030#ifdef PNG_FORMAT_BGR_SUPPORTED
3031# define PNG_FORMAT_FLAG_BGR 0x10U /* BGR colors, else order is RGB */
3032#endif
3033
3034#ifdef PNG_FORMAT_AFIRST_SUPPORTED
3035# define PNG_FORMAT_FLAG_AFIRST 0x20U /* alpha channel comes first */
3036#endif
3037
3038#define PNG_FORMAT_FLAG_ASSOCIATED_ALPHA 0x40U /* alpha channel is associated */
3039
3040/* Commonly used formats have predefined macros.
3042 * First the single byte (sRGB) formats:
3044#define PNG_FORMAT_GRAY 0
3045#define PNG_FORMAT_GA PNG_FORMAT_FLAG_ALPHA
3046#define PNG_FORMAT_AG (PNG_FORMAT_GA|PNG_FORMAT_FLAG_AFIRST)
3047#define PNG_FORMAT_RGB PNG_FORMAT_FLAG_COLOR
3048#define PNG_FORMAT_BGR (PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_BGR)
3049#define PNG_FORMAT_RGBA (PNG_FORMAT_RGB|PNG_FORMAT_FLAG_ALPHA)
3050#define PNG_FORMAT_ARGB (PNG_FORMAT_RGBA|PNG_FORMAT_FLAG_AFIRST)
3051#define PNG_FORMAT_BGRA (PNG_FORMAT_BGR|PNG_FORMAT_FLAG_ALPHA)
3052#define PNG_FORMAT_ABGR (PNG_FORMAT_BGRA|PNG_FORMAT_FLAG_AFIRST)
3053
3054/* Then the linear 2-byte formats. When naming these "Y" is used to
3055 * indicate a luminance (gray) channel.
3057#define PNG_FORMAT_LINEAR_Y PNG_FORMAT_FLAG_LINEAR
3058#define PNG_FORMAT_LINEAR_Y_ALPHA (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_ALPHA)
3059#define PNG_FORMAT_LINEAR_RGB (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_COLOR)
3060#define PNG_FORMAT_LINEAR_RGB_ALPHA \
3061 (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_ALPHA)
3062
3063/* With color-mapped formats the image data is one byte for each pixel, the byte
3064 * is an index into the color-map which is formatted as above. To obtain a
3065 * color-mapped format it is sufficient just to add the PNG_FOMAT_FLAG_COLORMAP
3066 * to one of the above definitions, or you can use one of the definitions below.
3068#define PNG_FORMAT_RGB_COLORMAP (PNG_FORMAT_RGB|PNG_FORMAT_FLAG_COLORMAP)
3069#define PNG_FORMAT_BGR_COLORMAP (PNG_FORMAT_BGR|PNG_FORMAT_FLAG_COLORMAP)
3070#define PNG_FORMAT_RGBA_COLORMAP (PNG_FORMAT_RGBA|PNG_FORMAT_FLAG_COLORMAP)
3071#define PNG_FORMAT_ARGB_COLORMAP (PNG_FORMAT_ARGB|PNG_FORMAT_FLAG_COLORMAP)
3072#define PNG_FORMAT_BGRA_COLORMAP (PNG_FORMAT_BGRA|PNG_FORMAT_FLAG_COLORMAP)
3073#define PNG_FORMAT_ABGR_COLORMAP (PNG_FORMAT_ABGR|PNG_FORMAT_FLAG_COLORMAP)
3074
3075/* PNG_IMAGE macros
3076 *
3077 * These are convenience macros to derive information from a png_image
3078 * structure. The PNG_IMAGE_SAMPLE_ macros return values appropriate to the
3079 * actual image sample values - either the entries in the color-map or the
3080 * pixels in the image. The PNG_IMAGE_PIXEL_ macros return corresponding values
3081 * for the pixels and will always return 1 for color-mapped formats. The
3082 * remaining macros return information about the rows in the image and the
3083 * complete image.
3084 *
3085 * NOTE: All the macros that take a png_image::format parameter are compile time
3086 * constants if the format parameter is, itself, a constant. Therefore these
3087 * macros can be used in array declarations and case labels where required.
3088 * Similarly the macros are also pre-processor constants (sizeof is not used) so
3089 * they can be used in #if tests.
3091 * First the information about the samples.
3092 */
3093#define PNG_IMAGE_SAMPLE_CHANNELS(fmt)\
3094 (((fmt)&(PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_ALPHA))+1)
3095 /* Return the total number of channels in a given format: 1..4 */
3096
3097#define PNG_IMAGE_SAMPLE_COMPONENT_SIZE(fmt)\
3098 ((((fmt) & PNG_FORMAT_FLAG_LINEAR) >> 2)+1)
3099 /* Return the size in bytes of a single component of a pixel or color-map
3100 * entry (as appropriate) in the image: 1 or 2.
3101 */
3102
3103#define PNG_IMAGE_SAMPLE_SIZE(fmt)\
3104 (PNG_IMAGE_SAMPLE_CHANNELS(fmt) * PNG_IMAGE_SAMPLE_COMPONENT_SIZE(fmt))
3105 /* This is the size of the sample data for one sample. If the image is
3106 * color-mapped it is the size of one color-map entry (and image pixels are
3107 * one byte in size), otherwise it is the size of one image pixel.
3108 */
3109
3110#define PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(fmt)\
3111 (PNG_IMAGE_SAMPLE_CHANNELS(fmt) * 256)
3112 /* The maximum size of the color-map required by the format expressed in a
3113 * count of components. This can be used to compile-time allocate a
3114 * color-map:
3115 *
3116 * png_uint_16 colormap[PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(linear_fmt)];
3117 *
3118 * png_byte colormap[PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(sRGB_fmt)];
3119 *
3120 * Alternatively use the PNG_IMAGE_COLORMAP_SIZE macro below to use the
3121 * information from one of the png_image_begin_read_ APIs and dynamically
3122 * allocate the required memory.
3124
3125/* Corresponding information about the pixels */
3126#define PNG_IMAGE_PIXEL_(test,fmt)\
3127 (((fmt)&PNG_FORMAT_FLAG_COLORMAP)?1:test(fmt))
3128
3129#define PNG_IMAGE_PIXEL_CHANNELS(fmt)\
3130 PNG_IMAGE_PIXEL_(PNG_IMAGE_SAMPLE_CHANNELS,fmt)
3131 /* The number of separate channels (components) in a pixel; 1 for a
3132 * color-mapped image.
3133 */
3134
3135#define PNG_IMAGE_PIXEL_COMPONENT_SIZE(fmt)\
3136 PNG_IMAGE_PIXEL_(PNG_IMAGE_SAMPLE_COMPONENT_SIZE,fmt)
3137 /* The size, in bytes, of each component in a pixel; 1 for a color-mapped
3138 * image.
3139 */
3140
3141#define PNG_IMAGE_PIXEL_SIZE(fmt) PNG_IMAGE_PIXEL_(PNG_IMAGE_SAMPLE_SIZE,fmt)
3142 /* The size, in bytes, of a complete pixel; 1 for a color-mapped image. */
3143
3144/* Information about the whole row, or whole image */
3145#define PNG_IMAGE_ROW_STRIDE(image)\
3146 (PNG_IMAGE_PIXEL_CHANNELS((image).format) * (image).width)
3147 /* Return the total number of components in a single row of the image; this
3148 * is the minimum 'row stride', the minimum count of components between each
3149 * row. For a color-mapped image this is the minimum number of bytes in a
3150 * row.
3151 *
3152 * WARNING: this macro overflows for some images with more than one component
3153 * and very large image widths. libpng will refuse to process an image where
3154 * this macro would overflow.
3155 */
3156
3157#define PNG_IMAGE_BUFFER_SIZE(image, row_stride)\
3158 (PNG_IMAGE_PIXEL_COMPONENT_SIZE((image).format)*(image).height*(row_stride))
3159 /* Return the size, in bytes, of an image buffer given a png_image and a row
3160 * stride - the number of components to leave space for in each row.
3161 *
3162 * WARNING: this macro overflows a 32-bit integer for some large PNG images,
3163 * libpng will refuse to process an image where such an overflow would occur.
3164 */
3165
3166#define PNG_IMAGE_SIZE(image)\
3167 PNG_IMAGE_BUFFER_SIZE(image, PNG_IMAGE_ROW_STRIDE(image))
3168 /* Return the size, in bytes, of the image in memory given just a png_image;
3169 * the row stride is the minimum stride required for the image.
3170 */
3171
3172#define PNG_IMAGE_COLORMAP_SIZE(image)\
3173 (PNG_IMAGE_SAMPLE_SIZE((image).format) * (image).colormap_entries)
3174 /* Return the size, in bytes, of the color-map of this image. If the image
3175 * format is not a color-map format this will return a size sufficient for
3176 * 256 entries in the given format; check PNG_FORMAT_FLAG_COLORMAP if
3177 * you don't want to allocate a color-map in this case.
3178 */
3179
3180/* PNG_IMAGE_FLAG_*
3181 *
3182 * Flags containing additional information about the image are held in the
3183 * 'flags' field of png_image.
3184 */
3185#define PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB 0x01
3186 /* This indicates that the RGB values of the in-memory bitmap do not
3187 * correspond to the red, green and blue end-points defined by sRGB.
3188 */
3189
3190#define PNG_IMAGE_FLAG_FAST 0x02
3191 /* On write emphasise speed over compression; the resultant PNG file will be
3192 * larger but will be produced significantly faster, particular for large
3193 * images. Do not use this option for images which will be distributed, only
3194 * used it when producing intermediate files that will be read back in
3195 * repeatedly. For a typical 24-bit image the option will double the read
3196 * speed at the cost of increasing the image size by 25%, however for many
3197 * more compressible images the PNG file can be 10 times larger with only a
3198 * slight speed gain.
3199 */
3200
3201#define PNG_IMAGE_FLAG_16BIT_sRGB 0x04
3202 /* On read if the image is a 16-bit per component image and there is no gAMA
3203 * or sRGB chunk assume that the components are sRGB encoded. Notice that
3204 * images output by the simplified API always have gamma information; setting
3205 * this flag only affects the interpretation of 16-bit images from an
3206 * external source. It is recommended that the application expose this flag
3207 * to the user; the user can normally easily recognize the difference between
3208 * linear and sRGB encoding. This flag has no effect on write - the data
3209 * passed to the write APIs must have the correct encoding (as defined
3210 * above.)
3211 *
3212 * If the flag is not set (the default) input 16-bit per component data is
3213 * assumed to be linear.
3214 *
3215 * NOTE: the flag can only be set after the png_image_begin_read_ call,
3216 * because that call initializes the 'flags' field.
3217 */
3218
3219#ifdef PNG_SIMPLIFIED_READ_SUPPORTED
3220/* READ APIs
3221 * ---------
3222 *
3223 * The png_image passed to the read APIs must have been initialized by setting
3224 * the png_controlp field 'opaque' to NULL (or, safer, memset the whole thing.)
3225 */
3226#ifdef PNG_STDIO_SUPPORTED
3227PNG_EXPORT(234, int, png_image_begin_read_from_file,
3228 (png_imagep image, const char *file_name));
3229 /* The named file is opened for read and the image header is filled in
3230 * from the PNG header in the file.
3231 */
3232
3233PNG_EXPORT(235, int, png_image_begin_read_from_stdio,
3235 /* The PNG header is read from the stdio FILE object. */
3236#endif /* STDIO */
3237
3238PNG_EXPORT(236, int, png_image_begin_read_from_memory,
3240 /* The PNG header is read from the given memory buffer. */
3241
3242PNG_EXPORT(237, int, png_image_finish_read,
3244 png_const_colorp background, void *buffer, png_int_32 row_stride,
3245 void *colormap));
3246 /* Finish reading the image into the supplied buffer and clean up the
3247 * png_image structure.
3248 *
3249 * row_stride is the step, in byte or 2-byte units as appropriate,
3250 * between adjacent rows. A positive stride indicates that the top-most row
3251 * is first in the buffer - the normal top-down arrangement. A negative
3252 * stride indicates that the bottom-most row is first in the buffer.
3253 *
3254 * background need only be supplied if an alpha channel must be removed from
3255 * a png_byte format and the removal is to be done by compositing on a solid
3256 * color; otherwise it may be NULL and any composition will be done directly
3257 * onto the buffer. The value is an sRGB color to use for the background,
3258 * for grayscale output the green channel is used.
3259 *
3260 * background must be supplied when an alpha channel must be removed from a
3261 * single byte color-mapped output format, in other words if:
3262 *
3263 * 1) The original format from png_image_begin_read_from_* had
3264 * PNG_FORMAT_FLAG_ALPHA set.
3265 * 2) The format set by the application does not.
3266 * 3) The format set by the application has PNG_FORMAT_FLAG_COLORMAP set and
3267 * PNG_FORMAT_FLAG_LINEAR *not* set.
3268 *
3269 * For linear output removing the alpha channel is always done by compositing
3270 * on black and background is ignored.
3271 *
3272 * colormap must be supplied when PNG_FORMAT_FLAG_COLORMAP is set. It must
3273 * be at least the size (in bytes) returned by PNG_IMAGE_COLORMAP_SIZE.
3274 * image->colormap_entries will be updated to the actual number of entries
3275 * written to the colormap; this may be less than the original value.
3276 */
3277
3278PNG_EXPORT(238, void, png_image_free,
3279 (png_imagep image));
3280 /* Free any data allocated by libpng in image->opaque, setting the pointer to
3281 * NULL. May be called at any time after the structure is initialized.
3282 */
3283#endif /* SIMPLIFIED_READ */
3284
3285#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
3286/* WRITE APIS
3287 * ----------
3288 * For write you must initialize a png_image structure to describe the image to
3289 * be written. To do this use memset to set the whole structure to 0 then
3290 * initialize fields describing your image.
3291 *
3292 * version: must be set to PNG_IMAGE_VERSION
3293 * opaque: must be initialized to NULL
3294 * width: image width in pixels
3295 * height: image height in rows
3296 * format: the format of the data (image and color-map) you wish to write
3297 * flags: set to 0 unless one of the defined flags applies; set
3298 * PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB for color format images where the RGB
3299 * values do not correspond to the colors in sRGB.
3300 * colormap_entries: set to the number of entries in the color-map (0 to 256)
3301 */
3302#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
3303PNG_EXPORT(239, int, png_image_write_to_file,
3305 const char *file, int convert_to_8bit, const void *buffer,
3306 png_int_32 row_stride, const void *colormap));
3307 /* Write the image to the named file. */
3308
3309PNG_EXPORT(240, int, png_image_write_to_stdio,
3311 FILE *file, int convert_to_8_bit, const void *buffer,
3312 png_int_32 row_stride, const void *colormap));
3313 /* Write the image to the given FILE object. */
3314#endif /* SIMPLIFIED_WRITE_STDIO */
3315
3316/* With all write APIs if image is in one of the linear formats with 16-bit
3317 * data then setting convert_to_8_bit will cause the output to be an 8-bit PNG
3318 * gamma encoded according to the sRGB specification, otherwise a 16-bit linear
3319 * encoded PNG file is written.
3320 *
3321 * With color-mapped data formats the colormap parameter point to a color-map
3322 * with at least image->colormap_entries encoded in the specified format. If
3323 * the format is linear the written PNG color-map will be converted to sRGB
3324 * regardless of the convert_to_8_bit flag.
3325 *
3326 * With all APIs row_stride is handled as in the read APIs - it is the spacing
3327 * from one row to the next in component sized units (1 or 2 bytes) and if
3328 * negative indicates a bottom-up row layout in the buffer. If row_stride is
3329 * zero, libpng will calculate it for you from the image width and number of
3330 * channels.
3331 *
3332 * Note that the write API does not support interlacing, sub-8-bit pixels or
3333 * most ancillary chunks. If you need to write text chunks (e.g. for copyright
3334 * notices) you need to use one of the other APIs.
3335 */
3336
3337PNG_EXPORT(245, int, png_image_write_to_memory,
3339 void *memory, png_alloc_size_t * PNG_RESTRICT memory_bytes,
3340 int convert_to_8_bit,
3341 const void *buffer, png_int_32 row_stride, const void *colormap));
3342 /* Write the image to the given memory buffer. The function both writes the
3343 * whole PNG data stream to *memory and updates *memory_bytes with the count
3344 * of bytes written.
3345 *
3346 * 'memory' may be NULL. In this case *memory_bytes is not read however on
3347 * success the number of bytes which would have been written will still be
3348 * stored in *memory_bytes. On failure *memory_bytes will contain 0.
3349 *
3350 * If 'memory' is not NULL it must point to memory[*memory_bytes] of
3351 * writeable memory.
3352 *
3353 * If the function returns success memory[*memory_bytes] (if 'memory' is not
3354 * NULL) contains the written PNG data. *memory_bytes will always be less
3355 * than or equal to the original value.
3356 *
3357 * If the function returns false and *memory_bytes was not changed an error
3358 * occurred during write. If *memory_bytes was changed, or is not 0 if
3359 * 'memory' was NULL, the write would have succeeded but for the memory
3360 * buffer being too small. *memory_bytes contains the required number of
3361 * bytes and will be bigger that the original value.
3362 */
3363
3364#define png_image_write_get_memory_size(image, size, convert_to_8_bit, buffer,\
3365 row_stride, colormap)\
3366 png_image_write_to_memory(&(image), 0, &(size), convert_to_8_bit, buffer,\
3367 row_stride, colormap)
3368 /* Return the amount of memory in 'size' required to compress this image.
3369 * The png_image structure 'image' must be filled in as in the above
3370 * function and must not be changed before the actual write call, the buffer
3371 * and all other parameters must also be identical to that in the final
3372 * write call. The 'size' variable need not be initialized.
3373 *
3374 * NOTE: the macro returns true/false, if false is returned 'size' will be
3375 * set to zero and the write failed and probably will fail if tried again.
3376 */
3377
3378/* You can pre-allocate the buffer by making sure it is of sufficient size
3379 * regardless of the amount of compression achieved. The buffer size will
3380 * always be bigger than the original image and it will never be filled. The
3381 * following macros are provided to assist in allocating the buffer.
3382 */
3383#define PNG_IMAGE_DATA_SIZE(image) (PNG_IMAGE_SIZE(image)+(image).height)
3384 /* The number of uncompressed bytes in the PNG byte encoding of the image;
3385 * uncompressing the PNG IDAT data will give this number of bytes.
3386 *
3387 * NOTE: while PNG_IMAGE_SIZE cannot overflow for an image in memory this
3388 * macro can because of the extra bytes used in the PNG byte encoding. You
3389 * need to avoid this macro if your image size approaches 2^30 in width or
3390 * height. The same goes for the remainder of these macros; they all produce
3391 * bigger numbers than the actual in-memory image size.
3392 */
3393#ifndef PNG_ZLIB_MAX_SIZE
3394# define PNG_ZLIB_MAX_SIZE(b) ((b)+(((b)+7U)>>3)+(((b)+63U)>>6)+11U)
3395 /* An upper bound on the number of compressed bytes given 'b' uncompressed
3396 * bytes. This is based on deflateBounds() in zlib; different
3397 * implementations of zlib compression may conceivably produce more data so
3398 * if your zlib implementation is not zlib itself redefine this macro
3399 * appropriately.
3401#endif
3402
3403#define PNG_IMAGE_COMPRESSED_SIZE_MAX(image)\
3404 PNG_ZLIB_MAX_SIZE((png_alloc_size_t)PNG_IMAGE_DATA_SIZE(image))
3405 /* An upper bound on the size of the data in the PNG IDAT chunks. */
3406
3407#define PNG_IMAGE_PNG_SIZE_MAX_(image, image_size)\
3408 ((8U/*sig*/+25U/*IHDR*/+16U/*gAMA*/+44U/*cHRM*/+12U/*IEND*/+\
3409 (((image).format&PNG_FORMAT_FLAG_COLORMAP)?/*colormap: PLTE, tRNS*/\
3410 12U+3U*(image).colormap_entries/*PLTE data*/+\
3411 (((image).format&PNG_FORMAT_FLAG_ALPHA)?\
3412 12U/*tRNS*/+(image).colormap_entries:0U):0U)+\
3413 12U)+(12U*((image_size)/PNG_ZBUF_SIZE))/*IDAT*/+(image_size))
3414 /* A helper for the following macro; if your compiler cannot handle the
3415 * following macro use this one with the result of
3416 * PNG_IMAGE_COMPRESSED_SIZE_MAX(image) as the second argument (most
3417 * compilers should handle this just fine.)
3418 */
3419
3420#define PNG_IMAGE_PNG_SIZE_MAX(image)\
3421 PNG_IMAGE_PNG_SIZE_MAX_(image, PNG_IMAGE_COMPRESSED_SIZE_MAX(image))
3422 /* An upper bound on the total length of the PNG data stream for 'image'.
3423 * The result is of type png_alloc_size_t, on 32-bit systems this may
3424 * overflow even though PNG_IMAGE_DATA_SIZE does not overflow; the write will
3425 * run out of buffer space but return a corrected size which should work.
3426 */
3427#endif /* SIMPLIFIED_WRITE */
3428/*******************************************************************************
3429 * END OF SIMPLIFIED API
3430 ******************************************************************************/
3431#endif /* SIMPLIFIED_{READ|WRITE} */
3432
3433/*******************************************************************************
3434 * Section 6: IMPLEMENTATION OPTIONS
3435 *******************************************************************************
3436 *
3437 * Support for arbitrary implementation-specific optimizations. The API allows
3438 * particular options to be turned on or off. 'Option' is the number of the
3439 * option and 'onoff' is 0 (off) or non-0 (on). The value returned is given
3440 * by the PNG_OPTION_ defines below.
3441 *
3442 * HARDWARE: normally hardware capabilities, such as the Intel SSE instructions,
3443 * are detected at run time, however sometimes it may be impossible
3444 * to do this in user mode, in which case it is necessary to discover
3445 * the capabilities in an OS specific way. Such capabilities are
3446 * listed here when libpng has support for them and must be turned
3447 * ON by the application if present.
3448 *
3449 * SOFTWARE: sometimes software optimizations actually result in performance
3450 * decrease on some architectures or systems, or with some sets of
3451 * PNG images. 'Software' options allow such optimizations to be
3452 * selected at run time.
3453 */
3454#ifdef PNG_SET_OPTION_SUPPORTED
3455
3456/* HARDWARE: ARM Neon SIMD instructions supported */
3457#ifdef PNG_ARM_NEON_API_SUPPORTED
3458# define PNG_ARM_NEON 0
3459#endif
3460
3461/* SOFTWARE: Force maximum window */
3462#define PNG_MAXIMUM_INFLATE_WINDOW 2
3463
3464/* SOFTWARE: Check ICC profile for sRGB */
3465#define PNG_SKIP_sRGB_CHECK_PROFILE 4
3466
3467/* HARDWARE: MIPS MSA SIMD instructions supported */
3468#ifdef PNG_MIPS_MSA_API_SUPPORTED
3469# define PNG_MIPS_MSA 6
3470#endif
3471
3472/* SOFTWARE: Disable Adler32 check on IDAT */
3473#ifdef PNG_DISABLE_ADLER32_CHECK_SUPPORTED
3474# define PNG_IGNORE_ADLER32 8
3475#endif
3476
3477/* HARDWARE: PowerPC VSX SIMD instructions supported */
3478#ifdef PNG_POWERPC_VSX_API_SUPPORTED
3479# define PNG_POWERPC_VSX 10
3480#endif
3481
3482/* HARDWARE: MIPS MMI SIMD instructions supported */
3483#ifdef PNG_MIPS_MMI_API_SUPPORTED
3484# define PNG_MIPS_MMI 12
3485#endif
3486
3487/* HARDWARE: RISC-V RVV SIMD instructions supported */
3488#ifdef PNG_RISCV_RVV_API_SUPPORTED
3489# define PNG_RISCV_RVV 14
3490#endif
3491
3492/* Next option - numbers must be even */
3493#define PNG_OPTION_NEXT 16
3495/* Return values: NOTE: there are four values and 'off' is *not* zero */
3496#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
3497#define PNG_OPTION_INVALID 1 /* Option number out of range */
3498#define PNG_OPTION_OFF 2
3499#define PNG_OPTION_ON 3
3500
3501PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
3502 int onoff));
3503#endif /* SET_OPTION */
3504
3505/*******************************************************************************
3506 * END OF HARDWARE AND SOFTWARE OPTIONS
3507 ******************************************************************************/
3508
3509/* Maintainer: Put new public prototypes here ^, in libpng.3, in project
3510 * defs, and in scripts/symbols.def.
3511 */
3512
3513/* The last ordinal number (this is the *last* one already used; the next
3514 * one to use is one more than this.)
3515 */
3516#ifdef PNG_EXPORT_LAST_ORDINAL
3517 PNG_EXPORT_LAST_ORDINAL(259);
3518#endif
3519
3520#ifdef __cplusplus
3521}
3522#endif
3523
3524#endif /* PNG_VERSION_INFO_ONLY */
3525/* Do not put anything past this line */
3526#endif /* PNG_H */
static const char * onoff(int bool)
Definition: cmds.c:777
void error_message(HWND hwnd, const char *msg)
Definition: main.cpp:783
static const WCHAR version[]
Definition: asmname.c:66
__time32_t time_t
Definition: corecrt.h:228
_JBTYPE jmp_buf[_JBLEN]
Definition: setjmp.h:142
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
method
Definition: dragdrop.c:54
GLuint start
Definition: gl.h:1545
GLint level
Definition: gl.h:1546
GLclampf green
Definition: gl.h:1740
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLenum GLint GLuint mask
Definition: glext.h:6028
GLenum mode
Definition: glext.h:6217
GLenum const GLfloat * params
Definition: glext.h:5645
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLfloat units
Definition: glext.h:11727
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLuint GLfloat * val
Definition: glext.h:7180
GLuint GLuint num
Definition: glext.h:9618
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void display_row(char *data, int off, int len)
Definition: iptest.cpp:39
JSAMPARRAY int num_rows
Definition: jpegint.h:420
#define profile
Definition: kernel32.h:12
static PVOID ptr
Definition: dispmode.c:27
static const char filler[0x1000]
Definition: loader.c:179
static char memory[1024 *256]
Definition: process.c:122
static LPCWSTR file_name
Definition: protocol.c:147
static HPALETTE palette
Definition: clipboard.c:1457
png_voidp PNGAPI png_get_io_ptr(png_const_structrp png_ptr)
Definition: png.c:691
png_const_charp PNGAPI png_get_copyright(png_const_structrp png_ptr)
Definition: png.c:816
png_const_charp PNGAPI png_get_header_ver(png_const_structrp png_ptr)
Definition: png.c:849
png_const_charp PNGAPI png_get_libpng_ver(png_const_structrp png_ptr)
Definition: png.c:842
png_const_charp PNGAPI png_get_header_version(png_const_structrp png_ptr)
Definition: png.c:857
png_uint_32 PNGAPI png_access_version_number(void)
Definition: png.c:991
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point *int_blue_Z png_set_cHRM_XYZ
Definition: png.h:2064
#define png_get_uint_16(buf)
Definition: png.h:2843
png_unknown_chunk * png_unknown_chunkp
Definition: png.h:633
png_struct * png_structp
Definition: png.h:436
png_get_cLLI_fixed
Definition: png.h:2104
png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point * int_green_y
Definition: png.h:2197
png_structrp png_fixed_point screen_gamma
Definition: png.h:1407
png_set_rgb_to_gray_fixed
Definition: png.h:1121
png_const_structrp png_const_inforp double * red_X
Definition: png.h:2038
png_const_structrp png_const_inforp double double double double double double double double * blue_Y
Definition: png.h:2040
png_color * png_colorp
Definition: png.h:479
png_sPLT_t ** png_sPLT_tpp
Definition: png.h:537
png_get_cHRM_XYZ
Definition: png.h:2036
png_get_x_offset_inches_fixed
Definition: png.h:2628
png_const_structrp png_const_inforp int * unit
Definition: png.h:2392
struct png_row_info_struct png_row_info
png_structrp png_const_color_16p int background_gamma_code
Definition: png.h:1352
png_get_io_chunk_type
Definition: png.h:2656
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point * int_blue_X
Definition: png.h:2053
png_info ** png_infopp
Definition: png.h:451
const png_text * png_const_textp
Definition: png.h:575
png_color ** png_colorpp
Definition: png.h:481
png_set_alpha_mode_fixed
Definition: png.h:1178
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point * int_green_Y
Definition: png.h:2051
png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point * int_blue_x
Definition: png.h:2198
png_text * png_textp
Definition: png.h:574
#define png_get_int_32(buf)
Definition: png.h:2844
png_structrp png_ptr
Definition: png.h:1122
const png_color_8 * png_const_color_8p
Definition: png.h:504
png_const_structrp png_const_inforp double double double double double double * green_Z
Definition: png.h:2039
png_uint_32
Definition: png.h:2036
png_color_8 ** png_color_8pp
Definition: png.h:505
png_const_structrp png_const_inforp double double double * red_Z
Definition: png.h:2038
png_unknown_chunk ** png_unknown_chunkpp
Definition: png.h:635
struct png_control * png_controlp
Definition: png.h:2915
png_sPLT_entry ** png_sPLT_entrypp
Definition: png.h:521
png_const_structrp png_const_inforp png_uint_32p png_uint_32p maximum_frame_average_light_level_scaled_by_10000 png_set_cLLI_fixed
Definition: png.h:2118
png_text ** png_textpp
Definition: png.h:576
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point *int_blue_Z png_const_structrp png_inforp double double double double double double double double double blue_Z png_set_cHRM_XYZ_fixed
Definition: png.h:2075
png_time * png_timep
Definition: png.h:604
png_row_info ** png_row_infopp
Definition: png.h:775
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point * int_red_X
Definition: png.h:2049
png_set_filter_heuristics_fixed
Definition: png.h:1552
png_row_info * png_row_infop
Definition: png.h:774
const png_struct * png_const_structp
Definition: png.h:435
png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_uint_32p mastering_display_maximum_luminance_scaled_by_10000
Definition: png.h:2202
struct png_sPLT_struct png_sPLT_t
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point png_fixed_point * int_red_Y
Definition: png.h:2049
png_structrp int int num_weights
Definition: png.h:1554
png_const_structrp png_const_inforp double double double double double * green_Y
Definition: png.h:2039
png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point * int_blue_y
Definition: png.h:2198
png_const_structrp png_const_inforp double double double double * green_X
Definition: png.h:2039
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point * int_blue_Y
Definition: png.h:2053
png_set_sCAL_fixed
Definition: png.h:2401
png_structrp int png_fixed_point red
Definition: png.h:1123
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_get_cHRM_XYZ_fixed
Definition: png.h:2047
png_const_structrp png_const_inforp double double * red_Y
Definition: png.h:2038
struct png_image * png_imagep
png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point * int_green_x
Definition: png.h:2197
png_color_16 ** png_color_16pp
Definition: png.h:493
png_sPLT_entry * png_sPLT_entryp
Definition: png.h:519
png_const_structrp png_const_inforp png_fixed_point *int_file_gamma png_set_gAMA_fixed
Definition: png.h:2154
struct png_text_struct png_text
png_get_gAMA_fixed
Definition: png.h:2145
struct png_time_struct png_time
png_get_mDCV_fixed
Definition: png.h:2193
png_const_structrp png_const_inforp png_fixed_point png_fixed_point * int_white_y
Definition: png.h:2195
struct png_unknown_chunk_t png_unknown_chunk
png_set_background_fixed
Definition: png.h:1350
png_color_16 * png_color_16p
Definition: png.h:491
struct png_sPLT_entry_struct png_sPLT_entry
png_const_structrp png_const_inforp info_ptr png_get_y_offset_inches_fixed
Definition: png.h:2635
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point * int_green_Z
Definition: png.h:2052
struct png_color_struct png_color
png_const_structrp png_const_inforp double double double double double double double * blue_X
Definition: png.h:2040
png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_uint_32p png_uint_32p mastering_display_minimum_luminance_scaled_by_10000 png_set_mDCV_fixed
Definition: png.h:2220
#define png_get_uint_32(buf)
Definition: png.h:2842
const png_sPLT_entry * png_const_sPLT_entryp
Definition: png.h:520
png_const_structrp png_const_inforp png_uint_32p maximum_content_light_level_scaled_by_10000
Definition: png.h:2109
png_get_pixel_aspect_ratio_fixed
Definition: png.h:1996
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point * int_green_X
Definition: png.h:2051
png_sPLT_t * png_sPLT_tp
Definition: png.h:535
struct png_color_8_struct png_color_8
png_get_sCAL_fixed
Definition: png.h:2390
png_structrp int heuristic_method
Definition: png.h:1554
const png_time * png_const_timep
Definition: png.h:605
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point * int_red_Z
Definition: png.h:2050
png_structrp int error_action
Definition: png.h:1123
const png_info * png_const_infop
Definition: png.h:450
png_const_structrp png_const_inforp png_fixed_point * int_white_x
Definition: png.h:2195
const png_struct *PNG_RESTRICT png_const_structrp
Definition: png.h:465
png_struct ** png_structpp
Definition: png.h:437
png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point * int_red_y
Definition: png.h:2196
png_const_structrp png_const_inforp int png_fixed_point * width
Definition: png.h:2392
const png_info *PNG_RESTRICT png_const_inforp
Definition: png.h:467
char * png_libpng_version_1_6_54
Definition: png.h:426
png_set_gamma_fixed
Definition: png.h:1405
png_structrp int int png_const_fixed_point_p filter_weights
Definition: png.h:1555
png_info * png_infop
Definition: png.h:449
const png_unknown_chunk * png_const_unknown_chunkp
Definition: png.h:634
png_structrp png_const_color_16p int int need_expand
Definition: png.h:1353
const png_sPLT_t * png_const_sPLT_tp
Definition: png.h:536
png_structrp png_const_color_16p background_color
Definition: png.h:1352
png_info *PNG_RESTRICT png_inforp
Definition: png.h:466
png_time ** png_timepp
Definition: png.h:606
png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point * int_red_x
Definition: png.h:2196
struct png_color_16_struct png_color_16
const png_color * png_const_colorp
Definition: png.h:480
png_struct *PNG_RESTRICT png_structrp
Definition: png.h:464
png_color_8 * png_color_8p
Definition: png.h:503
png_const_structrp png_const_inforp info_ptr
Definition: png.h:2037
const png_color_16 * png_const_color_16p
Definition: png.h:492
#define PNG_NORETURN
Definition: pngconf.h:423
#define PNG_FUNCTION(type, name, args, attributes)
Definition: pngconf.h:274
#define PNG_EXPORTA(ordinal, type, name, args, attributes)
Definition: pngconf.h:287
char * png_charp
Definition: pngconf.h:576
png_int_32 png_fixed_point
Definition: pngconf.h:561
const png_byte * png_const_bytep
Definition: pngconf.h:567
const png_uint_16 * png_const_uint_16p
Definition: pngconf.h:573
char ** png_charpp
Definition: pngconf.h:595
size_t png_alloc_size_t
Definition: pngconf.h:544
#define PNG_CALLBACK(type, name, args)
Definition: pngconf.h:306
png_byte * png_bytep
Definition: pngconf.h:566
#define PNGCAPI
Definition: pngconf.h:242
png_byte ** png_bytepp
Definition: pngconf.h:589
png_uint_16 * png_uint_16p
Definition: pngconf.h:572
png_uint_32 * png_uint_32p
Definition: pngconf.h:568
const png_fixed_point * png_const_fixed_point_p
Definition: pngconf.h:579
#define PNG_EXPORT(ordinal, type, name, args)
Definition: pngconf.h:297
#define PNG_ALLOCATED
Definition: pngconf.h:426
const char * png_const_charp
Definition: pngconf.h:577
#define PNG_REMOVED(ordinal, type, name, args, attributes)
Definition: pngconf.h:302
#define PNG_RESTRICT
Definition: pngconf.h:432
#define PNG_FIXED_EXPORT(ordinal, type, name, args)
Definition: pngpriv.h:422
#define PNG_DEPRECATED
Definition: pngpriv.h:373
#define PNG_FP_EXPORT(ordinal, type, name, args)
Definition: pngpriv.h:410
const png_double * png_const_doublep
Definition: pngpriv.h:415
wchar_t const *const size_t const buffer_size
Definition: stat.cpp:95
Definition: fci.c:127
Definition: format.c:58
Definition: tftpd.h:60
Definition: name.c:39
Definition: getopt.h:109
png_uint_16 red
Definition: png.h:486
png_byte index
Definition: png.h:485
png_uint_16 gray
Definition: png.h:489
png_uint_16 green
Definition: png.h:487
png_uint_16 blue
Definition: png.h:488
png_byte green
Definition: png.h:498
png_byte gray
Definition: png.h:500
png_byte blue
Definition: png.h:499
png_byte red
Definition: png.h:497
png_byte alpha
Definition: png.h:501
png_byte blue
Definition: png.h:477
png_byte red
Definition: png.h:475
png_byte green
Definition: png.h:476
png_uint_32 width
Definition: png.h:766
png_byte color_type
Definition: png.h:768
png_byte bit_depth
Definition: png.h:769
png_byte pixel_depth
Definition: png.h:771
png_byte channels
Definition: png.h:770
size_t rowbytes
Definition: png.h:767
Definition: png.h:512
png_uint_16 red
Definition: png.h:513
png_uint_16 blue
Definition: png.h:515
png_uint_16 green
Definition: png.h:514
png_uint_16 alpha
Definition: png.h:516
png_uint_16 frequency
Definition: png.h:517
png_sPLT_entryp entries
Definition: png.h:532
png_byte depth
Definition: png.h:531
png_int_32 nentries
Definition: png.h:533
png_charp name
Definition: png.h:530
png_charp text
Definition: png.h:565
png_charp lang_key
Definition: png.h:571
size_t text_length
Definition: png.h:567
png_charp lang
Definition: png.h:569
png_charp key
Definition: png.h:564
int compression
Definition: png.h:559
size_t itxt_length
Definition: png.h:568
png_byte month
Definition: png.h:598
png_uint_16 year
Definition: png.h:597
png_byte hour
Definition: png.h:600
png_byte second
Definition: png.h:602
png_byte minute
Definition: png.h:601
png_byte day
Definition: png.h:599
png_byte * data
Definition: png.h:620
size_t size
Definition: png.h:621
png_byte location
Definition: png.h:629
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383