PageRenderTime 34ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 1ms

/src/compiler/android/jni/ftk/png.h

http://ftk.googlecode.com/
C++ Header | 1411 lines | 563 code | 110 blank | 738 comment | 16 complexity | a993e38bb811d258493ecaa4da2b7533 MD5 | raw file
Possible License(s): LGPL-3.0
  1. /* png.h - header file for PNG reference library
  2. *
  3. * libpng version 1.2.44 - June 26, 2010
  4. * Copyright (c) 1998-2010 Glenn Randers-Pehrson
  5. * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  6. * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  7. *
  8. * This code is released under the libpng license (See LICENSE, below)
  9. *
  10. * Authors and maintainers:
  11. * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
  12. * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
  13. * libpng versions 0.97, January 1998, through 1.2.44 - June 26, 2010: Glenn
  14. * See also "Contributing Authors", below.
  15. *
  16. * Note about libpng version numbers:
  17. *
  18. * Due to various miscommunications, unforeseen code incompatibilities
  19. * and occasional factors outside the authors' control, version numbering
  20. * on the library has not always been consistent and straightforward.
  21. * The following table summarizes matters since version 0.89c, which was
  22. * the first widely used release:
  23. *
  24. * source png.h png.h shared-lib
  25. * version string int version
  26. * ------- ------ ----- ----------
  27. * 0.89c "1.0 beta 3" 0.89 89 1.0.89
  28. * 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90]
  29. * 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95]
  30. * 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96]
  31. * 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97]
  32. * 0.97c 0.97 97 2.0.97
  33. * 0.98 0.98 98 2.0.98
  34. * 0.99 0.99 98 2.0.99
  35. * 0.99a-m 0.99 99 2.0.99
  36. * 1.00 1.00 100 2.1.0 [100 should be 10000]
  37. * 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000]
  38. * 1.0.1 png.h string is 10001 2.1.0
  39. * 1.0.1a-e identical to the 10002 from here on, the shared library
  40. * 1.0.2 source version) 10002 is 2.V where V is the source code
  41. * 1.0.2a-b 10003 version, except as noted.
  42. * 1.0.3 10003
  43. * 1.0.3a-d 10004
  44. * 1.0.4 10004
  45. * 1.0.4a-f 10005
  46. * 1.0.5 (+ 2 patches) 10005
  47. * 1.0.5a-d 10006
  48. * 1.0.5e-r 10100 (not source compatible)
  49. * 1.0.5s-v 10006 (not binary compatible)
  50. * 1.0.6 (+ 3 patches) 10006 (still binary incompatible)
  51. * 1.0.6d-f 10007 (still binary incompatible)
  52. * 1.0.6g 10007
  53. * 1.0.6h 10007 10.6h (testing xy.z so-numbering)
  54. * 1.0.6i 10007 10.6i
  55. * 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0)
  56. * 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible)
  57. * 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible)
  58. * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible)
  59. * 1.0.7 1 10007 (still compatible)
  60. * 1.0.8beta1-4 1 10008 2.1.0.8beta1-4
  61. * 1.0.8rc1 1 10008 2.1.0.8rc1
  62. * 1.0.8 1 10008 2.1.0.8
  63. * 1.0.9beta1-6 1 10009 2.1.0.9beta1-6
  64. * 1.0.9rc1 1 10009 2.1.0.9rc1
  65. * 1.0.9beta7-10 1 10009 2.1.0.9beta7-10
  66. * 1.0.9rc2 1 10009 2.1.0.9rc2
  67. * 1.0.9 1 10009 2.1.0.9
  68. * 1.0.10beta1 1 10010 2.1.0.10beta1
  69. * 1.0.10rc1 1 10010 2.1.0.10rc1
  70. * 1.0.10 1 10010 2.1.0.10
  71. * 1.0.11beta1-3 1 10011 2.1.0.11beta1-3
  72. * 1.0.11rc1 1 10011 2.1.0.11rc1
  73. * 1.0.11 1 10011 2.1.0.11
  74. * 1.0.12beta1-2 2 10012 2.1.0.12beta1-2
  75. * 1.0.12rc1 2 10012 2.1.0.12rc1
  76. * 1.0.12 2 10012 2.1.0.12
  77. * 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned)
  78. * 1.2.0beta1-2 2 10200 2.1.2.0beta1-2
  79. * 1.2.0beta3-5 3 10200 3.1.2.0beta3-5
  80. * 1.2.0rc1 3 10200 3.1.2.0rc1
  81. * 1.2.0 3 10200 3.1.2.0
  82. * 1.2.1beta1-4 3 10201 3.1.2.1beta1-4
  83. * 1.2.1rc1-2 3 10201 3.1.2.1rc1-2
  84. * 1.2.1 3 10201 3.1.2.1
  85. * 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6
  86. * 1.0.13beta1 10 10013 10.so.0.1.0.13beta1
  87. * 1.0.13rc1 10 10013 10.so.0.1.0.13rc1
  88. * 1.2.2rc1 12 10202 12.so.0.1.2.2rc1
  89. * 1.0.13 10 10013 10.so.0.1.0.13
  90. * 1.2.2 12 10202 12.so.0.1.2.2
  91. * 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6
  92. * 1.2.3 12 10203 12.so.0.1.2.3
  93. * 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3
  94. * 1.0.14rc1 13 10014 10.so.0.1.0.14rc1
  95. * 1.2.4rc1 13 10204 12.so.0.1.2.4rc1
  96. * 1.0.14 10 10014 10.so.0.1.0.14
  97. * 1.2.4 13 10204 12.so.0.1.2.4
  98. * 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2
  99. * 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3
  100. * 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3
  101. * 1.0.15 10 10015 10.so.0.1.0.15
  102. * 1.2.5 13 10205 12.so.0.1.2.5
  103. * 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4
  104. * 1.0.16 10 10016 10.so.0.1.0.16
  105. * 1.2.6 13 10206 12.so.0.1.2.6
  106. * 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2
  107. * 1.0.17rc1 10 10017 10.so.0.1.0.17rc1
  108. * 1.2.7rc1 13 10207 12.so.0.1.2.7rc1
  109. * 1.0.17 10 10017 10.so.0.1.0.17
  110. * 1.2.7 13 10207 12.so.0.1.2.7
  111. * 1.2.8beta1-5 13 10208 12.so.0.1.2.8beta1-5
  112. * 1.0.18rc1-5 10 10018 10.so.0.1.0.18rc1-5
  113. * 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5
  114. * 1.0.18 10 10018 10.so.0.1.0.18
  115. * 1.2.8 13 10208 12.so.0.1.2.8
  116. * 1.2.9beta1-3 13 10209 12.so.0.1.2.9beta1-3
  117. * 1.2.9beta4-11 13 10209 12.so.0.9[.0]
  118. * 1.2.9rc1 13 10209 12.so.0.9[.0]
  119. * 1.2.9 13 10209 12.so.0.9[.0]
  120. * 1.2.10beta1-8 13 10210 12.so.0.10[.0]
  121. * 1.2.10rc1-3 13 10210 12.so.0.10[.0]
  122. * 1.2.10 13 10210 12.so.0.10[.0]
  123. * 1.2.11beta1-4 13 10211 12.so.0.11[.0]
  124. * 1.0.19rc1-5 10 10019 10.so.0.19[.0]
  125. * 1.2.11rc1-5 13 10211 12.so.0.11[.0]
  126. * 1.0.19 10 10019 10.so.0.19[.0]
  127. * 1.2.11 13 10211 12.so.0.11[.0]
  128. * 1.0.20 10 10020 10.so.0.20[.0]
  129. * 1.2.12 13 10212 12.so.0.12[.0]
  130. * 1.2.13beta1 13 10213 12.so.0.13[.0]
  131. * 1.0.21 10 10021 10.so.0.21[.0]
  132. * 1.2.13 13 10213 12.so.0.13[.0]
  133. * 1.2.14beta1-2 13 10214 12.so.0.14[.0]
  134. * 1.0.22rc1 10 10022 10.so.0.22[.0]
  135. * 1.2.14rc1 13 10214 12.so.0.14[.0]
  136. * 1.0.22 10 10022 10.so.0.22[.0]
  137. * 1.2.14 13 10214 12.so.0.14[.0]
  138. * 1.2.15beta1-6 13 10215 12.so.0.15[.0]
  139. * 1.0.23rc1-5 10 10023 10.so.0.23[.0]
  140. * 1.2.15rc1-5 13 10215 12.so.0.15[.0]
  141. * 1.0.23 10 10023 10.so.0.23[.0]
  142. * 1.2.15 13 10215 12.so.0.15[.0]
  143. * 1.2.16beta1-2 13 10216 12.so.0.16[.0]
  144. * 1.2.16rc1 13 10216 12.so.0.16[.0]
  145. * 1.0.24 10 10024 10.so.0.24[.0]
  146. * 1.2.16 13 10216 12.so.0.16[.0]
  147. * 1.2.17beta1-2 13 10217 12.so.0.17[.0]
  148. * 1.0.25rc1 10 10025 10.so.0.25[.0]
  149. * 1.2.17rc1-3 13 10217 12.so.0.17[.0]
  150. * 1.0.25 10 10025 10.so.0.25[.0]
  151. * 1.2.17 13 10217 12.so.0.17[.0]
  152. * 1.0.26 10 10026 10.so.0.26[.0]
  153. * 1.2.18 13 10218 12.so.0.18[.0]
  154. * 1.2.19beta1-31 13 10219 12.so.0.19[.0]
  155. * 1.0.27rc1-6 10 10027 10.so.0.27[.0]
  156. * 1.2.19rc1-6 13 10219 12.so.0.19[.0]
  157. * 1.0.27 10 10027 10.so.0.27[.0]
  158. * 1.2.19 13 10219 12.so.0.19[.0]
  159. * 1.2.20beta01-04 13 10220 12.so.0.20[.0]
  160. * 1.0.28rc1-6 10 10028 10.so.0.28[.0]
  161. * 1.2.20rc1-6 13 10220 12.so.0.20[.0]
  162. * 1.0.28 10 10028 10.so.0.28[.0]
  163. * 1.2.20 13 10220 12.so.0.20[.0]
  164. * 1.2.21beta1-2 13 10221 12.so.0.21[.0]
  165. * 1.2.21rc1-3 13 10221 12.so.0.21[.0]
  166. * 1.0.29 10 10029 10.so.0.29[.0]
  167. * 1.2.21 13 10221 12.so.0.21[.0]
  168. * 1.2.22beta1-4 13 10222 12.so.0.22[.0]
  169. * 1.0.30rc1 10 10030 10.so.0.30[.0]
  170. * 1.2.22rc1 13 10222 12.so.0.22[.0]
  171. * 1.0.30 10 10030 10.so.0.30[.0]
  172. * 1.2.22 13 10222 12.so.0.22[.0]
  173. * 1.2.23beta01-05 13 10223 12.so.0.23[.0]
  174. * 1.2.23rc01 13 10223 12.so.0.23[.0]
  175. * 1.2.23 13 10223 12.so.0.23[.0]
  176. * 1.2.24beta01-02 13 10224 12.so.0.24[.0]
  177. * 1.2.24rc01 13 10224 12.so.0.24[.0]
  178. * 1.2.24 13 10224 12.so.0.24[.0]
  179. * 1.2.25beta01-06 13 10225 12.so.0.25[.0]
  180. * 1.2.25rc01-02 13 10225 12.so.0.25[.0]
  181. * 1.0.31 10 10031 10.so.0.31[.0]
  182. * 1.2.25 13 10225 12.so.0.25[.0]
  183. * 1.2.26beta01-06 13 10226 12.so.0.26[.0]
  184. * 1.2.26rc01 13 10226 12.so.0.26[.0]
  185. * 1.2.26 13 10226 12.so.0.26[.0]
  186. * 1.0.32 10 10032 10.so.0.32[.0]
  187. * 1.2.27beta01-06 13 10227 12.so.0.27[.0]
  188. * 1.2.27rc01 13 10227 12.so.0.27[.0]
  189. * 1.0.33 10 10033 10.so.0.33[.0]
  190. * 1.2.27 13 10227 12.so.0.27[.0]
  191. * 1.0.34 10 10034 10.so.0.34[.0]
  192. * 1.2.28 13 10228 12.so.0.28[.0]
  193. * 1.2.29beta01-03 13 10229 12.so.0.29[.0]
  194. * 1.2.29rc01 13 10229 12.so.0.29[.0]
  195. * 1.0.35 10 10035 10.so.0.35[.0]
  196. * 1.2.29 13 10229 12.so.0.29[.0]
  197. * 1.0.37 10 10037 10.so.0.37[.0]
  198. * 1.2.30beta01-04 13 10230 12.so.0.30[.0]
  199. * 1.0.38rc01-08 10 10038 10.so.0.38[.0]
  200. * 1.2.30rc01-08 13 10230 12.so.0.30[.0]
  201. * 1.0.38 10 10038 10.so.0.38[.0]
  202. * 1.2.30 13 10230 12.so.0.30[.0]
  203. * 1.0.39rc01-03 10 10039 10.so.0.39[.0]
  204. * 1.2.31rc01-03 13 10231 12.so.0.31[.0]
  205. * 1.0.39 10 10039 10.so.0.39[.0]
  206. * 1.2.31 13 10231 12.so.0.31[.0]
  207. * 1.2.32beta01-02 13 10232 12.so.0.32[.0]
  208. * 1.0.40rc01 10 10040 10.so.0.40[.0]
  209. * 1.2.32rc01 13 10232 12.so.0.32[.0]
  210. * 1.0.40 10 10040 10.so.0.40[.0]
  211. * 1.2.32 13 10232 12.so.0.32[.0]
  212. * 1.2.33beta01-02 13 10233 12.so.0.33[.0]
  213. * 1.2.33rc01-02 13 10233 12.so.0.33[.0]
  214. * 1.0.41rc01 10 10041 10.so.0.41[.0]
  215. * 1.2.33 13 10233 12.so.0.33[.0]
  216. * 1.0.41 10 10041 10.so.0.41[.0]
  217. * 1.2.34beta01-07 13 10234 12.so.0.34[.0]
  218. * 1.0.42rc01 10 10042 10.so.0.42[.0]
  219. * 1.2.34rc01 13 10234 12.so.0.34[.0]
  220. * 1.0.42 10 10042 10.so.0.42[.0]
  221. * 1.2.34 13 10234 12.so.0.34[.0]
  222. * 1.2.35beta01-03 13 10235 12.so.0.35[.0]
  223. * 1.0.43rc01-02 10 10043 10.so.0.43[.0]
  224. * 1.2.35rc01-02 13 10235 12.so.0.35[.0]
  225. * 1.0.43 10 10043 10.so.0.43[.0]
  226. * 1.2.35 13 10235 12.so.0.35[.0]
  227. * 1.2.36beta01-05 13 10236 12.so.0.36[.0]
  228. * 1.2.36rc01 13 10236 12.so.0.36[.0]
  229. * 1.0.44 10 10044 10.so.0.44[.0]
  230. * 1.2.36 13 10236 12.so.0.36[.0]
  231. * 1.2.37beta01-03 13 10237 12.so.0.37[.0]
  232. * 1.2.37rc01 13 10237 12.so.0.37[.0]
  233. * 1.2.37 13 10237 12.so.0.37[.0]
  234. * 1.2.45 10 10045 12.so.0.45[.0]
  235. * 1.0.46 10 10046 10.so.0.46[.0]
  236. * 1.2.38beta01 13 10238 12.so.0.38[.0]
  237. * 1.2.38rc01-03 13 10238 12.so.0.38[.0]
  238. * 1.0.47 10 10047 10.so.0.47[.0]
  239. * 1.2.38 13 10238 12.so.0.38[.0]
  240. * 1.2.39beta01-05 13 10239 12.so.0.39[.0]
  241. * 1.2.39rc01 13 10239 12.so.0.39[.0]
  242. * 1.0.48 10 10048 10.so.0.48[.0]
  243. * 1.2.39 13 10239 12.so.0.39[.0]
  244. * 1.2.40beta01 13 10240 12.so.0.40[.0]
  245. * 1.2.40rc01 13 10240 12.so.0.40[.0]
  246. * 1.0.49 10 10049 10.so.0.49[.0]
  247. * 1.2.40 13 10240 12.so.0.40[.0]
  248. * 1.2.41beta01-18 13 10241 12.so.0.41[.0]
  249. * 1.0.51rc01 10 10051 10.so.0.51[.0]
  250. * 1.2.41rc01-03 13 10241 12.so.0.41[.0]
  251. * 1.0.51 10 10051 10.so.0.51[.0]
  252. * 1.2.41 13 10241 12.so.0.41[.0]
  253. * 1.2.42beta01-02 13 10242 12.so.0.42[.0]
  254. * 1.2.42rc01-05 13 10242 12.so.0.42[.0]
  255. * 1.0.52 10 10052 10.so.0.52[.0]
  256. * 1.2.42 13 10242 12.so.0.42[.0]
  257. * 1.2.43beta01-05 13 10243 12.so.0.43[.0]
  258. * 1.0.53rc01-02 10 10053 10.so.0.53[.0]
  259. * 1.2.43rc01-02 13 10243 12.so.0.43[.0]
  260. * 1.0.53 10 10053 10.so.0.53[.0]
  261. * 1.2.43 13 10243 12.so.0.43[.0]
  262. * 1.2.44beta01-03 13 10244 12.so.0.44[.0]
  263. * 1.2.44rc01-03 13 10244 12.so.0.44[.0]
  264. * 1.2.44 13 10244 12.so.0.44[.0]
  265. *
  266. * Henceforth the source version will match the shared-library major
  267. * and minor numbers; the shared-library major version number will be
  268. * used for changes in backward compatibility, as it is intended. The
  269. * PNG_LIBPNG_VER macro, which is not used within libpng but is available
  270. * for applications, is an unsigned integer of the form xyyzz corresponding
  271. * to the source version x.y.z (leading zeros in y and z). Beta versions
  272. * were given the previous public release number plus a letter, until
  273. * version 1.0.6j; from then on they were given the upcoming public
  274. * release number plus "betaNN" or "rcNN".
  275. *
  276. * Binary incompatibility exists only when applications make direct access
  277. * to the info_ptr or png_ptr members through png.h, and the compiled
  278. * application is loaded with a different version of the library.
  279. *
  280. * DLLNUM will change each time there are forward or backward changes
  281. * in binary compatibility (e.g., when a new feature is added).
  282. *
  283. * See libpng.txt or libpng.3 for more information. The PNG specification
  284. * is available as a W3C Recommendation and as an ISO Specification,
  285. * <http://www.w3.org/TR/2003/REC-PNG-20031110/
  286. */
  287. /*
  288. * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
  289. *
  290. * If you modify libpng you may insert additional notices immediately following
  291. * this sentence.
  292. *
  293. * This code is released under the libpng license.
  294. *
  295. * libpng versions 1.2.6, August 15, 2004, through 1.2.44, June 26, 2010, are
  296. * Copyright (c) 2004, 2006-2010 Glenn Randers-Pehrson, and are
  297. * distributed according to the same disclaimer and license as libpng-1.2.5
  298. * with the following individual added to the list of Contributing Authors:
  299. *
  300. * Cosmin Truta
  301. *
  302. * libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are
  303. * Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
  304. * distributed according to the same disclaimer and license as libpng-1.0.6
  305. * with the following individuals added to the list of Contributing Authors:
  306. *
  307. * Simon-Pierre Cadieux
  308. * Eric S. Raymond
  309. * Gilles Vollant
  310. *
  311. * and with the following additions to the disclaimer:
  312. *
  313. * There is no warranty against interference with your enjoyment of the
  314. * library or against infringement. There is no warranty that our
  315. * efforts or the library will fulfill any of your particular purposes
  316. * or needs. This library is provided with all faults, and the entire
  317. * risk of satisfactory quality, performance, accuracy, and effort is with
  318. * the user.
  319. *
  320. * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
  321. * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson, and are
  322. * distributed according to the same disclaimer and license as libpng-0.96,
  323. * with the following individuals added to the list of Contributing Authors:
  324. *
  325. * Tom Lane
  326. * Glenn Randers-Pehrson
  327. * Willem van Schaik
  328. *
  329. * libpng versions 0.89, June 1996, through 0.96, May 1997, are
  330. * Copyright (c) 1996, 1997 Andreas Dilger
  331. * Distributed according to the same disclaimer and license as libpng-0.88,
  332. * with the following individuals added to the list of Contributing Authors:
  333. *
  334. * John Bowler
  335. * Kevin Bracey
  336. * Sam Bushell
  337. * Magnus Holmgren
  338. * Greg Roelofs
  339. * Tom Tanner
  340. *
  341. * libpng versions 0.5, May 1995, through 0.88, January 1996, are
  342. * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
  343. *
  344. * For the purposes of this copyright and license, "Contributing Authors"
  345. * is defined as the following set of individuals:
  346. *
  347. * Andreas Dilger
  348. * Dave Martindale
  349. * Guy Eric Schalnat
  350. * Paul Schmidt
  351. * Tim Wegner
  352. *
  353. * The PNG Reference Library is supplied "AS IS". The Contributing Authors
  354. * and Group 42, Inc. disclaim all warranties, expressed or implied,
  355. * including, without limitation, the warranties of merchantability and of
  356. * fitness for any purpose. The Contributing Authors and Group 42, Inc.
  357. * assume no liability for direct, indirect, incidental, special, exemplary,
  358. * or consequential damages, which may result from the use of the PNG
  359. * Reference Library, even if advised of the possibility of such damage.
  360. *
  361. * Permission is hereby granted to use, copy, modify, and distribute this
  362. * source code, or portions hereof, for any purpose, without fee, subject
  363. * to the following restrictions:
  364. *
  365. * 1. The origin of this source code must not be misrepresented.
  366. *
  367. * 2. Altered versions must be plainly marked as such and
  368. * must not be misrepresented as being the original source.
  369. *
  370. * 3. This Copyright notice may not be removed or altered from
  371. * any source or altered source distribution.
  372. *
  373. * The Contributing Authors and Group 42, Inc. specifically permit, without
  374. * fee, and encourage the use of this source code as a component to
  375. * supporting the PNG file format in commercial products. If you use this
  376. * source code in a product, acknowledgment is not required but would be
  377. * appreciated.
  378. */
  379. /*
  380. * A "png_get_copyright" function is available, for convenient use in "about"
  381. * boxes and the like:
  382. *
  383. * printf("%s",png_get_copyright(NULL));
  384. *
  385. * Also, the PNG logo (in PNG format, of course) is supplied in the
  386. * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
  387. */
  388. /*
  389. * Libpng is OSI Certified Open Source Software. OSI Certified is a
  390. * certification mark of the Open Source Initiative.
  391. */
  392. /*
  393. * The contributing authors would like to thank all those who helped
  394. * with testing, bug fixes, and patience. This wouldn't have been
  395. * possible without all of you.
  396. *
  397. * Thanks to Frank J. T. Wojcik for helping with the documentation.
  398. */
  399. /*
  400. * Y2K compliance in libpng:
  401. * =========================
  402. *
  403. * June 26, 2010
  404. *
  405. * Since the PNG Development group is an ad-hoc body, we can't make
  406. * an official declaration.
  407. *
  408. * This is your unofficial assurance that libpng from version 0.71 and
  409. * upward through 1.2.44 are Y2K compliant. It is my belief that earlier
  410. * versions were also Y2K compliant.
  411. *
  412. * Libpng only has three year fields. One is a 2-byte unsigned integer
  413. * that will hold years up to 65535. The other two hold the date in text
  414. * format, and will hold years up to 9999.
  415. *
  416. * The integer is
  417. * "png_uint_16 year" in png_time_struct.
  418. *
  419. * The strings are
  420. * "png_charp time_buffer" in png_struct and
  421. * "near_time_buffer", which is a local character string in png.c.
  422. *
  423. * There are seven time-related functions:
  424. * png.c: png_convert_to_rfc_1123() in png.c
  425. * (formerly png_convert_to_rfc_1152() in error)
  426. * png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
  427. * png_convert_from_time_t() in pngwrite.c
  428. * png_get_tIME() in pngget.c
  429. * png_handle_tIME() in pngrutil.c, called in pngread.c
  430. * png_set_tIME() in pngset.c
  431. * png_write_tIME() in pngwutil.c, called in pngwrite.c
  432. *
  433. * All handle dates properly in a Y2K environment. The
  434. * png_convert_from_time_t() function calls gmtime() to convert from system
  435. * clock time, which returns (year - 1900), which we properly convert to
  436. * the full 4-digit year. There is a possibility that applications using
  437. * libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
  438. * function, or that they are incorrectly passing only a 2-digit year
  439. * instead of "year - 1900" into the png_convert_from_struct_tm() function,
  440. * but this is not under our control. The libpng documentation has always
  441. * stated that it works with 4-digit years, and the APIs have been
  442. * documented as such.
  443. *
  444. * The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned
  445. * integer to hold the year, and can hold years as large as 65535.
  446. *
  447. * zlib, upon which libpng depends, is also Y2K compliant. It contains
  448. * no date-related code.
  449. *
  450. * Glenn Randers-Pehrson
  451. * libpng maintainer
  452. * PNG Development Group
  453. */
  454. #ifndef PNG_H
  455. #define PNG_H
  456. /* This is not the place to learn how to use libpng. The file libpng.txt
  457. * describes how to use libpng, and the file example.c summarizes it
  458. * with some code on which to build. This file is useful for looking
  459. * at the actual function definitions and structure components.
  460. */
  461. /* Version information for png.h - this should match the version in png.c */
  462. #define PNG_LIBPNG_VER_STRING "1.2.44"
  463. #define PNG_HEADER_VERSION_STRING \
  464. " libpng version 1.2.44 - June 26, 2010\n"
  465. #define PNG_LIBPNG_VER_SONUM 0
  466. #define PNG_LIBPNG_VER_DLLNUM 13
  467. /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
  468. #define PNG_LIBPNG_VER_MAJOR 1
  469. #define PNG_LIBPNG_VER_MINOR 2
  470. #define PNG_LIBPNG_VER_RELEASE 44
  471. /* This should match the numeric part of the final component of
  472. * PNG_LIBPNG_VER_STRING, omitting any leading zero:
  473. */
  474. #define PNG_LIBPNG_VER_BUILD 0
  475. /* Release Status */
  476. #define PNG_LIBPNG_BUILD_ALPHA 1
  477. #define PNG_LIBPNG_BUILD_BETA 2
  478. #define PNG_LIBPNG_BUILD_RC 3
  479. #define PNG_LIBPNG_BUILD_STABLE 4
  480. #define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7
  481. /* Release-Specific Flags */
  482. #define PNG_LIBPNG_BUILD_PATCH 8 /* Can be OR'ed with
  483. PNG_LIBPNG_BUILD_STABLE only */
  484. #define PNG_LIBPNG_BUILD_PRIVATE 16 /* Cannot be OR'ed with
  485. PNG_LIBPNG_BUILD_SPECIAL */
  486. #define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
  487. PNG_LIBPNG_BUILD_PRIVATE */
  488. #define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
  489. /* Careful here. At one time, Guy wanted to use 082, but that would be octal.
  490. * We must not include leading zeros.
  491. * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
  492. * version 1.0.0 was mis-numbered 100 instead of 10000). From
  493. * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
  494. */
  495. #define PNG_LIBPNG_VER 10244 /* 1.2.44 */
  496. #ifndef PNG_VERSION_INFO_ONLY
  497. /* Include the compression library's header */
  498. #include "zlib.h"
  499. #endif
  500. /* Include all user configurable info, including optional assembler routines */
  501. #include "pngconf.h"
  502. /*
  503. * Added at libpng-1.2.8 */
  504. /* Ref MSDN: Private as priority over Special
  505. * VS_FF_PRIVATEBUILD File *was not* built using standard release
  506. * procedures. If this value is given, the StringFileInfo block must
  507. * contain a PrivateBuild string.
  508. *
  509. * VS_FF_SPECIALBUILD File *was* built by the original company using
  510. * standard release procedures but is a variation of the standard
  511. * file of the same version number. If this value is given, the
  512. * StringFileInfo block must contain a SpecialBuild string.
  513. */
  514. #ifdef PNG_USER_PRIVATEBUILD
  515. # define PNG_LIBPNG_BUILD_TYPE \
  516. (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE)
  517. #else
  518. # ifdef PNG_LIBPNG_SPECIALBUILD
  519. # define PNG_LIBPNG_BUILD_TYPE \
  520. (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL)
  521. # else
  522. # define PNG_LIBPNG_BUILD_TYPE (PNG_LIBPNG_BUILD_BASE_TYPE)
  523. # endif
  524. #endif
  525. #ifndef PNG_VERSION_INFO_ONLY
  526. /* Inhibit C++ name-mangling for libpng functions but not for system calls. */
  527. #ifdef __cplusplus
  528. extern "C" {
  529. #endif /* __cplusplus */
  530. /* This file is arranged in several sections. The first section contains
  531. * structure and type definitions. The second section contains the external
  532. * library functions, while the third has the internal library functions,
  533. * which applications aren't expected to use directly.
  534. */
  535. #ifndef PNG_NO_TYPECAST_NULL
  536. #define int_p_NULL (int *)NULL
  537. #define png_bytep_NULL (png_bytep)NULL
  538. #define png_bytepp_NULL (png_bytepp)NULL
  539. #define png_doublep_NULL (png_doublep)NULL
  540. #define png_error_ptr_NULL (png_error_ptr)NULL
  541. #define png_flush_ptr_NULL (png_flush_ptr)NULL
  542. #define png_free_ptr_NULL (png_free_ptr)NULL
  543. #define png_infopp_NULL (png_infopp)NULL
  544. #define png_malloc_ptr_NULL (png_malloc_ptr)NULL
  545. #define png_read_status_ptr_NULL (png_read_status_ptr)NULL
  546. #define png_rw_ptr_NULL (png_rw_ptr)NULL
  547. #define png_structp_NULL (png_structp)NULL
  548. #define png_uint_16p_NULL (png_uint_16p)NULL
  549. #define png_voidp_NULL (png_voidp)NULL
  550. #define png_write_status_ptr_NULL (png_write_status_ptr)NULL
  551. #else
  552. #define int_p_NULL NULL
  553. #define png_bytep_NULL NULL
  554. #define png_bytepp_NULL NULL
  555. #define png_doublep_NULL NULL
  556. #define png_error_ptr_NULL NULL
  557. #define png_flush_ptr_NULL NULL
  558. #define png_free_ptr_NULL NULL
  559. #define png_infopp_NULL NULL
  560. #define png_malloc_ptr_NULL NULL
  561. #define png_read_status_ptr_NULL NULL
  562. #define png_rw_ptr_NULL NULL
  563. #define png_structp_NULL NULL
  564. #define png_uint_16p_NULL NULL
  565. #define png_voidp_NULL NULL
  566. #define png_write_status_ptr_NULL NULL
  567. #endif
  568. /* Variables declared in png.c - only it needs to define PNG_NO_EXTERN */
  569. #if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
  570. /* Version information for C files, stored in png.c. This had better match
  571. * the version above.
  572. */
  573. #ifdef PNG_USE_GLOBAL_ARRAYS
  574. PNG_EXPORT_VAR (PNG_CONST char) png_libpng_ver[18];
  575. /* Need room for 99.99.99beta99z */
  576. #else
  577. #define png_libpng_ver png_get_header_ver(NULL)
  578. #endif
  579. #ifdef PNG_USE_GLOBAL_ARRAYS
  580. /* This was removed in version 1.0.5c */
  581. /* Structures to facilitate easy interlacing. See png.c for more details */
  582. PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_start[7];
  583. PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_inc[7];
  584. PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_ystart[7];
  585. PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_yinc[7];
  586. PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_mask[7];
  587. PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_dsp_mask[7];
  588. /* This isn't currently used. If you need it, see png.c for more details.
  589. PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_height[7];
  590. */
  591. #endif
  592. #endif /* PNG_NO_EXTERN */
  593. /* Three color definitions. The order of the red, green, and blue, (and the
  594. * exact size) is not important, although the size of the fields need to
  595. * be png_byte or png_uint_16 (as defined below).
  596. */
  597. typedef struct png_color_struct
  598. {
  599. png_byte red;
  600. png_byte green;
  601. png_byte blue;
  602. } png_color;
  603. typedef png_color FAR * png_colorp;
  604. typedef png_color FAR * FAR * png_colorpp;
  605. typedef struct png_color_16_struct
  606. {
  607. png_byte index; /* used for palette files */
  608. png_uint_16 red; /* for use in red green blue files */
  609. png_uint_16 green;
  610. png_uint_16 blue;
  611. png_uint_16 gray; /* for use in grayscale files */
  612. } png_color_16;
  613. typedef png_color_16 FAR * png_color_16p;
  614. typedef png_color_16 FAR * FAR * png_color_16pp;
  615. typedef struct png_color_8_struct
  616. {
  617. png_byte red; /* for use in red green blue files */
  618. png_byte green;
  619. png_byte blue;
  620. png_byte gray; /* for use in grayscale files */
  621. png_byte alpha; /* for alpha channel files */
  622. } png_color_8;
  623. typedef png_color_8 FAR * png_color_8p;
  624. typedef png_color_8 FAR * FAR * png_color_8pp;
  625. /*
  626. * The following two structures are used for the in-core representation
  627. * of sPLT chunks.
  628. */
  629. typedef struct png_sPLT_entry_struct
  630. {
  631. png_uint_16 red;
  632. png_uint_16 green;
  633. png_uint_16 blue;
  634. png_uint_16 alpha;
  635. png_uint_16 frequency;
  636. } png_sPLT_entry;
  637. typedef png_sPLT_entry FAR * png_sPLT_entryp;
  638. typedef png_sPLT_entry FAR * FAR * png_sPLT_entrypp;
  639. /* When the depth of the sPLT palette is 8 bits, the color and alpha samples
  640. * occupy the LSB of their respective members, and the MSB of each member
  641. * is zero-filled. The frequency member always occupies the full 16 bits.
  642. */
  643. typedef struct png_sPLT_struct
  644. {
  645. png_charp name; /* palette name */
  646. png_byte depth; /* depth of palette samples */
  647. png_sPLT_entryp entries; /* palette entries */
  648. png_int_32 nentries; /* number of palette entries */
  649. } png_sPLT_t;
  650. typedef png_sPLT_t FAR * png_sPLT_tp;
  651. typedef png_sPLT_t FAR * FAR * png_sPLT_tpp;
  652. #ifdef PNG_TEXT_SUPPORTED
  653. /* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file,
  654. * and whether that contents is compressed or not. The "key" field
  655. * points to a regular zero-terminated C string. The "text", "lang", and
  656. * "lang_key" fields can be regular C strings, empty strings, or NULL pointers.
  657. * However, the * structure returned by png_get_text() will always contain
  658. * regular zero-terminated C strings (possibly empty), never NULL pointers,
  659. * so they can be safely used in printf() and other string-handling functions.
  660. */
  661. typedef struct png_text_struct
  662. {
  663. int compression; /* compression value:
  664. -1: tEXt, none
  665. 0: zTXt, deflate
  666. 1: iTXt, none
  667. 2: iTXt, deflate */
  668. png_charp key; /* keyword, 1-79 character description of "text" */
  669. png_charp text; /* comment, may be an empty string (ie "")
  670. or a NULL pointer */
  671. png_size_t text_length; /* length of the text string */
  672. #ifdef PNG_iTXt_SUPPORTED
  673. png_size_t itxt_length; /* length of the itxt string */
  674. png_charp lang; /* language code, 0-79 characters
  675. or a NULL pointer */
  676. png_charp lang_key; /* keyword translated UTF-8 string, 0 or more
  677. chars or a NULL pointer */
  678. #endif
  679. } png_text;
  680. typedef png_text FAR * png_textp;
  681. typedef png_text FAR * FAR * png_textpp;
  682. #endif
  683. /* Supported compression types for text in PNG files (tEXt, and zTXt).
  684. * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed.
  685. */
  686. #define PNG_TEXT_COMPRESSION_NONE_WR -3
  687. #define PNG_TEXT_COMPRESSION_zTXt_WR -2
  688. #define PNG_TEXT_COMPRESSION_NONE -1
  689. #define PNG_TEXT_COMPRESSION_zTXt 0
  690. #define PNG_ITXT_COMPRESSION_NONE 1
  691. #define PNG_ITXT_COMPRESSION_zTXt 2
  692. #define PNG_TEXT_COMPRESSION_LAST 3 /* Not a valid value */
  693. /* png_time is a way to hold the time in an machine independent way.
  694. * Two conversions are provided, both from time_t and struct tm. There
  695. * is no portable way to convert to either of these structures, as far
  696. * as I know. If you know of a portable way, send it to me. As a side
  697. * note - PNG has always been Year 2000 compliant!
  698. */
  699. typedef struct png_time_struct
  700. {
  701. png_uint_16 year; /* full year, as in, 1995 */
  702. png_byte month; /* month of year, 1 - 12 */
  703. png_byte day; /* day of month, 1 - 31 */
  704. png_byte hour; /* hour of day, 0 - 23 */
  705. png_byte minute; /* minute of hour, 0 - 59 */
  706. png_byte second; /* second of minute, 0 - 60 (for leap seconds) */
  707. } png_time;
  708. typedef png_time FAR * png_timep;
  709. typedef png_time FAR * FAR * png_timepp;
  710. #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
  711. defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
  712. /* png_unknown_chunk is a structure to hold queued chunks for which there is
  713. * no specific support. The idea is that we can use this to queue
  714. * up private chunks for output even though the library doesn't actually
  715. * know about their semantics.
  716. */
  717. #define PNG_CHUNK_NAME_LENGTH 5
  718. typedef struct png_unknown_chunk_t
  719. {
  720. png_byte name[PNG_CHUNK_NAME_LENGTH];
  721. png_byte *data;
  722. png_size_t size;
  723. /* libpng-using applications should NOT directly modify this byte. */
  724. png_byte location; /* mode of operation at read time */
  725. }
  726. png_unknown_chunk;
  727. typedef png_unknown_chunk FAR * png_unknown_chunkp;
  728. typedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp;
  729. #endif
  730. #ifdef PNG_INDEX_SUPPORTED
  731. /* png_line_index_struct records an index point, where we impose an index point
  732. * to be located at the beginning of a line for simplifying the implementation.
  733. */
  734. typedef struct png_line_index_struct
  735. {
  736. // state of the lz decoder
  737. z_streamp z_state;
  738. // the IDAT header position of the chunk, which the index point is in
  739. png_uint_32 stream_idat_position;
  740. // we intend to record the offset of the index point in the chunk,
  741. // but we record the number of remaining bytes in the chunk after the
  742. // index point. That's because PNG processes a chunk this way.
  743. png_uint_32 bytes_left_in_idat;
  744. // decompressed data of the previous row
  745. png_bytep prev_row;
  746. } png_line_index;
  747. typedef png_line_index FAR * png_line_indexp;
  748. typedef struct png_index_struct
  749. {
  750. // A temporary variable used when we build the index. The variable records
  751. // the IDAT header position of the last chunk read in so far.
  752. png_uint_32 stream_idat_position;
  753. // line index information about each passes
  754. // the number of index points in each pass
  755. png_uint_32 size[7];
  756. // the line span of two index points of each pass
  757. png_uint_32 step[7];
  758. // the index points of each pass
  759. png_line_indexp *pass_line_index[7];
  760. } png_index;
  761. typedef png_index FAR * png_indexp;
  762. #define INDEX_SAMPLE_SIZE 254
  763. #endif
  764. /* png_info is a structure that holds the information in a PNG file so
  765. * that the application can find out the characteristics of the image.
  766. * If you are reading the file, this structure will tell you what is
  767. * in the PNG file. If you are writing the file, fill in the information
  768. * you want to put into the PNG file, then call png_write_info().
  769. * The names chosen should be very close to the PNG specification, so
  770. * consult that document for information about the meaning of each field.
  771. *
  772. * With libpng < 0.95, it was only possible to directly set and read the
  773. * the values in the png_info_struct, which meant that the contents and
  774. * order of the values had to remain fixed. With libpng 0.95 and later,
  775. * however, there are now functions that abstract the contents of
  776. * png_info_struct from the application, so this makes it easier to use
  777. * libpng with dynamic libraries, and even makes it possible to use
  778. * libraries that don't have all of the libpng ancillary chunk-handing
  779. * functionality.
  780. *
  781. * In any case, the order of the parameters in png_info_struct should NOT
  782. * be changed for as long as possible to keep compatibility with applications
  783. * that use the old direct-access method with png_info_struct.
  784. *
  785. * The following members may have allocated storage attached that should be
  786. * cleaned up before the structure is discarded: palette, trans, text,
  787. * pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
  788. * splt_palettes, scal_unit, row_pointers, and unknowns. By default, these
  789. * are automatically freed when the info structure is deallocated, if they were
  790. * allocated internally by libpng. This behavior can be changed by means
  791. * of the png_data_freer() function.
  792. *
  793. * More allocation details: all the chunk-reading functions that
  794. * change these members go through the corresponding png_set_*
  795. * functions. A function to clear these members is available: see
  796. * png_free_data(). The png_set_* functions do not depend on being
  797. * able to point info structure members to any of the storage they are
  798. * passed (they make their own copies), EXCEPT that the png_set_text
  799. * functions use the same storage passed to them in the text_ptr or
  800. * itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
  801. * functions do not make their own copies.
  802. */
  803. typedef struct png_info_struct
  804. {
  805. /* The following are necessary for every PNG file */
  806. png_uint_32 width PNG_DEPSTRUCT; /* width of image in pixels (from IHDR) */
  807. png_uint_32 height PNG_DEPSTRUCT; /* height of image in pixels (from IHDR) */
  808. png_uint_32 valid PNG_DEPSTRUCT; /* valid chunk data (see PNG_INFO_ below) */
  809. png_uint_32 rowbytes PNG_DEPSTRUCT; /* bytes needed to hold an untransformed row */
  810. png_colorp palette PNG_DEPSTRUCT; /* array of color values (valid & PNG_INFO_PLTE) */
  811. png_uint_16 num_palette PNG_DEPSTRUCT; /* number of color entries in "palette" (PLTE) */
  812. png_uint_16 num_trans PNG_DEPSTRUCT; /* number of transparent palette color (tRNS) */
  813. png_byte bit_depth PNG_DEPSTRUCT; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
  814. png_byte color_type PNG_DEPSTRUCT; /* see PNG_COLOR_TYPE_ below (from IHDR) */
  815. /* The following three should have been named *_method not *_type */
  816. png_byte compression_type PNG_DEPSTRUCT; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
  817. png_byte filter_type PNG_DEPSTRUCT; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
  818. png_byte interlace_type PNG_DEPSTRUCT; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
  819. /* The following is informational only on read, and not used on writes. */
  820. png_byte channels PNG_DEPSTRUCT; /* number of data channels per pixel (1, 2, 3, 4) */
  821. png_byte pixel_depth PNG_DEPSTRUCT; /* number of bits per pixel */
  822. png_byte spare_byte PNG_DEPSTRUCT; /* to align the data, and for future use */
  823. png_byte signature[8] PNG_DEPSTRUCT; /* magic bytes read by libpng from start of file */
  824. /* The rest of the data is optional. If you are reading, check the
  825. * valid field to see if the information in these are valid. If you
  826. * are writing, set the valid field to those chunks you want written,
  827. * and initialize the appropriate fields below.
  828. */
  829. #if defined(PNG_gAMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
  830. /* The gAMA chunk describes the gamma characteristics of the system
  831. * on which the image was created, normally in the range [1.0, 2.5].
  832. * Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
  833. */
  834. float gamma PNG_DEPSTRUCT; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
  835. #endif
  836. #ifdef PNG_sRGB_SUPPORTED
  837. /* GR-P, 0.96a */
  838. /* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
  839. png_byte srgb_intent PNG_DEPSTRUCT; /* sRGB rendering intent [0, 1, 2, or 3] */
  840. #endif
  841. #ifdef PNG_TEXT_SUPPORTED
  842. /* The tEXt, and zTXt chunks contain human-readable textual data in
  843. * uncompressed, compressed, and optionally compressed forms, respectively.
  844. * The data in "text" is an array of pointers to uncompressed,
  845. * null-terminated C strings. Each chunk has a keyword that describes the
  846. * textual data contained in that chunk. Keywords are not required to be
  847. * unique, and the text string may be empty. Any number of text chunks may
  848. * be in an image.
  849. */
  850. int num_text PNG_DEPSTRUCT; /* number of comments read/to write */
  851. int max_text PNG_DEPSTRUCT; /* current size of text array */
  852. png_textp text PNG_DEPSTRUCT; /* array of comments read/to write */
  853. #endif /* PNG_TEXT_SUPPORTED */
  854. #ifdef PNG_tIME_SUPPORTED
  855. /* The tIME chunk holds the last time the displayed image data was
  856. * modified. See the png_time struct for the contents of this struct.
  857. */
  858. png_time mod_time PNG_DEPSTRUCT;
  859. #endif
  860. #ifdef PNG_sBIT_SUPPORTED
  861. /* The sBIT chunk specifies the number of significant high-order bits
  862. * in the pixel data. Values are in the range [1, bit_depth], and are
  863. * only specified for the channels in the pixel data. The contents of
  864. * the low-order bits is not specified. Data is valid if
  865. * (valid & PNG_INFO_sBIT) is non-zero.
  866. */
  867. png_color_8 sig_bit PNG_DEPSTRUCT; /* significant bits in color channels */
  868. #endif
  869. #if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
  870. defined(PNG_READ_BACKGROUND_SUPPORTED)
  871. /* The tRNS chunk supplies transparency data for paletted images and
  872. * other image types that don't need a full alpha channel. There are
  873. * "num_trans" transparency values for a paletted image, stored in the
  874. * same order as the palette colors, starting from index 0. Values
  875. * for the data are in the range [0, 255], ranging from fully transparent
  876. * to fully opaque, respectively. For non-paletted images, there is a
  877. * single color specified that should be treated as fully transparent.
  878. * Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
  879. */
  880. png_bytep trans PNG_DEPSTRUCT; /* transparent values for paletted image */
  881. png_color_16 trans_values PNG_DEPSTRUCT; /* transparent color for non-palette image */
  882. #endif
  883. #if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
  884. /* The bKGD chunk gives the suggested image background color if the
  885. * display program does not have its own background color and the image
  886. * is needs to composited onto a background before display. The colors
  887. * in "background" are normally in the same color space/depth as the
  888. * pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
  889. */
  890. png_color_16 background PNG_DEPSTRUCT;
  891. #endif
  892. #ifdef PNG_oFFs_SUPPORTED
  893. /* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
  894. * and downwards from the top-left corner of the display, page, or other
  895. * application-specific co-ordinate space. See the PNG_OFFSET_ defines
  896. * below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero.
  897. */
  898. png_int_32 x_offset PNG_DEPSTRUCT; /* x offset on page */
  899. png_int_32 y_offset PNG_DEPSTRUCT; /* y offset on page */
  900. png_byte offset_unit_type PNG_DEPSTRUCT; /* offset units type */
  901. #endif
  902. #ifdef PNG_pHYs_SUPPORTED
  903. /* The pHYs chunk gives the physical pixel density of the image for
  904. * display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
  905. * defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
  906. */
  907. png_uint_32 x_pixels_per_unit PNG_DEPSTRUCT; /* horizontal pixel density */
  908. png_uint_32 y_pixels_per_unit PNG_DEPSTRUCT; /* vertical pixel density */
  909. png_byte phys_unit_type PNG_DEPSTRUCT; /* resolution type (see PNG_RESOLUTION_ below) */
  910. #endif
  911. #ifdef PNG_hIST_SUPPORTED
  912. /* The hIST chunk contains the relative frequency or importance of the
  913. * various palette entries, so that a viewer can intelligently select a
  914. * reduced-color palette, if required. Data is an array of "num_palette"
  915. * values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
  916. * is non-zero.
  917. */
  918. png_uint_16p hist PNG_DEPSTRUCT;
  919. #endif
  920. #ifdef PNG_cHRM_SUPPORTED
  921. /* The cHRM chunk describes the CIE color characteristics of the monitor
  922. * on which the PNG was created. This data allows the viewer to do gamut
  923. * mapping of the input image to ensure that the viewer sees the same
  924. * colors in the image as the creator. Values are in the range
  925. * [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero.
  926. */
  927. #ifdef PNG_FLOATING_POINT_SUPPORTED
  928. float x_white PNG_DEPSTRUCT;
  929. float y_white PNG_DEPSTRUCT;
  930. float x_red PNG_DEPSTRUCT;
  931. float y_red PNG_DEPSTRUCT;
  932. float x_green PNG_DEPSTRUCT;
  933. float y_green PNG_DEPSTRUCT;
  934. float x_blue PNG_DEPSTRUCT;
  935. float y_blue PNG_DEPSTRUCT;
  936. #endif
  937. #endif
  938. #ifdef PNG_pCAL_SUPPORTED
  939. /* The pCAL chunk describes a transformation between the stored pixel
  940. * values and original physical data values used to create the image.
  941. * The integer range [0, 2^bit_depth - 1] maps to the floating-point
  942. * range given by [pcal_X0, pcal_X1], and are further transformed by a
  943. * (possibly non-linear) transformation function given by "pcal_type"
  944. * and "pcal_params" into "pcal_units". Please see the PNG_EQUATION_
  945. * defines below, and the PNG-Group's PNG extensions document for a
  946. * complete description of the transformations and how they should be
  947. * implemented, and for a description of the ASCII parameter strings.
  948. * Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
  949. */
  950. png_charp pcal_purpose PNG_DEPSTRUCT; /* pCAL chunk description string */
  951. png_int_32 pcal_X0 PNG_DEPSTRUCT; /* minimum value */
  952. png_int_32 pcal_X1 PNG_DEPSTRUCT; /* maximum value */
  953. png_charp pcal_units PNG_DEPSTRUCT; /* Latin-1 string giving physical units */
  954. png_charpp pcal_params PNG_DEPSTRUCT; /* ASCII strings containing parameter values */
  955. png_byte pcal_type PNG_DEPSTRUCT; /* equation type (see PNG_EQUATION_ below) */
  956. png_byte pcal_nparams PNG_DEPSTRUCT; /* number of parameters given in pcal_params */
  957. #endif
  958. /* New members added in libpng-1.0.6 */
  959. #ifdef PNG_FREE_ME_SUPPORTED
  960. png_uint_32 free_me PNG_DEPSTRUCT; /* flags items libpng is responsible for freeing */
  961. #endif
  962. #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
  963. defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
  964. /* Storage for unknown chunks that the library doesn't recognize. */
  965. png_unknown_chunkp unknown_chunks PNG_DEPSTRUCT;
  966. png_size_t unknown_chunks_num PNG_DEPSTRUCT;
  967. #endif
  968. #ifdef PNG_iCCP_SUPPORTED
  969. /* iCCP chunk data. */
  970. png_charp iccp_name PNG_DEPSTRUCT; /* profile name */
  971. png_charp iccp_profile PNG_DEPSTRUCT; /* International Color Consortium profile data */
  972. /* Note to maintainer: should be png_bytep */
  973. png_uint_32 iccp_proflen PNG_DEPSTRUCT; /* ICC profile data length */
  974. png_byte iccp_compression PNG_DEPSTRUCT; /* Always zero */
  975. #endif
  976. #ifdef PNG_sPLT_SUPPORTED
  977. /* Data on sPLT chunks (there may be more than one). */
  978. png_sPLT_tp splt_palettes PNG_DEPSTRUCT;
  979. png_uint_32 splt_palettes_num PNG_DEPSTRUCT;
  980. #endif
  981. #ifdef PNG_sCAL_SUPPORTED
  982. /* The sCAL chunk describes the actual physical dimensions of the
  983. * subject matter of the graphic. The chunk contains a unit specification
  984. * a byte value, and two ASCII strings representing floating-point
  985. * values. The values are width and height corresponsing to one pixel
  986. * in the image. This external representation is converted to double
  987. * here. Data values are valid if (valid & PNG_INFO_sCAL) is non-zero.
  988. */
  989. png_byte scal_unit PNG_DEPSTRUCT; /* unit of physical scale */
  990. #ifdef PNG_FLOATING_POINT_SUPPORTED
  991. double scal_pixel_width PNG_DEPSTRUCT; /* width of one pixel */
  992. double scal_pixel_height PNG_DEPSTRUCT; /* height of one pixel */
  993. #endif
  994. #ifdef PNG_FIXED_POINT_SUPPORTED
  995. png_charp scal_s_width PNG_DEPSTRUCT; /* string containing height */
  996. png_charp scal_s_height PNG_DEPSTRUCT; /* string containing width */
  997. #endif
  998. #endif
  999. #ifdef PNG_INFO_IMAGE_SUPPORTED
  1000. /* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS) non-zero */
  1001. /* Data valid if (valid & PNG_INFO_IDAT) non-zero */
  1002. png_bytepp row_pointers PNG_DEPSTRUCT; /* the image bits */
  1003. #endif
  1004. #if defined(PNG_FIXED_POINT_SUPPORTED) && defined(PNG_gAMA_SUPPORTED)
  1005. png_fixed_point int_gamma PNG_DEPSTRUCT; /* gamma of image, if (valid & PNG_INFO_gAMA) */
  1006. #endif
  1007. #if defined(PNG_cHRM_SUPPORTED) && defined(PNG_FIXED_POINT_SUPPORTED)
  1008. png_fixed_point int_x_white PNG_DEPSTRUCT;
  1009. png_fixed_point int_y_white PNG_DEPSTRUCT;
  1010. png_fixed_point int_x_red PNG_DEPSTRUCT;
  1011. png_fixed_point int_y_red PNG_DEPSTRUCT;
  1012. png_fixed_point int_x_green PNG_DEPSTRUCT;
  1013. png_fixed_point int_y_green PNG_DEPSTRUCT;
  1014. png_fixed_point int_x_blue PNG_DEPSTRUCT;
  1015. png_fixed_point int_y_blue PNG_DEPSTRUCT;
  1016. #endif
  1017. } png_info;
  1018. typedef png_info FAR * png_infop;
  1019. typedef png_info FAR * FAR * png_infopp;
  1020. /* Maximum positive integer used in PNG is (2^31)-1 */
  1021. #define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
  1022. #define PNG_UINT_32_MAX ((png_uint_32)(-1))
  1023. #define PNG_SIZE_MAX ((png_size_t)(-1))
  1024. #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
  1025. /* PNG_MAX_UINT is deprecated; use PNG_UINT_31_MAX instead. */
  1026. #define PNG_MAX_UINT PNG_UINT_31_MAX
  1027. #endif
  1028. /* These describe the color_type field in png_info. */
  1029. /* color type masks */
  1030. #define PNG_COLOR_MASK_PALETTE 1
  1031. #define PNG_COLOR_MASK_COLOR 2
  1032. #define PNG_COLOR_MASK_ALPHA 4
  1033. /* color types. Note that not all combinations are legal */
  1034. #define PNG_COLOR_TYPE_GRAY 0
  1035. #define PNG_COLOR_TYPE_PALETTE (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  1036. #define PNG_COLOR_TYPE_RGB (PNG_COLOR_MASK_COLOR)
  1037. #define PNG_COLOR_TYPE_RGB_ALPHA (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  1038. #define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
  1039. /* aliases */
  1040. #define PNG_COLOR_TYPE_RGBA PNG_COLOR_TYPE_RGB_ALPHA
  1041. #define PNG_COLOR_TYPE_GA PNG_COLOR_TYPE_GRAY_ALPHA
  1042. /* This is for compression type. PNG 1.0-1.2 only define the single type. */
  1043. #define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */
  1044. #define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE
  1045. /* This is for filter type. PNG 1.0-1.2 only define the single type. */
  1046. #define PNG_FILTER_TYPE_BASE 0 /* Single row per-byte filtering */
  1047. #define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */
  1048. #define PNG_FILTER_TYPE_DEFAULT PNG_FILTER_TYPE_BASE
  1049. /* These are for the interlacing type. These values should NOT be changed. */
  1050. #define PNG_INTERLACE_NONE 0 /* Non-interlaced image */
  1051. #define PNG_INTERLACE_ADAM7 1 /* Adam7 interlacing */
  1052. #define PNG_INTERLACE_LAST 2 /* Not a valid value */
  1053. /* These are for the oFFs chunk. These values should NOT be changed. */
  1054. #define PNG_OFFSET_PIXEL 0 /* Offset in pixels */
  1055. #define PNG_OFFSET_MICROMETER 1 /* Offset in micrometers (1/10^6 meter) */
  1056. #define PNG_OFFSET_LAST 2 /* Not a valid value */
  1057. /* These are for the pCAL chunk. These values should NOT be changed. */
  1058. #define PNG_EQUATION_LINEAR 0 /* Linear transformation */
  1059. #define PNG_EQUATION_BASE_E 1 /* Exponential base e transform */
  1060. #define PNG_EQUATION_ARBITRARY 2 /* Arbitrary base exponential transform */
  1061. #define PNG_EQUATION_HYPERBOLIC 3 /* Hyperbolic sine transformation */
  1062. #define PNG_EQUATION_LAST 4 /* Not a valid value */
  1063. /* These are for the sCAL chunk. These values should NOT be changed. */
  1064. #define PNG_SCALE_UNKNOWN 0 /* unknown unit (image scale) */
  1065. #define PNG_SCALE_METER 1 /* meters per pixel */
  1066. #define PNG_SCALE_RADIAN 2 /* radians per pixel */
  1067. #define PNG_SCALE_LAST 3 /* Not a valid value */
  1068. /* These are for the pHYs chunk. These values should NOT be changed. */
  1069. #define PNG_RESOLUTION_UNKNOWN 0 /* pixels/unknown unit (aspect ratio) */
  1070. #define PNG_RESOLUTION_METER 1 /* pixels/meter */
  1071. #define PNG_RESOLUTION_LAST 2 /* Not a valid value */
  1072. /* These are for the sRGB chunk. These values should NOT be changed. */
  1073. #define PNG_sRGB_INTENT_PERCEPTUAL 0
  1074. #define PNG_sRGB_INTENT_RELATIVE 1
  1075. #define PNG_sRGB_INTENT_SATURATION 2
  1076. #define PNG_sRGB_INTENT_ABSOLUTE 3
  1077. #define PNG_sRGB_INTENT_LAST 4 /* Not a valid value */
  1078. /* This is for text chunks */
  1079. #define PNG_KEYWORD_MAX_LENGTH 79
  1080. /* Maximum number of entries in PLTE/sPLT/tRNS arrays */
  1081. #define PNG_MAX_PALETTE_LENGTH 256
  1082. /* These determine if an ancillary chunk's data has been successfully read
  1083. * from the PNG header, or if the application has filled in the corresponding
  1084. * data in the info_struct to be written into the output file. The values
  1085. * of the PNG_INFO_<chunk> defines should NOT be changed.
  1086. */
  1087. #define PNG_INFO_gAMA 0x0001
  1088. #define PNG_INFO_sBIT 0x0002
  1089. #define PNG_INFO_cHRM 0x0004
  1090. #define PNG_INFO_PLTE 0x0008
  1091. #define PNG_INFO_tRNS 0x0010
  1092. #define PNG_INFO_bKGD 0x0020
  1093. #define PNG_INFO_hIST 0x0040
  1094. #define PNG_INFO_pHYs 0x0080
  1095. #define PNG_INFO_oFFs 0x0100
  1096. #define PNG_INFO_tIME 0x0200
  1097. #define PNG_INFO_pCAL 0x0400
  1098. #define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */
  1099. #define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */
  1100. #define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
  1101. #define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
  1102. #define PNG_INFO_IDAT 0x8000L /* ESR, 1.0.6 */
  1103. /* This is used for the transformation routines, as some of them
  1104. * change these values for the row. It also should enable using
  1105. * the routines for other purposes.
  1106. */
  1107. typedef struct png_row_info_struct
  1108. {
  1109. png_uint_32 width; /* width of row */
  1110. png_uint_32 rowbytes; /* number of bytes in row */
  1111. png_byte color_type; /* color type of row */
  1112. png_byte bit_depth; /* bit depth of row */
  1113. png_byte channels; /* number of channels (1, 2, 3, or 4) */
  1114. png_byte pixel_depth; /* bits per pixel (depth * channels) */
  1115. } png_row_info;
  1116. typedef png_row_info FAR * png_row_infop;
  1117. typedef png_row_info FAR * FAR * png_row_infopp;
  1118. /* These are the function types for the I/O functions and for the functions
  1119. * that allow the user to override the default I/O functions with his or her
  1120. * own. The png_error_ptr type should match that of user-supplied warning
  1121. * and error functions, while the png_rw_ptr type should match that of the
  1122. * user read/write data functions.
  1123. */
  1124. typedef struct png_struct_def png_struct;
  1125. typedef png_struct FAR * png_structp;
  1126. typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp));
  1127. typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t));
  1128. #ifdef PNG_INDEX_SUPPORTED
  1129. typedef void (PNGAPI *png_seek_ptr) PNGARG((png_structp, png_uint_32));
  1130. #endif
  1131. typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp));
  1132. typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32,
  1133. int));
  1134. typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32,
  1135. int));
  1136. #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
  1137. typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp, png_infop));
  1138. typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop));
  1139. typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep,
  1140. png_uint_32, int));
  1141. #endif
  1142. #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
  1143. defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
  1144. defined(PNG_LEGACY_SUPPORTED)
  1145. typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp,
  1146. png_row_infop, png_bytep));
  1147. #endif
  1148. #ifdef PNG_USER_CHUNKS_SUPPORTED
  1149. typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp));
  1150. #endif
  1151. #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
  1152. typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
  1153. #endif
  1154. /* Transform masks for the high-level interface */
  1155. #define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */
  1156. #define PNG_TRANSFORM_STRIP_16 0x0001 /* read only */
  1157. #define PNG_TRANSFORM_STRIP_ALPHA 0x0002 /* read only */
  1158. #define PNG_TRANSFORM_PACKING 0x0004 /* read and write */
  1159. #define PNG_TRANSFORM_PACKSWAP 0x0008 /* read and write */
  1160. #define PNG_TRANSFORM_EXPAND 0x0010 /* read only */
  1161. #define PNG_TRANSFORM_INVERT_MONO 0x0020 /* read and write */
  1162. #define PNG_TRANSFORM_SHIFT 0x0040 /* read and write */
  1163. #define PNG_TRANSFORM_BGR 0x0080 /* read and write */
  1164. #define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */
  1165. #define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */
  1166. #define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */
  1167. #define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* write only, deprecated */
  1168. /* Added to libpng-1.2.34 */
  1169. #define PNG_TRANSFORM_STRIP_FILLER_BEFORE 0x0800 /* write only */
  1170. #define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* write only */
  1171. /* Added to libpng-1.2.41 */
  1172. #define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */
  1173. /* Flags for MNG supported features */
  1174. #define PNG_FLAG_MNG_EMPTY_PLTE 0x01
  1175. #define PNG_FLAG_MNG_FILTER_64 0x04
  1176. #define PNG_ALL_MNG_FEATURES 0x05
  1177. typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t));
  1178. typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp));
  1179. /* The structure that holds the information to read and write PNG files.
  1180. * The only people who need to care about what is inside of this are the
  1181. * people who will be modifying the library for their own special needs.
  1182. * It should NOT be accessed directly by an application, except to store
  1183. * the jmp_buf.
  1184. */
  1185. struct png_struct_def
  1186. {
  1187. #ifdef PNG_SETJMP_SUPPORTED
  1188. jmp_buf jmpbuf; /* used in png_error */
  1189. #endif
  1190. png_error_ptr error_fn PNG_DEPSTRUCT; /* function for printing errors and aborting */
  1191. png_error_ptr warning_fn PNG_DEPSTRUCT; /* function for printing warnings */
  1192. png_voidp error_ptr PNG_DEPSTRUCT; /* user supplied struct for error functions */
  1193. png_rw_ptr write_data_fn PNG_DEPSTRUCT; /* function for writing output data */
  1194. png_rw_ptr read_data_fn PNG_DEPSTRUCT; /* function for reading input data */
  1195. #ifdef PNG_INDEX_SUPPORTED
  1196. png_seek_ptr seek_data_fn PNG_DEPSTRUCT; /* function for seeking input data */
  1197. #endif
  1198. png_voidp io_ptr PNG_DEPSTRUCT; /* ptr to application struct for I/O functions */
  1199. #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
  1200. png_user_transform_ptr read_user_transform_fn PNG_DEPSTRUCT; /* user read transform */
  1201. #endif
  1202. #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
  1203. png_user_transform_ptr write_user_transform_fn PNG_DEPSTRUCT; /* user write transform */
  1204. #endif
  1205. /* These were added in libpng-1.0.2 */
  1206. #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
  1207. #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
  1208. defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
  1209. png_voidp user_transform_ptr PNG_DEPSTRUCT; /* user supplied struct for user transform */
  1210. png_byte user_transform_depth PNG_DEPSTRUCT; /* bit depth of user transformed pixels */
  1211. png_byte user_transform_channels PNG_DEPSTRUCT; /* channels in user transformed pixels */
  1212. #endif
  1213. #endif
  1214. png_uint_32 mode PNG_DEPSTRUCT; /* tells us where we are in the PNG file */
  1215. png_uint_32 flags PNG_DEPSTRUCT; /* flags indicating various things to libpng */
  1216. png_uint_32 transformations PNG_DEPSTRUCT; /* which transformations to perform */
  1217. z_stream zstream PNG_DEPSTRUCT; /* pointer to decompression structure (below) */
  1218. png_bytep zbuf PNG_DEPSTRUCT; /* buffer for zlib */
  1219. png_size_t zbuf_size PNG_DEPSTRUCT; /* size of zbuf */
  1220. int zlib_level PNG_DEPSTRUCT; /* holds zlib compression level */
  1221. int zlib_method PNG_DEPSTRUCT; /* holds zlib compression method */
  1222. int zlib_window_bits PNG_DEPSTRUCT; /* holds zlib compression window bits */
  1223. int zlib_mem_level PNG_DEPSTRUCT; /* holds zlib compression memory level */
  1224. int zlib_strategy PNG_DEPSTRUCT; /* holds zlib compression strategy */
  1225. png_uint_32 width PNG_DEPSTRUCT; /* width of image in pixels */
  1226. png_uint_32 height PNG_DEPSTRUCT; /* height of image in pixels */
  1227. png_uint_32 num_rows PNG_DEPSTRUCT; /* number of rows in current pass */
  1228. png_uint_32 usr_width PNG_DEPSTRUCT; /* width of row at start of write */
  1229. png_uint_32 rowbytes PNG_DEPSTRUCT; /* size of row in bytes */
  1230. #if 0 /* Replaced with the following in libpng-1.2.43 */
  1231. png_size_t irowbytes PNG_DEPSTRUCT;
  1232. #endif
  1233. /* Added in libpng-1.2.43 */
  1234. #ifdef PNG_USER_LIMITS_SUPPORTED
  1235. /* Added in libpng-1.4.0: Total number of sPLT, text, and unknown
  1236. * chunks that can be stored (0 means unlimited).
  1237. */
  1238. png_uint_32 user_chunk_cache_max PNG_DEPSTRUCT;
  1239. #endif
  1240. png_uint_32 iwidth PNG_DEPSTRUCT; /* width of current interlaced row in pixels */
  1241. png_uint_32 row_number PNG_DEPSTRUCT; /* current row in interlace pass */
  1242. png_bytep prev_row PNG_DEPSTRUCT; /* buffer to save previous (unfiltered) row */
  1243. png_bytep row_buf PNG_DEPSTRUCT; /* buffer to save current (unfiltered) row */
  1244. #ifndef PNG_NO_WRITE_FILTER
  1245. png_bytep sub_row PNG_DEPSTRUCT; /* buffer to save "sub" row when filtering */
  1246. png_bytep up_row PNG_DEPSTRUCT; /* buffer to save "up" row when filtering */
  1247. png_bytep avg_row PNG_DEPSTRUCT; /* buffer to save "avg" row when filtering */
  1248. png_bytep paeth_row PNG_DEPSTRUCT; /* buffer to save "Paeth" row when filtering */
  1249. #endif
  1250. png_row_info row_info PNG_DEPSTRUCT; /* used for transformation routines */
  1251. png_uint_32 idat_size PNG_DEPSTRUCT; /* current IDAT size for read */
  1252. png_uint_32 crc PNG_DEPSTRUCT; /* current chunk CRC value */
  1253. png_colorp palette PNG_DEPSTRUCT; /* palette from the input file */
  1254. png_uint_16 num_palette PNG_DEPSTRUCT; /* number of color entries in palette */
  1255. png_uint_16 num_trans PNG_DEPSTRUCT; /* number of transparency values */
  1256. png_byte chunk_name[5] PNG_DEPSTRUCT; /* null-terminated name of current chunk */
  1257. png_byte compression PNG_DEPSTRUCT; /* file compression type (always 0) */
  1258. png_byte filter PNG_DEPSTRUCT; /* file filter type (always 0) */
  1259. png_byte interlaced PNG_DEPSTRUCT; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
  1260. png_byte pass PNG_DEPSTRUCT; /* current interlace pass (0 - 6) */
  1261. png_byte do_filter PNG_DEPSTRUCT; /* row filter flags (see PNG_FILTER_ below ) */
  1262. png_byte color_type PNG_DEPSTRUCT; /* color type of file */
  1263. png_byte bit_depth PNG_DEPSTRUCT; /* bit depth of file */
  1264. png_byte usr_bit_depth PNG_DEPSTRUCT; /* bit depth of users row */
  1265. png_byte pixel_depth PNG_DEPSTRUCT; /* number of bits per pixel */
  1266. png_byte channels PNG_DEPSTRUCT; /* number of channels in file */
  1267. png_byte usr_channels PNG_DEPSTRUCT; /* channels at start of write */
  1268. png_byte sig_bytes PNG_DEPSTRUCT; /* magic bytes read/written from start of file */
  1269. #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
  1270. #ifdef PNG_LEGACY_SUPPORTED
  1271. png_byte filler PNG_DEPSTRUCT; /* filler byte for pixel expansion */
  1272. #else
  1273. png_uint_16 filler PNG_DEPSTRUCT; /* filler bytes for pixel expansion */
  1274. #endif
  1275. #endif
  1276. #ifdef PNG_bKGD_SUPPORTED
  1277. png_byte background_gamma_type PNG_DEPSTRUCT;
  1278. # ifdef PNG_FLOATING_POINT_SUPPORTED
  1279. float background_gamma PNG_DEPSTRUCT;
  1280. # endif
  1281. png_color_16 background PNG_DEPSTRUCT; /* background color in screen gamma space */
  1282. #ifdef PNG_READ_GAMMA_SUPPORTED
  1283. png_color_16 background_1 PNG_DEPSTRUCT; /* background normalized to gamma 1.0 */
  1284. #endif
  1285. #endif /* PNG_bKGD_SUPPORTED */
  1286. #ifdef PNG_WRITE_FLUSH_SUPPORTED
  1287. png_flush_ptr output_flush_fn PNG_DEPSTRUCT; /* Function for flushing output */
  1288. png_uint_32 flush_dist PNG_DEPSTRUCT; /* how many rows apart to flush, 0 - no flush */
  1289. png_uint_32 flush_rows PNG_DEPSTRUCT; /* number of rows written since last flush */
  1290. #endif
  1291. #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
  1292. int gamma_shift PNG_DEPSTRUCT; /* number of "insignificant" bits 16-bit gamma */
  1293. #ifdef PNG_FLOATING_POINT_SUPPORTED
  1294. float gamma PNG_DEPSTRUCT; /* file gamma value */
  1295. float screen_gamma PNG_DEPSTRUCT; /* screen gamma value (display_exponent) */
  1296. #endif
  1297. #endif
  1298. #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
  1299. png_bytep gamma_table PNG_DEPSTRUCT; /* gamma table for 8-bit depth files */
  1300. png_bytep gamma_from_1 PNG_DEPSTRUCT; /* converts from 1.0 to screen */
  1301. png_bytep gam