home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 February / PCWorld_2002-02_cd.bin / Software / Vyzkuste / pdflib / pdflib-4.0.1.sit / pdflib-4.0.1 / png / pngconf.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-07-04  |  45.2 KB  |  1,443 lines  |  [TEXT/CWIE]

  1. /* pngconf.h - machine configurable file for libpng
  2.  *
  3.  * libpng 1.0.8 - July 24, 2000
  4.  * For conditions of distribution and use, see copyright notice in png.h
  5.  * Copyright (c) 1998, 1999, 2000 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. /* $Id: pngconf.h,v 1.10 2001/04/02 13:11:31 rjs Exp $ */
  17.  
  18. #ifndef PNGCONF_H
  19. #define PNGCONF_H
  20.  
  21. #define PNG_STATIC  /* PDFlib GmbH: always create a static lib under Cygwin */
  22.  
  23. #define PNG_PREFIX  /* PDFlib GmbH: use private function names */
  24. #define PNG_USER_MEM_SUPPORTED /* PDFlib GmbH: allow private alloc functions */
  25. #define PNG_PDFLIB_MEM_SUPPORTED /* PDFlib GmbH: use modified alloc code 
  26.                     inside of libpng */
  27.  
  28. /* PDFlib GmbH: prefix public PNG names with pdf_ */
  29. #ifdef PNG_PREFIX
  30. #define png_IDAT pdf_png_IDAT
  31. #define png_IEND pdf_png_IEND
  32. #define png_IHDR pdf_png_IHDR
  33. #define png_PLTE pdf_png_PLTE
  34. #define png_access_version_number pdf_png_access_version_number
  35. #define png_bKGD pdf_png_bKGD
  36. #define png_cHRM pdf_png_cHRM
  37. #define png_calculate_crc pdf_png_calculate_crc
  38. #define png_check_sig pdf_png_check_sig
  39. #define png_convert_to_rfc1123 pdf_png_convert_to_rfc1123
  40. #define png_create_info_struct pdf_png_create_info_struct
  41. #define png_data_freer pdf_png_data_freer
  42. #define png_destroy_info_struct pdf_png_destroy_info_struct
  43. #define png_free_data pdf_png_free_data
  44. #define png_gAMA pdf_png_gAMA
  45. #define png_get_copyright pdf_png_get_copyright
  46. #define png_get_header_ver pdf_png_get_header_ver
  47. #define png_get_header_version pdf_png_get_header_version
  48. #define png_get_io_ptr pdf_png_get_io_ptr
  49. #define png_get_libpng_ver pdf_png_get_libpng_ver
  50. #define png_hIST pdf_png_hIST
  51. #define png_handle_as_unknown pdf_png_handle_as_unknown
  52. #define png_iCCP pdf_png_iCCP
  53. #define png_iTXt pdf_png_iTXt
  54. #define png_info_destroy pdf_png_info_destroy
  55. #define png_info_init pdf_png_info_init
  56. #define png_init_io pdf_png_init_io
  57. #define png_libpng_ver pdf_png_libpng_ver
  58. #define png_oFFs pdf_png_oFFs
  59. #define png_pCAL pdf_png_pCAL
  60. #define png_pHYs pdf_png_pHYs
  61. #define png_pass_dsp_mask pdf_png_pass_dsp_mask
  62. #define png_pass_inc pdf_png_pass_inc
  63. #define png_pass_mask pdf_png_pass_mask
  64. #define png_pass_start pdf_png_pass_start
  65. #define png_pass_yinc pdf_png_pass_yinc
  66. #define png_pass_ystart pdf_png_pass_ystart
  67. #define png_reset_crc pdf_png_reset_crc
  68. #define png_reset_zstream pdf_png_reset_zstream
  69. #define png_sBIT pdf_png_sBIT
  70. #define png_sCAL pdf_png_sCAL
  71. #define png_sPLT pdf_png_sPLT
  72. #define png_sRGB pdf_png_sRGB
  73. #define png_set_sig_bytes pdf_png_set_sig_bytes
  74. #define png_sig pdf_png_sig
  75. #define png_sig_cmp pdf_png_sig_cmp
  76. #define png_tEXt pdf_png_tEXt
  77. #define png_tIME pdf_png_tIME
  78. #define png_tRNS pdf_png_tRNS
  79. #define png_zTXt pdf_png_zTXt
  80. #define png_zalloc pdf_png_zalloc
  81. #define png_zfree pdf_png_zfree
  82. #define png_permit_empty_plte pdf_png_permit_empty_plte
  83. #define png_set_IHDR pdf_png_set_IHDR
  84. #define png_set_PLTE pdf_png_set_PLTE
  85. #define png_set_bKGD pdf_png_set_bKGD
  86. #define png_set_cHRM pdf_png_set_cHRM
  87. #define png_set_cHRM_fixed pdf_png_set_cHRM_fixed
  88. #define png_set_compression_buffer_size pdf_png_set_compression_buffer_size
  89. #define png_set_gAMA pdf_png_set_gAMA
  90. #define png_set_gAMA_fixed pdf_png_set_gAMA_fixed
  91. #define png_set_hIST pdf_png_set_hIST
  92. #define png_set_iCCP pdf_png_set_iCCP
  93. #define png_set_invalid pdf_png_set_invalid
  94. #define png_set_keep_unknown_chunks pdf_png_set_keep_unknown_chunks
  95. #define png_set_oFFs pdf_png_set_oFFs
  96. #define png_set_pCAL pdf_png_set_pCAL
  97. #define png_set_pHYs pdf_png_set_pHYs
  98. #define png_set_read_user_chunk_fn pdf_png_set_read_user_chunk_fn
  99. #define png_set_rows pdf_png_set_rows
  100. #define png_set_sBIT pdf_png_set_sBIT
  101. #define png_set_sCAL pdf_png_set_sCAL
  102. #define png_set_sPLT pdf_png_set_sPLT
  103. #define png_set_sRGB pdf_png_set_sRGB
  104. #define png_set_sRGB_gAMA_and_cHRM pdf_png_set_sRGB_gAMA_and_cHRM
  105. #define png_set_tIME pdf_png_set_tIME
  106. #define png_set_tRNS pdf_png_set_tRNS
  107. #define png_set_text pdf_png_set_text
  108. #define png_set_unknown_chunk_location pdf_png_set_unknown_chunk_location
  109. #define png_set_unknown_chunks pdf_png_set_unknown_chunks
  110. #define png_get_IHDR pdf_png_get_IHDR
  111. #define png_get_PLTE pdf_png_get_PLTE
  112. #define png_get_bKGD pdf_png_get_bKGD
  113. #define png_get_bit_depth pdf_png_get_bit_depth
  114. #define png_get_cHRM pdf_png_get_cHRM
  115. #define png_get_cHRM_fixed pdf_png_get_cHRM_fixed
  116. #define png_get_channels pdf_png_get_channels
  117. #define png_get_color_type pdf_png_get_color_type
  118. #define png_get_compression_buffer_size pdf_png_get_compression_buffer_size
  119. #define png_get_compression_type pdf_png_get_compression_type
  120. #define png_get_filter_type pdf_png_get_filter_type
  121. #define png_get_gAMA pdf_png_get_gAMA
  122. #define png_get_gAMA_fixed pdf_png_get_gAMA_fixed
  123. #define png_get_hIST pdf_png_get_hIST
  124. #define png_get_iCCP pdf_png_get_iCCP
  125. #define png_get_image_height pdf_png_get_image_height
  126. #define png_get_image_width pdf_png_get_image_width
  127. #define png_get_interlace_type pdf_png_get_interlace_type
  128. #define png_get_oFFs pdf_png_get_oFFs
  129. #define png_get_pCAL pdf_png_get_pCAL
  130. #define png_get_pHYs pdf_png_get_pHYs
  131. #define png_get_pixel_aspect_ratio pdf_png_get_pixel_aspect_ratio
  132. #define png_get_pixels_per_meter pdf_png_get_pixels_per_meter
  133. #define png_get_rgb_to_gray_status pdf_png_get_rgb_to_gray_status
  134. #define png_get_rowbytes pdf_png_get_rowbytes
  135. #define png_get_rows pdf_png_get_rows
  136. #define png_get_sBIT pdf_png_get_sBIT
  137. #define png_get_sCAL pdf_png_get_sCAL
  138. #define png_get_sPLT pdf_png_get_sPLT
  139. #define png_get_sRGB pdf_png_get_sRGB
  140. #define png_get_signature pdf_png_get_signature
  141. #define png_get_tIME pdf_png_get_tIME
  142. #define png_get_tRNS pdf_png_get_tRNS
  143. #define png_get_text pdf_png_get_text
  144. #define png_get_unknown_chunks pdf_png_get_unknown_chunks
  145. #define png_get_user_chunk_ptr pdf_png_get_user_chunk_ptr
  146. #define png_get_valid pdf_png_get_valid
  147. #define png_get_x_offset_microns pdf_png_get_x_offset_microns
  148. #define png_get_x_offset_pixels pdf_png_get_x_offset_pixels
  149. #define png_get_x_pixels_per_meter pdf_png_get_x_pixels_per_meter
  150. #define png_get_y_offset_microns pdf_png_get_y_offset_microns
  151. #define png_get_y_offset_pixels pdf_png_get_y_offset_pixels
  152. #define png_get_y_pixels_per_meter pdf_png_get_y_pixels_per_meter
  153. #define png_check_chunk_name pdf_png_check_chunk_name
  154. #define png_combine_row pdf_png_combine_row
  155. #define png_crc_error pdf_png_crc_error
  156. #define png_crc_finish pdf_png_crc_finish
  157. #define png_crc_read pdf_png_crc_read
  158. #define png_decompress_chunk pdf_png_decompress_chunk
  159. #define png_do_read_interlace pdf_png_do_read_interlace
  160. #define png_get_int_32 pdf_png_get_int_32
  161. #define png_get_uint_16 pdf_png_get_uint_16
  162. #define png_get_uint_32 pdf_png_get_uint_32
  163. #define png_handle_IEND pdf_png_handle_IEND
  164. #define png_handle_IHDR pdf_png_handle_IHDR
  165. #define png_handle_PLTE pdf_png_handle_PLTE
  166. #define png_handle_bKGD pdf_png_handle_bKGD
  167. #define png_handle_cHRM pdf_png_handle_cHRM
  168. #define png_handle_gAMA pdf_png_handle_gAMA
  169. #define png_handle_hIST pdf_png_handle_hIST
  170. #define png_handle_iCCP pdf_png_handle_iCCP
  171. #define png_handle_oFFs pdf_png_handle_oFFs
  172. #define png_handle_pCAL pdf_png_handle_pCAL
  173. #define png_handle_pHYs pdf_png_handle_pHYs
  174. #define png_handle_sBIT pdf_png_handle_sBIT
  175. #define png_handle_sCAL pdf_png_handle_sCAL
  176. #define png_handle_sPLT pdf_png_handle_sPLT
  177. #define png_handle_sRGB pdf_png_handle_sRGB
  178. #define png_handle_tEXt pdf_png_handle_tEXt
  179. #define png_handle_tIME pdf_png_handle_tIME
  180. #define png_handle_tRNS pdf_png_handle_tRNS
  181. #define png_handle_unknown pdf_png_handle_unknown
  182. #define png_handle_zTXt pdf_png_handle_zTXt
  183. #define png_read_filter_row pdf_png_read_filter_row
  184. #define png_read_finish_row pdf_png_read_finish_row
  185. #define png_read_start_row pdf_png_read_start_row
  186. #define png_do_bgr pdf_png_do_bgr
  187. #define png_do_invert pdf_png_do_invert
  188. #define png_do_packswap pdf_png_do_packswap
  189. #define png_do_strip_filler pdf_png_do_strip_filler
  190. #define png_do_swap pdf_png_do_swap
  191. #define png_get_user_transform_ptr pdf_png_get_user_transform_ptr
  192. #define png_set_bgr pdf_png_set_bgr
  193. #define png_set_filler pdf_png_set_filler
  194. #define png_set_interlace_handling pdf_png_set_interlace_handling
  195. #define png_set_invert_alpha pdf_png_set_invert_alpha
  196. #define png_set_invert_mono pdf_png_set_invert_mono
  197. #define png_set_packing pdf_png_set_packing
  198. #define png_set_packswap pdf_png_set_packswap
  199. #define png_set_shift pdf_png_set_shift
  200. #define png_set_swap pdf_png_set_swap
  201. #define png_set_swap_alpha pdf_png_set_swap_alpha
  202. #define png_set_user_transform_info pdf_png_set_user_transform_info
  203. #define png_create_read_struct pdf_png_create_read_struct
  204. #define png_destroy_read_struct pdf_png_destroy_read_struct
  205. #define png_read_destroy pdf_png_read_destroy
  206. #define png_read_end pdf_png_read_end
  207. #define png_read_image pdf_png_read_image
  208. #define png_read_info pdf_png_read_info
  209. /* png_read_init gets #defined in png.h */
  210. /* #define png_read_init pdf_png_read_init */
  211. #define png_read_init_2 pdf_png_read_init_2
  212. #define png_read_png pdf_png_read_png
  213. #define png_read_row pdf_png_read_row
  214. #define png_read_rows pdf_png_read_rows
  215. #define png_read_update_info pdf_png_read_update_info
  216. #define png_set_read_status_fn pdf_png_set_read_status_fn
  217. #define png_start_read_image pdf_png_start_read_image
  218. #define png_read_data pdf_png_read_data
  219. #define png_set_read_fn pdf_png_set_read_fn
  220. #define png_build_gamma_table pdf_png_build_gamma_table
  221. #define png_build_grayscale_palette pdf_png_build_grayscale_palette
  222. #define png_do_background pdf_png_do_background
  223. #define png_do_chop pdf_png_do_chop
  224. #define png_do_dither pdf_png_do_dither
  225. #define png_do_expand pdf_png_do_expand
  226. #define png_do_expand_palette pdf_png_do_expand_palette
  227. #define png_do_gamma pdf_png_do_gamma
  228. #define png_do_gray_to_rgb pdf_png_do_gray_to_rgb
  229. #define png_do_read_filler pdf_png_do_read_filler
  230. #define png_do_read_invert_alpha pdf_png_do_read_invert_alpha
  231. #define png_do_read_swap_alpha pdf_png_do_read_swap_alpha
  232. #define png_do_read_transformations pdf_png_do_read_transformations
  233. #define png_do_rgb_to_gray pdf_png_do_rgb_to_gray
  234. #define png_do_unpack pdf_png_do_unpack
  235. #define png_do_unshift pdf_png_do_unshift
  236. #define png_init_read_transformations pdf_png_init_read_transformations
  237. #define png_read_transform_info pdf_png_read_transform_info
  238. #define png_set_background pdf_png_set_background
  239. #define png_set_crc_action pdf_png_set_crc_action
  240. #define png_set_dither pdf_png_set_dither
  241. #define png_set_expand pdf_png_set_expand
  242. #define png_set_gamma pdf_png_set_gamma
  243. #define png_set_gray_1_2_4_to_8 pdf_png_set_gray_1_2_4_to_8
  244. #define png_set_gray_to_rgb pdf_png_set_gray_to_rgb
  245. #define png_set_palette_to_rgb pdf_png_set_palette_to_rgb
  246. #define png_set_read_user_transform_fn pdf_png_set_read_user_transform_fn
  247. #define png_set_rgb_to_gray pdf_png_set_rgb_to_gray
  248. #define png_set_rgb_to_gray_fixed pdf_png_set_rgb_to_gray_fixed
  249. #define png_set_strip_16 pdf_png_set_strip_16
  250. #define png_set_strip_alpha pdf_png_set_strip_alpha
  251. #define png_set_tRNS_to_alpha pdf_png_set_tRNS_to_alpha
  252. #define png_create_struct pdf_png_create_struct
  253. #define png_destroy_struct pdf_png_destroy_struct
  254. #define png_free pdf_png_free
  255. #define png_malloc pdf_png_malloc
  256. #define png_memcpy_check pdf_png_memcpy_check
  257. #define png_memset_check pdf_png_memset_check
  258. #define png_chunk_error pdf_png_chunk_error
  259. #define png_chunk_warning pdf_png_chunk_warning
  260. #define png_error pdf_png_error
  261. #define png_get_error_ptr pdf_png_get_error_ptr
  262. #define png_set_error_fn pdf_png_set_error_fn
  263. #define png_warning pdf_png_warning
  264. #endif
  265.  
  266. /* This is the size of the compression buffer, and thus the size of
  267.  * an IDAT chunk.  Make this whatever size you feel is best for your
  268.  * machine.  One of these will be allocated per png_struct.  When this
  269.  * is full, it writes the data to the disk, and does some other
  270.  * calculations.  Making this an extremely small size will slow
  271.  * the library down, but you may want to experiment to determine
  272.  * where it becomes significant, if you are concerned with memory
  273.  * usage.  Note that zlib allocates at least 32Kb also.  For readers,
  274.  * this describes the size of the buffer available to read the data in.
  275.  * Unless this gets smaller than the size of a row (compressed),
  276.  * it should not make much difference how big this is.
  277.  */
  278.  
  279. #ifndef PNG_ZBUF_SIZE
  280. #define PNG_ZBUF_SIZE 8192
  281. #endif
  282.  
  283. #ifndef PNG_NO_FLOATING_POINT_SUPPORTED 
  284. #define PNG_FLOATING_POINT_SUPPORTED
  285. #endif
  286.  
  287. /* If you are running on a machine where you cannot allocate more
  288.  * than 64K of memory at once, uncomment this.  While libpng will not
  289.  * normally need that much memory in a chunk (unless you load up a very
  290.  * large file), zlib needs to know how big of a chunk it can use, and
  291.  * libpng thus makes sure to check any memory allocation to verify it
  292.  * will fit into memory.
  293. #define PNG_MAX_MALLOC_64K
  294.  */
  295. #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
  296. #define PNG_MAX_MALLOC_64K
  297. #endif
  298.  
  299. /* Special munging to support doing things the 'cygwin' way:
  300.  * 'Normal' png-on-win32 defines/defaults:
  301.  *   PNG_BUILD_DLL -- building dll
  302.  *   PNG_USE_DLL   -- building an application, linking to dll
  303.  *   (no define)   -- building static library, or building an 
  304.  *                    application and linking to the static lib
  305.  * 'Cygwin' defines/defaults:
  306.  *   PNG_BUILD_DLL -- building the dll
  307.  *   (no define)   -- building an application, linking to the dll
  308.  *   PNG_STATIC    -- building the static lib, or building an application
  309.  *                    which links to the static lib.
  310.  * Thus,
  311.  * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
  312.  * this bit of #ifdefs will define the 'correct' config variables based on
  313.  * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but
  314.  * unnecessary.
  315.  */
  316. #if defined(__CYGWIN__)
  317. #  if defined(PNG_BUILD_DLL)
  318. #    if defined(PNG_USE_DLL)
  319. #      undef PNG_USE_DLL
  320. #    endif
  321. #    if !defined(PNG_DLL)
  322. #      define PNG_DLL
  323. #    endif
  324. #    if defined(PNG_STATIC)
  325. #      undef PNG_STATIC
  326. #    endif
  327. #  else
  328. #    if defined(PNG_STATIC)
  329. #      if defined(PNG_USE_DLL)
  330. #        undef PNG_USE_DLL
  331. #      endif
  332. #      if defined(PNG_DLL)
  333. #        undef PNG_DLL
  334. #      endif
  335. #    else
  336. #      if defined(PNG_USE_DLL)
  337. #        if !defined(PNG_DLL)
  338. #          define PNG_DLL
  339. #        endif
  340. #      else
  341. #        if defined(PNG_DLL)
  342. #           define PNG_USE_DLL
  343. #        else
  344. #           define PNG_USE_DLL
  345. #           define PNG_DLL
  346. #        endif
  347. #      endif
  348. #    endif
  349. #  endif
  350. #endif
  351.  
  352.  
  353. /* This protects us against compilers that run on a windowing system
  354.  * and thus don't have or would rather us not use the stdio types:
  355.  * stdin, stdout, and stderr.  The only one currently used is stderr
  356.  * in png_error() and png_warning().  #defining PNG_NO_CONSOLE_IO will
  357.  * prevent these from being compiled and used. #defining PNG_NO_STDIO
  358.  * will also prevent these, plus will prevent the entire set of stdio
  359.  * macros and functions (FILE *, printf, etc.) from being compiled and used,
  360.  * unless (PNG_DEBUG > 0) has been #defined.
  361.  *
  362.  * #define PNG_NO_CONSOLE_IO
  363.  * #define PNG_NO_STDIO
  364.  */
  365.  
  366. #if defined(_WIN32_WCE)
  367. #include <windows.h>
  368. /* Console I/O functions are not supported on WindowsCE */
  369. #define PNG_NO_CONSOLE_IO
  370. #ifdef PNG_DEBUG
  371. #  undef PNG_DEBUG
  372. #endif
  373. #endif
  374.  
  375. #ifdef PNG_BUILD_DLL
  376. #  ifndef PNG_CONSOLE_IO_SUPPORTED
  377. #    ifndef PNG_NO_CONSOLE_IO
  378. #      define PNG_NO_CONSOLE_IO
  379. #    endif
  380. #  endif
  381. #endif
  382.  
  383. #  ifdef PNG_NO_STDIO
  384. #    ifndef PNG_NO_CONSOLE_IO
  385. #      define PNG_NO_CONSOLE_IO
  386. #    endif
  387. #    ifdef PNG_DEBUG
  388. #      if (PNG_DEBUG > 0)
  389. #        include <stdio.h>
  390. #      endif
  391. #    endif
  392. #  else
  393. #    if !defined(_WIN32_WCE)
  394. /* "stdio.h" functions are not supported on WindowsCE */
  395. #      include <stdio.h>
  396. #    endif
  397. #  endif
  398.  
  399. /* This macro protects us against machines that don't have function
  400.  * prototypes (ie K&R style headers).  If your compiler does not handle
  401.  * function prototypes, define this macro and use the included ansi2knr.
  402.  * I've always been able to use _NO_PROTO as the indicator, but you may
  403.  * need to drag the empty declaration out in front of here, or change the
  404.  * ifdef to suit your own needs.
  405.  */
  406. #ifndef PNGARG
  407.  
  408. #ifdef OF /* zlib prototype munger */
  409. #define PNGARG(arglist) OF(arglist)
  410. #else
  411.  
  412. #ifdef _NO_PROTO
  413. #define PNGARG(arglist) ()
  414. #else
  415. #define PNGARG(arglist) arglist
  416. #endif /* _NO_PROTO */
  417.  
  418. #endif /* OF */
  419.  
  420. #endif /* PNGARG */
  421.  
  422. /* Try to determine if we are compiling on a Mac.  Note that testing for
  423.  * just __MWERKS__ is not good enough, because the Codewarrior is now used
  424.  * on non-Mac platforms.
  425.  */
  426. #ifndef MACOS
  427. #if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
  428.     defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
  429. #define MACOS
  430. #endif
  431. #endif
  432.  
  433. /* enough people need this for various reasons to include it here */
  434. #if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
  435. /*#include <sys/types.h>*/    /* PDFlib GmbH */
  436. #endif
  437.  
  438. #ifndef PNG_SETJMP_NOT_SUPPORTED
  439. #  define PNG_SETJMP_SUPPORTED
  440. #endif
  441.  
  442. #ifdef PNG_SETJMP_SUPPORTED
  443. /* This is an attempt to force a single setjmp behaviour on Linux.  If
  444.  * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
  445.  */
  446.  
  447. #  ifdef __linux__
  448. #    ifdef _BSD_SOURCE
  449. #      define PNG_SAVE_BSD_SOURCE
  450. #      undef _BSD_SOURCE
  451. #    endif
  452. #    ifdef _SETJMP_H
  453.       __png.h__ already includes setjmp.h;
  454.       __dont__ include it again.;
  455. #    endif
  456. #endif /* __linux__ */
  457.  
  458. /* include setjmp.h for error handling */
  459. #include <setjmp.h>
  460.  
  461. #  ifdef __linux__
  462. #    ifdef PNG_SAVE_BSD_SOURCE
  463. #      define _BSD_SOURCE
  464. #      undef PNG_SAVE_BSD_SOURCE
  465. #    endif
  466. #  endif /* __linux__ */
  467. #endif /* PNG_SETJMP_SUPPORTED */
  468.  
  469. #if defined(_AIX) && defined(__xlC__)
  470. /* This prevents "AIX/xlC" from generating an "index(s,c)" macro in strings.h
  471.  * that conflicts with libpng's png_color_16.index */
  472. #undef __STR__
  473. #endif
  474.  
  475. #ifdef BSD
  476. #include <strings.h>
  477. #else
  478. #include <string.h>
  479. #endif
  480.  
  481. /* Other defines for things like memory and the like can go here.  */
  482. #ifdef PNG_INTERNAL
  483. #include <stdlib.h>
  484.  
  485. /* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
  486.  * aren't usually used outside the library (as far as I know), so it is
  487.  * debatable if they should be exported at all.  In the future, when it is
  488.  * possible to have run-time registry of chunk-handling functions, some of
  489.  * these will be made available again.
  490. #define PNG_EXTERN extern
  491.  */
  492. #define PNG_EXTERN
  493.  
  494. /* Other defines specific to compilers can go here.  Try to keep
  495.  * them inside an appropriate ifdef/endif pair for portability.
  496.  */
  497.  
  498. #if defined(PNG_FLOATING_POINT_SUPPORTED)
  499. #if defined(MACOS)
  500. /* We need to check that <math.h> hasn't already been included earlier
  501.  * as it seems it doesn't agree with <fp.h>, yet we should really use
  502.  * <fp.h> if possible.
  503.  */
  504. #if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
  505. #include <fp.h>
  506. #endif
  507. #else
  508. #include <math.h>
  509. #endif
  510. #if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
  511. /* Amiga SAS/C: We must include builtin FPU functions when compiling using
  512.  * MATH=68881
  513.  */
  514. #include <m68881.h>
  515. #endif
  516. #endif
  517.  
  518. /* Codewarrior on NT has linking problems without this. */
  519. #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
  520. #define PNG_ALWAYS_EXTERN
  521. #endif
  522.  
  523. /* For some reason, Borland C++ defines memcmp, etc. in mem.h, not
  524.  * stdlib.h like it should (I think).  Or perhaps this is a C++
  525.  * "feature"?
  526.  */
  527. #ifdef __TURBOC__
  528. #include <mem.h>
  529. #include "alloc.h"
  530. #endif
  531.  
  532. #ifdef _MSC_VER
  533. #include <malloc.h>
  534. #endif
  535.  
  536. /* This controls how fine the dithering gets.  As this allocates
  537.  * a largish chunk of memory (32K), those who are not as concerned
  538.  * with dithering quality can decrease some or all of these.
  539.  */
  540. #ifndef PNG_DITHER_RED_BITS
  541. #define PNG_DITHER_RED_BITS 5
  542. #endif
  543. #ifndef PNG_DITHER_GREEN_BITS
  544. #define PNG_DITHER_GREEN_BITS 5
  545. #endif
  546. #ifndef PNG_DITHER_BLUE_BITS
  547. #define PNG_DITHER_BLUE_BITS 5
  548. #endif
  549.  
  550. /* This controls how fine the gamma correction becomes when you
  551.  * are only interested in 8 bits anyway.  Increasing this value
  552.  * results in more memory being used, and more pow() functions
  553.  * being called to fill in the gamma tables.  Don't set this value
  554.  * less then 8, and even that may not work (I haven't tested it).
  555.  */
  556.  
  557. #ifndef PNG_MAX_GAMMA_8
  558. #define PNG_MAX_GAMMA_8 11
  559. #endif
  560.  
  561. /* This controls how much a difference in gamma we can tolerate before
  562.  * we actually start doing gamma conversion.
  563.  */
  564. #ifndef PNG_GAMMA_THRESHOLD
  565. #define PNG_GAMMA_THRESHOLD 0.05
  566. #endif
  567.  
  568. #endif /* PNG_INTERNAL */
  569.  
  570. /* The following uses const char * instead of char * for error
  571.  * and warning message functions, so some compilers won't complain.
  572.  * If you do not want to use const, define PNG_NO_CONST here.
  573.  */
  574.  
  575. #ifndef PNG_NO_CONST
  576. #  define PNG_CONST const
  577. #else
  578. #  define PNG_CONST
  579. #endif
  580.  
  581. /* The following defines give you the ability to remove code from the
  582.  * library that you will not be using.  I wish I could figure out how to
  583.  * automate this, but I can't do that without making it seriously hard
  584.  * on the users.  So if you are not using an ability, change the #define
  585.  * to and #undef, and that part of the library will not be compiled.  If
  586.  * your linker can't find a function, you may want to make sure the
  587.  * ability is defined here.  Some of these depend upon some others being
  588.  * defined.  I haven't figured out all the interactions here, so you may
  589.  * have to experiment awhile to get everything to compile.  If you are
  590.  * creating or using a shared library, you probably shouldn't touch this,
  591.  * as it will affect the size of the structures, and this will cause bad
  592.  * things to happen if the library and/or application ever change.
  593.  */
  594.  
  595. /* Any features you will not be using can be undef'ed here */
  596.  
  597. /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
  598.  * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
  599.  * on the compile line, then pick and choose which ones to define without
  600.  * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
  601.  * if you only want to have a png-compliant reader/writer but don't need
  602.  * any of the extra transformations.  This saves about 80 kbytes in a
  603.  * typical installation of the library. (PNG_NO_* form added in version
  604.  * 1.0.1c, for consistency)
  605.  */
  606.  
  607. /* The size of the png_text structure changed in libpng-1.0.6 when
  608.  * iTXt is supported.  It is turned off by default, to support old apps
  609.  * that malloc the png_text structure instead of calling png_set_text()
  610.  * and letting libpng malloc it.  It will be turned on by default in
  611.  * libpng-2.0.0.
  612.  */
  613.  
  614. #ifndef PNG_iTXt_SUPPORTED
  615. #  ifndef PNG_READ_iTXt_SUPPORTED
  616. #    define PNG_NO_READ_iTXt
  617. #  endif
  618. #  ifndef PNG_WRITE_iTXt_SUPPORTED
  619. #    define PNG_NO_WRITE_iTXt
  620. #  endif
  621. #endif
  622.  
  623. /* The following support, added after version 1.0.0, can be turned off here en
  624.  * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
  625.  * with old applications that require the length of png_struct and png_info
  626.  * to remain unchanged.
  627.  */
  628.  
  629. #ifdef PNG_LEGACY_SUPPORTED
  630. #define PNG_NO_FREE_ME
  631. #define PNG_NO_READ_UNKNOWN_CHUNKS
  632. #define PNG_NO_WRITE_UNKNOWN_CHUNKS
  633. #define PNG_NO_READ_USER_CHUNKS
  634. #define PNG_NO_READ_iCCP
  635. #define PNG_NO_WRITE_iCCP
  636. #define PNG_NO_READ_iTXt
  637. #define PNG_NO_WRITE_iTXt
  638. #define PNG_NO_READ_sCAL
  639. #define PNG_NO_WRITE_sCAL
  640. #define PNG_NO_READ_sPLT
  641. #define PNG_NO_WRITE_sPLT
  642. #define PNG_NO_INFO_IMAGE
  643. #define PNG_NO_READ_RGB_TO_GRAY
  644. #define PNG_NO_READ_USER_TRANSFORM
  645. #define PNG_NO_WRITE_USER_TRANSFORM
  646. #define PNG_NO_USER_MEM
  647. #define PNG_NO_READ_EMPTY_PLTE
  648. #define PNG_NO_FIXED_POINT_SUPPORTED
  649. #endif
  650.  
  651. /* Ignore attempt to turn off both floating and fixed point support */
  652. #if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
  653.  !defined(PNG_NO_FIXED_POINT_SUPPORTED)
  654. #define PNG_FIXED_POINT_SUPPORTED
  655. #endif
  656.  
  657. #ifndef PNG_NO_FREE_ME
  658. #define PNG_FREE_ME_SUPPORTED
  659. #endif
  660.  
  661. #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
  662.     !defined(PNG_NO_READ_TRANSFORMS)
  663. #define PNG_READ_TRANSFORMS_SUPPORTED
  664. #endif
  665. #if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
  666.     !defined(PNG_NO_WRITE_TRANSFORMS)
  667. #define PNG_WRITE_TRANSFORMS_SUPPORTED
  668. #endif
  669.  
  670. #ifdef PNG_READ_TRANSFORMS_SUPPORTED
  671. #ifndef PNG_NO_READ_EXPAND
  672. #define PNG_READ_EXPAND_SUPPORTED
  673. #endif
  674. #ifndef PNG_NO_READ_SHIFT
  675. #define PNG_READ_SHIFT_SUPPORTED
  676. #endif
  677. #ifndef PNG_NO_READ_PACK
  678. #define PNG_READ_PACK_SUPPORTED
  679. #endif
  680. #ifndef PNG_NO_READ_BGR
  681. #define PNG_READ_BGR_SUPPORTED
  682. #endif
  683. #ifndef PNG_NO_READ_SWAP
  684. #define PNG_READ_SWAP_SUPPORTED
  685. #endif
  686. #ifndef PNG_NO_READ_PACKSWAP
  687. #define PNG_READ_PACKSWAP_SUPPORTED
  688. #endif
  689. #ifndef PNG_NO_READ_INVERT
  690. #define PNG_READ_INVERT_SUPPORTED
  691. #endif
  692. #ifndef PNG_NO_READ_DITHER
  693. #define PNG_READ_DITHER_SUPPORTED
  694. #endif
  695. #ifndef PNG_NO_READ_BACKGROUND
  696. #define PNG_READ_BACKGROUND_SUPPORTED
  697. #endif
  698. #ifndef PNG_NO_READ_16_TO_8
  699. #define PNG_READ_16_TO_8_SUPPORTED
  700. #endif
  701. #ifndef PNG_NO_READ_FILLER
  702. #define PNG_READ_FILLER_SUPPORTED
  703. #endif
  704. #ifndef PNG_NO_READ_GAMMA
  705. #define PNG_READ_GAMMA_SUPPORTED
  706. #endif
  707. #ifndef PNG_NO_READ_GRAY_TO_RGB
  708. #define PNG_READ_GRAY_TO_RGB_SUPPORTED
  709. #endif
  710. #ifndef PNG_NO_READ_SWAP_ALPHA
  711. #define PNG_READ_SWAP_ALPHA_SUPPORTED
  712. #endif
  713. #ifndef PNG_NO_READ_INVERT_ALPHA
  714. #define PNG_READ_INVERT_ALPHA_SUPPORTED
  715. #endif
  716. #ifndef PNG_NO_READ_STRIP_ALPHA
  717. #define PNG_READ_STRIP_ALPHA_SUPPORTED
  718. #endif
  719. #ifndef PNG_NO_READ_USER_TRANSFORM
  720. #define PNG_READ_USER_TRANSFORM_SUPPORTED
  721. #endif
  722. #ifndef PNG_NO_READ_RGB_TO_GRAY
  723. #define PNG_READ_RGB_TO_GRAY_SUPPORTED
  724. #endif
  725. #endif /* PNG_READ_TRANSFORMS_SUPPORTED */
  726.  
  727. #if !defined(PNG_NO_PROGRESSIVE_READ) && \
  728.  !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive  */
  729. #define PNG_PROGRESSIVE_READ_SUPPORTED       /* reading.  This is not talking */
  730. #endif                               /* about interlacing capability!  You'll */
  731.               /* still have interlacing unless you change the following line: */
  732. #define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
  733.  
  734. #ifndef PNG_NO_READ_COMPOSITE_NODIV
  735. #ifndef PNG_NO_READ_COMPOSITED_NODIV  /* libpng-1.0.x misspelling */
  736. #define PNG_READ_COMPOSITE_NODIV_SUPPORTED    /* well tested on Intel and SGI */
  737. #endif
  738. #endif
  739.  
  740. #ifndef PNG_NO_READ_EMPTY_PLTE
  741. #define PNG_READ_EMPTY_PLTE_SUPPORTED  /* useful for MNG applications */
  742. #endif
  743.  
  744. #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
  745. #ifndef PNG_NO_WRITE_SHIFT
  746. #define PNG_WRITE_SHIFT_SUPPORTED
  747. #endif
  748. #ifndef PNG_NO_WRITE_PACK
  749. #define PNG_WRITE_PACK_SUPPORTED
  750. #endif
  751. #ifndef PNG_NO_WRITE_BGR
  752. #define PNG_WRITE_BGR_SUPPORTED
  753. #endif
  754. #ifndef PNG_NO_WRITE_SWAP
  755. #define PNG_WRITE_SWAP_SUPPORTED
  756. #endif
  757. #ifndef PNG_NO_WRITE_PACKSWAP
  758. #define PNG_WRITE_PACKSWAP_SUPPORTED
  759. #endif
  760. #ifndef PNG_NO_WRITE_INVERT
  761. #define PNG_WRITE_INVERT_SUPPORTED
  762. #endif
  763. #ifndef PNG_NO_WRITE_FILLER
  764. #define PNG_WRITE_FILLER_SUPPORTED  /* This is the same as WRITE_STRIP_ALPHA */
  765. #endif
  766. #ifndef PNG_NO_WRITE_SWAP_ALPHA
  767. #define PNG_WRITE_SWAP_ALPHA_SUPPORTED
  768. #endif
  769. #ifndef PNG_NO_WRITE_INVERT_ALPHA
  770. #define PNG_WRITE_INVERT_ALPHA_SUPPORTED
  771. #endif
  772. #ifndef PNG_NO_WRITE_USER_TRANSFORM
  773. #define PNG_WRITE_USER_TRANSFORM_SUPPORTED
  774. #endif
  775. #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
  776.  
  777. #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
  778. defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
  779. #ifndef PNG_NO_USER_TRANSFORM_PTR
  780. #define PNG_USER_TRANSFORM_PTR_SUPPORTED
  781. #endif
  782. #endif
  783.  
  784. #define PNG_WRITE_INTERLACING_SUPPORTED  /* not required for PNG-compliant
  785.                                             encoders, but can cause trouble
  786.                                             if left undefined */
  787.  
  788. #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
  789.      defined(PNG_FLOATING_POINT_SUPPORTED)
  790. #define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
  791. #endif
  792.  
  793. #ifndef PNG_NO_WRITE_FLUSH
  794. #define PNG_WRITE_FLUSH_SUPPORTED
  795. #endif
  796.  
  797. #ifndef PNG_NO_WRITE_EMPTY_PLTE
  798. #define PNG_WRITE_EMPTY_PLTE_SUPPORTED  /* useful for MNG applications */
  799. #endif
  800.  
  801. #ifndef PNG_NO_STDIO
  802. #define PNG_TIME_RFC1123_SUPPORTED
  803. #endif
  804.  
  805. /* This adds extra functions in pngget.c for accessing data from the
  806.  * info pointer (added in version 0.99)
  807.  * png_get_image_width()
  808.  * png_get_image_height()
  809.  * png_get_bit_depth()
  810.  * png_get_color_type()
  811.  * png_get_compression_type()
  812.  * png_get_filter_type()
  813.  * png_get_interlace_type()
  814.  * png_get_pixel_aspect_ratio()
  815.  * png_get_pixels_per_meter()
  816.  * png_get_x_offset_pixels()
  817.  * png_get_y_offset_pixels()
  818.  * png_get_x_offset_microns()
  819.  * png_get_y_offset_microns()
  820.  */
  821. #ifndef PNG_NO_EASY_ACCESS
  822. #define PNG_EASY_ACCESS_SUPPORTED
  823. #endif
  824.  
  825. #if defined(PNG_USE_PNGVCRD) || defined(PNG_USE_PNGGCCRD) && \
  826.   !defined(PNG_NO_ASSEMBLER_CODE)
  827. #define PNG_ASSEMBLER_CODE_SUPPORTED
  828. #endif
  829.  
  830. /* These are currently experimental features, define them if you want */
  831.  
  832. /* very little testing */
  833. /*
  834. #define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
  835. #ifndef PNG_NO_USER_MEM
  836. #define PNG_USER_MEM_SUPPORTED
  837. #endif
  838. #ifndef PNG_NO_ZALLOC_ZERO
  839. #define PNG_ZALLOC_ZERO
  840. #endif
  841. */
  842.  
  843. /* This is only for PowerPC big-endian and 680x0 systems */
  844. /* some testing */
  845. /*
  846. #define PNG_READ_BIG_ENDIAN_SUPPORTED
  847. */
  848.  
  849. /* Buggy compilers (e.g., gcc 2.7.2.2) need this */
  850. /*
  851. #define PNG_NO_POINTER_INDEXING
  852. */
  853.  
  854. /* These functions are turned off by default, as they will be phased out. */
  855. /*
  856. #define  PNG_USELESS_TESTS_SUPPORTED
  857. #define  PNG_CORRECT_PALETTE_SUPPORTED
  858. */
  859.  
  860. /* Any chunks you are not interested in, you can undef here.  The
  861.  * ones that allocate memory may be expecially important (hIST,
  862.  * tEXt, zTXt, tRNS, pCAL).  Others will just save time and make png_info
  863.  * a bit smaller.
  864.  */
  865.  
  866. #if !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
  867.     !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
  868. #define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
  869. #endif
  870. #if !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
  871.     !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
  872. #define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
  873. #endif
  874.  
  875. #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
  876.  
  877. #ifdef PNG_NO_READ_TEXT
  878. #  define PNG_NO_READ_iTXt
  879. #  define PNG_NO_READ_tEXt
  880. #  define PNG_NO_READ_zTXt
  881. #endif
  882. #ifndef PNG_NO_READ_bKGD
  883. #  define PNG_READ_bKGD_SUPPORTED
  884. #  define PNG_bKGD_SUPPORTED
  885. #endif
  886. #ifndef PNG_NO_READ_cHRM
  887. #  define PNG_READ_cHRM_SUPPORTED
  888. #  define PNG_cHRM_SUPPORTED
  889. #endif
  890. #ifndef PNG_NO_READ_gAMA
  891. #  define PNG_READ_gAMA_SUPPORTED
  892. #  define PNG_gAMA_SUPPORTED
  893. #endif
  894. #ifndef PNG_NO_READ_hIST
  895. #  define PNG_READ_hIST_SUPPORTED
  896. #  define PNG_hIST_SUPPORTED
  897. #endif
  898. #ifndef PNG_NO_READ_iCCP
  899. #  define PNG_READ_iCCP_SUPPORTED
  900. #  define PNG_iCCP_SUPPORTED
  901. #endif
  902. #ifndef PNG_NO_READ_iTXt
  903. #  define PNG_READ_iTXt_SUPPORTED
  904. #  define PNG_iTXt_SUPPORTED
  905. #endif
  906. #ifndef PNG_NO_READ_oFFs
  907. #  define PNG_READ_oFFs_SUPPORTED
  908. #  define PNG_oFFs_SUPPORTED
  909. #endif
  910. #ifndef PNG_NO_READ_pCAL
  911. #  define PNG_READ_pCAL_SUPPORTED
  912. #  define PNG_pCAL_SUPPORTED
  913. #endif
  914. #ifndef PNG_NO_READ_sCAL
  915. #  define PNG_READ_sCAL_SUPPORTED
  916. #  define PNG_sCAL_SUPPORTED
  917. #endif
  918. #ifndef PNG_NO_READ_pHYs
  919. #  define PNG_READ_pHYs_SUPPORTED
  920. #  define PNG_pHYs_SUPPORTED
  921. #endif
  922. #ifndef PNG_NO_READ_sBIT
  923. #  define PNG_READ_sBIT_SUPPORTED
  924. #  define PNG_sBIT_SUPPORTED
  925. #endif
  926. #ifndef PNG_NO_READ_sPLT
  927. #  define PNG_READ_sPLT_SUPPORTED
  928. #  define PNG_sPLT_SUPPORTED
  929. #endif
  930. #ifndef PNG_NO_READ_sRGB
  931. #  define PNG_READ_sRGB_SUPPORTED
  932. #  define PNG_sRGB_SUPPORTED
  933. #endif
  934. #ifndef PNG_NO_READ_tEXt
  935. #  define PNG_READ_tEXt_SUPPORTED
  936. #  define PNG_tEXt_SUPPORTED
  937. #endif
  938. #ifndef PNG_NO_READ_tIME
  939. #  define PNG_READ_tIME_SUPPORTED
  940. #  define PNG_tIME_SUPPORTED
  941. #endif
  942. #ifndef PNG_NO_READ_tRNS
  943. #  define PNG_READ_tRNS_SUPPORTED
  944. #  define PNG_tRNS_SUPPORTED
  945. #endif
  946. #ifndef PNG_NO_READ_zTXt
  947. #  define PNG_READ_zTXt_SUPPORTED
  948. #  define PNG_zTXt_SUPPORTED
  949. #endif
  950. #ifndef PNG_NO_READ_UNKNOWN_CHUNKS
  951. #  define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
  952. #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
  953. #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
  954. #  endif
  955. #  ifndef PNG_NO_HANDLE_AS_UNKNOWN
  956. #    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  957. #  endif
  958. #endif
  959. #if !defined(PNG_NO_READ_USER_CHUNKS) && \
  960.      defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
  961. #  define PNG_READ_USER_CHUNKS_SUPPORTED
  962. #  define PNG_USER_CHUNKS_SUPPORTED
  963. #  ifdef PNG_NO_READ_UNKNOWN_CHUNKS
  964. #    undef PNG_NO_READ_UNKNOWN_CHUNKS
  965. #  endif
  966. #  ifdef PNG_NO_HANDLE_AS_UNKNOWN
  967. #    undef PNG_NO_HANDLE_AS_UNKNOWN
  968. #  endif
  969. #endif
  970. #ifndef PNG_NO_READ_OPT_PLTE
  971. #  define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
  972. #endif                      /* optional PLTE chunk in RGB and RGBA images */
  973. #if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
  974.   defined(PNG_READ_zTXt_SUPPORTED)
  975. #  define PNG_READ_TEXT_SUPPORTED
  976. #  define PNG_TEXT_SUPPORTED
  977. #endif
  978. #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
  979.  
  980. #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
  981. #ifdef PNG_NO_WRITE_TEXT
  982. #  define PNG_NO_WRITE_iTXt
  983. #  define PNG_NO_WRITE_tEXt
  984. #  define PNG_NO_WRITE_zTXt
  985. #endif
  986. #ifndef PNG_NO_WRITE_bKGD
  987. #  define PNG_WRITE_bKGD_SUPPORTED
  988. #  ifndef PNG_bKGD_SUPPORTED
  989. #    define PNG_bKGD_SUPPORTED
  990. #  endif
  991. #endif
  992. #ifndef PNG_NO_WRITE_cHRM
  993. #  define PNG_WRITE_cHRM_SUPPORTED
  994. #  ifndef PNG_cHRM_SUPPORTED
  995. #    define PNG_cHRM_SUPPORTED
  996. #  endif
  997. #endif
  998. #ifndef PNG_NO_WRITE_gAMA
  999. #  define PNG_WRITE_gAMA_SUPPORTED
  1000. #  ifndef PNG_gAMA_SUPPORTED
  1001. #    define PNG_gAMA_SUPPORTED
  1002. #  endif
  1003. #endif
  1004. #ifndef PNG_NO_WRITE_hIST
  1005. #  define PNG_WRITE_hIST_SUPPORTED
  1006. #  ifndef PNG_hIST_SUPPORTED
  1007. #    define PNG_hIST_SUPPORTED
  1008. #  endif
  1009. #endif
  1010. #ifndef PNG_NO_WRITE_iCCP
  1011. #  define PNG_WRITE_iCCP_SUPPORTED
  1012. #  ifndef PNG_iCCP_SUPPORTED
  1013. #    define PNG_iCCP_SUPPORTED
  1014. #  endif
  1015. #endif
  1016. #ifndef PNG_NO_WRITE_iTXt
  1017. #  define PNG_WRITE_iTXt_SUPPORTED
  1018. #  ifndef PNG_iTXt_SUPPORTED
  1019. #    define PNG_iTXt_SUPPORTED
  1020. #  endif
  1021. #endif
  1022. #ifndef PNG_NO_WRITE_oFFs
  1023. #  define PNG_WRITE_oFFs_SUPPORTED
  1024. #  ifndef PNG_oFFs_SUPPORTED
  1025. #    define PNG_oFFs_SUPPORTED
  1026. #  endif
  1027. #endif
  1028. #ifndef PNG_NO_WRITE_pCAL
  1029. #  define PNG_WRITE_pCAL_SUPPORTED
  1030. #  ifndef PNG_pCAL_SUPPORTED
  1031. #    define PNG_pCAL_SUPPORTED
  1032. #  endif
  1033. #endif
  1034. #ifndef PNG_NO_WRITE_sCAL
  1035. #  define PNG_WRITE_sCAL_SUPPORTED
  1036. #  ifndef PNG_sCAL_SUPPORTED
  1037. #    define PNG_sCAL_SUPPORTED
  1038. #  endif
  1039. #endif
  1040. #ifndef PNG_NO_WRITE_pHYs
  1041. #  define PNG_WRITE_pHYs_SUPPORTED
  1042. #  ifndef PNG_pHYs_SUPPORTED
  1043. #    define PNG_pHYs_SUPPORTED
  1044. #  endif
  1045. #endif
  1046. #ifndef PNG_NO_WRITE_sBIT
  1047. #  define PNG_WRITE_sBIT_SUPPORTED
  1048. #  ifndef PNG_sBIT_SUPPORTED
  1049. #    define PNG_sBIT_SUPPORTED
  1050. #  endif
  1051. #endif
  1052. #ifndef PNG_NO_WRITE_sPLT
  1053. #  define PNG_WRITE_sPLT_SUPPORTED
  1054. #  ifndef PNG_sPLT_SUPPORTED
  1055. #    define PNG_sPLT_SUPPORTED
  1056. #  endif
  1057. #endif
  1058. #ifndef PNG_NO_WRITE_sRGB
  1059. #  define PNG_WRITE_sRGB_SUPPORTED
  1060. #  ifndef PNG_sRGB_SUPPORTED
  1061. #    define PNG_sRGB_SUPPORTED
  1062. #  endif
  1063. #endif
  1064. #ifndef PNG_NO_WRITE_tEXt
  1065. #  define PNG_WRITE_tEXt_SUPPORTED
  1066. #  ifndef PNG_tEXt_SUPPORTED
  1067. #    define PNG_tEXt_SUPPORTED
  1068. #  endif
  1069. #endif
  1070. #ifndef PNG_NO_WRITE_tIME
  1071. #  define PNG_WRITE_tIME_SUPPORTED
  1072. #  ifndef PNG_tIME_SUPPORTED
  1073. #    define PNG_tIME_SUPPORTED
  1074. #  endif
  1075. #endif
  1076. #ifndef PNG_NO_WRITE_tRNS
  1077. #  define PNG_WRITE_tRNS_SUPPORTED
  1078. #  ifndef PNG_tRNS_SUPPORTED
  1079. #    define PNG_tRNS_SUPPORTED
  1080. #  endif
  1081. #endif
  1082. #ifndef PNG_NO_WRITE_zTXt
  1083. #  define PNG_WRITE_zTXt_SUPPORTED
  1084. #  ifndef PNG_zTXt_SUPPORTED
  1085. #    define PNG_zTXt_SUPPORTED
  1086. #  endif
  1087. #endif
  1088. #ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
  1089. #  define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
  1090. #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
  1091. #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
  1092. #  endif
  1093. #  ifndef PNG_NO_HANDLE_AS_UNKNOWN
  1094. #     ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  1095. #       define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  1096. #     endif
  1097. #  endif
  1098. #endif
  1099. #if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
  1100.   defined(PNG_WRITE_zTXt_SUPPORTED)
  1101. #  define PNG_WRITE_TEXT_SUPPORTED
  1102. #  ifndef PNG_TEXT_SUPPORTED
  1103. #    define PNG_TEXT_SUPPORTED
  1104. #  endif
  1105. #endif
  1106. #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
  1107.  
  1108. /* Turn this off to disable png_read_png() and
  1109.  * png_write_png() and leave the row_pointers member
  1110.  * out of the info structure.
  1111.  */
  1112. #ifndef PNG_NO_INFO_IMAGE
  1113. #  define PNG_INFO_IMAGE_SUPPORTED
  1114. #endif
  1115.  
  1116. /* need the time information for reading tIME chunks */
  1117. #if defined(PNG_tIME_SUPPORTED)
  1118. #  if !defined(_WIN32_WCE)
  1119.      /* "time.h" functions are not supported on WindowsCE */
  1120. #    include <time.h>
  1121. #  endif
  1122. #endif
  1123.  
  1124. /* Some typedefs to get us started.  These should be safe on most of the
  1125.  * common platforms.  The typedefs should be at least as large as the
  1126.  * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
  1127.  * don't have to be exactly that size.  Some compilers dislike passing
  1128.  * unsigned shorts as function parameters, so you may be better off using
  1129.  * unsigned int for png_uint_16.  Likewise, for 64-bit systems, you may
  1130.  * want to have unsigned int for png_uint_32 instead of unsigned long.
  1131.  */
  1132.  
  1133. typedef unsigned long png_uint_32;
  1134. typedef long png_int_32;
  1135. typedef unsigned short png_uint_16;
  1136. typedef short png_int_16;
  1137. typedef unsigned char png_byte;
  1138.  
  1139. /* This is usually size_t.  It is typedef'ed just in case you need it to
  1140.    change (I'm not sure if you will or not, so I thought I'd be safe) */
  1141. typedef size_t png_size_t;
  1142.  
  1143. /* The following is needed for medium model support.  It cannot be in the
  1144.  * PNG_INTERNAL section.  Needs modification for other compilers besides
  1145.  * MSC.  Model independent support declares all arrays and pointers to be
  1146.  * large using the far keyword.  The zlib version used must also support
  1147.  * model independent data.  As of version zlib 1.0.4, the necessary changes
  1148.  * have been made in zlib.  The USE_FAR_KEYWORD define triggers other
  1149.  * changes that are needed. (Tim Wegner)
  1150.  */
  1151.  
  1152. /* Separate compiler dependencies (problem here is that zlib.h always
  1153.    defines FAR. (SJT) */
  1154. #ifdef __BORLANDC__
  1155. #if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
  1156. #define LDATA 1
  1157. #else
  1158. #define LDATA 0
  1159. #endif
  1160.  
  1161. #if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
  1162. #define PNG_MAX_MALLOC_64K
  1163. #if (LDATA != 1)
  1164. #ifndef FAR
  1165. #define FAR __far
  1166. #endif
  1167. #define USE_FAR_KEYWORD
  1168. #endif   /* LDATA != 1 */
  1169.  
  1170. /* Possibly useful for moving data out of default segment.
  1171.  * Uncomment it if you want. Could also define FARDATA as
  1172.  * const if your compiler supports it. (SJT)
  1173. #  define FARDATA FAR
  1174.  */
  1175. #endif  /* __WIN32__, __FLAT__, __CYGWIN__ */
  1176.  
  1177. #endif   /* __BORLANDC__ */
  1178.  
  1179.  
  1180. /* Suggest testing for specific compiler first before testing for
  1181.  * FAR.  The Watcom compiler defines both __MEDIUM__ and M_I86MM,
  1182.  * making reliance oncertain keywords suspect. (SJT)
  1183.  */
  1184.  
  1185. /* MSC Medium model */
  1186. #if defined(FAR)
  1187. #  if defined(M_I86MM)
  1188. #     define USE_FAR_KEYWORD
  1189. #     define FARDATA FAR
  1190. #     include <dos.h>
  1191. #  endif
  1192. #endif
  1193.  
  1194. /* SJT: default case */
  1195. #ifndef FAR
  1196. #   define FAR
  1197. #endif
  1198.  
  1199. /* At this point FAR is always defined */
  1200. #ifndef FARDATA
  1201. #define FARDATA
  1202. #endif
  1203.  
  1204. /* Typedef for floating-point numbers that are converted
  1205.    to fixed-point with a multiple of 100,000, e.g., int_gamma */
  1206. typedef png_int_32 png_fixed_point;
  1207.  
  1208. /* Add typedefs for pointers */
  1209. typedef void            FAR * png_voidp;
  1210. typedef png_byte        FAR * png_bytep;
  1211. typedef png_uint_32     FAR * png_uint_32p;
  1212. typedef png_int_32      FAR * png_int_32p;
  1213. typedef png_uint_16     FAR * png_uint_16p;
  1214. typedef png_int_16      FAR * png_int_16p;
  1215. typedef PNG_CONST char  FAR * png_const_charp;
  1216. typedef char            FAR * png_charp;
  1217. typedef png_fixed_point FAR * png_fixed_point_p;
  1218. #if defined(_WIN32_WCE)
  1219. typedef HANDLE                png_FILE_p;
  1220. #else
  1221. typedef FILE                * png_FILE_p;
  1222. #endif
  1223. #ifdef PNG_FLOATING_POINT_SUPPORTED
  1224. typedef double          FAR * png_doublep;
  1225. #endif
  1226.  
  1227. /* Pointers to pointers; i.e. arrays */
  1228. typedef png_byte        FAR * FAR * png_bytepp;
  1229. typedef png_uint_32     FAR * FAR * png_uint_32pp;
  1230. typedef png_int_32      FAR * FAR * png_int_32pp;
  1231. typedef png_uint_16     FAR * FAR * png_uint_16pp;
  1232. typedef png_int_16      FAR * FAR * png_int_16pp;
  1233. typedef PNG_CONST char  FAR * FAR * png_const_charpp;
  1234. typedef char            FAR * FAR * png_charpp;
  1235. typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
  1236. #ifdef PNG_FLOATING_POINT_SUPPORTED
  1237. typedef double          FAR * FAR * png_doublepp;
  1238. #endif
  1239.  
  1240. /* Pointers to pointers to pointers; i.e. pointer to array */
  1241. typedef char            FAR * FAR * FAR * png_charppp;
  1242.  
  1243. /* libpng typedefs for types in zlib. If zlib changes
  1244.  * or another compression library is used, then change these.
  1245.  * Eliminates need to change all the source files.
  1246.  */
  1247. typedef charf *         png_zcharp;
  1248. typedef charf * FAR *   png_zcharpp;
  1249. typedef z_stream FAR *  png_zstreamp;
  1250.  
  1251. /*
  1252.  * Define PNG_BUILD_DLL if the module being built is a Windows
  1253.  * LIBPNG DLL.
  1254.  *
  1255.  * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
  1256.  * It is equivalent to Microsoft predefined macro _DLL which is
  1257.  * automatically defined when you compile using the share
  1258.  * version of the CRT (C Run-Time library)
  1259.  * 
  1260.  * The cygwin mods make this behavior a little different: 
  1261.  * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
  1262.  * Define PNG_STATIC if you are building a static library for use with cygwin,
  1263.  *   -or- if you are building an application that you want to link to the 
  1264.  *   static library.
  1265.  * PNG_USE_DLL is defined by default (no user action needed) unless one of
  1266.  *   the other flags is defined.
  1267.  */
  1268.  
  1269. #if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
  1270. #  define PNG_DLL
  1271. #endif
  1272. /* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
  1273.  * When building a static lib, default to no GLOBAL ARRAYS, but allow
  1274.  * command-line override
  1275.  */
  1276. #if defined(__CYGWIN__)
  1277. #  if !defined(PNG_STATIC)
  1278. #    if defined(PNG_USE_GLOBAL_ARRAYS)
  1279. #      undef PNG_USE_GLOBAL_ARRAYS
  1280. #    endif
  1281. #    if !defined(PNG_USE_LOCAL_ARRAYS)
  1282. #      define PNG_USE_LOCAL_ARRAYS
  1283. #    endif
  1284. #  else
  1285. #    if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
  1286. #      if defined(PNG_USE_GLOBAL_ARRAYS)
  1287. #        undef PNG_USE_GLOBAL_ARRAYS
  1288. #      endif
  1289. #    endif
  1290. #  endif
  1291. #  if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
  1292. #    define PNG_USE_LOCAL_ARRAYS
  1293. #  endif
  1294. #endif
  1295.     
  1296. /* Do not use global arrays (helps with building DLL's)
  1297.  * They are no longer used in libpng itself, since version 1.0.5c,
  1298.  * but might be required for some pre-1.0.5c applications.
  1299.  */
  1300. #if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
  1301. #  if defined(PNG_NO_GLOBAL_ARRAYS) || (defined(__GNUC__) && defined(PNG_DLL))
  1302. #    define PNG_USE_LOCAL_ARRAYS
  1303. #  else
  1304. #    define PNG_USE_GLOBAL_ARRAYS
  1305. #  endif
  1306. #endif
  1307.  
  1308. #ifndef PNGAPI
  1309.  
  1310.  
  1311. #if defined(__MINGW32__) || defined(__CYGWIN__) && !defined(PNG_MODULEDEF)
  1312. #  ifndef PNG_NO_MODULEDEF
  1313. #    define PNG_NO_MODULEDEF
  1314. #  endif
  1315. #endif 
  1316.  
  1317. #if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
  1318. #  define PNG_IMPEXP
  1319. #endif
  1320.  
  1321. #if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
  1322.     (( defined(_Windows) || defined(_WINDOWS) || \
  1323.        defined(WIN32) || defined(_WIN32) || defined(__WIN32__) \
  1324.       ) && !defined(__CYGWIN__))
  1325.  
  1326. #  ifdef __GNUC__
  1327. #    define PNGAPI __cdecl
  1328. #  else
  1329. #if !defined(OS390)
  1330. #    define PNGAPI __cdecl
  1331. #else
  1332. #    define PNGAPI /* */
  1333. #endif
  1334. #  endif
  1335.  
  1336. #  if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
  1337.        0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
  1338. #     define PNG_IMPEXP
  1339. #  endif
  1340.  
  1341. #  if !defined(PNG_IMPEXP)
  1342.  
  1343. #     define PNG_EXPORT_TYPE1(type,symbol)  PNG_IMPEXP type PNGAPI symbol
  1344. #     define PNG_EXPORT_TYPE2(type,symbol)  type PNG_IMPEXP PNGAPI symbol
  1345.  
  1346.       /* Borland/Microsoft */
  1347. #     if defined(_MSC_VER) || defined(__BORLANDC__)
  1348. #        if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
  1349. #           define PNG_EXPORT PNG_EXPORT_TYPE1
  1350. #        else
  1351. #           define PNG_EXPORT PNG_EXPORT_TYPE2
  1352. #           if defined(PNG_BUILD_DLL)
  1353. #              define PNG_IMPEXP __export
  1354. #           else
  1355. #              define PNG_IMPEXP /*__import*/ /* doesn't exist AFAIK in
  1356.                                                  VC++*/
  1357. #           endif                             /* Exists in Borland C++ for
  1358.                                                  C++ classes (== huge) */
  1359. #        endif
  1360. #     endif
  1361.  
  1362. #     if !defined(PNG_IMPEXP)
  1363. #        if defined(PNG_BUILD_DLL)
  1364. #           define PNG_IMPEXP __declspec(dllexport)
  1365. #        else
  1366. #           define PNG_IMPEXP __declspec(dllimport)
  1367. #        endif
  1368. #     endif
  1369. #  endif  /* PNG_IMPEXP */
  1370. #else /* !(DLL || non-cygwin WINDOWS) */
  1371. #  if defined(__CYGWIN__) && !defined(PNG_DLL)
  1372. #    if !defined(PNG_IMPEXP)
  1373. #      define PNG_IMPEXP
  1374. #    endif
  1375. #    define PNGAPI __cdecl
  1376. #  else
  1377. #    if 0 /* ... other platforms, with other meanings */
  1378. #    else
  1379. #       define PNGAPI
  1380. #       define PNG_IMPEXP
  1381. #    endif
  1382. #  endif
  1383. #endif
  1384. #endif
  1385.  
  1386. #ifndef PNG_EXPORT
  1387. #  define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
  1388. #endif
  1389.  
  1390. #ifdef PNG_USE_GLOBAL_ARRAYS
  1391. #ifndef PNG_EXPORT_VAR
  1392. #  define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
  1393. #endif
  1394. #endif
  1395.  
  1396. /* User may want to use these so they are not in PNG_INTERNAL. Any library
  1397.  * functions that are passed far data must be model independent.
  1398.  */
  1399.  
  1400. #ifndef PNG_ABORT
  1401. #   define PNG_ABORT() abort()
  1402. #endif
  1403.  
  1404. #ifdef PNG_SETJMP_SUPPORTED
  1405. #   define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
  1406. #else
  1407. #   define png_jmpbuf(png_ptr) \
  1408.     (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
  1409. #endif
  1410.  
  1411. #if defined(USE_FAR_KEYWORD)  /* memory model independent fns */
  1412. /* use this to make far-to-near assignments */
  1413. #   define CHECK   1
  1414. #   define NOCHECK 0
  1415. #   define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
  1416. #   define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
  1417. #   define png_strcpy _fstrcpy
  1418. #   define png_strlen _fstrlen
  1419. #   define png_memcmp _fmemcmp      /* SJT: added */
  1420. #   define png_memcpy _fmemcpy
  1421. #   define png_memset _fmemset
  1422. #else /* use the usual functions */
  1423. #   define CVT_PTR(ptr)         (ptr)
  1424. #   define CVT_PTR_NOCHECK(ptr) (ptr)
  1425. #   define png_strcpy strcpy
  1426. #   define png_strlen strlen
  1427. #   define png_memcmp memcmp     /* SJT: added */
  1428. #   define png_memcpy memcpy
  1429. #   define png_memset memset
  1430. #endif
  1431. /* End of memory model independent support */
  1432.  
  1433. /* Just a little check that someone hasn't tried to define something
  1434.  * contradictory.
  1435.  */
  1436. #if (PNG_ZBUF_SIZE > 65536) && defined(PNG_MAX_MALLOC_64K)
  1437. #undef PNG_ZBUF_SIZE
  1438. #define PNG_ZBUF_SIZE 65536
  1439. #endif
  1440.  
  1441. #endif /* PNGCONF_H */
  1442.  
  1443.