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