/media/libpng/pngpriv.h

http://github.com/zpao/v8monkey · C Header · 1012 lines · 715 code · 149 blank · 148 comment · 29 complexity · 526eb06276468e25d9e325d42492a4b6 MD5 · raw file

  1. /* pngpriv.h - private declarations for use inside libpng
  2. *
  3. * libpng version 1.4.8 - July 7, 2011
  4. * For conditions of distribution and use, see copyright notice in png.h
  5. * Copyright (c) 1998-2011 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. /* The symbols declared in this file (including the functions declared
  14. * as PNG_EXTERN) are PRIVATE. They are not part of the libpng public
  15. * interface, and are not recommended for use by regular applications.
  16. * Some of them may become public in the future; others may stay private,
  17. * change in an incompatible way, or even disappear.
  18. * Although the libpng users are not forbidden to include this header,
  19. * they should be well aware of the issues that may arise from doing so.
  20. */
  21. #ifndef PNGPRIV_H
  22. #define PNGPRIV_H
  23. #ifndef PNG_VERSION_INFO_ONLY
  24. #if defined(_AIX) && defined(_ALL_SOURCE)
  25. /* On AIX if _ALL_SOURCE is defined standard header files (including
  26. * stdlib.h) define identifiers that are not permitted by the ANSI and
  27. * POSIX standards. In particular 'jmpbuf' is #defined and this will
  28. * prevent compilation of libpng. The following prevents this:
  29. */
  30. # undef _ALL_SOURCE
  31. #endif
  32. #include <stdlib.h>
  33. #ifndef PNG_EXTERN
  34. /* The functions exported by PNG_EXTERN are internal functions, which
  35. * aren't usually used outside the library (as far as I know), so it is
  36. * debatable if they should be exported at all. In the future, when it
  37. * is possible to have run-time registry of chunk-handling functions,
  38. * some of these will be made available again.
  39. # define PNG_EXTERN extern
  40. */
  41. # define PNG_EXTERN
  42. #endif
  43. /* Other defines specific to compilers can go here. Try to keep
  44. * them inside an appropriate ifdef/endif pair for portability.
  45. */
  46. #ifdef PNG_FLOATING_POINT_SUPPORTED
  47. # ifdef MACOS
  48. /* We need to check that <math.h> hasn't already been included earlier
  49. * as it seems it doesn't agree with <fp.h>, yet we should really use
  50. * <fp.h> if possible.
  51. */
  52. # if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
  53. # include <fp.h>
  54. # endif
  55. # else
  56. # include <math.h>
  57. # endif
  58. # if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
  59. /* Amiga SAS/C: We must include builtin FPU functions when compiling using
  60. * MATH=68881
  61. */
  62. # include <m68881.h>
  63. # endif
  64. #endif
  65. /* Codewarrior on NT has linking problems without this. */
  66. #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
  67. # define PNG_ALWAYS_EXTERN
  68. #endif
  69. /* This provides the non-ANSI (far) memory allocation routines. */
  70. #if defined(__TURBOC__) && defined(__MSDOS__)
  71. # include <mem.h>
  72. # include <alloc.h>
  73. #endif
  74. #if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \
  75. defined(_WIN32) || defined(__WIN32__)
  76. # include <windows.h> /* defines _WINDOWS_ macro */
  77. #endif
  78. /* Various modes of operation. Note that after an init, mode is set to
  79. * zero automatically when the structure is created.
  80. */
  81. #define PNG_HAVE_IHDR 0x01
  82. #define PNG_HAVE_PLTE 0x02
  83. #define PNG_HAVE_IDAT 0x04
  84. #define PNG_AFTER_IDAT 0x08 /* Have complete zlib datastream */
  85. #define PNG_HAVE_IEND 0x10
  86. #define PNG_HAVE_gAMA 0x20
  87. #define PNG_HAVE_cHRM 0x40
  88. #define PNG_HAVE_sRGB 0x80
  89. #define PNG_HAVE_CHUNK_HEADER 0x100
  90. #define PNG_WROTE_tIME 0x200
  91. #define PNG_WROTE_INFO_BEFORE_PLTE 0x400
  92. #define PNG_BACKGROUND_IS_GRAY 0x800
  93. #define PNG_HAVE_PNG_SIGNATURE 0x1000
  94. #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
  95. #ifdef PNG_APNG_SUPPORTED
  96. #define PNG_HAVE_acTL 0x4000
  97. #define PNG_HAVE_fcTL 0x8000L
  98. #endif
  99. /* Flags for the transformations the PNG library does on the image data */
  100. #define PNG_BGR 0x0001
  101. #define PNG_INTERLACE 0x0002
  102. #define PNG_PACK 0x0004
  103. #define PNG_SHIFT 0x0008
  104. #define PNG_SWAP_BYTES 0x0010
  105. #define PNG_INVERT_MONO 0x0020
  106. #define PNG_QUANTIZE 0x0040 /* formerly PNG_DITHER */
  107. #define PNG_BACKGROUND 0x0080
  108. #define PNG_BACKGROUND_EXPAND 0x0100
  109. /* 0x0200 unused */
  110. #define PNG_16_TO_8 0x0400
  111. #define PNG_RGBA 0x0800
  112. #define PNG_EXPAND 0x1000
  113. #define PNG_GAMMA 0x2000
  114. #define PNG_GRAY_TO_RGB 0x4000
  115. #define PNG_FILLER 0x8000L
  116. #define PNG_PACKSWAP 0x10000L
  117. #define PNG_SWAP_ALPHA 0x20000L
  118. #define PNG_STRIP_ALPHA 0x40000L
  119. #define PNG_INVERT_ALPHA 0x80000L
  120. #define PNG_USER_TRANSFORM 0x100000L
  121. #define PNG_RGB_TO_GRAY_ERR 0x200000L
  122. #define PNG_RGB_TO_GRAY_WARN 0x400000L
  123. #define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */
  124. /* 0x800000L Unused */
  125. #define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */
  126. #define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */
  127. /* 0x4000000L unused */
  128. /* 0x8000000L unused */
  129. /* 0x10000000L unused */
  130. /* 0x20000000L unused */
  131. /* 0x40000000L unused */
  132. /* Flags for png_create_struct */
  133. #define PNG_STRUCT_PNG 0x0001
  134. #define PNG_STRUCT_INFO 0x0002
  135. /* Scaling factor for filter heuristic weighting calculations */
  136. #define PNG_WEIGHT_SHIFT 8
  137. #define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT))
  138. #define PNG_COST_SHIFT 3
  139. #define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))
  140. /* Flags for the png_ptr->flags rather than declaring a byte for each one */
  141. #define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001
  142. #define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002
  143. #define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004
  144. #define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008
  145. #define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010
  146. #define PNG_FLAG_ZLIB_FINISHED 0x0020
  147. #define PNG_FLAG_ROW_INIT 0x0040
  148. #define PNG_FLAG_FILLER_AFTER 0x0080
  149. #define PNG_FLAG_CRC_ANCILLARY_USE 0x0100
  150. #define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200
  151. #define PNG_FLAG_CRC_CRITICAL_USE 0x0400
  152. #define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800
  153. /* 0x1000 unused */
  154. /* 0x2000 unused */
  155. /* 0x4000 unused */
  156. #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L
  157. #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L
  158. #define PNG_FLAG_LIBRARY_MISMATCH 0x20000L
  159. #define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L
  160. #define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L
  161. #define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L
  162. #define PNG_FLAG_ADD_ALPHA 0x200000L /* Added to libpng-1.2.8 */
  163. #define PNG_FLAG_STRIP_ALPHA 0x400000L /* Added to libpng-1.2.8 */
  164. #define PNG_FLAG_BENIGN_ERRORS_WARN 0x800000L /* Added to libpng-1.4.0 */
  165. /* 0x1000000L unused */
  166. /* 0x2000000L unused */
  167. /* 0x4000000L unused */
  168. /* 0x8000000L unused */
  169. /* 0x10000000L unused */
  170. /* 0x20000000L unused */
  171. /* 0x40000000L unused */
  172. #define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
  173. PNG_FLAG_CRC_ANCILLARY_NOWARN)
  174. #define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \
  175. PNG_FLAG_CRC_CRITICAL_IGNORE)
  176. #define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \
  177. PNG_FLAG_CRC_CRITICAL_MASK)
  178. /* Save typing and make code easier to understand */
  179. #define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
  180. abs((int)((c1).green) - (int)((c2).green)) + \
  181. abs((int)((c1).blue) - (int)((c2).blue)))
  182. /* Added to libpng-1.2.6 JB */
  183. #define PNG_ROWBYTES(pixel_bits, width) \
  184. ((pixel_bits) >= 8 ? \
  185. ((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \
  186. (( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) )
  187. /* PNG_OUT_OF_RANGE returns true if value is outside the range
  188. * ideal-delta..ideal+delta. Each argument is evaluated twice.
  189. * "ideal" and "delta" should be constants, normally simple
  190. * integers, "value" a variable. Added to libpng-1.2.6 JB
  191. */
  192. #define PNG_OUT_OF_RANGE(value, ideal, delta) \
  193. ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
  194. /* Constant strings for known chunk types. If you need to add a chunk,
  195. * define the name here, and add an invocation of the macro wherever it's
  196. * needed.
  197. */
  198. #define PNG_IHDR PNG_CONST png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'}
  199. #define PNG_IDAT PNG_CONST png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'}
  200. #define PNG_IEND PNG_CONST png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'}
  201. #define PNG_PLTE PNG_CONST png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'}
  202. #define PNG_bKGD PNG_CONST png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'}
  203. #define PNG_cHRM PNG_CONST png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'}
  204. #define PNG_gAMA PNG_CONST png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'}
  205. #define PNG_hIST PNG_CONST png_byte png_hIST[5] = {104, 73, 83, 84, '\0'}
  206. #define PNG_iCCP PNG_CONST png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'}
  207. #define PNG_iTXt PNG_CONST png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'}
  208. #define PNG_oFFs PNG_CONST png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'}
  209. #define PNG_pCAL PNG_CONST png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'}
  210. #define PNG_sCAL PNG_CONST png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'}
  211. #define PNG_pHYs PNG_CONST png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'}
  212. #define PNG_sBIT PNG_CONST png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'}
  213. #define PNG_sPLT PNG_CONST png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'}
  214. #define PNG_sRGB PNG_CONST png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'}
  215. #define PNG_sTER PNG_CONST png_byte png_sTER[5] = {115, 84, 69, 82, '\0'}
  216. #define PNG_tEXt PNG_CONST png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'}
  217. #define PNG_tIME PNG_CONST png_byte png_tIME[5] = {116, 73, 77, 69, '\0'}
  218. #define PNG_tRNS PNG_CONST png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'}
  219. #define PNG_zTXt PNG_CONST png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'}
  220. #ifdef PNG_APNG_SUPPORTED
  221. #define PNG_acTL PNG_CONST png_byte png_acTL[5] = { 97, 99, 84, 76, '\0'}
  222. #define PNG_fcTL PNG_CONST png_byte png_fcTL[5] = {102, 99, 84, 76, '\0'}
  223. #define PNG_fdAT PNG_CONST png_byte png_fdAT[5] = {102, 100, 65, 84, '\0'}
  224. #endif
  225. /* Inhibit C++ name-mangling for libpng functions but not for system calls. */
  226. #ifdef __cplusplus
  227. extern "C" {
  228. #endif /* __cplusplus */
  229. /* These functions are used internally in the code. They generally
  230. * shouldn't be used unless you are writing code to add or replace some
  231. * functionality in libpng. More information about most functions can
  232. * be found in the files where the functions are located.
  233. */
  234. /* Allocate memory for an internal libpng struct */
  235. PNG_EXTERN png_voidp png_create_struct PNGARG((int type));
  236. /* Free memory from internal libpng struct */
  237. PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));
  238. PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr
  239. malloc_fn, png_voidp mem_ptr));
  240. PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
  241. png_free_ptr free_fn, png_voidp mem_ptr));
  242. /* Free any memory that info_ptr points to and reset struct. */
  243. PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
  244. png_infop info_ptr));
  245. /* Function to allocate memory for zlib. PNGAPI is disallowed. */
  246. PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
  247. /* Function to free memory for zlib. PNGAPI is disallowed. */
  248. PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
  249. /* Next four functions are used internally as callbacks. PNGAPI is required
  250. * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */
  251. PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr,
  252. png_bytep data, png_size_t length));
  253. #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  254. PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr,
  255. png_bytep buffer, png_size_t length));
  256. #endif
  257. PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr,
  258. png_bytep data, png_size_t length));
  259. #ifdef PNG_WRITE_FLUSH_SUPPORTED
  260. #ifdef PNG_STDIO_SUPPORTED
  261. PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr));
  262. #endif
  263. #endif
  264. /* Reset the CRC variable */
  265. PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));
  266. /* Write the "data" buffer to whatever output you are using */
  267. PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data,
  268. png_size_t length));
  269. /* Read and check the PNG file signature */
  270. PNG_EXTERN void png_read_sig PNGARG((png_structp png_ptr, png_infop info_ptr));
  271. /* Read the chunk header (length + type name) */
  272. PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr));
  273. /* Read data from whatever input you are using into the "data" buffer */
  274. PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
  275. png_size_t length));
  276. /* Read bytes into buf, and update png_ptr->crc */
  277. PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
  278. png_size_t length));
  279. /* Decompress data in a chunk that uses compression */
  280. #if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \
  281. defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
  282. PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr,
  283. int comp_type, png_size_t chunklength, png_size_t prefix_length,
  284. png_size_t *data_length));
  285. #endif
  286. /* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
  287. PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip));
  288. /* Read the CRC from the file and compare it to the libpng calculated CRC */
  289. PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr));
  290. /* Calculate the CRC over a section of data. Note that we are only
  291. * passing a maximum of 64K on systems that have this as a memory limit,
  292. * since this is the maximum buffer size we can specify.
  293. */
  294. PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
  295. png_size_t length));
  296. #ifdef PNG_WRITE_FLUSH_SUPPORTED
  297. PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
  298. #endif
  299. /* Write various chunks */
  300. /* Write the IHDR chunk, and update the png_struct with the necessary
  301. * information.
  302. */
  303. PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
  304. png_uint_32 height,
  305. int bit_depth, int color_type, int compression_method, int filter_method,
  306. int interlace_method));
  307. PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,
  308. png_uint_32 num_pal));
  309. PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
  310. png_size_t length));
  311. PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr));
  312. #ifdef PNG_WRITE_gAMA_SUPPORTED
  313. #ifdef PNG_FLOATING_POINT_SUPPORTED
  314. PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma));
  315. #endif
  316. #ifdef PNG_FIXED_POINT_SUPPORTED
  317. PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr,
  318. png_fixed_point file_gamma));
  319. #endif
  320. #endif
  321. #ifdef PNG_WRITE_sBIT_SUPPORTED
  322. PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
  323. int color_type));
  324. #endif
  325. #ifdef PNG_WRITE_cHRM_SUPPORTED
  326. #ifdef PNG_FLOATING_POINT_SUPPORTED
  327. PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr,
  328. double white_x, double white_y,
  329. double red_x, double red_y, double green_x, double green_y,
  330. double blue_x, double blue_y));
  331. #endif
  332. PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr,
  333. png_fixed_point int_white_x, png_fixed_point int_white_y,
  334. png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
  335. int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
  336. png_fixed_point int_blue_y));
  337. #endif
  338. #ifdef PNG_WRITE_sRGB_SUPPORTED
  339. PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,
  340. int intent));
  341. #endif
  342. #ifdef PNG_WRITE_iCCP_SUPPORTED
  343. PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,
  344. png_charp name, int compression_type,
  345. png_charp profile, int proflen));
  346. /* Note to maintainer: profile should be png_bytep */
  347. #endif
  348. #ifdef PNG_WRITE_sPLT_SUPPORTED
  349. PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr,
  350. png_sPLT_tp palette));
  351. #endif
  352. #ifdef PNG_WRITE_tRNS_SUPPORTED
  353. PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,
  354. png_color_16p values, int number, int color_type));
  355. #endif
  356. #ifdef PNG_WRITE_bKGD_SUPPORTED
  357. PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr,
  358. png_color_16p values, int color_type));
  359. #endif
  360. #ifdef PNG_WRITE_hIST_SUPPORTED
  361. PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,
  362. int num_hist));
  363. #endif
  364. #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
  365. defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
  366. PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,
  367. png_charp key, png_charpp new_key));
  368. #endif
  369. #ifdef PNG_WRITE_tEXt_SUPPORTED
  370. PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,
  371. png_charp text, png_size_t text_len));
  372. #endif
  373. #ifdef PNG_WRITE_zTXt_SUPPORTED
  374. PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,
  375. png_charp text, png_size_t text_len, int compression));
  376. #endif
  377. #ifdef PNG_WRITE_iTXt_SUPPORTED
  378. PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr,
  379. int compression, png_charp key, png_charp lang, png_charp lang_key,
  380. png_charp text));
  381. #endif
  382. #ifdef PNG_TEXT_SUPPORTED /* Added at version 1.0.14 and 1.2.4 */
  383. PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr,
  384. png_infop info_ptr, png_textp text_ptr, int num_text));
  385. #endif
  386. #ifdef PNG_WRITE_oFFs_SUPPORTED
  387. PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
  388. png_int_32 x_offset, png_int_32 y_offset, int unit_type));
  389. #endif
  390. #ifdef PNG_WRITE_pCAL_SUPPORTED
  391. PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose,
  392. png_int_32 X0, png_int_32 X1, int type, int nparams,
  393. png_charp units, png_charpp params));
  394. #endif
  395. #ifdef PNG_WRITE_pHYs_SUPPORTED
  396. PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr,
  397. png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
  398. int unit_type));
  399. #endif
  400. #ifdef PNG_WRITE_tIME_SUPPORTED
  401. PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
  402. png_timep mod_time));
  403. #endif
  404. #ifdef PNG_WRITE_sCAL_SUPPORTED
  405. #if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
  406. PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,
  407. int unit, double width, double height));
  408. #else
  409. #ifdef PNG_FIXED_POINT_SUPPORTED
  410. PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr,
  411. int unit, png_charp width, png_charp height));
  412. #endif
  413. #endif
  414. #endif
  415. #ifdef PNG_WRITE_APNG_SUPPORTED
  416. PNG_EXTERN void png_write_acTL PNGARG((png_structp png_ptr,
  417. png_uint_32 num_frames, png_uint_32 num_plays));
  418. PNG_EXTERN void png_write_fcTL PNGARG((png_structp png_ptr,
  419. png_uint_32 width, png_uint_32 height,
  420. png_uint_32 x_offset, png_uint_32 y_offset,
  421. png_uint_16 delay_num, png_uint_16 delay_den,
  422. png_byte dispose_op, png_byte blend_op));
  423. #endif
  424. /* Called when finished processing a row of data */
  425. PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr));
  426. /* Internal use only. Called before first row of data */
  427. PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));
  428. #ifdef PNG_READ_GAMMA_SUPPORTED
  429. PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr,
  430. png_byte bit_depth));
  431. #endif
  432. /* Combine a row of data, dealing with alpha, etc. if requested */
  433. PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
  434. int mask));
  435. #ifdef PNG_READ_INTERLACING_SUPPORTED
  436. /* Expand an interlaced row */
  437. /* OLD pre-1.0.9 interface:
  438. PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
  439. png_bytep row, int pass, png_uint_32 transformations));
  440. */
  441. PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));
  442. #endif
  443. /* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */
  444. #ifdef PNG_WRITE_INTERLACING_SUPPORTED
  445. /* Grab pixels out of a row for an interlaced pass */
  446. PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
  447. png_bytep row, int pass));
  448. #endif
  449. /* Unfilter a row */
  450. PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr,
  451. png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter));
  452. /* Choose the best filter to use and filter the row data */
  453. PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr,
  454. png_row_infop row_info));
  455. /* Write out the filtered row. */
  456. PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr,
  457. png_bytep filtered_row));
  458. /* Finish a row while reading, dealing with interlacing passes, etc. */
  459. PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr));
  460. /* Initialize the row buffers, etc. */
  461. PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr));
  462. /* Optional call to update the users info structure */
  463. PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,
  464. png_infop info_ptr));
  465. #ifdef PNG_READ_APNG_SUPPORTED
  466. /* Private, reset some things to become ready for reading next frame */
  467. PNG_EXTERN void png_read_reset PNGARG((png_structp png_ptr));
  468. PNG_EXTERN void png_read_reinit PNGARG((png_structp png_ptr,
  469. png_infop info_ptr));
  470. PNG_EXTERN void png_progressive_read_reset PNGARG((png_structp png_ptr));
  471. #endif
  472. #ifdef PNG_WRITE_APNG_SUPPORTED
  473. /* Private, reset some things to become ready for writing next frame */
  474. PNG_EXTERN void png_write_reset PNGARG((png_structp png_ptr));
  475. PNG_EXTERN void png_write_reinit PNGARG((png_structp png_ptr,
  476. png_infop info_ptr, png_uint_32 width, png_uint_32 height));
  477. #endif
  478. /* These are the functions that do the transformations */
  479. #ifdef PNG_READ_FILLER_SUPPORTED
  480. PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,
  481. png_bytep row, png_uint_32 filler, png_uint_32 flags));
  482. #endif
  483. #ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
  484. PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info,
  485. png_bytep row));
  486. #endif
  487. #ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
  488. PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info,
  489. png_bytep row));
  490. #endif
  491. #ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
  492. PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info,
  493. png_bytep row));
  494. #endif
  495. #ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
  496. PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info,
  497. png_bytep row));
  498. #endif
  499. #if defined(PNG_WRITE_FILLER_SUPPORTED) || \
  500. defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
  501. PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info,
  502. png_bytep row, png_uint_32 flags));
  503. #endif
  504. #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
  505. PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));
  506. #endif
  507. #if defined(PNG_READ_PACKSWAP_SUPPORTED) || \
  508. defined(PNG_WRITE_PACKSWAP_SUPPORTED)
  509. PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row));
  510. #endif
  511. #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
  512. PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop
  513. row_info, png_bytep row));
  514. #endif
  515. #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
  516. PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,
  517. png_bytep row));
  518. #endif
  519. #ifdef PNG_READ_PACK_SUPPORTED
  520. PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));
  521. #endif
  522. #ifdef PNG_READ_SHIFT_SUPPORTED
  523. PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row,
  524. png_color_8p sig_bits));
  525. #endif
  526. #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
  527. PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));
  528. #endif
  529. #ifdef PNG_READ_16_TO_8_SUPPORTED
  530. PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));
  531. #endif
  532. #ifdef PNG_READ_QUANTIZE_SUPPORTED
  533. PNG_EXTERN void png_do_quantize PNGARG((png_row_infop row_info,
  534. png_bytep row, png_bytep palette_lookup, png_bytep quantize_lookup));
  535. # ifdef PNG_CORRECT_PALETTE_SUPPORTED
  536. PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,
  537. png_colorp palette, int num_palette));
  538. # endif
  539. #endif
  540. #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
  541. PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row));
  542. #endif
  543. #ifdef PNG_WRITE_PACK_SUPPORTED
  544. PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info,
  545. png_bytep row, png_uint_32 bit_depth));
  546. #endif
  547. #ifdef PNG_WRITE_SHIFT_SUPPORTED
  548. PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,
  549. png_color_8p bit_depth));
  550. #endif
  551. #ifdef PNG_READ_BACKGROUND_SUPPORTED
  552. #ifdef PNG_READ_GAMMA_SUPPORTED
  553. PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
  554. png_color_16p trans_color, png_color_16p background,
  555. png_color_16p background_1,
  556. png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
  557. png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
  558. png_uint_16pp gamma_16_to_1, int gamma_shift));
  559. #else
  560. PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
  561. png_color_16p trans_color, png_color_16p background));
  562. #endif
  563. #endif
  564. #ifdef PNG_READ_GAMMA_SUPPORTED
  565. PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row,
  566. png_bytep gamma_table, png_uint_16pp gamma_16_table,
  567. int gamma_shift));
  568. #endif
  569. #ifdef PNG_READ_EXPAND_SUPPORTED
  570. PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info,
  571. png_bytep row, png_colorp palette, png_bytep trans, int num_trans));
  572. PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,
  573. png_bytep row, png_color_16p trans_value));
  574. #endif
  575. /* The following decodes the appropriate chunks, and does error correction,
  576. * then calls the appropriate callback for the chunk if it is valid.
  577. */
  578. /* Decode the IHDR chunk */
  579. PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,
  580. png_uint_32 length));
  581. PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,
  582. png_uint_32 length));
  583. PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr,
  584. png_uint_32 length));
  585. #ifdef PNG_READ_bKGD_SUPPORTED
  586. PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,
  587. png_uint_32 length));
  588. #endif
  589. #ifdef PNG_READ_cHRM_SUPPORTED
  590. PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,
  591. png_uint_32 length));
  592. #endif
  593. #ifdef PNG_READ_gAMA_SUPPORTED
  594. PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,
  595. png_uint_32 length));
  596. #endif
  597. #ifdef PNG_READ_hIST_SUPPORTED
  598. PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
  599. png_uint_32 length));
  600. #endif
  601. #ifdef PNG_READ_iCCP_SUPPORTED
  602. PNG_EXTERN void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,
  603. png_uint_32 length));
  604. #endif /* PNG_READ_iCCP_SUPPORTED */
  605. #ifdef PNG_READ_iTXt_SUPPORTED
  606. PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
  607. png_uint_32 length));
  608. #endif
  609. #ifdef PNG_READ_oFFs_SUPPORTED
  610. PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,
  611. png_uint_32 length));
  612. #endif
  613. #ifdef PNG_READ_pCAL_SUPPORTED
  614. PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
  615. png_uint_32 length));
  616. #endif
  617. #ifdef PNG_READ_pHYs_SUPPORTED
  618. PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,
  619. png_uint_32 length));
  620. #endif
  621. #ifdef PNG_READ_sBIT_SUPPORTED
  622. PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,
  623. png_uint_32 length));
  624. #endif
  625. #ifdef PNG_READ_sCAL_SUPPORTED
  626. PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
  627. png_uint_32 length));
  628. #endif
  629. #ifdef PNG_READ_sPLT_SUPPORTED
  630. PNG_EXTERN void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,
  631. png_uint_32 length));
  632. #endif /* PNG_READ_sPLT_SUPPORTED */
  633. #ifdef PNG_READ_sRGB_SUPPORTED
  634. PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr,
  635. png_uint_32 length));
  636. #endif
  637. #ifdef PNG_READ_tEXt_SUPPORTED
  638. PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
  639. png_uint_32 length));
  640. #endif
  641. #ifdef PNG_READ_tIME_SUPPORTED
  642. PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,
  643. png_uint_32 length));
  644. #endif
  645. #ifdef PNG_READ_tRNS_SUPPORTED
  646. PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
  647. png_uint_32 length));
  648. #endif
  649. #ifdef PNG_READ_zTXt_SUPPORTED
  650. PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
  651. png_uint_32 length));
  652. #endif
  653. #ifdef PNG_READ_APNG_SUPPORTED
  654. PNG_EXTERN void png_handle_acTL PNGARG((png_structp png_ptr, png_infop info_ptr,
  655. png_uint_32 length));
  656. PNG_EXTERN void png_handle_fcTL PNGARG((png_structp png_ptr, png_infop info_ptr,
  657. png_uint_32 length));
  658. PNG_EXTERN void png_have_info PNGARG((png_structp png_ptr, png_infop info_ptr));
  659. PNG_EXTERN void png_handle_fdAT PNGARG((png_structp png_ptr, png_infop info_ptr,
  660. png_uint_32 length));
  661. PNG_EXTERN void png_ensure_sequence_number PNGARG((png_structp png_ptr,
  662. png_uint_32 length));
  663. #endif
  664. PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
  665. png_infop info_ptr, png_uint_32 length));
  666. PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,
  667. png_bytep chunk_name));
  668. /* Handle the transformations for reading and writing */
  669. PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));
  670. PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr));
  671. PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr));
  672. #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  673. PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr,
  674. png_infop info_ptr));
  675. PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr,
  676. png_infop info_ptr));
  677. PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr));
  678. PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr,
  679. png_uint_32 length));
  680. PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr));
  681. PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr));
  682. PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr,
  683. png_bytep buffer, png_size_t buffer_length));
  684. PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr));
  685. PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr,
  686. png_bytep buffer, png_size_t buffer_length));
  687. PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr));
  688. PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr,
  689. png_infop info_ptr, png_uint_32 length));
  690. PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr,
  691. png_infop info_ptr));
  692. PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr,
  693. png_infop info_ptr));
  694. PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row));
  695. PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr,
  696. png_infop info_ptr));
  697. PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr,
  698. png_infop info_ptr));
  699. PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr));
  700. #ifdef PNG_READ_tEXt_SUPPORTED
  701. PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr,
  702. png_infop info_ptr, png_uint_32 length));
  703. PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr,
  704. png_infop info_ptr));
  705. #endif
  706. #ifdef PNG_READ_zTXt_SUPPORTED
  707. PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr,
  708. png_infop info_ptr, png_uint_32 length));
  709. PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr,
  710. png_infop info_ptr));
  711. #endif
  712. #ifdef PNG_READ_iTXt_SUPPORTED
  713. PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr,
  714. png_infop info_ptr, png_uint_32 length));
  715. PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr,
  716. png_infop info_ptr));
  717. #endif
  718. #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
  719. #ifdef PNG_MNG_FEATURES_SUPPORTED
  720. PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,
  721. png_bytep row));
  722. PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
  723. png_bytep row));
  724. #endif
  725. /* Added at libpng version 1.4.0 */
  726. #ifdef PNG_cHRM_SUPPORTED
  727. PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
  728. png_fixed_point int_white_x, png_fixed_point int_white_y,
  729. png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
  730. int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
  731. png_fixed_point int_blue_y));
  732. #endif
  733. #ifdef PNG_cHRM_SUPPORTED
  734. #ifdef PNG_CHECK_cHRM_SUPPORTED
  735. /* Added at libpng version 1.2.34 and 1.4.0 */
  736. PNG_EXTERN void png_64bit_product PNGARG((long v1, long v2,
  737. unsigned long *hi_product, unsigned long *lo_product));
  738. #endif
  739. #endif
  740. /* Added at libpng version 1.4.0 */
  741. PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr,
  742. png_uint_32 width, png_uint_32 height, int bit_depth,
  743. int color_type, int interlace_type, int compression_type,
  744. int filter_type));
  745. /* Free all memory used by the read (old method - NOT DLL EXPORTED) */
  746. PNG_EXTERN void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
  747. png_infop end_info_ptr));
  748. /* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
  749. PNG_EXTERN void png_write_destroy PNGARG((png_structp png_ptr));
  750. #ifdef USE_FAR_KEYWORD /* memory model conversion function */
  751. PNG_EXTERN void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
  752. int check));
  753. #endif /* USE_FAR_KEYWORD */
  754. /* Define PNG_DEBUG at compile time for debugging information. Higher
  755. * numbers for PNG_DEBUG mean more debugging information. This has
  756. * only been added since version 0.95 so it is not implemented throughout
  757. * libpng yet, but more support will be added as needed.
  758. */
  759. #ifdef PNG_DEBUG
  760. #if (PNG_DEBUG > 0)
  761. #if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
  762. #include <crtdbg.h>
  763. #if (PNG_DEBUG > 1)
  764. #ifndef _DEBUG
  765. # define _DEBUG
  766. #endif
  767. #ifndef png_debug
  768. #define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
  769. #endif
  770. #ifndef png_debug1
  771. #define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
  772. #endif
  773. #ifndef png_debug2
  774. #define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
  775. #endif
  776. #endif
  777. #else /* PNG_DEBUG_FILE || !_MSC_VER */
  778. #ifndef PNG_DEBUG_FILE
  779. #define PNG_DEBUG_FILE stderr
  780. #endif /* PNG_DEBUG_FILE */
  781. #if (PNG_DEBUG > 1)
  782. /* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
  783. * non-ISO compilers
  784. */
  785. # ifdef __STDC__
  786. # ifndef png_debug
  787. # define png_debug(l,m) \
  788. { \
  789. int num_tabs=l; \
  790. fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
  791. (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
  792. }
  793. # endif
  794. # ifndef png_debug1
  795. # define png_debug1(l,m,p1) \
  796. { \
  797. int num_tabs=l; \
  798. fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
  799. (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
  800. }
  801. # endif
  802. # ifndef png_debug2
  803. # define png_debug2(l,m,p1,p2) \
  804. { \
  805. int num_tabs=l; \
  806. fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
  807. (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
  808. }
  809. # endif
  810. # else /* __STDC __ */
  811. # ifndef png_debug
  812. # define png_debug(l,m) \
  813. { \
  814. int num_tabs=l; \
  815. char format[256]; \
  816. snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
  817. (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
  818. m,PNG_STRING_NEWLINE); \
  819. fprintf(PNG_DEBUG_FILE,format); \
  820. }
  821. # endif
  822. # ifndef png_debug1
  823. # define png_debug1(l,m,p1) \
  824. { \
  825. int num_tabs=l; \
  826. char format[256]; \
  827. snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
  828. (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
  829. m,PNG_STRING_NEWLINE); \
  830. fprintf(PNG_DEBUG_FILE,format,p1); \
  831. }
  832. # endif
  833. # ifndef png_debug2
  834. # define png_debug2(l,m,p1,p2) \
  835. { \
  836. int num_tabs=l; \
  837. char format[256]; \
  838. snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
  839. (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
  840. m,PNG_STRING_NEWLINE); \
  841. fprintf(PNG_DEBUG_FILE,format,p1,p2); \
  842. }
  843. # endif
  844. # endif /* __STDC __ */
  845. #endif /* (PNG_DEBUG > 1) */
  846. #endif /* _MSC_VER */
  847. #endif /* (PNG_DEBUG > 0) */
  848. #endif /* PNG_DEBUG */
  849. #ifndef png_debug
  850. #define png_debug(l, m)
  851. #endif
  852. #ifndef png_debug1
  853. #define png_debug1(l, m, p1)
  854. #endif
  855. #ifndef png_debug2
  856. #define png_debug2(l, m, p1, p2)
  857. #endif
  858. /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
  859. #ifdef __cplusplus
  860. }
  861. #endif
  862. #endif /* PNG_VERSION_INFO_ONLY */
  863. #endif /* PNGPRIV_H */