rfreeimage 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (860) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +1 -0
  4. data/Rakefile +34 -0
  5. data/ext/rfreeimage/extconf.rb +35 -0
  6. data/ext/rfreeimage/rfi_main.c +389 -0
  7. data/lib/rfreeimage/image.rb +26 -0
  8. data/lib/rfreeimage/version.rb +3 -0
  9. data/lib/rfreeimage.rb +3 -0
  10. data/rfreeimage.gemspec +32 -0
  11. data/vendor/FreeImage/Makefile +34 -0
  12. data/vendor/FreeImage/Makefile.cygwin +74 -0
  13. data/vendor/FreeImage/Makefile.fip +84 -0
  14. data/vendor/FreeImage/Makefile.gnu +83 -0
  15. data/vendor/FreeImage/Makefile.iphone +96 -0
  16. data/vendor/FreeImage/Makefile.mingw +136 -0
  17. data/vendor/FreeImage/Makefile.osx +115 -0
  18. data/vendor/FreeImage/Makefile.solaris +66 -0
  19. data/vendor/FreeImage/Makefile.srcs +6 -0
  20. data/vendor/FreeImage/README.iphone +19 -0
  21. data/vendor/FreeImage/README.linux +50 -0
  22. data/vendor/FreeImage/README.minGW +236 -0
  23. data/vendor/FreeImage/README.osx +44 -0
  24. data/vendor/FreeImage/README.solaris +67 -0
  25. data/vendor/FreeImage/Source/CacheFile.h +92 -0
  26. data/vendor/FreeImage/Source/DeprecationManager/Deprecated.cpp +36 -0
  27. data/vendor/FreeImage/Source/DeprecationManager/DeprecationMgr.cpp +103 -0
  28. data/vendor/FreeImage/Source/DeprecationManager/DeprecationMgr.h +83 -0
  29. data/vendor/FreeImage/Source/FreeImage/BitmapAccess.cpp +1573 -0
  30. data/vendor/FreeImage/Source/FreeImage/CacheFile.cpp +271 -0
  31. data/vendor/FreeImage/Source/FreeImage/ColorLookup.cpp +785 -0
  32. data/vendor/FreeImage/Source/FreeImage/Conversion.cpp +551 -0
  33. data/vendor/FreeImage/Source/FreeImage/Conversion16_555.cpp +209 -0
  34. data/vendor/FreeImage/Source/FreeImage/Conversion16_565.cpp +204 -0
  35. data/vendor/FreeImage/Source/FreeImage/Conversion24.cpp +252 -0
  36. data/vendor/FreeImage/Source/FreeImage/Conversion32.cpp +345 -0
  37. data/vendor/FreeImage/Source/FreeImage/Conversion4.cpp +246 -0
  38. data/vendor/FreeImage/Source/FreeImage/Conversion8.cpp +305 -0
  39. data/vendor/FreeImage/Source/FreeImage/ConversionFloat.cpp +194 -0
  40. data/vendor/FreeImage/Source/FreeImage/ConversionRGB16.cpp +144 -0
  41. data/vendor/FreeImage/Source/FreeImage/ConversionRGBA16.cpp +147 -0
  42. data/vendor/FreeImage/Source/FreeImage/ConversionRGBAF.cpp +250 -0
  43. data/vendor/FreeImage/Source/FreeImage/ConversionRGBF.cpp +243 -0
  44. data/vendor/FreeImage/Source/FreeImage/ConversionType.cpp +699 -0
  45. data/vendor/FreeImage/Source/FreeImage/ConversionUINT16.cpp +134 -0
  46. data/vendor/FreeImage/Source/FreeImage/FreeImage.cpp +226 -0
  47. data/vendor/FreeImage/Source/FreeImage/FreeImageC.c +22 -0
  48. data/vendor/FreeImage/Source/FreeImage/FreeImageIO.cpp +175 -0
  49. data/vendor/FreeImage/Source/FreeImage/GetType.cpp +92 -0
  50. data/vendor/FreeImage/Source/FreeImage/Halftoning.cpp +474 -0
  51. data/vendor/FreeImage/Source/FreeImage/J2KHelper.cpp +591 -0
  52. data/vendor/FreeImage/Source/FreeImage/J2KHelper.h +36 -0
  53. data/vendor/FreeImage/Source/FreeImage/LFPQuantizer.cpp +208 -0
  54. data/vendor/FreeImage/Source/FreeImage/MNGHelper.cpp +1320 -0
  55. data/vendor/FreeImage/Source/FreeImage/MemoryIO.cpp +237 -0
  56. data/vendor/FreeImage/Source/FreeImage/MultiPage.cpp +974 -0
  57. data/vendor/FreeImage/Source/FreeImage/NNQuantizer.cpp +507 -0
  58. data/vendor/FreeImage/Source/FreeImage/PSDParser.cpp +1057 -0
  59. data/vendor/FreeImage/Source/FreeImage/PSDParser.h +271 -0
  60. data/vendor/FreeImage/Source/FreeImage/PixelAccess.cpp +197 -0
  61. data/vendor/FreeImage/Source/FreeImage/Plugin.cpp +822 -0
  62. data/vendor/FreeImage/Source/FreeImage/PluginBMP.cpp +1494 -0
  63. data/vendor/FreeImage/Source/FreeImage/PluginCUT.cpp +240 -0
  64. data/vendor/FreeImage/Source/FreeImage/PluginDDS.cpp +655 -0
  65. data/vendor/FreeImage/Source/FreeImage/PluginEXR.cpp +773 -0
  66. data/vendor/FreeImage/Source/FreeImage/PluginG3.cpp +433 -0
  67. data/vendor/FreeImage/Source/FreeImage/PluginGIF.cpp +1407 -0
  68. data/vendor/FreeImage/Source/FreeImage/PluginHDR.cpp +722 -0
  69. data/vendor/FreeImage/Source/FreeImage/PluginICO.cpp +824 -0
  70. data/vendor/FreeImage/Source/FreeImage/PluginIFF.cpp +459 -0
  71. data/vendor/FreeImage/Source/FreeImage/PluginJ2K.cpp +328 -0
  72. data/vendor/FreeImage/Source/FreeImage/PluginJNG.cpp +162 -0
  73. data/vendor/FreeImage/Source/FreeImage/PluginJP2.cpp +328 -0
  74. data/vendor/FreeImage/Source/FreeImage/PluginJPEG.cpp +1706 -0
  75. data/vendor/FreeImage/Source/FreeImage/PluginJXR.cpp +1475 -0
  76. data/vendor/FreeImage/Source/FreeImage/PluginKOALA.cpp +243 -0
  77. data/vendor/FreeImage/Source/FreeImage/PluginMNG.cpp +153 -0
  78. data/vendor/FreeImage/Source/FreeImage/PluginPCD.cpp +251 -0
  79. data/vendor/FreeImage/Source/FreeImage/PluginPCX.cpp +659 -0
  80. data/vendor/FreeImage/Source/FreeImage/PluginPFM.cpp +409 -0
  81. data/vendor/FreeImage/Source/FreeImage/PluginPICT.cpp +1343 -0
  82. data/vendor/FreeImage/Source/FreeImage/PluginPNG.cpp +1115 -0
  83. data/vendor/FreeImage/Source/FreeImage/PluginPNM.cpp +838 -0
  84. data/vendor/FreeImage/Source/FreeImage/PluginPSD.cpp +131 -0
  85. data/vendor/FreeImage/Source/FreeImage/PluginRAS.cpp +512 -0
  86. data/vendor/FreeImage/Source/FreeImage/PluginRAW.cpp +793 -0
  87. data/vendor/FreeImage/Source/FreeImage/PluginSGI.cpp +425 -0
  88. data/vendor/FreeImage/Source/FreeImage/PluginTARGA.cpp +1591 -0
  89. data/vendor/FreeImage/Source/FreeImage/PluginTIFF.cpp +2631 -0
  90. data/vendor/FreeImage/Source/FreeImage/PluginWBMP.cpp +372 -0
  91. data/vendor/FreeImage/Source/FreeImage/PluginWebP.cpp +698 -0
  92. data/vendor/FreeImage/Source/FreeImage/PluginXBM.cpp +399 -0
  93. data/vendor/FreeImage/Source/FreeImage/PluginXPM.cpp +487 -0
  94. data/vendor/FreeImage/Source/FreeImage/TIFFLogLuv.cpp +65 -0
  95. data/vendor/FreeImage/Source/FreeImage/ToneMapping.cpp +75 -0
  96. data/vendor/FreeImage/Source/FreeImage/WuQuantizer.cpp +559 -0
  97. data/vendor/FreeImage/Source/FreeImage/ZLibInterface.cpp +223 -0
  98. data/vendor/FreeImage/Source/FreeImage/tmoColorConvert.cpp +479 -0
  99. data/vendor/FreeImage/Source/FreeImage/tmoDrago03.cpp +295 -0
  100. data/vendor/FreeImage/Source/FreeImage/tmoFattal02.cpp +689 -0
  101. data/vendor/FreeImage/Source/FreeImage/tmoReinhard05.cpp +260 -0
  102. data/vendor/FreeImage/Source/FreeImage.h +1153 -0
  103. data/vendor/FreeImage/Source/FreeImageIO.h +63 -0
  104. data/vendor/FreeImage/Source/FreeImageToolkit/BSplineRotate.cpp +730 -0
  105. data/vendor/FreeImage/Source/FreeImageToolkit/Background.cpp +895 -0
  106. data/vendor/FreeImage/Source/FreeImageToolkit/Channels.cpp +488 -0
  107. data/vendor/FreeImage/Source/FreeImageToolkit/ClassicRotate.cpp +917 -0
  108. data/vendor/FreeImage/Source/FreeImageToolkit/Colors.cpp +967 -0
  109. data/vendor/FreeImage/Source/FreeImageToolkit/CopyPaste.cpp +861 -0
  110. data/vendor/FreeImage/Source/FreeImageToolkit/Display.cpp +230 -0
  111. data/vendor/FreeImage/Source/FreeImageToolkit/Filters.h +287 -0
  112. data/vendor/FreeImage/Source/FreeImageToolkit/Flip.cpp +166 -0
  113. data/vendor/FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp +623 -0
  114. data/vendor/FreeImage/Source/FreeImageToolkit/MultigridPoissonSolver.cpp +505 -0
  115. data/vendor/FreeImage/Source/FreeImageToolkit/Rescale.cpp +192 -0
  116. data/vendor/FreeImage/Source/FreeImageToolkit/Resize.cpp +2116 -0
  117. data/vendor/FreeImage/Source/FreeImageToolkit/Resize.h +196 -0
  118. data/vendor/FreeImage/Source/LibJPEG/ansi2knr.c +739 -0
  119. data/vendor/FreeImage/Source/LibJPEG/cderror.h +134 -0
  120. data/vendor/FreeImage/Source/LibJPEG/cdjpeg.c +181 -0
  121. data/vendor/FreeImage/Source/LibJPEG/cdjpeg.h +187 -0
  122. data/vendor/FreeImage/Source/LibJPEG/cjpeg.c +664 -0
  123. data/vendor/FreeImage/Source/LibJPEG/ckconfig.c +402 -0
  124. data/vendor/FreeImage/Source/LibJPEG/djpeg.c +617 -0
  125. data/vendor/FreeImage/Source/LibJPEG/example.c +433 -0
  126. data/vendor/FreeImage/Source/LibJPEG/jaricom.c +153 -0
  127. data/vendor/FreeImage/Source/LibJPEG/jcapimin.c +288 -0
  128. data/vendor/FreeImage/Source/LibJPEG/jcapistd.c +162 -0
  129. data/vendor/FreeImage/Source/LibJPEG/jcarith.c +944 -0
  130. data/vendor/FreeImage/Source/LibJPEG/jccoefct.c +454 -0
  131. data/vendor/FreeImage/Source/LibJPEG/jccolor.c +604 -0
  132. data/vendor/FreeImage/Source/LibJPEG/jcdctmgr.c +477 -0
  133. data/vendor/FreeImage/Source/LibJPEG/jchuff.c +1573 -0
  134. data/vendor/FreeImage/Source/LibJPEG/jcinit.c +84 -0
  135. data/vendor/FreeImage/Source/LibJPEG/jcmainct.c +297 -0
  136. data/vendor/FreeImage/Source/LibJPEG/jcmarker.c +719 -0
  137. data/vendor/FreeImage/Source/LibJPEG/jcmaster.c +856 -0
  138. data/vendor/FreeImage/Source/LibJPEG/jcomapi.c +106 -0
  139. data/vendor/FreeImage/Source/LibJPEG/jconfig.h +161 -0
  140. data/vendor/FreeImage/Source/LibJPEG/jcparam.c +675 -0
  141. data/vendor/FreeImage/Source/LibJPEG/jcprepct.c +358 -0
  142. data/vendor/FreeImage/Source/LibJPEG/jcsample.c +545 -0
  143. data/vendor/FreeImage/Source/LibJPEG/jctrans.c +385 -0
  144. data/vendor/FreeImage/Source/LibJPEG/jdapimin.c +399 -0
  145. data/vendor/FreeImage/Source/LibJPEG/jdapistd.c +276 -0
  146. data/vendor/FreeImage/Source/LibJPEG/jdarith.c +796 -0
  147. data/vendor/FreeImage/Source/LibJPEG/jdatadst.c +270 -0
  148. data/vendor/FreeImage/Source/LibJPEG/jdatasrc.c +275 -0
  149. data/vendor/FreeImage/Source/LibJPEG/jdcoefct.c +741 -0
  150. data/vendor/FreeImage/Source/LibJPEG/jdcolor.c +748 -0
  151. data/vendor/FreeImage/Source/LibJPEG/jdct.h +393 -0
  152. data/vendor/FreeImage/Source/LibJPEG/jddctmgr.c +384 -0
  153. data/vendor/FreeImage/Source/LibJPEG/jdhuff.c +1554 -0
  154. data/vendor/FreeImage/Source/LibJPEG/jdinput.c +662 -0
  155. data/vendor/FreeImage/Source/LibJPEG/jdmainct.c +513 -0
  156. data/vendor/FreeImage/Source/LibJPEG/jdmarker.c +1511 -0
  157. data/vendor/FreeImage/Source/LibJPEG/jdmaster.c +543 -0
  158. data/vendor/FreeImage/Source/LibJPEG/jdmerge.c +401 -0
  159. data/vendor/FreeImage/Source/LibJPEG/jdpostct.c +290 -0
  160. data/vendor/FreeImage/Source/LibJPEG/jdsample.c +361 -0
  161. data/vendor/FreeImage/Source/LibJPEG/jdtrans.c +140 -0
  162. data/vendor/FreeImage/Source/LibJPEG/jerror.c +253 -0
  163. data/vendor/FreeImage/Source/LibJPEG/jerror.h +304 -0
  164. data/vendor/FreeImage/Source/LibJPEG/jfdctflt.c +174 -0
  165. data/vendor/FreeImage/Source/LibJPEG/jfdctfst.c +230 -0
  166. data/vendor/FreeImage/Source/LibJPEG/jfdctint.c +4406 -0
  167. data/vendor/FreeImage/Source/LibJPEG/jidctflt.c +235 -0
  168. data/vendor/FreeImage/Source/LibJPEG/jidctfst.c +368 -0
  169. data/vendor/FreeImage/Source/LibJPEG/jidctint.c +5179 -0
  170. data/vendor/FreeImage/Source/LibJPEG/jinclude.h +91 -0
  171. data/vendor/FreeImage/Source/LibJPEG/jmemansi.c +167 -0
  172. data/vendor/FreeImage/Source/LibJPEG/jmemdos.c +638 -0
  173. data/vendor/FreeImage/Source/LibJPEG/jmemmac.c +289 -0
  174. data/vendor/FreeImage/Source/LibJPEG/jmemmgr.c +1119 -0
  175. data/vendor/FreeImage/Source/LibJPEG/jmemname.c +276 -0
  176. data/vendor/FreeImage/Source/LibJPEG/jmemnobs.c +109 -0
  177. data/vendor/FreeImage/Source/LibJPEG/jmemsys.h +198 -0
  178. data/vendor/FreeImage/Source/LibJPEG/jmorecfg.h +442 -0
  179. data/vendor/FreeImage/Source/LibJPEG/jpegint.h +426 -0
  180. data/vendor/FreeImage/Source/LibJPEG/jpeglib.h +1180 -0
  181. data/vendor/FreeImage/Source/LibJPEG/jpegtran.c +577 -0
  182. data/vendor/FreeImage/Source/LibJPEG/jquant1.c +857 -0
  183. data/vendor/FreeImage/Source/LibJPEG/jquant2.c +1311 -0
  184. data/vendor/FreeImage/Source/LibJPEG/jutils.c +227 -0
  185. data/vendor/FreeImage/Source/LibJPEG/jversion.h +14 -0
  186. data/vendor/FreeImage/Source/LibJPEG/rdbmp.c +480 -0
  187. data/vendor/FreeImage/Source/LibJPEG/rdcolmap.c +253 -0
  188. data/vendor/FreeImage/Source/LibJPEG/rdgif.c +38 -0
  189. data/vendor/FreeImage/Source/LibJPEG/rdjpgcom.c +515 -0
  190. data/vendor/FreeImage/Source/LibJPEG/rdppm.c +459 -0
  191. data/vendor/FreeImage/Source/LibJPEG/rdrle.c +387 -0
  192. data/vendor/FreeImage/Source/LibJPEG/rdswitch.c +365 -0
  193. data/vendor/FreeImage/Source/LibJPEG/rdtarga.c +500 -0
  194. data/vendor/FreeImage/Source/LibJPEG/transupp.c +1763 -0
  195. data/vendor/FreeImage/Source/LibJPEG/transupp.h +219 -0
  196. data/vendor/FreeImage/Source/LibJPEG/wrbmp.c +442 -0
  197. data/vendor/FreeImage/Source/LibJPEG/wrgif.c +399 -0
  198. data/vendor/FreeImage/Source/LibJPEG/wrjpgcom.c +583 -0
  199. data/vendor/FreeImage/Source/LibJPEG/wrppm.c +269 -0
  200. data/vendor/FreeImage/Source/LibJPEG/wrrle.c +305 -0
  201. data/vendor/FreeImage/Source/LibJPEG/wrtarga.c +253 -0
  202. data/vendor/FreeImage/Source/LibJXR/common/include/guiddef.h +230 -0
  203. data/vendor/FreeImage/Source/LibJXR/common/include/wmsal.h +757 -0
  204. data/vendor/FreeImage/Source/LibJXR/common/include/wmspecstring.h +342 -0
  205. data/vendor/FreeImage/Source/LibJXR/common/include/wmspecstrings_adt.h +71 -0
  206. data/vendor/FreeImage/Source/LibJXR/common/include/wmspecstrings_strict.h +1096 -0
  207. data/vendor/FreeImage/Source/LibJXR/common/include/wmspecstrings_undef.h +406 -0
  208. data/vendor/FreeImage/Source/LibJXR/image/decode/JXRTranscode.c +987 -0
  209. data/vendor/FreeImage/Source/LibJXR/image/decode/decode.c +200 -0
  210. data/vendor/FreeImage/Source/LibJXR/image/decode/decode.h +143 -0
  211. data/vendor/FreeImage/Source/LibJXR/image/decode/postprocess.c +288 -0
  212. data/vendor/FreeImage/Source/LibJXR/image/decode/segdec.c +1205 -0
  213. data/vendor/FreeImage/Source/LibJXR/image/decode/strInvTransform.c +1888 -0
  214. data/vendor/FreeImage/Source/LibJXR/image/decode/strPredQuantDec.c +539 -0
  215. data/vendor/FreeImage/Source/LibJXR/image/decode/strdec.c +3628 -0
  216. data/vendor/FreeImage/Source/LibJXR/image/decode/strdec_x86.c +1640 -0
  217. data/vendor/FreeImage/Source/LibJXR/image/encode/encode.c +144 -0
  218. data/vendor/FreeImage/Source/LibJXR/image/encode/encode.h +113 -0
  219. data/vendor/FreeImage/Source/LibJXR/image/encode/segenc.c +1186 -0
  220. data/vendor/FreeImage/Source/LibJXR/image/encode/strFwdTransform.c +1111 -0
  221. data/vendor/FreeImage/Source/LibJXR/image/encode/strPredQuantEnc.c +511 -0
  222. data/vendor/FreeImage/Source/LibJXR/image/encode/strenc.c +2370 -0
  223. data/vendor/FreeImage/Source/LibJXR/image/encode/strenc_x86.c +409 -0
  224. data/vendor/FreeImage/Source/LibJXR/image/sys/adapthuff.c +511 -0
  225. data/vendor/FreeImage/Source/LibJXR/image/sys/ansi.h +61 -0
  226. data/vendor/FreeImage/Source/LibJXR/image/sys/common.h +131 -0
  227. data/vendor/FreeImage/Source/LibJXR/image/sys/image.c +183 -0
  228. data/vendor/FreeImage/Source/LibJXR/image/sys/perfTimer.h +115 -0
  229. data/vendor/FreeImage/Source/LibJXR/image/sys/perfTimerANSI.c +274 -0
  230. data/vendor/FreeImage/Source/LibJXR/image/sys/strPredQuant.c +306 -0
  231. data/vendor/FreeImage/Source/LibJXR/image/sys/strTransform.c +85 -0
  232. data/vendor/FreeImage/Source/LibJXR/image/sys/strTransform.h +50 -0
  233. data/vendor/FreeImage/Source/LibJXR/image/sys/strcodec.c +1251 -0
  234. data/vendor/FreeImage/Source/LibJXR/image/sys/strcodec.h +681 -0
  235. data/vendor/FreeImage/Source/LibJXR/image/sys/windowsmediaphoto.h +515 -0
  236. data/vendor/FreeImage/Source/LibJXR/image/sys/xplatform_image.h +84 -0
  237. data/vendor/FreeImage/Source/LibJXR/image/x86/x86.h +58 -0
  238. data/vendor/FreeImage/Source/LibJXR/jxrgluelib/JXRGlue.c +930 -0
  239. data/vendor/FreeImage/Source/LibJXR/jxrgluelib/JXRGlue.h +636 -0
  240. data/vendor/FreeImage/Source/LibJXR/jxrgluelib/JXRGlueJxr.c +2246 -0
  241. data/vendor/FreeImage/Source/LibJXR/jxrgluelib/JXRGluePFC.c +2338 -0
  242. data/vendor/FreeImage/Source/LibJXR/jxrgluelib/JXRMeta.c +905 -0
  243. data/vendor/FreeImage/Source/LibJXR/jxrgluelib/JXRMeta.h +258 -0
  244. data/vendor/FreeImage/Source/LibOpenJPEG/bio.c +188 -0
  245. data/vendor/FreeImage/Source/LibOpenJPEG/bio.h +128 -0
  246. data/vendor/FreeImage/Source/LibOpenJPEG/cidx_manager.c +239 -0
  247. data/vendor/FreeImage/Source/LibOpenJPEG/cidx_manager.h +68 -0
  248. data/vendor/FreeImage/Source/LibOpenJPEG/cio.c +644 -0
  249. data/vendor/FreeImage/Source/LibOpenJPEG/cio.h +393 -0
  250. data/vendor/FreeImage/Source/LibOpenJPEG/dwt.c +919 -0
  251. data/vendor/FreeImage/Source/LibOpenJPEG/dwt.h +116 -0
  252. data/vendor/FreeImage/Source/LibOpenJPEG/event.c +141 -0
  253. data/vendor/FreeImage/Source/LibOpenJPEG/event.h +97 -0
  254. data/vendor/FreeImage/Source/LibOpenJPEG/function_list.c +114 -0
  255. data/vendor/FreeImage/Source/LibOpenJPEG/function_list.h +126 -0
  256. data/vendor/FreeImage/Source/LibOpenJPEG/image.c +235 -0
  257. data/vendor/FreeImage/Source/LibOpenJPEG/image.h +63 -0
  258. data/vendor/FreeImage/Source/LibOpenJPEG/indexbox_manager.h +148 -0
  259. data/vendor/FreeImage/Source/LibOpenJPEG/invert.c +289 -0
  260. data/vendor/FreeImage/Source/LibOpenJPEG/invert.h +59 -0
  261. data/vendor/FreeImage/Source/LibOpenJPEG/j2k.c +10238 -0
  262. data/vendor/FreeImage/Source/LibOpenJPEG/j2k.h +838 -0
  263. data/vendor/FreeImage/Source/LibOpenJPEG/jp2.c +2776 -0
  264. data/vendor/FreeImage/Source/LibOpenJPEG/jp2.h +490 -0
  265. data/vendor/FreeImage/Source/LibOpenJPEG/mct.c +319 -0
  266. data/vendor/FreeImage/Source/LibOpenJPEG/mct.h +149 -0
  267. data/vendor/FreeImage/Source/LibOpenJPEG/mqc.c +604 -0
  268. data/vendor/FreeImage/Source/LibOpenJPEG/mqc.h +201 -0
  269. data/vendor/FreeImage/Source/LibOpenJPEG/openjpeg.c +955 -0
  270. data/vendor/FreeImage/Source/LibOpenJPEG/openjpeg.h +1475 -0
  271. data/vendor/FreeImage/Source/LibOpenJPEG/opj_clock.c +59 -0
  272. data/vendor/FreeImage/Source/LibOpenJPEG/opj_clock.h +54 -0
  273. data/vendor/FreeImage/Source/LibOpenJPEG/opj_codec.h +160 -0
  274. data/vendor/FreeImage/Source/LibOpenJPEG/opj_config.h +9 -0
  275. data/vendor/FreeImage/Source/LibOpenJPEG/opj_config_private.h +16 -0
  276. data/vendor/FreeImage/Source/LibOpenJPEG/opj_includes.h +175 -0
  277. data/vendor/FreeImage/Source/LibOpenJPEG/opj_intmath.h +172 -0
  278. data/vendor/FreeImage/Source/LibOpenJPEG/opj_inttypes.h +43 -0
  279. data/vendor/FreeImage/Source/LibOpenJPEG/opj_malloc.h +180 -0
  280. data/vendor/FreeImage/Source/LibOpenJPEG/opj_stdint.h +47 -0
  281. data/vendor/FreeImage/Source/LibOpenJPEG/phix_manager.c +191 -0
  282. data/vendor/FreeImage/Source/LibOpenJPEG/pi.c +1870 -0
  283. data/vendor/FreeImage/Source/LibOpenJPEG/pi.h +182 -0
  284. data/vendor/FreeImage/Source/LibOpenJPEG/ppix_manager.c +194 -0
  285. data/vendor/FreeImage/Source/LibOpenJPEG/raw.c +89 -0
  286. data/vendor/FreeImage/Source/LibOpenJPEG/raw.h +100 -0
  287. data/vendor/FreeImage/Source/LibOpenJPEG/t1.c +1751 -0
  288. data/vendor/FreeImage/Source/LibOpenJPEG/t1.h +157 -0
  289. data/vendor/FreeImage/Source/LibOpenJPEG/t1_generate_luts.c +276 -0
  290. data/vendor/FreeImage/Source/LibOpenJPEG/t1_luts.h +143 -0
  291. data/vendor/FreeImage/Source/LibOpenJPEG/t2.c +1334 -0
  292. data/vendor/FreeImage/Source/LibOpenJPEG/t2.h +127 -0
  293. data/vendor/FreeImage/Source/LibOpenJPEG/tcd.c +2123 -0
  294. data/vendor/FreeImage/Source/LibOpenJPEG/tcd.h +348 -0
  295. data/vendor/FreeImage/Source/LibOpenJPEG/tgt.c +331 -0
  296. data/vendor/FreeImage/Source/LibOpenJPEG/tgt.h +140 -0
  297. data/vendor/FreeImage/Source/LibOpenJPEG/thix_manager.c +134 -0
  298. data/vendor/FreeImage/Source/LibOpenJPEG/tpix_manager.c +185 -0
  299. data/vendor/FreeImage/Source/LibPNG/example.c +1061 -0
  300. data/vendor/FreeImage/Source/LibPNG/png.c +4493 -0
  301. data/vendor/FreeImage/Source/LibPNG/png.h +3282 -0
  302. data/vendor/FreeImage/Source/LibPNG/pngconf.h +644 -0
  303. data/vendor/FreeImage/Source/LibPNG/pngdebug.h +154 -0
  304. data/vendor/FreeImage/Source/LibPNG/pngerror.c +963 -0
  305. data/vendor/FreeImage/Source/LibPNG/pngget.c +1213 -0
  306. data/vendor/FreeImage/Source/LibPNG/pnginfo.h +260 -0
  307. data/vendor/FreeImage/Source/LibPNG/pnglibconf.h +218 -0
  308. data/vendor/FreeImage/Source/LibPNG/pngmem.c +281 -0
  309. data/vendor/FreeImage/Source/LibPNG/pngpread.c +1168 -0
  310. data/vendor/FreeImage/Source/LibPNG/pngpriv.h +1944 -0
  311. data/vendor/FreeImage/Source/LibPNG/pngread.c +4121 -0
  312. data/vendor/FreeImage/Source/LibPNG/pngrio.c +120 -0
  313. data/vendor/FreeImage/Source/LibPNG/pngrtran.c +4994 -0
  314. data/vendor/FreeImage/Source/LibPNG/pngrutil.c +4474 -0
  315. data/vendor/FreeImage/Source/LibPNG/pngset.c +1611 -0
  316. data/vendor/FreeImage/Source/LibPNG/pngstruct.h +489 -0
  317. data/vendor/FreeImage/Source/LibPNG/pngtest.c +2011 -0
  318. data/vendor/FreeImage/Source/LibPNG/pngtrans.c +849 -0
  319. data/vendor/FreeImage/Source/LibPNG/pngwio.c +168 -0
  320. data/vendor/FreeImage/Source/LibPNG/pngwrite.c +2455 -0
  321. data/vendor/FreeImage/Source/LibPNG/pngwtran.c +574 -0
  322. data/vendor/FreeImage/Source/LibPNG/pngwutil.c +3029 -0
  323. data/vendor/FreeImage/Source/LibRawLite/dcraw/dcraw.c +15462 -0
  324. data/vendor/FreeImage/Source/LibRawLite/internal/aahd_demosaic.cpp +706 -0
  325. data/vendor/FreeImage/Source/LibRawLite/internal/dcb_demosaicing.c +710 -0
  326. data/vendor/FreeImage/Source/LibRawLite/internal/dcraw_common.cpp +13593 -0
  327. data/vendor/FreeImage/Source/LibRawLite/internal/dcraw_fileio.cpp +240 -0
  328. data/vendor/FreeImage/Source/LibRawLite/internal/defines.h +167 -0
  329. data/vendor/FreeImage/Source/LibRawLite/internal/demosaic_packs.cpp +99 -0
  330. data/vendor/FreeImage/Source/LibRawLite/internal/dht_demosaic.cpp +873 -0
  331. data/vendor/FreeImage/Source/LibRawLite/internal/libraw_internal_funcs.h +282 -0
  332. data/vendor/FreeImage/Source/LibRawLite/internal/libraw_x3f.cpp +1919 -0
  333. data/vendor/FreeImage/Source/LibRawLite/internal/var_defines.h +216 -0
  334. data/vendor/FreeImage/Source/LibRawLite/internal/wf_filtering.cpp +1950 -0
  335. data/vendor/FreeImage/Source/LibRawLite/libraw/libraw.h +338 -0
  336. data/vendor/FreeImage/Source/LibRawLite/libraw/libraw_alloc.h +99 -0
  337. data/vendor/FreeImage/Source/LibRawLite/libraw/libraw_const.h +233 -0
  338. data/vendor/FreeImage/Source/LibRawLite/libraw/libraw_datastream.h +238 -0
  339. data/vendor/FreeImage/Source/LibRawLite/libraw/libraw_internal.h +225 -0
  340. data/vendor/FreeImage/Source/LibRawLite/libraw/libraw_types.h +442 -0
  341. data/vendor/FreeImage/Source/LibRawLite/libraw/libraw_version.h +62 -0
  342. data/vendor/FreeImage/Source/LibRawLite/src/libraw_c_api.cpp +230 -0
  343. data/vendor/FreeImage/Source/LibRawLite/src/libraw_cxx.cpp +4533 -0
  344. data/vendor/FreeImage/Source/LibRawLite/src/libraw_datastream.cpp +703 -0
  345. data/vendor/FreeImage/Source/LibTIFF4/mkg3states.c +451 -0
  346. data/vendor/FreeImage/Source/LibTIFF4/mkspans.c +82 -0
  347. data/vendor/FreeImage/Source/LibTIFF4/t4.h +292 -0
  348. data/vendor/FreeImage/Source/LibTIFF4/tif_aux.c +358 -0
  349. data/vendor/FreeImage/Source/LibTIFF4/tif_close.c +140 -0
  350. data/vendor/FreeImage/Source/LibTIFF4/tif_codec.c +166 -0
  351. data/vendor/FreeImage/Source/LibTIFF4/tif_color.c +287 -0
  352. data/vendor/FreeImage/Source/LibTIFF4/tif_compress.c +304 -0
  353. data/vendor/FreeImage/Source/LibTIFF4/tif_config.h +97 -0
  354. data/vendor/FreeImage/Source/LibTIFF4/tif_config.vc.h +74 -0
  355. data/vendor/FreeImage/Source/LibTIFF4/tif_config.wince.h +71 -0
  356. data/vendor/FreeImage/Source/LibTIFF4/tif_dir.c +1700 -0
  357. data/vendor/FreeImage/Source/LibTIFF4/tif_dir.h +308 -0
  358. data/vendor/FreeImage/Source/LibTIFF4/tif_dirinfo.c +959 -0
  359. data/vendor/FreeImage/Source/LibTIFF4/tif_dirread.c +5640 -0
  360. data/vendor/FreeImage/Source/LibTIFF4/tif_dirwrite.c +2910 -0
  361. data/vendor/FreeImage/Source/LibTIFF4/tif_dumpmode.c +143 -0
  362. data/vendor/FreeImage/Source/LibTIFF4/tif_error.c +80 -0
  363. data/vendor/FreeImage/Source/LibTIFF4/tif_extension.c +118 -0
  364. data/vendor/FreeImage/Source/LibTIFF4/tif_fax3.c +1595 -0
  365. data/vendor/FreeImage/Source/LibTIFF4/tif_fax3.h +538 -0
  366. data/vendor/FreeImage/Source/LibTIFF4/tif_fax3sm.c +1260 -0
  367. data/vendor/FreeImage/Source/LibTIFF4/tif_flush.c +118 -0
  368. data/vendor/FreeImage/Source/LibTIFF4/tif_getimage.c +2890 -0
  369. data/vendor/FreeImage/Source/LibTIFF4/tif_jbig.c +213 -0
  370. data/vendor/FreeImage/Source/LibTIFF4/tif_jpeg.c +2354 -0
  371. data/vendor/FreeImage/Source/LibTIFF4/tif_jpeg_12.c +65 -0
  372. data/vendor/FreeImage/Source/LibTIFF4/tif_luv.c +1683 -0
  373. data/vendor/FreeImage/Source/LibTIFF4/tif_lzma.c +495 -0
  374. data/vendor/FreeImage/Source/LibTIFF4/tif_lzw.c +1169 -0
  375. data/vendor/FreeImage/Source/LibTIFF4/tif_next.c +181 -0
  376. data/vendor/FreeImage/Source/LibTIFF4/tif_ojpeg.c +2501 -0
  377. data/vendor/FreeImage/Source/LibTIFF4/tif_open.c +725 -0
  378. data/vendor/FreeImage/Source/LibTIFF4/tif_packbits.c +300 -0
  379. data/vendor/FreeImage/Source/LibTIFF4/tif_pixarlog.c +1442 -0
  380. data/vendor/FreeImage/Source/LibTIFF4/tif_predict.c +764 -0
  381. data/vendor/FreeImage/Source/LibTIFF4/tif_predict.h +77 -0
  382. data/vendor/FreeImage/Source/LibTIFF4/tif_print.c +716 -0
  383. data/vendor/FreeImage/Source/LibTIFF4/tif_read.c +1086 -0
  384. data/vendor/FreeImage/Source/LibTIFF4/tif_strip.c +383 -0
  385. data/vendor/FreeImage/Source/LibTIFF4/tif_swab.c +310 -0
  386. data/vendor/FreeImage/Source/LibTIFF4/tif_thunder.c +207 -0
  387. data/vendor/FreeImage/Source/LibTIFF4/tif_tile.c +299 -0
  388. data/vendor/FreeImage/Source/LibTIFF4/tif_unix.c +325 -0
  389. data/vendor/FreeImage/Source/LibTIFF4/tif_version.c +40 -0
  390. data/vendor/FreeImage/Source/LibTIFF4/tif_vms.c +603 -0
  391. data/vendor/FreeImage/Source/LibTIFF4/tif_warning.c +81 -0
  392. data/vendor/FreeImage/Source/LibTIFF4/tif_win32.c +443 -0
  393. data/vendor/FreeImage/Source/LibTIFF4/tif_wince.c +293 -0
  394. data/vendor/FreeImage/Source/LibTIFF4/tif_write.c +771 -0
  395. data/vendor/FreeImage/Source/LibTIFF4/tif_zip.c +472 -0
  396. data/vendor/FreeImage/Source/LibTIFF4/tiff.h +681 -0
  397. data/vendor/FreeImage/Source/LibTIFF4/tiffconf.h +170 -0
  398. data/vendor/FreeImage/Source/LibTIFF4/tiffconf.vc.h +160 -0
  399. data/vendor/FreeImage/Source/LibTIFF4/tiffconf.wince.h +121 -0
  400. data/vendor/FreeImage/Source/LibTIFF4/tiffio.h +557 -0
  401. data/vendor/FreeImage/Source/LibTIFF4/tiffiop.h +367 -0
  402. data/vendor/FreeImage/Source/LibTIFF4/tiffvers.h +9 -0
  403. data/vendor/FreeImage/Source/LibTIFF4/uvcode.h +180 -0
  404. data/vendor/FreeImage/Source/LibWebP/src/dec/alphai.h +55 -0
  405. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.alpha.c +167 -0
  406. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.buffer.c +249 -0
  407. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.frame.c +827 -0
  408. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.idec.c +857 -0
  409. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.io.c +640 -0
  410. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.quant.c +110 -0
  411. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.tree.c +525 -0
  412. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.vp8.c +663 -0
  413. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.vp8l.c +1584 -0
  414. data/vendor/FreeImage/Source/LibWebP/src/dec/dec.webp.c +834 -0
  415. data/vendor/FreeImage/Source/LibWebP/src/dec/decode_vp8.h +185 -0
  416. data/vendor/FreeImage/Source/LibWebP/src/dec/vp8i.h +353 -0
  417. data/vendor/FreeImage/Source/LibWebP/src/dec/vp8li.h +136 -0
  418. data/vendor/FreeImage/Source/LibWebP/src/dec/webpi.h +120 -0
  419. data/vendor/FreeImage/Source/LibWebP/src/demux/demux.demux.c +957 -0
  420. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.alpha_processing.c +377 -0
  421. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.alpha_processing_mips_dsp_r2.c +139 -0
  422. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.alpha_processing_sse2.c +296 -0
  423. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.argb.c +68 -0
  424. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.argb_mips_dsp_r2.c +108 -0
  425. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.argb_sse2.c +62 -0
  426. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.cost.c +412 -0
  427. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.cost_mips32.c +154 -0
  428. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.cost_mips_dsp_r2.c +107 -0
  429. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.cost_sse2.c +121 -0
  430. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.cpu.c +138 -0
  431. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.dec.c +760 -0
  432. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.dec_clip_tables.c +366 -0
  433. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.dec_mips32.c +585 -0
  434. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.dec_mips_dsp_r2.c +992 -0
  435. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.dec_neon.c +1489 -0
  436. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.dec_sse2.c +1284 -0
  437. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.enc.c +788 -0
  438. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.enc_avx2.c +24 -0
  439. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.enc_mips32.c +670 -0
  440. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.enc_mips_dsp_r2.c +1510 -0
  441. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.enc_neon.c +932 -0
  442. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.enc_sse2.c +940 -0
  443. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.filters.c +240 -0
  444. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.filters_mips_dsp_r2.c +404 -0
  445. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.filters_sse2.c +349 -0
  446. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.h +434 -0
  447. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.lossless.c +1838 -0
  448. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.lossless_mips32.c +416 -0
  449. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.lossless_mips_dsp_r2.c +921 -0
  450. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.lossless_neon.c +357 -0
  451. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.lossless_sse2.c +535 -0
  452. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.rescaler.c +115 -0
  453. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.rescaler_mips32.c +192 -0
  454. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.rescaler_mips_dsp_r2.c +210 -0
  455. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.upsampling.c +252 -0
  456. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.upsampling_mips_dsp_r2.c +280 -0
  457. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.upsampling_neon.c +267 -0
  458. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.upsampling_sse2.c +214 -0
  459. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.yuv.c +166 -0
  460. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.yuv_mips32.c +100 -0
  461. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.yuv_mips_dsp_r2.c +131 -0
  462. data/vendor/FreeImage/Source/LibWebP/src/dsp/dsp.yuv_sse2.c +322 -0
  463. data/vendor/FreeImage/Source/LibWebP/src/dsp/lossless.h +313 -0
  464. data/vendor/FreeImage/Source/LibWebP/src/dsp/mips_macro.h +200 -0
  465. data/vendor/FreeImage/Source/LibWebP/src/dsp/neon.h +82 -0
  466. data/vendor/FreeImage/Source/LibWebP/src/dsp/yuv.h +321 -0
  467. data/vendor/FreeImage/Source/LibWebP/src/dsp/yuv_tables_sse2.h +536 -0
  468. data/vendor/FreeImage/Source/LibWebP/src/enc/backward_references.h +202 -0
  469. data/vendor/FreeImage/Source/LibWebP/src/enc/cost.h +69 -0
  470. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.alpha.c +440 -0
  471. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.analysis.c +501 -0
  472. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.backward_references.c +1076 -0
  473. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.config.c +163 -0
  474. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.cost.c +355 -0
  475. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.filter.c +296 -0
  476. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.frame.c +850 -0
  477. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.histogram.c +897 -0
  478. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.iterator.c +456 -0
  479. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.near_lossless.c +160 -0
  480. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.picture.c +290 -0
  481. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.picture_csp.c +1100 -0
  482. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.picture_psnr.c +150 -0
  483. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.picture_rescale.c +285 -0
  484. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.picture_tools.c +206 -0
  485. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.quant.c +1191 -0
  486. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.syntax.c +383 -0
  487. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.token.c +285 -0
  488. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.tree.c +504 -0
  489. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.vp8l.c +1437 -0
  490. data/vendor/FreeImage/Source/LibWebP/src/enc/enc.webpenc.c +379 -0
  491. data/vendor/FreeImage/Source/LibWebP/src/enc/histogram.h +114 -0
  492. data/vendor/FreeImage/Source/LibWebP/src/enc/vp8enci.h +551 -0
  493. data/vendor/FreeImage/Source/LibWebP/src/enc/vp8li.h +78 -0
  494. data/vendor/FreeImage/Source/LibWebP/src/mux/mux.anim_encode.c +1241 -0
  495. data/vendor/FreeImage/Source/LibWebP/src/mux/mux.muxedit.c +696 -0
  496. data/vendor/FreeImage/Source/LibWebP/src/mux/mux.muxinternal.c +551 -0
  497. data/vendor/FreeImage/Source/LibWebP/src/mux/mux.muxread.c +544 -0
  498. data/vendor/FreeImage/Source/LibWebP/src/mux/muxi.h +232 -0
  499. data/vendor/FreeImage/Source/LibWebP/src/utils/bit_reader.h +168 -0
  500. data/vendor/FreeImage/Source/LibWebP/src/utils/bit_reader_inl.h +172 -0
  501. data/vendor/FreeImage/Source/LibWebP/src/utils/bit_writer.h +120 -0
  502. data/vendor/FreeImage/Source/LibWebP/src/utils/color_cache.h +74 -0
  503. data/vendor/FreeImage/Source/LibWebP/src/utils/endian_inl.h +100 -0
  504. data/vendor/FreeImage/Source/LibWebP/src/utils/filters.h +32 -0
  505. data/vendor/FreeImage/Source/LibWebP/src/utils/huffman.h +67 -0
  506. data/vendor/FreeImage/Source/LibWebP/src/utils/huffman_encode.h +60 -0
  507. data/vendor/FreeImage/Source/LibWebP/src/utils/quant_levels.h +36 -0
  508. data/vendor/FreeImage/Source/LibWebP/src/utils/quant_levels_dec.h +35 -0
  509. data/vendor/FreeImage/Source/LibWebP/src/utils/random.h +63 -0
  510. data/vendor/FreeImage/Source/LibWebP/src/utils/rescaler.h +78 -0
  511. data/vendor/FreeImage/Source/LibWebP/src/utils/thread.h +93 -0
  512. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.bit_reader.c +208 -0
  513. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.bit_writer.c +308 -0
  514. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.color_cache.c +49 -0
  515. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.filters.c +76 -0
  516. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.h +121 -0
  517. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.huffman.c +205 -0
  518. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.huffman_encode.c +417 -0
  519. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.quant_levels.c +140 -0
  520. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.quant_levels_dec.c +279 -0
  521. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.random.c +43 -0
  522. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.rescaler.c +82 -0
  523. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.thread.c +309 -0
  524. data/vendor/FreeImage/Source/LibWebP/src/utils/utils.utils.c +211 -0
  525. data/vendor/FreeImage/Source/LibWebP/src/webp/decode.h +493 -0
  526. data/vendor/FreeImage/Source/LibWebP/src/webp/demux.h +224 -0
  527. data/vendor/FreeImage/Source/LibWebP/src/webp/encode.h +515 -0
  528. data/vendor/FreeImage/Source/LibWebP/src/webp/format_constants.h +88 -0
  529. data/vendor/FreeImage/Source/LibWebP/src/webp/mux.h +507 -0
  530. data/vendor/FreeImage/Source/LibWebP/src/webp/mux_types.h +97 -0
  531. data/vendor/FreeImage/Source/LibWebP/src/webp/types.h +52 -0
  532. data/vendor/FreeImage/Source/MapIntrospector.h +212 -0
  533. data/vendor/FreeImage/Source/Metadata/Exif.cpp +1253 -0
  534. data/vendor/FreeImage/Source/Metadata/FIRational.cpp +176 -0
  535. data/vendor/FreeImage/Source/Metadata/FIRational.h +108 -0
  536. data/vendor/FreeImage/Source/Metadata/FreeImageTag.cpp +353 -0
  537. data/vendor/FreeImage/Source/Metadata/FreeImageTag.h +500 -0
  538. data/vendor/FreeImage/Source/Metadata/IPTC.cpp +342 -0
  539. data/vendor/FreeImage/Source/Metadata/TagConversion.cpp +1094 -0
  540. data/vendor/FreeImage/Source/Metadata/TagLib.cpp +1618 -0
  541. data/vendor/FreeImage/Source/Metadata/XTIFF.cpp +766 -0
  542. data/vendor/FreeImage/Source/OpenEXR/Half/eLut.cpp +114 -0
  543. data/vendor/FreeImage/Source/OpenEXR/Half/eLut.h +71 -0
  544. data/vendor/FreeImage/Source/OpenEXR/Half/half.cpp +310 -0
  545. data/vendor/FreeImage/Source/OpenEXR/Half/half.h +757 -0
  546. data/vendor/FreeImage/Source/OpenEXR/Half/halfExport.h +27 -0
  547. data/vendor/FreeImage/Source/OpenEXR/Half/halfFunction.h +179 -0
  548. data/vendor/FreeImage/Source/OpenEXR/Half/halfLimits.h +102 -0
  549. data/vendor/FreeImage/Source/OpenEXR/Half/toFloat.cpp +164 -0
  550. data/vendor/FreeImage/Source/OpenEXR/Half/toFloat.h +16391 -0
  551. data/vendor/FreeImage/Source/OpenEXR/Iex/Iex.h +60 -0
  552. data/vendor/FreeImage/Source/OpenEXR/Iex/IexBaseExc.cpp +156 -0
  553. data/vendor/FreeImage/Source/OpenEXR/Iex/IexBaseExc.h +264 -0
  554. data/vendor/FreeImage/Source/OpenEXR/Iex/IexErrnoExc.h +208 -0
  555. data/vendor/FreeImage/Source/OpenEXR/Iex/IexExport.h +51 -0
  556. data/vendor/FreeImage/Source/OpenEXR/Iex/IexForward.h +229 -0
  557. data/vendor/FreeImage/Source/OpenEXR/Iex/IexMacros.h +170 -0
  558. data/vendor/FreeImage/Source/OpenEXR/Iex/IexMathExc.h +57 -0
  559. data/vendor/FreeImage/Source/OpenEXR/Iex/IexNamespace.h +112 -0
  560. data/vendor/FreeImage/Source/OpenEXR/Iex/IexThrowErrnoExc.cpp +873 -0
  561. data/vendor/FreeImage/Source/OpenEXR/Iex/IexThrowErrnoExc.h +97 -0
  562. data/vendor/FreeImage/Source/OpenEXR/IexMath/IexMathFloatExc.cpp +113 -0
  563. data/vendor/FreeImage/Source/OpenEXR/IexMath/IexMathFloatExc.h +146 -0
  564. data/vendor/FreeImage/Source/OpenEXR/IexMath/IexMathFpu.cpp +530 -0
  565. data/vendor/FreeImage/Source/OpenEXR/IexMath/IexMathFpu.h +91 -0
  566. data/vendor/FreeImage/Source/OpenEXR/IexMath/IexMathIeeeExc.h +62 -0
  567. data/vendor/FreeImage/Source/OpenEXR/IlmBaseConfig.h +61 -0
  568. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfAcesFile.cpp +633 -0
  569. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfAcesFile.h +324 -0
  570. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfArray.h +285 -0
  571. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfAttribute.cpp +158 -0
  572. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfAttribute.h +407 -0
  573. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfAutoArray.h +95 -0
  574. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfB44Compressor.cpp +1072 -0
  575. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfB44Compressor.h +118 -0
  576. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfBoxAttribute.cpp +111 -0
  577. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfBoxAttribute.h +87 -0
  578. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCRgbaFile.cpp +1438 -0
  579. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCRgbaFile.h +555 -0
  580. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChannelList.cpp +322 -0
  581. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChannelList.h +436 -0
  582. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChannelListAttribute.cpp +150 -0
  583. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChannelListAttribute.h +74 -0
  584. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCheckedArithmetic.h +163 -0
  585. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChromaticities.cpp +151 -0
  586. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChromaticities.h +131 -0
  587. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChromaticitiesAttribute.cpp +87 -0
  588. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfChromaticitiesAttribute.h +73 -0
  589. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompositeDeepScanLine.cpp +591 -0
  590. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompositeDeepScanLine.h +142 -0
  591. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompression.h +84 -0
  592. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompressionAttribute.cpp +78 -0
  593. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompressionAttribute.h +64 -0
  594. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompressor.cpp +226 -0
  595. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfCompressor.h +265 -0
  596. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfConvert.cpp +143 -0
  597. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfConvert.h +107 -0
  598. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepCompositing.cpp +110 -0
  599. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepCompositing.h +132 -0
  600. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepFrameBuffer.cpp +230 -0
  601. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepFrameBuffer.h +339 -0
  602. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepImageState.h +96 -0
  603. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepImageStateAttribute.cpp +78 -0
  604. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepImageStateAttribute.h +68 -0
  605. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineInputFile.cpp +2025 -0
  606. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineInputFile.h +276 -0
  607. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineInputPart.cpp +149 -0
  608. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineInputPart.h +181 -0
  609. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineOutputFile.cpp +1552 -0
  610. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineOutputFile.h +244 -0
  611. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineOutputPart.cpp +107 -0
  612. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepScanLineOutputPart.h +168 -0
  613. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledInputFile.cpp +1979 -0
  614. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledInputFile.h +437 -0
  615. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledInputPart.cpp +273 -0
  616. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledInputPart.h +362 -0
  617. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledOutputFile.cpp +2055 -0
  618. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledOutputFile.h +475 -0
  619. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledOutputPart.cpp +250 -0
  620. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDeepTiledOutputPart.h +394 -0
  621. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDoubleAttribute.cpp +57 -0
  622. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDoubleAttribute.h +59 -0
  623. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDwaCompressor.cpp +3424 -0
  624. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDwaCompressor.h +210 -0
  625. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfDwaCompressorSimd.h +2145 -0
  626. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfEnvmap.cpp +335 -0
  627. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfEnvmap.h +336 -0
  628. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfEnvmapAttribute.cpp +76 -0
  629. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfEnvmapAttribute.h +68 -0
  630. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfExport.h +46 -0
  631. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFastHuf.cpp +768 -0
  632. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFastHuf.h +148 -0
  633. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFloatAttribute.cpp +57 -0
  634. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFloatAttribute.h +58 -0
  635. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFloatVectorAttribute.cpp +84 -0
  636. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFloatVectorAttribute.h +76 -0
  637. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfForward.h +127 -0
  638. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFrameBuffer.cpp +228 -0
  639. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFrameBuffer.h +386 -0
  640. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFramesPerSecond.cpp +76 -0
  641. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfFramesPerSecond.h +94 -0
  642. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfGenericInputFile.cpp +76 -0
  643. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfGenericInputFile.h +58 -0
  644. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfGenericOutputFile.cpp +112 -0
  645. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfGenericOutputFile.h +62 -0
  646. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfHeader.cpp +1283 -0
  647. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfHeader.h +699 -0
  648. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfHuf.cpp +1114 -0
  649. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfHuf.h +82 -0
  650. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfIO.cpp +110 -0
  651. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfIO.h +255 -0
  652. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputFile.cpp +895 -0
  653. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputFile.h +240 -0
  654. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputPart.cpp +114 -0
  655. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputPart.h +84 -0
  656. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputPartData.cpp +51 -0
  657. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputPartData.h +69 -0
  658. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInputStreamMutex.h +68 -0
  659. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfInt64.h +56 -0
  660. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfIntAttribute.cpp +57 -0
  661. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfIntAttribute.h +58 -0
  662. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfKeyCode.cpp +217 -0
  663. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfKeyCode.h +167 -0
  664. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfKeyCodeAttribute.cpp +99 -0
  665. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfKeyCodeAttribute.h +73 -0
  666. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfLineOrder.h +69 -0
  667. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfLineOrderAttribute.cpp +78 -0
  668. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfLineOrderAttribute.h +72 -0
  669. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfLut.cpp +178 -0
  670. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfLut.h +188 -0
  671. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMatrixAttribute.cpp +263 -0
  672. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMatrixAttribute.h +83 -0
  673. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMisc.cpp +1872 -0
  674. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMisc.h +466 -0
  675. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMultiPartInputFile.cpp +783 -0
  676. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMultiPartInputFile.h +128 -0
  677. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMultiPartOutputFile.cpp +519 -0
  678. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMultiPartOutputFile.h +118 -0
  679. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMultiView.cpp +435 -0
  680. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfMultiView.h +187 -0
  681. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfName.h +150 -0
  682. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfNamespace.h +115 -0
  683. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOpaqueAttribute.cpp +126 -0
  684. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOpaqueAttribute.h +110 -0
  685. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOptimizedPixelReading.h +646 -0
  686. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputFile.cpp +1378 -0
  687. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputFile.h +263 -0
  688. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputPart.cpp +105 -0
  689. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputPart.h +77 -0
  690. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputPartData.cpp +52 -0
  691. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputPartData.h +62 -0
  692. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfOutputStreamMutex.h +70 -0
  693. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPartHelper.h +262 -0
  694. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPartType.cpp +63 -0
  695. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPartType.h +62 -0
  696. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPixelType.h +67 -0
  697. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPizCompressor.cpp +667 -0
  698. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPizCompressor.h +117 -0
  699. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPreviewImage.cpp +104 -0
  700. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPreviewImage.h +135 -0
  701. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPreviewImageAttribute.cpp +103 -0
  702. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPreviewImageAttribute.h +70 -0
  703. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPxr24Compressor.cpp +553 -0
  704. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfPxr24Compressor.h +109 -0
  705. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRational.cpp +127 -0
  706. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRational.h +98 -0
  707. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRationalAttribute.cpp +74 -0
  708. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRationalAttribute.h +69 -0
  709. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRgba.h +109 -0
  710. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRgbaFile.cpp +1405 -0
  711. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRgbaFile.h +346 -0
  712. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRgbaYca.cpp +497 -0
  713. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRgbaYca.h +259 -0
  714. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRle.cpp +157 -0
  715. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRle.h +63 -0
  716. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRleCompressor.cpp +220 -0
  717. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfRleCompressor.h +80 -0
  718. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfScanLineInputFile.cpp +1702 -0
  719. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfScanLineInputFile.h +210 -0
  720. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfSimd.h +59 -0
  721. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStandardAttributes.cpp +125 -0
  722. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStandardAttributes.h +382 -0
  723. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStdIO.cpp +242 -0
  724. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStdIO.h +160 -0
  725. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStringAttribute.cpp +80 -0
  726. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStringAttribute.h +71 -0
  727. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStringVectorAttribute.cpp +100 -0
  728. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfStringVectorAttribute.h +74 -0
  729. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfSystemSpecific.cpp +129 -0
  730. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfSystemSpecific.h +172 -0
  731. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTestFile.cpp +216 -0
  732. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTestFile.h +97 -0
  733. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfThreading.cpp +62 -0
  734. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfThreading.h +95 -0
  735. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTileDescription.h +107 -0
  736. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTileDescriptionAttribute.cpp +86 -0
  737. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTileDescriptionAttribute.h +72 -0
  738. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTileOffsets.cpp +552 -0
  739. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTileOffsets.h +125 -0
  740. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledInputFile.cpp +1533 -0
  741. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledInputFile.h +401 -0
  742. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledInputPart.cpp +208 -0
  743. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledInputPart.h +100 -0
  744. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledMisc.cpp +389 -0
  745. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledMisc.h +106 -0
  746. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledOutputFile.cpp +1841 -0
  747. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledOutputFile.h +495 -0
  748. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledOutputPart.cpp +228 -0
  749. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledOutputPart.h +105 -0
  750. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledRgbaFile.cpp +1163 -0
  751. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTiledRgbaFile.h +482 -0
  752. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTimeCode.cpp +431 -0
  753. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTimeCode.h +242 -0
  754. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTimeCodeAttribute.cpp +79 -0
  755. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfTimeCodeAttribute.h +74 -0
  756. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfVecAttribute.cpp +217 -0
  757. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfVecAttribute.h +100 -0
  758. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfVersion.cpp +60 -0
  759. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfVersion.h +136 -0
  760. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfWav.cpp +391 -0
  761. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfWav.h +78 -0
  762. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfXdr.h +927 -0
  763. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfZip.cpp +196 -0
  764. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfZip.h +78 -0
  765. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfZipCompressor.cpp +127 -0
  766. data/vendor/FreeImage/Source/OpenEXR/IlmImf/ImfZipCompressor.h +89 -0
  767. data/vendor/FreeImage/Source/OpenEXR/IlmImf/b44ExpLogTable.cpp +136 -0
  768. data/vendor/FreeImage/Source/OpenEXR/IlmImf/b44ExpLogTable.h +16396 -0
  769. data/vendor/FreeImage/Source/OpenEXR/IlmImf/dwaLookups.cpp +573 -0
  770. data/vendor/FreeImage/Source/OpenEXR/IlmImf/dwaLookups.h +98334 -0
  771. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThread.cpp +80 -0
  772. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThread.h +143 -0
  773. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadExport.h +46 -0
  774. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadForward.h +52 -0
  775. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadMutex.cpp +59 -0
  776. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadMutex.h +160 -0
  777. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadMutexPosix.cpp +85 -0
  778. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadMutexWin32.cpp +79 -0
  779. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadNamespace.h +114 -0
  780. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadPool.cpp +483 -0
  781. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadPool.h +160 -0
  782. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadPosix.cpp +98 -0
  783. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadSemaphore.cpp +60 -0
  784. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadSemaphore.h +112 -0
  785. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadSemaphorePosix.cpp +106 -0
  786. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadSemaphorePosixCompat.cpp +155 -0
  787. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadSemaphoreWin32.cpp +153 -0
  788. data/vendor/FreeImage/Source/OpenEXR/IlmThread/IlmThreadWin32.cpp +100 -0
  789. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathBox.cpp +37 -0
  790. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathBox.h +849 -0
  791. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathBoxAlgo.h +1016 -0
  792. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathColor.h +736 -0
  793. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathColorAlgo.cpp +178 -0
  794. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathColorAlgo.h +257 -0
  795. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathEuler.h +926 -0
  796. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathExc.h +73 -0
  797. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathExport.h +46 -0
  798. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathForward.h +72 -0
  799. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathFrame.h +192 -0
  800. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathFrustum.h +741 -0
  801. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathFrustumTest.h +417 -0
  802. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathFun.cpp +181 -0
  803. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathFun.h +269 -0
  804. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathGL.h +166 -0
  805. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathGLU.h +54 -0
  806. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathHalfLimits.h +68 -0
  807. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathInt64.h +62 -0
  808. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathInterval.h +226 -0
  809. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathLimits.h +268 -0
  810. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathLine.h +185 -0
  811. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathLineAlgo.h +288 -0
  812. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathMath.h +208 -0
  813. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathMatrix.h +3441 -0
  814. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathMatrixAlgo.cpp +1252 -0
  815. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathMatrixAlgo.h +1425 -0
  816. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathNamespace.h +115 -0
  817. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathPlane.h +257 -0
  818. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathPlatform.h +112 -0
  819. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathQuat.h +964 -0
  820. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathRandom.cpp +194 -0
  821. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathRandom.h +401 -0
  822. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathRoots.h +219 -0
  823. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathShear.cpp +54 -0
  824. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathShear.h +656 -0
  825. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathSphere.h +177 -0
  826. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathVec.cpp +583 -0
  827. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathVec.h +2227 -0
  828. data/vendor/FreeImage/Source/OpenEXR/Imath/ImathVecAlgo.h +147 -0
  829. data/vendor/FreeImage/Source/OpenEXR/OpenEXRConfig.h +72 -0
  830. data/vendor/FreeImage/Source/Plugin.h +144 -0
  831. data/vendor/FreeImage/Source/Quantizers.h +354 -0
  832. data/vendor/FreeImage/Source/ToneMapping.h +44 -0
  833. data/vendor/FreeImage/Source/Utilities.h +516 -0
  834. data/vendor/FreeImage/Source/ZLib/adler32.c +179 -0
  835. data/vendor/FreeImage/Source/ZLib/compress.c +80 -0
  836. data/vendor/FreeImage/Source/ZLib/crc32.c +425 -0
  837. data/vendor/FreeImage/Source/ZLib/crc32.h +441 -0
  838. data/vendor/FreeImage/Source/ZLib/deflate.c +1967 -0
  839. data/vendor/FreeImage/Source/ZLib/deflate.h +346 -0
  840. data/vendor/FreeImage/Source/ZLib/gzclose.c +25 -0
  841. data/vendor/FreeImage/Source/ZLib/gzguts.h +209 -0
  842. data/vendor/FreeImage/Source/ZLib/gzlib.c +634 -0
  843. data/vendor/FreeImage/Source/ZLib/gzread.c +594 -0
  844. data/vendor/FreeImage/Source/ZLib/gzwrite.c +577 -0
  845. data/vendor/FreeImage/Source/ZLib/infback.c +640 -0
  846. data/vendor/FreeImage/Source/ZLib/inffast.c +340 -0
  847. data/vendor/FreeImage/Source/ZLib/inffast.h +11 -0
  848. data/vendor/FreeImage/Source/ZLib/inffixed.h +94 -0
  849. data/vendor/FreeImage/Source/ZLib/inflate.c +1512 -0
  850. data/vendor/FreeImage/Source/ZLib/inflate.h +122 -0
  851. data/vendor/FreeImage/Source/ZLib/inftrees.c +306 -0
  852. data/vendor/FreeImage/Source/ZLib/inftrees.h +62 -0
  853. data/vendor/FreeImage/Source/ZLib/trees.c +1226 -0
  854. data/vendor/FreeImage/Source/ZLib/trees.h +128 -0
  855. data/vendor/FreeImage/Source/ZLib/uncompr.c +59 -0
  856. data/vendor/FreeImage/Source/ZLib/zconf.h +511 -0
  857. data/vendor/FreeImage/Source/ZLib/zlib.h +1768 -0
  858. data/vendor/FreeImage/Source/ZLib/zutil.c +324 -0
  859. data/vendor/FreeImage/Source/ZLib/zutil.h +253 -0
  860. metadata +931 -0
@@ -0,0 +1,1611 @@
1
+
2
+ /* pngset.c - storage of image information into info struct
3
+ *
4
+ * Last changed in libpng 1.6.15 [November 20, 2014]
5
+ * Copyright (c) 1998-2014 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 functions here are used during reads to store data from the file
14
+ * into the info struct, and during writes to store application data
15
+ * into the info struct for writing into the file. This abstracts the
16
+ * info struct and allows us to change the structure in the future.
17
+ */
18
+
19
+ #include "pngpriv.h"
20
+
21
+ #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
22
+
23
+ #ifdef PNG_bKGD_SUPPORTED
24
+ void PNGAPI
25
+ png_set_bKGD(png_const_structrp png_ptr, png_inforp info_ptr,
26
+ png_const_color_16p background)
27
+ {
28
+ png_debug1(1, "in %s storage function", "bKGD");
29
+
30
+ if (png_ptr == NULL || info_ptr == NULL || background == NULL)
31
+ return;
32
+
33
+ info_ptr->background = *background;
34
+ info_ptr->valid |= PNG_INFO_bKGD;
35
+ }
36
+ #endif
37
+
38
+ #ifdef PNG_cHRM_SUPPORTED
39
+ void PNGFAPI
40
+ png_set_cHRM_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
41
+ png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
42
+ png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
43
+ png_fixed_point blue_x, png_fixed_point blue_y)
44
+ {
45
+ png_xy xy;
46
+
47
+ png_debug1(1, "in %s storage function", "cHRM fixed");
48
+
49
+ if (png_ptr == NULL || info_ptr == NULL)
50
+ return;
51
+
52
+ xy.redx = red_x;
53
+ xy.redy = red_y;
54
+ xy.greenx = green_x;
55
+ xy.greeny = green_y;
56
+ xy.bluex = blue_x;
57
+ xy.bluey = blue_y;
58
+ xy.whitex = white_x;
59
+ xy.whitey = white_y;
60
+
61
+ if (png_colorspace_set_chromaticities(png_ptr, &info_ptr->colorspace, &xy,
62
+ 2/* override with app values*/) != 0)
63
+ info_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_cHRM;
64
+
65
+ png_colorspace_sync_info(png_ptr, info_ptr);
66
+ }
67
+
68
+ void PNGFAPI
69
+ png_set_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
70
+ png_fixed_point int_red_X, png_fixed_point int_red_Y,
71
+ png_fixed_point int_red_Z, png_fixed_point int_green_X,
72
+ png_fixed_point int_green_Y, png_fixed_point int_green_Z,
73
+ png_fixed_point int_blue_X, png_fixed_point int_blue_Y,
74
+ png_fixed_point int_blue_Z)
75
+ {
76
+ png_XYZ XYZ;
77
+
78
+ png_debug1(1, "in %s storage function", "cHRM XYZ fixed");
79
+
80
+ if (png_ptr == NULL || info_ptr == NULL)
81
+ return;
82
+
83
+ XYZ.red_X = int_red_X;
84
+ XYZ.red_Y = int_red_Y;
85
+ XYZ.red_Z = int_red_Z;
86
+ XYZ.green_X = int_green_X;
87
+ XYZ.green_Y = int_green_Y;
88
+ XYZ.green_Z = int_green_Z;
89
+ XYZ.blue_X = int_blue_X;
90
+ XYZ.blue_Y = int_blue_Y;
91
+ XYZ.blue_Z = int_blue_Z;
92
+
93
+ if (png_colorspace_set_endpoints(png_ptr, &info_ptr->colorspace,
94
+ &XYZ, 2) != 0)
95
+ info_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_cHRM;
96
+
97
+ png_colorspace_sync_info(png_ptr, info_ptr);
98
+ }
99
+
100
+ # ifdef PNG_FLOATING_POINT_SUPPORTED
101
+ void PNGAPI
102
+ png_set_cHRM(png_const_structrp png_ptr, png_inforp info_ptr,
103
+ double white_x, double white_y, double red_x, double red_y,
104
+ double green_x, double green_y, double blue_x, double blue_y)
105
+ {
106
+ png_set_cHRM_fixed(png_ptr, info_ptr,
107
+ png_fixed(png_ptr, white_x, "cHRM White X"),
108
+ png_fixed(png_ptr, white_y, "cHRM White Y"),
109
+ png_fixed(png_ptr, red_x, "cHRM Red X"),
110
+ png_fixed(png_ptr, red_y, "cHRM Red Y"),
111
+ png_fixed(png_ptr, green_x, "cHRM Green X"),
112
+ png_fixed(png_ptr, green_y, "cHRM Green Y"),
113
+ png_fixed(png_ptr, blue_x, "cHRM Blue X"),
114
+ png_fixed(png_ptr, blue_y, "cHRM Blue Y"));
115
+ }
116
+
117
+ void PNGAPI
118
+ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X,
119
+ double red_Y, double red_Z, double green_X, double green_Y, double green_Z,
120
+ double blue_X, double blue_Y, double blue_Z)
121
+ {
122
+ png_set_cHRM_XYZ_fixed(png_ptr, info_ptr,
123
+ png_fixed(png_ptr, red_X, "cHRM Red X"),
124
+ png_fixed(png_ptr, red_Y, "cHRM Red Y"),
125
+ png_fixed(png_ptr, red_Z, "cHRM Red Z"),
126
+ png_fixed(png_ptr, green_X, "cHRM Red X"),
127
+ png_fixed(png_ptr, green_Y, "cHRM Red Y"),
128
+ png_fixed(png_ptr, green_Z, "cHRM Red Z"),
129
+ png_fixed(png_ptr, blue_X, "cHRM Red X"),
130
+ png_fixed(png_ptr, blue_Y, "cHRM Red Y"),
131
+ png_fixed(png_ptr, blue_Z, "cHRM Red Z"));
132
+ }
133
+ # endif /* FLOATING_POINT */
134
+
135
+ #endif /* cHRM */
136
+
137
+ #ifdef PNG_gAMA_SUPPORTED
138
+ void PNGFAPI
139
+ png_set_gAMA_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
140
+ png_fixed_point file_gamma)
141
+ {
142
+ png_debug1(1, "in %s storage function", "gAMA");
143
+
144
+ if (png_ptr == NULL || info_ptr == NULL)
145
+ return;
146
+
147
+ png_colorspace_set_gamma(png_ptr, &info_ptr->colorspace, file_gamma);
148
+ png_colorspace_sync_info(png_ptr, info_ptr);
149
+ }
150
+
151
+ # ifdef PNG_FLOATING_POINT_SUPPORTED
152
+ void PNGAPI
153
+ png_set_gAMA(png_const_structrp png_ptr, png_inforp info_ptr, double file_gamma)
154
+ {
155
+ png_set_gAMA_fixed(png_ptr, info_ptr, png_fixed(png_ptr, file_gamma,
156
+ "png_set_gAMA"));
157
+ }
158
+ # endif
159
+ #endif
160
+
161
+ #ifdef PNG_hIST_SUPPORTED
162
+ void PNGAPI
163
+ png_set_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
164
+ png_const_uint_16p hist)
165
+ {
166
+ int i;
167
+
168
+ png_debug1(1, "in %s storage function", "hIST");
169
+
170
+ if (png_ptr == NULL || info_ptr == NULL)
171
+ return;
172
+
173
+ if (info_ptr->num_palette == 0 || info_ptr->num_palette
174
+ > PNG_MAX_PALETTE_LENGTH)
175
+ {
176
+ png_warning(png_ptr,
177
+ "Invalid palette size, hIST allocation skipped");
178
+
179
+ return;
180
+ }
181
+
182
+ png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
183
+
184
+ /* Changed from info->num_palette to PNG_MAX_PALETTE_LENGTH in
185
+ * version 1.2.1
186
+ */
187
+ info_ptr->hist = png_voidcast(png_uint_16p, png_malloc_warn(png_ptr,
188
+ PNG_MAX_PALETTE_LENGTH * (sizeof (png_uint_16))));
189
+
190
+ if (info_ptr->hist == NULL)
191
+ {
192
+ png_warning(png_ptr, "Insufficient memory for hIST chunk data");
193
+ return;
194
+ }
195
+
196
+ info_ptr->free_me |= PNG_FREE_HIST;
197
+
198
+ for (i = 0; i < info_ptr->num_palette; i++)
199
+ info_ptr->hist[i] = hist[i];
200
+
201
+ info_ptr->valid |= PNG_INFO_hIST;
202
+ }
203
+ #endif
204
+
205
+ void PNGAPI
206
+ png_set_IHDR(png_const_structrp png_ptr, png_inforp info_ptr,
207
+ png_uint_32 width, png_uint_32 height, int bit_depth,
208
+ int color_type, int interlace_type, int compression_type,
209
+ int filter_type)
210
+ {
211
+ png_debug1(1, "in %s storage function", "IHDR");
212
+
213
+ if (png_ptr == NULL || info_ptr == NULL)
214
+ return;
215
+
216
+ info_ptr->width = width;
217
+ info_ptr->height = height;
218
+ info_ptr->bit_depth = (png_byte)bit_depth;
219
+ info_ptr->color_type = (png_byte)color_type;
220
+ info_ptr->compression_type = (png_byte)compression_type;
221
+ info_ptr->filter_type = (png_byte)filter_type;
222
+ info_ptr->interlace_type = (png_byte)interlace_type;
223
+
224
+ png_check_IHDR (png_ptr, info_ptr->width, info_ptr->height,
225
+ info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type,
226
+ info_ptr->compression_type, info_ptr->filter_type);
227
+
228
+ if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
229
+ info_ptr->channels = 1;
230
+
231
+ else if ((info_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
232
+ info_ptr->channels = 3;
233
+
234
+ else
235
+ info_ptr->channels = 1;
236
+
237
+ if ((info_ptr->color_type & PNG_COLOR_MASK_ALPHA) != 0)
238
+ info_ptr->channels++;
239
+
240
+ info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
241
+
242
+ info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
243
+ }
244
+
245
+ #ifdef PNG_oFFs_SUPPORTED
246
+ void PNGAPI
247
+ png_set_oFFs(png_const_structrp png_ptr, png_inforp info_ptr,
248
+ png_int_32 offset_x, png_int_32 offset_y, int unit_type)
249
+ {
250
+ png_debug1(1, "in %s storage function", "oFFs");
251
+
252
+ if (png_ptr == NULL || info_ptr == NULL)
253
+ return;
254
+
255
+ info_ptr->x_offset = offset_x;
256
+ info_ptr->y_offset = offset_y;
257
+ info_ptr->offset_unit_type = (png_byte)unit_type;
258
+ info_ptr->valid |= PNG_INFO_oFFs;
259
+ }
260
+ #endif
261
+
262
+ #ifdef PNG_pCAL_SUPPORTED
263
+ void PNGAPI
264
+ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
265
+ png_const_charp purpose, png_int_32 X0, png_int_32 X1, int type,
266
+ int nparams, png_const_charp units, png_charpp params)
267
+ {
268
+ png_size_t length;
269
+ int i;
270
+
271
+ png_debug1(1, "in %s storage function", "pCAL");
272
+
273
+ if (png_ptr == NULL || info_ptr == NULL || purpose == NULL || units == NULL
274
+ || (nparams > 0 && params == NULL))
275
+ return;
276
+
277
+ length = strlen(purpose) + 1;
278
+ png_debug1(3, "allocating purpose for info (%lu bytes)",
279
+ (unsigned long)length);
280
+
281
+ /* TODO: validate format of calibration name and unit name */
282
+
283
+ /* Check that the type matches the specification. */
284
+ if (type < 0 || type > 3)
285
+ png_error(png_ptr, "Invalid pCAL equation type");
286
+
287
+ if (nparams < 0 || nparams > 255)
288
+ png_error(png_ptr, "Invalid pCAL parameter count");
289
+
290
+ /* Validate params[nparams] */
291
+ for (i=0; i<nparams; ++i)
292
+ {
293
+ if (params[i] == NULL ||
294
+ !png_check_fp_string(params[i], strlen(params[i])))
295
+ png_error(png_ptr, "Invalid format for pCAL parameter");
296
+ }
297
+
298
+ info_ptr->pcal_purpose = png_voidcast(png_charp,
299
+ png_malloc_warn(png_ptr, length));
300
+
301
+ if (info_ptr->pcal_purpose == NULL)
302
+ {
303
+ png_warning(png_ptr, "Insufficient memory for pCAL purpose");
304
+ return;
305
+ }
306
+
307
+ memcpy(info_ptr->pcal_purpose, purpose, length);
308
+
309
+ png_debug(3, "storing X0, X1, type, and nparams in info");
310
+ info_ptr->pcal_X0 = X0;
311
+ info_ptr->pcal_X1 = X1;
312
+ info_ptr->pcal_type = (png_byte)type;
313
+ info_ptr->pcal_nparams = (png_byte)nparams;
314
+
315
+ length = strlen(units) + 1;
316
+ png_debug1(3, "allocating units for info (%lu bytes)",
317
+ (unsigned long)length);
318
+
319
+ info_ptr->pcal_units = png_voidcast(png_charp,
320
+ png_malloc_warn(png_ptr, length));
321
+
322
+ if (info_ptr->pcal_units == NULL)
323
+ {
324
+ png_warning(png_ptr, "Insufficient memory for pCAL units");
325
+ return;
326
+ }
327
+
328
+ memcpy(info_ptr->pcal_units, units, length);
329
+
330
+ info_ptr->pcal_params = png_voidcast(png_charpp, png_malloc_warn(png_ptr,
331
+ (png_size_t)((nparams + 1) * (sizeof (png_charp)))));
332
+
333
+ if (info_ptr->pcal_params == NULL)
334
+ {
335
+ png_warning(png_ptr, "Insufficient memory for pCAL params");
336
+ return;
337
+ }
338
+
339
+ memset(info_ptr->pcal_params, 0, (nparams + 1) * (sizeof (png_charp)));
340
+
341
+ for (i = 0; i < nparams; i++)
342
+ {
343
+ length = strlen(params[i]) + 1;
344
+ png_debug2(3, "allocating parameter %d for info (%lu bytes)", i,
345
+ (unsigned long)length);
346
+
347
+ info_ptr->pcal_params[i] = (png_charp)png_malloc_warn(png_ptr, length);
348
+
349
+ if (info_ptr->pcal_params[i] == NULL)
350
+ {
351
+ png_warning(png_ptr, "Insufficient memory for pCAL parameter");
352
+ return;
353
+ }
354
+
355
+ memcpy(info_ptr->pcal_params[i], params[i], length);
356
+ }
357
+
358
+ info_ptr->valid |= PNG_INFO_pCAL;
359
+ info_ptr->free_me |= PNG_FREE_PCAL;
360
+ }
361
+ #endif
362
+
363
+ #ifdef PNG_sCAL_SUPPORTED
364
+ void PNGAPI
365
+ png_set_sCAL_s(png_const_structrp png_ptr, png_inforp info_ptr,
366
+ int unit, png_const_charp swidth, png_const_charp sheight)
367
+ {
368
+ png_size_t lengthw = 0, lengthh = 0;
369
+
370
+ png_debug1(1, "in %s storage function", "sCAL");
371
+
372
+ if (png_ptr == NULL || info_ptr == NULL)
373
+ return;
374
+
375
+ /* Double check the unit (should never get here with an invalid
376
+ * unit unless this is an API call.)
377
+ */
378
+ if (unit != 1 && unit != 2)
379
+ png_error(png_ptr, "Invalid sCAL unit");
380
+
381
+ if (swidth == NULL || (lengthw = strlen(swidth)) == 0 ||
382
+ swidth[0] == 45 /* '-' */ || !png_check_fp_string(swidth, lengthw))
383
+ png_error(png_ptr, "Invalid sCAL width");
384
+
385
+ if (sheight == NULL || (lengthh = strlen(sheight)) == 0 ||
386
+ sheight[0] == 45 /* '-' */ || !png_check_fp_string(sheight, lengthh))
387
+ png_error(png_ptr, "Invalid sCAL height");
388
+
389
+ info_ptr->scal_unit = (png_byte)unit;
390
+
391
+ ++lengthw;
392
+
393
+ png_debug1(3, "allocating unit for info (%u bytes)", (unsigned int)lengthw);
394
+
395
+ info_ptr->scal_s_width = png_voidcast(png_charp,
396
+ png_malloc_warn(png_ptr, lengthw));
397
+
398
+ if (info_ptr->scal_s_width == NULL)
399
+ {
400
+ png_warning(png_ptr, "Memory allocation failed while processing sCAL");
401
+ return;
402
+ }
403
+
404
+ memcpy(info_ptr->scal_s_width, swidth, lengthw);
405
+
406
+ ++lengthh;
407
+
408
+ png_debug1(3, "allocating unit for info (%u bytes)", (unsigned int)lengthh);
409
+
410
+ info_ptr->scal_s_height = png_voidcast(png_charp,
411
+ png_malloc_warn(png_ptr, lengthh));
412
+
413
+ if (info_ptr->scal_s_height == NULL)
414
+ {
415
+ png_free (png_ptr, info_ptr->scal_s_width);
416
+ info_ptr->scal_s_width = NULL;
417
+
418
+ png_warning(png_ptr, "Memory allocation failed while processing sCAL");
419
+ return;
420
+ }
421
+
422
+ memcpy(info_ptr->scal_s_height, sheight, lengthh);
423
+
424
+ info_ptr->valid |= PNG_INFO_sCAL;
425
+ info_ptr->free_me |= PNG_FREE_SCAL;
426
+ }
427
+
428
+ # ifdef PNG_FLOATING_POINT_SUPPORTED
429
+ void PNGAPI
430
+ png_set_sCAL(png_const_structrp png_ptr, png_inforp info_ptr, int unit,
431
+ double width, double height)
432
+ {
433
+ png_debug1(1, "in %s storage function", "sCAL");
434
+
435
+ /* Check the arguments. */
436
+ if (width <= 0)
437
+ png_warning(png_ptr, "Invalid sCAL width ignored");
438
+
439
+ else if (height <= 0)
440
+ png_warning(png_ptr, "Invalid sCAL height ignored");
441
+
442
+ else
443
+ {
444
+ /* Convert 'width' and 'height' to ASCII. */
445
+ char swidth[PNG_sCAL_MAX_DIGITS+1];
446
+ char sheight[PNG_sCAL_MAX_DIGITS+1];
447
+
448
+ png_ascii_from_fp(png_ptr, swidth, (sizeof swidth), width,
449
+ PNG_sCAL_PRECISION);
450
+ png_ascii_from_fp(png_ptr, sheight, (sizeof sheight), height,
451
+ PNG_sCAL_PRECISION);
452
+
453
+ png_set_sCAL_s(png_ptr, info_ptr, unit, swidth, sheight);
454
+ }
455
+ }
456
+ # endif
457
+
458
+ # ifdef PNG_FIXED_POINT_SUPPORTED
459
+ void PNGAPI
460
+ png_set_sCAL_fixed(png_const_structrp png_ptr, png_inforp info_ptr, int unit,
461
+ png_fixed_point width, png_fixed_point height)
462
+ {
463
+ png_debug1(1, "in %s storage function", "sCAL");
464
+
465
+ /* Check the arguments. */
466
+ if (width <= 0)
467
+ png_warning(png_ptr, "Invalid sCAL width ignored");
468
+
469
+ else if (height <= 0)
470
+ png_warning(png_ptr, "Invalid sCAL height ignored");
471
+
472
+ else
473
+ {
474
+ /* Convert 'width' and 'height' to ASCII. */
475
+ char swidth[PNG_sCAL_MAX_DIGITS+1];
476
+ char sheight[PNG_sCAL_MAX_DIGITS+1];
477
+
478
+ png_ascii_from_fixed(png_ptr, swidth, (sizeof swidth), width);
479
+ png_ascii_from_fixed(png_ptr, sheight, (sizeof sheight), height);
480
+
481
+ png_set_sCAL_s(png_ptr, info_ptr, unit, swidth, sheight);
482
+ }
483
+ }
484
+ # endif
485
+ #endif
486
+
487
+ #ifdef PNG_pHYs_SUPPORTED
488
+ void PNGAPI
489
+ png_set_pHYs(png_const_structrp png_ptr, png_inforp info_ptr,
490
+ png_uint_32 res_x, png_uint_32 res_y, int unit_type)
491
+ {
492
+ png_debug1(1, "in %s storage function", "pHYs");
493
+
494
+ if (png_ptr == NULL || info_ptr == NULL)
495
+ return;
496
+
497
+ info_ptr->x_pixels_per_unit = res_x;
498
+ info_ptr->y_pixels_per_unit = res_y;
499
+ info_ptr->phys_unit_type = (png_byte)unit_type;
500
+ info_ptr->valid |= PNG_INFO_pHYs;
501
+ }
502
+ #endif
503
+
504
+ void PNGAPI
505
+ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
506
+ png_const_colorp palette, int num_palette)
507
+ {
508
+
509
+ png_debug1(1, "in %s storage function", "PLTE");
510
+
511
+ if (png_ptr == NULL || info_ptr == NULL)
512
+ return;
513
+
514
+ if (num_palette < 0 || num_palette > PNG_MAX_PALETTE_LENGTH)
515
+ {
516
+ if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
517
+ png_error(png_ptr, "Invalid palette length");
518
+
519
+ else
520
+ {
521
+ png_warning(png_ptr, "Invalid palette length");
522
+ return;
523
+ }
524
+ }
525
+
526
+ if ((num_palette > 0 && palette == NULL) ||
527
+ (num_palette == 0
528
+ # ifdef PNG_MNG_FEATURES_SUPPORTED
529
+ && (png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0
530
+ # endif
531
+ ))
532
+ {
533
+ png_error(png_ptr, "Invalid palette");
534
+ return;
535
+ }
536
+
537
+ /* It may not actually be necessary to set png_ptr->palette here;
538
+ * we do it for backward compatibility with the way the png_handle_tRNS
539
+ * function used to do the allocation.
540
+ *
541
+ * 1.6.0: the above statement appears to be incorrect; something has to set
542
+ * the palette inside png_struct on read.
543
+ */
544
+ png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
545
+
546
+ /* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead
547
+ * of num_palette entries, in case of an invalid PNG file that has
548
+ * too-large sample values.
549
+ */
550
+ png_ptr->palette = png_voidcast(png_colorp, png_calloc(png_ptr,
551
+ PNG_MAX_PALETTE_LENGTH * (sizeof (png_color))));
552
+
553
+ if (num_palette > 0)
554
+ memcpy(png_ptr->palette, palette, num_palette * (sizeof (png_color)));
555
+ info_ptr->palette = png_ptr->palette;
556
+ info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
557
+
558
+ info_ptr->free_me |= PNG_FREE_PLTE;
559
+
560
+ info_ptr->valid |= PNG_INFO_PLTE;
561
+ }
562
+
563
+ #ifdef PNG_sBIT_SUPPORTED
564
+ void PNGAPI
565
+ png_set_sBIT(png_const_structrp png_ptr, png_inforp info_ptr,
566
+ png_const_color_8p sig_bit)
567
+ {
568
+ png_debug1(1, "in %s storage function", "sBIT");
569
+
570
+ if (png_ptr == NULL || info_ptr == NULL || sig_bit == NULL)
571
+ return;
572
+
573
+ info_ptr->sig_bit = *sig_bit;
574
+ info_ptr->valid |= PNG_INFO_sBIT;
575
+ }
576
+ #endif
577
+
578
+ #ifdef PNG_sRGB_SUPPORTED
579
+ void PNGAPI
580
+ png_set_sRGB(png_const_structrp png_ptr, png_inforp info_ptr, int srgb_intent)
581
+ {
582
+ png_debug1(1, "in %s storage function", "sRGB");
583
+
584
+ if (png_ptr == NULL || info_ptr == NULL)
585
+ return;
586
+
587
+ (void)png_colorspace_set_sRGB(png_ptr, &info_ptr->colorspace, srgb_intent);
588
+ png_colorspace_sync_info(png_ptr, info_ptr);
589
+ }
590
+
591
+ void PNGAPI
592
+ png_set_sRGB_gAMA_and_cHRM(png_const_structrp png_ptr, png_inforp info_ptr,
593
+ int srgb_intent)
594
+ {
595
+ png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM");
596
+
597
+ if (png_ptr == NULL || info_ptr == NULL)
598
+ return;
599
+
600
+ if (png_colorspace_set_sRGB(png_ptr, &info_ptr->colorspace,
601
+ srgb_intent) != 0)
602
+ {
603
+ /* This causes the gAMA and cHRM to be written too */
604
+ info_ptr->colorspace.flags |=
605
+ PNG_COLORSPACE_FROM_gAMA|PNG_COLORSPACE_FROM_cHRM;
606
+ }
607
+
608
+ png_colorspace_sync_info(png_ptr, info_ptr);
609
+ }
610
+ #endif /* sRGB */
611
+
612
+
613
+ #ifdef PNG_iCCP_SUPPORTED
614
+ void PNGAPI
615
+ png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
616
+ png_const_charp name, int compression_type,
617
+ png_const_bytep profile, png_uint_32 proflen)
618
+ {
619
+ png_charp new_iccp_name;
620
+ png_bytep new_iccp_profile;
621
+ png_size_t length;
622
+
623
+ png_debug1(1, "in %s storage function", "iCCP");
624
+
625
+ if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL)
626
+ return;
627
+
628
+ if (compression_type != PNG_COMPRESSION_TYPE_BASE)
629
+ png_app_error(png_ptr, "Invalid iCCP compression method");
630
+
631
+ /* Set the colorspace first because this validates the profile; do not
632
+ * override previously set app cHRM or gAMA here (because likely as not the
633
+ * application knows better than libpng what the correct values are.) Pass
634
+ * the info_ptr color_type field to png_colorspace_set_ICC because in the
635
+ * write case it has not yet been stored in png_ptr.
636
+ */
637
+ {
638
+ int result = png_colorspace_set_ICC(png_ptr, &info_ptr->colorspace, name,
639
+ proflen, profile, info_ptr->color_type);
640
+
641
+ png_colorspace_sync_info(png_ptr, info_ptr);
642
+
643
+ /* Don't do any of the copying if the profile was bad, or inconsistent. */
644
+ if (result == 0)
645
+ return;
646
+
647
+ /* But do write the gAMA and cHRM chunks from the profile. */
648
+ info_ptr->colorspace.flags |=
649
+ PNG_COLORSPACE_FROM_gAMA|PNG_COLORSPACE_FROM_cHRM;
650
+ }
651
+
652
+ length = strlen(name)+1;
653
+ new_iccp_name = png_voidcast(png_charp, png_malloc_warn(png_ptr, length));
654
+
655
+ if (new_iccp_name == NULL)
656
+ {
657
+ png_benign_error(png_ptr, "Insufficient memory to process iCCP chunk");
658
+ return;
659
+ }
660
+
661
+ memcpy(new_iccp_name, name, length);
662
+ new_iccp_profile = png_voidcast(png_bytep,
663
+ png_malloc_warn(png_ptr, proflen));
664
+
665
+ if (new_iccp_profile == NULL)
666
+ {
667
+ png_free(png_ptr, new_iccp_name);
668
+ new_iccp_name = NULL;
669
+ png_benign_error(png_ptr,
670
+ "Insufficient memory to process iCCP profile");
671
+ return;
672
+ }
673
+
674
+ memcpy(new_iccp_profile, profile, proflen);
675
+
676
+ png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0);
677
+
678
+ info_ptr->iccp_proflen = proflen;
679
+ info_ptr->iccp_name = new_iccp_name;
680
+ info_ptr->iccp_profile = new_iccp_profile;
681
+ info_ptr->free_me |= PNG_FREE_ICCP;
682
+ info_ptr->valid |= PNG_INFO_iCCP;
683
+ }
684
+ #endif
685
+
686
+ #ifdef PNG_TEXT_SUPPORTED
687
+ void PNGAPI
688
+ png_set_text(png_const_structrp png_ptr, png_inforp info_ptr,
689
+ png_const_textp text_ptr, int num_text)
690
+ {
691
+ int ret;
692
+ ret = png_set_text_2(png_ptr, info_ptr, text_ptr, num_text);
693
+
694
+ if (ret != 0)
695
+ png_error(png_ptr, "Insufficient memory to store text");
696
+ }
697
+
698
+ int /* PRIVATE */
699
+ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
700
+ png_const_textp text_ptr, int num_text)
701
+ {
702
+ int i;
703
+
704
+ png_debug1(1, "in %lx storage function", png_ptr == NULL ? "unexpected" :
705
+ (unsigned long)png_ptr->chunk_name);
706
+
707
+ if (png_ptr == NULL || info_ptr == NULL || num_text <= 0 || text_ptr == NULL)
708
+ return(0);
709
+
710
+ /* Make sure we have enough space in the "text" array in info_struct
711
+ * to hold all of the incoming text_ptr objects. This compare can't overflow
712
+ * because max_text >= num_text (anyway, subtract of two positive integers
713
+ * can't overflow in any case.)
714
+ */
715
+ if (num_text > info_ptr->max_text - info_ptr->num_text)
716
+ {
717
+ int old_num_text = info_ptr->num_text;
718
+ int max_text;
719
+ png_textp new_text = NULL;
720
+
721
+ /* Calculate an appropriate max_text, checking for overflow. */
722
+ max_text = old_num_text;
723
+ if (num_text <= INT_MAX - max_text)
724
+ {
725
+ max_text += num_text;
726
+
727
+ /* Round up to a multiple of 8 */
728
+ if (max_text < INT_MAX-8)
729
+ max_text = (max_text + 8) & ~0x7;
730
+
731
+ else
732
+ max_text = INT_MAX;
733
+
734
+ /* Now allocate a new array and copy the old members in; this does all
735
+ * the overflow checks.
736
+ */
737
+ new_text = png_voidcast(png_textp,png_realloc_array(png_ptr,
738
+ info_ptr->text, old_num_text, max_text-old_num_text,
739
+ sizeof *new_text));
740
+ }
741
+
742
+ if (new_text == NULL)
743
+ {
744
+ png_chunk_report(png_ptr, "too many text chunks",
745
+ PNG_CHUNK_WRITE_ERROR);
746
+ return 1;
747
+ }
748
+
749
+ png_free(png_ptr, info_ptr->text);
750
+
751
+ info_ptr->text = new_text;
752
+ info_ptr->free_me |= PNG_FREE_TEXT;
753
+ info_ptr->max_text = max_text;
754
+ /* num_text is adjusted below as the entries are copied in */
755
+
756
+ png_debug1(3, "allocated %d entries for info_ptr->text", max_text);
757
+ }
758
+
759
+ for (i = 0; i < num_text; i++)
760
+ {
761
+ size_t text_length, key_len;
762
+ size_t lang_len, lang_key_len;
763
+ png_textp textp = &(info_ptr->text[info_ptr->num_text]);
764
+
765
+ if (text_ptr[i].key == NULL)
766
+ continue;
767
+
768
+ if (text_ptr[i].compression < PNG_TEXT_COMPRESSION_NONE ||
769
+ text_ptr[i].compression >= PNG_TEXT_COMPRESSION_LAST)
770
+ {
771
+ png_chunk_report(png_ptr, "text compression mode is out of range",
772
+ PNG_CHUNK_WRITE_ERROR);
773
+ continue;
774
+ }
775
+
776
+ key_len = strlen(text_ptr[i].key);
777
+
778
+ if (text_ptr[i].compression <= 0)
779
+ {
780
+ lang_len = 0;
781
+ lang_key_len = 0;
782
+ }
783
+
784
+ else
785
+ # ifdef PNG_iTXt_SUPPORTED
786
+ {
787
+ /* Set iTXt data */
788
+
789
+ if (text_ptr[i].lang != NULL)
790
+ lang_len = strlen(text_ptr[i].lang);
791
+
792
+ else
793
+ lang_len = 0;
794
+
795
+ if (text_ptr[i].lang_key != NULL)
796
+ lang_key_len = strlen(text_ptr[i].lang_key);
797
+
798
+ else
799
+ lang_key_len = 0;
800
+ }
801
+ # else /* PNG_iTXt_SUPPORTED */
802
+ {
803
+ png_chunk_report(png_ptr, "iTXt chunk not supported",
804
+ PNG_CHUNK_WRITE_ERROR);
805
+ continue;
806
+ }
807
+ # endif
808
+
809
+ if (text_ptr[i].text == NULL || text_ptr[i].text[0] == '\0')
810
+ {
811
+ text_length = 0;
812
+ # ifdef PNG_iTXt_SUPPORTED
813
+ if (text_ptr[i].compression > 0)
814
+ textp->compression = PNG_ITXT_COMPRESSION_NONE;
815
+
816
+ else
817
+ # endif
818
+ textp->compression = PNG_TEXT_COMPRESSION_NONE;
819
+ }
820
+
821
+ else
822
+ {
823
+ text_length = strlen(text_ptr[i].text);
824
+ textp->compression = text_ptr[i].compression;
825
+ }
826
+
827
+ textp->key = png_voidcast(png_charp,png_malloc_base(png_ptr,
828
+ key_len + text_length + lang_len + lang_key_len + 4));
829
+
830
+ if (textp->key == NULL)
831
+ {
832
+ png_chunk_report(png_ptr, "text chunk: out of memory",
833
+ PNG_CHUNK_WRITE_ERROR);
834
+ return 1;
835
+ }
836
+
837
+ png_debug2(2, "Allocated %lu bytes at %p in png_set_text",
838
+ (unsigned long)(png_uint_32)
839
+ (key_len + lang_len + lang_key_len + text_length + 4),
840
+ textp->key);
841
+
842
+ memcpy(textp->key, text_ptr[i].key, key_len);
843
+ *(textp->key + key_len) = '\0';
844
+
845
+ if (text_ptr[i].compression > 0)
846
+ {
847
+ textp->lang = textp->key + key_len + 1;
848
+ memcpy(textp->lang, text_ptr[i].lang, lang_len);
849
+ *(textp->lang + lang_len) = '\0';
850
+ textp->lang_key = textp->lang + lang_len + 1;
851
+ memcpy(textp->lang_key, text_ptr[i].lang_key, lang_key_len);
852
+ *(textp->lang_key + lang_key_len) = '\0';
853
+ textp->text = textp->lang_key + lang_key_len + 1;
854
+ }
855
+
856
+ else
857
+ {
858
+ textp->lang=NULL;
859
+ textp->lang_key=NULL;
860
+ textp->text = textp->key + key_len + 1;
861
+ }
862
+
863
+ if (text_length != 0)
864
+ memcpy(textp->text, text_ptr[i].text, text_length);
865
+
866
+ *(textp->text + text_length) = '\0';
867
+
868
+ # ifdef PNG_iTXt_SUPPORTED
869
+ if (textp->compression > 0)
870
+ {
871
+ textp->text_length = 0;
872
+ textp->itxt_length = text_length;
873
+ }
874
+
875
+ else
876
+ # endif
877
+ {
878
+ textp->text_length = text_length;
879
+ textp->itxt_length = 0;
880
+ }
881
+
882
+ info_ptr->num_text++;
883
+ png_debug1(3, "transferred text chunk %d", info_ptr->num_text);
884
+ }
885
+
886
+ return(0);
887
+ }
888
+ #endif
889
+
890
+ #ifdef PNG_tIME_SUPPORTED
891
+ void PNGAPI
892
+ png_set_tIME(png_const_structrp png_ptr, png_inforp info_ptr,
893
+ png_const_timep mod_time)
894
+ {
895
+ png_debug1(1, "in %s storage function", "tIME");
896
+
897
+ if (png_ptr == NULL || info_ptr == NULL || mod_time == NULL ||
898
+ (png_ptr->mode & PNG_WROTE_tIME) != 0)
899
+ return;
900
+
901
+ if (mod_time->month == 0 || mod_time->month > 12 ||
902
+ mod_time->day == 0 || mod_time->day > 31 ||
903
+ mod_time->hour > 23 || mod_time->minute > 59 ||
904
+ mod_time->second > 60)
905
+ {
906
+ png_warning(png_ptr, "Ignoring invalid time value");
907
+ return;
908
+ }
909
+
910
+ info_ptr->mod_time = *mod_time;
911
+ info_ptr->valid |= PNG_INFO_tIME;
912
+ }
913
+ #endif
914
+
915
+ #ifdef PNG_tRNS_SUPPORTED
916
+ void PNGAPI
917
+ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
918
+ png_const_bytep trans_alpha, int num_trans, png_const_color_16p trans_color)
919
+ {
920
+ png_debug1(1, "in %s storage function", "tRNS");
921
+
922
+ if (png_ptr == NULL || info_ptr == NULL)
923
+ return;
924
+
925
+ if (trans_alpha != NULL)
926
+ {
927
+ /* It may not actually be necessary to set png_ptr->trans_alpha here;
928
+ * we do it for backward compatibility with the way the png_handle_tRNS
929
+ * function used to do the allocation.
930
+ *
931
+ * 1.6.0: The above statement is incorrect; png_handle_tRNS effectively
932
+ * relies on png_set_tRNS storing the information in png_struct
933
+ * (otherwise it won't be there for the code in pngrtran.c).
934
+ */
935
+
936
+ png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
937
+
938
+ /* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
939
+ png_ptr->trans_alpha = info_ptr->trans_alpha = png_voidcast(png_bytep,
940
+ png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH));
941
+
942
+ if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH)
943
+ memcpy(info_ptr->trans_alpha, trans_alpha, (png_size_t)num_trans);
944
+ }
945
+
946
+ if (trans_color != NULL)
947
+ {
948
+ int sample_max = (1 << info_ptr->bit_depth);
949
+
950
+ if ((info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
951
+ trans_color->gray > sample_max) ||
952
+ (info_ptr->color_type == PNG_COLOR_TYPE_RGB &&
953
+ (trans_color->red > sample_max ||
954
+ trans_color->green > sample_max ||
955
+ trans_color->blue > sample_max)))
956
+ png_warning(png_ptr,
957
+ "tRNS chunk has out-of-range samples for bit_depth");
958
+
959
+ info_ptr->trans_color = *trans_color;
960
+
961
+ if (num_trans == 0)
962
+ num_trans = 1;
963
+ }
964
+
965
+ info_ptr->num_trans = (png_uint_16)num_trans;
966
+
967
+ if (num_trans != 0)
968
+ {
969
+ info_ptr->valid |= PNG_INFO_tRNS;
970
+ info_ptr->free_me |= PNG_FREE_TRNS;
971
+ }
972
+ }
973
+ #endif
974
+
975
+ #ifdef PNG_sPLT_SUPPORTED
976
+ void PNGAPI
977
+ png_set_sPLT(png_const_structrp png_ptr,
978
+ png_inforp info_ptr, png_const_sPLT_tp entries, int nentries)
979
+ /*
980
+ * entries - array of png_sPLT_t structures
981
+ * to be added to the list of palettes
982
+ * in the info structure.
983
+ *
984
+ * nentries - number of palette structures to be
985
+ * added.
986
+ */
987
+ {
988
+ png_sPLT_tp np;
989
+
990
+ if (png_ptr == NULL || info_ptr == NULL || nentries <= 0 || entries == NULL)
991
+ return;
992
+
993
+ /* Use the internal realloc function, which checks for all the possible
994
+ * overflows. Notice that the parameters are (int) and (size_t)
995
+ */
996
+ np = png_voidcast(png_sPLT_tp,png_realloc_array(png_ptr,
997
+ info_ptr->splt_palettes, info_ptr->splt_palettes_num, nentries,
998
+ sizeof *np));
999
+
1000
+ if (np == NULL)
1001
+ {
1002
+ /* Out of memory or too many chunks */
1003
+ png_chunk_report(png_ptr, "too many sPLT chunks", PNG_CHUNK_WRITE_ERROR);
1004
+ return;
1005
+ }
1006
+
1007
+ png_free(png_ptr, info_ptr->splt_palettes);
1008
+ info_ptr->splt_palettes = np;
1009
+ info_ptr->free_me |= PNG_FREE_SPLT;
1010
+
1011
+ np += info_ptr->splt_palettes_num;
1012
+
1013
+ do
1014
+ {
1015
+ png_size_t length;
1016
+
1017
+ /* Skip invalid input entries */
1018
+ if (entries->name == NULL || entries->entries == NULL)
1019
+ {
1020
+ /* png_handle_sPLT doesn't do this, so this is an app error */
1021
+ png_app_error(png_ptr, "png_set_sPLT: invalid sPLT");
1022
+ /* Just skip the invalid entry */
1023
+ continue;
1024
+ }
1025
+
1026
+ np->depth = entries->depth;
1027
+
1028
+ /* In the event of out-of-memory just return - there's no point keeping
1029
+ * on trying to add sPLT chunks.
1030
+ */
1031
+ length = strlen(entries->name) + 1;
1032
+ np->name = png_voidcast(png_charp, png_malloc_base(png_ptr, length));
1033
+
1034
+ if (np->name == NULL)
1035
+ break;
1036
+
1037
+ memcpy(np->name, entries->name, length);
1038
+
1039
+ /* IMPORTANT: we have memory now that won't get freed if something else
1040
+ * goes wrong; this code must free it. png_malloc_array produces no
1041
+ * warnings; use a png_chunk_report (below) if there is an error.
1042
+ */
1043
+ np->entries = png_voidcast(png_sPLT_entryp, png_malloc_array(png_ptr,
1044
+ entries->nentries, sizeof (png_sPLT_entry)));
1045
+
1046
+ if (np->entries == NULL)
1047
+ {
1048
+ png_free(png_ptr, np->name);
1049
+ np->name = NULL;
1050
+ break;
1051
+ }
1052
+
1053
+ np->nentries = entries->nentries;
1054
+ /* This multiply can't overflow because png_malloc_array has already
1055
+ * checked it when doing the allocation.
1056
+ */
1057
+ memcpy(np->entries, entries->entries,
1058
+ entries->nentries * sizeof (png_sPLT_entry));
1059
+
1060
+ /* Note that 'continue' skips the advance of the out pointer and out
1061
+ * count, so an invalid entry is not added.
1062
+ */
1063
+ info_ptr->valid |= PNG_INFO_sPLT;
1064
+ ++(info_ptr->splt_palettes_num);
1065
+ ++np;
1066
+ }
1067
+ while (++entries, --nentries);
1068
+
1069
+ if (nentries > 0)
1070
+ png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR);
1071
+ }
1072
+ #endif /* sPLT */
1073
+
1074
+ #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
1075
+ static png_byte
1076
+ check_location(png_const_structrp png_ptr, int location)
1077
+ {
1078
+ location &= (PNG_HAVE_IHDR|PNG_HAVE_PLTE|PNG_AFTER_IDAT);
1079
+
1080
+ /* New in 1.6.0; copy the location and check it. This is an API
1081
+ * change; previously the app had to use the
1082
+ * png_set_unknown_chunk_location API below for each chunk.
1083
+ */
1084
+ if (location == 0 && (png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
1085
+ {
1086
+ /* Write struct, so unknown chunks come from the app */
1087
+ png_app_warning(png_ptr,
1088
+ "png_set_unknown_chunks now expects a valid location");
1089
+ /* Use the old behavior */
1090
+ location = (png_byte)(png_ptr->mode &
1091
+ (PNG_HAVE_IHDR|PNG_HAVE_PLTE|PNG_AFTER_IDAT));
1092
+ }
1093
+
1094
+ /* This need not be an internal error - if the app calls
1095
+ * png_set_unknown_chunks on a read pointer it must get the location right.
1096
+ */
1097
+ if (location == 0)
1098
+ png_error(png_ptr, "invalid location in png_set_unknown_chunks");
1099
+
1100
+ /* Now reduce the location to the top-most set bit by removing each least
1101
+ * significant bit in turn.
1102
+ */
1103
+ while (location != (location & -location))
1104
+ location &= ~(location & -location);
1105
+
1106
+ /* The cast is safe because 'location' is a bit mask and only the low four
1107
+ * bits are significant.
1108
+ */
1109
+ return (png_byte)location;
1110
+ }
1111
+
1112
+ void PNGAPI
1113
+ png_set_unknown_chunks(png_const_structrp png_ptr,
1114
+ png_inforp info_ptr, png_const_unknown_chunkp unknowns, int num_unknowns)
1115
+ {
1116
+ png_unknown_chunkp np;
1117
+
1118
+ if (png_ptr == NULL || info_ptr == NULL || num_unknowns <= 0 ||
1119
+ unknowns == NULL)
1120
+ return;
1121
+
1122
+ /* Check for the failure cases where support has been disabled at compile
1123
+ * time. This code is hardly ever compiled - it's here because
1124
+ * STORE_UNKNOWN_CHUNKS is set by both read and write code (compiling in this
1125
+ * code) but may be meaningless if the read or write handling of unknown
1126
+ * chunks is not compiled in.
1127
+ */
1128
+ # if !defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) && \
1129
+ defined(PNG_READ_SUPPORTED)
1130
+ if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
1131
+ {
1132
+ png_app_error(png_ptr, "no unknown chunk support on read");
1133
+ return;
1134
+ }
1135
+ # endif
1136
+ # if !defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) && \
1137
+ defined(PNG_WRITE_SUPPORTED)
1138
+ if ((png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
1139
+ {
1140
+ png_app_error(png_ptr, "no unknown chunk support on write");
1141
+ return;
1142
+ }
1143
+ # endif
1144
+
1145
+ /* Prior to 1.6.0 this code used png_malloc_warn; however, this meant that
1146
+ * unknown critical chunks could be lost with just a warning resulting in
1147
+ * undefined behavior. Now png_chunk_report is used to provide behavior
1148
+ * appropriate to read or write.
1149
+ */
1150
+ np = png_voidcast(png_unknown_chunkp, png_realloc_array(png_ptr,
1151
+ info_ptr->unknown_chunks, info_ptr->unknown_chunks_num, num_unknowns,
1152
+ sizeof *np));
1153
+
1154
+ if (np == NULL)
1155
+ {
1156
+ png_chunk_report(png_ptr, "too many unknown chunks",
1157
+ PNG_CHUNK_WRITE_ERROR);
1158
+ return;
1159
+ }
1160
+
1161
+ png_free(png_ptr, info_ptr->unknown_chunks);
1162
+ info_ptr->unknown_chunks = np; /* safe because it is initialized */
1163
+ info_ptr->free_me |= PNG_FREE_UNKN;
1164
+
1165
+ np += info_ptr->unknown_chunks_num;
1166
+
1167
+ /* Increment unknown_chunks_num each time round the loop to protect the
1168
+ * just-allocated chunk data.
1169
+ */
1170
+ for (; num_unknowns > 0; --num_unknowns, ++unknowns)
1171
+ {
1172
+ memcpy(np->name, unknowns->name, (sizeof np->name));
1173
+ np->name[(sizeof np->name)-1] = '\0';
1174
+ np->location = check_location(png_ptr, unknowns->location);
1175
+
1176
+ if (unknowns->size == 0)
1177
+ {
1178
+ np->data = NULL;
1179
+ np->size = 0;
1180
+ }
1181
+
1182
+ else
1183
+ {
1184
+ np->data = png_voidcast(png_bytep,
1185
+ png_malloc_base(png_ptr, unknowns->size));
1186
+
1187
+ if (np->data == NULL)
1188
+ {
1189
+ png_chunk_report(png_ptr, "unknown chunk: out of memory",
1190
+ PNG_CHUNK_WRITE_ERROR);
1191
+ /* But just skip storing the unknown chunk */
1192
+ continue;
1193
+ }
1194
+
1195
+ memcpy(np->data, unknowns->data, unknowns->size);
1196
+ np->size = unknowns->size;
1197
+ }
1198
+
1199
+ /* These increments are skipped on out-of-memory for the data - the
1200
+ * unknown chunk entry gets overwritten if the png_chunk_report returns.
1201
+ * This is correct in the read case (the chunk is just dropped.)
1202
+ */
1203
+ ++np;
1204
+ ++(info_ptr->unknown_chunks_num);
1205
+ }
1206
+ }
1207
+
1208
+ void PNGAPI
1209
+ png_set_unknown_chunk_location(png_const_structrp png_ptr, png_inforp info_ptr,
1210
+ int chunk, int location)
1211
+ {
1212
+ /* This API is pretty pointless in 1.6.0 because the location can be set
1213
+ * before the call to png_set_unknown_chunks.
1214
+ *
1215
+ * TODO: add a png_app_warning in 1.7
1216
+ */
1217
+ if (png_ptr != NULL && info_ptr != NULL && chunk >= 0 &&
1218
+ chunk < info_ptr->unknown_chunks_num)
1219
+ {
1220
+ if ((location & (PNG_HAVE_IHDR|PNG_HAVE_PLTE|PNG_AFTER_IDAT)) == 0)
1221
+ {
1222
+ png_app_error(png_ptr, "invalid unknown chunk location");
1223
+ /* Fake out the pre 1.6.0 behavior: */
1224
+ if ((location & PNG_HAVE_IDAT) != 0) /* undocumented! */
1225
+ location = PNG_AFTER_IDAT;
1226
+
1227
+ else
1228
+ location = PNG_HAVE_IHDR; /* also undocumented */
1229
+ }
1230
+
1231
+ info_ptr->unknown_chunks[chunk].location =
1232
+ check_location(png_ptr, location);
1233
+ }
1234
+ }
1235
+ #endif
1236
+
1237
+
1238
+ #ifdef PNG_MNG_FEATURES_SUPPORTED
1239
+ png_uint_32 PNGAPI
1240
+ png_permit_mng_features (png_structrp png_ptr, png_uint_32 mng_features)
1241
+ {
1242
+ png_debug(1, "in png_permit_mng_features");
1243
+
1244
+ if (png_ptr == NULL)
1245
+ return 0;
1246
+
1247
+ png_ptr->mng_features_permitted = mng_features & PNG_ALL_MNG_FEATURES;
1248
+
1249
+ return png_ptr->mng_features_permitted;
1250
+ }
1251
+ #endif
1252
+
1253
+ #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
1254
+ static unsigned int
1255
+ add_one_chunk(png_bytep list, unsigned int count, png_const_bytep add, int keep)
1256
+ {
1257
+ unsigned int i;
1258
+
1259
+ /* Utility function: update the 'keep' state of a chunk if it is already in
1260
+ * the list, otherwise add it to the list.
1261
+ */
1262
+ for (i=0; i<count; ++i, list += 5)
1263
+ {
1264
+ if (memcmp(list, add, 4) == 0)
1265
+ {
1266
+ list[4] = (png_byte)keep;
1267
+ return count;
1268
+ }
1269
+ }
1270
+
1271
+ if (keep != PNG_HANDLE_CHUNK_AS_DEFAULT)
1272
+ {
1273
+ ++count;
1274
+ memcpy(list, add, 4);
1275
+ list[4] = (png_byte)keep;
1276
+ }
1277
+
1278
+ return count;
1279
+ }
1280
+
1281
+ void PNGAPI
1282
+ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
1283
+ png_const_bytep chunk_list, int num_chunks_in)
1284
+ {
1285
+ png_bytep new_list;
1286
+ unsigned int num_chunks, old_num_chunks;
1287
+
1288
+ if (png_ptr == NULL)
1289
+ return;
1290
+
1291
+ if (keep < 0 || keep >= PNG_HANDLE_CHUNK_LAST)
1292
+ {
1293
+ png_app_error(png_ptr, "png_set_keep_unknown_chunks: invalid keep");
1294
+ return;
1295
+ }
1296
+
1297
+ if (num_chunks_in <= 0)
1298
+ {
1299
+ png_ptr->unknown_default = keep;
1300
+
1301
+ /* '0' means just set the flags, so stop here */
1302
+ if (num_chunks_in == 0)
1303
+ return;
1304
+ }
1305
+
1306
+ if (num_chunks_in < 0)
1307
+ {
1308
+ /* Ignore all unknown chunks and all chunks recognized by
1309
+ * libpng except for IHDR, PLTE, tRNS, IDAT, and IEND
1310
+ */
1311
+ static PNG_CONST png_byte chunks_to_ignore[] = {
1312
+ 98, 75, 71, 68, '\0', /* bKGD */
1313
+ 99, 72, 82, 77, '\0', /* cHRM */
1314
+ 103, 65, 77, 65, '\0', /* gAMA */
1315
+ 104, 73, 83, 84, '\0', /* hIST */
1316
+ 105, 67, 67, 80, '\0', /* iCCP */
1317
+ 105, 84, 88, 116, '\0', /* iTXt */
1318
+ 111, 70, 70, 115, '\0', /* oFFs */
1319
+ 112, 67, 65, 76, '\0', /* pCAL */
1320
+ 112, 72, 89, 115, '\0', /* pHYs */
1321
+ 115, 66, 73, 84, '\0', /* sBIT */
1322
+ 115, 67, 65, 76, '\0', /* sCAL */
1323
+ 115, 80, 76, 84, '\0', /* sPLT */
1324
+ 115, 84, 69, 82, '\0', /* sTER */
1325
+ 115, 82, 71, 66, '\0', /* sRGB */
1326
+ 116, 69, 88, 116, '\0', /* tEXt */
1327
+ 116, 73, 77, 69, '\0', /* tIME */
1328
+ 122, 84, 88, 116, '\0' /* zTXt */
1329
+ };
1330
+
1331
+ chunk_list = chunks_to_ignore;
1332
+ num_chunks = (unsigned int)/*SAFE*/(sizeof chunks_to_ignore)/5U;
1333
+ }
1334
+
1335
+ else /* num_chunks_in > 0 */
1336
+ {
1337
+ if (chunk_list == NULL)
1338
+ {
1339
+ /* Prior to 1.6.0 this was silently ignored, now it is an app_error
1340
+ * which can be switched off.
1341
+ */
1342
+ png_app_error(png_ptr, "png_set_keep_unknown_chunks: no chunk list");
1343
+ return;
1344
+ }
1345
+
1346
+ num_chunks = num_chunks_in;
1347
+ }
1348
+
1349
+ old_num_chunks = png_ptr->num_chunk_list;
1350
+ if (png_ptr->chunk_list == NULL)
1351
+ old_num_chunks = 0;
1352
+
1353
+ /* Since num_chunks is always restricted to UINT_MAX/5 this can't overflow.
1354
+ */
1355
+ if (num_chunks + old_num_chunks > UINT_MAX/5)
1356
+ {
1357
+ png_app_error(png_ptr, "png_set_keep_unknown_chunks: too many chunks");
1358
+ return;
1359
+ }
1360
+
1361
+ /* If these chunks are being reset to the default then no more memory is
1362
+ * required because add_one_chunk above doesn't extend the list if the 'keep'
1363
+ * parameter is the default.
1364
+ */
1365
+ if (keep != 0)
1366
+ {
1367
+ new_list = png_voidcast(png_bytep, png_malloc(png_ptr,
1368
+ 5 * (num_chunks + old_num_chunks)));
1369
+
1370
+ if (old_num_chunks > 0)
1371
+ memcpy(new_list, png_ptr->chunk_list, 5*old_num_chunks);
1372
+ }
1373
+
1374
+ else if (old_num_chunks > 0)
1375
+ new_list = png_ptr->chunk_list;
1376
+
1377
+ else
1378
+ new_list = NULL;
1379
+
1380
+ /* Add the new chunks together with each one's handling code. If the chunk
1381
+ * already exists the code is updated, otherwise the chunk is added to the
1382
+ * end. (In libpng 1.6.0 order no longer matters because this code enforces
1383
+ * the earlier convention that the last setting is the one that is used.)
1384
+ */
1385
+ if (new_list != NULL)
1386
+ {
1387
+ png_const_bytep inlist;
1388
+ png_bytep outlist;
1389
+ unsigned int i;
1390
+
1391
+ for (i=0; i<num_chunks; ++i)
1392
+ {
1393
+ old_num_chunks = add_one_chunk(new_list, old_num_chunks,
1394
+ chunk_list+5*i, keep);
1395
+ }
1396
+
1397
+ /* Now remove any spurious 'default' entries. */
1398
+ num_chunks = 0;
1399
+ for (i=0, inlist=outlist=new_list; i<old_num_chunks; ++i, inlist += 5)
1400
+ {
1401
+ if (inlist[4])
1402
+ {
1403
+ if (outlist != inlist)
1404
+ memcpy(outlist, inlist, 5);
1405
+ outlist += 5;
1406
+ ++num_chunks;
1407
+ }
1408
+ }
1409
+
1410
+ /* This means the application has removed all the specialized handling. */
1411
+ if (num_chunks == 0)
1412
+ {
1413
+ if (png_ptr->chunk_list != new_list)
1414
+ png_free(png_ptr, new_list);
1415
+
1416
+ new_list = NULL;
1417
+ }
1418
+ }
1419
+
1420
+ else
1421
+ num_chunks = 0;
1422
+
1423
+ png_ptr->num_chunk_list = num_chunks;
1424
+
1425
+ if (png_ptr->chunk_list != new_list)
1426
+ {
1427
+ if (png_ptr->chunk_list != NULL)
1428
+ png_free(png_ptr, png_ptr->chunk_list);
1429
+
1430
+ png_ptr->chunk_list = new_list;
1431
+ }
1432
+ }
1433
+ #endif
1434
+
1435
+ #ifdef PNG_READ_USER_CHUNKS_SUPPORTED
1436
+ void PNGAPI
1437
+ png_set_read_user_chunk_fn(png_structrp png_ptr, png_voidp user_chunk_ptr,
1438
+ png_user_chunk_ptr read_user_chunk_fn)
1439
+ {
1440
+ png_debug(1, "in png_set_read_user_chunk_fn");
1441
+
1442
+ if (png_ptr == NULL)
1443
+ return;
1444
+
1445
+ png_ptr->read_user_chunk_fn = read_user_chunk_fn;
1446
+ png_ptr->user_chunk_ptr = user_chunk_ptr;
1447
+ }
1448
+ #endif
1449
+
1450
+ #ifdef PNG_INFO_IMAGE_SUPPORTED
1451
+ void PNGAPI
1452
+ png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
1453
+ png_bytepp row_pointers)
1454
+ {
1455
+ png_debug1(1, "in %s storage function", "rows");
1456
+
1457
+ if (png_ptr == NULL || info_ptr == NULL)
1458
+ return;
1459
+
1460
+ if (info_ptr->row_pointers != NULL &&
1461
+ (info_ptr->row_pointers != row_pointers))
1462
+ png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0);
1463
+
1464
+ info_ptr->row_pointers = row_pointers;
1465
+
1466
+ if (row_pointers != NULL)
1467
+ info_ptr->valid |= PNG_INFO_IDAT;
1468
+ }
1469
+ #endif
1470
+
1471
+ void PNGAPI
1472
+ png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size)
1473
+ {
1474
+ if (png_ptr == NULL)
1475
+ return;
1476
+
1477
+ if (size == 0 || size > PNG_UINT_31_MAX)
1478
+ png_error(png_ptr, "invalid compression buffer size");
1479
+
1480
+ # ifdef PNG_SEQUENTIAL_READ_SUPPORTED
1481
+ if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
1482
+ {
1483
+ png_ptr->IDAT_read_size = (png_uint_32)size; /* checked above */
1484
+ return;
1485
+ }
1486
+ # endif
1487
+
1488
+ # ifdef PNG_WRITE_SUPPORTED
1489
+ if ((png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
1490
+ {
1491
+ if (png_ptr->zowner != 0)
1492
+ {
1493
+ png_warning(png_ptr,
1494
+ "Compression buffer size cannot be changed because it is in use");
1495
+ return;
1496
+ }
1497
+
1498
+ if (size > ZLIB_IO_MAX)
1499
+ {
1500
+ png_warning(png_ptr,
1501
+ "Compression buffer size limited to system maximum");
1502
+ size = ZLIB_IO_MAX; /* must fit */
1503
+ }
1504
+
1505
+ else if (size < 6)
1506
+ {
1507
+ /* Deflate will potentially go into an infinite loop on a SYNC_FLUSH
1508
+ * if this is permitted.
1509
+ */
1510
+ png_warning(png_ptr,
1511
+ "Compression buffer size cannot be reduced below 6");
1512
+ return;
1513
+ }
1514
+
1515
+ if (png_ptr->zbuffer_size != size)
1516
+ {
1517
+ png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list);
1518
+ png_ptr->zbuffer_size = (uInt)size;
1519
+ }
1520
+ }
1521
+ # endif
1522
+ }
1523
+
1524
+ void PNGAPI
1525
+ png_set_invalid(png_const_structrp png_ptr, png_inforp info_ptr, int mask)
1526
+ {
1527
+ if (png_ptr != NULL && info_ptr != NULL)
1528
+ info_ptr->valid &= ~mask;
1529
+ }
1530
+
1531
+
1532
+ #ifdef PNG_SET_USER_LIMITS_SUPPORTED
1533
+ /* This function was added to libpng 1.2.6 */
1534
+ void PNGAPI
1535
+ png_set_user_limits (png_structrp png_ptr, png_uint_32 user_width_max,
1536
+ png_uint_32 user_height_max)
1537
+ {
1538
+ /* Images with dimensions larger than these limits will be
1539
+ * rejected by png_set_IHDR(). To accept any PNG datastream
1540
+ * regardless of dimensions, set both limits to 0x7ffffffL.
1541
+ */
1542
+ if (png_ptr == NULL)
1543
+ return;
1544
+
1545
+ png_ptr->user_width_max = user_width_max;
1546
+ png_ptr->user_height_max = user_height_max;
1547
+ }
1548
+
1549
+ /* This function was added to libpng 1.4.0 */
1550
+ void PNGAPI
1551
+ png_set_chunk_cache_max (png_structrp png_ptr, png_uint_32 user_chunk_cache_max)
1552
+ {
1553
+ if (png_ptr != NULL)
1554
+ png_ptr->user_chunk_cache_max = user_chunk_cache_max;
1555
+ }
1556
+
1557
+ /* This function was added to libpng 1.4.1 */
1558
+ void PNGAPI
1559
+ png_set_chunk_malloc_max (png_structrp png_ptr,
1560
+ png_alloc_size_t user_chunk_malloc_max)
1561
+ {
1562
+ if (png_ptr != NULL)
1563
+ png_ptr->user_chunk_malloc_max = user_chunk_malloc_max;
1564
+ }
1565
+ #endif /* ?SET_USER_LIMITS */
1566
+
1567
+
1568
+ #ifdef PNG_BENIGN_ERRORS_SUPPORTED
1569
+ void PNGAPI
1570
+ png_set_benign_errors(png_structrp png_ptr, int allowed)
1571
+ {
1572
+ png_debug(1, "in png_set_benign_errors");
1573
+
1574
+ /* If allowed is 1, png_benign_error() is treated as a warning.
1575
+ *
1576
+ * If allowed is 0, png_benign_error() is treated as an error (which
1577
+ * is the default behavior if png_set_benign_errors() is not called).
1578
+ */
1579
+
1580
+ if (allowed != 0)
1581
+ png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN |
1582
+ PNG_FLAG_APP_WARNINGS_WARN | PNG_FLAG_APP_ERRORS_WARN;
1583
+
1584
+ else
1585
+ png_ptr->flags &= ~(PNG_FLAG_BENIGN_ERRORS_WARN |
1586
+ PNG_FLAG_APP_WARNINGS_WARN | PNG_FLAG_APP_ERRORS_WARN);
1587
+ }
1588
+ #endif /* BENIGN_ERRORS */
1589
+
1590
+ #ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
1591
+ /* Whether to report invalid palette index; added at libng-1.5.10.
1592
+ * It is possible for an indexed (color-type==3) PNG file to contain
1593
+ * pixels with invalid (out-of-range) indexes if the PLTE chunk has
1594
+ * fewer entries than the image's bit-depth would allow. We recover
1595
+ * from this gracefully by filling any incomplete palette with zeros
1596
+ * (opaque black). By default, when this occurs libpng will issue
1597
+ * a benign error. This API can be used to override that behavior.
1598
+ */
1599
+ void PNGAPI
1600
+ png_set_check_for_invalid_index(png_structrp png_ptr, int allowed)
1601
+ {
1602
+ png_debug(1, "in png_set_check_for_invalid_index");
1603
+
1604
+ if (allowed > 0)
1605
+ png_ptr->num_palette_max = 0;
1606
+
1607
+ else
1608
+ png_ptr->num_palette_max = -1;
1609
+ }
1610
+ #endif
1611
+ #endif /* READ || WRITE */