Glenn Randers-Pehrson | d60b8fa | 2006-04-20 21:31:14 -0500 | [diff] [blame] | 1 | |
Glenn Randers-Pehrson | beb572e | 2006-08-19 13:59:24 -0500 | [diff] [blame] | 2 | /* pngpriv.h - private declarations for use inside libpng |
Glenn Randers-Pehrson | d60b8fa | 2006-04-20 21:31:14 -0500 | [diff] [blame] | 3 | * |
Glenn Randers-Pehrson | d84748a | 2009-06-24 08:17:34 -0500 | [diff] [blame] | 4 | * libpng version 1.4.0beta65 - June 24, 2009 |
Glenn Randers-Pehrson | d60b8fa | 2006-04-20 21:31:14 -0500 | [diff] [blame] | 5 | * For conditions of distribution and use, see copyright notice in png.h |
Glenn Randers-Pehrson | 79134c6 | 2009-02-14 10:32:18 -0600 | [diff] [blame] | 6 | * Copyright (c) 1998-2009 Glenn Randers-Pehrson |
Glenn Randers-Pehrson | d60b8fa | 2006-04-20 21:31:14 -0500 | [diff] [blame] | 7 | * (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-Pehrson | 3e61d79 | 2009-06-24 09:31:28 -0500 | [diff] [blame^] | 9 | * |
| 10 | * This code is released under the zlib-libpng license. |
| 11 | * |
Glenn Randers-Pehrson | d60b8fa | 2006-04-20 21:31:14 -0500 | [diff] [blame] | 12 | */ |
| 13 | |
Glenn Randers-Pehrson | beb572e | 2006-08-19 13:59:24 -0500 | [diff] [blame] | 14 | /* The symbols declared in this file (including the functions declared |
| 15 | * as PNG_EXTERN) are PRIVATE. They are not part of the libpng public |
| 16 | * interface, and are not recommended for use by regular applications. |
| 17 | * Some of them may become public in the future; others may stay private, |
| 18 | * change in an incompatible way, or even disappear. |
| 19 | * Although the libpng users are not forbidden to include this header, |
| 20 | * they should be well aware of the issues that may arise from doing so. |
| 21 | */ |
| 22 | |
| 23 | #ifndef PNGPRIV_H |
| 24 | #define PNGPRIV_H |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 25 | |
| 26 | #ifndef PNG_VERSION_INFO_ONLY |
| 27 | |
| 28 | #include <stdlib.h> |
| 29 | |
Glenn Randers-Pehrson | beb572e | 2006-08-19 13:59:24 -0500 | [diff] [blame] | 30 | /* The functions exported by PNG_EXTERN are internal functions, which |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 31 | * aren't usually used outside the library (as far as I know), so it is |
Glenn Randers-Pehrson | beb572e | 2006-08-19 13:59:24 -0500 | [diff] [blame] | 32 | * debatable if they should be exported at all. In the future, when it |
| 33 | * is possible to have run-time registry of chunk-handling functions, |
| 34 | * some of these will be made available again. |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 35 | #define PNG_EXTERN extern |
| 36 | */ |
| 37 | #define PNG_EXTERN |
| 38 | |
| 39 | /* Other defines specific to compilers can go here. Try to keep |
| 40 | * them inside an appropriate ifdef/endif pair for portability. |
| 41 | */ |
| 42 | |
| 43 | #if defined(PNG_FLOATING_POINT_SUPPORTED) |
| 44 | # if defined(MACOS) |
| 45 | /* We need to check that <math.h> hasn't already been included earlier |
| 46 | * as it seems it doesn't agree with <fp.h>, yet we should really use |
| 47 | * <fp.h> if possible. |
| 48 | */ |
| 49 | # if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__) |
| 50 | # include <fp.h> |
| 51 | # endif |
| 52 | # else |
| 53 | # include <math.h> |
| 54 | # endif |
| 55 | # if defined(_AMIGA) && defined(__SASC) && defined(_M68881) |
| 56 | /* Amiga SAS/C: We must include builtin FPU functions when compiling using |
| 57 | * MATH=68881 |
| 58 | */ |
| 59 | # include <m68881.h> |
| 60 | # endif |
| 61 | #endif |
| 62 | |
| 63 | /* Codewarrior on NT has linking problems without this. */ |
| 64 | #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__) |
| 65 | # define PNG_ALWAYS_EXTERN |
| 66 | #endif |
| 67 | |
| 68 | /* This provides the non-ANSI (far) memory allocation routines. */ |
| 69 | #if defined(__TURBOC__) && defined(__MSDOS__) |
| 70 | # include <mem.h> |
| 71 | # include <alloc.h> |
| 72 | #endif |
| 73 | |
| 74 | #if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \ |
| 75 | defined(_WIN32) || defined(__WIN32__) |
| 76 | # include <windows.h> /* defines _WINDOWS_ macro */ |
| 77 | /* I have no idea why is this necessary... */ |
| 78 | # if defined(_MSC_VER) |
| 79 | # include <malloc.h> |
| 80 | # endif |
| 81 | #endif |
| 82 | |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 83 | /* Various modes of operation. Note that after an init, mode is set to |
| 84 | * zero automatically when the structure is created. |
| 85 | */ |
| 86 | #define PNG_HAVE_IHDR 0x01 |
| 87 | #define PNG_HAVE_PLTE 0x02 |
| 88 | #define PNG_HAVE_IDAT 0x04 |
Glenn Randers-Pehrson | 6bc53be | 2006-06-16 07:52:03 -0500 | [diff] [blame] | 89 | #define PNG_AFTER_IDAT 0x08 /* Have complete zlib datastream */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 90 | #define PNG_HAVE_IEND 0x10 |
| 91 | #define PNG_HAVE_gAMA 0x20 |
| 92 | #define PNG_HAVE_cHRM 0x40 |
| 93 | #define PNG_HAVE_sRGB 0x80 |
| 94 | #define PNG_HAVE_CHUNK_HEADER 0x100 |
| 95 | #define PNG_WROTE_tIME 0x200 |
| 96 | #define PNG_WROTE_INFO_BEFORE_PLTE 0x400 |
| 97 | #define PNG_BACKGROUND_IS_GRAY 0x800 |
| 98 | #define PNG_HAVE_PNG_SIGNATURE 0x1000 |
Glenn Randers-Pehrson | 6bc53be | 2006-06-16 07:52:03 -0500 | [diff] [blame] | 99 | #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 100 | |
Glenn Randers-Pehrson | 6c7a09a | 2009-06-15 21:57:39 -0500 | [diff] [blame] | 101 | /* Flags for the transformations the PNG library does on the image data */ |
Glenn Randers-Pehrson | 1916f6a | 2008-08-14 13:44:49 -0500 | [diff] [blame] | 102 | #define PNG_BGR 0x0001 |
| 103 | #define PNG_INTERLACE 0x0002 |
| 104 | #define PNG_PACK 0x0004 |
| 105 | #define PNG_SHIFT 0x0008 |
| 106 | #define PNG_SWAP_BYTES 0x0010 |
| 107 | #define PNG_INVERT_MONO 0x0020 |
| 108 | #define PNG_DITHER 0x0040 |
| 109 | #define PNG_BACKGROUND 0x0080 |
| 110 | #define PNG_BACKGROUND_EXPAND 0x0100 |
| 111 | /* 0x0200 unused */ |
| 112 | #define PNG_16_TO_8 0x0400 |
| 113 | #define PNG_RGBA 0x0800 |
| 114 | #define PNG_EXPAND 0x1000 |
| 115 | #define PNG_GAMMA 0x2000 |
| 116 | #define PNG_GRAY_TO_RGB 0x4000 |
| 117 | #define PNG_FILLER 0x8000L |
| 118 | #define PNG_PACKSWAP 0x10000L |
| 119 | #define PNG_SWAP_ALPHA 0x20000L |
| 120 | #define PNG_STRIP_ALPHA 0x40000L |
| 121 | #define PNG_INVERT_ALPHA 0x80000L |
| 122 | #define PNG_USER_TRANSFORM 0x100000L |
| 123 | #define PNG_RGB_TO_GRAY_ERR 0x200000L |
| 124 | #define PNG_RGB_TO_GRAY_WARN 0x400000L |
| 125 | #define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */ |
| 126 | /* 0x800000L Unused */ |
| 127 | #define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */ |
| 128 | #define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */ |
Glenn Randers-Pehrson | 8fb550c | 2009-03-21 08:15:32 -0500 | [diff] [blame] | 129 | #define PNG_PREMULTIPLY_ALPHA 0x4000000L /* Added to libpng-1.4.0 */ |
| 130 | /* by volker */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 131 | /* 0x8000000L unused */ |
| 132 | /* 0x10000000L unused */ |
| 133 | /* 0x20000000L unused */ |
| 134 | /* 0x40000000L unused */ |
| 135 | |
Glenn Randers-Pehrson | 6c7a09a | 2009-06-15 21:57:39 -0500 | [diff] [blame] | 136 | /* Flags for png_create_struct */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 137 | #define PNG_STRUCT_PNG 0x0001 |
| 138 | #define PNG_STRUCT_INFO 0x0002 |
| 139 | |
| 140 | /* Scaling factor for filter heuristic weighting calculations */ |
| 141 | #define PNG_WEIGHT_SHIFT 8 |
| 142 | #define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT)) |
| 143 | #define PNG_COST_SHIFT 3 |
| 144 | #define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT)) |
| 145 | |
Glenn Randers-Pehrson | 6c7a09a | 2009-06-15 21:57:39 -0500 | [diff] [blame] | 146 | /* Flags for the png_ptr->flags rather than declaring a byte for each one */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 147 | #define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001 |
| 148 | #define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002 |
| 149 | #define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004 |
| 150 | #define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008 |
| 151 | #define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010 |
| 152 | #define PNG_FLAG_ZLIB_FINISHED 0x0020 |
| 153 | #define PNG_FLAG_ROW_INIT 0x0040 |
| 154 | #define PNG_FLAG_FILLER_AFTER 0x0080 |
| 155 | #define PNG_FLAG_CRC_ANCILLARY_USE 0x0100 |
| 156 | #define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200 |
| 157 | #define PNG_FLAG_CRC_CRITICAL_USE 0x0400 |
| 158 | #define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800 |
| 159 | #define PNG_FLAG_FREE_PLTE 0x1000 |
| 160 | #define PNG_FLAG_FREE_TRNS 0x2000 |
| 161 | #define PNG_FLAG_FREE_HIST 0x4000 |
| 162 | #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L |
| 163 | #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L |
| 164 | #define PNG_FLAG_LIBRARY_MISMATCH 0x20000L |
| 165 | #define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L |
| 166 | #define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L |
| 167 | #define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L |
| 168 | #define PNG_FLAG_ADD_ALPHA 0x200000L /* Added to libpng-1.2.8 */ |
| 169 | #define PNG_FLAG_STRIP_ALPHA 0x400000L /* Added to libpng-1.2.8 */ |
Glenn Randers-Pehrson | 6bc53be | 2006-06-16 07:52:03 -0500 | [diff] [blame] | 170 | #define PNG_FLAG_BENIGN_ERRORS_WARN 0x800000L /* Added to libpng-1.4.0 */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 171 | /* 0x1000000L unused */ |
| 172 | /* 0x2000000L unused */ |
| 173 | /* 0x4000000L unused */ |
| 174 | /* 0x8000000L unused */ |
| 175 | /* 0x10000000L unused */ |
| 176 | /* 0x20000000L unused */ |
| 177 | /* 0x40000000L unused */ |
| 178 | |
| 179 | #define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \ |
| 180 | PNG_FLAG_CRC_ANCILLARY_NOWARN) |
| 181 | |
| 182 | #define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \ |
| 183 | PNG_FLAG_CRC_CRITICAL_IGNORE) |
| 184 | |
| 185 | #define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \ |
| 186 | PNG_FLAG_CRC_CRITICAL_MASK) |
| 187 | |
Glenn Randers-Pehrson | 6c7a09a | 2009-06-15 21:57:39 -0500 | [diff] [blame] | 188 | /* Save typing and make code easier to understand */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 189 | |
| 190 | #define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \ |
| 191 | abs((int)((c1).green) - (int)((c2).green)) + \ |
| 192 | abs((int)((c1).blue) - (int)((c2).blue))) |
| 193 | |
| 194 | /* Added to libpng-1.2.6 JB */ |
| 195 | #define PNG_ROWBYTES(pixel_bits, width) \ |
| 196 | ((pixel_bits) >= 8 ? \ |
Glenn Randers-Pehrson | beb572e | 2006-08-19 13:59:24 -0500 | [diff] [blame] | 197 | ((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \ |
| 198 | (( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) ) |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 199 | |
| 200 | /* PNG_OUT_OF_RANGE returns true if value is outside the range |
| 201 | ideal-delta..ideal+delta. Each argument is evaluated twice. |
| 202 | "ideal" and "delta" should be constants, normally simple |
| 203 | integers, "value" a variable. Added to libpng-1.2.6 JB */ |
| 204 | #define PNG_OUT_OF_RANGE(value, ideal, delta) \ |
| 205 | ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) ) |
| 206 | |
Glenn Randers-Pehrson | 6c7a09a | 2009-06-15 21:57:39 -0500 | [diff] [blame] | 207 | /* Variables declared in png.c - only it needs to define PNG_NO_EXTERN */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 208 | #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN) |
Glenn Randers-Pehrson | 6c7a09a | 2009-06-15 21:57:39 -0500 | [diff] [blame] | 209 | /* Place to hold the signature string for a PNG file. */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 210 | #ifdef PNG_USE_GLOBAL_ARRAYS |
| 211 | PNG_EXPORT_VAR (const png_byte FARDATA) png_sig[8]; |
| 212 | #else |
| 213 | #if 0 |
| 214 | #define png_sig png_sig_bytes(NULL) |
| 215 | #endif |
| 216 | #endif |
| 217 | #endif /* PNG_NO_EXTERN */ |
| 218 | |
| 219 | /* Constant strings for known chunk types. If you need to add a chunk, |
| 220 | * define the name here, and add an invocation of the macro in png.c and |
| 221 | * wherever it's needed. |
| 222 | */ |
| 223 | #define PNG_IHDR const png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'} |
| 224 | #define PNG_IDAT const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'} |
| 225 | #define PNG_IEND const png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'} |
| 226 | #define PNG_PLTE const png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'} |
| 227 | #define PNG_bKGD const png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'} |
| 228 | #define PNG_cHRM const png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'} |
| 229 | #define PNG_gAMA const png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'} |
| 230 | #define PNG_hIST const png_byte png_hIST[5] = {104, 73, 83, 84, '\0'} |
| 231 | #define PNG_iCCP const png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'} |
| 232 | #define PNG_iTXt const png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'} |
| 233 | #define PNG_oFFs const png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'} |
| 234 | #define PNG_pCAL const png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'} |
| 235 | #define PNG_sCAL const png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'} |
| 236 | #define PNG_pHYs const png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'} |
| 237 | #define PNG_sBIT const png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'} |
| 238 | #define PNG_sPLT const png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'} |
| 239 | #define PNG_sRGB const png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'} |
Glenn Randers-Pehrson | d120996 | 2006-06-21 19:40:52 -0500 | [diff] [blame] | 240 | #define PNG_sTER const png_byte png_sTER[5] = {115, 84, 69, 82, '\0'} |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 241 | #define PNG_tEXt const png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'} |
| 242 | #define PNG_tIME const png_byte png_tIME[5] = {116, 73, 77, 69, '\0'} |
| 243 | #define PNG_tRNS const png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'} |
| 244 | #define PNG_zTXt const png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'} |
| 245 | |
| 246 | #ifdef PNG_USE_GLOBAL_ARRAYS |
| 247 | PNG_EXPORT_VAR (const png_byte FARDATA) png_IHDR[5]; |
| 248 | PNG_EXPORT_VAR (const png_byte FARDATA) png_IDAT[5]; |
| 249 | PNG_EXPORT_VAR (const png_byte FARDATA) png_IEND[5]; |
| 250 | PNG_EXPORT_VAR (const png_byte FARDATA) png_PLTE[5]; |
| 251 | PNG_EXPORT_VAR (const png_byte FARDATA) png_bKGD[5]; |
| 252 | PNG_EXPORT_VAR (const png_byte FARDATA) png_cHRM[5]; |
| 253 | PNG_EXPORT_VAR (const png_byte FARDATA) png_gAMA[5]; |
| 254 | PNG_EXPORT_VAR (const png_byte FARDATA) png_hIST[5]; |
| 255 | PNG_EXPORT_VAR (const png_byte FARDATA) png_iCCP[5]; |
| 256 | PNG_EXPORT_VAR (const png_byte FARDATA) png_iTXt[5]; |
| 257 | PNG_EXPORT_VAR (const png_byte FARDATA) png_oFFs[5]; |
| 258 | PNG_EXPORT_VAR (const png_byte FARDATA) png_pCAL[5]; |
| 259 | PNG_EXPORT_VAR (const png_byte FARDATA) png_sCAL[5]; |
| 260 | PNG_EXPORT_VAR (const png_byte FARDATA) png_pHYs[5]; |
| 261 | PNG_EXPORT_VAR (const png_byte FARDATA) png_sBIT[5]; |
| 262 | PNG_EXPORT_VAR (const png_byte FARDATA) png_sPLT[5]; |
| 263 | PNG_EXPORT_VAR (const png_byte FARDATA) png_sRGB[5]; |
| 264 | PNG_EXPORT_VAR (const png_byte FARDATA) png_tEXt[5]; |
| 265 | PNG_EXPORT_VAR (const png_byte FARDATA) png_tIME[5]; |
| 266 | PNG_EXPORT_VAR (const png_byte FARDATA) png_tRNS[5]; |
| 267 | PNG_EXPORT_VAR (const png_byte FARDATA) png_zTXt[5]; |
| 268 | #endif /* PNG_USE_GLOBAL_ARRAYS */ |
| 269 | |
| 270 | /* Inhibit C++ name-mangling for libpng functions but not for system calls. */ |
| 271 | #ifdef __cplusplus |
| 272 | extern "C" { |
| 273 | #endif /* __cplusplus */ |
| 274 | |
| 275 | /* These functions are used internally in the code. They generally |
| 276 | * shouldn't be used unless you are writing code to add or replace some |
| 277 | * functionality in libpng. More information about most functions can |
| 278 | * be found in the files where the functions are located. |
| 279 | */ |
| 280 | |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 281 | /* Allocate memory for an internal libpng struct */ |
| 282 | PNG_EXTERN png_voidp png_create_struct PNGARG((int type)); |
| 283 | |
| 284 | /* Free memory from internal libpng struct */ |
| 285 | PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr)); |
| 286 | |
| 287 | PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr |
| 288 | malloc_fn, png_voidp mem_ptr)); |
| 289 | PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr, |
| 290 | png_free_ptr free_fn, png_voidp mem_ptr)); |
| 291 | |
| 292 | /* Free any memory that info_ptr points to and reset struct. */ |
| 293 | PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr, |
| 294 | png_infop info_ptr)); |
| 295 | |
Glenn Randers-Pehrson | beb572e | 2006-08-19 13:59:24 -0500 | [diff] [blame] | 296 | /* Function to allocate memory for zlib. PNGAPI is disallowed. */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 297 | PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size)); |
| 298 | |
Glenn Randers-Pehrson | beb572e | 2006-08-19 13:59:24 -0500 | [diff] [blame] | 299 | /* Function to free memory for zlib. PNGAPI is disallowed. */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 300 | PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr)); |
| 301 | |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 302 | /* Next four functions are used internally as callbacks. PNGAPI is required |
| 303 | * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */ |
| 304 | |
| 305 | PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr, |
| 306 | png_bytep data, png_size_t length)); |
| 307 | |
| 308 | #ifdef PNG_PROGRESSIVE_READ_SUPPORTED |
| 309 | PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr, |
| 310 | png_bytep buffer, png_size_t length)); |
| 311 | #endif |
| 312 | |
| 313 | PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr, |
| 314 | png_bytep data, png_size_t length)); |
| 315 | |
| 316 | #if defined(PNG_WRITE_FLUSH_SUPPORTED) |
| 317 | #if !defined(PNG_NO_STDIO) |
| 318 | PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr)); |
| 319 | #endif |
| 320 | #endif |
| 321 | |
| 322 | /* Reset the CRC variable */ |
| 323 | PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr)); |
| 324 | |
Glenn Randers-Pehrson | beb572e | 2006-08-19 13:59:24 -0500 | [diff] [blame] | 325 | /* Write the "data" buffer to whatever output you are using */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 326 | PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data, |
| 327 | png_size_t length)); |
| 328 | |
Glenn Randers-Pehrson | beb572e | 2006-08-19 13:59:24 -0500 | [diff] [blame] | 329 | /* Read the chunk header (length + type name) */ |
| 330 | PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr)); |
| 331 | |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 332 | /* Read data from whatever input you are using into the "data" buffer */ |
| 333 | PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data, |
| 334 | png_size_t length)); |
| 335 | |
| 336 | /* Read bytes into buf, and update png_ptr->crc */ |
| 337 | PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf, |
| 338 | png_size_t length)); |
| 339 | |
| 340 | /* Decompress data in a chunk that uses compression */ |
| 341 | #if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \ |
| 342 | defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) |
Glenn Randers-Pehrson | 895a9c9 | 2008-07-25 08:51:18 -0500 | [diff] [blame] | 343 | PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr, |
| 344 | int comp_type, png_size_t chunklength, png_size_t prefix_length, |
| 345 | png_size_t *data_length)); |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 346 | #endif |
| 347 | |
| 348 | /* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */ |
| 349 | PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip)); |
| 350 | |
| 351 | /* Read the CRC from the file and compare it to the libpng calculated CRC */ |
| 352 | PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr)); |
| 353 | |
| 354 | /* Calculate the CRC over a section of data. Note that we are only |
| 355 | * passing a maximum of 64K on systems that have this as a memory limit, |
| 356 | * since this is the maximum buffer size we can specify. |
| 357 | */ |
| 358 | PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr, |
| 359 | png_size_t length)); |
| 360 | |
| 361 | #if defined(PNG_WRITE_FLUSH_SUPPORTED) |
| 362 | PNG_EXTERN void png_flush PNGARG((png_structp png_ptr)); |
| 363 | #endif |
| 364 | |
Glenn Randers-Pehrson | 6c7a09a | 2009-06-15 21:57:39 -0500 | [diff] [blame] | 365 | /* Write various chunks */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 366 | |
| 367 | /* Write the IHDR chunk, and update the png_struct with the necessary |
| 368 | * information. |
| 369 | */ |
| 370 | PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width, |
| 371 | png_uint_32 height, |
| 372 | int bit_depth, int color_type, int compression_method, int filter_method, |
| 373 | int interlace_method)); |
| 374 | |
| 375 | PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette, |
| 376 | png_uint_32 num_pal)); |
| 377 | |
| 378 | PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data, |
| 379 | png_size_t length)); |
| 380 | |
| 381 | PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr)); |
| 382 | |
| 383 | #if defined(PNG_WRITE_gAMA_SUPPORTED) |
| 384 | #ifdef PNG_FLOATING_POINT_SUPPORTED |
| 385 | PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma)); |
| 386 | #endif |
| 387 | #ifdef PNG_FIXED_POINT_SUPPORTED |
| 388 | PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, png_fixed_point |
| 389 | file_gamma)); |
| 390 | #endif |
| 391 | #endif |
| 392 | |
| 393 | #if defined(PNG_WRITE_sBIT_SUPPORTED) |
| 394 | PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit, |
| 395 | int color_type)); |
| 396 | #endif |
| 397 | |
| 398 | #if defined(PNG_WRITE_cHRM_SUPPORTED) |
| 399 | #ifdef PNG_FLOATING_POINT_SUPPORTED |
| 400 | PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr, |
| 401 | double white_x, double white_y, |
| 402 | double red_x, double red_y, double green_x, double green_y, |
| 403 | double blue_x, double blue_y)); |
| 404 | #endif |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 405 | PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr, |
| 406 | png_fixed_point int_white_x, png_fixed_point int_white_y, |
| 407 | png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point |
| 408 | int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, |
| 409 | png_fixed_point int_blue_y)); |
| 410 | #endif |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 411 | |
| 412 | #if defined(PNG_WRITE_sRGB_SUPPORTED) |
| 413 | PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr, |
| 414 | int intent)); |
| 415 | #endif |
| 416 | |
| 417 | #if defined(PNG_WRITE_iCCP_SUPPORTED) |
| 418 | PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr, |
| 419 | png_charp name, int compression_type, |
| 420 | png_charp profile, int proflen)); |
| 421 | /* Note to maintainer: profile should be png_bytep */ |
| 422 | #endif |
| 423 | |
| 424 | #if defined(PNG_WRITE_sPLT_SUPPORTED) |
| 425 | PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr, |
| 426 | png_sPLT_tp palette)); |
| 427 | #endif |
| 428 | |
| 429 | #if defined(PNG_WRITE_tRNS_SUPPORTED) |
| 430 | PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans, |
| 431 | png_color_16p values, int number, int color_type)); |
| 432 | #endif |
| 433 | |
| 434 | #if defined(PNG_WRITE_bKGD_SUPPORTED) |
| 435 | PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr, |
| 436 | png_color_16p values, int color_type)); |
| 437 | #endif |
| 438 | |
| 439 | #if defined(PNG_WRITE_hIST_SUPPORTED) |
| 440 | PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist, |
| 441 | int num_hist)); |
| 442 | #endif |
| 443 | |
| 444 | #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \ |
| 445 | defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED) |
| 446 | PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr, |
| 447 | png_charp key, png_charpp new_key)); |
| 448 | #endif |
| 449 | |
| 450 | #if defined(PNG_WRITE_tEXt_SUPPORTED) |
| 451 | PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key, |
| 452 | png_charp text, png_size_t text_len)); |
| 453 | #endif |
| 454 | |
| 455 | #if defined(PNG_WRITE_zTXt_SUPPORTED) |
| 456 | PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key, |
| 457 | png_charp text, png_size_t text_len, int compression)); |
| 458 | #endif |
| 459 | |
| 460 | #if defined(PNG_WRITE_iTXt_SUPPORTED) |
| 461 | PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr, |
| 462 | int compression, png_charp key, png_charp lang, png_charp lang_key, |
| 463 | png_charp text)); |
| 464 | #endif |
| 465 | |
| 466 | #if defined(PNG_TEXT_SUPPORTED) /* Added at version 1.0.14 and 1.2.4 */ |
| 467 | PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr, |
| 468 | png_infop info_ptr, png_textp text_ptr, int num_text)); |
| 469 | #endif |
| 470 | |
| 471 | #if defined(PNG_WRITE_oFFs_SUPPORTED) |
| 472 | PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr, |
| 473 | png_int_32 x_offset, png_int_32 y_offset, int unit_type)); |
| 474 | #endif |
| 475 | |
| 476 | #if defined(PNG_WRITE_pCAL_SUPPORTED) |
| 477 | PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose, |
| 478 | png_int_32 X0, png_int_32 X1, int type, int nparams, |
| 479 | png_charp units, png_charpp params)); |
| 480 | #endif |
| 481 | |
| 482 | #if defined(PNG_WRITE_pHYs_SUPPORTED) |
| 483 | PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr, |
| 484 | png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit, |
| 485 | int unit_type)); |
| 486 | #endif |
| 487 | |
| 488 | #if defined(PNG_WRITE_tIME_SUPPORTED) |
| 489 | PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr, |
| 490 | png_timep mod_time)); |
| 491 | #endif |
| 492 | |
| 493 | #if defined(PNG_WRITE_sCAL_SUPPORTED) |
| 494 | #if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO) |
| 495 | PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr, |
| 496 | int unit, double width, double height)); |
| 497 | #else |
| 498 | #ifdef PNG_FIXED_POINT_SUPPORTED |
| 499 | PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr, |
| 500 | int unit, png_charp width, png_charp height)); |
| 501 | #endif |
| 502 | #endif |
| 503 | #endif |
| 504 | |
| 505 | /* Called when finished processing a row of data */ |
| 506 | PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)); |
| 507 | |
| 508 | /* Internal use only. Called before first row of data */ |
| 509 | PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr)); |
| 510 | |
| 511 | #if defined(PNG_READ_GAMMA_SUPPORTED) |
| 512 | PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr)); |
| 513 | #endif |
| 514 | |
Glenn Randers-Pehrson | 6c7a09a | 2009-06-15 21:57:39 -0500 | [diff] [blame] | 515 | /* Combine a row of data, dealing with alpha, etc. if requested */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 516 | PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row, |
| 517 | int mask)); |
| 518 | |
| 519 | #if defined(PNG_READ_INTERLACING_SUPPORTED) |
Glenn Randers-Pehrson | 6c7a09a | 2009-06-15 21:57:39 -0500 | [diff] [blame] | 520 | /* Expand an interlaced row */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 521 | /* OLD pre-1.0.9 interface: |
| 522 | PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info, |
| 523 | png_bytep row, int pass, png_uint_32 transformations)); |
| 524 | */ |
| 525 | PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr)); |
| 526 | #endif |
| 527 | |
| 528 | /* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */ |
| 529 | |
| 530 | #if defined(PNG_WRITE_INTERLACING_SUPPORTED) |
Glenn Randers-Pehrson | 6c7a09a | 2009-06-15 21:57:39 -0500 | [diff] [blame] | 531 | /* Grab pixels out of a row for an interlaced pass */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 532 | PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info, |
| 533 | png_bytep row, int pass)); |
| 534 | #endif |
| 535 | |
Glenn Randers-Pehrson | 6c7a09a | 2009-06-15 21:57:39 -0500 | [diff] [blame] | 536 | /* Unfilter a row */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 537 | PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr, |
| 538 | png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter)); |
| 539 | |
| 540 | /* Choose the best filter to use and filter the row data */ |
| 541 | PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr, |
| 542 | png_row_infop row_info)); |
| 543 | |
| 544 | /* Write out the filtered row. */ |
| 545 | PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr, |
| 546 | png_bytep filtered_row)); |
Glenn Randers-Pehrson | 6c7a09a | 2009-06-15 21:57:39 -0500 | [diff] [blame] | 547 | /* Finish a row while reading, dealing with interlacing passes, etc. */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 548 | PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr)); |
| 549 | |
Glenn Randers-Pehrson | 6c7a09a | 2009-06-15 21:57:39 -0500 | [diff] [blame] | 550 | /* Initialize the row buffers, etc. */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 551 | PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr)); |
Glenn Randers-Pehrson | 6c7a09a | 2009-06-15 21:57:39 -0500 | [diff] [blame] | 552 | /* Optional call to update the users info structure */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 553 | PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr, |
| 554 | png_infop info_ptr)); |
| 555 | |
Glenn Randers-Pehrson | 6c7a09a | 2009-06-15 21:57:39 -0500 | [diff] [blame] | 556 | /* These are the functions that do the transformations */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 557 | #if defined(PNG_READ_FILLER_SUPPORTED) |
| 558 | PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info, |
| 559 | png_bytep row, png_uint_32 filler, png_uint_32 flags)); |
| 560 | #endif |
| 561 | |
| 562 | #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) |
| 563 | PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info, |
| 564 | png_bytep row)); |
| 565 | #endif |
| 566 | |
| 567 | #if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) |
| 568 | PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info, |
| 569 | png_bytep row)); |
| 570 | #endif |
| 571 | |
| 572 | #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) |
| 573 | PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info, |
| 574 | png_bytep row)); |
| 575 | #endif |
| 576 | |
| 577 | #if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) |
| 578 | PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info, |
| 579 | png_bytep row)); |
| 580 | #endif |
| 581 | |
| 582 | #if defined(PNG_WRITE_FILLER_SUPPORTED) || \ |
| 583 | defined(PNG_READ_STRIP_ALPHA_SUPPORTED) |
| 584 | PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info, |
| 585 | png_bytep row, png_uint_32 flags)); |
| 586 | #endif |
| 587 | |
Glenn Randers-Pehrson | 8fb550c | 2009-03-21 08:15:32 -0500 | [diff] [blame] | 588 | #if defined(PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED) |
| 589 | PNG_EXTERN void png_do_read_premultiply_alpha |
| 590 | PNGARG((png_row_infop row_info, png_bytep row)); |
| 591 | #endif |
| 592 | |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 593 | #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) |
| 594 | PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row)); |
| 595 | #endif |
| 596 | |
| 597 | #if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED) |
| 598 | PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row)); |
| 599 | #endif |
| 600 | |
| 601 | #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) |
| 602 | PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop |
| 603 | row_info, png_bytep row)); |
| 604 | #endif |
| 605 | |
| 606 | #if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED) |
| 607 | PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info, |
| 608 | png_bytep row)); |
| 609 | #endif |
| 610 | |
| 611 | #if defined(PNG_READ_PACK_SUPPORTED) |
| 612 | PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row)); |
| 613 | #endif |
| 614 | |
| 615 | #if defined(PNG_READ_SHIFT_SUPPORTED) |
| 616 | PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row, |
| 617 | png_color_8p sig_bits)); |
| 618 | #endif |
| 619 | |
| 620 | #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) |
| 621 | PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row)); |
| 622 | #endif |
| 623 | |
| 624 | #if defined(PNG_READ_16_TO_8_SUPPORTED) |
| 625 | PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row)); |
| 626 | #endif |
| 627 | |
| 628 | #if defined(PNG_READ_DITHER_SUPPORTED) |
| 629 | PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info, |
| 630 | png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup)); |
| 631 | |
| 632 | # if defined(PNG_CORRECT_PALETTE_SUPPORTED) |
| 633 | PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr, |
| 634 | png_colorp palette, int num_palette)); |
| 635 | # endif |
| 636 | #endif |
| 637 | |
| 638 | #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) |
| 639 | PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row)); |
| 640 | #endif |
| 641 | |
| 642 | #if defined(PNG_WRITE_PACK_SUPPORTED) |
| 643 | PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info, |
| 644 | png_bytep row, png_uint_32 bit_depth)); |
| 645 | #endif |
| 646 | |
| 647 | #if defined(PNG_WRITE_SHIFT_SUPPORTED) |
| 648 | PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row, |
| 649 | png_color_8p bit_depth)); |
| 650 | #endif |
| 651 | |
| 652 | #if defined(PNG_READ_BACKGROUND_SUPPORTED) |
| 653 | #if defined(PNG_READ_GAMMA_SUPPORTED) |
| 654 | PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, |
Glenn Randers-Pehrson | 56f6396 | 2008-10-06 10:16:17 -0500 | [diff] [blame] | 655 | png_color_16p trans_color, png_color_16p background, |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 656 | png_color_16p background_1, |
| 657 | png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1, |
| 658 | png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1, |
| 659 | png_uint_16pp gamma_16_to_1, int gamma_shift)); |
| 660 | #else |
| 661 | PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row, |
Glenn Randers-Pehrson | 56f6396 | 2008-10-06 10:16:17 -0500 | [diff] [blame] | 662 | png_color_16p trans_color, png_color_16p background)); |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 663 | #endif |
| 664 | #endif |
| 665 | |
| 666 | #if defined(PNG_READ_GAMMA_SUPPORTED) |
| 667 | PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row, |
| 668 | png_bytep gamma_table, png_uint_16pp gamma_16_table, |
| 669 | int gamma_shift)); |
| 670 | #endif |
| 671 | |
| 672 | #if defined(PNG_READ_EXPAND_SUPPORTED) |
| 673 | PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info, |
| 674 | png_bytep row, png_colorp palette, png_bytep trans, int num_trans)); |
| 675 | PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info, |
| 676 | png_bytep row, png_color_16p trans_value)); |
| 677 | #endif |
| 678 | |
| 679 | /* The following decodes the appropriate chunks, and does error correction, |
| 680 | * then calls the appropriate callback for the chunk if it is valid. |
| 681 | */ |
| 682 | |
Glenn Randers-Pehrson | 6c7a09a | 2009-06-15 21:57:39 -0500 | [diff] [blame] | 683 | /* Decode the IHDR chunk */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 684 | PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 685 | png_uint_32 length)); |
| 686 | PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 687 | png_uint_32 length)); |
| 688 | PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 689 | png_uint_32 length)); |
| 690 | |
| 691 | #if defined(PNG_READ_bKGD_SUPPORTED) |
| 692 | PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 693 | png_uint_32 length)); |
| 694 | #endif |
| 695 | |
| 696 | #if defined(PNG_READ_cHRM_SUPPORTED) |
| 697 | PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 698 | png_uint_32 length)); |
| 699 | #endif |
| 700 | |
| 701 | #if defined(PNG_READ_gAMA_SUPPORTED) |
| 702 | PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 703 | png_uint_32 length)); |
| 704 | #endif |
| 705 | |
| 706 | #if defined(PNG_READ_hIST_SUPPORTED) |
| 707 | PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 708 | png_uint_32 length)); |
| 709 | #endif |
| 710 | |
| 711 | #if defined(PNG_READ_iCCP_SUPPORTED) |
| 712 | extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 713 | png_uint_32 length)); |
| 714 | #endif /* PNG_READ_iCCP_SUPPORTED */ |
| 715 | |
| 716 | #if defined(PNG_READ_iTXt_SUPPORTED) |
| 717 | PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 718 | png_uint_32 length)); |
| 719 | #endif |
| 720 | |
| 721 | #if defined(PNG_READ_oFFs_SUPPORTED) |
| 722 | PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 723 | png_uint_32 length)); |
| 724 | #endif |
| 725 | |
| 726 | #if defined(PNG_READ_pCAL_SUPPORTED) |
| 727 | PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 728 | png_uint_32 length)); |
| 729 | #endif |
| 730 | |
| 731 | #if defined(PNG_READ_pHYs_SUPPORTED) |
| 732 | PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 733 | png_uint_32 length)); |
| 734 | #endif |
| 735 | |
| 736 | #if defined(PNG_READ_sBIT_SUPPORTED) |
| 737 | PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 738 | png_uint_32 length)); |
| 739 | #endif |
| 740 | |
| 741 | #if defined(PNG_READ_sCAL_SUPPORTED) |
| 742 | PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 743 | png_uint_32 length)); |
| 744 | #endif |
| 745 | |
| 746 | #if defined(PNG_READ_sPLT_SUPPORTED) |
| 747 | extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 748 | png_uint_32 length)); |
| 749 | #endif /* PNG_READ_sPLT_SUPPORTED */ |
| 750 | |
| 751 | #if defined(PNG_READ_sRGB_SUPPORTED) |
| 752 | PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 753 | png_uint_32 length)); |
| 754 | #endif |
| 755 | |
| 756 | #if defined(PNG_READ_tEXt_SUPPORTED) |
| 757 | PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 758 | png_uint_32 length)); |
| 759 | #endif |
| 760 | |
| 761 | #if defined(PNG_READ_tIME_SUPPORTED) |
| 762 | PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 763 | png_uint_32 length)); |
| 764 | #endif |
| 765 | |
| 766 | #if defined(PNG_READ_tRNS_SUPPORTED) |
| 767 | PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 768 | png_uint_32 length)); |
| 769 | #endif |
| 770 | |
| 771 | #if defined(PNG_READ_zTXt_SUPPORTED) |
| 772 | PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr, |
| 773 | png_uint_32 length)); |
| 774 | #endif |
| 775 | |
| 776 | PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr, |
| 777 | png_infop info_ptr, png_uint_32 length)); |
| 778 | |
| 779 | PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr, |
| 780 | png_bytep chunk_name)); |
| 781 | |
Glenn Randers-Pehrson | 6c7a09a | 2009-06-15 21:57:39 -0500 | [diff] [blame] | 782 | /* Handle the transformations for reading and writing */ |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 783 | PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr)); |
| 784 | PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr)); |
| 785 | |
| 786 | PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr)); |
| 787 | |
| 788 | #ifdef PNG_PROGRESSIVE_READ_SUPPORTED |
| 789 | PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr, |
| 790 | png_infop info_ptr)); |
| 791 | PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr, |
| 792 | png_infop info_ptr)); |
| 793 | PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr)); |
| 794 | PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr, |
| 795 | png_uint_32 length)); |
| 796 | PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr)); |
| 797 | PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr)); |
| 798 | PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr, |
| 799 | png_bytep buffer, png_size_t buffer_length)); |
| 800 | PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr)); |
| 801 | PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr, |
| 802 | png_bytep buffer, png_size_t buffer_length)); |
| 803 | PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr)); |
| 804 | PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr, |
| 805 | png_infop info_ptr, png_uint_32 length)); |
| 806 | PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr, |
| 807 | png_infop info_ptr)); |
| 808 | PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr, |
| 809 | png_infop info_ptr)); |
| 810 | PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row)); |
| 811 | PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr, |
| 812 | png_infop info_ptr)); |
| 813 | PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr, |
| 814 | png_infop info_ptr)); |
| 815 | PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr)); |
| 816 | #if defined(PNG_READ_tEXt_SUPPORTED) |
| 817 | PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr, |
| 818 | png_infop info_ptr, png_uint_32 length)); |
| 819 | PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr, |
| 820 | png_infop info_ptr)); |
| 821 | #endif |
| 822 | #if defined(PNG_READ_zTXt_SUPPORTED) |
| 823 | PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr, |
| 824 | png_infop info_ptr, png_uint_32 length)); |
| 825 | PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr, |
| 826 | png_infop info_ptr)); |
| 827 | #endif |
| 828 | #if defined(PNG_READ_iTXt_SUPPORTED) |
| 829 | PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr, |
| 830 | png_infop info_ptr, png_uint_32 length)); |
| 831 | PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr, |
| 832 | png_infop info_ptr)); |
| 833 | #endif |
| 834 | |
| 835 | #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ |
| 836 | |
| 837 | #ifdef PNG_MNG_FEATURES_SUPPORTED |
| 838 | PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info, |
| 839 | png_bytep row)); |
| 840 | PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info, |
| 841 | png_bytep row)); |
| 842 | #endif |
| 843 | |
Glenn Randers-Pehrson | f783101 | 2008-11-13 06:05:13 -0600 | [diff] [blame] | 844 | /* Added at libpng version 1.4.0 */ |
| 845 | #if defined(PNG_cHRM_SUPPORTED) |
Glenn Randers-Pehrson | f783101 | 2008-11-13 06:05:13 -0600 | [diff] [blame] | 846 | PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr, |
| 847 | png_fixed_point int_white_x, png_fixed_point int_white_y, |
| 848 | png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point |
| 849 | int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, |
| 850 | png_fixed_point int_blue_y)); |
| 851 | #endif |
Glenn Randers-Pehrson | f783101 | 2008-11-13 06:05:13 -0600 | [diff] [blame] | 852 | |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 853 | /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ |
| 854 | |
Glenn Randers-Pehrson | 1721829 | 2006-04-20 07:20:46 -0500 | [diff] [blame] | 855 | #ifdef __cplusplus |
| 856 | } |
| 857 | #endif |
| 858 | |
| 859 | #endif /* PNG_VERSION_INFO_ONLY */ |
Glenn Randers-Pehrson | beb572e | 2006-08-19 13:59:24 -0500 | [diff] [blame] | 860 | #endif /* PNGPRIV_H */ |