home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 July / CMCD0704.ISO / Software / Freeware / Utilitare / VisualBoyAdvance-1.7.2 / win32 / include / png / pngconf.h < prev   
C/C++ Source or Header  |  2002-10-20  |  40KB  |  1,323 lines

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