You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1526 lines
45 KiB

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