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