Back to index

lightning-sunbird  0.9+nobinonly
pngconf.h
Go to the documentation of this file.
00001 
00002 /* pngconf.h - machine configurable file for libpng
00003  *
00004  * libpng version 1.2.7 - September 12, 2004
00005  * For conditions of distribution and use, see copyright notice in png.h
00006  * Copyright (c) 1998-2004 Glenn Randers-Pehrson
00007  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
00008  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
00009  */
00010 
00011 /* Any machine specific code is near the front of this file, so if you
00012  * are configuring libpng for a machine, you may want to read the section
00013  * starting here down to where it starts to typedef png_color, png_text,
00014  * and png_info.
00015  */
00016 
00017 #ifndef PNGCONF_H
00018 #define PNGCONF_H
00019 
00020 /* This include defines the subset of the libpng library that
00021  * mozilla utilizes.
00022  */
00023 #include "mozpngconf.h"
00024 
00025 #ifdef PNG_USER_CONFIG
00026 #include "pngusr.h"
00027 #endif
00028 
00029 /* This is the size of the compression buffer, and thus the size of
00030  * an IDAT chunk.  Make this whatever size you feel is best for your
00031  * machine.  One of these will be allocated per png_struct.  When this
00032  * is full, it writes the data to the disk, and does some other
00033  * calculations.  Making this an extremely small size will slow
00034  * the library down, but you may want to experiment to determine
00035  * where it becomes significant, if you are concerned with memory
00036  * usage.  Note that zlib allocates at least 32Kb also.  For readers,
00037  * this describes the size of the buffer available to read the data in.
00038  * Unless this gets smaller than the size of a row (compressed),
00039  * it should not make much difference how big this is.
00040  */
00041 
00042 #ifndef PNG_ZBUF_SIZE
00043 #  define PNG_ZBUF_SIZE 8192
00044 #endif
00045 
00046 /* Enable if you want a write-only libpng */
00047 
00048 #ifndef PNG_NO_READ_SUPPORTED
00049 #  define PNG_READ_SUPPORTED
00050 #endif
00051 
00052 /* Enable if you want a read-only libpng */
00053 
00054 #ifndef PNG_NO_WRITE_SUPPORTED
00055 #  define PNG_WRITE_SUPPORTED
00056 #endif
00057 
00058 /* Enabled by default in 1.2.0.  You can disable this if you don't need to
00059    support PNGs that are embedded in MNG datastreams */
00060 #if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES)
00061 #  ifndef PNG_MNG_FEATURES_SUPPORTED
00062 #    define PNG_MNG_FEATURES_SUPPORTED
00063 #  endif
00064 #endif
00065 
00066 #ifndef PNG_NO_FLOATING_POINT_SUPPORTED
00067 #  ifndef PNG_FLOATING_POINT_SUPPORTED
00068 #    define PNG_FLOATING_POINT_SUPPORTED
00069 #  endif
00070 #endif
00071 
00072 /* If you are running on a machine where you cannot allocate more
00073  * than 64K of memory at once, uncomment this.  While libpng will not
00074  * normally need that much memory in a chunk (unless you load up a very
00075  * large file), zlib needs to know how big of a chunk it can use, and
00076  * libpng thus makes sure to check any memory allocation to verify it
00077  * will fit into memory.
00078 #define PNG_MAX_MALLOC_64K
00079  */
00080 #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
00081 #  define PNG_MAX_MALLOC_64K
00082 #endif
00083 
00084 /* Special munging to support doing things the 'cygwin' way:
00085  * 'Normal' png-on-win32 defines/defaults:
00086  *   PNG_BUILD_DLL -- building dll
00087  *   PNG_USE_DLL   -- building an application, linking to dll
00088  *   (no define)   -- building static library, or building an
00089  *                    application and linking to the static lib
00090  * 'Cygwin' defines/defaults:
00091  *   PNG_BUILD_DLL -- (ignored) building the dll
00092  *   (no define)   -- (ignored) building an application, linking to the dll
00093  *   PNG_STATIC    -- (ignored) building the static lib, or building an 
00094  *                    application that links to the static lib.
00095  *   ALL_STATIC    -- (ignored) building various static libs, or building an 
00096  *                    application that links to the static libs.
00097  * Thus,
00098  * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
00099  * this bit of #ifdefs will define the 'correct' config variables based on
00100  * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but
00101  * unnecessary.
00102  *
00103  * Also, the precedence order is:
00104  *   ALL_STATIC (since we can't #undef something outside our namespace)
00105  *   PNG_BUILD_DLL
00106  *   PNG_STATIC
00107  *   (nothing) == PNG_USE_DLL
00108  * 
00109  * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
00110  *   of auto-import in binutils, we no longer need to worry about 
00111  *   __declspec(dllexport) / __declspec(dllimport) and friends.  Therefore,
00112  *   we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
00113  *   to __declspec() stuff.  However, we DO need to worry about 
00114  *   PNG_BUILD_DLL and PNG_STATIC because those change some defaults
00115  *   such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
00116  */
00117 #if defined(__CYGWIN__)
00118 #  if defined(ALL_STATIC)
00119 #    if defined(PNG_BUILD_DLL)
00120 #      undef PNG_BUILD_DLL
00121 #    endif
00122 #    if defined(PNG_USE_DLL)
00123 #      undef PNG_USE_DLL
00124 #    endif
00125 #    if defined(PNG_DLL)
00126 #      undef PNG_DLL
00127 #    endif
00128 #    if !defined(PNG_STATIC)
00129 #      define PNG_STATIC
00130 #    endif
00131 #  else
00132 #    if defined (PNG_BUILD_DLL)
00133 #      if defined(PNG_STATIC)
00134 #        undef PNG_STATIC
00135 #      endif
00136 #      if defined(PNG_USE_DLL)
00137 #        undef PNG_USE_DLL
00138 #      endif
00139 #      if !defined(PNG_DLL)
00140 #        define PNG_DLL
00141 #      endif
00142 #    else
00143 #      if defined(PNG_STATIC)
00144 #        if defined(PNG_USE_DLL)
00145 #          undef PNG_USE_DLL
00146 #        endif
00147 #        if defined(PNG_DLL)
00148 #          undef PNG_DLL
00149 #        endif
00150 #      else
00151 #        if !defined(PNG_USE_DLL)
00152 #          define PNG_USE_DLL
00153 #        endif
00154 #        if !defined(PNG_DLL)
00155 #          define PNG_DLL
00156 #        endif
00157 #      endif  
00158 #    endif  
00159 #  endif
00160 #endif
00161 
00162 /* This protects us against compilers that run on a windowing system
00163  * and thus don't have or would rather us not use the stdio types:
00164  * stdin, stdout, and stderr.  The only one currently used is stderr
00165  * in png_error() and png_warning().  #defining PNG_NO_CONSOLE_IO will
00166  * prevent these from being compiled and used. #defining PNG_NO_STDIO
00167  * will also prevent these, plus will prevent the entire set of stdio
00168  * macros and functions (FILE *, printf, etc.) from being compiled and used,
00169  * unless (PNG_DEBUG > 0) has been #defined.
00170  *
00171  * #define PNG_NO_CONSOLE_IO
00172  * #define PNG_NO_STDIO
00173  */
00174 
00175 #if defined(_WIN32_WCE)
00176 #  include <windows.h>
00177    /* Console I/O functions are not supported on WindowsCE */
00178 #  define PNG_NO_CONSOLE_IO
00179 #  ifdef PNG_DEBUG
00180 #    undef PNG_DEBUG
00181 #  endif
00182 #endif
00183 
00184 #ifdef PNG_BUILD_DLL
00185 #  ifndef PNG_CONSOLE_IO_SUPPORTED
00186 #    ifndef PNG_NO_CONSOLE_IO
00187 #      define PNG_NO_CONSOLE_IO
00188 #    endif
00189 #  endif
00190 #endif
00191 
00192 #  ifdef PNG_NO_STDIO
00193 #    ifndef PNG_NO_CONSOLE_IO
00194 #      define PNG_NO_CONSOLE_IO
00195 #    endif
00196 #    ifdef PNG_DEBUG
00197 #      if (PNG_DEBUG > 0)
00198 #        include <stdio.h>
00199 #      endif
00200 #    endif
00201 #  else
00202 #    if !defined(_WIN32_WCE)
00203 /* "stdio.h" functions are not supported on WindowsCE */
00204 #      include <stdio.h>
00205 #    endif
00206 #  endif
00207 
00208 /* This macro protects us against machines that don't have function
00209  * prototypes (ie K&R style headers).  If your compiler does not handle
00210  * function prototypes, define this macro and use the included ansi2knr.
00211  * I've always been able to use _NO_PROTO as the indicator, but you may
00212  * need to drag the empty declaration out in front of here, or change the
00213  * ifdef to suit your own needs.
00214  */
00215 #ifndef PNGARG
00216 
00217 #ifdef OF /* zlib prototype munger */
00218 #  define PNGARG(arglist) OF(arglist)
00219 #else
00220 
00221 #ifdef _NO_PROTO
00222 #  define PNGARG(arglist) ()
00223 #  ifndef PNG_TYPECAST_NULL
00224 #     define PNG_TYPECAST_NULL
00225 #  endif
00226 #else
00227 #  define PNGARG(arglist) arglist
00228 #endif /* _NO_PROTO */
00229 
00230 #endif /* OF */
00231 
00232 #endif /* PNGARG */
00233 
00234 /* Try to determine if we are compiling on a Mac.  Note that testing for
00235  * just __MWERKS__ is not good enough, because the Codewarrior is now used
00236  * on non-Mac platforms.
00237  */
00238 #ifndef MACOS
00239 #  if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
00240       defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
00241 #    define MACOS
00242 #  endif
00243 #endif
00244 
00245 /* enough people need this for various reasons to include it here */
00246 #if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
00247 #  include <sys/types.h>
00248 #endif
00249 
00250 #if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)
00251 #  define PNG_SETJMP_SUPPORTED
00252 #endif
00253 
00254 #ifdef PNG_SETJMP_SUPPORTED
00255 /* This is an attempt to force a single setjmp behaviour on Linux.  If
00256  * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
00257  */
00258 
00259 #  ifdef __linux__
00260 #    ifdef _BSD_SOURCE
00261 #      define PNG_SAVE_BSD_SOURCE
00262 #      undef _BSD_SOURCE
00263 #    endif
00264 #    ifdef _SETJMP_H
00265      /* If you encounter a compiler error here, see the explanation
00266       * near the end of INSTALL.
00267       */
00268          __png.h__ already includes setjmp.h;
00269          __dont__ include it again.;
00270 #    endif
00271 #  endif /* __linux__ */
00272 
00273    /* include setjmp.h for error handling */
00274 #  include <setjmp.h>
00275 
00276 #  ifdef __linux__
00277 #    ifdef PNG_SAVE_BSD_SOURCE
00278 #      define _BSD_SOURCE
00279 #      undef PNG_SAVE_BSD_SOURCE
00280 #    endif
00281 #  endif /* __linux__ */
00282 #endif /* PNG_SETJMP_SUPPORTED */
00283 
00284 #ifdef BSD
00285 #  include <strings.h>
00286 #else
00287 #  include <string.h>
00288 #endif
00289 
00290 /* Other defines for things like memory and the like can go here.  */
00291 #ifdef PNG_INTERNAL
00292 
00293 #include <stdlib.h>
00294 
00295 /* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
00296  * aren't usually used outside the library (as far as I know), so it is
00297  * debatable if they should be exported at all.  In the future, when it is
00298  * possible to have run-time registry of chunk-handling functions, some of
00299  * these will be made available again.
00300 #define PNG_EXTERN extern
00301  */
00302 #define PNG_EXTERN
00303 
00304 /* Other defines specific to compilers can go here.  Try to keep
00305  * them inside an appropriate ifdef/endif pair for portability.
00306  */
00307 
00308 #if defined(PNG_FLOATING_POINT_SUPPORTED)
00309 #  if defined(MACOS)
00310      /* We need to check that <math.h> hasn't already been included earlier
00311       * as it seems it doesn't agree with <fp.h>, yet we should really use
00312       * <fp.h> if possible.
00313       */
00314 #    if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
00315 #      include <fp.h>
00316 #    endif
00317 #  else
00318 #    include <math.h>
00319 #  endif
00320 #  if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
00321      /* Amiga SAS/C: We must include builtin FPU functions when compiling using
00322       * MATH=68881
00323       */
00324 #    include <m68881.h>
00325 #  endif
00326 #endif
00327 
00328 /* Codewarrior on NT has linking problems without this. */
00329 #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
00330 #  define PNG_ALWAYS_EXTERN
00331 #endif
00332 
00333 /* This provides the non-ANSI (far) memory allocation routines. */
00334 #if defined(__TURBOC__) && defined(__MSDOS__)
00335 #  include <mem.h>
00336 #  include <alloc.h>
00337 #endif
00338 
00339 /* I have no idea why is this necessary... */
00340 #if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \
00341     defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__))
00342 #  include <malloc.h>
00343 #endif
00344 
00345 /* This controls how fine the dithering gets.  As this allocates
00346  * a largish chunk of memory (32K), those who are not as concerned
00347  * with dithering quality can decrease some or all of these.
00348  */
00349 #ifndef PNG_DITHER_RED_BITS
00350 #  define PNG_DITHER_RED_BITS 5
00351 #endif
00352 #ifndef PNG_DITHER_GREEN_BITS
00353 #  define PNG_DITHER_GREEN_BITS 5
00354 #endif
00355 #ifndef PNG_DITHER_BLUE_BITS
00356 #  define PNG_DITHER_BLUE_BITS 5
00357 #endif
00358 
00359 /* This controls how fine the gamma correction becomes when you
00360  * are only interested in 8 bits anyway.  Increasing this value
00361  * results in more memory being used, and more pow() functions
00362  * being called to fill in the gamma tables.  Don't set this value
00363  * less then 8, and even that may not work (I haven't tested it).
00364  */
00365 
00366 #ifndef PNG_MAX_GAMMA_8
00367 #  define PNG_MAX_GAMMA_8 11
00368 #endif
00369 
00370 /* This controls how much a difference in gamma we can tolerate before
00371  * we actually start doing gamma conversion.
00372  */
00373 #ifndef PNG_GAMMA_THRESHOLD
00374 #  define PNG_GAMMA_THRESHOLD 0.05
00375 #endif
00376 
00377 #endif /* PNG_INTERNAL */
00378 
00379 /* The following uses const char * instead of char * for error
00380  * and warning message functions, so some compilers won't complain.
00381  * If you do not want to use const, define PNG_NO_CONST here.
00382  */
00383 
00384 #ifndef PNG_NO_CONST
00385 #  define PNG_CONST const
00386 #else
00387 #  define PNG_CONST
00388 #endif
00389 
00390 /* The following defines give you the ability to remove code from the
00391  * library that you will not be using.  I wish I could figure out how to
00392  * automate this, but I can't do that without making it seriously hard
00393  * on the users.  So if you are not using an ability, change the #define
00394  * to and #undef, and that part of the library will not be compiled.  If
00395  * your linker can't find a function, you may want to make sure the
00396  * ability is defined here.  Some of these depend upon some others being
00397  * defined.  I haven't figured out all the interactions here, so you may
00398  * have to experiment awhile to get everything to compile.  If you are
00399  * creating or using a shared library, you probably shouldn't touch this,
00400  * as it will affect the size of the structures, and this will cause bad
00401  * things to happen if the library and/or application ever change.
00402  */
00403 
00404 /* Any features you will not be using can be undef'ed here */
00405 
00406 /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
00407  * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
00408  * on the compile line, then pick and choose which ones to define without
00409  * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
00410  * if you only want to have a png-compliant reader/writer but don't need
00411  * any of the extra transformations.  This saves about 80 kbytes in a
00412  * typical installation of the library. (PNG_NO_* form added in version
00413  * 1.0.1c, for consistency)
00414  */
00415 
00416 /* The size of the png_text structure changed in libpng-1.0.6 when
00417  * iTXt is supported.  It is turned off by default, to support old apps
00418  * that malloc the png_text structure instead of calling png_set_text()
00419  * and letting libpng malloc it.  It will be turned on by default in
00420  * libpng-1.3.0.
00421  */
00422 
00423 #ifndef PNG_iTXt_SUPPORTED
00424 #  if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
00425 #    define PNG_NO_READ_iTXt
00426 #  endif
00427 #  if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt)
00428 #    define PNG_NO_WRITE_iTXt
00429 #  endif
00430 #endif
00431 
00432 /* The following support, added after version 1.0.0, can be turned off here en
00433  * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
00434  * with old applications that require the length of png_struct and png_info
00435  * to remain unchanged.
00436  */
00437 
00438 #ifdef PNG_LEGACY_SUPPORTED
00439 #  define PNG_NO_FREE_ME
00440 #  define PNG_NO_READ_UNKNOWN_CHUNKS
00441 #  define PNG_NO_WRITE_UNKNOWN_CHUNKS
00442 #  define PNG_NO_READ_USER_CHUNKS
00443 #  define PNG_NO_READ_iCCP
00444 #  define PNG_NO_WRITE_iCCP
00445 #  define PNG_NO_READ_iTXt
00446 #  define PNG_NO_WRITE_iTXt
00447 #  define PNG_NO_READ_sCAL
00448 #  define PNG_NO_WRITE_sCAL
00449 #  define PNG_NO_READ_sPLT
00450 #  define PNG_NO_WRITE_sPLT
00451 #  define PNG_NO_INFO_IMAGE
00452 #  define PNG_NO_READ_RGB_TO_GRAY
00453 #  define PNG_NO_READ_USER_TRANSFORM
00454 #  define PNG_NO_WRITE_USER_TRANSFORM
00455 #  define PNG_NO_USER_MEM
00456 #  define PNG_NO_READ_EMPTY_PLTE
00457 #  define PNG_NO_MNG_FEATURES
00458 #  define PNG_NO_FIXED_POINT_SUPPORTED
00459 #endif
00460 
00461 /* Ignore attempt to turn off both floating and fixed point support */
00462 #if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
00463     !defined(PNG_NO_FIXED_POINT_SUPPORTED)
00464 #  define PNG_FIXED_POINT_SUPPORTED
00465 #endif
00466 
00467 #ifndef PNG_NO_FREE_ME
00468 #  define PNG_FREE_ME_SUPPORTED
00469 #endif
00470 
00471 #if defined(PNG_READ_SUPPORTED)
00472 
00473 #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
00474       !defined(PNG_NO_READ_TRANSFORMS)
00475 #  define PNG_READ_TRANSFORMS_SUPPORTED
00476 #endif
00477 
00478 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
00479 #  ifndef PNG_NO_READ_EXPAND
00480 #    define PNG_READ_EXPAND_SUPPORTED
00481 #  endif
00482 #  ifndef PNG_NO_READ_SHIFT
00483 #    define PNG_READ_SHIFT_SUPPORTED
00484 #  endif
00485 #  ifndef PNG_NO_READ_PACK
00486 #    define PNG_READ_PACK_SUPPORTED
00487 #  endif
00488 #  ifndef PNG_NO_READ_BGR
00489 #    define PNG_READ_BGR_SUPPORTED
00490 #  endif
00491 #  ifndef PNG_NO_READ_SWAP
00492 #    define PNG_READ_SWAP_SUPPORTED
00493 #  endif
00494 #  ifndef PNG_NO_READ_PACKSWAP
00495 #    define PNG_READ_PACKSWAP_SUPPORTED
00496 #  endif
00497 #  ifndef PNG_NO_READ_INVERT
00498 #    define PNG_READ_INVERT_SUPPORTED
00499 #  endif
00500 #  ifndef PNG_NO_READ_DITHER
00501 #    define PNG_READ_DITHER_SUPPORTED
00502 #  endif
00503 #  ifndef PNG_NO_READ_BACKGROUND
00504 #    define PNG_READ_BACKGROUND_SUPPORTED
00505 #  endif
00506 #  ifndef PNG_NO_READ_16_TO_8
00507 #    define PNG_READ_16_TO_8_SUPPORTED
00508 #  endif
00509 #  ifndef PNG_NO_READ_FILLER
00510 #    define PNG_READ_FILLER_SUPPORTED
00511 #  endif
00512 #  ifndef PNG_NO_READ_GAMMA
00513 #    define PNG_READ_GAMMA_SUPPORTED
00514 #  endif
00515 #  ifndef PNG_NO_READ_GRAY_TO_RGB
00516 #    define PNG_READ_GRAY_TO_RGB_SUPPORTED
00517 #  endif
00518 #  ifndef PNG_NO_READ_SWAP_ALPHA
00519 #    define PNG_READ_SWAP_ALPHA_SUPPORTED
00520 #  endif
00521 #  ifndef PNG_NO_READ_INVERT_ALPHA
00522 #    define PNG_READ_INVERT_ALPHA_SUPPORTED
00523 #  endif
00524 #  ifndef PNG_NO_READ_STRIP_ALPHA
00525 #    define PNG_READ_STRIP_ALPHA_SUPPORTED
00526 #  endif
00527 #  ifndef PNG_NO_READ_USER_TRANSFORM
00528 #    define PNG_READ_USER_TRANSFORM_SUPPORTED
00529 #  endif
00530 #  ifndef PNG_NO_READ_RGB_TO_GRAY
00531 #    define PNG_READ_RGB_TO_GRAY_SUPPORTED
00532 #  endif
00533 #endif /* PNG_READ_TRANSFORMS_SUPPORTED */
00534 
00535 #if !defined(PNG_NO_PROGRESSIVE_READ) && \
00536  !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED)  /* if you don't do progressive */
00537 #  define PNG_PROGRESSIVE_READ_SUPPORTED     /* reading.  This is not talking */
00538 #endif                               /* about interlacing capability!  You'll */
00539               /* still have interlacing unless you change the following line: */
00540 
00541 #define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
00542 
00543 #ifndef PNG_NO_READ_COMPOSITE_NODIV
00544 #  ifndef PNG_NO_READ_COMPOSITED_NODIV  /* libpng-1.0.x misspelling */
00545 #    define PNG_READ_COMPOSITE_NODIV_SUPPORTED   /* well tested on Intel, SGI */
00546 #  endif
00547 #endif
00548 
00549 /* Deprecated, will be removed from version 2.0.0.
00550    Use PNG_MNG_FEATURES_SUPPORTED instead. */
00551 #ifndef PNG_NO_READ_EMPTY_PLTE
00552 #  define PNG_READ_EMPTY_PLTE_SUPPORTED
00553 #endif
00554 
00555 #endif /* PNG_READ_SUPPORTED */
00556 
00557 #if defined(PNG_WRITE_SUPPORTED)
00558 
00559 # if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
00560     !defined(PNG_NO_WRITE_TRANSFORMS)
00561 #  define PNG_WRITE_TRANSFORMS_SUPPORTED
00562 #endif
00563 
00564 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
00565 #  ifndef PNG_NO_WRITE_SHIFT
00566 #    define PNG_WRITE_SHIFT_SUPPORTED
00567 #  endif
00568 #  ifndef PNG_NO_WRITE_PACK
00569 #    define PNG_WRITE_PACK_SUPPORTED
00570 #  endif
00571 #  ifndef PNG_NO_WRITE_BGR
00572 #    define PNG_WRITE_BGR_SUPPORTED
00573 #  endif
00574 #  ifndef PNG_NO_WRITE_SWAP
00575 #    define PNG_WRITE_SWAP_SUPPORTED
00576 #  endif
00577 #  ifndef PNG_NO_WRITE_PACKSWAP
00578 #    define PNG_WRITE_PACKSWAP_SUPPORTED
00579 #  endif
00580 #  ifndef PNG_NO_WRITE_INVERT
00581 #    define PNG_WRITE_INVERT_SUPPORTED
00582 #  endif
00583 #  ifndef PNG_NO_WRITE_FILLER
00584 #    define PNG_WRITE_FILLER_SUPPORTED   /* same as WRITE_STRIP_ALPHA */
00585 #  endif
00586 #  ifndef PNG_NO_WRITE_SWAP_ALPHA
00587 #    define PNG_WRITE_SWAP_ALPHA_SUPPORTED
00588 #  endif
00589 #  ifndef PNG_NO_WRITE_INVERT_ALPHA
00590 #    define PNG_WRITE_INVERT_ALPHA_SUPPORTED
00591 #  endif
00592 #  ifndef PNG_NO_WRITE_USER_TRANSFORM
00593 #    define PNG_WRITE_USER_TRANSFORM_SUPPORTED
00594 #  endif
00595 #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
00596 
00597 #define PNG_WRITE_INTERLACING_SUPPORTED  /* not required for PNG-compliant
00598                                             encoders, but can cause trouble
00599                                             if left undefined */
00600 
00601 #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
00602      defined(PNG_FLOATING_POINT_SUPPORTED)
00603 #  define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
00604 #endif
00605 
00606 #ifndef PNG_NO_WRITE_FLUSH
00607 #  define PNG_WRITE_FLUSH_SUPPORTED
00608 #endif
00609 
00610 /* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
00611 #ifndef PNG_NO_WRITE_EMPTY_PLTE
00612 #  define PNG_WRITE_EMPTY_PLTE_SUPPORTED
00613 #endif
00614 
00615 #endif /* PNG_WRITE_SUPPORTED */
00616 
00617 #ifndef PNG_1_0_X
00618 #  ifndef PNG_NO_ERROR_NUMBERS
00619 #    define PNG_ERROR_NUMBERS_SUPPORTED
00620 #  endif
00621 #endif /* PNG_1_0_X */
00622 
00623 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
00624     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
00625 #  ifndef PNG_NO_USER_TRANSFORM_PTR
00626 #    define PNG_USER_TRANSFORM_PTR_SUPPORTED
00627 #  endif
00628 #endif
00629 
00630 #ifndef PNG_NO_STDIO
00631 #  define PNG_TIME_RFC1123_SUPPORTED
00632 #endif
00633 
00634 /* This adds extra functions in pngget.c for accessing data from the
00635  * info pointer (added in version 0.99)
00636  * png_get_image_width()
00637  * png_get_image_height()
00638  * png_get_bit_depth()
00639  * png_get_color_type()
00640  * png_get_compression_type()
00641  * png_get_filter_type()
00642  * png_get_interlace_type()
00643  * png_get_pixel_aspect_ratio()
00644  * png_get_pixels_per_meter()
00645  * png_get_x_offset_pixels()
00646  * png_get_y_offset_pixels()
00647  * png_get_x_offset_microns()
00648  * png_get_y_offset_microns()
00649  */
00650 #if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)
00651 #  define PNG_EASY_ACCESS_SUPPORTED
00652 #endif
00653 
00654 /* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0 
00655    even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */
00656 #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
00657 #  ifndef PNG_ASSEMBLER_CODE_SUPPORTED
00658 #    define PNG_ASSEMBLER_CODE_SUPPORTED
00659 #  endif
00660 #  if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
00661 #    define PNG_MMX_CODE_SUPPORTED
00662 #  endif
00663 #endif
00664 
00665 /* If you are sure that you don't need thread safety and you are compiling
00666    with PNG_USE_PNGCCRD for an MMX application, you can define this for
00667    faster execution.  See pnggccrd.c.
00668 #define PNG_THREAD_UNSAFE_OK
00669 */
00670 
00671 #if !defined(PNG_1_0_X)
00672 #if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
00673 #  define PNG_USER_MEM_SUPPORTED
00674 #endif
00675 #endif /* PNG_1_0_X */
00676 
00677 /* Added at libpng-1.2.6 */
00678 #if !defined(PNG_1_0_X)
00679 #ifndef PNG_SET_USER_LIMITS_SUPPORTED
00680 #if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED)
00681 #  define PNG_SET_USER_LIMITS_SUPPORTED
00682 #endif
00683 #endif
00684 #endif /* PNG_1_0_X */
00685 
00686 /* Added at libpng-1.0.16 and 1.2.6.  To accept all valid PNGS no matter
00687  * how large, set these limits to 0x7fffffffL
00688  */
00689 #ifndef PNG_USER_WIDTH_MAX
00690 #  define PNG_USER_WIDTH_MAX 1000000L
00691 #endif
00692 #ifndef PNG_USER_HEIGHT_MAX
00693 #  define PNG_USER_HEIGHT_MAX 1000000L
00694 #endif
00695 
00696 /* These are currently experimental features, define them if you want */
00697 
00698 /* very little testing */
00699 /*
00700 #ifdef PNG_READ_SUPPORTED
00701 #  ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
00702 #    define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
00703 #  endif
00704 #endif
00705 */
00706 
00707 /* This is only for PowerPC big-endian and 680x0 systems */
00708 /* some testing */
00709 /*
00710 #ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
00711 #  define PNG_READ_BIG_ENDIAN_SUPPORTED
00712 #endif
00713 */
00714 
00715 /* Buggy compilers (e.g., gcc 2.7.2.2) need this */
00716 /*
00717 #define PNG_NO_POINTER_INDEXING
00718 */
00719 
00720 /* These functions are turned off by default, as they will be phased out. */
00721 /*
00722 #define  PNG_USELESS_TESTS_SUPPORTED
00723 #define  PNG_CORRECT_PALETTE_SUPPORTED
00724 */
00725 
00726 /* Any chunks you are not interested in, you can undef here.  The
00727  * ones that allocate memory may be expecially important (hIST,
00728  * tEXt, zTXt, tRNS, pCAL).  Others will just save time and make png_info
00729  * a bit smaller.
00730  */
00731 
00732 #if defined(PNG_READ_SUPPORTED) && \
00733     !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
00734     !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
00735 #  define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
00736 #endif
00737 
00738 #if defined(PNG_WRITE_SUPPORTED) && \
00739     !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
00740     !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
00741 #  define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
00742 #endif
00743 
00744 #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
00745 
00746 #ifdef PNG_NO_READ_TEXT
00747 #  define PNG_NO_READ_iTXt
00748 #  define PNG_NO_READ_tEXt
00749 #  define PNG_NO_READ_zTXt
00750 #endif
00751 #ifndef PNG_NO_READ_bKGD
00752 #  define PNG_READ_bKGD_SUPPORTED
00753 #  define PNG_bKGD_SUPPORTED
00754 #endif
00755 #ifndef PNG_NO_READ_cHRM
00756 #  define PNG_READ_cHRM_SUPPORTED
00757 #  define PNG_cHRM_SUPPORTED
00758 #endif
00759 #ifndef PNG_NO_READ_gAMA
00760 #  define PNG_READ_gAMA_SUPPORTED
00761 #  define PNG_gAMA_SUPPORTED
00762 #endif
00763 #ifndef PNG_NO_READ_hIST
00764 #  define PNG_READ_hIST_SUPPORTED
00765 #  define PNG_hIST_SUPPORTED
00766 #endif
00767 #ifndef PNG_NO_READ_iCCP
00768 #  define PNG_READ_iCCP_SUPPORTED
00769 #  define PNG_iCCP_SUPPORTED
00770 #endif
00771 #ifndef PNG_NO_READ_iTXt
00772 #  ifndef PNG_READ_iTXt_SUPPORTED
00773 #    define PNG_READ_iTXt_SUPPORTED
00774 #  endif
00775 #  ifndef PNG_iTXt_SUPPORTED
00776 #    define PNG_iTXt_SUPPORTED
00777 #  endif
00778 #endif
00779 #ifndef PNG_NO_READ_oFFs
00780 #  define PNG_READ_oFFs_SUPPORTED
00781 #  define PNG_oFFs_SUPPORTED
00782 #endif
00783 #ifndef PNG_NO_READ_pCAL
00784 #  define PNG_READ_pCAL_SUPPORTED
00785 #  define PNG_pCAL_SUPPORTED
00786 #endif
00787 #ifndef PNG_NO_READ_sCAL
00788 #  define PNG_READ_sCAL_SUPPORTED
00789 #  define PNG_sCAL_SUPPORTED
00790 #endif
00791 #ifndef PNG_NO_READ_pHYs
00792 #  define PNG_READ_pHYs_SUPPORTED
00793 #  define PNG_pHYs_SUPPORTED
00794 #endif
00795 #ifndef PNG_NO_READ_sBIT
00796 #  define PNG_READ_sBIT_SUPPORTED
00797 #  define PNG_sBIT_SUPPORTED
00798 #endif
00799 #ifndef PNG_NO_READ_sPLT
00800 #  define PNG_READ_sPLT_SUPPORTED
00801 #  define PNG_sPLT_SUPPORTED
00802 #endif
00803 #ifndef PNG_NO_READ_sRGB
00804 #  define PNG_READ_sRGB_SUPPORTED
00805 #  define PNG_sRGB_SUPPORTED
00806 #endif
00807 #ifndef PNG_NO_READ_tEXt
00808 #  define PNG_READ_tEXt_SUPPORTED
00809 #  define PNG_tEXt_SUPPORTED
00810 #endif
00811 #ifndef PNG_NO_READ_tIME
00812 #  define PNG_READ_tIME_SUPPORTED
00813 #  define PNG_tIME_SUPPORTED
00814 #endif
00815 #ifndef PNG_NO_READ_tRNS
00816 #  define PNG_READ_tRNS_SUPPORTED
00817 #  define PNG_tRNS_SUPPORTED
00818 #endif
00819 #ifndef PNG_NO_READ_zTXt
00820 #  define PNG_READ_zTXt_SUPPORTED
00821 #  define PNG_zTXt_SUPPORTED
00822 #endif
00823 #ifndef PNG_NO_READ_UNKNOWN_CHUNKS
00824 #  define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
00825 #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
00826 #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
00827 #  endif
00828 #  ifndef PNG_NO_HANDLE_AS_UNKNOWN
00829 #    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
00830 #  endif
00831 #endif
00832 #if !defined(PNG_NO_READ_USER_CHUNKS) && \
00833      defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
00834 #  define PNG_READ_USER_CHUNKS_SUPPORTED
00835 #  define PNG_USER_CHUNKS_SUPPORTED
00836 #  ifdef PNG_NO_READ_UNKNOWN_CHUNKS
00837 #    undef PNG_NO_READ_UNKNOWN_CHUNKS
00838 #  endif
00839 #  ifdef PNG_NO_HANDLE_AS_UNKNOWN
00840 #    undef PNG_NO_HANDLE_AS_UNKNOWN
00841 #  endif
00842 #endif
00843 #ifndef PNG_NO_READ_OPT_PLTE
00844 #  define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
00845 #endif                      /* optional PLTE chunk in RGB and RGBA images */
00846 #if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
00847     defined(PNG_READ_zTXt_SUPPORTED)
00848 #  define PNG_READ_TEXT_SUPPORTED
00849 #  define PNG_TEXT_SUPPORTED
00850 #endif
00851 
00852 #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
00853 
00854 #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
00855 
00856 #ifdef PNG_NO_WRITE_TEXT
00857 #  define PNG_NO_WRITE_iTXt
00858 #  define PNG_NO_WRITE_tEXt
00859 #  define PNG_NO_WRITE_zTXt
00860 #endif
00861 #ifndef PNG_NO_WRITE_bKGD
00862 #  define PNG_WRITE_bKGD_SUPPORTED
00863 #  ifndef PNG_bKGD_SUPPORTED
00864 #    define PNG_bKGD_SUPPORTED
00865 #  endif
00866 #endif
00867 #ifndef PNG_NO_WRITE_cHRM
00868 #  define PNG_WRITE_cHRM_SUPPORTED
00869 #  ifndef PNG_cHRM_SUPPORTED
00870 #    define PNG_cHRM_SUPPORTED
00871 #  endif
00872 #endif
00873 #ifndef PNG_NO_WRITE_gAMA
00874 #  define PNG_WRITE_gAMA_SUPPORTED
00875 #  ifndef PNG_gAMA_SUPPORTED
00876 #    define PNG_gAMA_SUPPORTED
00877 #  endif
00878 #endif
00879 #ifndef PNG_NO_WRITE_hIST
00880 #  define PNG_WRITE_hIST_SUPPORTED
00881 #  ifndef PNG_hIST_SUPPORTED
00882 #    define PNG_hIST_SUPPORTED
00883 #  endif
00884 #endif
00885 #ifndef PNG_NO_WRITE_iCCP
00886 #  define PNG_WRITE_iCCP_SUPPORTED
00887 #  ifndef PNG_iCCP_SUPPORTED
00888 #    define PNG_iCCP_SUPPORTED
00889 #  endif
00890 #endif
00891 #ifndef PNG_NO_WRITE_iTXt
00892 #  ifndef PNG_WRITE_iTXt_SUPPORTED
00893 #    define PNG_WRITE_iTXt_SUPPORTED
00894 #  endif
00895 #  ifndef PNG_iTXt_SUPPORTED
00896 #    define PNG_iTXt_SUPPORTED
00897 #  endif
00898 #endif
00899 #ifndef PNG_NO_WRITE_oFFs
00900 #  define PNG_WRITE_oFFs_SUPPORTED
00901 #  ifndef PNG_oFFs_SUPPORTED
00902 #    define PNG_oFFs_SUPPORTED
00903 #  endif
00904 #endif
00905 #ifndef PNG_NO_WRITE_pCAL
00906 #  define PNG_WRITE_pCAL_SUPPORTED
00907 #  ifndef PNG_pCAL_SUPPORTED
00908 #    define PNG_pCAL_SUPPORTED
00909 #  endif
00910 #endif
00911 #ifndef PNG_NO_WRITE_sCAL
00912 #  define PNG_WRITE_sCAL_SUPPORTED
00913 #  ifndef PNG_sCAL_SUPPORTED
00914 #    define PNG_sCAL_SUPPORTED
00915 #  endif
00916 #endif
00917 #ifndef PNG_NO_WRITE_pHYs
00918 #  define PNG_WRITE_pHYs_SUPPORTED
00919 #  ifndef PNG_pHYs_SUPPORTED
00920 #    define PNG_pHYs_SUPPORTED
00921 #  endif
00922 #endif
00923 #ifndef PNG_NO_WRITE_sBIT
00924 #  define PNG_WRITE_sBIT_SUPPORTED
00925 #  ifndef PNG_sBIT_SUPPORTED
00926 #    define PNG_sBIT_SUPPORTED
00927 #  endif
00928 #endif
00929 #ifndef PNG_NO_WRITE_sPLT
00930 #  define PNG_WRITE_sPLT_SUPPORTED
00931 #  ifndef PNG_sPLT_SUPPORTED
00932 #    define PNG_sPLT_SUPPORTED
00933 #  endif
00934 #endif
00935 #ifndef PNG_NO_WRITE_sRGB
00936 #  define PNG_WRITE_sRGB_SUPPORTED
00937 #  ifndef PNG_sRGB_SUPPORTED
00938 #    define PNG_sRGB_SUPPORTED
00939 #  endif
00940 #endif
00941 #ifndef PNG_NO_WRITE_tEXt
00942 #  define PNG_WRITE_tEXt_SUPPORTED
00943 #  ifndef PNG_tEXt_SUPPORTED
00944 #    define PNG_tEXt_SUPPORTED
00945 #  endif
00946 #endif
00947 #ifndef PNG_NO_WRITE_tIME
00948 #  define PNG_WRITE_tIME_SUPPORTED
00949 #  ifndef PNG_tIME_SUPPORTED
00950 #    define PNG_tIME_SUPPORTED
00951 #  endif
00952 #endif
00953 #ifndef PNG_NO_WRITE_tRNS
00954 #  define PNG_WRITE_tRNS_SUPPORTED
00955 #  ifndef PNG_tRNS_SUPPORTED
00956 #    define PNG_tRNS_SUPPORTED
00957 #  endif
00958 #endif
00959 #ifndef PNG_NO_WRITE_zTXt
00960 #  define PNG_WRITE_zTXt_SUPPORTED
00961 #  ifndef PNG_zTXt_SUPPORTED
00962 #    define PNG_zTXt_SUPPORTED
00963 #  endif
00964 #endif
00965 #ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
00966 #  define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
00967 #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
00968 #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
00969 #  endif
00970 #  ifndef PNG_NO_HANDLE_AS_UNKNOWN
00971 #     ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
00972 #       define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
00973 #     endif
00974 #  endif
00975 #endif
00976 #if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
00977     defined(PNG_WRITE_zTXt_SUPPORTED)
00978 #  define PNG_WRITE_TEXT_SUPPORTED
00979 #  ifndef PNG_TEXT_SUPPORTED
00980 #    define PNG_TEXT_SUPPORTED
00981 #  endif
00982 #endif
00983 
00984 #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
00985 
00986 /* Turn this off to disable png_read_png() and
00987  * png_write_png() and leave the row_pointers member
00988  * out of the info structure.
00989  */
00990 #ifndef PNG_NO_INFO_IMAGE
00991 #  define PNG_INFO_IMAGE_SUPPORTED
00992 #endif
00993 
00994 /* need the time information for reading tIME chunks */
00995 #if defined(PNG_tIME_SUPPORTED)
00996 #  if !defined(_WIN32_WCE)
00997      /* "time.h" functions are not supported on WindowsCE */
00998 #    include <time.h>
00999 #  endif
01000 #endif
01001 
01002 /* Some typedefs to get us started.  These should be safe on most of the
01003  * common platforms.  The typedefs should be at least as large as the
01004  * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
01005  * don't have to be exactly that size.  Some compilers dislike passing
01006  * unsigned shorts as function parameters, so you may be better off using
01007  * unsigned int for png_uint_16.  Likewise, for 64-bit systems, you may
01008  * want to have unsigned int for png_uint_32 instead of unsigned long.
01009  */
01010 
01011 typedef unsigned long png_uint_32;
01012 typedef long png_int_32;
01013 typedef unsigned short png_uint_16;
01014 typedef short png_int_16;
01015 typedef unsigned char png_byte;
01016 
01017 /* This is usually size_t.  It is typedef'ed just in case you need it to
01018    change (I'm not sure if you will or not, so I thought I'd be safe) */
01019 #ifdef PNG_SIZE_T
01020    typedef PNG_SIZE_T png_size_t;
01021 #  define png_sizeof(x) png_convert_size(sizeof (x))
01022 #else
01023    typedef size_t png_size_t;
01024 #  define png_sizeof(x) sizeof (x)
01025 #endif
01026 
01027 /* The following is needed for medium model support.  It cannot be in the
01028  * PNG_INTERNAL section.  Needs modification for other compilers besides
01029  * MSC.  Model independent support declares all arrays and pointers to be
01030  * large using the far keyword.  The zlib version used must also support
01031  * model independent data.  As of version zlib 1.0.4, the necessary changes
01032  * have been made in zlib.  The USE_FAR_KEYWORD define triggers other
01033  * changes that are needed. (Tim Wegner)
01034  */
01035 
01036 /* Separate compiler dependencies (problem here is that zlib.h always
01037    defines FAR. (SJT) */
01038 #ifdef __BORLANDC__
01039 #  if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
01040 #    define LDATA 1
01041 #  else
01042 #    define LDATA 0
01043 #  endif
01044    /* GRR:  why is Cygwin in here?  Cygwin is not Borland C... */
01045 #  if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
01046 #    define PNG_MAX_MALLOC_64K
01047 #    if (LDATA != 1)
01048 #      ifndef FAR
01049 #        define FAR __far
01050 #      endif
01051 #      define USE_FAR_KEYWORD
01052 #    endif   /* LDATA != 1 */
01053      /* Possibly useful for moving data out of default segment.
01054       * Uncomment it if you want. Could also define FARDATA as
01055       * const if your compiler supports it. (SJT)
01056 #    define FARDATA FAR
01057       */
01058 #  endif  /* __WIN32__, __FLAT__, __CYGWIN__ */
01059 #endif   /* __BORLANDC__ */
01060 
01061 
01062 /* Suggest testing for specific compiler first before testing for
01063  * FAR.  The Watcom compiler defines both __MEDIUM__ and M_I86MM,
01064  * making reliance oncertain keywords suspect. (SJT)
01065  */
01066 
01067 /* MSC Medium model */
01068 #if defined(FAR)
01069 #  if defined(M_I86MM)
01070 #    define USE_FAR_KEYWORD
01071 #    define FARDATA FAR
01072 #    include <dos.h>
01073 #  endif
01074 #endif
01075 
01076 /* SJT: default case */
01077 #ifndef FAR
01078 #  define FAR
01079 #endif
01080 
01081 /* At this point FAR is always defined */
01082 #ifndef FARDATA
01083 #  define FARDATA
01084 #endif
01085 
01086 /* Typedef for floating-point numbers that are converted
01087    to fixed-point with a multiple of 100,000, e.g., int_gamma */
01088 typedef png_int_32 png_fixed_point;
01089 
01090 /* Add typedefs for pointers */
01091 typedef void            FAR * png_voidp;
01092 typedef png_byte        FAR * png_bytep;
01093 typedef png_uint_32     FAR * png_uint_32p;
01094 typedef png_int_32      FAR * png_int_32p;
01095 typedef png_uint_16     FAR * png_uint_16p;
01096 typedef png_int_16      FAR * png_int_16p;
01097 typedef PNG_CONST char  FAR * png_const_charp;
01098 typedef char            FAR * png_charp;
01099 typedef png_fixed_point FAR * png_fixed_point_p;
01100 
01101 #ifndef PNG_NO_STDIO
01102 #if defined(_WIN32_WCE)
01103 typedef HANDLE                png_FILE_p;
01104 #else
01105 typedef FILE                * png_FILE_p;
01106 #endif
01107 #endif
01108 
01109 #ifdef PNG_FLOATING_POINT_SUPPORTED
01110 typedef double          FAR * png_doublep;
01111 #endif
01112 
01113 /* Pointers to pointers; i.e. arrays */
01114 typedef png_byte        FAR * FAR * png_bytepp;
01115 typedef png_uint_32     FAR * FAR * png_uint_32pp;
01116 typedef png_int_32      FAR * FAR * png_int_32pp;
01117 typedef png_uint_16     FAR * FAR * png_uint_16pp;
01118 typedef png_int_16      FAR * FAR * png_int_16pp;
01119 typedef PNG_CONST char  FAR * FAR * png_const_charpp;
01120 typedef char            FAR * FAR * png_charpp;
01121 typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
01122 #ifdef PNG_FLOATING_POINT_SUPPORTED
01123 typedef double          FAR * FAR * png_doublepp;
01124 #endif
01125 
01126 /* Pointers to pointers to pointers; i.e., pointer to array */
01127 typedef char            FAR * FAR * FAR * png_charppp;
01128 
01129 /* libpng typedefs for types in zlib. If zlib changes
01130  * or another compression library is used, then change these.
01131  * Eliminates need to change all the source files.
01132  */
01133 typedef charf *         png_zcharp;
01134 typedef charf * FAR *   png_zcharpp;
01135 typedef z_stream FAR *  png_zstreamp;
01136 
01137 /*
01138  * Define PNG_BUILD_DLL if the module being built is a Windows
01139  * LIBPNG DLL.
01140  *
01141  * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
01142  * It is equivalent to Microsoft predefined macro _DLL that is
01143  * automatically defined when you compile using the share
01144  * version of the CRT (C Run-Time library)
01145  *
01146  * The cygwin mods make this behavior a little different:
01147  * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
01148  * Define PNG_STATIC if you are building a static library for use with cygwin,
01149  *   -or- if you are building an application that you want to link to the
01150  *   static library.
01151  * PNG_USE_DLL is defined by default (no user action needed) unless one of
01152  *   the other flags is defined.
01153  */
01154 
01155 #if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
01156 #  define PNG_DLL
01157 #endif
01158 /* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
01159  * When building a static lib, default to no GLOBAL ARRAYS, but allow
01160  * command-line override
01161  */
01162 #if defined(__CYGWIN__)
01163 #  if !defined(PNG_STATIC)
01164 #    if defined(PNG_USE_GLOBAL_ARRAYS)
01165 #      undef PNG_USE_GLOBAL_ARRAYS
01166 #    endif
01167 #    if !defined(PNG_USE_LOCAL_ARRAYS)
01168 #      define PNG_USE_LOCAL_ARRAYS
01169 #    endif
01170 #  else
01171 #    if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
01172 #      if defined(PNG_USE_GLOBAL_ARRAYS)
01173 #        undef PNG_USE_GLOBAL_ARRAYS
01174 #      endif
01175 #    endif
01176 #  endif
01177 #  if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
01178 #    define PNG_USE_LOCAL_ARRAYS
01179 #  endif
01180 #endif
01181 
01182 /* Do not use global arrays (helps with building DLL's)
01183  * They are no longer used in libpng itself, since version 1.0.5c,
01184  * but might be required for some pre-1.0.5c applications.
01185  */
01186 #if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
01187 #  if defined(PNG_NO_GLOBAL_ARRAYS) || (defined(__GNUC__) && defined(PNG_DLL))
01188 #    define PNG_USE_LOCAL_ARRAYS
01189 #  else
01190 #    define PNG_USE_GLOBAL_ARRAYS
01191 #  endif
01192 #endif
01193 
01194 #if defined(__CYGWIN__)
01195 #  undef PNGAPI
01196 #  define PNGAPI __cdecl
01197 #  undef PNG_IMPEXP
01198 #  define PNG_IMPEXP
01199 #endif  
01200 
01201 /* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
01202  * you may get warnings regarding the linkage of png_zalloc and png_zfree.
01203  * Don't ignore those warnings; you must also reset the default calling
01204  * convention in your compiler to match your PNGAPI, and you must build
01205  * zlib and your applications the same way you build libpng.
01206  */
01207 
01208 #if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
01209 #  ifndef PNG_NO_MODULEDEF
01210 #    define PNG_NO_MODULEDEF
01211 #  endif
01212 #endif
01213 
01214 #if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
01215 #  define PNG_IMPEXP
01216 #endif
01217 
01218 #if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
01219     (( defined(_Windows) || defined(_WINDOWS) || \
01220        defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
01221 
01222 #  ifndef PNGAPI
01223 #     if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
01224 #        define PNGAPI __cdecl
01225 #     else
01226 #        define PNGAPI _cdecl
01227 #     endif
01228 #  endif
01229 
01230 #  if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
01231        0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
01232 #     define PNG_IMPEXP
01233 #  endif
01234 
01235 #  if !defined(PNG_IMPEXP)
01236 
01237 #     define PNG_EXPORT_TYPE1(type,symbol)  PNG_IMPEXP type PNGAPI symbol
01238 #     define PNG_EXPORT_TYPE2(type,symbol)  type PNG_IMPEXP PNGAPI symbol
01239 
01240       /* Borland/Microsoft */
01241 #     if defined(_MSC_VER) || defined(__BORLANDC__)
01242 #        if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
01243 #           define PNG_EXPORT PNG_EXPORT_TYPE1
01244 #        else
01245 #           define PNG_EXPORT PNG_EXPORT_TYPE2
01246 #           if defined(PNG_BUILD_DLL)
01247 #              define PNG_IMPEXP __export
01248 #           else
01249 #              define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
01250                                                  VC++ */
01251 #           endif                             /* Exists in Borland C++ for
01252                                                  C++ classes (== huge) */
01253 #        endif
01254 #     endif
01255 
01256 #     if !defined(PNG_IMPEXP)
01257 #        if defined(PNG_BUILD_DLL)
01258 #           define PNG_IMPEXP __declspec(dllexport)
01259 #        else
01260 #           define PNG_IMPEXP __declspec(dllimport)
01261 #        endif
01262 #     endif
01263 #  endif  /* PNG_IMPEXP */
01264 #else /* !(DLL || non-cygwin WINDOWS) */
01265 #   if defined(__OS2__)
01266 #      if defined(__GNUC__) && defined(__declspec) && defined(PNG_DLL) && !defined(PNG_IMPEXP)
01267 #         ifdef PNG_BUILD_DLL
01268 #            define PNG_IMPEXP __declspec(dllexport)
01269 #         else
01270 #            define PNG_IMPEXP __declspec(dllimport)
01271 #         endif
01272 #      endif /* GNUC & declspec */
01273 #      if (defined(__IBMC__) || defined(__IBMCPP__)) && !defined(PNGAPI)
01274 #         define PNGAPI _System
01275 #      endif
01276 #   else
01277 #      if 0 /* ... other platforms, with other meanings */
01278 #      endif
01279 #   endif
01280 #endif
01281 
01282 #ifndef PNGAPI
01283 #  define PNGAPI
01284 #endif
01285 #ifndef PNG_IMPEXP
01286 #  define PNG_IMPEXP
01287 #endif
01288 
01289 #ifndef PNG_EXPORT
01290 #  define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
01291 #endif
01292 
01293 #ifdef PNG_USE_GLOBAL_ARRAYS
01294 #  ifndef PNG_EXPORT_VAR
01295 #    define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
01296 #  endif
01297 #endif
01298 
01299 /* User may want to use these so they are not in PNG_INTERNAL. Any library
01300  * functions that are passed far data must be model independent.
01301  */
01302 
01303 #ifndef PNG_ABORT
01304 #  define PNG_ABORT() abort()
01305 #endif
01306 
01307 #ifdef PNG_SETJMP_SUPPORTED
01308 #  define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
01309 #else
01310 #  define png_jmpbuf(png_ptr) \
01311    (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
01312 #endif
01313 
01314 #if defined(USE_FAR_KEYWORD)  /* memory model independent fns */
01315 /* use this to make far-to-near assignments */
01316 #  define CHECK   1
01317 #  define NOCHECK 0
01318 #  define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
01319 #  define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
01320 #  define png_strcpy  _fstrcpy
01321 #  define png_strncpy _fstrncpy   /* Added to v 1.2.6 */
01322 #  define png_strlen  _fstrlen
01323 #  define png_memcmp  _fmemcmp    /* SJT: added */
01324 #  define png_memcpy  _fmemcpy
01325 #  define png_memset  _fmemset
01326 #else /* use the usual functions */
01327 #  define CVT_PTR(ptr)         (ptr)
01328 #  define CVT_PTR_NOCHECK(ptr) (ptr)
01329 #  define png_strcpy  strcpy
01330 #  define png_strncpy strncpy     /* Added to v 1.2.6 */
01331 #  define png_strlen  strlen
01332 #  define png_memcmp  memcmp      /* SJT: added */
01333 #  define png_memcpy  memcpy
01334 #  define png_memset  memset
01335 #endif
01336 /* End of memory model independent support */
01337 
01338 /* Just a little check that someone hasn't tried to define something
01339  * contradictory.
01340  */
01341 #if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
01342 #  undef PNG_ZBUF_SIZE
01343 #  define PNG_ZBUF_SIZE 65536L
01344 #endif
01345 
01346 #ifdef PNG_READ_SUPPORTED
01347 /* Prior to libpng-1.0.9, this block was in pngasmrd.h */
01348 #if defined(PNG_INTERNAL)
01349 
01350 /* These are the default thresholds before the MMX code kicks in; if either
01351  * rowbytes or bitdepth is below the threshold, plain C code is used.  These
01352  * can be overridden at runtime via the png_set_mmx_thresholds() call in
01353  * libpng 1.2.0 and later.  The values below were chosen by Intel.
01354  */
01355 
01356 #ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT
01357 #  define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT  128  /*  >=  */
01358 #endif
01359 #ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT
01360 #  define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT  9    /*  >=  */   
01361 #endif
01362 
01363 /* Set this in the makefile for VC++ on Pentium, not here. */
01364 /* Platform must be Pentium.  Makefile must assemble and load pngvcrd.c .
01365  * MMX will be detected at run time and used if present.
01366  */
01367 #ifdef PNG_USE_PNGVCRD
01368 #  define PNG_HAVE_ASSEMBLER_COMBINE_ROW
01369 #  define PNG_HAVE_ASSEMBLER_READ_INTERLACE
01370 #  define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
01371 #endif
01372 
01373 /* Set this in the makefile for gcc/as on Pentium, not here. */
01374 /* Platform must be Pentium.  Makefile must assemble and load pnggccrd.c .
01375  * MMX will be detected at run time and used if present.
01376  */
01377 #ifdef PNG_USE_PNGGCCRD
01378 #  define PNG_HAVE_ASSEMBLER_COMBINE_ROW
01379 #  define PNG_HAVE_ASSEMBLER_READ_INTERLACE
01380 #  define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
01381 #endif
01382 /* - see pnggccrd.c for info about what is currently enabled */
01383 
01384 #endif /* PNG_INTERNAL */
01385 #endif /* PNG_READ_SUPPORTED */
01386 
01387 #endif /* PNGCONF_H */
01388