Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

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