Home | History | Annotate | Download | only in libpng-1.2.19
      1 
      2 /* pngconf.h - machine configurable file for libpng
      3  *
      4  * libpng version 1.2.19 - August 18, 2007
      5  * For conditions of distribution and use, see copyright notice in png.h
      6  * Copyright (c) 1998-2007 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 
     11 /* Any machine specific code is near the front of this file, so if you
     12  * are configuring libpng for a machine, you may want to read the section
     13  * starting here down to where it starts to typedef png_color, png_text,
     14  * and png_info.
     15  */
     16 
     17 #ifndef PNGCONF_H
     18 #define PNGCONF_H
     19 
     20 #define PNG_1_2_X
     21 
     22 /*
     23  * PNG_USER_CONFIG has to be defined on the compiler command line. This
     24  * includes the resource compiler for Windows DLL configurations.
     25  */
     26 #ifdef PNG_USER_CONFIG
     27 #  ifndef PNG_USER_PRIVATEBUILD
     28 #    define PNG_USER_PRIVATEBUILD
     29 #  endif
     30 #include "pngusr.h"
     31 #endif
     32 
     33 /* PNG_CONFIGURE_LIBPNG is set by the "configure" script. */
     34 #ifdef PNG_CONFIGURE_LIBPNG
     35 #ifdef HAVE_CONFIG_H
     36 #include "config.h"
     37 #endif
     38 #endif
     39 
     40 /*
     41  * Added at libpng-1.2.8
     42  *
     43  * If you create a private DLL you need to define in "pngusr.h" the followings:
     44  * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
     45  *        the DLL was built>
     46  *  e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons."
     47  * #define PNG_USER_DLLFNAME_POSTFIX <two-letter postfix that serve to
     48  *        distinguish your DLL from those of the official release. These
     49  *        correspond to the trailing letters that come after the version
     50  *        number and must match your private DLL name>
     51  *  e.g. // private DLL "libpng13gx.dll"
     52  *       #define PNG_USER_DLLFNAME_POSTFIX "gx"
     53  *
     54  * The following macros are also at your disposal if you want to complete the
     55  * DLL VERSIONINFO structure.
     56  * - PNG_USER_VERSIONINFO_COMMENTS
     57  * - PNG_USER_VERSIONINFO_COMPANYNAME
     58  * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS
     59  */
     60 
     61 #ifdef __STDC__
     62 #ifdef SPECIALBUILD
     63 #  pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\
     64  are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.")
     65 #endif
     66 
     67 #ifdef PRIVATEBUILD
     68 # pragma message("PRIVATEBUILD is deprecated.\
     69  Use PNG_USER_PRIVATEBUILD instead.")
     70 # define PNG_USER_PRIVATEBUILD PRIVATEBUILD
     71 #endif
     72 #endif /* __STDC__ */
     73 
     74 #ifndef PNG_VERSION_INFO_ONLY
     75 
     76 /* End of material added to libpng-1.2.8 */
     77 
     78 /* Added at libpng-1.2.19 */
     79 #ifndef PNG_NO_WARN_UNINITIALIZED_ROW
     80 #  ifndef PNG_WARN_UNINITIALIZED_ROW
     81 #    define PNG_WARN_UNINITIALIZED_ROW 1 /* 0: warning; 1: error */
     82 #  endif
     83 #endif
     84 /* End of material added at libpng-1.2.19 */
     85 
     86 /* This is the size of the compression buffer, and thus the size of
     87  * an IDAT chunk.  Make this whatever size you feel is best for your
     88  * machine.  One of these will be allocated per png_struct.  When this
     89  * is full, it writes the data to the disk, and does some other
     90  * calculations.  Making this an extremely small size will slow
     91  * the library down, but you may want to experiment to determine
     92  * where it becomes significant, if you are concerned with memory
     93  * usage.  Note that zlib allocates at least 32Kb also.  For readers,
     94  * this describes the size of the buffer available to read the data in.
     95  * Unless this gets smaller than the size of a row (compressed),
     96  * it should not make much difference how big this is.
     97  */
     98 
     99 #ifndef PNG_ZBUF_SIZE
    100 #  define PNG_ZBUF_SIZE 8192
    101 #endif
    102 
    103 /* Enable if you want a write-only libpng */
    104 
    105 #ifndef PNG_NO_READ_SUPPORTED
    106 #  define PNG_READ_SUPPORTED
    107 #endif
    108 
    109 /* Enable if you want a read-only libpng */
    110 
    111 #ifndef PNG_NO_WRITE_SUPPORTED
    112 #  define PNG_WRITE_SUPPORTED
    113 #endif
    114 
    115 /* Enabled by default in 1.2.0.  You can disable this if you don't need to
    116    support PNGs that are embedded in MNG datastreams */
    117 #if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES)
    118 #  ifndef PNG_MNG_FEATURES_SUPPORTED
    119 #    define PNG_MNG_FEATURES_SUPPORTED
    120 #  endif
    121 #endif
    122 
    123 #ifndef PNG_NO_FLOATING_POINT_SUPPORTED
    124 #  ifndef PNG_FLOATING_POINT_SUPPORTED
    125 #    define PNG_FLOATING_POINT_SUPPORTED
    126 #  endif
    127 #endif
    128 
    129 /* If you are running on a machine where you cannot allocate more
    130  * than 64K of memory at once, uncomment this.  While libpng will not
    131  * normally need that much memory in a chunk (unless you load up a very
    132  * large file), zlib needs to know how big of a chunk it can use, and
    133  * libpng thus makes sure to check any memory allocation to verify it
    134  * will fit into memory.
    135 #define PNG_MAX_MALLOC_64K
    136  */
    137 #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
    138 #  define PNG_MAX_MALLOC_64K
    139 #endif
    140 
    141 /* Special munging to support doing things the 'cygwin' way:
    142  * 'Normal' png-on-win32 defines/defaults:
    143  *   PNG_BUILD_DLL -- building dll
    144  *   PNG_USE_DLL   -- building an application, linking to dll
    145  *   (no define)   -- building static library, or building an
    146  *                    application and linking to the static lib
    147  * 'Cygwin' defines/defaults:
    148  *   PNG_BUILD_DLL -- (ignored) building the dll
    149  *   (no define)   -- (ignored) building an application, linking to the dll
    150  *   PNG_STATIC    -- (ignored) building the static lib, or building an
    151  *                    application that links to the static lib.
    152  *   ALL_STATIC    -- (ignored) building various static libs, or building an
    153  *                    application that links to the static libs.
    154  * Thus,
    155  * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
    156  * this bit of #ifdefs will define the 'correct' config variables based on
    157  * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but
    158  * unnecessary.
    159  *
    160  * Also, the precedence order is:
    161  *   ALL_STATIC (since we can't #undef something outside our namespace)
    162  *   PNG_BUILD_DLL
    163  *   PNG_STATIC
    164  *   (nothing) == PNG_USE_DLL
    165  *
    166  * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
    167  *   of auto-import in binutils, we no longer need to worry about
    168  *   __declspec(dllexport) / __declspec(dllimport) and friends.  Therefore,
    169  *   we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
    170  *   to __declspec() stuff.  However, we DO need to worry about
    171  *   PNG_BUILD_DLL and PNG_STATIC because those change some defaults
    172  *   such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
    173  */
    174 #if defined(__CYGWIN__)
    175 #  if defined(ALL_STATIC)
    176 #    if defined(PNG_BUILD_DLL)
    177 #      undef PNG_BUILD_DLL
    178 #    endif
    179 #    if defined(PNG_USE_DLL)
    180 #      undef PNG_USE_DLL
    181 #    endif
    182 #    if defined(PNG_DLL)
    183 #      undef PNG_DLL
    184 #    endif
    185 #    if !defined(PNG_STATIC)
    186 #      define PNG_STATIC
    187 #    endif
    188 #  else
    189 #    if defined (PNG_BUILD_DLL)
    190 #      if defined(PNG_STATIC)
    191 #        undef PNG_STATIC
    192 #      endif
    193 #      if defined(PNG_USE_DLL)
    194 #        undef PNG_USE_DLL
    195 #      endif
    196 #      if !defined(PNG_DLL)
    197 #        define PNG_DLL
    198 #      endif
    199 #    else
    200 #      if defined(PNG_STATIC)
    201 #        if defined(PNG_USE_DLL)
    202 #          undef PNG_USE_DLL
    203 #        endif
    204 #        if defined(PNG_DLL)
    205 #          undef PNG_DLL
    206 #        endif
    207 #      else
    208 #        if !defined(PNG_USE_DLL)
    209 #          define PNG_USE_DLL
    210 #        endif
    211 #        if !defined(PNG_DLL)
    212 #          define PNG_DLL
    213 #        endif
    214 #      endif
    215 #    endif
    216 #  endif
    217 #endif
    218 
    219 /* This protects us against compilers that run on a windowing system
    220  * and thus don't have or would rather us not use the stdio types:
    221  * stdin, stdout, and stderr.  The only one currently used is stderr
    222  * in png_error() and png_warning().  #defining PNG_NO_CONSOLE_IO will
    223  * prevent these from being compiled and used. #defining PNG_NO_STDIO
    224  * will also prevent these, plus will prevent the entire set of stdio
    225  * macros and functions (FILE *, printf, etc.) from being compiled and used,
    226  * unless (PNG_DEBUG > 0) has been #defined.
    227  *
    228  * #define PNG_NO_CONSOLE_IO
    229  * #define PNG_NO_STDIO
    230  */
    231 
    232 #if defined(_WIN32_WCE)
    233 #  include <windows.h>
    234    /* Console I/O functions are not supported on WindowsCE */
    235 #  define PNG_NO_CONSOLE_IO
    236 #  ifdef PNG_DEBUG
    237 #    undef PNG_DEBUG
    238 #  endif
    239 #endif
    240 
    241 #ifdef PNG_BUILD_DLL
    242 #  ifndef PNG_CONSOLE_IO_SUPPORTED
    243 #    ifndef PNG_NO_CONSOLE_IO
    244 #      define PNG_NO_CONSOLE_IO
    245 #    endif
    246 #  endif
    247 #endif
    248 
    249 #  ifdef PNG_NO_STDIO
    250 #    ifndef PNG_NO_CONSOLE_IO
    251 #      define PNG_NO_CONSOLE_IO
    252 #    endif
    253 #    ifdef PNG_DEBUG
    254 #      if (PNG_DEBUG > 0)
    255 #        include <stdio.h>
    256 #      endif
    257 #    endif
    258 #  else
    259 #    if !defined(_WIN32_WCE)
    260 /* "stdio.h" functions are not supported on WindowsCE */
    261 #      include <stdio.h>
    262 #    endif
    263 #  endif
    264 
    265 /* This macro protects us against machines that don't have function
    266  * prototypes (ie K&R style headers).  If your compiler does not handle
    267  * function prototypes, define this macro and use the included ansi2knr.
    268  * I've always been able to use _NO_PROTO as the indicator, but you may
    269  * need to drag the empty declaration out in front of here, or change the
    270  * ifdef to suit your own needs.
    271  */
    272 #ifndef PNGARG
    273 
    274 #ifdef OF /* zlib prototype munger */
    275 #  define PNGARG(arglist) OF(arglist)
    276 #else
    277 
    278 #ifdef _NO_PROTO
    279 #  define PNGARG(arglist) ()
    280 #  ifndef PNG_TYPECAST_NULL
    281 #     define PNG_TYPECAST_NULL
    282 #  endif
    283 #else
    284 #  define PNGARG(arglist) arglist
    285 #endif /* _NO_PROTO */
    286 
    287 
    288 #endif /* OF */
    289 
    290 #endif /* PNGARG */
    291 
    292 /* Try to determine if we are compiling on a Mac.  Note that testing for
    293  * just __MWERKS__ is not good enough, because the Codewarrior is now used
    294  * on non-Mac platforms.
    295  */
    296 #ifndef MACOS
    297 #  if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
    298       defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
    299 #    define MACOS
    300 #  endif
    301 #endif
    302 
    303 /* enough people need this for various reasons to include it here */
    304 #if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
    305 #  include <sys/types.h>
    306 #endif
    307 
    308 #if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)
    309 #  define PNG_SETJMP_SUPPORTED
    310 #endif
    311 
    312 #ifdef PNG_SETJMP_SUPPORTED
    313 /* This is an attempt to force a single setjmp behaviour on Linux.  If
    314  * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
    315  */
    316 
    317 #  ifdef __linux__
    318 #    ifdef _BSD_SOURCE
    319 #      define PNG_SAVE_BSD_SOURCE
    320 #      undef _BSD_SOURCE
    321 #    endif
    322 #    ifdef _SETJMP_H
    323      /* If you encounter a compiler error here, see the explanation
    324       * near the end of INSTALL.
    325       */
    326          __png.h__ already includes setjmp.h;
    327          __dont__ include it again.;
    328 #    endif
    329 #  endif /* __linux__ */
    330 
    331    /* include setjmp.h for error handling */
    332 #  include <setjmp.h>
    333 
    334 #  ifdef __linux__
    335 #    ifdef PNG_SAVE_BSD_SOURCE
    336 #      define _BSD_SOURCE
    337 #      undef PNG_SAVE_BSD_SOURCE
    338 #    endif
    339 #  endif /* __linux__ */
    340 #endif /* PNG_SETJMP_SUPPORTED */
    341 
    342 #ifdef BSD
    343 #  include <strings.h>
    344 #else
    345 #  include <string.h>
    346 #endif
    347 
    348 /* Other defines for things like memory and the like can go here.  */
    349 #ifdef PNG_INTERNAL
    350 
    351 #include <stdlib.h>
    352 
    353 /* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
    354  * aren't usually used outside the library (as far as I know), so it is
    355  * debatable if they should be exported at all.  In the future, when it is
    356  * possible to have run-time registry of chunk-handling functions, some of
    357  * these will be made available again.
    358 #define PNG_EXTERN extern
    359  */
    360 #define PNG_EXTERN
    361 
    362 /* Other defines specific to compilers can go here.  Try to keep
    363  * them inside an appropriate ifdef/endif pair for portability.
    364  */
    365 
    366 #if defined(PNG_FLOATING_POINT_SUPPORTED)
    367 #  if defined(MACOS)
    368      /* We need to check that <math.h> hasn't already been included earlier
    369       * as it seems it doesn't agree with <fp.h>, yet we should really use
    370       * <fp.h> if possible.
    371       */
    372 #    if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
    373 #      include <fp.h>
    374 #    endif
    375 #  else
    376 #    include <math.h>
    377 #  endif
    378 #  if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
    379      /* Amiga SAS/C: We must include builtin FPU functions when compiling using
    380       * MATH=68881
    381       */
    382 #    include <m68881.h>
    383 #  endif
    384 #endif
    385 
    386 /* Codewarrior on NT has linking problems without this. */
    387 #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
    388 #  define PNG_ALWAYS_EXTERN
    389 #endif
    390 
    391 /* This provides the non-ANSI (far) memory allocation routines. */
    392 #if defined(__TURBOC__) && defined(__MSDOS__)
    393 #  include <mem.h>
    394 #  include <alloc.h>
    395 #endif
    396 
    397 /* I have no idea why is this necessary... */
    398 #if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \
    399     defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__))
    400 #  include <malloc.h>
    401 #endif
    402 
    403 /* This controls how fine the dithering gets.  As this allocates
    404  * a largish chunk of memory (32K), those who are not as concerned
    405  * with dithering quality can decrease some or all of these.
    406  */
    407 #ifndef PNG_DITHER_RED_BITS
    408 #  define PNG_DITHER_RED_BITS 5
    409 #endif
    410 #ifndef PNG_DITHER_GREEN_BITS
    411 #  define PNG_DITHER_GREEN_BITS 5
    412 #endif
    413 #ifndef PNG_DITHER_BLUE_BITS
    414 #  define PNG_DITHER_BLUE_BITS 5
    415 #endif
    416 
    417 /* This controls how fine the gamma correction becomes when you
    418  * are only interested in 8 bits anyway.  Increasing this value
    419  * results in more memory being used, and more pow() functions
    420  * being called to fill in the gamma tables.  Don't set this value
    421  * less then 8, and even that may not work (I haven't tested it).
    422  */
    423 
    424 #ifndef PNG_MAX_GAMMA_8
    425 #  define PNG_MAX_GAMMA_8 11
    426 #endif
    427 
    428 /* This controls how much a difference in gamma we can tolerate before
    429  * we actually start doing gamma conversion.
    430  */
    431 #ifndef PNG_GAMMA_THRESHOLD
    432 #  define PNG_GAMMA_THRESHOLD 0.05
    433 #endif
    434 
    435 #endif /* PNG_INTERNAL */
    436 
    437 /* The following uses const char * instead of char * for error
    438  * and warning message functions, so some compilers won't complain.
    439  * If you do not want to use const, define PNG_NO_CONST here.
    440  */
    441 
    442 #ifndef PNG_NO_CONST
    443 #  define PNG_CONST const
    444 #else
    445 #  define PNG_CONST
    446 #endif
    447 
    448 /* The following defines give you the ability to remove code from the
    449  * library that you will not be using.  I wish I could figure out how to
    450  * automate this, but I can't do that without making it seriously hard
    451  * on the users.  So if you are not using an ability, change the #define
    452  * to and #undef, and that part of the library will not be compiled.  If
    453  * your linker can't find a function, you may want to make sure the
    454  * ability is defined here.  Some of these depend upon some others being
    455  * defined.  I haven't figured out all the interactions here, so you may
    456  * have to experiment awhile to get everything to compile.  If you are
    457  * creating or using a shared library, you probably shouldn't touch this,
    458  * as it will affect the size of the structures, and this will cause bad
    459  * things to happen if the library and/or application ever change.
    460  */
    461 
    462 /* Any features you will not be using can be undef'ed here */
    463 
    464 /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
    465  * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
    466  * on the compile line, then pick and choose which ones to define without
    467  * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
    468  * if you only want to have a png-compliant reader/writer but don't need
    469  * any of the extra transformations.  This saves about 80 kbytes in a
    470  * typical installation of the library. (PNG_NO_* form added in version
    471  * 1.0.1c, for consistency)
    472  */
    473 
    474 /* The size of the png_text structure changed in libpng-1.0.6 when
    475  * iTXt support was added.  iTXt support was turned off by default through
    476  * libpng-1.2.x, to support old apps that malloc the png_text structure
    477  * instead of calling png_set_text() and letting libpng malloc it.  It
    478  * was turned on by default in libpng-1.3.0.
    479  */
    480 
    481 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
    482 #  ifndef PNG_NO_iTXt_SUPPORTED
    483 #    define PNG_NO_iTXt_SUPPORTED
    484 #  endif
    485 #  ifndef PNG_NO_READ_iTXt
    486 #    define PNG_NO_READ_iTXt
    487 #  endif
    488 #  ifndef PNG_NO_WRITE_iTXt
    489 #    define PNG_NO_WRITE_iTXt
    490 #  endif
    491 #endif
    492 
    493 #if !defined(PNG_NO_iTXt_SUPPORTED)
    494 #  if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
    495 #    define PNG_READ_iTXt
    496 #  endif
    497 #  if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt)
    498 #    define PNG_WRITE_iTXt
    499 #  endif
    500 #endif
    501 
    502 /* The following support, added after version 1.0.0, can be turned off here en
    503  * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
    504  * with old applications that require the length of png_struct and png_info
    505  * to remain unchanged.
    506  */
    507 
    508 #ifdef PNG_LEGACY_SUPPORTED
    509 #  define PNG_NO_FREE_ME
    510 #  define PNG_NO_READ_UNKNOWN_CHUNKS
    511 #  define PNG_NO_WRITE_UNKNOWN_CHUNKS
    512 #  define PNG_NO_READ_USER_CHUNKS
    513 #  define PNG_NO_READ_iCCP
    514 #  define PNG_NO_WRITE_iCCP
    515 #  define PNG_NO_READ_iTXt
    516 #  define PNG_NO_WRITE_iTXt
    517 #  define PNG_NO_READ_sCAL
    518 #  define PNG_NO_WRITE_sCAL
    519 #  define PNG_NO_READ_sPLT
    520 #  define PNG_NO_WRITE_sPLT
    521 #  define PNG_NO_INFO_IMAGE
    522 #  define PNG_NO_READ_RGB_TO_GRAY
    523 #  define PNG_NO_READ_USER_TRANSFORM
    524 #  define PNG_NO_WRITE_USER_TRANSFORM
    525 #  define PNG_NO_USER_MEM
    526 #  define PNG_NO_READ_EMPTY_PLTE
    527 #  define PNG_NO_MNG_FEATURES
    528 #  define PNG_NO_FIXED_POINT_SUPPORTED
    529 #endif
    530 
    531 /* Ignore attempt to turn off both floating and fixed point support */
    532 #if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
    533     !defined(PNG_NO_FIXED_POINT_SUPPORTED)
    534 #  define PNG_FIXED_POINT_SUPPORTED
    535 #endif
    536 
    537 #ifndef PNG_NO_FREE_ME
    538 #  define PNG_FREE_ME_SUPPORTED
    539 #endif
    540 
    541 #if defined(PNG_READ_SUPPORTED)
    542 
    543 #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
    544       !defined(PNG_NO_READ_TRANSFORMS)
    545 #  define PNG_READ_TRANSFORMS_SUPPORTED
    546 #endif
    547 
    548 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
    549 #  ifndef PNG_NO_READ_EXPAND
    550 #    define PNG_READ_EXPAND_SUPPORTED
    551 #  endif
    552 #  ifndef PNG_NO_READ_SHIFT
    553 #    define PNG_READ_SHIFT_SUPPORTED
    554 #  endif
    555 #  ifndef PNG_NO_READ_PACK
    556 #    define PNG_READ_PACK_SUPPORTED
    557 #  endif
    558 #  ifndef PNG_NO_READ_BGR
    559 #    define PNG_READ_BGR_SUPPORTED
    560 #  endif
    561 #  ifndef PNG_NO_READ_SWAP
    562 #    define PNG_READ_SWAP_SUPPORTED
    563 #  endif
    564 #  ifndef PNG_NO_READ_PACKSWAP
    565 #    define PNG_READ_PACKSWAP_SUPPORTED
    566 #  endif
    567 #  ifndef PNG_NO_READ_INVERT
    568 #    define PNG_READ_INVERT_SUPPORTED
    569 #  endif
    570 #  ifndef PNG_NO_READ_DITHER
    571 #    define PNG_READ_DITHER_SUPPORTED
    572 #  endif
    573 #  ifndef PNG_NO_READ_BACKGROUND
    574 #    define PNG_READ_BACKGROUND_SUPPORTED
    575 #  endif
    576 #  ifndef PNG_NO_READ_16_TO_8
    577 #    define PNG_READ_16_TO_8_SUPPORTED
    578 #  endif
    579 #  ifndef PNG_NO_READ_FILLER
    580 #    define PNG_READ_FILLER_SUPPORTED
    581 #  endif
    582 #  ifndef PNG_NO_READ_GAMMA
    583 #    define PNG_READ_GAMMA_SUPPORTED
    584 #  endif
    585 #  ifndef PNG_NO_READ_GRAY_TO_RGB
    586 #    define PNG_READ_GRAY_TO_RGB_SUPPORTED
    587 #  endif
    588 #  ifndef PNG_NO_READ_SWAP_ALPHA
    589 #    define PNG_READ_SWAP_ALPHA_SUPPORTED
    590 #  endif
    591 #  ifndef PNG_NO_READ_INVERT_ALPHA
    592 #    define PNG_READ_INVERT_ALPHA_SUPPORTED
    593 #  endif
    594 #  ifndef PNG_NO_READ_STRIP_ALPHA
    595 #    define PNG_READ_STRIP_ALPHA_SUPPORTED
    596 #  endif
    597 #  ifndef PNG_NO_READ_USER_TRANSFORM
    598 #    define PNG_READ_USER_TRANSFORM_SUPPORTED
    599 #  endif
    600 #  ifndef PNG_NO_READ_RGB_TO_GRAY
    601 #    define PNG_READ_RGB_TO_GRAY_SUPPORTED
    602 #  endif
    603 #endif /* PNG_READ_TRANSFORMS_SUPPORTED */
    604 
    605 #if !defined(PNG_NO_PROGRESSIVE_READ) && \
    606  !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
    607 #  define PNG_PROGRESSIVE_READ_SUPPORTED    /* reading.  This is not talking */
    608 #endif                              /* about interlacing capability!  You'll */
    609              /* still have interlacing unless you change the following line: */
    610 
    611 #define PNG_READ_INTERLACING_SUPPORTED /* required in PNG-compliant decoders */
    612 
    613 #ifndef PNG_NO_READ_COMPOSITE_NODIV
    614 #  ifndef PNG_NO_READ_COMPOSITED_NODIV  /* libpng-1.0.x misspelling */
    615 #    define PNG_READ_COMPOSITE_NODIV_SUPPORTED  /* well tested on Intel, SGI */
    616 #  endif
    617 #endif
    618 
    619 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
    620 /* Deprecated, will be removed from version 2.0.0.
    621    Use PNG_MNG_FEATURES_SUPPORTED instead. */
    622 #ifndef PNG_NO_READ_EMPTY_PLTE
    623 #  define PNG_READ_EMPTY_PLTE_SUPPORTED
    624 #endif
    625 #endif
    626 
    627 #endif /* PNG_READ_SUPPORTED */
    628 
    629 #if defined(PNG_WRITE_SUPPORTED)
    630 
    631 # if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
    632     !defined(PNG_NO_WRITE_TRANSFORMS)
    633 #  define PNG_WRITE_TRANSFORMS_SUPPORTED
    634 #endif
    635 
    636 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
    637 #  ifndef PNG_NO_WRITE_SHIFT
    638 #    define PNG_WRITE_SHIFT_SUPPORTED
    639 #  endif
    640 #  ifndef PNG_NO_WRITE_PACK
    641 #    define PNG_WRITE_PACK_SUPPORTED
    642 #  endif
    643 #  ifndef PNG_NO_WRITE_BGR
    644 #    define PNG_WRITE_BGR_SUPPORTED
    645 #  endif
    646 #  ifndef PNG_NO_WRITE_SWAP
    647 #    define PNG_WRITE_SWAP_SUPPORTED
    648 #  endif
    649 #  ifndef PNG_NO_WRITE_PACKSWAP
    650 #    define PNG_WRITE_PACKSWAP_SUPPORTED
    651 #  endif
    652 #  ifndef PNG_NO_WRITE_INVERT
    653 #    define PNG_WRITE_INVERT_SUPPORTED
    654 #  endif
    655 #  ifndef PNG_NO_WRITE_FILLER
    656 #    define PNG_WRITE_FILLER_SUPPORTED   /* same as WRITE_STRIP_ALPHA */
    657 #  endif
    658 #  ifndef PNG_NO_WRITE_SWAP_ALPHA
    659 #    define PNG_WRITE_SWAP_ALPHA_SUPPORTED
    660 #  endif
    661 #  ifndef PNG_NO_WRITE_INVERT_ALPHA
    662 #    define PNG_WRITE_INVERT_ALPHA_SUPPORTED
    663 #  endif
    664 #  ifndef PNG_NO_WRITE_USER_TRANSFORM
    665 #    define PNG_WRITE_USER_TRANSFORM_SUPPORTED
    666 #  endif
    667 #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
    668 
    669 #if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \
    670     !defined(PNG_WRITE_INTERLACING_SUPPORTED)
    671 #define PNG_WRITE_INTERLACING_SUPPORTED  /* not required for PNG-compliant
    672                                             encoders, but can cause trouble
    673                                             if left undefined */
    674 #endif
    675 
    676 #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
    677     !defined(PNG_WRITE_WEIGHTED_FILTER) && \
    678      defined(PNG_FLOATING_POINT_SUPPORTED)
    679 #  define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
    680 #endif
    681 
    682 #ifndef PNG_NO_WRITE_FLUSH
    683 #  define PNG_WRITE_FLUSH_SUPPORTED
    684 #endif
    685 
    686 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
    687 /* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
    688 #ifndef PNG_NO_WRITE_EMPTY_PLTE
    689 #  define PNG_WRITE_EMPTY_PLTE_SUPPORTED
    690 #endif
    691 #endif
    692 
    693 #endif /* PNG_WRITE_SUPPORTED */
    694 
    695 #ifndef PNG_1_0_X
    696 #  ifndef PNG_NO_ERROR_NUMBERS
    697 #    define PNG_ERROR_NUMBERS_SUPPORTED
    698 #  endif
    699 #endif /* PNG_1_0_X */
    700 
    701 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
    702     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
    703 #  ifndef PNG_NO_USER_TRANSFORM_PTR
    704 #    define PNG_USER_TRANSFORM_PTR_SUPPORTED
    705 #  endif
    706 #endif
    707 
    708 #ifndef PNG_NO_STDIO
    709 #  define PNG_TIME_RFC1123_SUPPORTED
    710 #endif
    711 
    712 /* This adds extra functions in pngget.c for accessing data from the
    713  * info pointer (added in version 0.99)
    714  * png_get_image_width()
    715  * png_get_image_height()
    716  * png_get_bit_depth()
    717  * png_get_color_type()
    718  * png_get_compression_type()
    719  * png_get_filter_type()
    720  * png_get_interlace_type()
    721  * png_get_pixel_aspect_ratio()
    722  * png_get_pixels_per_meter()
    723  * png_get_x_offset_pixels()
    724  * png_get_y_offset_pixels()
    725  * png_get_x_offset_microns()
    726  * png_get_y_offset_microns()
    727  */
    728 #if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)
    729 #  define PNG_EASY_ACCESS_SUPPORTED
    730 #endif
    731 
    732 /* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0
    733  * even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined.
    734  *
    735  * PNG_NO_ASSEMBLER_CODE disables use of all assembler code,
    736  * and removes several functions from the API.
    737  *
    738  * PNG_NO_MMX_CODE disables the use of MMX code without changing the API.
    739  * When MMX code is off, then optimized C replacement functions are used,
    740  * if PNG_NO_OPTIMIZED_CODE is not enabled.  This was added in version
    741  * 1.2.19.
    742 */
    743 
    744 #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_OPTIMIZED_CODE)
    745 #  ifndef PNG_OPTIMIZED_CODE_SUPPORTED
    746 #    define PNG_OPTIMIZED_CODE_SUPPORTED
    747 #  endif
    748 #endif
    749 
    750 #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
    751 #  ifndef PNG_ASSEMBLER_CODE_SUPPORTED
    752 #    define PNG_ASSEMBLER_CODE_SUPPORTED
    753 #  endif
    754 
    755 #  if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
    756 #    define PNG_MMX_CODE_SUPPORTED
    757 #  endif
    758 
    759 #  if !defined(PNG_USE_PNGVCRD) && defined(PNG_MMX_CODE_SUPPORTED) && \
    760      defined(_MSC_VER)
    761 #    define PNG_USE_PNGVCRD
    762 #  endif
    763 
    764 #  if !defined(PNG_USE_PNGGCCRD) && defined(PNG_MMX_CODE_SUPPORTED) && \
    765      !defined(PNG_USE_PNGVCRD)
    766 #    define PNG_USE_PNGGCCRD
    767      /* If you are sure that you don't need thread safety and you are compiling
    768         with PNG_USE_PNGCCRD for an MMX application, you can define this for
    769         faster execution.  See pnggccrd.c.
    770 #    define PNG_THREAD_UNSAFE_OK
    771      */
    772 #  endif
    773 
    774 #endif
    775 
    776 #if !defined(PNG_1_0_X)
    777 #if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
    778 #  define PNG_USER_MEM_SUPPORTED
    779 #endif
    780 #endif /* PNG_1_0_X */
    781 
    782 /* Added at libpng-1.2.6 */
    783 #if !defined(PNG_1_0_X)
    784 #ifndef PNG_SET_USER_LIMITS_SUPPORTED
    785 #if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED)
    786 #  define PNG_SET_USER_LIMITS_SUPPORTED
    787 #endif
    788 #endif
    789 #endif /* PNG_1_0_X */
    790 
    791 /* Added at libpng-1.0.16 and 1.2.6.  To accept all valid PNGS no matter
    792  * how large, set these limits to 0x7fffffffL
    793  */
    794 #ifndef PNG_USER_WIDTH_MAX
    795 #  define PNG_USER_WIDTH_MAX 1000000L
    796 #endif
    797 #ifndef PNG_USER_HEIGHT_MAX
    798 #  define PNG_USER_HEIGHT_MAX 1000000L
    799 #endif
    800 
    801 /* These are currently experimental features, define them if you want */
    802 
    803 /* very little testing */
    804 /*
    805 #ifdef PNG_READ_SUPPORTED
    806 #  ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
    807 #    define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
    808 #  endif
    809 #endif
    810 */
    811 
    812 /* This is only for PowerPC big-endian and 680x0 systems */
    813 /* some testing */
    814 /*
    815 #ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
    816 #  define PNG_READ_BIG_ENDIAN_SUPPORTED
    817 #endif
    818 */
    819 
    820 /* Buggy compilers (e.g., gcc 2.7.2.2) need this */
    821 /*
    822 #define PNG_NO_POINTER_INDEXING
    823 */
    824 
    825 /* These functions are turned off by default, as they will be phased out. */
    826 /*
    827 #define  PNG_USELESS_TESTS_SUPPORTED
    828 #define  PNG_CORRECT_PALETTE_SUPPORTED
    829 */
    830 
    831 /* Any chunks you are not interested in, you can undef here.  The
    832  * ones that allocate memory may be expecially important (hIST,
    833  * tEXt, zTXt, tRNS, pCAL).  Others will just save time and make png_info
    834  * a bit smaller.
    835  */
    836 
    837 #if defined(PNG_READ_SUPPORTED) && \
    838     !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
    839     !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
    840 #  define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
    841 #endif
    842 
    843 #if defined(PNG_WRITE_SUPPORTED) && \
    844     !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
    845     !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
    846 #  define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
    847 #endif
    848 
    849 #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
    850 
    851 #ifdef PNG_NO_READ_TEXT
    852 #  define PNG_NO_READ_iTXt
    853 #  define PNG_NO_READ_tEXt
    854 #  define PNG_NO_READ_zTXt
    855 #endif
    856 #ifndef PNG_NO_READ_bKGD
    857 #  define PNG_READ_bKGD_SUPPORTED
    858 #  define PNG_bKGD_SUPPORTED
    859 #endif
    860 #ifndef PNG_NO_READ_cHRM
    861 #  define PNG_READ_cHRM_SUPPORTED
    862 #  define PNG_cHRM_SUPPORTED
    863 #endif
    864 #ifndef PNG_NO_READ_gAMA
    865 #  define PNG_READ_gAMA_SUPPORTED
    866 #  define PNG_gAMA_SUPPORTED
    867 #endif
    868 #ifndef PNG_NO_READ_hIST
    869 #  define PNG_READ_hIST_SUPPORTED
    870 #  define PNG_hIST_SUPPORTED
    871 #endif
    872 #ifndef PNG_NO_READ_iCCP
    873 #  define PNG_READ_iCCP_SUPPORTED
    874 #  define PNG_iCCP_SUPPORTED
    875 #endif
    876 #ifndef PNG_NO_READ_iTXt
    877 #  ifndef PNG_READ_iTXt_SUPPORTED
    878 #    define PNG_READ_iTXt_SUPPORTED
    879 #  endif
    880 #  ifndef PNG_iTXt_SUPPORTED
    881 #    define PNG_iTXt_SUPPORTED
    882 #  endif
    883 #endif
    884 #ifndef PNG_NO_READ_oFFs
    885 #  define PNG_READ_oFFs_SUPPORTED
    886 #  define PNG_oFFs_SUPPORTED
    887 #endif
    888 #ifndef PNG_NO_READ_pCAL
    889 #  define PNG_READ_pCAL_SUPPORTED
    890 #  define PNG_pCAL_SUPPORTED
    891 #endif
    892 #ifndef PNG_NO_READ_sCAL
    893 #  define PNG_READ_sCAL_SUPPORTED
    894 #  define PNG_sCAL_SUPPORTED
    895 #endif
    896 #ifndef PNG_NO_READ_pHYs
    897 #  define PNG_READ_pHYs_SUPPORTED
    898 #  define PNG_pHYs_SUPPORTED
    899 #endif
    900 #ifndef PNG_NO_READ_sBIT
    901 #  define PNG_READ_sBIT_SUPPORTED
    902 #  define PNG_sBIT_SUPPORTED
    903 #endif
    904 #ifndef PNG_NO_READ_sPLT
    905 #  define PNG_READ_sPLT_SUPPORTED
    906 #  define PNG_sPLT_SUPPORTED
    907 #endif
    908 #ifndef PNG_NO_READ_sRGB
    909 #  define PNG_READ_sRGB_SUPPORTED
    910 #  define PNG_sRGB_SUPPORTED
    911 #endif
    912 #ifndef PNG_NO_READ_tEXt
    913 #  define PNG_READ_tEXt_SUPPORTED
    914 #  define PNG_tEXt_SUPPORTED
    915 #endif
    916 #ifndef PNG_NO_READ_tIME
    917 #  define PNG_READ_tIME_SUPPORTED
    918 #  define PNG_tIME_SUPPORTED
    919 #endif
    920 #ifndef PNG_NO_READ_tRNS
    921 #  define PNG_READ_tRNS_SUPPORTED
    922 #  define PNG_tRNS_SUPPORTED
    923 #endif
    924 #ifndef PNG_NO_READ_zTXt
    925 #  define PNG_READ_zTXt_SUPPORTED
    926 #  define PNG_zTXt_SUPPORTED
    927 #endif
    928 #ifndef PNG_NO_READ_UNKNOWN_CHUNKS
    929 #  define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
    930 #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
    931 #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
    932 #  endif
    933 #  ifndef PNG_NO_HANDLE_AS_UNKNOWN
    934 #    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
    935 #  endif
    936 #endif
    937 #if !defined(PNG_NO_READ_USER_CHUNKS) && \
    938      defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
    939 #  define PNG_READ_USER_CHUNKS_SUPPORTED
    940 #  define PNG_USER_CHUNKS_SUPPORTED
    941 #  ifdef PNG_NO_READ_UNKNOWN_CHUNKS
    942 #    undef PNG_NO_READ_UNKNOWN_CHUNKS
    943 #  endif
    944 #  ifdef PNG_NO_HANDLE_AS_UNKNOWN
    945 #    undef PNG_NO_HANDLE_AS_UNKNOWN
    946 #  endif
    947 #endif
    948 #ifndef PNG_NO_READ_OPT_PLTE
    949 #  define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
    950 #endif                      /* optional PLTE chunk in RGB and RGBA images */
    951 #if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
    952     defined(PNG_READ_zTXt_SUPPORTED)
    953 #  define PNG_READ_TEXT_SUPPORTED
    954 #  define PNG_TEXT_SUPPORTED
    955 #endif
    956 
    957 #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
    958 
    959 #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
    960 
    961 #ifdef PNG_NO_WRITE_TEXT
    962 #  define PNG_NO_WRITE_iTXt
    963 #  define PNG_NO_WRITE_tEXt
    964 #  define PNG_NO_WRITE_zTXt
    965 #endif
    966 #ifndef PNG_NO_WRITE_bKGD
    967 #  define PNG_WRITE_bKGD_SUPPORTED
    968 #  ifndef PNG_bKGD_SUPPORTED
    969 #    define PNG_bKGD_SUPPORTED
    970 #  endif
    971 #endif
    972 #ifndef PNG_NO_WRITE_cHRM
    973 #  define PNG_WRITE_cHRM_SUPPORTED
    974 #  ifndef PNG_cHRM_SUPPORTED
    975 #    define PNG_cHRM_SUPPORTED
    976 #  endif
    977 #endif
    978 #ifndef PNG_NO_WRITE_gAMA
    979 #  define PNG_WRITE_gAMA_SUPPORTED
    980 #  ifndef PNG_gAMA_SUPPORTED
    981 #    define PNG_gAMA_SUPPORTED
    982 #  endif
    983 #endif
    984 #ifndef PNG_NO_WRITE_hIST
    985 #  define PNG_WRITE_hIST_SUPPORTED
    986 #  ifndef PNG_hIST_SUPPORTED
    987 #    define PNG_hIST_SUPPORTED
    988 #  endif
    989 #endif
    990 #ifndef PNG_NO_WRITE_iCCP
    991 #  define PNG_WRITE_iCCP_SUPPORTED
    992 #  ifndef PNG_iCCP_SUPPORTED
    993 #    define PNG_iCCP_SUPPORTED
    994 #  endif
    995 #endif
    996 #ifndef PNG_NO_WRITE_iTXt
    997 #  ifndef PNG_WRITE_iTXt_SUPPORTED
    998 #    define PNG_WRITE_iTXt_SUPPORTED
    999 #  endif
   1000 #  ifndef PNG_iTXt_SUPPORTED
   1001 #    define PNG_iTXt_SUPPORTED
   1002 #  endif
   1003 #endif
   1004 #ifndef PNG_NO_WRITE_oFFs
   1005 #  define PNG_WRITE_oFFs_SUPPORTED
   1006 #  ifndef PNG_oFFs_SUPPORTED
   1007 #    define PNG_oFFs_SUPPORTED
   1008 #  endif
   1009 #endif
   1010 #ifndef PNG_NO_WRITE_pCAL
   1011 #  define PNG_WRITE_pCAL_SUPPORTED
   1012 #  ifndef PNG_pCAL_SUPPORTED
   1013 #    define PNG_pCAL_SUPPORTED
   1014 #  endif
   1015 #endif
   1016 #ifndef PNG_NO_WRITE_sCAL
   1017 #  define PNG_WRITE_sCAL_SUPPORTED
   1018 #  ifndef PNG_sCAL_SUPPORTED
   1019 #    define PNG_sCAL_SUPPORTED
   1020 #  endif
   1021 #endif
   1022 #ifndef PNG_NO_WRITE_pHYs
   1023 #  define PNG_WRITE_pHYs_SUPPORTED
   1024 #  ifndef PNG_pHYs_SUPPORTED
   1025 #    define PNG_pHYs_SUPPORTED
   1026 #  endif
   1027 #endif
   1028 #ifndef PNG_NO_WRITE_sBIT
   1029 #  define PNG_WRITE_sBIT_SUPPORTED
   1030 #  ifndef PNG_sBIT_SUPPORTED
   1031 #    define PNG_sBIT_SUPPORTED
   1032 #  endif
   1033 #endif
   1034 #ifndef PNG_NO_WRITE_sPLT
   1035 #  define PNG_WRITE_sPLT_SUPPORTED
   1036 #  ifndef PNG_sPLT_SUPPORTED
   1037 #    define PNG_sPLT_SUPPORTED
   1038 #  endif
   1039 #endif
   1040 #ifndef PNG_NO_WRITE_sRGB
   1041 #  define PNG_WRITE_sRGB_SUPPORTED
   1042 #  ifndef PNG_sRGB_SUPPORTED
   1043 #    define PNG_sRGB_SUPPORTED
   1044 #  endif
   1045 #endif
   1046 #ifndef PNG_NO_WRITE_tEXt
   1047 #  define PNG_WRITE_tEXt_SUPPORTED
   1048 #  ifndef PNG_tEXt_SUPPORTED
   1049 #    define PNG_tEXt_SUPPORTED
   1050 #  endif
   1051 #endif
   1052 #ifndef PNG_NO_WRITE_tIME
   1053 #  define PNG_WRITE_tIME_SUPPORTED
   1054 #  ifndef PNG_tIME_SUPPORTED
   1055 #    define PNG_tIME_SUPPORTED
   1056 #  endif
   1057 #endif
   1058 #ifndef PNG_NO_WRITE_tRNS
   1059 #  define PNG_WRITE_tRNS_SUPPORTED
   1060 #  ifndef PNG_tRNS_SUPPORTED
   1061 #    define PNG_tRNS_SUPPORTED
   1062 #  endif
   1063 #endif
   1064 #ifndef PNG_NO_WRITE_zTXt
   1065 #  define PNG_WRITE_zTXt_SUPPORTED
   1066 #  ifndef PNG_zTXt_SUPPORTED
   1067 #    define PNG_zTXt_SUPPORTED
   1068 #  endif
   1069 #endif
   1070 #ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
   1071 #  define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
   1072 #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
   1073 #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
   1074 #  endif
   1075 #  ifndef PNG_NO_HANDLE_AS_UNKNOWN
   1076 #     ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
   1077 #       define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
   1078 #     endif
   1079 #  endif
   1080 #endif
   1081 #if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
   1082     defined(PNG_WRITE_zTXt_SUPPORTED)
   1083 #  define PNG_WRITE_TEXT_SUPPORTED
   1084 #  ifndef PNG_TEXT_SUPPORTED
   1085 #    define PNG_TEXT_SUPPORTED
   1086 #  endif
   1087 #endif
   1088 
   1089 #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
   1090 
   1091 /* Turn this off to disable png_read_png() and
   1092  * png_write_png() and leave the row_pointers member
   1093  * out of the info structure.
   1094  */
   1095 #ifndef PNG_NO_INFO_IMAGE
   1096 #  define PNG_INFO_IMAGE_SUPPORTED
   1097 #endif
   1098 
   1099 /* need the time information for reading tIME chunks */
   1100 #if defined(PNG_tIME_SUPPORTED)
   1101 #  if !defined(_WIN32_WCE)
   1102      /* "time.h" functions are not supported on WindowsCE */
   1103 #    include <time.h>
   1104 #  endif
   1105 #endif
   1106 
   1107 /* Some typedefs to get us started.  These should be safe on most of the
   1108  * common platforms.  The typedefs should be at least as large as the
   1109  * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
   1110  * don't have to be exactly that size.  Some compilers dislike passing
   1111  * unsigned shorts as function parameters, so you may be better off using
   1112  * unsigned int for png_uint_16.  Likewise, for 64-bit systems, you may
   1113  * want to have unsigned int for png_uint_32 instead of unsigned long.
   1114  */
   1115 
   1116 typedef unsigned long png_uint_32;
   1117 typedef long png_int_32;
   1118 typedef unsigned short png_uint_16;
   1119 typedef short png_int_16;
   1120 typedef unsigned char png_byte;
   1121 
   1122 /* This is usually size_t.  It is typedef'ed just in case you need it to
   1123    change (I'm not sure if you will or not, so I thought I'd be safe) */
   1124 #ifdef PNG_SIZE_T
   1125    typedef PNG_SIZE_T png_size_t;
   1126 #  define png_sizeof(x) png_convert_size(sizeof (x))
   1127 #else
   1128    typedef size_t png_size_t;
   1129 #  define png_sizeof(x) sizeof (x)
   1130 #endif
   1131 
   1132 /* The following is needed for medium model support.  It cannot be in the
   1133  * PNG_INTERNAL section.  Needs modification for other compilers besides
   1134  * MSC.  Model independent support declares all arrays and pointers to be
   1135  * large using the far keyword.  The zlib version used must also support
   1136  * model independent data.  As of version zlib 1.0.4, the necessary changes
   1137  * have been made in zlib.  The USE_FAR_KEYWORD define triggers other
   1138  * changes that are needed. (Tim Wegner)
   1139  */
   1140 
   1141 /* Separate compiler dependencies (problem here is that zlib.h always
   1142    defines FAR. (SJT) */
   1143 #ifdef __BORLANDC__
   1144 #  if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
   1145 #    define LDATA 1
   1146 #  else
   1147 #    define LDATA 0
   1148 #  endif
   1149    /* GRR:  why is Cygwin in here?  Cygwin is not Borland C... */
   1150 #  if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
   1151 #    define PNG_MAX_MALLOC_64K
   1152 #    if (LDATA != 1)
   1153 #      ifndef FAR
   1154 #        define FAR __far
   1155 #      endif
   1156 #      define USE_FAR_KEYWORD
   1157 #    endif   /* LDATA != 1 */
   1158      /* Possibly useful for moving data out of default segment.
   1159       * Uncomment it if you want. Could also define FARDATA as
   1160       * const if your compiler supports it. (SJT)
   1161 #    define FARDATA FAR
   1162       */
   1163 #  endif  /* __WIN32__, __FLAT__, __CYGWIN__ */
   1164 #endif   /* __BORLANDC__ */
   1165 
   1166 
   1167 /* Suggest testing for specific compiler first before testing for
   1168  * FAR.  The Watcom compiler defines both __MEDIUM__ and M_I86MM,
   1169  * making reliance oncertain keywords suspect. (SJT)
   1170  */
   1171 
   1172 /* MSC Medium model */
   1173 #if defined(FAR)
   1174 #  if defined(M_I86MM)
   1175 #    define USE_FAR_KEYWORD
   1176 #    define FARDATA FAR
   1177 #    include <dos.h>
   1178 #  endif
   1179 #endif
   1180 
   1181 /* SJT: default case */
   1182 #ifndef FAR
   1183 #  define FAR
   1184 #endif
   1185 
   1186 /* At this point FAR is always defined */
   1187 #ifndef FARDATA
   1188 #  define FARDATA
   1189 #endif
   1190 
   1191 /* Typedef for floating-point numbers that are converted
   1192    to fixed-point with a multiple of 100,000, e.g., int_gamma */
   1193 typedef png_int_32 png_fixed_point;
   1194 
   1195 /* Add typedefs for pointers */
   1196 typedef void            FAR * png_voidp;
   1197 typedef png_byte        FAR * png_bytep;
   1198 typedef png_uint_32     FAR * png_uint_32p;
   1199 typedef png_int_32      FAR * png_int_32p;
   1200 typedef png_uint_16     FAR * png_uint_16p;
   1201 typedef png_int_16      FAR * png_int_16p;
   1202 typedef PNG_CONST char  FAR * png_const_charp;
   1203 typedef char            FAR * png_charp;
   1204 typedef png_fixed_point FAR * png_fixed_point_p;
   1205 
   1206 #ifndef PNG_NO_STDIO
   1207 #if defined(_WIN32_WCE)
   1208 typedef HANDLE                png_FILE_p;
   1209 #else
   1210 typedef FILE                * png_FILE_p;
   1211 #endif
   1212 #endif
   1213 
   1214 #ifdef PNG_FLOATING_POINT_SUPPORTED
   1215 typedef double          FAR * png_doublep;
   1216 #endif
   1217 
   1218 /* Pointers to pointers; i.e. arrays */
   1219 typedef png_byte        FAR * FAR * png_bytepp;
   1220 typedef png_uint_32     FAR * FAR * png_uint_32pp;
   1221 typedef png_int_32      FAR * FAR * png_int_32pp;
   1222 typedef png_uint_16     FAR * FAR * png_uint_16pp;
   1223 typedef png_int_16      FAR * FAR * png_int_16pp;
   1224 typedef PNG_CONST char  FAR * FAR * png_const_charpp;
   1225 typedef char            FAR * FAR * png_charpp;
   1226 typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
   1227 #ifdef PNG_FLOATING_POINT_SUPPORTED
   1228 typedef double          FAR * FAR * png_doublepp;
   1229 #endif
   1230 
   1231 /* Pointers to pointers to pointers; i.e., pointer to array */
   1232 typedef char            FAR * FAR * FAR * png_charppp;
   1233 
   1234 #if defined(PNG_1_0_X) || defined(PNG_1_2_X)
   1235 /* SPC -  Is this stuff deprecated? */
   1236 /* It'll be removed as of libpng-1.3.0 - GR-P */
   1237 /* libpng typedefs for types in zlib. If zlib changes
   1238  * or another compression library is used, then change these.
   1239  * Eliminates need to change all the source files.
   1240  */
   1241 typedef charf *         png_zcharp;
   1242 typedef charf * FAR *   png_zcharpp;
   1243 typedef z_stream FAR *  png_zstreamp;
   1244 #endif /* (PNG_1_0_X) || defined(PNG_1_2_X) */
   1245 
   1246 /*
   1247  * Define PNG_BUILD_DLL if the module being built is a Windows
   1248  * LIBPNG DLL.
   1249  *
   1250  * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
   1251  * It is equivalent to Microsoft predefined macro _DLL that is
   1252  * automatically defined when you compile using the share
   1253  * version of the CRT (C Run-Time library)
   1254  *
   1255  * The cygwin mods make this behavior a little different:
   1256  * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
   1257  * Define PNG_STATIC if you are building a static library for use with cygwin,
   1258  *   -or- if you are building an application that you want to link to the
   1259  *   static library.
   1260  * PNG_USE_DLL is defined by default (no user action needed) unless one of
   1261  *   the other flags is defined.
   1262  */
   1263 
   1264 #if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
   1265 #  define PNG_DLL
   1266 #endif
   1267 /* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
   1268  * When building a static lib, default to no GLOBAL ARRAYS, but allow
   1269  * command-line override
   1270  */
   1271 #if defined(__CYGWIN__)
   1272 #  if !defined(PNG_STATIC)
   1273 #    if defined(PNG_USE_GLOBAL_ARRAYS)
   1274 #      undef PNG_USE_GLOBAL_ARRAYS
   1275 #    endif
   1276 #    if !defined(PNG_USE_LOCAL_ARRAYS)
   1277 #      define PNG_USE_LOCAL_ARRAYS
   1278 #    endif
   1279 #  else
   1280 #    if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
   1281 #      if defined(PNG_USE_GLOBAL_ARRAYS)
   1282 #        undef PNG_USE_GLOBAL_ARRAYS
   1283 #      endif
   1284 #    endif
   1285 #  endif
   1286 #  if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
   1287 #    define PNG_USE_LOCAL_ARRAYS
   1288 #  endif
   1289 #endif
   1290 
   1291 /* Do not use global arrays (helps with building DLL's)
   1292  * They are no longer used in libpng itself, since version 1.0.5c,
   1293  * but might be required for some pre-1.0.5c applications.
   1294  */
   1295 #if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
   1296 #  if defined(PNG_NO_GLOBAL_ARRAYS) || \
   1297       (defined(__GNUC__) && defined(PNG_DLL)) || defined(_MSC_VER)
   1298 #    define PNG_USE_LOCAL_ARRAYS
   1299 #  else
   1300 #    define PNG_USE_GLOBAL_ARRAYS
   1301 #  endif
   1302 #endif
   1303 
   1304 #if defined(__CYGWIN__)
   1305 #  undef PNGAPI
   1306 #  define PNGAPI __cdecl
   1307 #  undef PNG_IMPEXP
   1308 #  define PNG_IMPEXP
   1309 #endif
   1310 
   1311 /* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
   1312  * you may get warnings regarding the linkage of png_zalloc and png_zfree.
   1313  * Don't ignore those warnings; you must also reset the default calling
   1314  * convention in your compiler to match your PNGAPI, and you must build
   1315  * zlib and your applications the same way you build libpng.
   1316  */
   1317 
   1318 #if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
   1319 #  ifndef PNG_NO_MODULEDEF
   1320 #    define PNG_NO_MODULEDEF
   1321 #  endif
   1322 #endif
   1323 
   1324 #if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
   1325 #  define PNG_IMPEXP
   1326 #endif
   1327 
   1328 #if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
   1329     (( defined(_Windows) || defined(_WINDOWS) || \
   1330        defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
   1331 
   1332 #  ifndef PNGAPI
   1333 #     if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
   1334 #        define PNGAPI __cdecl
   1335 #     else
   1336 #        define PNGAPI _cdecl
   1337 #     endif
   1338 #  endif
   1339 
   1340 #  if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
   1341        0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
   1342 #     define PNG_IMPEXP
   1343 #  endif
   1344 
   1345 #  if !defined(PNG_IMPEXP)
   1346 
   1347 #     define PNG_EXPORT_TYPE1(type,symbol)  PNG_IMPEXP type PNGAPI symbol
   1348 #     define PNG_EXPORT_TYPE2(type,symbol)  type PNG_IMPEXP PNGAPI symbol
   1349 
   1350       /* Borland/Microsoft */
   1351 #     if defined(_MSC_VER) || defined(__BORLANDC__)
   1352 #        if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
   1353 #           define PNG_EXPORT PNG_EXPORT_TYPE1
   1354 #        else
   1355 #           define PNG_EXPORT PNG_EXPORT_TYPE2
   1356 #           if defined(PNG_BUILD_DLL)
   1357 #              define PNG_IMPEXP __export
   1358 #           else
   1359 #              define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
   1360                                                  VC++ */
   1361 #           endif                             /* Exists in Borland C++ for
   1362                                                  C++ classes (== huge) */
   1363 #        endif
   1364 #     endif
   1365 
   1366 #     if !defined(PNG_IMPEXP)
   1367 #        if defined(PNG_BUILD_DLL)
   1368 #           define PNG_IMPEXP __declspec(dllexport)
   1369 #        else
   1370 #           define PNG_IMPEXP __declspec(dllimport)
   1371 #        endif
   1372 #     endif
   1373 #  endif  /* PNG_IMPEXP */
   1374 #else /* !(DLL || non-cygwin WINDOWS) */
   1375 #   if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
   1376 #      ifndef PNGAPI
   1377 #         define PNGAPI _System
   1378 #      endif
   1379 #   else
   1380 #      if 0 /* ... other platforms, with other meanings */
   1381 #      endif
   1382 #   endif
   1383 #endif
   1384 
   1385 #ifndef PNGAPI
   1386 #  define PNGAPI
   1387 #endif
   1388 #ifndef PNG_IMPEXP
   1389 #  define PNG_IMPEXP
   1390 #endif
   1391 
   1392 #ifdef PNG_BUILDSYMS
   1393 #  ifndef PNG_EXPORT
   1394 #    define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END
   1395 #  endif
   1396 #  ifdef PNG_USE_GLOBAL_ARRAYS
   1397 #    ifndef PNG_EXPORT_VAR
   1398 #      define PNG_EXPORT_VAR(type) PNG_DATA_EXPORT
   1399 #    endif
   1400 #  endif
   1401 #endif
   1402 
   1403 #ifndef PNG_EXPORT
   1404 #  define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
   1405 #endif
   1406 
   1407 #ifdef PNG_USE_GLOBAL_ARRAYS
   1408 #  ifndef PNG_EXPORT_VAR
   1409 #    define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
   1410 #  endif
   1411 #endif
   1412 
   1413 /* User may want to use these so they are not in PNG_INTERNAL. Any library
   1414  * functions that are passed far data must be model independent.
   1415  */
   1416 
   1417 #ifndef PNG_ABORT
   1418 #  define PNG_ABORT() abort()
   1419 #endif
   1420 
   1421 #ifdef PNG_SETJMP_SUPPORTED
   1422 #  define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
   1423 #else
   1424 #  define png_jmpbuf(png_ptr) \
   1425    (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
   1426 #endif
   1427 
   1428 #if defined(USE_FAR_KEYWORD)  /* memory model independent fns */
   1429 /* use this to make far-to-near assignments */
   1430 #  define CHECK   1
   1431 #  define NOCHECK 0
   1432 #  define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
   1433 #  define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
   1434 #  define png_snprintf _fsnprintf   /* Added to v 1.2.19 */
   1435 #  define png_strcpy  _fstrcpy
   1436 #  define png_strncpy _fstrncpy   /* Added to v 1.2.6 */
   1437 #  define png_strlen  _fstrlen
   1438 #  define png_memcmp  _fmemcmp    /* SJT: added */
   1439 #  define png_memcpy  _fmemcpy
   1440 #  define png_memset  _fmemset
   1441 #else /* use the usual functions */
   1442 #  define CVT_PTR(ptr)         (ptr)
   1443 #  define CVT_PTR_NOCHECK(ptr) (ptr)
   1444 #  ifndef PNG_NO_SNPRINTF
   1445 #    ifdef _MSC_VER
   1446 #      define png_snprintf _snprintf   /* Added to v 1.2.19 */
   1447 #      define png_snprintf2 _snprintf
   1448 #      define png_snprintf6 _snprintf
   1449 #    else
   1450 #      define png_snprintf snprintf   /* Added to v 1.2.19 */
   1451 #      define png_snprintf2 snprintf
   1452 #      define png_snprintf6 snprintf
   1453 #    endif
   1454 #  else
   1455      /* You don't have or don't want to use snprintf().  Caution: Using
   1456       * sprintf instead of snprintf exposes your application to accidental
   1457       * or malevolent buffer overflows.  If you don't have snprintf()
   1458       * as a general rule you should provide one (you can get one from
   1459       * Portable OpenSSH). */
   1460 #    define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
   1461 #    define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
   1462 #    define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
   1463         sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
   1464 #  endif
   1465 #  define png_strcpy  strcpy
   1466 #  define png_strncpy strncpy     /* Added to v 1.2.6 */
   1467 #  define png_strlen  strlen
   1468 #  define png_memcmp  memcmp      /* SJT: added */
   1469 #  define png_memcpy  memcpy
   1470 #  define png_memset  memset
   1471 #endif
   1472 /* End of memory model independent support */
   1473 
   1474 /* Just a little check that someone hasn't tried to define something
   1475  * contradictory.
   1476  */
   1477 #if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
   1478 #  undef PNG_ZBUF_SIZE
   1479 #  define PNG_ZBUF_SIZE 65536L
   1480 #endif
   1481 
   1482 #ifdef PNG_READ_SUPPORTED
   1483 /* Prior to libpng-1.0.9, this block was in pngasmrd.h */
   1484 #if defined(PNG_INTERNAL)
   1485 
   1486 #if defined(PNG_USE_PNGGCCRD) || defined(PNG_USE_PNGVCRD)
   1487   /* Platform must be Pentium.  Makefile must assemble and load
   1488    * pnggccrd.c or  pngvcrd.c. MMX will be detected at run time and
   1489    * used if present.
   1490    */
   1491 #  ifndef PNG_NO_MMX_COMBINE_ROW
   1492 #    define PNG_HAVE_MMX_COMBINE_ROW
   1493 #  endif
   1494 #  ifndef PNG_NO_MMX_READ_INTERLACE
   1495 #    define PNG_HAVE_MMX_READ_INTERLACE
   1496 #  endif
   1497 #  ifndef PNG_NO_MMX_READ_FILTER_ROW
   1498 #    define PNG_HAVE_MMX_READ_FILTER_ROW
   1499 #    ifndef PNG_NO_MMX_FILTER_SUB
   1500 #      define PNG_MMX_READ_FILTER_SUB_SUPPORTED
   1501 #    endif
   1502 #    if !(defined(__GNUC__) && defined(__x86_64__) && (__GNUC__ < 4))
   1503        /* work around 64-bit gcc compiler bugs in gcc-3.x */
   1504 #      ifndef PNG_NO_MMX_FILTER_UP
   1505 #        define PNG_MMX_READ_FILTER_UP_SUPPORTED
   1506 #      endif
   1507 #      ifndef PNG_NO_MMX_FILTER_AVG
   1508 #        define PNG_MMX_READ_FILTER_AVG_SUPPORTED
   1509 #      endif
   1510 #      ifndef PNG_NO_MMX_FILTER_PAETH
   1511 #        define PNG_MMX_READ_FILTER_PAETH_SUPPORTED
   1512 #      endif
   1513 #    endif /* !((__x86_64__) && (GNUC < 4)) */
   1514 #  endif
   1515   /* These are the default thresholds before the MMX code kicks in; if either
   1516    * rowbytes or bitdepth is below the threshold, plain C code is used.  These
   1517    * can be overridden at runtime via the png_set_mmx_thresholds() call in
   1518    * libpng 1.2.0 and later.  The values below were chosen by Intel.
   1519    */
   1520 #  ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT
   1521 #    define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT  128  /*  >=  */
   1522 #  endif
   1523 #  ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT
   1524 #    define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT  9    /*  >=  */
   1525 #  endif
   1526 #endif /* PNG_USE_PNGGCCRD || PNG_USE_PNGVCRD */
   1527 /* - see pngvcrd.c or pnggccrd.c for info about what is currently enabled */
   1528 
   1529 #endif /* PNG_INTERNAL */
   1530 #endif /* PNG_READ_SUPPORTED */
   1531 
   1532 /* Added at libpng-1.2.8 */
   1533 #endif /* PNG_VERSION_INFO_ONLY */
   1534 
   1535 #endif /* PNGCONF_H */
   1536