pngstruct.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. /* pngstruct.h - header file for PNG reference library
  2. *
  3. * Copyright (c) 1998-2013 Glenn Randers-Pehrson
  4. * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  5. * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  6. *
  7. * Last changed in libpng 1.6.1 [March 28, 2013]
  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 structure that holds the information to read and write PNG files.
  14. * The only people who need to care about what is inside of this are the
  15. * people who will be modifying the library for their own special needs.
  16. * It should NOT be accessed directly by an application.
  17. */
  18. #ifndef PNGSTRUCT_H
  19. #define PNGSTRUCT_H
  20. /* zlib.h defines the structure z_stream, an instance of which is included
  21. * in this structure and is required for decompressing the LZ compressed
  22. * data in PNG files.
  23. */
  24. #ifndef ZLIB_CONST
  25. /* We must ensure that zlib uses 'const' in declarations. */
  26. # define ZLIB_CONST
  27. #endif
  28. #include "zlib.h"
  29. #ifdef const
  30. /* zlib.h sometimes #defines const to nothing, undo this. */
  31. # undef const
  32. #endif
  33. /* zlib.h has mediocre z_const use before 1.2.6, this stuff is for compatibility
  34. * with older builds.
  35. */
  36. #if ZLIB_VERNUM < 0x1260
  37. # define PNGZ_MSG_CAST(s) png_constcast(char*,s)
  38. # define PNGZ_INPUT_CAST(b) png_constcast(png_bytep,b)
  39. #else
  40. # define PNGZ_MSG_CAST(s) (s)
  41. # define PNGZ_INPUT_CAST(b) (b)
  42. #endif
  43. /* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib
  44. * can handle at once. This type need be no larger than 16 bits (so maximum of
  45. * 65535), this define allows us to discover how big it is, but limited by the
  46. * maximuum for png_size_t. The value can be overriden in a library build
  47. * (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably
  48. * lower value (e.g. 255 works). A lower value may help memory usage (slightly)
  49. * and may even improve performance on some systems (and degrade it on others.)
  50. */
  51. #ifndef ZLIB_IO_MAX
  52. # define ZLIB_IO_MAX ((uInt)-1)
  53. #endif
  54. #ifdef PNG_WRITE_SUPPORTED
  55. /* The type of a compression buffer list used by the write code. */
  56. typedef struct png_compression_buffer
  57. {
  58. struct png_compression_buffer *next;
  59. png_byte output[1]; /* actually zbuf_size */
  60. } png_compression_buffer, *png_compression_bufferp;
  61. #define PNG_COMPRESSION_BUFFER_SIZE(pp)\
  62. (offsetof(png_compression_buffer, output) + (pp)->zbuffer_size)
  63. #endif
  64. /* Colorspace support; structures used in png_struct, png_info and in internal
  65. * functions to hold and communicate information about the color space.
  66. *
  67. * PNG_COLORSPACE_SUPPORTED is only required if the application will perform
  68. * colorspace corrections, otherwise all the colorspace information can be
  69. * skipped and the size of libpng can be reduced (significantly) by compiling
  70. * out the colorspace support.
  71. */
  72. #ifdef PNG_COLORSPACE_SUPPORTED
  73. /* The chromaticities of the red, green and blue colorants and the chromaticity
  74. * of the corresponding white point (i.e. of rgb(1.0,1.0,1.0)).
  75. */
  76. typedef struct png_xy
  77. {
  78. png_fixed_point redx, redy;
  79. png_fixed_point greenx, greeny;
  80. png_fixed_point bluex, bluey;
  81. png_fixed_point whitex, whitey;
  82. } png_xy;
  83. /* The same data as above but encoded as CIE XYZ values. When this data comes
  84. * from chromaticities the sum of the Y values is assumed to be 1.0
  85. */
  86. typedef struct png_XYZ
  87. {
  88. png_fixed_point red_X, red_Y, red_Z;
  89. png_fixed_point green_X, green_Y, green_Z;
  90. png_fixed_point blue_X, blue_Y, blue_Z;
  91. } png_XYZ;
  92. #endif /* COLORSPACE */
  93. #if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
  94. /* A colorspace is all the above plus, potentially, profile information,
  95. * however at present libpng does not use the profile internally so it is only
  96. * stored in the png_info struct (if iCCP is supported.) The rendering intent
  97. * is retained here and is checked.
  98. *
  99. * The file gamma encoding information is also stored here and gamma correction
  100. * is done by libpng, whereas color correction must currently be done by the
  101. * application.
  102. */
  103. typedef struct png_colorspace
  104. {
  105. #ifdef PNG_GAMMA_SUPPORTED
  106. png_fixed_point gamma; /* File gamma */
  107. #endif
  108. #ifdef PNG_COLORSPACE_SUPPORTED
  109. png_xy end_points_xy; /* End points as chromaticities */
  110. png_XYZ end_points_XYZ; /* End points as CIE XYZ colorant values */
  111. png_uint_16 rendering_intent; /* Rendering intent of a profile */
  112. #endif
  113. /* Flags are always defined to simplify the code. */
  114. png_uint_16 flags; /* As defined below */
  115. } png_colorspace, * PNG_RESTRICT png_colorspacerp;
  116. typedef const png_colorspace * PNG_RESTRICT png_const_colorspacerp;
  117. /* General flags for the 'flags' field */
  118. #define PNG_COLORSPACE_HAVE_GAMMA 0x0001
  119. #define PNG_COLORSPACE_HAVE_ENDPOINTS 0x0002
  120. #define PNG_COLORSPACE_HAVE_INTENT 0x0004
  121. #define PNG_COLORSPACE_FROM_gAMA 0x0008
  122. #define PNG_COLORSPACE_FROM_cHRM 0x0010
  123. #define PNG_COLORSPACE_FROM_sRGB 0x0020
  124. #define PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB 0x0040
  125. #define PNG_COLORSPACE_MATCHES_sRGB 0x0080 /* exact match on profile */
  126. #define PNG_COLORSPACE_INVALID 0x8000
  127. #define PNG_COLORSPACE_CANCEL(flags) (0xffff ^ (flags))
  128. #endif /* COLORSPACE || GAMMA */
  129. #ifdef PNG_INDEX_SUPPORTED
  130. /* png_line_index_struct records an index point, where we impose an index point
  131. * to be located at the beginning of a line for simplifying the implementation.
  132. */
  133. typedef struct png_line_index_struct
  134. {
  135. // state of the lz decoder
  136. z_streamp z_state;
  137. // the IDAT header position of the chunk, which the index point is in
  138. png_uint_32 stream_idat_position;
  139. // we intend to record the offset of the index point in the chunk,
  140. // but we record the number of remaining bytes in the chunk after the
  141. // index point. That's because PNG processes a chunk this way.
  142. png_uint_32 bytes_left_in_idat;
  143. // decompressed data of the previous row
  144. png_bytep prev_row;
  145. } png_line_index;
  146. typedef png_line_index FAR * png_line_indexp;
  147. typedef struct png_index_struct
  148. {
  149. // A temporary variable used when we build the index. The variable records
  150. // the IDAT header position of the last chunk read in so far.
  151. png_uint_32 stream_idat_position;
  152. // line index information about each passes
  153. // the number of index points in each pass
  154. png_uint_32 size[7];
  155. // the line span of two index points of each pass
  156. png_uint_32 step[7];
  157. // the index points of each pass
  158. png_line_indexp *pass_line_index[7];
  159. } png_index;
  160. typedef png_index FAR * png_indexp;
  161. #define INDEX_SAMPLE_SIZE 254
  162. #endif
  163. struct png_struct_def
  164. {
  165. #ifdef PNG_SETJMP_SUPPORTED
  166. jmp_buf jmp_buf_local; /* New name in 1.6.0 for jmp_buf in png_struct */
  167. png_longjmp_ptr longjmp_fn;/* setjmp non-local goto function. */
  168. jmp_buf *jmp_buf_ptr; /* passed to longjmp_fn */
  169. size_t jmp_buf_size; /* size of the above, if allocated */
  170. #endif
  171. png_error_ptr error_fn; /* function for printing errors and aborting */
  172. #ifdef PNG_WARNINGS_SUPPORTED
  173. png_error_ptr warning_fn; /* function for printing warnings */
  174. #endif
  175. png_voidp error_ptr; /* user supplied struct for error functions */
  176. png_rw_ptr write_data_fn; /* function for writing output data */
  177. png_rw_ptr read_data_fn; /* function for reading input data */
  178. #ifdef PNG_INDEX_SUPPORTED
  179. png_seek_ptr seek_data_fn; /* function for seeking input data */
  180. #endif
  181. png_voidp io_ptr; /* ptr to application struct for I/O functions */
  182. #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
  183. png_user_transform_ptr read_user_transform_fn; /* user read transform */
  184. #endif
  185. #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
  186. png_user_transform_ptr write_user_transform_fn; /* user write transform */
  187. #endif
  188. /* These were added in libpng-1.0.2 */
  189. #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
  190. #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
  191. defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
  192. png_voidp user_transform_ptr; /* user supplied struct for user transform */
  193. png_byte user_transform_depth; /* bit depth of user transformed pixels */
  194. png_byte user_transform_channels; /* channels in user transformed pixels */
  195. #endif
  196. #endif
  197. png_uint_32 mode; /* tells us where we are in the PNG file */
  198. png_uint_32 flags; /* flags indicating various things to libpng */
  199. png_uint_32 transformations; /* which transformations to perform */
  200. png_uint_32 zowner; /* ID (chunk type) of zstream owner, 0 if none */
  201. z_stream zstream; /* decompression structure */
  202. #ifdef PNG_WRITE_SUPPORTED
  203. png_compression_bufferp zbuffer_list; /* Created on demand during write */
  204. uInt zbuffer_size; /* size of the actual buffer */
  205. int zlib_level; /* holds zlib compression level */
  206. int zlib_method; /* holds zlib compression method */
  207. int zlib_window_bits; /* holds zlib compression window bits */
  208. int zlib_mem_level; /* holds zlib compression memory level */
  209. int zlib_strategy; /* holds zlib compression strategy */
  210. #endif
  211. /* Added at libpng 1.5.4 */
  212. #ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
  213. int zlib_text_level; /* holds zlib compression level */
  214. int zlib_text_method; /* holds zlib compression method */
  215. int zlib_text_window_bits; /* holds zlib compression window bits */
  216. int zlib_text_mem_level; /* holds zlib compression memory level */
  217. int zlib_text_strategy; /* holds zlib compression strategy */
  218. #endif
  219. /* End of material added at libpng 1.5.4 */
  220. /* Added at libpng 1.6.0 */
  221. #ifdef PNG_WRITE_SUPPORTED
  222. int zlib_set_level; /* Actual values set into the zstream on write */
  223. int zlib_set_method;
  224. int zlib_set_window_bits;
  225. int zlib_set_mem_level;
  226. int zlib_set_strategy;
  227. #endif
  228. png_uint_32 width; /* width of image in pixels */
  229. png_uint_32 height; /* height of image in pixels */
  230. png_uint_32 num_rows; /* number of rows in current pass */
  231. png_uint_32 usr_width; /* width of row at start of write */
  232. png_size_t rowbytes; /* size of row in bytes */
  233. png_uint_32 iwidth; /* width of current interlaced row in pixels */
  234. png_uint_32 row_number; /* current row in interlace pass */
  235. png_uint_32 chunk_name; /* PNG_CHUNK() id of current chunk */
  236. png_bytep prev_row; /* buffer to save previous (unfiltered) row.
  237. * This is a pointer into big_prev_row
  238. */
  239. png_bytep row_buf; /* buffer to save current (unfiltered) row.
  240. * This is a pointer into big_row_buf
  241. */
  242. #ifdef PNG_WRITE_SUPPORTED
  243. png_bytep sub_row; /* buffer to save "sub" row when filtering */
  244. png_bytep up_row; /* buffer to save "up" row when filtering */
  245. png_bytep avg_row; /* buffer to save "avg" row when filtering */
  246. png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
  247. #endif
  248. png_size_t info_rowbytes; /* Added in 1.5.4: cache of updated row bytes */
  249. png_uint_32 idat_size; /* current IDAT size for read */
  250. png_uint_32 crc; /* current chunk CRC value */
  251. png_colorp palette; /* palette from the input file */
  252. png_uint_16 num_palette; /* number of color entries in palette */
  253. /* Added at libpng-1.5.10 */
  254. #ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
  255. int num_palette_max; /* maximum palette index found in IDAT */
  256. #endif
  257. png_uint_16 num_trans; /* number of transparency values */
  258. png_byte compression; /* file compression type (always 0) */
  259. png_byte filter; /* file filter type (always 0) */
  260. png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
  261. png_byte pass; /* current interlace pass (0 - 6) */
  262. png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
  263. png_byte color_type; /* color type of file */
  264. png_byte bit_depth; /* bit depth of file */
  265. png_byte usr_bit_depth; /* bit depth of users row: write only */
  266. png_byte pixel_depth; /* number of bits per pixel */
  267. png_byte channels; /* number of channels in file */
  268. #ifdef PNG_WRITE_SUPPORTED
  269. png_byte usr_channels; /* channels at start of write: write only */
  270. #endif
  271. png_byte sig_bytes; /* magic bytes read/written from start of file */
  272. png_byte maximum_pixel_depth;
  273. /* pixel depth used for the row buffers */
  274. png_byte transformed_pixel_depth;
  275. /* pixel depth after read/write transforms */
  276. #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
  277. png_uint_16 filler; /* filler bytes for pixel expansion */
  278. #endif
  279. #if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
  280. defined(PNG_READ_ALPHA_MODE_SUPPORTED)
  281. png_byte background_gamma_type;
  282. png_fixed_point background_gamma;
  283. png_color_16 background; /* background color in screen gamma space */
  284. #ifdef PNG_READ_GAMMA_SUPPORTED
  285. png_color_16 background_1; /* background normalized to gamma 1.0 */
  286. #endif
  287. #endif /* PNG_bKGD_SUPPORTED */
  288. #ifdef PNG_WRITE_FLUSH_SUPPORTED
  289. png_flush_ptr output_flush_fn; /* Function for flushing output */
  290. png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */
  291. png_uint_32 flush_rows; /* number of rows written since last flush */
  292. #endif
  293. #ifdef PNG_READ_GAMMA_SUPPORTED
  294. int gamma_shift; /* number of "insignificant" bits in 16-bit gamma */
  295. png_fixed_point screen_gamma; /* screen gamma value (display_exponent) */
  296. png_bytep gamma_table; /* gamma table for 8-bit depth files */
  297. png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
  298. #if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
  299. defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
  300. defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
  301. png_bytep gamma_from_1; /* converts from 1.0 to screen */
  302. png_bytep gamma_to_1; /* converts from file to 1.0 */
  303. png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
  304. png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
  305. #endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
  306. #endif
  307. #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
  308. png_color_8 sig_bit; /* significant bits in each available channel */
  309. #endif
  310. #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
  311. png_color_8 shift; /* shift for significant bit tranformation */
  312. #endif
  313. #if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
  314. || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
  315. png_bytep trans_alpha; /* alpha values for paletted files */
  316. png_color_16 trans_color; /* transparent color for non-paletted files */
  317. #endif
  318. png_read_status_ptr read_row_fn; /* called after each row is decoded */
  319. png_write_status_ptr write_row_fn; /* called after each row is encoded */
  320. #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  321. png_progressive_info_ptr info_fn; /* called after header data fully read */
  322. png_progressive_row_ptr row_fn; /* called after a prog. row is decoded */
  323. png_progressive_end_ptr end_fn; /* called after image is complete */
  324. png_bytep save_buffer_ptr; /* current location in save_buffer */
  325. png_bytep save_buffer; /* buffer for previously read data */
  326. png_bytep current_buffer_ptr; /* current location in current_buffer */
  327. png_bytep current_buffer; /* buffer for recently used data */
  328. png_uint_32 push_length; /* size of current input chunk */
  329. png_uint_32 skip_length; /* bytes to skip in input data */
  330. png_size_t save_buffer_size; /* amount of data now in save_buffer */
  331. png_size_t save_buffer_max; /* total size of save_buffer */
  332. png_size_t buffer_size; /* total amount of available input data */
  333. png_size_t current_buffer_size; /* amount of data now in current_buffer */
  334. int process_mode; /* what push library is currently doing */
  335. int cur_palette; /* current push library palette index */
  336. #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
  337. #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
  338. /* For the Borland special 64K segment handler */
  339. png_bytepp offset_table_ptr;
  340. png_bytep offset_table;
  341. png_uint_16 offset_table_number;
  342. png_uint_16 offset_table_count;
  343. png_uint_16 offset_table_count_free;
  344. #endif
  345. #ifdef PNG_READ_QUANTIZE_SUPPORTED
  346. png_bytep palette_lookup; /* lookup table for quantizing */
  347. png_bytep quantize_index; /* index translation for palette files */
  348. #endif
  349. #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
  350. png_byte heuristic_method; /* heuristic for row filter selection */
  351. png_byte num_prev_filters; /* number of weights for previous rows */
  352. png_bytep prev_filters; /* filter type(s) of previous row(s) */
  353. png_uint_16p filter_weights; /* weight(s) for previous line(s) */
  354. png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */
  355. png_uint_16p filter_costs; /* relative filter calculation cost */
  356. png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
  357. #endif
  358. /* Options */
  359. #ifdef PNG_SET_OPTION_SUPPORTED
  360. png_byte options; /* On/off state (up to 4 options) */
  361. #endif
  362. #if PNG_LIBPNG_VER < 10700
  363. /* To do: remove this from libpng-1.7 */
  364. #ifdef PNG_TIME_RFC1123_SUPPORTED
  365. char time_buffer[29]; /* String to hold RFC 1123 time text */
  366. #endif
  367. #endif
  368. /* New members added in libpng-1.0.6 */
  369. png_uint_32 free_me; /* flags items libpng is responsible for freeing */
  370. #ifdef PNG_USER_CHUNKS_SUPPORTED
  371. png_voidp user_chunk_ptr;
  372. #ifdef PNG_READ_USER_CHUNKS_SUPPORTED
  373. png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
  374. #endif
  375. #endif
  376. #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
  377. int unknown_default; /* As PNG_HANDLE_* */
  378. unsigned int num_chunk_list; /* Number of entries in the list */
  379. png_bytep chunk_list; /* List of png_byte[5]; the textual chunk name
  380. * followed by a PNG_HANDLE_* byte */
  381. #endif
  382. /* New members added in libpng-1.0.3 */
  383. #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
  384. png_byte rgb_to_gray_status;
  385. /* Added in libpng 1.5.5 to record setting of coefficients: */
  386. png_byte rgb_to_gray_coefficients_set;
  387. /* These were changed from png_byte in libpng-1.0.6 */
  388. png_uint_16 rgb_to_gray_red_coeff;
  389. png_uint_16 rgb_to_gray_green_coeff;
  390. /* deleted in 1.5.5: rgb_to_gray_blue_coeff; */
  391. #endif
  392. /* New member added in libpng-1.0.4 (renamed in 1.0.9) */
  393. #if defined(PNG_MNG_FEATURES_SUPPORTED)
  394. /* Changed from png_byte to png_uint_32 at version 1.2.0 */
  395. png_uint_32 mng_features_permitted;
  396. #endif
  397. /* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
  398. #ifdef PNG_MNG_FEATURES_SUPPORTED
  399. png_byte filter_type;
  400. #endif
  401. /* New members added in libpng-1.2.0 */
  402. /* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
  403. #ifdef PNG_USER_MEM_SUPPORTED
  404. png_voidp mem_ptr; /* user supplied struct for mem functions */
  405. png_malloc_ptr malloc_fn; /* function for allocating memory */
  406. png_free_ptr free_fn; /* function for freeing memory */
  407. #endif
  408. /* New member added in libpng-1.0.13 and 1.2.0 */
  409. png_bytep big_row_buf; /* buffer to save current (unfiltered) row */
  410. #ifdef PNG_READ_QUANTIZE_SUPPORTED
  411. /* The following three members were added at version 1.0.14 and 1.2.4 */
  412. png_bytep quantize_sort; /* working sort array */
  413. png_bytep index_to_palette; /* where the original index currently is
  414. in the palette */
  415. png_bytep palette_to_index; /* which original index points to this
  416. palette color */
  417. #endif
  418. /* New members added in libpng-1.0.16 and 1.2.6 */
  419. png_byte compression_type;
  420. #ifdef PNG_USER_LIMITS_SUPPORTED
  421. png_uint_32 user_width_max;
  422. png_uint_32 user_height_max;
  423. /* Added in libpng-1.4.0: Total number of sPLT, text, and unknown
  424. * chunks that can be stored (0 means unlimited).
  425. */
  426. png_uint_32 user_chunk_cache_max;
  427. /* Total memory that a zTXt, sPLT, iTXt, iCCP, or unknown chunk
  428. * can occupy when decompressed. 0 means unlimited.
  429. */
  430. png_alloc_size_t user_chunk_malloc_max;
  431. #endif
  432. /* New member added in libpng-1.0.25 and 1.2.17 */
  433. #ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
  434. /* Temporary storage for unknown chunk that the library doesn't recognize,
  435. * used while reading the chunk.
  436. */
  437. png_unknown_chunk unknown_chunk;
  438. #endif
  439. /* New member added in libpng-1.2.26 */
  440. png_size_t old_big_row_buf_size;
  441. #ifdef PNG_READ_SUPPORTED
  442. /* New member added in libpng-1.2.30 */
  443. png_bytep read_buffer; /* buffer for reading chunk data */
  444. png_alloc_size_t read_buffer_size; /* current size of the buffer */
  445. #endif
  446. #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
  447. uInt IDAT_read_size; /* limit on read buffer size for IDAT */
  448. #endif
  449. #ifdef PNG_IO_STATE_SUPPORTED
  450. /* New member added in libpng-1.4.0 */
  451. png_uint_32 io_state;
  452. #endif
  453. /* New member added in libpng-1.5.6 */
  454. png_bytep big_prev_row;
  455. /* New member added in libpng-1.5.7 */
  456. void (*read_filter[PNG_FILTER_VALUE_LAST-1])(png_row_infop row_info,
  457. png_bytep row, png_const_bytep prev_row);
  458. #ifdef PNG_READ_SUPPORTED
  459. #if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
  460. png_colorspace colorspace;
  461. #endif
  462. #endif
  463. #ifdef PNG_INDEX_SUPPORTED
  464. png_indexp index;
  465. png_uint_32 total_data_read;
  466. #endif
  467. };
  468. #endif /* PNGSTRUCT_H */