blob: 8efeff208820b575fc74829237926e7d63d1f5e5 [file] [log] [blame]
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -05001
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -05002/* pngpriv.h - private declarations for use inside libpng
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -05003 *
Glenn Randers-Pehrsonc957b6b2010-03-08 21:47:07 -06004 * libpng version 1.5.0beta13 - March 9, 2010
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -05005 * For conditions of distribution and use, see copyright notice in png.h
Glenn Randers-Pehrsone69b55d2010-01-01 10:29:06 -06006 * Copyright (c) 1998-2010 Glenn Randers-Pehrson
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -05007 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
8 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
Glenn Randers-Pehrson3e61d792009-06-24 09:31:28 -05009 *
Glenn Randers-Pehrsonbfbf8652009-06-26 21:46:52 -050010 * This code is released under the libpng license.
Glenn Randers-Pehrsonc332bbc2009-06-25 13:43:50 -050011 * For conditions of distribution and use, see the disclaimer
Glenn Randers-Pehrson037023b2009-06-24 10:27:36 -050012 * and license in png.h
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -050013 */
14
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -050015/* The symbols declared in this file (including the functions declared
16 * as PNG_EXTERN) are PRIVATE. They are not part of the libpng public
17 * interface, and are not recommended for use by regular applications.
18 * Some of them may become public in the future; others may stay private,
19 * change in an incompatible way, or even disappear.
20 * Although the libpng users are not forbidden to include this header,
21 * they should be well aware of the issues that may arise from doing so.
22 */
23
24#ifndef PNGPRIV_H
25#define PNGPRIV_H
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050026
Glenn Randers-Pehrsonc3cd22b2010-03-08 21:10:25 -060027#define PNG_NO_PEDANTIC_WARNINGS
28#include "png.h"
29#include "pnginfo.h"
30#include "pngstruct.h"
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050031
32#include <stdlib.h>
33
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -050034/* The functions exported by PNG_EXTERN are internal functions, which
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050035 * aren't usually used outside the library (as far as I know), so it is
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -050036 * debatable if they should be exported at all. In the future, when it
37 * is possible to have run-time registry of chunk-handling functions,
38 * some of these will be made available again.
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050039#define PNG_EXTERN extern
40 */
41#define PNG_EXTERN
42
43/* Other defines specific to compilers can go here. Try to keep
44 * them inside an appropriate ifdef/endif pair for portability.
45 */
46
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -050047#ifdef PNG_FLOATING_POINT_SUPPORTED
48# ifdef MACOS
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050049 /* We need to check that <math.h> hasn't already been included earlier
50 * as it seems it doesn't agree with <fp.h>, yet we should really use
51 * <fp.h> if possible.
52 */
53# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
54# include <fp.h>
55# endif
56# else
57# include <math.h>
58# endif
59# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
60 /* Amiga SAS/C: We must include builtin FPU functions when compiling using
61 * MATH=68881
62 */
63# include <m68881.h>
64# endif
65#endif
66
67/* Codewarrior on NT has linking problems without this. */
68#if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
69# define PNG_ALWAYS_EXTERN
70#endif
71
72/* This provides the non-ANSI (far) memory allocation routines. */
73#if defined(__TURBOC__) && defined(__MSDOS__)
74# include <mem.h>
75# include <alloc.h>
76#endif
77
78#if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \
Glenn Randers-Pehrsonf74c5ac2009-09-20 07:27:34 -050079 defined(_WIN32) || defined(__WIN32__)
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050080# include <windows.h> /* defines _WINDOWS_ macro */
81/* I have no idea why is this necessary... */
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -050082# ifdef _MSC_VER
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050083# include <malloc.h>
84# endif
85#endif
86
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050087/* Various modes of operation. Note that after an init, mode is set to
88 * zero automatically when the structure is created.
89 */
90#define PNG_HAVE_IHDR 0x01
91#define PNG_HAVE_PLTE 0x02
92#define PNG_HAVE_IDAT 0x04
Glenn Randers-Pehrson6bc53be2006-06-16 07:52:03 -050093#define PNG_AFTER_IDAT 0x08 /* Have complete zlib datastream */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050094#define PNG_HAVE_IEND 0x10
95#define PNG_HAVE_gAMA 0x20
96#define PNG_HAVE_cHRM 0x40
97#define PNG_HAVE_sRGB 0x80
98#define PNG_HAVE_CHUNK_HEADER 0x100
99#define PNG_WROTE_tIME 0x200
100#define PNG_WROTE_INFO_BEFORE_PLTE 0x400
101#define PNG_BACKGROUND_IS_GRAY 0x800
102#define PNG_HAVE_PNG_SIGNATURE 0x1000
Glenn Randers-Pehrson6bc53be2006-06-16 07:52:03 -0500103#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500104
Glenn Randers-Pehrson6c7a09a2009-06-15 21:57:39 -0500105/* Flags for the transformations the PNG library does on the image data */
Glenn Randers-Pehrson1916f6a2008-08-14 13:44:49 -0500106#define PNG_BGR 0x0001
107#define PNG_INTERLACE 0x0002
108#define PNG_PACK 0x0004
109#define PNG_SHIFT 0x0008
110#define PNG_SWAP_BYTES 0x0010
111#define PNG_INVERT_MONO 0x0020
112#define PNG_DITHER 0x0040
113#define PNG_BACKGROUND 0x0080
114#define PNG_BACKGROUND_EXPAND 0x0100
115 /* 0x0200 unused */
116#define PNG_16_TO_8 0x0400
117#define PNG_RGBA 0x0800
118#define PNG_EXPAND 0x1000
119#define PNG_GAMMA 0x2000
120#define PNG_GRAY_TO_RGB 0x4000
121#define PNG_FILLER 0x8000L
122#define PNG_PACKSWAP 0x10000L
123#define PNG_SWAP_ALPHA 0x20000L
124#define PNG_STRIP_ALPHA 0x40000L
125#define PNG_INVERT_ALPHA 0x80000L
126#define PNG_USER_TRANSFORM 0x100000L
127#define PNG_RGB_TO_GRAY_ERR 0x200000L
128#define PNG_RGB_TO_GRAY_WARN 0x400000L
129#define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */
130 /* 0x800000L Unused */
131#define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */
132#define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */
Glenn Randers-Pehrson5876b852009-11-27 00:24:42 -0600133 /* 0x4000000L unused */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500134 /* 0x8000000L unused */
135 /* 0x10000000L unused */
136 /* 0x20000000L unused */
137 /* 0x40000000L unused */
138
Glenn Randers-Pehrson6c7a09a2009-06-15 21:57:39 -0500139/* Flags for png_create_struct */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500140#define PNG_STRUCT_PNG 0x0001
141#define PNG_STRUCT_INFO 0x0002
142
143/* Scaling factor for filter heuristic weighting calculations */
144#define PNG_WEIGHT_SHIFT 8
145#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT))
146#define PNG_COST_SHIFT 3
147#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))
148
Glenn Randers-Pehrson6c7a09a2009-06-15 21:57:39 -0500149/* Flags for the png_ptr->flags rather than declaring a byte for each one */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500150#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001
151#define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002
152#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004
153#define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008
154#define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010
155#define PNG_FLAG_ZLIB_FINISHED 0x0020
156#define PNG_FLAG_ROW_INIT 0x0040
157#define PNG_FLAG_FILLER_AFTER 0x0080
158#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100
159#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200
160#define PNG_FLAG_CRC_CRITICAL_USE 0x0400
161#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800
Glenn Randers-Pehrsonf74c5ac2009-09-20 07:27:34 -0500162 /* 0x1000 unused */
163 /* 0x2000 unused */
164 /* 0x4000 unused */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500165#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L
166#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L
167#define PNG_FLAG_LIBRARY_MISMATCH 0x20000L
168#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L
169#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L
170#define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L
171#define PNG_FLAG_ADD_ALPHA 0x200000L /* Added to libpng-1.2.8 */
172#define PNG_FLAG_STRIP_ALPHA 0x400000L /* Added to libpng-1.2.8 */
Glenn Randers-Pehrson6bc53be2006-06-16 07:52:03 -0500173#define PNG_FLAG_BENIGN_ERRORS_WARN 0x800000L /* Added to libpng-1.4.0 */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500174 /* 0x1000000L unused */
175 /* 0x2000000L unused */
176 /* 0x4000000L unused */
177 /* 0x8000000L unused */
178 /* 0x10000000L unused */
179 /* 0x20000000L unused */
180 /* 0x40000000L unused */
181
182#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
183 PNG_FLAG_CRC_ANCILLARY_NOWARN)
184
185#define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \
186 PNG_FLAG_CRC_CRITICAL_IGNORE)
187
188#define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \
189 PNG_FLAG_CRC_CRITICAL_MASK)
190
Glenn Randers-Pehrson6c7a09a2009-06-15 21:57:39 -0500191/* Save typing and make code easier to understand */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500192
193#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
194 abs((int)((c1).green) - (int)((c2).green)) + \
195 abs((int)((c1).blue) - (int)((c2).blue)))
196
197/* Added to libpng-1.2.6 JB */
198#define PNG_ROWBYTES(pixel_bits, width) \
199 ((pixel_bits) >= 8 ? \
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500200 ((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \
201 (( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) )
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500202
203/* PNG_OUT_OF_RANGE returns true if value is outside the range
Glenn Randers-Pehrson9bf60832009-09-20 13:37:50 -0500204 * ideal-delta..ideal+delta. Each argument is evaluated twice.
205 * "ideal" and "delta" should be constants, normally simple
206 * integers, "value" a variable. Added to libpng-1.2.6 JB
207 */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500208#define PNG_OUT_OF_RANGE(value, ideal, delta) \
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600209 ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500210
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500211/* Constant strings for known chunk types. If you need to add a chunk,
Glenn Randers-Pehrson9bf60832009-09-20 13:37:50 -0500212 * define the name here, and add an invocation of the macro wherever it's
213 * needed.
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500214 */
Glenn Randers-Pehrson9bf60832009-09-20 13:37:50 -0500215#define PNG_IHDR PNG_CONST png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'}
216#define PNG_IDAT PNG_CONST png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'}
217#define PNG_IEND PNG_CONST png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'}
218#define PNG_PLTE PNG_CONST png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'}
219#define PNG_bKGD PNG_CONST png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'}
220#define PNG_cHRM PNG_CONST png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'}
221#define PNG_gAMA PNG_CONST png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'}
222#define PNG_hIST PNG_CONST png_byte png_hIST[5] = {104, 73, 83, 84, '\0'}
223#define PNG_iCCP PNG_CONST png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'}
224#define PNG_iTXt PNG_CONST png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'}
225#define PNG_oFFs PNG_CONST png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'}
226#define PNG_pCAL PNG_CONST png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'}
227#define PNG_sCAL PNG_CONST png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'}
228#define PNG_pHYs PNG_CONST png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'}
229#define PNG_sBIT PNG_CONST png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'}
230#define PNG_sPLT PNG_CONST png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'}
231#define PNG_sRGB PNG_CONST png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'}
232#define PNG_sTER PNG_CONST png_byte png_sTER[5] = {115, 84, 69, 82, '\0'}
233#define PNG_tEXt PNG_CONST png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'}
234#define PNG_tIME PNG_CONST png_byte png_tIME[5] = {116, 73, 77, 69, '\0'}
235#define PNG_tRNS PNG_CONST png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'}
236#define PNG_zTXt PNG_CONST png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'}
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500237
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500238
239/* Inhibit C++ name-mangling for libpng functions but not for system calls. */
240#ifdef __cplusplus
241extern "C" {
242#endif /* __cplusplus */
243
244/* These functions are used internally in the code. They generally
245 * shouldn't be used unless you are writing code to add or replace some
246 * functionality in libpng. More information about most functions can
247 * be found in the files where the functions are located.
248 */
249
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500250/* Allocate memory for an internal libpng struct */
251PNG_EXTERN png_voidp png_create_struct PNGARG((int type));
252
253/* Free memory from internal libpng struct */
254PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));
255
256PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600257 malloc_fn, png_voidp mem_ptr));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500258PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600259 png_free_ptr free_fn, png_voidp mem_ptr));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500260
261/* Free any memory that info_ptr points to and reset struct. */
262PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600263 png_infop info_ptr));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500264
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500265/* Function to allocate memory for zlib. PNGAPI is disallowed. */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500266PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
267
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500268/* Function to free memory for zlib. PNGAPI is disallowed. */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500269PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
270
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500271/* Next four functions are used internally as callbacks. PNGAPI is required
272 * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */
273
274PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600275 png_bytep data, png_size_t length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500276
277#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
278PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600279 png_bytep buffer, png_size_t length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500280#endif
281
282PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600283 png_bytep data, png_size_t length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500284
Glenn Randers-Pehrsondbd40142009-08-31 08:42:02 -0500285#ifdef PNG_WRITE_FLUSH_SUPPORTED
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600286# ifdef PNG_STDIO_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500287PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr));
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600288# endif
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500289#endif
290
291/* Reset the CRC variable */
292PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));
293
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500294/* Write the "data" buffer to whatever output you are using */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500295PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600296 png_size_t length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500297
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500298/* Read the chunk header (length + type name) */
299PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr));
300
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500301/* Read data from whatever input you are using into the "data" buffer */
302PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600303 png_size_t length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500304
305/* Read bytes into buf, and update png_ptr->crc */
306PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600307 png_size_t length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500308
309/* Decompress data in a chunk that uses compression */
310#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \
311 defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
Glenn Randers-Pehrson895a9c92008-07-25 08:51:18 -0500312PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600313 int comp_type, png_size_t chunklength, png_size_t prefix_length,
314 png_size_t *data_length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500315#endif
316
317/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
318PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip));
319
320/* Read the CRC from the file and compare it to the libpng calculated CRC */
321PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr));
322
323/* Calculate the CRC over a section of data. Note that we are only
324 * passing a maximum of 64K on systems that have this as a memory limit,
325 * since this is the maximum buffer size we can specify.
326 */
327PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600328 png_size_t length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500329
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500330#ifdef PNG_WRITE_FLUSH_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500331PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
332#endif
333
Glenn Randers-Pehrson6c7a09a2009-06-15 21:57:39 -0500334/* Write various chunks */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500335
336/* Write the IHDR chunk, and update the png_struct with the necessary
337 * information.
338 */
339PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600340 png_uint_32 height,
341 int bit_depth, int color_type, int compression_method, int filter_method,
342 int interlace_method));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500343
344PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600345 png_uint_32 num_pal));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500346
347PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600348 png_size_t length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500349
350PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr));
351
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500352#ifdef PNG_WRITE_gAMA_SUPPORTED
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600353# ifdef PNG_FLOATING_POINT_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500354PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma));
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600355# endif
356# ifdef PNG_FIXED_POINT_SUPPORTED
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600357PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr,
358 png_fixed_point file_gamma));
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600359# endif
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500360#endif
361
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500362#ifdef PNG_WRITE_sBIT_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500363PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600364 int color_type));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500365#endif
366
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500367#ifdef PNG_WRITE_cHRM_SUPPORTED
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600368# ifdef PNG_FLOATING_POINT_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500369PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600370 double white_x, double white_y,
371 double red_x, double red_y, double green_x, double green_y,
372 double blue_x, double blue_y));
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600373# endif
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500374PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600375 png_fixed_point int_white_x, png_fixed_point int_white_y,
376 png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
377 int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
378 png_fixed_point int_blue_y));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500379#endif
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500380
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500381#ifdef PNG_WRITE_sRGB_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500382PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600383 int intent));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500384#endif
385
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500386#ifdef PNG_WRITE_iCCP_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500387PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600388 png_charp name, int compression_type,
389 png_charp profile, int proflen));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500390 /* Note to maintainer: profile should be png_bytep */
391#endif
392
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500393#ifdef PNG_WRITE_sPLT_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500394PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600395 png_sPLT_tp palette));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500396#endif
397
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500398#ifdef PNG_WRITE_tRNS_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500399PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600400 png_color_16p values, int number, int color_type));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500401#endif
402
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500403#ifdef PNG_WRITE_bKGD_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500404PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600405 png_color_16p values, int color_type));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500406#endif
407
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500408#ifdef PNG_WRITE_hIST_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500409PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600410 int num_hist));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500411#endif
412
413#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
414 defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
415PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600416 png_charp key, png_charpp new_key));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500417#endif
418
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500419#ifdef PNG_WRITE_tEXt_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500420PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600421 png_charp text, png_size_t text_len));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500422#endif
423
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500424#ifdef PNG_WRITE_zTXt_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500425PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600426 png_charp text, png_size_t text_len, int compression));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500427#endif
428
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500429#ifdef PNG_WRITE_iTXt_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500430PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600431 int compression, png_charp key, png_charp lang, png_charp lang_key,
432 png_charp text));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500433#endif
434
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500435#ifdef PNG_TEXT_SUPPORTED /* Added at version 1.0.14 and 1.2.4 */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500436PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600437 png_infop info_ptr, png_textp text_ptr, int num_text));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500438#endif
439
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500440#ifdef PNG_WRITE_oFFs_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500441PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600442 png_int_32 x_offset, png_int_32 y_offset, int unit_type));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500443#endif
444
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500445#ifdef PNG_WRITE_pCAL_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500446PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600447 png_int_32 X0, png_int_32 X1, int type, int nparams,
448 png_charp units, png_charpp params));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500449#endif
450
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500451#ifdef PNG_WRITE_pHYs_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500452PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600453 png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
454 int unit_type));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500455#endif
456
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500457#ifdef PNG_WRITE_tIME_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500458PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600459 png_timep mod_time));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500460#endif
461
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500462#ifdef PNG_WRITE_sCAL_SUPPORTED
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600463# if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500464PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600465 int unit, double width, double height));
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600466# else
467# ifdef PNG_FIXED_POINT_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500468PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600469 int unit, png_charp width, png_charp height));
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600470# endif
471# endif
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500472#endif
473
474/* Called when finished processing a row of data */
475PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr));
476
477/* Internal use only. Called before first row of data */
478PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));
479
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500480#ifdef PNG_READ_GAMMA_SUPPORTED
Glenn Randers-Pehrsonffa89242009-12-13 08:14:40 -0600481PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600482 png_byte bit_depth));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500483#endif
484
Glenn Randers-Pehrson6c7a09a2009-06-15 21:57:39 -0500485/* Combine a row of data, dealing with alpha, etc. if requested */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500486PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600487 int mask));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500488
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500489#ifdef PNG_READ_INTERLACING_SUPPORTED
Glenn Randers-Pehrson6c7a09a2009-06-15 21:57:39 -0500490/* Expand an interlaced row */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500491/* OLD pre-1.0.9 interface:
492PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600493 png_bytep row, int pass, png_uint_32 transformations));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500494 */
495PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));
496#endif
497
498/* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */
499
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500500#ifdef PNG_WRITE_INTERLACING_SUPPORTED
Glenn Randers-Pehrson6c7a09a2009-06-15 21:57:39 -0500501/* Grab pixels out of a row for an interlaced pass */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500502PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600503 png_bytep row, int pass));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500504#endif
505
Glenn Randers-Pehrson6c7a09a2009-06-15 21:57:39 -0500506/* Unfilter a row */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500507PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600508 png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500509
510/* Choose the best filter to use and filter the row data */
511PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600512 png_row_infop row_info));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500513
514/* Write out the filtered row. */
515PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600516 png_bytep filtered_row));
Glenn Randers-Pehrson6c7a09a2009-06-15 21:57:39 -0500517/* Finish a row while reading, dealing with interlacing passes, etc. */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500518PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr));
519
Glenn Randers-Pehrson6c7a09a2009-06-15 21:57:39 -0500520/* Initialize the row buffers, etc. */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500521PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr));
Glenn Randers-Pehrson6c7a09a2009-06-15 21:57:39 -0500522/* Optional call to update the users info structure */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500523PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600524 png_infop info_ptr));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500525
Glenn Randers-Pehrson6c7a09a2009-06-15 21:57:39 -0500526/* These are the functions that do the transformations */
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500527#ifdef PNG_READ_FILLER_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500528PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600529 png_bytep row, png_uint_32 filler, png_uint_32 flags));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500530#endif
531
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500532#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500533PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600534 png_bytep row));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500535#endif
536
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500537#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500538PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600539 png_bytep row));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500540#endif
541
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500542#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500543PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600544 png_bytep row));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500545#endif
546
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500547#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500548PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600549 png_bytep row));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500550#endif
551
552#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
553 defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
554PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600555 png_bytep row, png_uint_32 flags));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500556#endif
557
558#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
559PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));
560#endif
561
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600562#if defined(PNG_READ_PACKSWAP_SUPPORTED) || \
563 defined(PNG_WRITE_PACKSWAP_SUPPORTED)
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500564PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row));
565#endif
566
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500567#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500568PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600569 row_info, png_bytep row));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500570#endif
571
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500572#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500573PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600574 png_bytep row));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500575#endif
576
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500577#ifdef PNG_READ_PACK_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500578PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));
579#endif
580
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500581#ifdef PNG_READ_SHIFT_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500582PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600583 png_color_8p sig_bits));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500584#endif
585
586#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
587PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));
588#endif
589
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500590#ifdef PNG_READ_16_TO_8_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500591PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));
592#endif
593
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500594#ifdef PNG_READ_DITHER_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500595PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600596 png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500597
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500598# ifdef PNG_CORRECT_PALETTE_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500599PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600600 png_colorp palette, int num_palette));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500601# endif
602#endif
603
604#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
605PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row));
606#endif
607
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500608#ifdef PNG_WRITE_PACK_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500609PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info,
610 png_bytep row, png_uint_32 bit_depth));
611#endif
612
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500613#ifdef PNG_WRITE_SHIFT_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500614PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600615 png_color_8p bit_depth));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500616#endif
617
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500618#ifdef PNG_READ_BACKGROUND_SUPPORTED
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600619# ifdef PNG_READ_GAMMA_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500620PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600621 png_color_16p trans_color, png_color_16p background,
622 png_color_16p background_1,
623 png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
624 png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
625 png_uint_16pp gamma_16_to_1, int gamma_shift));
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600626# else
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500627PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600628 png_color_16p trans_color, png_color_16p background));
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600629# endif
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500630#endif
631
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500632#ifdef PNG_READ_GAMMA_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500633PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600634 png_bytep gamma_table, png_uint_16pp gamma_16_table,
635 int gamma_shift));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500636#endif
637
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500638#ifdef PNG_READ_EXPAND_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500639PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600640 png_bytep row, png_colorp palette, png_bytep trans, int num_trans));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500641PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600642 png_bytep row, png_color_16p trans_value));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500643#endif
644
645/* The following decodes the appropriate chunks, and does error correction,
646 * then calls the appropriate callback for the chunk if it is valid.
647 */
648
Glenn Randers-Pehrson6c7a09a2009-06-15 21:57:39 -0500649/* Decode the IHDR chunk */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500650PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600651 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500652PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600653 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500654PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600655 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500656
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500657#ifdef PNG_READ_bKGD_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500658PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600659 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500660#endif
661
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500662#ifdef PNG_READ_cHRM_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500663PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600664 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500665#endif
666
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500667#ifdef PNG_READ_gAMA_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500668PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600669 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500670#endif
671
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500672#ifdef PNG_READ_hIST_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500673PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600674 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500675#endif
676
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500677#ifdef PNG_READ_iCCP_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500678extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600679 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500680#endif /* PNG_READ_iCCP_SUPPORTED */
681
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500682#ifdef PNG_READ_iTXt_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500683PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600684 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500685#endif
686
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500687#ifdef PNG_READ_oFFs_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500688PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600689 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500690#endif
691
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500692#ifdef PNG_READ_pCAL_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500693PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600694 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500695#endif
696
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500697#ifdef PNG_READ_pHYs_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500698PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600699 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500700#endif
701
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500702#ifdef PNG_READ_sBIT_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500703PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600704 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500705#endif
706
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500707#ifdef PNG_READ_sCAL_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500708PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600709 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500710#endif
711
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500712#ifdef PNG_READ_sPLT_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500713extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600714 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500715#endif /* PNG_READ_sPLT_SUPPORTED */
716
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500717#ifdef PNG_READ_sRGB_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500718PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600719 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500720#endif
721
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500722#ifdef PNG_READ_tEXt_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500723PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600724 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500725#endif
726
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500727#ifdef PNG_READ_tIME_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500728PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600729 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500730#endif
731
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500732#ifdef PNG_READ_tRNS_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500733PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600734 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500735#endif
736
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500737#ifdef PNG_READ_zTXt_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500738PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600739 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500740#endif
741
742PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600743 png_infop info_ptr, png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500744
745PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600746 png_bytep chunk_name));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500747
Glenn Randers-Pehrson6c7a09a2009-06-15 21:57:39 -0500748/* Handle the transformations for reading and writing */
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500749PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));
750PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr));
751
752PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr));
753
754#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
755PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600756 png_infop info_ptr));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500757PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600758 png_infop info_ptr));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500759PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr));
760PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600761 png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500762PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr));
763PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr));
764PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600765 png_bytep buffer, png_size_t buffer_length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500766PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr));
767PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600768 png_bytep buffer, png_size_t buffer_length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500769PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr));
770PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr,
771 png_infop info_ptr, png_uint_32 length));
772PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr,
773 png_infop info_ptr));
774PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr,
775 png_infop info_ptr));
776PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row));
777PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600778 png_infop info_ptr));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500779PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600780 png_infop info_ptr));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500781PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr));
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600782# ifdef PNG_READ_tEXt_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500783PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600784 png_infop info_ptr, png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500785PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600786 png_infop info_ptr));
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600787# endif
788# ifdef PNG_READ_zTXt_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500789PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600790 png_infop info_ptr, png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500791PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600792 png_infop info_ptr));
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600793# endif
794# ifdef PNG_READ_iTXt_SUPPORTED
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500795PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600796 png_infop info_ptr, png_uint_32 length));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500797PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600798 png_infop info_ptr));
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600799# endif
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500800
801#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
802
803#ifdef PNG_MNG_FEATURES_SUPPORTED
804PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600805 png_bytep row));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500806PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600807 png_bytep row));
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500808#endif
809
Glenn Randers-Pehrsonf7831012008-11-13 06:05:13 -0600810/* Added at libpng version 1.4.0 */
Glenn Randers-Pehrson4e6b5e92009-09-23 10:24:53 -0500811#ifdef PNG_cHRM_SUPPORTED
Glenn Randers-Pehrson134bbe42009-09-24 18:10:49 -0500812PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600813 png_fixed_point int_white_x, png_fixed_point int_white_y,
814 png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
815 int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
816 png_fixed_point int_blue_y));
Glenn Randers-Pehrsonf7831012008-11-13 06:05:13 -0600817#endif
Glenn Randers-Pehrsonf7831012008-11-13 06:05:13 -0600818
Glenn Randers-Pehrson7ec330d2009-09-25 11:45:42 -0500819#ifdef PNG_cHRM_SUPPORTED
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600820# ifdef PNG_CHECK_cHRM_SUPPORTED
Glenn Randers-Pehrson7ec330d2009-09-25 11:45:42 -0500821/* Added at libpng version 1.2.34 and 1.4.0 */
822PNG_EXTERN void png_64bit_product PNGARG((long v1, long v2,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600823 unsigned long *hi_product, unsigned long *lo_product));
Glenn Randers-Pehrsond4df36c2010-03-06 10:45:55 -0600824# endif
Glenn Randers-Pehrson7ec330d2009-09-25 11:45:42 -0500825#endif
826
Glenn Randers-Pehrson134bbe42009-09-24 18:10:49 -0500827/* Added at libpng version 1.4.0 */
828PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600829 png_uint_32 width, png_uint_32 height, int bit_depth,
830 int color_type, int interlace_type, int compression_type,
831 int filter_type));
Glenn Randers-Pehrson134bbe42009-09-24 18:10:49 -0500832
Glenn Randers-Pehrsond29033f2009-11-07 10:46:42 -0600833/* Free all memory used by the read (old method - NOT DLL EXPORTED) */
834extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600835 png_infop end_info_ptr));
Glenn Randers-Pehrsond29033f2009-11-07 10:46:42 -0600836
837/* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
838extern void png_write_destroy PNGARG((png_structp png_ptr));
839
840#ifdef USE_FAR_KEYWORD /* memory model conversion function */
841extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
Glenn Randers-Pehrsone8b1aa02010-03-06 11:39:29 -0600842 int check));
Glenn Randers-Pehrsond29033f2009-11-07 10:46:42 -0600843#endif /* USE_FAR_KEYWORD */
844
Glenn Randers-Pehrsonc3cd22b2010-03-08 21:10:25 -0600845#include "pngdebug.h"
Glenn Randers-Pehrsond29033f2009-11-07 10:46:42 -0600846
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500847/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
848
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500849#ifdef __cplusplus
850}
851#endif
852
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500853#endif /* PNGPRIV_H */