gosu 0.7.15 → 0.7.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1095) hide show
  1. data/Gosu/Audio.hpp +18 -29
  2. data/Gosu/Bitmap.hpp +1 -1
  3. data/Gosu/Color.hpp +16 -1
  4. data/Gosu/Font.hpp +3 -3
  5. data/Gosu/Graphics.hpp +7 -1
  6. data/Gosu/Image.hpp +4 -4
  7. data/Gosu/TextInput.hpp +10 -2
  8. data/Gosu/Version.hpp +2 -2
  9. data/Gosu/Window.hpp +4 -3
  10. data/GosuImpl/Audio/AudioOpenAL.mm +46 -29
  11. data/GosuImpl/AudioFmod.cpp +58 -61
  12. data/GosuImpl/AudioSDL.cpp +47 -32
  13. data/GosuImpl/Graphics/BitmapColorKey.cpp +1 -1
  14. data/GosuImpl/Graphics/BitmapUtils.cpp +2 -2
  15. data/GosuImpl/Graphics/Color.cpp +12 -0
  16. data/GosuImpl/Graphics/Font.cpp +1 -1
  17. data/GosuImpl/Graphics/Text.cpp +2 -2
  18. data/GosuImpl/Graphics/Texture.cpp +3 -0
  19. data/GosuImpl/ObjGosu/ObjGosu.mm +36 -0
  20. data/GosuImpl/ObjGosu/ObjGosuColor.mm +84 -0
  21. data/GosuImpl/ObjGosu/ObjGosuFont.mm +42 -0
  22. data/GosuImpl/ObjGosu/ObjGosuImage.h +7 -0
  23. data/GosuImpl/ObjGosu/ObjGosuImage.mm +65 -0
  24. data/GosuImpl/ObjGosu/ObjGosuSample.mm +32 -0
  25. data/GosuImpl/ObjGosu/ObjGosuSong.mm +43 -0
  26. data/GosuImpl/ObjGosu/ObjGosuWindow.h +32 -0
  27. data/GosuImpl/ObjGosu/ObjGosuWindow.mm +155 -0
  28. data/GosuImpl/RubyGosu.swg +48 -21
  29. data/GosuImpl/RubyGosuStub.mm +6 -0
  30. data/GosuImpl/RubyGosu_wrap.cxx +358 -195
  31. data/GosuImpl/RubyGosu_wrap.h +9 -0
  32. data/GosuImpl/TextInputMac.mm +10 -4
  33. data/GosuImpl/TextInputWin.cpp +4 -2
  34. data/GosuImpl/TextInputX.cpp +16 -14
  35. data/GosuImpl/WindowMac.mm +33 -23
  36. data/GosuImpl/WindowWin.cpp +22 -16
  37. data/GosuImpl/WindowX.cpp +17 -16
  38. data/Rakefile +38 -12
  39. data/dependencies/libogg/AUTHORS +4 -0
  40. data/dependencies/libogg/CHANGES +33 -0
  41. data/dependencies/libogg/COPYING +28 -0
  42. data/dependencies/libogg/Makefile.am +32 -0
  43. data/dependencies/libogg/Makefile.in +713 -0
  44. data/dependencies/libogg/README +103 -0
  45. data/dependencies/libogg/aclocal.m4 +6807 -0
  46. data/dependencies/libogg/compile +142 -0
  47. data/dependencies/libogg/config.guess +1465 -0
  48. data/dependencies/libogg/config.h.in +70 -0
  49. data/dependencies/libogg/config.sub +1569 -0
  50. data/dependencies/libogg/configure +23018 -0
  51. data/dependencies/libogg/configure.in +301 -0
  52. data/dependencies/libogg/debian/changelog +68 -0
  53. data/dependencies/libogg/debian/control +22 -0
  54. data/dependencies/libogg/debian/copyright +37 -0
  55. data/dependencies/libogg/debian/libogg-dev.docs +1 -0
  56. data/dependencies/libogg/debian/libogg-dev.install +8 -0
  57. data/dependencies/libogg/debian/libogg0.README.Debian +6 -0
  58. data/dependencies/libogg/debian/libogg0.install +1 -0
  59. data/dependencies/libogg/debian/rules +154 -0
  60. data/dependencies/libogg/debian/watch +3 -0
  61. data/dependencies/libogg/depcomp +529 -0
  62. data/dependencies/libogg/doc/Makefile.am +11 -0
  63. data/dependencies/libogg/doc/Makefile.in +518 -0
  64. data/dependencies/libogg/doc/framing.html +431 -0
  65. data/dependencies/libogg/doc/index.html +104 -0
  66. data/dependencies/libogg/doc/libogg/Makefile.am +28 -0
  67. data/dependencies/libogg/doc/libogg/Makefile.in +378 -0
  68. data/dependencies/libogg/doc/libogg/bitpacking.html +99 -0
  69. data/dependencies/libogg/doc/libogg/datastructures.html +59 -0
  70. data/dependencies/libogg/doc/libogg/decoding.html +100 -0
  71. data/dependencies/libogg/doc/libogg/encoding.html +64 -0
  72. data/dependencies/libogg/doc/libogg/general.html +105 -0
  73. data/dependencies/libogg/doc/libogg/index.html +39 -0
  74. data/dependencies/libogg/doc/libogg/ogg_packet.html +75 -0
  75. data/dependencies/libogg/doc/libogg/ogg_packet_clear.html +62 -0
  76. data/dependencies/libogg/doc/libogg/ogg_page.html +74 -0
  77. data/dependencies/libogg/doc/libogg/ogg_page_bos.html +65 -0
  78. data/dependencies/libogg/doc/libogg/ogg_page_checksum_set.html +62 -0
  79. data/dependencies/libogg/doc/libogg/ogg_page_continued.html +64 -0
  80. data/dependencies/libogg/doc/libogg/ogg_page_eos.html +65 -0
  81. data/dependencies/libogg/doc/libogg/ogg_page_granulepos.html +65 -0
  82. data/dependencies/libogg/doc/libogg/ogg_page_packets.html +75 -0
  83. data/dependencies/libogg/doc/libogg/ogg_page_pageno.html +63 -0
  84. data/dependencies/libogg/doc/libogg/ogg_page_serialno.html +63 -0
  85. data/dependencies/libogg/doc/libogg/ogg_page_version.html +63 -0
  86. data/dependencies/libogg/doc/libogg/ogg_stream_clear.html +61 -0
  87. data/dependencies/libogg/doc/libogg/ogg_stream_destroy.html +62 -0
  88. data/dependencies/libogg/doc/libogg/ogg_stream_eos.html +62 -0
  89. data/dependencies/libogg/doc/libogg/ogg_stream_flush.html +67 -0
  90. data/dependencies/libogg/doc/libogg/ogg_stream_init.html +66 -0
  91. data/dependencies/libogg/doc/libogg/ogg_stream_packetin.html +65 -0
  92. data/dependencies/libogg/doc/libogg/ogg_stream_packetout.html +71 -0
  93. data/dependencies/libogg/doc/libogg/ogg_stream_packetpeek.html +85 -0
  94. data/dependencies/libogg/doc/libogg/ogg_stream_pagein.html +67 -0
  95. data/dependencies/libogg/doc/libogg/ogg_stream_pageout.html +66 -0
  96. data/dependencies/libogg/doc/libogg/ogg_stream_reset.html +61 -0
  97. data/dependencies/libogg/doc/libogg/ogg_stream_reset_serialno.html +67 -0
  98. data/dependencies/libogg/doc/libogg/ogg_stream_state.html +121 -0
  99. data/dependencies/libogg/doc/libogg/ogg_sync_buffer.html +67 -0
  100. data/dependencies/libogg/doc/libogg/ogg_sync_clear.html +62 -0
  101. data/dependencies/libogg/doc/libogg/ogg_sync_destroy.html +62 -0
  102. data/dependencies/libogg/doc/libogg/ogg_sync_init.html +63 -0
  103. data/dependencies/libogg/doc/libogg/ogg_sync_pageout.html +79 -0
  104. data/dependencies/libogg/doc/libogg/ogg_sync_pageseek.html +68 -0
  105. data/dependencies/libogg/doc/libogg/ogg_sync_reset.html +63 -0
  106. data/dependencies/libogg/doc/libogg/ogg_sync_state.html +67 -0
  107. data/dependencies/libogg/doc/libogg/ogg_sync_wrote.html +73 -0
  108. data/dependencies/libogg/doc/libogg/oggpack_adv.html +64 -0
  109. data/dependencies/libogg/doc/libogg/oggpack_adv1.html +62 -0
  110. data/dependencies/libogg/doc/libogg/oggpack_bits.html +62 -0
  111. data/dependencies/libogg/doc/libogg/oggpack_buffer.html +66 -0
  112. data/dependencies/libogg/doc/libogg/oggpack_bytes.html +62 -0
  113. data/dependencies/libogg/doc/libogg/oggpack_get_buffer.html +62 -0
  114. data/dependencies/libogg/doc/libogg/oggpack_look.html +66 -0
  115. data/dependencies/libogg/doc/libogg/oggpack_look1.html +63 -0
  116. data/dependencies/libogg/doc/libogg/oggpack_read.html +65 -0
  117. data/dependencies/libogg/doc/libogg/oggpack_read1.html +63 -0
  118. data/dependencies/libogg/doc/libogg/oggpack_readinit.html +64 -0
  119. data/dependencies/libogg/doc/libogg/oggpack_reset.html +62 -0
  120. data/dependencies/libogg/doc/libogg/oggpack_write.html +68 -0
  121. data/dependencies/libogg/doc/libogg/oggpack_writealign.html +65 -0
  122. data/dependencies/libogg/doc/libogg/oggpack_writeclear.html +62 -0
  123. data/dependencies/libogg/doc/libogg/oggpack_writecopy.html +69 -0
  124. data/dependencies/libogg/doc/libogg/oggpack_writeinit.html +62 -0
  125. data/dependencies/libogg/doc/libogg/oggpack_writetrunc.html +65 -0
  126. data/dependencies/libogg/doc/libogg/overview.html +44 -0
  127. data/dependencies/libogg/doc/libogg/reference.html +93 -0
  128. data/dependencies/libogg/doc/libogg/style.css +7 -0
  129. data/dependencies/libogg/doc/libogg/vorbis_comment.html +70 -0
  130. data/dependencies/libogg/doc/libogg/vorbis_info.html +80 -0
  131. data/dependencies/libogg/doc/ogg-multiplex.html +445 -0
  132. data/dependencies/libogg/doc/oggstream.html +234 -0
  133. data/dependencies/libogg/doc/rfc3533.txt +843 -0
  134. data/dependencies/libogg/doc/rfc3534.txt +339 -0
  135. data/dependencies/libogg/doc/stream.png +0 -0
  136. data/dependencies/libogg/doc/vorbisword2.png +0 -0
  137. data/dependencies/libogg/doc/white-ogg.png +0 -0
  138. data/dependencies/libogg/doc/white-xifish.png +0 -0
  139. data/dependencies/libogg/include/Makefile.am +3 -0
  140. data/dependencies/libogg/include/Makefile.in +481 -0
  141. data/dependencies/libogg/include/ogg/Makefile.am +6 -0
  142. data/dependencies/libogg/include/ogg/Makefile.in +428 -0
  143. data/dependencies/libogg/include/ogg/config_types.h.in +11 -0
  144. data/dependencies/libogg/include/ogg/ogg.h +202 -0
  145. data/dependencies/libogg/include/ogg/os_types.h +127 -0
  146. data/dependencies/libogg/install-sh +323 -0
  147. data/dependencies/libogg/libogg.spec +106 -0
  148. data/dependencies/libogg/libogg.spec.in +106 -0
  149. data/dependencies/libogg/ltmain.sh +6426 -0
  150. data/dependencies/libogg/macos/compat/strdup.c +21 -0
  151. data/dependencies/libogg/macos/compat/sys/types.h +1 -0
  152. data/dependencies/libogg/macos/libogg.mcp +0 -0
  153. data/dependencies/libogg/macos/libogg.mcp.exp +64 -0
  154. data/dependencies/libogg/macosx/English.lproj/InfoPlist.strings +0 -0
  155. data/dependencies/libogg/macosx/Info.plist +30 -0
  156. data/dependencies/libogg/macosx/Ogg.xcodeproj/project.pbxproj +303 -0
  157. data/dependencies/libogg/macosx/Ogg_Prefix.pch +5 -0
  158. data/dependencies/libogg/missing +357 -0
  159. data/dependencies/libogg/ogg-uninstalled.pc.in +14 -0
  160. data/dependencies/libogg/ogg.m4 +102 -0
  161. data/dependencies/libogg/ogg.pc.in +14 -0
  162. data/dependencies/libogg/src/Makefile.am +28 -0
  163. data/dependencies/libogg/src/Makefile.in +536 -0
  164. data/dependencies/libogg/src/bitwise.c +784 -0
  165. data/dependencies/libogg/src/framing.c +1800 -0
  166. data/dependencies/libogg/win32/Makefile.am +5 -0
  167. data/dependencies/libogg/win32/Makefile.in +327 -0
  168. data/dependencies/libogg/win32/build_ogg_dynamic.bat +18 -0
  169. data/dependencies/libogg/win32/build_ogg_dynamic_debug.bat +18 -0
  170. data/dependencies/libogg/win32/build_ogg_static.bat +18 -0
  171. data/dependencies/libogg/win32/build_ogg_static_debug.bat +18 -0
  172. data/dependencies/libogg/win32/ogg.def +78 -0
  173. data/dependencies/libogg/win32/ogg.dsw +41 -0
  174. data/dependencies/libogg/win32/ogg_dynamic.dsp +128 -0
  175. data/dependencies/libogg/win32/ogg_static.dsp +108 -0
  176. data/dependencies/libpng/ANNOUNCE +61 -0
  177. data/dependencies/libpng/CHANGES +2173 -0
  178. data/dependencies/libpng/INSTALL +199 -0
  179. data/dependencies/libpng/KNOWNBUG +22 -0
  180. data/dependencies/libpng/LICENSE +109 -0
  181. data/dependencies/libpng/README +264 -0
  182. data/dependencies/libpng/TODO +24 -0
  183. data/dependencies/libpng/Y2KINFO +55 -0
  184. data/dependencies/libpng/configure +13 -0
  185. data/dependencies/libpng/contrib/gregbook/COPYING +340 -0
  186. data/dependencies/libpng/contrib/gregbook/LICENSE +50 -0
  187. data/dependencies/libpng/contrib/gregbook/Makefile.mingw32 +130 -0
  188. data/dependencies/libpng/contrib/gregbook/Makefile.sgi +104 -0
  189. data/dependencies/libpng/contrib/gregbook/Makefile.unx +132 -0
  190. data/dependencies/libpng/contrib/gregbook/Makefile.w32 +113 -0
  191. data/dependencies/libpng/contrib/gregbook/README +186 -0
  192. data/dependencies/libpng/contrib/gregbook/makevms.com +132 -0
  193. data/dependencies/libpng/contrib/gregbook/readpng.c +304 -0
  194. data/dependencies/libpng/contrib/gregbook/readpng.h +88 -0
  195. data/dependencies/libpng/contrib/gregbook/readpng2.c +645 -0
  196. data/dependencies/libpng/contrib/gregbook/readpng2.h +121 -0
  197. data/dependencies/libpng/contrib/gregbook/readppm.c +179 -0
  198. data/dependencies/libpng/contrib/gregbook/rpng-win.c +684 -0
  199. data/dependencies/libpng/contrib/gregbook/rpng-x.c +904 -0
  200. data/dependencies/libpng/contrib/gregbook/rpng2-win.c +1225 -0
  201. data/dependencies/libpng/contrib/gregbook/rpng2-x.c +2127 -0
  202. data/dependencies/libpng/contrib/gregbook/toucan.png +0 -0
  203. data/dependencies/libpng/contrib/gregbook/wpng.c +853 -0
  204. data/dependencies/libpng/contrib/gregbook/writepng.c +392 -0
  205. data/dependencies/libpng/contrib/gregbook/writepng.h +133 -0
  206. data/dependencies/libpng/contrib/pngminim/decoder/README +6 -0
  207. data/dependencies/libpng/contrib/pngminim/decoder/gather.sh +8 -0
  208. data/dependencies/libpng/contrib/pngminim/decoder/makefile.std +44 -0
  209. data/dependencies/libpng/contrib/pngminim/decoder/pngusr.h +67 -0
  210. data/dependencies/libpng/contrib/pngminim/encoder/README +6 -0
  211. data/dependencies/libpng/contrib/pngminim/encoder/dummy_inflate.c +27 -0
  212. data/dependencies/libpng/contrib/pngminim/encoder/gather.sh +9 -0
  213. data/dependencies/libpng/contrib/pngminim/encoder/makefile.std +43 -0
  214. data/dependencies/libpng/contrib/pngminim/encoder/pngusr.h +66 -0
  215. data/dependencies/libpng/contrib/pngminus/README +153 -0
  216. data/dependencies/libpng/contrib/pngminus/makefile.std +65 -0
  217. data/dependencies/libpng/contrib/pngminus/makefile.tc3 +38 -0
  218. data/dependencies/libpng/contrib/pngminus/makevms.com +92 -0
  219. data/dependencies/libpng/contrib/pngminus/png2pnm.bat +41 -0
  220. data/dependencies/libpng/contrib/pngminus/png2pnm.c +430 -0
  221. data/dependencies/libpng/contrib/pngminus/png2pnm.sh +42 -0
  222. data/dependencies/libpng/contrib/pngminus/pngminus.bat +4 -0
  223. data/dependencies/libpng/contrib/pngminus/pngminus.sh +5 -0
  224. data/dependencies/libpng/contrib/pngminus/pnm2png.bat +41 -0
  225. data/dependencies/libpng/contrib/pngminus/pnm2png.c +533 -0
  226. data/dependencies/libpng/contrib/pngminus/pnm2png.sh +42 -0
  227. data/dependencies/libpng/contrib/pngsuite/basn0g01.png +0 -0
  228. data/dependencies/libpng/contrib/pngsuite/basn0g02.png +0 -0
  229. data/dependencies/libpng/contrib/pngsuite/basn0g04.png +0 -0
  230. data/dependencies/libpng/contrib/pngsuite/basn0g08.png +0 -0
  231. data/dependencies/libpng/contrib/pngsuite/basn0g16.png +0 -0
  232. data/dependencies/libpng/contrib/pngsuite/basn2c08.png +0 -0
  233. data/dependencies/libpng/contrib/pngsuite/basn2c16.png +0 -0
  234. data/dependencies/libpng/contrib/pngsuite/basn3p01.png +0 -0
  235. data/dependencies/libpng/contrib/pngsuite/basn3p02.png +0 -0
  236. data/dependencies/libpng/contrib/pngsuite/basn3p04.png +0 -0
  237. data/dependencies/libpng/contrib/pngsuite/basn3p08.png +0 -0
  238. data/dependencies/libpng/contrib/pngsuite/basn4a08.png +0 -0
  239. data/dependencies/libpng/contrib/pngsuite/basn4a16.png +0 -0
  240. data/dependencies/libpng/contrib/pngsuite/basn6a08.png +0 -0
  241. data/dependencies/libpng/contrib/pngsuite/basn6a16.png +0 -0
  242. data/dependencies/libpng/contrib/visupng/PngFile.c +439 -0
  243. data/dependencies/libpng/contrib/visupng/PngFile.h +27 -0
  244. data/dependencies/libpng/contrib/visupng/README.txt +58 -0
  245. data/dependencies/libpng/contrib/visupng/VisualPng.c +961 -0
  246. data/dependencies/libpng/contrib/visupng/VisualPng.dsp +147 -0
  247. data/dependencies/libpng/contrib/visupng/VisualPng.dsw +29 -0
  248. data/dependencies/libpng/contrib/visupng/VisualPng.ico +0 -0
  249. data/dependencies/libpng/contrib/visupng/VisualPng.png +0 -0
  250. data/dependencies/libpng/contrib/visupng/VisualPng.rc +152 -0
  251. data/dependencies/libpng/contrib/visupng/cexcept.h +243 -0
  252. data/dependencies/libpng/contrib/visupng/resource.h +23 -0
  253. data/dependencies/libpng/example.c +814 -0
  254. data/dependencies/libpng/libpng-1.2.29.txt +2906 -0
  255. data/dependencies/libpng/libpng.3 +3680 -0
  256. data/dependencies/libpng/libpngpf.3 +274 -0
  257. data/dependencies/libpng/png.5 +74 -0
  258. data/dependencies/libpng/png.c +798 -0
  259. data/dependencies/libpng/png.h +3569 -0
  260. data/dependencies/libpng/pngbar.jpg +0 -0
  261. data/dependencies/libpng/pngbar.png +0 -0
  262. data/dependencies/libpng/pngconf.h +1481 -0
  263. data/dependencies/libpng/pngerror.c +343 -0
  264. data/dependencies/libpng/pnggccrd.c +103 -0
  265. data/dependencies/libpng/pngget.c +901 -0
  266. data/dependencies/libpng/pngmem.c +608 -0
  267. data/dependencies/libpng/pngnow.png +0 -0
  268. data/dependencies/libpng/pngpread.c +1598 -0
  269. data/dependencies/libpng/pngread.c +1479 -0
  270. data/dependencies/libpng/pngrio.c +167 -0
  271. data/dependencies/libpng/pngrtran.c +4292 -0
  272. data/dependencies/libpng/pngrutil.c +3183 -0
  273. data/dependencies/libpng/pngset.c +1268 -0
  274. data/dependencies/libpng/pngtest.c +1563 -0
  275. data/dependencies/libpng/pngtest.png +0 -0
  276. data/dependencies/libpng/pngtrans.c +662 -0
  277. data/dependencies/libpng/pngvcrd.c +1 -0
  278. data/dependencies/libpng/pngwio.c +234 -0
  279. data/dependencies/libpng/pngwrite.c +1532 -0
  280. data/dependencies/libpng/pngwtran.c +572 -0
  281. data/dependencies/libpng/pngwutil.c +2802 -0
  282. data/dependencies/libpng/projects/beos/x86-shared.proj +0 -0
  283. data/dependencies/libpng/projects/beos/x86-shared.txt +22 -0
  284. data/dependencies/libpng/projects/beos/x86-static.proj +0 -0
  285. data/dependencies/libpng/projects/beos/x86-static.txt +22 -0
  286. data/dependencies/libpng/projects/cbuilder5/libpng.bpf +22 -0
  287. data/dependencies/libpng/projects/cbuilder5/libpng.bpg +25 -0
  288. data/dependencies/libpng/projects/cbuilder5/libpng.bpr +157 -0
  289. data/dependencies/libpng/projects/cbuilder5/libpng.cpp +29 -0
  290. data/dependencies/libpng/projects/cbuilder5/libpng.readme.txt +25 -0
  291. data/dependencies/libpng/projects/cbuilder5/libpngstat.bpf +22 -0
  292. data/dependencies/libpng/projects/cbuilder5/libpngstat.bpr +109 -0
  293. data/dependencies/libpng/projects/cbuilder5/zlib.readme.txt +14 -0
  294. data/dependencies/libpng/projects/netware.txt +6 -0
  295. data/dependencies/libpng/projects/visualc6/README.txt +57 -0
  296. data/dependencies/libpng/projects/visualc6/libpng.dsp +472 -0
  297. data/dependencies/libpng/projects/visualc6/libpng.dsw +59 -0
  298. data/dependencies/libpng/projects/visualc6/pngtest.dsp +314 -0
  299. data/dependencies/libpng/projects/visualc71/PRJ0041.mak +21 -0
  300. data/dependencies/libpng/projects/visualc71/README.txt +57 -0
  301. data/dependencies/libpng/projects/visualc71/README_zlib.txt +44 -0
  302. data/dependencies/libpng/projects/visualc71/libpng.sln +88 -0
  303. data/dependencies/libpng/projects/visualc71/libpng.vcproj +702 -0
  304. data/dependencies/libpng/projects/visualc71/pngtest.vcproj +459 -0
  305. data/dependencies/libpng/projects/visualc71/zlib.vcproj +670 -0
  306. data/dependencies/libpng/projects/wince.txt +6 -0
  307. data/dependencies/libpng/scripts/CMakeLists.txt +210 -0
  308. data/dependencies/libpng/scripts/SCOPTIONS.ppc +7 -0
  309. data/dependencies/libpng/scripts/descrip.mms +52 -0
  310. data/dependencies/libpng/scripts/libpng-config-body.in +96 -0
  311. data/dependencies/libpng/scripts/libpng-config-head.in +21 -0
  312. data/dependencies/libpng/scripts/libpng-config.in +124 -0
  313. data/dependencies/libpng/scripts/libpng.icc +44 -0
  314. data/dependencies/libpng/scripts/libpng.pc-configure.in +10 -0
  315. data/dependencies/libpng/scripts/libpng.pc.in +10 -0
  316. data/dependencies/libpng/scripts/makefile.32sunu +254 -0
  317. data/dependencies/libpng/scripts/makefile.64sunu +254 -0
  318. data/dependencies/libpng/scripts/makefile.acorn +51 -0
  319. data/dependencies/libpng/scripts/makefile.aix +113 -0
  320. data/dependencies/libpng/scripts/makefile.amiga +48 -0
  321. data/dependencies/libpng/scripts/makefile.atari +51 -0
  322. data/dependencies/libpng/scripts/makefile.bc32 +152 -0
  323. data/dependencies/libpng/scripts/makefile.beos +226 -0
  324. data/dependencies/libpng/scripts/makefile.bor +162 -0
  325. data/dependencies/libpng/scripts/makefile.cygwin +299 -0
  326. data/dependencies/libpng/scripts/makefile.darwin +234 -0
  327. data/dependencies/libpng/scripts/makefile.dec +214 -0
  328. data/dependencies/libpng/scripts/makefile.dj2 +55 -0
  329. data/dependencies/libpng/scripts/makefile.elf +275 -0
  330. data/dependencies/libpng/scripts/makefile.freebsd +48 -0
  331. data/dependencies/libpng/scripts/makefile.gcc +79 -0
  332. data/dependencies/libpng/scripts/makefile.gcmmx +271 -0
  333. data/dependencies/libpng/scripts/makefile.hp64 +235 -0
  334. data/dependencies/libpng/scripts/makefile.hpgcc +245 -0
  335. data/dependencies/libpng/scripts/makefile.hpux +232 -0
  336. data/dependencies/libpng/scripts/makefile.ibmc +71 -0
  337. data/dependencies/libpng/scripts/makefile.intel +102 -0
  338. data/dependencies/libpng/scripts/makefile.knr +99 -0
  339. data/dependencies/libpng/scripts/makefile.linux +249 -0
  340. data/dependencies/libpng/scripts/makefile.mingw +289 -0
  341. data/dependencies/libpng/scripts/makefile.mips +83 -0
  342. data/dependencies/libpng/scripts/makefile.msc +86 -0
  343. data/dependencies/libpng/scripts/makefile.ne12bsd +45 -0
  344. data/dependencies/libpng/scripts/makefile.netbsd +45 -0
  345. data/dependencies/libpng/scripts/makefile.nommx +252 -0
  346. data/dependencies/libpng/scripts/makefile.openbsd +73 -0
  347. data/dependencies/libpng/scripts/makefile.os2 +69 -0
  348. data/dependencies/libpng/scripts/makefile.sco +229 -0
  349. data/dependencies/libpng/scripts/makefile.sggcc +242 -0
  350. data/dependencies/libpng/scripts/makefile.sgi +245 -0
  351. data/dependencies/libpng/scripts/makefile.so9 +251 -0
  352. data/dependencies/libpng/scripts/makefile.solaris +249 -0
  353. data/dependencies/libpng/scripts/makefile.solaris-x86 +248 -0
  354. data/dependencies/libpng/scripts/makefile.std +92 -0
  355. data/dependencies/libpng/scripts/makefile.sunos +97 -0
  356. data/dependencies/libpng/scripts/makefile.tc3 +89 -0
  357. data/dependencies/libpng/scripts/makefile.vcawin32 +99 -0
  358. data/dependencies/libpng/scripts/makefile.vcwin32 +99 -0
  359. data/dependencies/libpng/scripts/makefile.watcom +109 -0
  360. data/dependencies/libpng/scripts/makevms.com +144 -0
  361. data/dependencies/libpng/scripts/pngos2.def +257 -0
  362. data/dependencies/libpng/scripts/pngw32.def +238 -0
  363. data/dependencies/libpng/scripts/pngw32.rc +112 -0
  364. data/dependencies/libpng/scripts/smakefile.ppc +30 -0
  365. data/dependencies/libvorbis/AUTHORS +3 -0
  366. data/dependencies/libvorbis/CHANGES +48 -0
  367. data/dependencies/libvorbis/COPYING +28 -0
  368. data/dependencies/libvorbis/Makefile.am +41 -0
  369. data/dependencies/libvorbis/Makefile.in +759 -0
  370. data/dependencies/libvorbis/README +132 -0
  371. data/dependencies/libvorbis/acinclude.m4 +161 -0
  372. data/dependencies/libvorbis/aclocal.m4 +7273 -0
  373. data/dependencies/libvorbis/autogen.sh +127 -0
  374. data/dependencies/libvorbis/config.guess +1500 -0
  375. data/dependencies/libvorbis/config.h.in +78 -0
  376. data/dependencies/libvorbis/config.sub +1616 -0
  377. data/dependencies/libvorbis/configure +22114 -0
  378. data/dependencies/libvorbis/configure.in +246 -0
  379. data/dependencies/libvorbis/depcomp +584 -0
  380. data/dependencies/libvorbis/doc/Makefile +665 -0
  381. data/dependencies/libvorbis/doc/Makefile.am +137 -0
  382. data/dependencies/libvorbis/doc/Makefile.in +665 -0
  383. data/dependencies/libvorbis/doc/Vorbis_I_spec.html +2292 -0
  384. data/dependencies/libvorbis/doc/Vorbis_I_spec.pdf +0 -0
  385. data/dependencies/libvorbis/doc/components.png +0 -0
  386. data/dependencies/libvorbis/doc/draft-ietf-avt-rtp-vorbis-06.txt +1401 -0
  387. data/dependencies/libvorbis/doc/draft-ietf-avt-rtp-vorbis-06.xml +1388 -0
  388. data/dependencies/libvorbis/doc/eightphase.png +0 -0
  389. data/dependencies/libvorbis/doc/evenlsp.png +0 -0
  390. data/dependencies/libvorbis/doc/fish_xiph_org.png +0 -0
  391. data/dependencies/libvorbis/doc/floor1-1.png +0 -0
  392. data/dependencies/libvorbis/doc/floor1-2.png +0 -0
  393. data/dependencies/libvorbis/doc/floor1-3.png +0 -0
  394. data/dependencies/libvorbis/doc/floor1-4.png +0 -0
  395. data/dependencies/libvorbis/doc/floor1_inverse_dB_table.html +154 -0
  396. data/dependencies/libvorbis/doc/floorval.png +0 -0
  397. data/dependencies/libvorbis/doc/fourphase.png +0 -0
  398. data/dependencies/libvorbis/doc/framing.html +431 -0
  399. data/dependencies/libvorbis/doc/helper.html +239 -0
  400. data/dependencies/libvorbis/doc/hufftree-under.png +0 -0
  401. data/dependencies/libvorbis/doc/hufftree.png +0 -0
  402. data/dependencies/libvorbis/doc/index.html +114 -0
  403. data/dependencies/libvorbis/doc/lspmap.png +0 -0
  404. data/dependencies/libvorbis/doc/oddlsp.png +0 -0
  405. data/dependencies/libvorbis/doc/oggstream.html +234 -0
  406. data/dependencies/libvorbis/doc/programming.html +554 -0
  407. data/dependencies/libvorbis/doc/residue-pack.png +0 -0
  408. data/dependencies/libvorbis/doc/residue2.png +0 -0
  409. data/dependencies/libvorbis/doc/squarepolar.png +0 -0
  410. data/dependencies/libvorbis/doc/stereo.html +418 -0
  411. data/dependencies/libvorbis/doc/stream.png +0 -0
  412. data/dependencies/libvorbis/doc/v-comment.html +285 -0
  413. data/dependencies/libvorbis/doc/vorbis-clip.txt +139 -0
  414. data/dependencies/libvorbis/doc/vorbis-errors.txt +103 -0
  415. data/dependencies/libvorbis/doc/vorbis-fidelity.html +180 -0
  416. data/dependencies/libvorbis/doc/vorbis.html +234 -0
  417. data/dependencies/libvorbis/doc/vorbisenc/Makefile +382 -0
  418. data/dependencies/libvorbis/doc/vorbisenc/Makefile.am +9 -0
  419. data/dependencies/libvorbis/doc/vorbisenc/Makefile.in +382 -0
  420. data/dependencies/libvorbis/doc/vorbisenc/changes.html +104 -0
  421. data/dependencies/libvorbis/doc/vorbisenc/examples.html +133 -0
  422. data/dependencies/libvorbis/doc/vorbisenc/index.html +40 -0
  423. data/dependencies/libvorbis/doc/vorbisenc/ov_ectl_ratemanage2_arg.html +92 -0
  424. data/dependencies/libvorbis/doc/vorbisenc/ov_ectl_ratemanage_arg.html +92 -0
  425. data/dependencies/libvorbis/doc/vorbisenc/overview.html +382 -0
  426. data/dependencies/libvorbis/doc/vorbisenc/reference.html +48 -0
  427. data/dependencies/libvorbis/doc/vorbisenc/style.css +7 -0
  428. data/dependencies/libvorbis/doc/vorbisenc/vorbis_encode_ctl.html +169 -0
  429. data/dependencies/libvorbis/doc/vorbisenc/vorbis_encode_init.html +88 -0
  430. data/dependencies/libvorbis/doc/vorbisenc/vorbis_encode_init_vbr.html +81 -0
  431. data/dependencies/libvorbis/doc/vorbisenc/vorbis_encode_setup_init.html +88 -0
  432. data/dependencies/libvorbis/doc/vorbisenc/vorbis_encode_setup_managed.html +102 -0
  433. data/dependencies/libvorbis/doc/vorbisenc/vorbis_encode_setup_vbr.html +90 -0
  434. data/dependencies/libvorbis/doc/vorbisenc/vorbis_info.html +81 -0
  435. data/dependencies/libvorbis/doc/vorbisfile/Makefile +396 -0
  436. data/dependencies/libvorbis/doc/vorbisfile/Makefile.am +23 -0
  437. data/dependencies/libvorbis/doc/vorbisfile/Makefile.in +396 -0
  438. data/dependencies/libvorbis/doc/vorbisfile/OggVorbis_File.html +137 -0
  439. data/dependencies/libvorbis/doc/vorbisfile/callbacks.html +121 -0
  440. data/dependencies/libvorbis/doc/vorbisfile/chaining_example_c.html +90 -0
  441. data/dependencies/libvorbis/doc/vorbisfile/chainingexample.html +175 -0
  442. data/dependencies/libvorbis/doc/vorbisfile/crosslap.html +121 -0
  443. data/dependencies/libvorbis/doc/vorbisfile/datastructures.html +61 -0
  444. data/dependencies/libvorbis/doc/vorbisfile/decoding.html +87 -0
  445. data/dependencies/libvorbis/doc/vorbisfile/example.html +208 -0
  446. data/dependencies/libvorbis/doc/vorbisfile/exampleindex.html +39 -0
  447. data/dependencies/libvorbis/doc/vorbisfile/fileinfo.html +95 -0
  448. data/dependencies/libvorbis/doc/vorbisfile/index.html +49 -0
  449. data/dependencies/libvorbis/doc/vorbisfile/initialization.html +118 -0
  450. data/dependencies/libvorbis/doc/vorbisfile/ov_bitrate.html +72 -0
  451. data/dependencies/libvorbis/doc/vorbisfile/ov_bitrate_instant.html +65 -0
  452. data/dependencies/libvorbis/doc/vorbisfile/ov_callbacks.html +117 -0
  453. data/dependencies/libvorbis/doc/vorbisfile/ov_clear.html +64 -0
  454. data/dependencies/libvorbis/doc/vorbisfile/ov_comment.html +66 -0
  455. data/dependencies/libvorbis/doc/vorbisfile/ov_crosslap.html +100 -0
  456. data/dependencies/libvorbis/doc/vorbisfile/ov_fopen.html +124 -0
  457. data/dependencies/libvorbis/doc/vorbisfile/ov_info.html +64 -0
  458. data/dependencies/libvorbis/doc/vorbisfile/ov_open.html +183 -0
  459. data/dependencies/libvorbis/doc/vorbisfile/ov_open_callbacks.html +147 -0
  460. data/dependencies/libvorbis/doc/vorbisfile/ov_pcm_seek.html +83 -0
  461. data/dependencies/libvorbis/doc/vorbisfile/ov_pcm_seek_lap.html +103 -0
  462. data/dependencies/libvorbis/doc/vorbisfile/ov_pcm_seek_page.html +84 -0
  463. data/dependencies/libvorbis/doc/vorbisfile/ov_pcm_seek_page_lap.html +112 -0
  464. data/dependencies/libvorbis/doc/vorbisfile/ov_pcm_tell.html +63 -0
  465. data/dependencies/libvorbis/doc/vorbisfile/ov_pcm_total.html +67 -0
  466. data/dependencies/libvorbis/doc/vorbisfile/ov_raw_seek.html +83 -0
  467. data/dependencies/libvorbis/doc/vorbisfile/ov_raw_seek_lap.html +110 -0
  468. data/dependencies/libvorbis/doc/vorbisfile/ov_raw_tell.html +65 -0
  469. data/dependencies/libvorbis/doc/vorbisfile/ov_raw_total.html +68 -0
  470. data/dependencies/libvorbis/doc/vorbisfile/ov_read.html +123 -0
  471. data/dependencies/libvorbis/doc/vorbisfile/ov_read_float.html +101 -0
  472. data/dependencies/libvorbis/doc/vorbisfile/ov_seekable.html +63 -0
  473. data/dependencies/libvorbis/doc/vorbisfile/ov_serialnumber.html +67 -0
  474. data/dependencies/libvorbis/doc/vorbisfile/ov_streams.html +64 -0
  475. data/dependencies/libvorbis/doc/vorbisfile/ov_test.html +101 -0
  476. data/dependencies/libvorbis/doc/vorbisfile/ov_test_callbacks.html +111 -0
  477. data/dependencies/libvorbis/doc/vorbisfile/ov_test_open.html +82 -0
  478. data/dependencies/libvorbis/doc/vorbisfile/ov_time_seek.html +82 -0
  479. data/dependencies/libvorbis/doc/vorbisfile/ov_time_seek_lap.html +105 -0
  480. data/dependencies/libvorbis/doc/vorbisfile/ov_time_seek_page.html +83 -0
  481. data/dependencies/libvorbis/doc/vorbisfile/ov_time_seek_page_lap.html +112 -0
  482. data/dependencies/libvorbis/doc/vorbisfile/ov_time_tell.html +63 -0
  483. data/dependencies/libvorbis/doc/vorbisfile/ov_time_total.html +67 -0
  484. data/dependencies/libvorbis/doc/vorbisfile/overview.html +61 -0
  485. data/dependencies/libvorbis/doc/vorbisfile/reference.html +83 -0
  486. data/dependencies/libvorbis/doc/vorbisfile/return.html +77 -0
  487. data/dependencies/libvorbis/doc/vorbisfile/seekexample.html +152 -0
  488. data/dependencies/libvorbis/doc/vorbisfile/seeking.html +107 -0
  489. data/dependencies/libvorbis/doc/vorbisfile/seeking_example_c.html +86 -0
  490. data/dependencies/libvorbis/doc/vorbisfile/seeking_test_c.html +86 -0
  491. data/dependencies/libvorbis/doc/vorbisfile/seekingexample.html +203 -0
  492. data/dependencies/libvorbis/doc/vorbisfile/style.css +7 -0
  493. data/dependencies/libvorbis/doc/vorbisfile/threads.html +50 -0
  494. data/dependencies/libvorbis/doc/vorbisfile/vorbis_comment.html +70 -0
  495. data/dependencies/libvorbis/doc/vorbisfile/vorbis_info.html +80 -0
  496. data/dependencies/libvorbis/doc/vorbisfile/vorbisfile_example_c.html +106 -0
  497. data/dependencies/libvorbis/doc/vorbisword2.png +0 -0
  498. data/dependencies/libvorbis/doc/wait.png +0 -0
  499. data/dependencies/libvorbis/doc/white-ogg.png +0 -0
  500. data/dependencies/libvorbis/doc/white-xifish.png +0 -0
  501. data/dependencies/libvorbis/doc/window1.png +0 -0
  502. data/dependencies/libvorbis/doc/window2.png +0 -0
  503. data/dependencies/libvorbis/doc/xifish.pdf +0 -0
  504. data/dependencies/libvorbis/doc/xml/01-introduction.xml +665 -0
  505. data/dependencies/libvorbis/doc/xml/02-bitpacking.xml +280 -0
  506. data/dependencies/libvorbis/doc/xml/03-codebook.xml +458 -0
  507. data/dependencies/libvorbis/doc/xml/04-codec.xml +711 -0
  508. data/dependencies/libvorbis/doc/xml/05-comment.xml +284 -0
  509. data/dependencies/libvorbis/doc/xml/06-floor0.xml +257 -0
  510. data/dependencies/libvorbis/doc/xml/07-floor1.xml +450 -0
  511. data/dependencies/libvorbis/doc/xml/08-residue.xml +492 -0
  512. data/dependencies/libvorbis/doc/xml/09-helper.xml +211 -0
  513. data/dependencies/libvorbis/doc/xml/10-tables.xml +94 -0
  514. data/dependencies/libvorbis/doc/xml/TODO +28 -0
  515. data/dependencies/libvorbis/doc/xml/Vorbis_I_spec.xml +30 -0
  516. data/dependencies/libvorbis/doc/xml/a1-encapsulation_ogg.xml +201 -0
  517. data/dependencies/libvorbis/doc/xml/a2-encapsulation_rtp.xml +31 -0
  518. data/dependencies/libvorbis/doc/xml/footer.xml +60 -0
  519. data/dependencies/libvorbis/doc/xml/spec-common.xsl +24 -0
  520. data/dependencies/libvorbis/doc/xml/spec-fo.xsl +16 -0
  521. data/dependencies/libvorbis/doc/xml/spec-html.xsl +5 -0
  522. data/dependencies/libvorbis/examples/Makefile +515 -0
  523. data/dependencies/libvorbis/examples/Makefile.am +28 -0
  524. data/dependencies/libvorbis/examples/Makefile.in +515 -0
  525. data/dependencies/libvorbis/examples/chaining_example.c +72 -0
  526. data/dependencies/libvorbis/examples/decoder_example.c +307 -0
  527. data/dependencies/libvorbis/examples/encoder_example.c +253 -0
  528. data/dependencies/libvorbis/examples/frameview.pl +630 -0
  529. data/dependencies/libvorbis/examples/seeking_example.c +256 -0
  530. data/dependencies/libvorbis/examples/vorbisfile_example.c +87 -0
  531. data/dependencies/libvorbis/include/Makefile.am +3 -0
  532. data/dependencies/libvorbis/include/Makefile.in +506 -0
  533. data/dependencies/libvorbis/include/vorbis/Makefile.am +7 -0
  534. data/dependencies/libvorbis/include/vorbis/Makefile.in +426 -0
  535. data/dependencies/libvorbis/include/vorbis/codec.h +241 -0
  536. data/dependencies/libvorbis/include/vorbis/vorbisenc.h +112 -0
  537. data/dependencies/libvorbis/include/vorbis/vorbisfile.h +183 -0
  538. data/dependencies/libvorbis/install-sh +507 -0
  539. data/dependencies/libvorbis/lib/Makefile.am +44 -0
  540. data/dependencies/libvorbis/lib/Makefile.in +706 -0
  541. data/dependencies/libvorbis/lib/analysis.c +121 -0
  542. data/dependencies/libvorbis/lib/backends.h +146 -0
  543. data/dependencies/libvorbis/lib/barkmel.c +64 -0
  544. data/dependencies/libvorbis/lib/bitrate.c +253 -0
  545. data/dependencies/libvorbis/lib/bitrate.h +59 -0
  546. data/dependencies/libvorbis/lib/block.c +993 -0
  547. data/dependencies/libvorbis/lib/books/Makefile.am +3 -0
  548. data/dependencies/libvorbis/lib/books/Makefile.in +506 -0
  549. data/dependencies/libvorbis/lib/books/coupled/Makefile.am +3 -0
  550. data/dependencies/libvorbis/lib/books/coupled/Makefile.in +347 -0
  551. data/dependencies/libvorbis/lib/books/coupled/res_books_stereo.h +20681 -0
  552. data/dependencies/libvorbis/lib/books/floor/Makefile.am +3 -0
  553. data/dependencies/libvorbis/lib/books/floor/Makefile.in +347 -0
  554. data/dependencies/libvorbis/lib/books/floor/floor_books.h +1838 -0
  555. data/dependencies/libvorbis/lib/books/uncoupled/Makefile.am +3 -0
  556. data/dependencies/libvorbis/lib/books/uncoupled/Makefile.in +347 -0
  557. data/dependencies/libvorbis/lib/books/uncoupled/res_books_uncoupled.h +11517 -0
  558. data/dependencies/libvorbis/lib/codebook.c +634 -0
  559. data/dependencies/libvorbis/lib/codebook.h +160 -0
  560. data/dependencies/libvorbis/lib/codec_internal.h +137 -0
  561. data/dependencies/libvorbis/lib/envelope.c +382 -0
  562. data/dependencies/libvorbis/lib/envelope.h +81 -0
  563. data/dependencies/libvorbis/lib/floor0.c +223 -0
  564. data/dependencies/libvorbis/lib/floor1.c +1094 -0
  565. data/dependencies/libvorbis/lib/highlevel.h +57 -0
  566. data/dependencies/libvorbis/lib/info.c +644 -0
  567. data/dependencies/libvorbis/lib/lookup.c +94 -0
  568. data/dependencies/libvorbis/lib/lookup.h +32 -0
  569. data/dependencies/libvorbis/lib/lookup_data.h +189 -0
  570. data/dependencies/libvorbis/lib/lookups.pl +142 -0
  571. data/dependencies/libvorbis/lib/lpc.c +149 -0
  572. data/dependencies/libvorbis/lib/lpc.h +29 -0
  573. data/dependencies/libvorbis/lib/lsp.c +455 -0
  574. data/dependencies/libvorbis/lib/lsp.h +28 -0
  575. data/dependencies/libvorbis/lib/mapping0.c +844 -0
  576. data/dependencies/libvorbis/lib/masking.h +785 -0
  577. data/dependencies/libvorbis/lib/mdct.c +564 -0
  578. data/dependencies/libvorbis/lib/mdct.h +83 -0
  579. data/dependencies/libvorbis/lib/misc.h +52 -0
  580. data/dependencies/libvorbis/lib/modes/Makefile.am +6 -0
  581. data/dependencies/libvorbis/lib/modes/Makefile.in +351 -0
  582. data/dependencies/libvorbis/lib/modes/floor_all.h +248 -0
  583. data/dependencies/libvorbis/lib/modes/psych_11.h +51 -0
  584. data/dependencies/libvorbis/lib/modes/psych_16.h +136 -0
  585. data/dependencies/libvorbis/lib/modes/psych_44.h +666 -0
  586. data/dependencies/libvorbis/lib/modes/psych_8.h +102 -0
  587. data/dependencies/libvorbis/lib/modes/residue_16.h +163 -0
  588. data/dependencies/libvorbis/lib/modes/residue_44.h +294 -0
  589. data/dependencies/libvorbis/lib/modes/residue_44u.h +318 -0
  590. data/dependencies/libvorbis/lib/modes/residue_8.h +109 -0
  591. data/dependencies/libvorbis/lib/modes/setup_11.h +141 -0
  592. data/dependencies/libvorbis/lib/modes/setup_16.h +149 -0
  593. data/dependencies/libvorbis/lib/modes/setup_22.h +128 -0
  594. data/dependencies/libvorbis/lib/modes/setup_32.h +132 -0
  595. data/dependencies/libvorbis/lib/modes/setup_44.h +107 -0
  596. data/dependencies/libvorbis/lib/modes/setup_44u.h +74 -0
  597. data/dependencies/libvorbis/lib/modes/setup_8.h +146 -0
  598. data/dependencies/libvorbis/lib/modes/setup_X.h +226 -0
  599. data/dependencies/libvorbis/lib/os.h +156 -0
  600. data/dependencies/libvorbis/lib/psy.c +1227 -0
  601. data/dependencies/libvorbis/lib/psy.h +186 -0
  602. data/dependencies/libvorbis/lib/psytune.c +524 -0
  603. data/dependencies/libvorbis/lib/registry.c +46 -0
  604. data/dependencies/libvorbis/lib/registry.h +32 -0
  605. data/dependencies/libvorbis/lib/res0.c +919 -0
  606. data/dependencies/libvorbis/lib/scales.h +86 -0
  607. data/dependencies/libvorbis/lib/sharedbook.c +735 -0
  608. data/dependencies/libvorbis/lib/smallft.c +1255 -0
  609. data/dependencies/libvorbis/lib/smallft.h +34 -0
  610. data/dependencies/libvorbis/lib/synthesis.c +170 -0
  611. data/dependencies/libvorbis/lib/tone.c +54 -0
  612. data/dependencies/libvorbis/lib/vorbisenc.c +1184 -0
  613. data/dependencies/libvorbis/lib/vorbisfile.c +2194 -0
  614. data/dependencies/libvorbis/lib/window.c +2136 -0
  615. data/dependencies/libvorbis/lib/window.h +26 -0
  616. data/dependencies/libvorbis/libvorbis.spec +118 -0
  617. data/dependencies/libvorbis/libvorbis.spec.in +118 -0
  618. data/dependencies/libvorbis/ltmain.sh +6871 -0
  619. data/dependencies/libvorbis/macos/compat/strdup.c +21 -0
  620. data/dependencies/libvorbis/macos/compat/sys/types.h +1 -0
  621. data/dependencies/libvorbis/macos/decoder_example.mcp +0 -0
  622. data/dependencies/libvorbis/macos/encoder_example.mcp +0 -0
  623. data/dependencies/libvorbis/macos/libvorbis.mcp +0 -0
  624. data/dependencies/libvorbis/macos/libvorbis.mcp.exp +45 -0
  625. data/dependencies/libvorbis/macos/libvorbisenc.mcp +0 -0
  626. data/dependencies/libvorbis/macos/libvorbisenc.mcp.exp +8 -0
  627. data/dependencies/libvorbis/macos/libvorbisfile.mcp +0 -0
  628. data/dependencies/libvorbis/macos/libvorbisfile.mcp.exp +45 -0
  629. data/dependencies/libvorbis/macos/vorbis.mcp +0 -0
  630. data/dependencies/libvorbis/macosx/English.lproj/InfoPlist.strings +0 -0
  631. data/dependencies/libvorbis/macosx/Info.plist +30 -0
  632. data/dependencies/libvorbis/macosx/Vorbis.xcodeproj/project.pbxproj +893 -0
  633. data/dependencies/libvorbis/missing +367 -0
  634. data/dependencies/libvorbis/symbian/bld.inf +35 -0
  635. data/dependencies/libvorbis/symbian/config.h +54 -0
  636. data/dependencies/libvorbis/symbian/vorbis.mmp +43 -0
  637. data/dependencies/libvorbis/todo.txt +22 -0
  638. data/dependencies/libvorbis/vorbis-uninstalled.pc.in +14 -0
  639. data/dependencies/libvorbis/vorbis.m4 +122 -0
  640. data/dependencies/libvorbis/vorbis.pc.in +14 -0
  641. data/dependencies/libvorbis/vorbisenc-uninstalled.pc.in +14 -0
  642. data/dependencies/libvorbis/vorbisenc.pc.in +14 -0
  643. data/dependencies/libvorbis/vorbisfile-uninstalled.pc.in +14 -0
  644. data/dependencies/libvorbis/vorbisfile.pc.in +14 -0
  645. data/dependencies/libvorbis/vq/16.vqs +77 -0
  646. data/dependencies/libvorbis/vq/16u.vqs +71 -0
  647. data/dependencies/libvorbis/vq/44c-1.vqs +63 -0
  648. data/dependencies/libvorbis/vq/44c0.vqs +65 -0
  649. data/dependencies/libvorbis/vq/44c1.vqs +66 -0
  650. data/dependencies/libvorbis/vq/44c2.vqs +37 -0
  651. data/dependencies/libvorbis/vq/44c3.vqs +36 -0
  652. data/dependencies/libvorbis/vq/44c4.vqs +36 -0
  653. data/dependencies/libvorbis/vq/44c5.vqs +37 -0
  654. data/dependencies/libvorbis/vq/44c6.vqs +37 -0
  655. data/dependencies/libvorbis/vq/44c7.vqs +38 -0
  656. data/dependencies/libvorbis/vq/44c8.vqs +39 -0
  657. data/dependencies/libvorbis/vq/44c9.vqs +37 -0
  658. data/dependencies/libvorbis/vq/44u0.vqs +33 -0
  659. data/dependencies/libvorbis/vq/44u1.vqs +33 -0
  660. data/dependencies/libvorbis/vq/44u2.vqs +32 -0
  661. data/dependencies/libvorbis/vq/44u3.vqs +33 -0
  662. data/dependencies/libvorbis/vq/44u4.vqs +33 -0
  663. data/dependencies/libvorbis/vq/44u5.vqs +35 -0
  664. data/dependencies/libvorbis/vq/44u6.vqs +35 -0
  665. data/dependencies/libvorbis/vq/44u7.vqs +34 -0
  666. data/dependencies/libvorbis/vq/44u8.vqs +35 -0
  667. data/dependencies/libvorbis/vq/44u9.vqs +36 -0
  668. data/dependencies/libvorbis/vq/8.vqs +43 -0
  669. data/dependencies/libvorbis/vq/8u.vqs +41 -0
  670. data/dependencies/libvorbis/vq/Makefile +532 -0
  671. data/dependencies/libvorbis/vq/Makefile.am +34 -0
  672. data/dependencies/libvorbis/vq/Makefile.in +532 -0
  673. data/dependencies/libvorbis/vq/auxpartition.pl +71 -0
  674. data/dependencies/libvorbis/vq/bookutil.c +717 -0
  675. data/dependencies/libvorbis/vq/bookutil.h +43 -0
  676. data/dependencies/libvorbis/vq/build.c +195 -0
  677. data/dependencies/libvorbis/vq/cascade.c +91 -0
  678. data/dependencies/libvorbis/vq/distribution.c +248 -0
  679. data/dependencies/libvorbis/vq/floor_11.vqs +10 -0
  680. data/dependencies/libvorbis/vq/floor_22.vqs +27 -0
  681. data/dependencies/libvorbis/vq/floor_44.vqs +83 -0
  682. data/dependencies/libvorbis/vq/genericdata.c +61 -0
  683. data/dependencies/libvorbis/vq/huffbuild.c +201 -0
  684. data/dependencies/libvorbis/vq/latticebuild.c +177 -0
  685. data/dependencies/libvorbis/vq/latticehint.c +430 -0
  686. data/dependencies/libvorbis/vq/latticepare.c +595 -0
  687. data/dependencies/libvorbis/vq/latticetune.c +164 -0
  688. data/dependencies/libvorbis/vq/localcodebook.h +160 -0
  689. data/dependencies/libvorbis/vq/lspdata.c +157 -0
  690. data/dependencies/libvorbis/vq/make_floor_books.pl +108 -0
  691. data/dependencies/libvorbis/vq/make_residue_books.pl +187 -0
  692. data/dependencies/libvorbis/vq/metrics.c +295 -0
  693. data/dependencies/libvorbis/vq/residue_entropy +58 -0
  694. data/dependencies/libvorbis/vq/residuedata.c +160 -0
  695. data/dependencies/libvorbis/vq/residuesplit.c +282 -0
  696. data/dependencies/libvorbis/vq/run.c +216 -0
  697. data/dependencies/libvorbis/vq/train.c +364 -0
  698. data/dependencies/libvorbis/vq/vqext.h +34 -0
  699. data/dependencies/libvorbis/vq/vqgen.c +567 -0
  700. data/dependencies/libvorbis/vq/vqgen.h +85 -0
  701. data/dependencies/libvorbis/vq/vqsplit.c +612 -0
  702. data/dependencies/libvorbis/vq/vqsplit.h +37 -0
  703. data/dependencies/libvorbis/win32/VS2003/libvorbis/libvorbis.vcproj +467 -0
  704. data/dependencies/libvorbis/win32/VS2003/libvorbisfile/libvorbisfile.def +47 -0
  705. data/dependencies/libvorbis/win32/VS2003/libvorbisfile/libvorbisfile.vcproj +147 -0
  706. data/dependencies/libvorbis/win32/VS2003/vorbisdec/vorbisdec.vcproj +268 -0
  707. data/dependencies/libvorbis/win32/VS2003/vorbisenc/vorbisenc.vcproj +268 -0
  708. data/dependencies/libvorbis/win32/VS2005/libvorbis/libvorbis.vcproj +653 -0
  709. data/dependencies/libvorbis/win32/VS2005/libvorbisfile/libvorbisfile.def +47 -0
  710. data/dependencies/libvorbis/win32/VS2005/libvorbisfile/libvorbisfile.vcproj +219 -0
  711. data/dependencies/libvorbis/win32/VS2005/vorbisdec/vorbisdec.vcproj +389 -0
  712. data/dependencies/libvorbis/win32/VS2005/vorbisenc/vorbisenc.vcproj +390 -0
  713. data/dependencies/libvorbis/win32/build_vorbis_dynamic.bat +19 -0
  714. data/dependencies/libvorbis/win32/build_vorbis_dynamic_debug.bat +19 -0
  715. data/dependencies/libvorbis/win32/build_vorbis_static.bat +19 -0
  716. data/dependencies/libvorbis/win32/build_vorbis_static_debug.bat +19 -0
  717. data/dependencies/libvorbis/win32/build_vorbisenc_dynamic.bat +19 -0
  718. data/dependencies/libvorbis/win32/build_vorbisenc_dynamic_debug.bat +19 -0
  719. data/dependencies/libvorbis/win32/build_vorbisenc_static.bat +19 -0
  720. data/dependencies/libvorbis/win32/build_vorbisenc_static_debug.bat +19 -0
  721. data/dependencies/libvorbis/win32/build_vorbisfile_dynamic.bat +19 -0
  722. data/dependencies/libvorbis/win32/build_vorbisfile_dynamic_debug.bat +19 -0
  723. data/dependencies/libvorbis/win32/build_vorbisfile_static.bat +19 -0
  724. data/dependencies/libvorbis/win32/build_vorbisfile_static_debug.bat +19 -0
  725. data/dependencies/libvorbis/win32/vorbis.def +57 -0
  726. data/dependencies/libvorbis/win32/vorbis.dsw +101 -0
  727. data/dependencies/libvorbis/win32/vorbis_dynamic.dsp +281 -0
  728. data/dependencies/libvorbis/win32/vorbis_static.dsp +257 -0
  729. data/dependencies/libvorbis/win32/vorbisenc.def +13 -0
  730. data/dependencies/libvorbis/win32/vorbisenc_dynamic.dsp +121 -0
  731. data/dependencies/libvorbis/win32/vorbisenc_static.dsp +100 -0
  732. data/dependencies/libvorbis/win32/vorbisfile.def +41 -0
  733. data/dependencies/libvorbis/win32/vorbisfile_dynamic.dsp +119 -0
  734. data/dependencies/libvorbis/win32/vorbisfile_static.dsp +100 -0
  735. data/dependencies/zlib/ChangeLog +855 -0
  736. data/dependencies/zlib/FAQ +339 -0
  737. data/dependencies/zlib/INDEX +51 -0
  738. data/dependencies/zlib/Makefile +154 -0
  739. data/dependencies/zlib/Makefile.in +154 -0
  740. data/dependencies/zlib/README +125 -0
  741. data/dependencies/zlib/adler32.c +149 -0
  742. data/dependencies/zlib/algorithm.txt +209 -0
  743. data/dependencies/zlib/amiga/Makefile.pup +66 -0
  744. data/dependencies/zlib/amiga/Makefile.sas +65 -0
  745. data/dependencies/zlib/as400/bndsrc +132 -0
  746. data/dependencies/zlib/as400/compile.clp +123 -0
  747. data/dependencies/zlib/as400/readme.txt +111 -0
  748. data/dependencies/zlib/as400/zlib.inc +331 -0
  749. data/dependencies/zlib/compress.c +79 -0
  750. data/dependencies/zlib/configure +459 -0
  751. data/dependencies/zlib/contrib/README.contrib +71 -0
  752. data/dependencies/zlib/contrib/ada/buffer_demo.adb +106 -0
  753. data/dependencies/zlib/contrib/ada/mtest.adb +156 -0
  754. data/dependencies/zlib/contrib/ada/read.adb +156 -0
  755. data/dependencies/zlib/contrib/ada/readme.txt +65 -0
  756. data/dependencies/zlib/contrib/ada/test.adb +463 -0
  757. data/dependencies/zlib/contrib/ada/zlib-streams.adb +225 -0
  758. data/dependencies/zlib/contrib/ada/zlib-streams.ads +114 -0
  759. data/dependencies/zlib/contrib/ada/zlib-thin.adb +141 -0
  760. data/dependencies/zlib/contrib/ada/zlib-thin.ads +450 -0
  761. data/dependencies/zlib/contrib/ada/zlib.adb +701 -0
  762. data/dependencies/zlib/contrib/ada/zlib.ads +328 -0
  763. data/dependencies/zlib/contrib/ada/zlib.gpr +20 -0
  764. data/dependencies/zlib/contrib/asm586/README.586 +43 -0
  765. data/dependencies/zlib/contrib/asm586/match.S +364 -0
  766. data/dependencies/zlib/contrib/asm686/README.686 +34 -0
  767. data/dependencies/zlib/contrib/asm686/match.S +329 -0
  768. data/dependencies/zlib/contrib/blast/Makefile +8 -0
  769. data/dependencies/zlib/contrib/blast/README +4 -0
  770. data/dependencies/zlib/contrib/blast/blast.c +444 -0
  771. data/dependencies/zlib/contrib/blast/blast.h +71 -0
  772. data/dependencies/zlib/contrib/blast/test.pk +0 -0
  773. data/dependencies/zlib/contrib/blast/test.txt +1 -0
  774. data/dependencies/zlib/contrib/delphi/ZLib.pas +557 -0
  775. data/dependencies/zlib/contrib/delphi/ZLibConst.pas +11 -0
  776. data/dependencies/zlib/contrib/delphi/readme.txt +76 -0
  777. data/dependencies/zlib/contrib/delphi/zlibd32.mak +93 -0
  778. data/dependencies/zlib/contrib/dotzlib/DotZLib.build +33 -0
  779. data/dependencies/zlib/contrib/dotzlib/DotZLib.chm +0 -0
  780. data/dependencies/zlib/contrib/dotzlib/DotZLib.sln +21 -0
  781. data/dependencies/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs +58 -0
  782. data/dependencies/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs +202 -0
  783. data/dependencies/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs +83 -0
  784. data/dependencies/zlib/contrib/dotzlib/DotZLib/CodecBase.cs +198 -0
  785. data/dependencies/zlib/contrib/dotzlib/DotZLib/Deflater.cs +106 -0
  786. data/dependencies/zlib/contrib/dotzlib/DotZLib/DotZLib.cs +288 -0
  787. data/dependencies/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj +141 -0
  788. data/dependencies/zlib/contrib/dotzlib/DotZLib/GZipStream.cs +301 -0
  789. data/dependencies/zlib/contrib/dotzlib/DotZLib/Inflater.cs +105 -0
  790. data/dependencies/zlib/contrib/dotzlib/DotZLib/UnitTests.cs +274 -0
  791. data/dependencies/zlib/contrib/dotzlib/LICENSE_1_0.txt +23 -0
  792. data/dependencies/zlib/contrib/dotzlib/readme.txt +58 -0
  793. data/dependencies/zlib/contrib/infback9/README +1 -0
  794. data/dependencies/zlib/contrib/infback9/infback9.c +608 -0
  795. data/dependencies/zlib/contrib/infback9/infback9.h +37 -0
  796. data/dependencies/zlib/contrib/infback9/inffix9.h +107 -0
  797. data/dependencies/zlib/contrib/infback9/inflate9.h +47 -0
  798. data/dependencies/zlib/contrib/infback9/inftree9.c +323 -0
  799. data/dependencies/zlib/contrib/infback9/inftree9.h +55 -0
  800. data/dependencies/zlib/contrib/inflate86/inffas86.c +1157 -0
  801. data/dependencies/zlib/contrib/inflate86/inffast.S +1368 -0
  802. data/dependencies/zlib/contrib/iostream/test.cpp +24 -0
  803. data/dependencies/zlib/contrib/iostream/zfstream.cpp +329 -0
  804. data/dependencies/zlib/contrib/iostream/zfstream.h +128 -0
  805. data/dependencies/zlib/contrib/iostream2/zstream.h +307 -0
  806. data/dependencies/zlib/contrib/iostream2/zstream_test.cpp +25 -0
  807. data/dependencies/zlib/contrib/iostream3/README +35 -0
  808. data/dependencies/zlib/contrib/iostream3/TODO +17 -0
  809. data/dependencies/zlib/contrib/iostream3/test.cc +50 -0
  810. data/dependencies/zlib/contrib/iostream3/zfstream.cc +479 -0
  811. data/dependencies/zlib/contrib/iostream3/zfstream.h +466 -0
  812. data/dependencies/zlib/contrib/masm686/match.asm +413 -0
  813. data/dependencies/zlib/contrib/masmx64/bld_ml64.bat +2 -0
  814. data/dependencies/zlib/contrib/masmx64/gvmat64.asm +513 -0
  815. data/dependencies/zlib/contrib/masmx64/gvmat64.obj +0 -0
  816. data/dependencies/zlib/contrib/masmx64/inffas8664.c +186 -0
  817. data/dependencies/zlib/contrib/masmx64/inffasx64.asm +392 -0
  818. data/dependencies/zlib/contrib/masmx64/inffasx64.obj +0 -0
  819. data/dependencies/zlib/contrib/masmx64/readme.txt +28 -0
  820. data/dependencies/zlib/contrib/masmx86/bld_ml32.bat +2 -0
  821. data/dependencies/zlib/contrib/masmx86/gvmat32.asm +972 -0
  822. data/dependencies/zlib/contrib/masmx86/gvmat32.obj +0 -0
  823. data/dependencies/zlib/contrib/masmx86/gvmat32c.c +62 -0
  824. data/dependencies/zlib/contrib/masmx86/inffas32.asm +1083 -0
  825. data/dependencies/zlib/contrib/masmx86/inffas32.obj +0 -0
  826. data/dependencies/zlib/contrib/masmx86/mkasm.bat +3 -0
  827. data/dependencies/zlib/contrib/masmx86/readme.txt +21 -0
  828. data/dependencies/zlib/contrib/minizip/ChangeLogUnzip +67 -0
  829. data/dependencies/zlib/contrib/minizip/Makefile +25 -0
  830. data/dependencies/zlib/contrib/minizip/crypt.h +132 -0
  831. data/dependencies/zlib/contrib/minizip/ioapi.c +177 -0
  832. data/dependencies/zlib/contrib/minizip/ioapi.h +75 -0
  833. data/dependencies/zlib/contrib/minizip/iowin32.c +270 -0
  834. data/dependencies/zlib/contrib/minizip/iowin32.h +21 -0
  835. data/dependencies/zlib/contrib/minizip/miniunz.c +585 -0
  836. data/dependencies/zlib/contrib/minizip/minizip.c +420 -0
  837. data/dependencies/zlib/contrib/minizip/mztools.c +281 -0
  838. data/dependencies/zlib/contrib/minizip/mztools.h +31 -0
  839. data/dependencies/zlib/contrib/minizip/unzip.c +1598 -0
  840. data/dependencies/zlib/contrib/minizip/unzip.h +354 -0
  841. data/dependencies/zlib/contrib/minizip/zip.c +1219 -0
  842. data/dependencies/zlib/contrib/minizip/zip.h +235 -0
  843. data/dependencies/zlib/contrib/pascal/example.pas +599 -0
  844. data/dependencies/zlib/contrib/pascal/readme.txt +76 -0
  845. data/dependencies/zlib/contrib/pascal/zlibd32.mak +93 -0
  846. data/dependencies/zlib/contrib/pascal/zlibpas.pas +236 -0
  847. data/dependencies/zlib/contrib/puff/Makefile +8 -0
  848. data/dependencies/zlib/contrib/puff/README +63 -0
  849. data/dependencies/zlib/contrib/puff/puff.c +837 -0
  850. data/dependencies/zlib/contrib/puff/puff.h +31 -0
  851. data/dependencies/zlib/contrib/puff/zeros.raw +0 -0
  852. data/dependencies/zlib/contrib/testzlib/testzlib.c +275 -0
  853. data/dependencies/zlib/contrib/testzlib/testzlib.txt +10 -0
  854. data/dependencies/zlib/contrib/untgz/Makefile +14 -0
  855. data/dependencies/zlib/contrib/untgz/Makefile.msc +17 -0
  856. data/dependencies/zlib/contrib/untgz/untgz.c +674 -0
  857. data/dependencies/zlib/contrib/vstudio/readme.txt +73 -0
  858. data/dependencies/zlib/contrib/vstudio/vc7/miniunz.vcproj +126 -0
  859. data/dependencies/zlib/contrib/vstudio/vc7/minizip.vcproj +126 -0
  860. data/dependencies/zlib/contrib/vstudio/vc7/testzlib.vcproj +126 -0
  861. data/dependencies/zlib/contrib/vstudio/vc7/zlib.rc +32 -0
  862. data/dependencies/zlib/contrib/vstudio/vc7/zlibstat.vcproj +246 -0
  863. data/dependencies/zlib/contrib/vstudio/vc7/zlibvc.def +92 -0
  864. data/dependencies/zlib/contrib/vstudio/vc7/zlibvc.sln +78 -0
  865. data/dependencies/zlib/contrib/vstudio/vc7/zlibvc.vcproj +445 -0
  866. data/dependencies/zlib/contrib/vstudio/vc8/miniunz.vcproj +566 -0
  867. data/dependencies/zlib/contrib/vstudio/vc8/minizip.vcproj +563 -0
  868. data/dependencies/zlib/contrib/vstudio/vc8/testzlib.vcproj +948 -0
  869. data/dependencies/zlib/contrib/vstudio/vc8/testzlibdll.vcproj +567 -0
  870. data/dependencies/zlib/contrib/vstudio/vc8/zlib.rc +32 -0
  871. data/dependencies/zlib/contrib/vstudio/vc8/zlibstat.vcproj +870 -0
  872. data/dependencies/zlib/contrib/vstudio/vc8/zlibvc.def +92 -0
  873. data/dependencies/zlib/contrib/vstudio/vc8/zlibvc.sln +144 -0
  874. data/dependencies/zlib/contrib/vstudio/vc8/zlibvc.vcproj +1219 -0
  875. data/dependencies/zlib/crc32.c +423 -0
  876. data/dependencies/zlib/crc32.h +441 -0
  877. data/dependencies/zlib/deflate.c +1736 -0
  878. data/dependencies/zlib/deflate.h +331 -0
  879. data/dependencies/zlib/example.c +565 -0
  880. data/dependencies/zlib/examples/README.examples +42 -0
  881. data/dependencies/zlib/examples/fitblk.c +233 -0
  882. data/dependencies/zlib/examples/gun.c +693 -0
  883. data/dependencies/zlib/examples/gzappend.c +500 -0
  884. data/dependencies/zlib/examples/gzjoin.c +448 -0
  885. data/dependencies/zlib/examples/gzlog.c +413 -0
  886. data/dependencies/zlib/examples/gzlog.h +58 -0
  887. data/dependencies/zlib/examples/zlib_how.html +523 -0
  888. data/dependencies/zlib/examples/zpipe.c +191 -0
  889. data/dependencies/zlib/examples/zran.c +404 -0
  890. data/dependencies/zlib/gzio.c +1026 -0
  891. data/dependencies/zlib/infback.c +623 -0
  892. data/dependencies/zlib/inffast.c +318 -0
  893. data/dependencies/zlib/inffast.h +11 -0
  894. data/dependencies/zlib/inffixed.h +94 -0
  895. data/dependencies/zlib/inflate.c +1368 -0
  896. data/dependencies/zlib/inflate.h +115 -0
  897. data/dependencies/zlib/inftrees.c +329 -0
  898. data/dependencies/zlib/inftrees.h +55 -0
  899. data/dependencies/zlib/make_vms.com +461 -0
  900. data/dependencies/zlib/minigzip.c +322 -0
  901. data/dependencies/zlib/msdos/Makefile.bor +109 -0
  902. data/dependencies/zlib/msdos/Makefile.dj2 +104 -0
  903. data/dependencies/zlib/msdos/Makefile.emx +69 -0
  904. data/dependencies/zlib/msdos/Makefile.msc +106 -0
  905. data/dependencies/zlib/msdos/Makefile.tc +94 -0
  906. data/dependencies/zlib/old/Makefile.riscos +151 -0
  907. data/dependencies/zlib/old/README +3 -0
  908. data/dependencies/zlib/old/descrip.mms +48 -0
  909. data/dependencies/zlib/old/os2/Makefile.os2 +136 -0
  910. data/dependencies/zlib/old/os2/zlib.def +51 -0
  911. data/dependencies/zlib/old/visual-basic.txt +160 -0
  912. data/dependencies/zlib/old/zlib.html +971 -0
  913. data/dependencies/zlib/projects/README.projects +41 -0
  914. data/dependencies/zlib/projects/visualc6/README.txt +73 -0
  915. data/dependencies/zlib/projects/visualc6/example.dsp +278 -0
  916. data/dependencies/zlib/projects/visualc6/minigzip.dsp +278 -0
  917. data/dependencies/zlib/projects/visualc6/zlib.dsp +609 -0
  918. data/dependencies/zlib/projects/visualc6/zlib.dsw +59 -0
  919. data/dependencies/zlib/qnx/package.qpg +141 -0
  920. data/dependencies/zlib/trees.c +1219 -0
  921. data/dependencies/zlib/trees.h +128 -0
  922. data/dependencies/zlib/uncompr.c +61 -0
  923. data/dependencies/zlib/win32/DLL_FAQ.txt +397 -0
  924. data/dependencies/zlib/win32/Makefile.bor +107 -0
  925. data/dependencies/zlib/win32/Makefile.emx +69 -0
  926. data/dependencies/zlib/win32/Makefile.gcc +141 -0
  927. data/dependencies/zlib/win32/Makefile.msc +126 -0
  928. data/dependencies/zlib/win32/VisualC.txt +3 -0
  929. data/dependencies/zlib/win32/zlib.def +60 -0
  930. data/dependencies/zlib/win32/zlib1.rc +39 -0
  931. data/dependencies/zlib/zconf.h +332 -0
  932. data/dependencies/zlib/zconf.in.h +332 -0
  933. data/dependencies/zlib/zlib.3 +159 -0
  934. data/dependencies/zlib/zlib.h +1357 -0
  935. data/dependencies/zlib/zutil.c +318 -0
  936. data/dependencies/zlib/zutil.h +269 -0
  937. data/examples/ChipmunkIntegration.rb +7 -7
  938. data/examples/CptnRuby.rb +5 -5
  939. data/examples/OpenGLIntegration.rb +6 -6
  940. data/examples/RMagickIntegration.rb +1 -1
  941. data/examples/TextInput.cpp +23 -1
  942. data/examples/TextInput.rb +7 -1
  943. data/examples/Tutorial.cpp +2 -2
  944. data/examples/Tutorial.rb +5 -5
  945. data/lib/gosu/patches.rb +53 -0
  946. data/linux/Makefile.in +3 -2
  947. data/mac/Gosu.xcodeproj/jlnr.pbxuser +461 -349
  948. data/mac/Gosu.xcodeproj/jlnr.perspectivev3 +82 -50
  949. data/mac/Gosu.xcodeproj/project.pbxproj +503 -0
  950. data/reference/cpp/_audio_8hpp.html +0 -3
  951. data/reference/cpp/_audio_8hpp_source.html +95 -103
  952. data/reference/cpp/_bitmap_8hpp_source.html +1 -1
  953. data/reference/cpp/_color_8hpp.html +2 -3
  954. data/reference/cpp/_color_8hpp_source.html +54 -38
  955. data/reference/cpp/_font_8hpp_source.html +6 -6
  956. data/reference/cpp/_graphics_8hpp_source.html +55 -49
  957. data/reference/cpp/_image_8hpp_source.html +7 -7
  958. data/reference/cpp/_text_input_8hpp_source.html +11 -6
  959. data/reference/cpp/_version_8hpp.html +4 -4
  960. data/reference/cpp/_version_8hpp_source.html +2 -2
  961. data/reference/cpp/_window_8hpp_source.html +37 -36
  962. data/reference/cpp/annotated.html +0 -1
  963. data/reference/cpp/class_gosu_1_1_bitmap-members.html +1 -1
  964. data/reference/cpp/class_gosu_1_1_bitmap.html +3 -3
  965. data/reference/cpp/class_gosu_1_1_color-members.html +11 -0
  966. data/reference/cpp/class_gosu_1_1_color.html +212 -1
  967. data/reference/cpp/class_gosu_1_1_font-members.html +3 -3
  968. data/reference/cpp/class_gosu_1_1_font.html +12 -12
  969. data/reference/cpp/class_gosu_1_1_graphics-members.html +1 -1
  970. data/reference/cpp/class_gosu_1_1_graphics.html +5 -5
  971. data/reference/cpp/class_gosu_1_1_image-members.html +3 -3
  972. data/reference/cpp/class_gosu_1_1_image.html +13 -13
  973. data/reference/cpp/class_gosu_1_1_sample-members.html +2 -0
  974. data/reference/cpp/class_gosu_1_1_sample.html +70 -26
  975. data/reference/cpp/class_gosu_1_1_sample_instance.html +1 -1
  976. data/reference/cpp/class_gosu_1_1_song-members.html +3 -0
  977. data/reference/cpp/class_gosu_1_1_song.html +103 -26
  978. data/reference/cpp/class_gosu_1_1_text_input-members.html +2 -1
  979. data/reference/cpp/class_gosu_1_1_text_input.html +31 -4
  980. data/reference/cpp/class_gosu_1_1_window.html +6 -6
  981. data/reference/cpp/classes.html +12 -13
  982. data/reference/cpp/functions.html +3 -3
  983. data/reference/cpp/functions_0x62.html +7 -3
  984. data/reference/cpp/functions_0x63.html +4 -2
  985. data/reference/cpp/functions_0x64.html +6 -6
  986. data/reference/cpp/functions_0x66.html +4 -0
  987. data/reference/cpp/functions_0x67.html +4 -0
  988. data/reference/cpp/functions_0x6e.html +2 -0
  989. data/reference/cpp/functions_0x72.html +4 -2
  990. data/reference/cpp/functions_0x73.html +6 -6
  991. data/reference/cpp/functions_0x75.html +1 -1
  992. data/reference/cpp/functions_0x77.html +5 -3
  993. data/reference/cpp/functions_0x79.html +2 -0
  994. data/reference/cpp/functions_0x7e.html +1 -3
  995. data/reference/cpp/functions_func.html +0 -2
  996. data/reference/cpp/functions_func_0x62.html +1 -1
  997. data/reference/cpp/functions_func_0x64.html +6 -6
  998. data/reference/cpp/functions_func_0x66.html +2 -0
  999. data/reference/cpp/functions_func_0x72.html +1 -1
  1000. data/reference/cpp/functions_func_0x73.html +8 -8
  1001. data/reference/cpp/functions_func_0x75.html +1 -1
  1002. data/reference/cpp/functions_func_0x7e.html +1 -3
  1003. data/reference/cpp/functions_vars.html +22 -0
  1004. data/reference/cpp/hierarchy.html +0 -1
  1005. data/reference/cpp/namespace_gosu.html +2 -8
  1006. data/reference/cpp/namespace_gosu_1_1_colors.html +30 -17
  1007. data/reference/cpp/namespacemembers.html +2 -0
  1008. data/reference/cpp/namespacemembers_vars.html +2 -0
  1009. data/reference/cpp/namespaces.html +1 -1
  1010. data/reference/rdoc/classes/Gosu.html +23 -3
  1011. data/reference/rdoc/classes/Gosu/Color.html +127 -29
  1012. data/reference/rdoc/classes/Gosu/Font.html +31 -21
  1013. data/reference/rdoc/classes/Gosu/GLTexInfo.html +3 -3
  1014. data/reference/rdoc/classes/Gosu/Image.html +52 -37
  1015. data/reference/rdoc/classes/Gosu/Sample.html +19 -13
  1016. data/reference/rdoc/classes/Gosu/SampleInstance.html +29 -19
  1017. data/reference/rdoc/classes/Gosu/Song.html +41 -27
  1018. data/reference/rdoc/classes/Gosu/TextInput.html +42 -3
  1019. data/reference/rdoc/classes/Gosu/Window.html +102 -69
  1020. data/reference/rdoc/classes/Numeric.html +7 -3
  1021. data/reference/rdoc/created.rid +1 -1
  1022. data/reference/rdoc/files/COPYING_txt.html +3 -3
  1023. data/reference/rdoc/files/README_txt.html +3 -3
  1024. data/reference/rdoc/files/reference/Deployment on OS X_rdoc.html +4 -19
  1025. data/reference/rdoc/files/reference/Deployment on Windows_rdoc.html +18 -31
  1026. data/reference/rdoc/files/reference/Drawing with Colors_rdoc.html +3 -3
  1027. data/reference/rdoc/files/reference/Order of Corners_rdoc.html +3 -3
  1028. data/reference/rdoc/files/reference/Tileability_rdoc.html +3 -3
  1029. data/reference/rdoc/files/reference/Z Ordering_rdoc.html +3 -3
  1030. data/reference/rdoc/files/reference/gosu_rb.html +3 -3
  1031. data/reference/rdoc/fr_method_index.html +49 -48
  1032. data/reference/rdoc/index.html +1 -1
  1033. metadata +912 -66
  1034. data/reference/rdoc/classes/Gosu.src/M000003.html +0 -0
  1035. data/reference/rdoc/classes/Gosu.src/M000004.html +0 -0
  1036. data/reference/rdoc/classes/Gosu.src/M000005.html +0 -0
  1037. data/reference/rdoc/classes/Gosu.src/M000006.html +0 -0
  1038. data/reference/rdoc/classes/Gosu.src/M000007.html +0 -0
  1039. data/reference/rdoc/classes/Gosu.src/M000008.html +0 -0
  1040. data/reference/rdoc/classes/Gosu.src/M000009.html +0 -0
  1041. data/reference/rdoc/classes/Gosu.src/M000010.html +0 -0
  1042. data/reference/rdoc/classes/Gosu.src/M000011.html +0 -0
  1043. data/reference/rdoc/classes/Gosu.src/M000012.html +0 -0
  1044. data/reference/rdoc/classes/Gosu/Color.src/M000016.html +0 -0
  1045. data/reference/rdoc/classes/Gosu/Color.src/M000017.html +0 -0
  1046. data/reference/rdoc/classes/Gosu/Color.src/M000018.html +0 -0
  1047. data/reference/rdoc/classes/Gosu/Color.src/M000019.html +0 -0
  1048. data/reference/rdoc/classes/Gosu/Font.src/M000029.html +0 -0
  1049. data/reference/rdoc/classes/Gosu/Font.src/M000030.html +0 -0
  1050. data/reference/rdoc/classes/Gosu/Font.src/M000031.html +0 -0
  1051. data/reference/rdoc/classes/Gosu/Font.src/M000032.html +0 -0
  1052. data/reference/rdoc/classes/Gosu/Font.src/M000033.html +0 -0
  1053. data/reference/rdoc/classes/Gosu/Image.src/M000020.html +0 -0
  1054. data/reference/rdoc/classes/Gosu/Image.src/M000021.html +0 -0
  1055. data/reference/rdoc/classes/Gosu/Image.src/M000022.html +0 -0
  1056. data/reference/rdoc/classes/Gosu/Image.src/M000023.html +0 -0
  1057. data/reference/rdoc/classes/Gosu/Image.src/M000024.html +0 -0
  1058. data/reference/rdoc/classes/Gosu/Image.src/M000025.html +0 -0
  1059. data/reference/rdoc/classes/Gosu/Image.src/M000026.html +0 -0
  1060. data/reference/rdoc/classes/Gosu/Image.src/M000027.html +0 -0
  1061. data/reference/rdoc/classes/Gosu/Image.src/M000028.html +0 -0
  1062. data/reference/rdoc/classes/Gosu/Sample.src/M000013.html +0 -0
  1063. data/reference/rdoc/classes/Gosu/Sample.src/M000014.html +0 -0
  1064. data/reference/rdoc/classes/Gosu/Sample.src/M000015.html +0 -0
  1065. data/reference/rdoc/classes/Gosu/SampleInstance.src/M000051.html +0 -0
  1066. data/reference/rdoc/classes/Gosu/SampleInstance.src/M000052.html +0 -0
  1067. data/reference/rdoc/classes/Gosu/SampleInstance.src/M000053.html +0 -0
  1068. data/reference/rdoc/classes/Gosu/SampleInstance.src/M000054.html +0 -0
  1069. data/reference/rdoc/classes/Gosu/SampleInstance.src/M000055.html +0 -0
  1070. data/reference/rdoc/classes/Gosu/Song.src/M000056.html +0 -0
  1071. data/reference/rdoc/classes/Gosu/Song.src/M000057.html +0 -0
  1072. data/reference/rdoc/classes/Gosu/Song.src/M000058.html +0 -0
  1073. data/reference/rdoc/classes/Gosu/Song.src/M000059.html +0 -0
  1074. data/reference/rdoc/classes/Gosu/Song.src/M000060.html +0 -0
  1075. data/reference/rdoc/classes/Gosu/Song.src/M000061.html +0 -0
  1076. data/reference/rdoc/classes/Gosu/Song.src/M000062.html +0 -0
  1077. data/reference/rdoc/classes/Gosu/Window.src/M000034.html +0 -0
  1078. data/reference/rdoc/classes/Gosu/Window.src/M000035.html +0 -0
  1079. data/reference/rdoc/classes/Gosu/Window.src/M000036.html +0 -0
  1080. data/reference/rdoc/classes/Gosu/Window.src/M000037.html +0 -0
  1081. data/reference/rdoc/classes/Gosu/Window.src/M000038.html +0 -0
  1082. data/reference/rdoc/classes/Gosu/Window.src/M000039.html +0 -0
  1083. data/reference/rdoc/classes/Gosu/Window.src/M000040.html +0 -0
  1084. data/reference/rdoc/classes/Gosu/Window.src/M000041.html +0 -0
  1085. data/reference/rdoc/classes/Gosu/Window.src/M000042.html +0 -0
  1086. data/reference/rdoc/classes/Gosu/Window.src/M000043.html +0 -0
  1087. data/reference/rdoc/classes/Gosu/Window.src/M000044.html +0 -0
  1088. data/reference/rdoc/classes/Gosu/Window.src/M000045.html +0 -0
  1089. data/reference/rdoc/classes/Gosu/Window.src/M000046.html +0 -0
  1090. data/reference/rdoc/classes/Gosu/Window.src/M000047.html +0 -0
  1091. data/reference/rdoc/classes/Gosu/Window.src/M000048.html +0 -0
  1092. data/reference/rdoc/classes/Gosu/Window.src/M000049.html +0 -0
  1093. data/reference/rdoc/classes/Gosu/Window.src/M000050.html +0 -0
  1094. data/reference/rdoc/classes/Numeric.src/M000001.html +0 -0
  1095. data/reference/rdoc/classes/Numeric.src/M000002.html +0 -0
@@ -0,0 +1,2127 @@
1
+ /*---------------------------------------------------------------------------
2
+
3
+ rpng2 - progressive-model PNG display program rpng2-x.c
4
+
5
+ This program decodes and displays PNG files progressively, as if it were
6
+ a web browser (though the front end is only set up to read from files).
7
+ It supports gamma correction, user-specified background colors, and user-
8
+ specified background patterns (for transparent images). This version is
9
+ for the X Window System (tested by the author under Unix and by Martin
10
+ Zinser under OpenVMS; may work under OS/2 with a little tweaking).
11
+
12
+ Thanks to Adam Costello and Pieter S. van der Meulen for the "diamond"
13
+ and "radial waves" patterns, respectively.
14
+
15
+ to do (someday, maybe):
16
+ - fix expose/redraw code: don't draw entire row if only part exposed
17
+ - 8-bit (colormapped) X support
18
+ - finish resizable checkerboard-gradient (sizes 4-128?)
19
+ - use %.1023s to simplify truncation of title-bar string?
20
+
21
+ ---------------------------------------------------------------------------
22
+
23
+ Changelog:
24
+ - 1.01: initial public release
25
+ - 1.02: modified to allow abbreviated options; fixed char/uchar mismatch
26
+ - 1.10: added support for non-default visuals; fixed X pixel-conversion
27
+ - 1.11: added -usleep option for demos; fixed command-line parsing bug
28
+ - 1.12: added -pause option for demos and testing
29
+ - 1.20: added runtime MMX-enabling/disabling and new -mmx* options
30
+ - 1.21: fixed some small X memory leaks (thanks to Fran�ois Petitjean)
31
+ - 1.22: fixed XFreeGC() crash bug (thanks to Patrick Welche)
32
+ - 1.23: added -bgpat 0 mode (std white/gray checkerboard, 8x8 squares)
33
+ - 1.30: added -loop option for -bgpat (ifdef FEATURE_LOOP); fixed bpp =
34
+ 24; added support for X resources (thanks to Gerhard Niklasch)
35
+ - 1.31: added code to skip unused chunks (thanks to Glenn Randers-Pehrson)
36
+ - 1.32: added AMD64/EM64T support (__x86_64__); added basic expose/redraw
37
+ handling
38
+ - 2.00: dual-licensed (added GNU GPL)
39
+ - 2.01: fixed 64-bit typo in readpng2.c; fixed -pause usage description
40
+ - 2.02: fixed improper display of usage screen on PNG error(s); fixed
41
+ unexpected-EOF and file-read-error cases; fixed Trace() cut-and-
42
+ paste bugs
43
+
44
+ ---------------------------------------------------------------------------
45
+
46
+ Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
47
+
48
+ This software is provided "as is," without warranty of any kind,
49
+ express or implied. In no event shall the author or contributors
50
+ be held liable for any damages arising in any way from the use of
51
+ this software.
52
+
53
+ The contents of this file are DUAL-LICENSED. You may modify and/or
54
+ redistribute this software according to the terms of one of the
55
+ following two licenses (at your option):
56
+
57
+
58
+ LICENSE 1 ("BSD-like with advertising clause"):
59
+
60
+ Permission is granted to anyone to use this software for any purpose,
61
+ including commercial applications, and to alter it and redistribute
62
+ it freely, subject to the following restrictions:
63
+
64
+ 1. Redistributions of source code must retain the above copyright
65
+ notice, disclaimer, and this list of conditions.
66
+ 2. Redistributions in binary form must reproduce the above copyright
67
+ notice, disclaimer, and this list of conditions in the documenta-
68
+ tion and/or other materials provided with the distribution.
69
+ 3. All advertising materials mentioning features or use of this
70
+ software must display the following acknowledgment:
71
+
72
+ This product includes software developed by Greg Roelofs
73
+ and contributors for the book, "PNG: The Definitive Guide,"
74
+ published by O'Reilly and Associates.
75
+
76
+
77
+ LICENSE 2 (GNU GPL v2 or later):
78
+
79
+ This program is free software; you can redistribute it and/or modify
80
+ it under the terms of the GNU General Public License as published by
81
+ the Free Software Foundation; either version 2 of the License, or
82
+ (at your option) any later version.
83
+
84
+ This program is distributed in the hope that it will be useful,
85
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
86
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
87
+ GNU General Public License for more details.
88
+
89
+ You should have received a copy of the GNU General Public License
90
+ along with this program; if not, write to the Free Software Foundation,
91
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
92
+
93
+ ---------------------------------------------------------------------------*/
94
+
95
+ #define PROGNAME "rpng2-x"
96
+ #define LONGNAME "Progressive PNG Viewer for X"
97
+ #define VERSION "2.02 of 16 March 2008"
98
+ #define RESNAME "rpng2" /* our X resource application name */
99
+ #define RESCLASS "Rpng" /* our X resource class name */
100
+
101
+ #include <stdio.h>
102
+ #include <stdlib.h>
103
+ #include <ctype.h>
104
+ #include <string.h>
105
+ #include <setjmp.h> /* for jmpbuf declaration in readpng2.h */
106
+ #include <time.h>
107
+ #include <math.h> /* only for PvdM background code */
108
+ #include <X11/Xlib.h>
109
+ #include <X11/Xutil.h>
110
+ #include <X11/Xos.h>
111
+ #include <X11/keysym.h> /* defines XK_* macros */
112
+
113
+ #ifdef VMS
114
+ # include <unistd.h>
115
+ #endif
116
+
117
+ /* all for PvdM background code: */
118
+ #ifndef PI
119
+ # define PI 3.141592653589793238
120
+ #endif
121
+ #define PI_2 (PI*0.5)
122
+ #define INV_PI_360 (360.0 / PI)
123
+ #define MAX(a,b) (a>b?a:b)
124
+ #define MIN(a,b) (a<b?a:b)
125
+ #define CLIP(a,min,max) MAX(min,MIN((a),max))
126
+ #define ABS(a) ((a)<0?-(a):(a))
127
+ #define CLIP8P(c) MAX(0,(MIN((c),255))) /* 8-bit pos. integer (uch) */
128
+ #define ROUNDF(f) ((int)(f + 0.5))
129
+
130
+ #define QUIT(e,k) ((e.type == ButtonPress && e.xbutton.button == Button1) || \
131
+ (e.type == KeyPress && /* v--- or 1 for shifted keys */ \
132
+ ((k = XLookupKeysym(&e.xkey, 0)) == XK_q || k == XK_Escape)))
133
+
134
+ #define NO_24BIT_MASKS /* undef case not fully written--only for redisplay() */
135
+
136
+ #define rgb1_max bg_freq
137
+ #define rgb1_min bg_gray
138
+ #define rgb2_max bg_bsat
139
+ #define rgb2_min bg_brot
140
+
141
+ /* #define DEBUG */ /* this enables the Trace() macros */
142
+
143
+ #include "readpng2.h" /* typedefs, common macros, readpng2 prototypes */
144
+
145
+
146
+ /* could just include png.h, but this macro is the only thing we need
147
+ * (name and typedefs changed to local versions); note that side effects
148
+ * only happen with alpha (which could easily be avoided with
149
+ * "ush acopy = (alpha);") */
150
+
151
+ #define alpha_composite(composite, fg, alpha, bg) { \
152
+ ush temp = ((ush)(fg)*(ush)(alpha) + \
153
+ (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
154
+ (composite) = (uch)((temp + (temp >> 8)) >> 8); \
155
+ }
156
+
157
+
158
+ #define INBUFSIZE 4096 /* with pseudo-timing on (1 sec delay/block), this
159
+ * block size corresponds roughly to a download
160
+ * speed 10% faster than theoretical 33.6K maximum
161
+ * (assuming 8 data bits, 1 stop bit and no other
162
+ * overhead) */
163
+
164
+ /* local prototypes */
165
+ static void rpng2_x_init (void);
166
+ static int rpng2_x_create_window (void);
167
+ static int rpng2_x_load_bg_image (void);
168
+ static void rpng2_x_display_row (ulg row);
169
+ static void rpng2_x_finish_display (void);
170
+ static void rpng2_x_redisplay_image (ulg startcol, ulg startrow,
171
+ ulg width, ulg height);
172
+ #ifdef FEATURE_LOOP
173
+ static void rpng2_x_reload_bg_image (void);
174
+ static int is_number (char *p);
175
+ #endif
176
+ static void rpng2_x_cleanup (void);
177
+ static int rpng2_x_msb (ulg u32val);
178
+
179
+
180
+ static char titlebar[1024], *window_name = titlebar;
181
+ static char *appname = LONGNAME;
182
+ static char *icon_name = PROGNAME;
183
+ static char *res_name = RESNAME;
184
+ static char *res_class = RESCLASS;
185
+ static char *filename;
186
+ static FILE *infile;
187
+
188
+ static mainprog_info rpng2_info;
189
+
190
+ static uch inbuf[INBUFSIZE];
191
+ static int incount;
192
+
193
+ static int pat = 6; /* must be less than num_bgpat */
194
+ static int bg_image = 0;
195
+ static int bgscale, bgscale_default = 16;
196
+ static ulg bg_rowbytes;
197
+ static uch *bg_data;
198
+
199
+ int pause_after_pass = FALSE;
200
+ int demo_timing = FALSE;
201
+ ulg usleep_duration = 0L;
202
+
203
+ static struct rgb_color {
204
+ uch r, g, b;
205
+ } rgb[] = {
206
+ { 0, 0, 0}, /* 0: black */
207
+ {255, 255, 255}, /* 1: white */
208
+ {173, 132, 57}, /* 2: tan */
209
+ { 64, 132, 0}, /* 3: medium green */
210
+ {189, 117, 1}, /* 4: gold */
211
+ {253, 249, 1}, /* 5: yellow */
212
+ { 0, 0, 255}, /* 6: blue */
213
+ { 0, 0, 120}, /* 7: medium blue */
214
+ {255, 0, 255}, /* 8: magenta */
215
+ { 64, 0, 64}, /* 9: dark magenta */
216
+ {255, 0, 0}, /* 10: red */
217
+ { 64, 0, 0}, /* 11: dark red */
218
+ {255, 127, 0}, /* 12: orange */
219
+ {192, 96, 0}, /* 13: darker orange */
220
+ { 24, 60, 0}, /* 14: dark green-yellow */
221
+ { 85, 125, 200}, /* 15: ice blue */
222
+ {192, 192, 192} /* 16: Netscape/Mosaic gray */
223
+ };
224
+ /* not used for now, but should be for error-checking:
225
+ static int num_rgb = sizeof(rgb) / sizeof(struct rgb_color);
226
+ */
227
+
228
+ /*
229
+ This whole struct is a fairly cheesy way to keep the number of
230
+ command-line options to a minimum. The radial-waves background
231
+ type is a particularly poor fit to the integer elements of the
232
+ struct...but a few macros and a little fixed-point math will do
233
+ wonders for ya.
234
+
235
+ type bits:
236
+ F E D C B A 9 8 7 6 5 4 3 2 1 0
237
+ | | | | |
238
+ | | +-+-+-- 0 = sharp-edged checkerboard
239
+ | | 1 = soft diamonds
240
+ | | 2 = radial waves
241
+ | | 3-7 = undefined
242
+ | +-- gradient #2 inverted?
243
+ +-- alternating columns inverted?
244
+ */
245
+ static struct background_pattern {
246
+ ush type;
247
+ int rgb1_max, rgb1_min; /* or bg_freq, bg_gray */
248
+ int rgb2_max, rgb2_min; /* or bg_bsat, bg_brot (both scaled by 10)*/
249
+ } bg[] = {
250
+ {0, 1,1, 16,16}, /* checkered: white vs. light gray (basic) */
251
+ {0+8, 2,0, 1,15}, /* checkered: tan/black vs. white/ice blue */
252
+ {0+24, 2,0, 1,0}, /* checkered: tan/black vs. white/black */
253
+ {0+8, 4,5, 0,2}, /* checkered: gold/yellow vs. black/tan */
254
+ {0+8, 4,5, 0,6}, /* checkered: gold/yellow vs. black/blue */
255
+ {0, 7,0, 8,9}, /* checkered: deep blue/black vs. magenta */
256
+ {0+8, 13,0, 5,14}, /* checkered: orange/black vs. yellow */
257
+ {0+8, 12,0, 10,11}, /* checkered: orange/black vs. red */
258
+ {1, 7,0, 8,0}, /* diamonds: deep blue/black vs. magenta */
259
+ {1, 12,0, 11,0}, /* diamonds: orange vs. dark red */
260
+ {1, 10,0, 7,0}, /* diamonds: red vs. medium blue */
261
+ {1, 4,0, 5,0}, /* diamonds: gold vs. yellow */
262
+ {1, 3,0, 0,0}, /* diamonds: medium green vs. black */
263
+ {2, 16, 100, 20, 0}, /* radial: ~hard radial color-beams */
264
+ {2, 18, 100, 10, 2}, /* radial: soft, curved radial color-beams */
265
+ {2, 16, 256, 100, 250}, /* radial: very tight spiral */
266
+ {2, 10000, 256, 11, 0} /* radial: dipole-moire' (almost fractal) */
267
+ };
268
+ static int num_bgpat = sizeof(bg) / sizeof(struct background_pattern);
269
+
270
+
271
+ /* X-specific variables */
272
+ static char *displayname;
273
+ static XImage *ximage;
274
+ static Display *display;
275
+ static int depth;
276
+ static Visual *visual;
277
+ static XVisualInfo *visual_list;
278
+ static int RShift, GShift, BShift;
279
+ static ulg RMask, GMask, BMask;
280
+ static Window window;
281
+ static GC gc;
282
+ static Colormap colormap;
283
+
284
+ static int have_nondefault_visual = FALSE;
285
+ static int have_colormap = FALSE;
286
+ static int have_window = FALSE;
287
+ static int have_gc = FALSE;
288
+
289
+
290
+
291
+
292
+ int main(int argc, char **argv)
293
+ {
294
+ #ifdef sgi
295
+ char tmpline[80];
296
+ #endif
297
+ char *p, *bgstr = NULL;
298
+ int rc, alen, flen;
299
+ int error = 0;
300
+ int timing = FALSE;
301
+ int have_bg = FALSE;
302
+ #ifdef FEATURE_LOOP
303
+ int loop = FALSE;
304
+ long loop_interval = -1; /* seconds (100,000 max) */
305
+ #endif
306
+ double LUT_exponent; /* just the lookup table */
307
+ double CRT_exponent = 2.2; /* just the monitor */
308
+ double default_display_exponent; /* whole display system */
309
+ XEvent e;
310
+ KeySym k;
311
+
312
+
313
+ /* First initialize a few things, just to be sure--memset takes care of
314
+ * default background color (black), booleans (FALSE), pointers (NULL),
315
+ * etc. */
316
+
317
+ displayname = (char *)NULL;
318
+ filename = (char *)NULL;
319
+ memset(&rpng2_info, 0, sizeof(mainprog_info));
320
+
321
+
322
+ /* Set the default value for our display-system exponent, i.e., the
323
+ * product of the CRT exponent and the exponent corresponding to
324
+ * the frame-buffer's lookup table (LUT), if any. This is not an
325
+ * exhaustive list of LUT values (e.g., OpenStep has a lot of weird
326
+ * ones), but it should cover 99% of the current possibilities. */
327
+
328
+ #if defined(NeXT)
329
+ /* third-party utilities can modify the default LUT exponent */
330
+ LUT_exponent = 1.0 / 2.2;
331
+ /*
332
+ if (some_next_function_that_returns_gamma(&next_gamma))
333
+ LUT_exponent = 1.0 / next_gamma;
334
+ */
335
+ #elif defined(sgi)
336
+ LUT_exponent = 1.0 / 1.7;
337
+ /* there doesn't seem to be any documented function to
338
+ * get the "gamma" value, so we do it the hard way */
339
+ infile = fopen("/etc/config/system.glGammaVal", "r");
340
+ if (infile) {
341
+ double sgi_gamma;
342
+
343
+ fgets(tmpline, 80, infile);
344
+ fclose(infile);
345
+ sgi_gamma = atof(tmpline);
346
+ if (sgi_gamma > 0.0)
347
+ LUT_exponent = 1.0 / sgi_gamma;
348
+ }
349
+ #elif defined(Macintosh)
350
+ LUT_exponent = 1.8 / 2.61;
351
+ /*
352
+ if (some_mac_function_that_returns_gamma(&mac_gamma))
353
+ LUT_exponent = mac_gamma / 2.61;
354
+ */
355
+ #else
356
+ LUT_exponent = 1.0; /* assume no LUT: most PCs */
357
+ #endif
358
+
359
+ /* the defaults above give 1.0, 1.3, 1.5 and 2.2, respectively: */
360
+ default_display_exponent = LUT_exponent * CRT_exponent;
361
+
362
+
363
+ /* If the user has set the SCREEN_GAMMA environment variable as suggested
364
+ * (somewhat imprecisely) in the libpng documentation, use that; otherwise
365
+ * use the default value we just calculated. Either way, the user may
366
+ * override this via a command-line option. */
367
+
368
+ if ((p = getenv("SCREEN_GAMMA")) != NULL)
369
+ rpng2_info.display_exponent = atof(p);
370
+ else
371
+ rpng2_info.display_exponent = default_display_exponent;
372
+
373
+
374
+ /* Now parse the command line for options and the PNG filename. */
375
+
376
+ while (*++argv && !error) {
377
+ if (!strncmp(*argv, "-display", 2)) {
378
+ if (!*++argv)
379
+ ++error;
380
+ else
381
+ displayname = *argv;
382
+ } else if (!strncmp(*argv, "-gamma", 2)) {
383
+ if (!*++argv)
384
+ ++error;
385
+ else {
386
+ rpng2_info.display_exponent = atof(*argv);
387
+ if (rpng2_info.display_exponent <= 0.0)
388
+ ++error;
389
+ }
390
+ } else if (!strncmp(*argv, "-bgcolor", 4)) {
391
+ if (!*++argv)
392
+ ++error;
393
+ else {
394
+ bgstr = *argv;
395
+ if (strlen(bgstr) != 7 || bgstr[0] != '#')
396
+ ++error;
397
+ else {
398
+ have_bg = TRUE;
399
+ bg_image = FALSE;
400
+ }
401
+ }
402
+ } else if (!strncmp(*argv, "-bgpat", 4)) {
403
+ if (!*++argv)
404
+ ++error;
405
+ else {
406
+ pat = atoi(*argv);
407
+ if (pat >= 0 && pat < num_bgpat) {
408
+ bg_image = TRUE;
409
+ have_bg = FALSE;
410
+ } else
411
+ ++error;
412
+ }
413
+ } else if (!strncmp(*argv, "-usleep", 2)) {
414
+ if (!*++argv)
415
+ ++error;
416
+ else {
417
+ usleep_duration = (ulg)atol(*argv);
418
+ demo_timing = TRUE;
419
+ }
420
+ } else if (!strncmp(*argv, "-pause", 2)) {
421
+ pause_after_pass = TRUE;
422
+ } else if (!strncmp(*argv, "-timing", 2)) {
423
+ timing = TRUE;
424
+ #ifdef FEATURE_LOOP
425
+ } else if (!strncmp(*argv, "-loop", 2)) {
426
+ loop = TRUE;
427
+ if (!argv[1] || !is_number(argv[1]))
428
+ loop_interval = 2;
429
+ else {
430
+ ++argv;
431
+ loop_interval = atol(*argv);
432
+ if (loop_interval < 0)
433
+ loop_interval = 2;
434
+ else if (loop_interval > 100000) /* bit more than one day */
435
+ loop_interval = 100000;
436
+ }
437
+ #endif
438
+ #if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
439
+ } else if (!strncmp(*argv, "-nommxfilters", 7)) {
440
+ rpng2_info.nommxfilters = TRUE;
441
+ } else if (!strncmp(*argv, "-nommxcombine", 7)) {
442
+ rpng2_info.nommxcombine = TRUE;
443
+ } else if (!strncmp(*argv, "-nommxinterlace", 7)) {
444
+ rpng2_info.nommxinterlace = TRUE;
445
+ } else if (!strcmp(*argv, "-nommx")) {
446
+ rpng2_info.nommxfilters = TRUE;
447
+ rpng2_info.nommxcombine = TRUE;
448
+ rpng2_info.nommxinterlace = TRUE;
449
+ #endif
450
+ } else {
451
+ if (**argv != '-') {
452
+ filename = *argv;
453
+ if (argv[1]) /* shouldn't be any more args after filename */
454
+ ++error;
455
+ } else
456
+ ++error; /* not expecting any other options */
457
+ }
458
+ }
459
+
460
+ if (!filename)
461
+ ++error;
462
+
463
+
464
+ /* print usage screen if any errors up to this point */
465
+
466
+ if (error) {
467
+ fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
468
+ readpng2_version_info();
469
+ fprintf(stderr, "\n"
470
+ "Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n"
471
+ #if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
472
+ " %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n"
473
+ #endif
474
+ #ifdef FEATURE_LOOP
475
+ " %*s [-usleep dur | -timing] [-pause] [-loop [sec]] file.png\n\n"
476
+ #else
477
+ " %*s [-usleep dur | -timing] [-pause] file.png\n\n"
478
+ #endif
479
+ " xdpy\tname of the target X display (e.g., ``hostname:0'')\n"
480
+ " exp \ttransfer-function exponent (``gamma'') of the display\n"
481
+ "\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
482
+ "\t\t to the product of the lookup-table exponent (varies)\n"
483
+ "\t\t and the CRT exponent (usually 2.2); must be positive\n"
484
+ " bg \tdesired background color in 7-character hex RGB format\n"
485
+ "\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
486
+ "\t\t used with transparent images; overrides -bgpat\n"
487
+ " pat \tdesired background pattern number (0-%d); used with\n"
488
+ "\t\t transparent images; overrides -bgcolor\n"
489
+ #ifdef FEATURE_LOOP
490
+ " -loop\tloops through background images after initial display\n"
491
+ "\t\t is complete (depends on -bgpat)\n"
492
+ " sec \tseconds to display each background image (default = 2)\n"
493
+ #endif
494
+ #if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
495
+ " -nommx*\tdisable optimized MMX routines for decoding row filters,\n"
496
+ "\t\t combining rows, and expanding interlacing, respectively\n"
497
+ #endif
498
+ " dur \tduration in microseconds to wait after displaying each\n"
499
+ "\t\t row (for demo purposes)\n"
500
+ " -timing\tenables delay for every block read, to simulate modem\n"
501
+ "\t\t download of image (~36 Kbps)\n"
502
+ " -pause\tpauses after displaying each pass until mouse clicked\n"
503
+ "\nPress Q, Esc or mouse button 1 (within image window, after image\n"
504
+ "is displayed) to quit.\n"
505
+ "\n", PROGNAME,
506
+ #if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
507
+ (int)strlen(PROGNAME), " ",
508
+ #endif
509
+ (int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat-1);
510
+ exit(1);
511
+ }
512
+
513
+
514
+ if (!(infile = fopen(filename, "rb"))) {
515
+ fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
516
+ ++error;
517
+ } else {
518
+ incount = fread(inbuf, 1, INBUFSIZE, infile);
519
+ if (incount < 8 || !readpng2_check_sig(inbuf, 8)) {
520
+ fprintf(stderr, PROGNAME
521
+ ": [%s] is not a PNG file: incorrect signature\n",
522
+ filename);
523
+ ++error;
524
+ } else if ((rc = readpng2_init(&rpng2_info)) != 0) {
525
+ switch (rc) {
526
+ case 2:
527
+ fprintf(stderr, PROGNAME
528
+ ": [%s] has bad IHDR (libpng longjmp)\n", filename);
529
+ break;
530
+ case 4:
531
+ fprintf(stderr, PROGNAME ": insufficient memory\n");
532
+ break;
533
+ default:
534
+ fprintf(stderr, PROGNAME
535
+ ": unknown readpng2_init() error\n");
536
+ break;
537
+ }
538
+ ++error;
539
+ } else {
540
+ Trace((stderr, "about to call XOpenDisplay()\n"))
541
+ display = XOpenDisplay(displayname);
542
+ if (!display) {
543
+ readpng2_cleanup(&rpng2_info);
544
+ fprintf(stderr, PROGNAME ": can't open X display [%s]\n",
545
+ displayname? displayname : "default");
546
+ ++error;
547
+ }
548
+ }
549
+ if (error)
550
+ fclose(infile);
551
+ }
552
+
553
+
554
+ if (error) {
555
+ fprintf(stderr, PROGNAME ": aborting.\n");
556
+ exit(2);
557
+ }
558
+
559
+
560
+ /* set the title-bar string, but make sure buffer doesn't overflow */
561
+
562
+ alen = strlen(appname);
563
+ flen = strlen(filename);
564
+ if (alen + flen + 3 > 1023)
565
+ sprintf(titlebar, "%s: ...%s", appname, filename+(alen+flen+6-1023));
566
+ else
567
+ sprintf(titlebar, "%s: %s", appname, filename);
568
+
569
+
570
+ /* set some final rpng2_info variables before entering main data loop */
571
+
572
+ if (have_bg) {
573
+ unsigned r, g, b; /* this approach quiets compiler warnings */
574
+
575
+ sscanf(bgstr+1, "%2x%2x%2x", &r, &g, &b);
576
+ rpng2_info.bg_red = (uch)r;
577
+ rpng2_info.bg_green = (uch)g;
578
+ rpng2_info.bg_blue = (uch)b;
579
+ } else
580
+ rpng2_info.need_bgcolor = TRUE;
581
+
582
+ rpng2_info.state = kPreInit;
583
+ rpng2_info.mainprog_init = rpng2_x_init;
584
+ rpng2_info.mainprog_display_row = rpng2_x_display_row;
585
+ rpng2_info.mainprog_finish_display = rpng2_x_finish_display;
586
+
587
+
588
+ /* OK, this is the fun part: call readpng2_decode_data() at the start of
589
+ * the loop to deal with our first buffer of data (read in above to verify
590
+ * that the file is a PNG image), then loop through the file and continue
591
+ * calling the same routine to handle each chunk of data. It in turn
592
+ * passes the data to libpng, which will invoke one or more of our call-
593
+ * backs as decoded data become available. We optionally call sleep() for
594
+ * one second per iteration to simulate downloading the image via an analog
595
+ * modem. */
596
+
597
+ for (;;) {
598
+ Trace((stderr, "about to call readpng2_decode_data()\n"))
599
+ if (readpng2_decode_data(&rpng2_info, inbuf, incount))
600
+ ++error;
601
+ Trace((stderr, "done with readpng2_decode_data()\n"))
602
+
603
+ if (error || incount != INBUFSIZE || rpng2_info.state == kDone) {
604
+ if (rpng2_info.state == kDone) {
605
+ Trace((stderr, "done decoding PNG image\n"))
606
+ } else if (ferror(infile)) {
607
+ fprintf(stderr, PROGNAME
608
+ ": error while reading PNG image file\n");
609
+ exit(3);
610
+ } else if (feof(infile)) {
611
+ fprintf(stderr, PROGNAME ": end of file reached "
612
+ "(unexpectedly) while reading PNG image file\n");
613
+ exit(3);
614
+ } else /* if (error) */ {
615
+ // will print error message below
616
+ }
617
+ break;
618
+ }
619
+
620
+ if (timing)
621
+ sleep(1);
622
+
623
+ incount = fread(inbuf, 1, INBUFSIZE, infile);
624
+ }
625
+
626
+
627
+ /* clean up PNG stuff and report any decoding errors */
628
+
629
+ fclose(infile);
630
+ Trace((stderr, "about to call readpng2_cleanup()\n"))
631
+ readpng2_cleanup(&rpng2_info);
632
+
633
+ if (error) {
634
+ fprintf(stderr, PROGNAME ": libpng error while decoding PNG image\n");
635
+ exit(3);
636
+ }
637
+
638
+
639
+ #ifdef FEATURE_LOOP
640
+
641
+ if (loop && bg_image) {
642
+ Trace((stderr, "entering -loop loop (FEATURE_LOOP)\n"))
643
+ for (;;) {
644
+ int i, use_sleep;
645
+ struct timeval now, then;
646
+
647
+ /* get current time and add loop_interval to get target time */
648
+ if (gettimeofday(&then, NULL) == 0) {
649
+ then.tv_sec += loop_interval;
650
+ use_sleep = FALSE;
651
+ } else
652
+ use_sleep = TRUE;
653
+
654
+ /* do quick check for a quit event but don't wait for it */
655
+ /* GRR BUG: should also check for Expose events and redraw... */
656
+ if (XCheckMaskEvent(display, KeyPressMask | ButtonPressMask, &e))
657
+ if (QUIT(e,k))
658
+ break;
659
+
660
+ /* generate next background image */
661
+ if (++pat >= num_bgpat)
662
+ pat = 0;
663
+ rpng2_x_reload_bg_image();
664
+
665
+ /* wait for timeout, using whatever means are available */
666
+ if (use_sleep || gettimeofday(&now, NULL) != 0) {
667
+ for (i = loop_interval; i > 0; --i) {
668
+ sleep(1);
669
+ /* GRR BUG: also need to check for Expose (and redraw!) */
670
+ if (XCheckMaskEvent(display, KeyPressMask | ButtonPressMask,
671
+ &e) && QUIT(e,k))
672
+ break;
673
+ }
674
+ } else {
675
+ /* Y2038 BUG! */
676
+ if (now.tv_sec < then.tv_sec ||
677
+ (now.tv_sec == then.tv_sec && now.tv_usec < then.tv_usec))
678
+ {
679
+ int quit = FALSE;
680
+ long seconds_to_go = then.tv_sec - now.tv_sec;
681
+ long usleep_usec;
682
+
683
+ /* basically chew up most of remaining loop-interval with
684
+ * calls to sleep(1) interleaved with checks for quit
685
+ * events, but also recalc time-to-go periodically; when
686
+ * done, clean up any remaining time with usleep() call
687
+ * (could also use SIGALRM, but signals are a pain...) */
688
+ while (seconds_to_go-- > 1) {
689
+ int seconds_done = 0;
690
+
691
+ for (i = seconds_to_go; i > 0 && !quit; --i) {
692
+ sleep(1);
693
+ /* GRR BUG: need to check for Expose and redraw */
694
+ if (XCheckMaskEvent(display, KeyPressMask |
695
+ ButtonPressMask, &e) && QUIT(e,k))
696
+ quit = TRUE;
697
+ if (++seconds_done > 1000)
698
+ break; /* time to redo seconds_to_go meas. */
699
+ }
700
+ if (quit)
701
+ break;
702
+
703
+ /* OK, more than 1000 seconds since last check:
704
+ * correct the time-to-go measurement for drift */
705
+ if (gettimeofday(&now, NULL) == 0) {
706
+ if (now.tv_sec >= then.tv_sec)
707
+ break;
708
+ seconds_to_go = then.tv_sec - now.tv_sec;
709
+ } else
710
+ ++seconds_to_go; /* restore what we subtracted */
711
+ }
712
+ if (quit)
713
+ break; /* breaks outer do-loop, skips redisplay */
714
+
715
+ /* since difference between "now" and "then" is already
716
+ * eaten up to within a couple of seconds, don't need to
717
+ * worry about overflow--but might have overshot (neg.) */
718
+ if (gettimeofday(&now, NULL) == 0) {
719
+ usleep_usec = 1000000L*(then.tv_sec - now.tv_sec) +
720
+ then.tv_usec - now.tv_usec;
721
+ if (usleep_usec > 0)
722
+ usleep((ulg)usleep_usec);
723
+ }
724
+ }
725
+ }
726
+
727
+ /* composite image against new background and display (note that
728
+ * we do not take into account the time spent doing this...) */
729
+ rpng2_x_redisplay_image (0, 0, rpng2_info.width, rpng2_info.height);
730
+ }
731
+
732
+ } else /* FALL THROUGH and do the normal thing */
733
+
734
+ #endif /* FEATURE_LOOP */
735
+
736
+ /* wait for the user to tell us when to quit */
737
+
738
+ if (rpng2_info.state >= kWindowInit) {
739
+ Trace((stderr, "entering final wait-for-quit-event loop\n"))
740
+ do {
741
+ XNextEvent(display, &e);
742
+ if (e.type == Expose) {
743
+ XExposeEvent *ex = (XExposeEvent *)&e;
744
+ rpng2_x_redisplay_image (ex->x, ex->y, ex->width, ex->height);
745
+ }
746
+ } while (!QUIT(e,k));
747
+ } else {
748
+ fprintf(stderr, PROGNAME ": init callback never called: probable "
749
+ "libpng error while decoding PNG metadata\n");
750
+ exit(4);
751
+ }
752
+
753
+
754
+ /* we're done: clean up all image and X resources and go away */
755
+
756
+ Trace((stderr, "about to call rpng2_x_cleanup()\n"))
757
+ rpng2_x_cleanup();
758
+
759
+ return 0;
760
+ }
761
+
762
+
763
+
764
+
765
+
766
+ /* this function is called by readpng2_info_callback() in readpng2.c, which
767
+ * in turn is called by libpng after all of the pre-IDAT chunks have been
768
+ * read and processed--i.e., we now have enough info to finish initializing */
769
+
770
+ static void rpng2_x_init(void)
771
+ {
772
+ ulg i;
773
+ ulg rowbytes = rpng2_info.rowbytes;
774
+
775
+ Trace((stderr, "beginning rpng2_x_init()\n"))
776
+ Trace((stderr, " rowbytes = %d\n", rpng2_info.rowbytes))
777
+ Trace((stderr, " width = %ld\n", rpng2_info.width))
778
+ Trace((stderr, " height = %ld\n", rpng2_info.height))
779
+
780
+ rpng2_info.image_data = (uch *)malloc(rowbytes * rpng2_info.height);
781
+ if (!rpng2_info.image_data) {
782
+ readpng2_cleanup(&rpng2_info);
783
+ return;
784
+ }
785
+
786
+ rpng2_info.row_pointers = (uch **)malloc(rpng2_info.height * sizeof(uch *));
787
+ if (!rpng2_info.row_pointers) {
788
+ free(rpng2_info.image_data);
789
+ rpng2_info.image_data = NULL;
790
+ readpng2_cleanup(&rpng2_info);
791
+ return;
792
+ }
793
+
794
+ for (i = 0; i < rpng2_info.height; ++i)
795
+ rpng2_info.row_pointers[i] = rpng2_info.image_data + i*rowbytes;
796
+
797
+
798
+ /* do the basic X initialization stuff, make the window, and fill it with
799
+ * the user-specified, file-specified or default background color or
800
+ * pattern */
801
+
802
+ if (rpng2_x_create_window()) {
803
+
804
+ /* GRR TEMPORARY HACK: this is fundamentally no different from cases
805
+ * above; libpng should longjmp() back to us when png_ptr goes away.
806
+ * If we/it segfault instead, seems like a libpng bug... */
807
+
808
+ /* we're here via libpng callback, so if window fails, clean and bail */
809
+ readpng2_cleanup(&rpng2_info);
810
+ rpng2_x_cleanup();
811
+ exit(2);
812
+ }
813
+
814
+ rpng2_info.state = kWindowInit;
815
+ }
816
+
817
+
818
+
819
+
820
+
821
+ static int rpng2_x_create_window(void)
822
+ {
823
+ ulg bg_red = rpng2_info.bg_red;
824
+ ulg bg_green = rpng2_info.bg_green;
825
+ ulg bg_blue = rpng2_info.bg_blue;
826
+ ulg bg_pixel = 0L;
827
+ ulg attrmask;
828
+ int need_colormap = FALSE;
829
+ int screen, pad;
830
+ uch *xdata;
831
+ Window root;
832
+ XEvent e;
833
+ XGCValues gcvalues;
834
+ XSetWindowAttributes attr;
835
+ XTextProperty windowName, *pWindowName = &windowName;
836
+ XTextProperty iconName, *pIconName = &iconName;
837
+ XVisualInfo visual_info;
838
+ XSizeHints *size_hints;
839
+ XWMHints *wm_hints;
840
+ XClassHint *class_hints;
841
+
842
+
843
+ Trace((stderr, "beginning rpng2_x_create_window()\n"))
844
+
845
+ screen = DefaultScreen(display);
846
+ depth = DisplayPlanes(display, screen);
847
+ root = RootWindow(display, screen);
848
+
849
+ #ifdef DEBUG
850
+ XSynchronize(display, True);
851
+ #endif
852
+
853
+ if (depth != 16 && depth != 24 && depth != 32) {
854
+ int visuals_matched = 0;
855
+
856
+ Trace((stderr, "default depth is %d: checking other visuals\n",
857
+ depth))
858
+
859
+ /* 24-bit first */
860
+ visual_info.screen = screen;
861
+ visual_info.depth = 24;
862
+ visual_list = XGetVisualInfo(display,
863
+ VisualScreenMask | VisualDepthMask, &visual_info, &visuals_matched);
864
+ if (visuals_matched == 0) {
865
+ /* GRR: add 15-, 16- and 32-bit TrueColor visuals (also DirectColor?) */
866
+ fprintf(stderr, "default screen depth %d not supported, and no"
867
+ " 24-bit visuals found\n", depth);
868
+ return 2;
869
+ }
870
+ Trace((stderr, "XGetVisualInfo() returned %d 24-bit visuals\n",
871
+ visuals_matched))
872
+ visual = visual_list[0].visual;
873
+ depth = visual_list[0].depth;
874
+ /*
875
+ colormap_size = visual_list[0].colormap_size;
876
+ visual_class = visual->class;
877
+ visualID = XVisualIDFromVisual(visual);
878
+ */
879
+ have_nondefault_visual = TRUE;
880
+ need_colormap = TRUE;
881
+ } else {
882
+ XMatchVisualInfo(display, screen, depth, TrueColor, &visual_info);
883
+ visual = visual_info.visual;
884
+ }
885
+
886
+ RMask = visual->red_mask;
887
+ GMask = visual->green_mask;
888
+ BMask = visual->blue_mask;
889
+
890
+ /* GRR: add/check 8-bit support */
891
+ if (depth == 8 || need_colormap) {
892
+ colormap = XCreateColormap(display, root, visual, AllocNone);
893
+ if (!colormap) {
894
+ fprintf(stderr, "XCreateColormap() failed\n");
895
+ return 2;
896
+ }
897
+ have_colormap = TRUE;
898
+ if (depth == 8)
899
+ bg_image = FALSE; /* gradient just wastes palette entries */
900
+ }
901
+ if (depth == 15 || depth == 16) {
902
+ RShift = 15 - rpng2_x_msb(RMask); /* these are right-shifts */
903
+ GShift = 15 - rpng2_x_msb(GMask);
904
+ BShift = 15 - rpng2_x_msb(BMask);
905
+ } else if (depth > 16) {
906
+ RShift = rpng2_x_msb(RMask) - 7; /* these are left-shifts */
907
+ GShift = rpng2_x_msb(GMask) - 7;
908
+ BShift = rpng2_x_msb(BMask) - 7;
909
+ }
910
+ if (depth >= 15 && (RShift < 0 || GShift < 0 || BShift < 0)) {
911
+ fprintf(stderr, "rpng2 internal logic error: negative X shift(s)!\n");
912
+ return 2;
913
+ }
914
+
915
+ /*---------------------------------------------------------------------------
916
+ Finally, create the window.
917
+ ---------------------------------------------------------------------------*/
918
+
919
+ attr.backing_store = Always;
920
+ attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask;
921
+ attrmask = CWBackingStore | CWEventMask;
922
+ if (have_nondefault_visual) {
923
+ attr.colormap = colormap;
924
+ attr.background_pixel = 0;
925
+ attr.border_pixel = 1;
926
+ attrmask |= CWColormap | CWBackPixel | CWBorderPixel;
927
+ }
928
+
929
+ window = XCreateWindow(display, root, 0, 0, rpng2_info.width,
930
+ rpng2_info.height, 0, depth, InputOutput, visual, attrmask, &attr);
931
+
932
+ if (window == None) {
933
+ fprintf(stderr, "XCreateWindow() failed\n");
934
+ return 2;
935
+ } else
936
+ have_window = TRUE;
937
+
938
+ if (depth == 8)
939
+ XSetWindowColormap(display, window, colormap);
940
+
941
+ if (!XStringListToTextProperty(&window_name, 1, pWindowName))
942
+ pWindowName = NULL;
943
+ if (!XStringListToTextProperty(&icon_name, 1, pIconName))
944
+ pIconName = NULL;
945
+
946
+ /* OK if either hints allocation fails; XSetWMProperties() allows NULLs */
947
+
948
+ if ((size_hints = XAllocSizeHints()) != NULL) {
949
+ /* window will not be resizable */
950
+ size_hints->flags = PMinSize | PMaxSize;
951
+ size_hints->min_width = size_hints->max_width = (int)rpng2_info.width;
952
+ size_hints->min_height = size_hints->max_height =
953
+ (int)rpng2_info.height;
954
+ }
955
+
956
+ if ((wm_hints = XAllocWMHints()) != NULL) {
957
+ wm_hints->initial_state = NormalState;
958
+ wm_hints->input = True;
959
+ /* wm_hints->icon_pixmap = icon_pixmap; */
960
+ wm_hints->flags = StateHint | InputHint /* | IconPixmapHint */ ;
961
+ }
962
+
963
+ if ((class_hints = XAllocClassHint()) != NULL) {
964
+ class_hints->res_name = res_name;
965
+ class_hints->res_class = res_class;
966
+ }
967
+
968
+ XSetWMProperties(display, window, pWindowName, pIconName, NULL, 0,
969
+ size_hints, wm_hints, class_hints);
970
+
971
+ /* various properties and hints no longer needed; free memory */
972
+ if (pWindowName)
973
+ XFree(pWindowName->value);
974
+ if (pIconName)
975
+ XFree(pIconName->value);
976
+ if (size_hints)
977
+ XFree(size_hints);
978
+ if (wm_hints)
979
+ XFree(wm_hints);
980
+ if (class_hints)
981
+ XFree(class_hints);
982
+
983
+ XMapWindow(display, window);
984
+
985
+ gc = XCreateGC(display, window, 0, &gcvalues);
986
+ have_gc = TRUE;
987
+
988
+ /*---------------------------------------------------------------------------
989
+ Allocate memory for the X- and display-specific version of the image.
990
+ ---------------------------------------------------------------------------*/
991
+
992
+ if (depth == 24 || depth == 32) {
993
+ xdata = (uch *)malloc(4*rpng2_info.width*rpng2_info.height);
994
+ pad = 32;
995
+ } else if (depth == 16) {
996
+ xdata = (uch *)malloc(2*rpng2_info.width*rpng2_info.height);
997
+ pad = 16;
998
+ } else /* depth == 8 */ {
999
+ xdata = (uch *)malloc(rpng2_info.width*rpng2_info.height);
1000
+ pad = 8;
1001
+ }
1002
+
1003
+ if (!xdata) {
1004
+ fprintf(stderr, PROGNAME ": unable to allocate image memory\n");
1005
+ return 4;
1006
+ }
1007
+
1008
+ ximage = XCreateImage(display, visual, depth, ZPixmap, 0,
1009
+ (char *)xdata, rpng2_info.width, rpng2_info.height, pad, 0);
1010
+
1011
+ if (!ximage) {
1012
+ fprintf(stderr, PROGNAME ": XCreateImage() failed\n");
1013
+ free(xdata);
1014
+ return 3;
1015
+ }
1016
+
1017
+ /* to avoid testing the byte order every pixel (or doubling the size of
1018
+ * the drawing routine with a giant if-test), we arbitrarily set the byte
1019
+ * order to MSBFirst and let Xlib worry about inverting things on little-
1020
+ * endian machines (e.g., Linux/x86, old VAXen, etc.)--this is not the
1021
+ * most efficient approach (the giant if-test would be better), but in
1022
+ * the interest of clarity, we'll take the easy way out... */
1023
+
1024
+ ximage->byte_order = MSBFirst;
1025
+
1026
+ /*---------------------------------------------------------------------------
1027
+ Fill window with the specified background color (default is black) or
1028
+ faked "background image" (but latter is disabled if 8-bit; gradients
1029
+ just waste palette entries).
1030
+ ---------------------------------------------------------------------------*/
1031
+
1032
+ if (bg_image)
1033
+ rpng2_x_load_bg_image(); /* resets bg_image if fails */
1034
+
1035
+ if (!bg_image) {
1036
+ if (depth == 24 || depth == 32) {
1037
+ bg_pixel = (bg_red << RShift) |
1038
+ (bg_green << GShift) |
1039
+ (bg_blue << BShift);
1040
+ } else if (depth == 16) {
1041
+ bg_pixel = (((bg_red << 8) >> RShift) & RMask) |
1042
+ (((bg_green << 8) >> GShift) & GMask) |
1043
+ (((bg_blue << 8) >> BShift) & BMask);
1044
+ } else /* depth == 8 */ {
1045
+
1046
+ /* GRR: add 8-bit support */
1047
+
1048
+ }
1049
+ XSetForeground(display, gc, bg_pixel);
1050
+ XFillRectangle(display, window, gc, 0, 0, rpng2_info.width,
1051
+ rpng2_info.height);
1052
+ }
1053
+
1054
+ /*---------------------------------------------------------------------------
1055
+ Wait for first Expose event to do any drawing, then flush and return.
1056
+ ---------------------------------------------------------------------------*/
1057
+
1058
+ do
1059
+ XNextEvent(display, &e);
1060
+ while (e.type != Expose || e.xexpose.count);
1061
+
1062
+ XFlush(display);
1063
+
1064
+ return 0;
1065
+
1066
+ } /* end function rpng2_x_create_window() */
1067
+
1068
+
1069
+
1070
+
1071
+
1072
+ static int rpng2_x_load_bg_image(void)
1073
+ {
1074
+ uch *src;
1075
+ char *dest;
1076
+ uch r1, r2, g1, g2, b1, b2;
1077
+ uch r1_inv, r2_inv, g1_inv, g2_inv, b1_inv, b2_inv;
1078
+ int k, hmax, max;
1079
+ int xidx, yidx, yidx_max;
1080
+ int even_odd_vert, even_odd_horiz, even_odd;
1081
+ int invert_gradient2 = (bg[pat].type & 0x08);
1082
+ int invert_column;
1083
+ int ximage_rowbytes = ximage->bytes_per_line;
1084
+ ulg i, row;
1085
+ ulg pixel;
1086
+
1087
+ /*---------------------------------------------------------------------------
1088
+ Allocate buffer for fake background image to be used with transparent
1089
+ images; if this fails, revert to plain background color.
1090
+ ---------------------------------------------------------------------------*/
1091
+
1092
+ bg_rowbytes = 3 * rpng2_info.width;
1093
+ bg_data = (uch *)malloc(bg_rowbytes * rpng2_info.height);
1094
+ if (!bg_data) {
1095
+ fprintf(stderr, PROGNAME
1096
+ ": unable to allocate memory for background image\n");
1097
+ bg_image = 0;
1098
+ return 1;
1099
+ }
1100
+
1101
+ bgscale = (pat == 0)? 8 : bgscale_default;
1102
+ yidx_max = bgscale - 1;
1103
+
1104
+ /*---------------------------------------------------------------------------
1105
+ Vertical gradients (ramps) in NxN squares, alternating direction and
1106
+ colors (N == bgscale).
1107
+ ---------------------------------------------------------------------------*/
1108
+
1109
+ if ((bg[pat].type & 0x07) == 0) {
1110
+ uch r1_min = rgb[bg[pat].rgb1_min].r;
1111
+ uch g1_min = rgb[bg[pat].rgb1_min].g;
1112
+ uch b1_min = rgb[bg[pat].rgb1_min].b;
1113
+ uch r2_min = rgb[bg[pat].rgb2_min].r;
1114
+ uch g2_min = rgb[bg[pat].rgb2_min].g;
1115
+ uch b2_min = rgb[bg[pat].rgb2_min].b;
1116
+ int r1_diff = rgb[bg[pat].rgb1_max].r - r1_min;
1117
+ int g1_diff = rgb[bg[pat].rgb1_max].g - g1_min;
1118
+ int b1_diff = rgb[bg[pat].rgb1_max].b - b1_min;
1119
+ int r2_diff = rgb[bg[pat].rgb2_max].r - r2_min;
1120
+ int g2_diff = rgb[bg[pat].rgb2_max].g - g2_min;
1121
+ int b2_diff = rgb[bg[pat].rgb2_max].b - b2_min;
1122
+
1123
+ for (row = 0; row < rpng2_info.height; ++row) {
1124
+ yidx = (int)(row % bgscale);
1125
+ even_odd_vert = (int)((row / bgscale) & 1);
1126
+
1127
+ r1 = r1_min + (r1_diff * yidx) / yidx_max;
1128
+ g1 = g1_min + (g1_diff * yidx) / yidx_max;
1129
+ b1 = b1_min + (b1_diff * yidx) / yidx_max;
1130
+ r1_inv = r1_min + (r1_diff * (yidx_max-yidx)) / yidx_max;
1131
+ g1_inv = g1_min + (g1_diff * (yidx_max-yidx)) / yidx_max;
1132
+ b1_inv = b1_min + (b1_diff * (yidx_max-yidx)) / yidx_max;
1133
+
1134
+ r2 = r2_min + (r2_diff * yidx) / yidx_max;
1135
+ g2 = g2_min + (g2_diff * yidx) / yidx_max;
1136
+ b2 = b2_min + (b2_diff * yidx) / yidx_max;
1137
+ r2_inv = r2_min + (r2_diff * (yidx_max-yidx)) / yidx_max;
1138
+ g2_inv = g2_min + (g2_diff * (yidx_max-yidx)) / yidx_max;
1139
+ b2_inv = b2_min + (b2_diff * (yidx_max-yidx)) / yidx_max;
1140
+
1141
+ dest = (char *)bg_data + row*bg_rowbytes;
1142
+ for (i = 0; i < rpng2_info.width; ++i) {
1143
+ even_odd_horiz = (int)((i / bgscale) & 1);
1144
+ even_odd = even_odd_vert ^ even_odd_horiz;
1145
+ invert_column =
1146
+ (even_odd_horiz && (bg[pat].type & 0x10));
1147
+ if (even_odd == 0) { /* gradient #1 */
1148
+ if (invert_column) {
1149
+ *dest++ = r1_inv;
1150
+ *dest++ = g1_inv;
1151
+ *dest++ = b1_inv;
1152
+ } else {
1153
+ *dest++ = r1;
1154
+ *dest++ = g1;
1155
+ *dest++ = b1;
1156
+ }
1157
+ } else { /* gradient #2 */
1158
+ if ((invert_column && invert_gradient2) ||
1159
+ (!invert_column && !invert_gradient2))
1160
+ {
1161
+ *dest++ = r2; /* not inverted or */
1162
+ *dest++ = g2; /* doubly inverted */
1163
+ *dest++ = b2;
1164
+ } else {
1165
+ *dest++ = r2_inv;
1166
+ *dest++ = g2_inv; /* singly inverted */
1167
+ *dest++ = b2_inv;
1168
+ }
1169
+ }
1170
+ }
1171
+ }
1172
+
1173
+ /*---------------------------------------------------------------------------
1174
+ Soft gradient-diamonds with scale = bgscale. Code contributed by Adam
1175
+ M. Costello.
1176
+ ---------------------------------------------------------------------------*/
1177
+
1178
+ } else if ((bg[pat].type & 0x07) == 1) {
1179
+
1180
+ hmax = (bgscale-1)/2; /* half the max weight of a color */
1181
+ max = 2*hmax; /* the max weight of a color */
1182
+
1183
+ r1 = rgb[bg[pat].rgb1_max].r;
1184
+ g1 = rgb[bg[pat].rgb1_max].g;
1185
+ b1 = rgb[bg[pat].rgb1_max].b;
1186
+ r2 = rgb[bg[pat].rgb2_max].r;
1187
+ g2 = rgb[bg[pat].rgb2_max].g;
1188
+ b2 = rgb[bg[pat].rgb2_max].b;
1189
+
1190
+ for (row = 0; row < rpng2_info.height; ++row) {
1191
+ yidx = (int)(row % bgscale);
1192
+ if (yidx > hmax)
1193
+ yidx = bgscale-1 - yidx;
1194
+ dest = (char *)bg_data + row*bg_rowbytes;
1195
+ for (i = 0; i < rpng2_info.width; ++i) {
1196
+ xidx = (int)(i % bgscale);
1197
+ if (xidx > hmax)
1198
+ xidx = bgscale-1 - xidx;
1199
+ k = xidx + yidx;
1200
+ *dest++ = (k*r1 + (max-k)*r2) / max;
1201
+ *dest++ = (k*g1 + (max-k)*g2) / max;
1202
+ *dest++ = (k*b1 + (max-k)*b2) / max;
1203
+ }
1204
+ }
1205
+
1206
+ /*---------------------------------------------------------------------------
1207
+ Radial "starburst" with azimuthal sinusoids; [eventually number of sinu-
1208
+ soids will equal bgscale?]. This one is slow but very cool. Code con-
1209
+ tributed by Pieter S. van der Meulen (originally in Smalltalk).
1210
+ ---------------------------------------------------------------------------*/
1211
+
1212
+ } else if ((bg[pat].type & 0x07) == 2) {
1213
+ uch ch;
1214
+ int ii, x, y, hw, hh, grayspot;
1215
+ double freq, rotate, saturate, gray, intensity;
1216
+ double angle=0.0, aoffset=0.0, maxDist, dist;
1217
+ double red=0.0, green=0.0, blue=0.0, hue, s, v, f, p, q, t;
1218
+
1219
+ fprintf(stderr, "%s: computing radial background...",
1220
+ PROGNAME);
1221
+ fflush(stderr);
1222
+
1223
+ hh = (int)(rpng2_info.height / 2);
1224
+ hw = (int)(rpng2_info.width / 2);
1225
+
1226
+ /* variables for radial waves:
1227
+ * aoffset: number of degrees to rotate hue [CURRENTLY NOT USED]
1228
+ * freq: number of color beams originating from the center
1229
+ * grayspot: size of the graying center area (anti-alias)
1230
+ * rotate: rotation of the beams as a function of radius
1231
+ * saturate: saturation of beams' shape azimuthally
1232
+ */
1233
+ angle = CLIP(angle, 0.0, 360.0);
1234
+ grayspot = CLIP(bg[pat].bg_gray, 1, (hh + hw));
1235
+ freq = MAX((double)bg[pat].bg_freq, 0.0);
1236
+ saturate = (double)bg[pat].bg_bsat * 0.1;
1237
+ rotate = (double)bg[pat].bg_brot * 0.1;
1238
+ gray = 0.0;
1239
+ intensity = 0.0;
1240
+ maxDist = (double)((hw*hw) + (hh*hh));
1241
+
1242
+ for (row = 0; row < rpng2_info.height; ++row) {
1243
+ y = (int)(row - hh);
1244
+ dest = (char *)bg_data + row*bg_rowbytes;
1245
+ for (i = 0; i < rpng2_info.width; ++i) {
1246
+ x = (int)(i - hw);
1247
+ angle = (x == 0)? PI_2 : atan((double)y / (double)x);
1248
+ gray = (double)MAX(ABS(y), ABS(x)) / grayspot;
1249
+ gray = MIN(1.0, gray);
1250
+ dist = (double)((x*x) + (y*y)) / maxDist;
1251
+ intensity = cos((angle+(rotate*dist*PI)) * freq) *
1252
+ gray * saturate;
1253
+ intensity = (MAX(MIN(intensity,1.0),-1.0) + 1.0) * 0.5;
1254
+ hue = (angle + PI) * INV_PI_360 + aoffset;
1255
+ s = gray * ((double)(ABS(x)+ABS(y)) / (double)(hw + hh));
1256
+ s = MIN(MAX(s,0.0), 1.0);
1257
+ v = MIN(MAX(intensity,0.0), 1.0);
1258
+
1259
+ if (s == 0.0) {
1260
+ ch = (uch)(v * 255.0);
1261
+ *dest++ = ch;
1262
+ *dest++ = ch;
1263
+ *dest++ = ch;
1264
+ } else {
1265
+ if ((hue < 0.0) || (hue >= 360.0))
1266
+ hue -= (((int)(hue / 360.0)) * 360.0);
1267
+ hue /= 60.0;
1268
+ ii = (int)hue;
1269
+ f = hue - (double)ii;
1270
+ p = (1.0 - s) * v;
1271
+ q = (1.0 - (s * f)) * v;
1272
+ t = (1.0 - (s * (1.0 - f))) * v;
1273
+ if (ii == 0) { red = v; green = t; blue = p; }
1274
+ else if (ii == 1) { red = q; green = v; blue = p; }
1275
+ else if (ii == 2) { red = p; green = v; blue = t; }
1276
+ else if (ii == 3) { red = p; green = q; blue = v; }
1277
+ else if (ii == 4) { red = t; green = p; blue = v; }
1278
+ else if (ii == 5) { red = v; green = p; blue = q; }
1279
+ *dest++ = (uch)(red * 255.0);
1280
+ *dest++ = (uch)(green * 255.0);
1281
+ *dest++ = (uch)(blue * 255.0);
1282
+ }
1283
+ }
1284
+ }
1285
+ fprintf(stderr, "done.\n");
1286
+ fflush(stderr);
1287
+ }
1288
+
1289
+ /*---------------------------------------------------------------------------
1290
+ Blast background image to display buffer before beginning PNG decode.
1291
+ ---------------------------------------------------------------------------*/
1292
+
1293
+ if (depth == 24 || depth == 32) {
1294
+ ulg red, green, blue;
1295
+ int bpp = ximage->bits_per_pixel;
1296
+
1297
+ for (row = 0; row < rpng2_info.height; ++row) {
1298
+ src = bg_data + row*bg_rowbytes;
1299
+ dest = ximage->data + row*ximage_rowbytes;
1300
+ if (bpp == 32) { /* slightly optimized version */
1301
+ for (i = rpng2_info.width; i > 0; --i) {
1302
+ red = *src++;
1303
+ green = *src++;
1304
+ blue = *src++;
1305
+ pixel = (red << RShift) |
1306
+ (green << GShift) |
1307
+ (blue << BShift);
1308
+ /* recall that we set ximage->byte_order = MSBFirst above */
1309
+ *dest++ = (char)((pixel >> 24) & 0xff);
1310
+ *dest++ = (char)((pixel >> 16) & 0xff);
1311
+ *dest++ = (char)((pixel >> 8) & 0xff);
1312
+ *dest++ = (char)( pixel & 0xff);
1313
+ }
1314
+ } else {
1315
+ for (i = rpng2_info.width; i > 0; --i) {
1316
+ red = *src++;
1317
+ green = *src++;
1318
+ blue = *src++;
1319
+ pixel = (red << RShift) |
1320
+ (green << GShift) |
1321
+ (blue << BShift);
1322
+ /* recall that we set ximage->byte_order = MSBFirst above */
1323
+ /* GRR BUG? this assumes bpp == 24 & bits are packed low */
1324
+ /* (probably need to use RShift, RMask, etc.) */
1325
+ *dest++ = (char)((pixel >> 16) & 0xff);
1326
+ *dest++ = (char)((pixel >> 8) & 0xff);
1327
+ *dest++ = (char)( pixel & 0xff);
1328
+ }
1329
+ }
1330
+ }
1331
+
1332
+ } else if (depth == 16) {
1333
+ ush red, green, blue;
1334
+
1335
+ for (row = 0; row < rpng2_info.height; ++row) {
1336
+ src = bg_data + row*bg_rowbytes;
1337
+ dest = ximage->data + row*ximage_rowbytes;
1338
+ for (i = rpng2_info.width; i > 0; --i) {
1339
+ red = ((ush)(*src) << 8); ++src;
1340
+ green = ((ush)(*src) << 8); ++src;
1341
+ blue = ((ush)(*src) << 8); ++src;
1342
+ pixel = ((red >> RShift) & RMask) |
1343
+ ((green >> GShift) & GMask) |
1344
+ ((blue >> BShift) & BMask);
1345
+ /* recall that we set ximage->byte_order = MSBFirst above */
1346
+ *dest++ = (char)((pixel >> 8) & 0xff);
1347
+ *dest++ = (char)( pixel & 0xff);
1348
+ }
1349
+ }
1350
+
1351
+ } else /* depth == 8 */ {
1352
+
1353
+ /* GRR: add 8-bit support */
1354
+
1355
+ }
1356
+
1357
+ XPutImage(display, window, gc, ximage, 0, 0, 0, 0, rpng2_info.width,
1358
+ rpng2_info.height);
1359
+
1360
+ return 0;
1361
+
1362
+ } /* end function rpng2_x_load_bg_image() */
1363
+
1364
+
1365
+
1366
+
1367
+
1368
+ static void rpng2_x_display_row(ulg row)
1369
+ {
1370
+ uch bg_red = rpng2_info.bg_red;
1371
+ uch bg_green = rpng2_info.bg_green;
1372
+ uch bg_blue = rpng2_info.bg_blue;
1373
+ uch *src, *src2=NULL;
1374
+ char *dest;
1375
+ uch r, g, b, a;
1376
+ int ximage_rowbytes = ximage->bytes_per_line;
1377
+ ulg i, pixel;
1378
+ static int rows=0, prevpass=(-1);
1379
+ static ulg firstrow;
1380
+
1381
+ /*---------------------------------------------------------------------------
1382
+ rows and firstrow simply track how many rows (and which ones) have not
1383
+ yet been displayed; alternatively, we could call XPutImage() for every
1384
+ row and not bother with the records-keeping.
1385
+ ---------------------------------------------------------------------------*/
1386
+
1387
+ Trace((stderr, "beginning rpng2_x_display_row()\n"))
1388
+
1389
+ if (rpng2_info.pass != prevpass) {
1390
+ if (pause_after_pass && rpng2_info.pass > 0) {
1391
+ XEvent e;
1392
+ KeySym k;
1393
+
1394
+ fprintf(stderr,
1395
+ "%s: end of pass %d of 7; click in image window to continue\n",
1396
+ PROGNAME, prevpass + 1);
1397
+ do
1398
+ XNextEvent(display, &e);
1399
+ while (!QUIT(e,k));
1400
+ }
1401
+ fprintf(stderr, "%s: pass %d of 7\r", PROGNAME, rpng2_info.pass + 1);
1402
+ fflush(stderr);
1403
+ prevpass = rpng2_info.pass;
1404
+ }
1405
+
1406
+ if (rows == 0)
1407
+ firstrow = row; /* first row that is not yet displayed */
1408
+
1409
+ ++rows; /* count of rows received but not yet displayed */
1410
+
1411
+ /*---------------------------------------------------------------------------
1412
+ Aside from the use of the rpng2_info struct, the lack of an outer loop
1413
+ (over rows) and moving the XPutImage() call outside the "if (depth)"
1414
+ tests, this routine is identical to rpng_x_display_image() in the non-
1415
+ progressive version of the program.
1416
+ ---------------------------------------------------------------------------*/
1417
+
1418
+ if (depth == 24 || depth == 32) {
1419
+ ulg red, green, blue;
1420
+ int bpp = ximage->bits_per_pixel;
1421
+
1422
+ src = rpng2_info.image_data + row*rpng2_info.rowbytes;
1423
+ if (bg_image)
1424
+ src2 = bg_data + row*bg_rowbytes;
1425
+ dest = ximage->data + row*ximage_rowbytes;
1426
+ if (rpng2_info.channels == 3) {
1427
+ for (i = rpng2_info.width; i > 0; --i) {
1428
+ red = *src++;
1429
+ green = *src++;
1430
+ blue = *src++;
1431
+ pixel = (red << RShift) |
1432
+ (green << GShift) |
1433
+ (blue << BShift);
1434
+ /* recall that we set ximage->byte_order = MSBFirst above */
1435
+ if (bpp == 32) {
1436
+ *dest++ = (char)((pixel >> 24) & 0xff);
1437
+ *dest++ = (char)((pixel >> 16) & 0xff);
1438
+ *dest++ = (char)((pixel >> 8) & 0xff);
1439
+ *dest++ = (char)( pixel & 0xff);
1440
+ } else {
1441
+ /* GRR BUG? this assumes bpp == 24 & bits are packed low */
1442
+ /* (probably need to use RShift, RMask, etc.) */
1443
+ *dest++ = (char)((pixel >> 16) & 0xff);
1444
+ *dest++ = (char)((pixel >> 8) & 0xff);
1445
+ *dest++ = (char)( pixel & 0xff);
1446
+ }
1447
+ }
1448
+ } else /* if (rpng2_info.channels == 4) */ {
1449
+ for (i = rpng2_info.width; i > 0; --i) {
1450
+ r = *src++;
1451
+ g = *src++;
1452
+ b = *src++;
1453
+ a = *src++;
1454
+ if (bg_image) {
1455
+ bg_red = *src2++;
1456
+ bg_green = *src2++;
1457
+ bg_blue = *src2++;
1458
+ }
1459
+ if (a == 255) {
1460
+ red = r;
1461
+ green = g;
1462
+ blue = b;
1463
+ } else if (a == 0) {
1464
+ red = bg_red;
1465
+ green = bg_green;
1466
+ blue = bg_blue;
1467
+ } else {
1468
+ /* this macro (from png.h) composites the foreground
1469
+ * and background values and puts the result into the
1470
+ * first argument */
1471
+ alpha_composite(red, r, a, bg_red);
1472
+ alpha_composite(green, g, a, bg_green);
1473
+ alpha_composite(blue, b, a, bg_blue);
1474
+ }
1475
+ pixel = (red << RShift) |
1476
+ (green << GShift) |
1477
+ (blue << BShift);
1478
+ /* recall that we set ximage->byte_order = MSBFirst above */
1479
+ if (bpp == 32) {
1480
+ *dest++ = (char)((pixel >> 24) & 0xff);
1481
+ *dest++ = (char)((pixel >> 16) & 0xff);
1482
+ *dest++ = (char)((pixel >> 8) & 0xff);
1483
+ *dest++ = (char)( pixel & 0xff);
1484
+ } else {
1485
+ /* GRR BUG? this assumes bpp == 24 & bits are packed low */
1486
+ /* (probably need to use RShift, RMask, etc.) */
1487
+ *dest++ = (char)((pixel >> 16) & 0xff);
1488
+ *dest++ = (char)((pixel >> 8) & 0xff);
1489
+ *dest++ = (char)( pixel & 0xff);
1490
+ }
1491
+ }
1492
+ }
1493
+
1494
+ } else if (depth == 16) {
1495
+ ush red, green, blue;
1496
+
1497
+ src = rpng2_info.row_pointers[row];
1498
+ if (bg_image)
1499
+ src2 = bg_data + row*bg_rowbytes;
1500
+ dest = ximage->data + row*ximage_rowbytes;
1501
+ if (rpng2_info.channels == 3) {
1502
+ for (i = rpng2_info.width; i > 0; --i) {
1503
+ red = ((ush)(*src) << 8);
1504
+ ++src;
1505
+ green = ((ush)(*src) << 8);
1506
+ ++src;
1507
+ blue = ((ush)(*src) << 8);
1508
+ ++src;
1509
+ pixel = ((red >> RShift) & RMask) |
1510
+ ((green >> GShift) & GMask) |
1511
+ ((blue >> BShift) & BMask);
1512
+ /* recall that we set ximage->byte_order = MSBFirst above */
1513
+ *dest++ = (char)((pixel >> 8) & 0xff);
1514
+ *dest++ = (char)( pixel & 0xff);
1515
+ }
1516
+ } else /* if (rpng2_info.channels == 4) */ {
1517
+ for (i = rpng2_info.width; i > 0; --i) {
1518
+ r = *src++;
1519
+ g = *src++;
1520
+ b = *src++;
1521
+ a = *src++;
1522
+ if (bg_image) {
1523
+ bg_red = *src2++;
1524
+ bg_green = *src2++;
1525
+ bg_blue = *src2++;
1526
+ }
1527
+ if (a == 255) {
1528
+ red = ((ush)r << 8);
1529
+ green = ((ush)g << 8);
1530
+ blue = ((ush)b << 8);
1531
+ } else if (a == 0) {
1532
+ red = ((ush)bg_red << 8);
1533
+ green = ((ush)bg_green << 8);
1534
+ blue = ((ush)bg_blue << 8);
1535
+ } else {
1536
+ /* this macro (from png.h) composites the foreground
1537
+ * and background values and puts the result back into
1538
+ * the first argument (== fg byte here: safe) */
1539
+ alpha_composite(r, r, a, bg_red);
1540
+ alpha_composite(g, g, a, bg_green);
1541
+ alpha_composite(b, b, a, bg_blue);
1542
+ red = ((ush)r << 8);
1543
+ green = ((ush)g << 8);
1544
+ blue = ((ush)b << 8);
1545
+ }
1546
+ pixel = ((red >> RShift) & RMask) |
1547
+ ((green >> GShift) & GMask) |
1548
+ ((blue >> BShift) & BMask);
1549
+ /* recall that we set ximage->byte_order = MSBFirst above */
1550
+ *dest++ = (char)((pixel >> 8) & 0xff);
1551
+ *dest++ = (char)( pixel & 0xff);
1552
+ }
1553
+ }
1554
+
1555
+ } else /* depth == 8 */ {
1556
+
1557
+ /* GRR: add 8-bit support */
1558
+
1559
+ }
1560
+
1561
+
1562
+ /*---------------------------------------------------------------------------
1563
+ Display after every 16 rows or when on one of last two rows. (Region
1564
+ may include previously displayed lines due to interlacing--i.e., not
1565
+ contiguous. Also, second-to-last row is final one in interlaced images
1566
+ with odd number of rows.) For demos, flush (and delay) after every 16th
1567
+ row so "sparse" passes don't go twice as fast.
1568
+ ---------------------------------------------------------------------------*/
1569
+
1570
+ if (demo_timing && (row - firstrow >= 16 || row >= rpng2_info.height-2)) {
1571
+ XPutImage(display, window, gc, ximage, 0, (int)firstrow, 0,
1572
+ (int)firstrow, rpng2_info.width, row - firstrow + 1);
1573
+ XFlush(display);
1574
+ rows = 0;
1575
+ usleep(usleep_duration);
1576
+ } else
1577
+ if (!demo_timing && ((rows & 0xf) == 0 || row >= rpng2_info.height-2)) {
1578
+ XPutImage(display, window, gc, ximage, 0, (int)firstrow, 0,
1579
+ (int)firstrow, rpng2_info.width, row - firstrow + 1);
1580
+ XFlush(display);
1581
+ rows = 0;
1582
+ }
1583
+
1584
+ }
1585
+
1586
+
1587
+
1588
+
1589
+
1590
+ static void rpng2_x_finish_display(void)
1591
+ {
1592
+ Trace((stderr, "beginning rpng2_x_finish_display()\n"))
1593
+
1594
+ /* last row has already been displayed by rpng2_x_display_row(), so we
1595
+ * have nothing to do here except set a flag and let the user know that
1596
+ * the image is done */
1597
+
1598
+ rpng2_info.state = kDone;
1599
+ printf(
1600
+ "Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n");
1601
+ fflush(stdout);
1602
+ }
1603
+
1604
+
1605
+
1606
+
1607
+
1608
+ static void rpng2_x_redisplay_image(ulg startcol, ulg startrow,
1609
+ ulg width, ulg height)
1610
+ {
1611
+ uch bg_red = rpng2_info.bg_red;
1612
+ uch bg_green = rpng2_info.bg_green;
1613
+ uch bg_blue = rpng2_info.bg_blue;
1614
+ uch *src, *src2=NULL;
1615
+ char *dest;
1616
+ uch r, g, b, a;
1617
+ ulg i, row, lastrow = 0;
1618
+ ulg pixel;
1619
+ int ximage_rowbytes = ximage->bytes_per_line;
1620
+
1621
+
1622
+ Trace((stderr, "beginning display loop (image_channels == %d)\n",
1623
+ rpng2_info.channels))
1624
+ Trace((stderr, " (width = %ld, rowbytes = %d, ximage_rowbytes = %d)\n",
1625
+ rpng2_info.width, rpng2_info.rowbytes, ximage_rowbytes))
1626
+ Trace((stderr, " (bpp = %d)\n", ximage->bits_per_pixel))
1627
+ Trace((stderr, " (byte_order = %s)\n", ximage->byte_order == MSBFirst?
1628
+ "MSBFirst" : (ximage->byte_order == LSBFirst? "LSBFirst" : "unknown")))
1629
+
1630
+ /*---------------------------------------------------------------------------
1631
+ Aside from the use of the rpng2_info struct and of src2 (for background
1632
+ image), this routine is identical to rpng_x_display_image() in the non-
1633
+ progressive version of the program--for the simple reason that redisplay
1634
+ of the image against a new background happens after the image is fully
1635
+ decoded and therefore is, by definition, non-progressive.
1636
+ ---------------------------------------------------------------------------*/
1637
+
1638
+ if (depth == 24 || depth == 32) {
1639
+ ulg red, green, blue;
1640
+ int bpp = ximage->bits_per_pixel;
1641
+
1642
+ for (lastrow = row = startrow; row < startrow+height; ++row) {
1643
+ src = rpng2_info.image_data + row*rpng2_info.rowbytes;
1644
+ if (bg_image)
1645
+ src2 = bg_data + row*bg_rowbytes;
1646
+ dest = ximage->data + row*ximage_rowbytes;
1647
+ if (rpng2_info.channels == 3) {
1648
+ for (i = rpng2_info.width; i > 0; --i) {
1649
+ red = *src++;
1650
+ green = *src++;
1651
+ blue = *src++;
1652
+ #ifdef NO_24BIT_MASKS
1653
+ pixel = (red << RShift) |
1654
+ (green << GShift) |
1655
+ (blue << BShift);
1656
+ /* recall that we set ximage->byte_order = MSBFirst above */
1657
+ if (bpp == 32) {
1658
+ *dest++ = (char)((pixel >> 24) & 0xff);
1659
+ *dest++ = (char)((pixel >> 16) & 0xff);
1660
+ *dest++ = (char)((pixel >> 8) & 0xff);
1661
+ *dest++ = (char)( pixel & 0xff);
1662
+ } else {
1663
+ /* this assumes bpp == 24 & bits are packed low */
1664
+ /* (probably need to use RShift, RMask, etc.) */
1665
+ *dest++ = (char)((pixel >> 16) & 0xff);
1666
+ *dest++ = (char)((pixel >> 8) & 0xff);
1667
+ *dest++ = (char)( pixel & 0xff);
1668
+ }
1669
+ #else
1670
+ red = (RShift < 0)? red << (-RShift) : red >> RShift;
1671
+ green = (GShift < 0)? green << (-GShift) : green >> GShift;
1672
+ blue = (BShift < 0)? blue << (-BShift) : blue >> BShift;
1673
+ pixel = (red & RMask) | (green & GMask) | (blue & BMask);
1674
+ /* recall that we set ximage->byte_order = MSBFirst above */
1675
+ if (bpp == 32) {
1676
+ *dest++ = (char)((pixel >> 24) & 0xff);
1677
+ *dest++ = (char)((pixel >> 16) & 0xff);
1678
+ *dest++ = (char)((pixel >> 8) & 0xff);
1679
+ *dest++ = (char)( pixel & 0xff);
1680
+ } else {
1681
+ /* GRR BUG */
1682
+ /* this assumes bpp == 24 & bits are packed low */
1683
+ /* (probably need to use RShift/RMask/etc. here, too) */
1684
+ *dest++ = (char)((pixel >> 16) & 0xff);
1685
+ *dest++ = (char)((pixel >> 8) & 0xff);
1686
+ *dest++ = (char)( pixel & 0xff);
1687
+ }
1688
+ #endif
1689
+ }
1690
+
1691
+ } else /* if (rpng2_info.channels == 4) */ {
1692
+ for (i = rpng2_info.width; i > 0; --i) {
1693
+ r = *src++;
1694
+ g = *src++;
1695
+ b = *src++;
1696
+ a = *src++;
1697
+ if (bg_image) {
1698
+ bg_red = *src2++;
1699
+ bg_green = *src2++;
1700
+ bg_blue = *src2++;
1701
+ }
1702
+ if (a == 255) {
1703
+ red = r;
1704
+ green = g;
1705
+ blue = b;
1706
+ } else if (a == 0) {
1707
+ red = bg_red;
1708
+ green = bg_green;
1709
+ blue = bg_blue;
1710
+ } else {
1711
+ /* this macro (from png.h) composites the foreground
1712
+ * and background values and puts the result into the
1713
+ * first argument */
1714
+ alpha_composite(red, r, a, bg_red);
1715
+ alpha_composite(green, g, a, bg_green);
1716
+ alpha_composite(blue, b, a, bg_blue);
1717
+ }
1718
+ #ifdef NO_24BIT_MASKS
1719
+ pixel = (red << RShift) |
1720
+ (green << GShift) |
1721
+ (blue << BShift);
1722
+ /* recall that we set ximage->byte_order = MSBFirst above */
1723
+ if (bpp == 32) {
1724
+ *dest++ = (char)((pixel >> 24) & 0xff);
1725
+ *dest++ = (char)((pixel >> 16) & 0xff);
1726
+ *dest++ = (char)((pixel >> 8) & 0xff);
1727
+ *dest++ = (char)( pixel & 0xff);
1728
+ } else {
1729
+ /* this assumes bpp == 24 & bits are packed low */
1730
+ /* (probably need to use RShift, RMask, etc.) */
1731
+ *dest++ = (char)((pixel >> 16) & 0xff);
1732
+ *dest++ = (char)((pixel >> 8) & 0xff);
1733
+ *dest++ = (char)( pixel & 0xff);
1734
+ }
1735
+ #else
1736
+ red = (RShift < 0)? red << (-RShift) : red >> RShift;
1737
+ green = (GShift < 0)? green << (-GShift) : green >> GShift;
1738
+ blue = (BShift < 0)? blue << (-BShift) : blue >> BShift;
1739
+ pixel = (red & RMask) | (green & GMask) | (blue & BMask);
1740
+ /* recall that we set ximage->byte_order = MSBFirst above */
1741
+ if (bpp == 32) {
1742
+ *dest++ = (char)((pixel >> 24) & 0xff);
1743
+ *dest++ = (char)((pixel >> 16) & 0xff);
1744
+ *dest++ = (char)((pixel >> 8) & 0xff);
1745
+ *dest++ = (char)( pixel & 0xff);
1746
+ } else {
1747
+ /* GRR BUG */
1748
+ /* this assumes bpp == 24 & bits are packed low */
1749
+ /* (probably need to use RShift/RMask/etc. here, too) */
1750
+ *dest++ = (char)((pixel >> 16) & 0xff);
1751
+ *dest++ = (char)((pixel >> 8) & 0xff);
1752
+ *dest++ = (char)( pixel & 0xff);
1753
+ }
1754
+ #endif
1755
+ }
1756
+ }
1757
+ /* display after every 16 lines */
1758
+ if (((row+1) & 0xf) == 0) {
1759
+ XPutImage(display, window, gc, ximage, 0, (int)lastrow, 0,
1760
+ (int)lastrow, rpng2_info.width, 16);
1761
+ XFlush(display);
1762
+ lastrow = row + 1;
1763
+ }
1764
+ }
1765
+
1766
+ } else if (depth == 16) {
1767
+ ush red, green, blue;
1768
+
1769
+ for (lastrow = row = startrow; row < startrow+height; ++row) {
1770
+ src = rpng2_info.row_pointers[row];
1771
+ if (bg_image)
1772
+ src2 = bg_data + row*bg_rowbytes;
1773
+ dest = ximage->data + row*ximage_rowbytes;
1774
+ if (rpng2_info.channels == 3) {
1775
+ for (i = rpng2_info.width; i > 0; --i) {
1776
+ red = ((ush)(*src) << 8);
1777
+ ++src;
1778
+ green = ((ush)(*src) << 8);
1779
+ ++src;
1780
+ blue = ((ush)(*src) << 8);
1781
+ ++src;
1782
+ pixel = ((red >> RShift) & RMask) |
1783
+ ((green >> GShift) & GMask) |
1784
+ ((blue >> BShift) & BMask);
1785
+ /* recall that we set ximage->byte_order = MSBFirst above */
1786
+ *dest++ = (char)((pixel >> 8) & 0xff);
1787
+ *dest++ = (char)( pixel & 0xff);
1788
+ }
1789
+ } else /* if (rpng2_info.channels == 4) */ {
1790
+ for (i = rpng2_info.width; i > 0; --i) {
1791
+ r = *src++;
1792
+ g = *src++;
1793
+ b = *src++;
1794
+ a = *src++;
1795
+ if (bg_image) {
1796
+ bg_red = *src2++;
1797
+ bg_green = *src2++;
1798
+ bg_blue = *src2++;
1799
+ }
1800
+ if (a == 255) {
1801
+ red = ((ush)r << 8);
1802
+ green = ((ush)g << 8);
1803
+ blue = ((ush)b << 8);
1804
+ } else if (a == 0) {
1805
+ red = ((ush)bg_red << 8);
1806
+ green = ((ush)bg_green << 8);
1807
+ blue = ((ush)bg_blue << 8);
1808
+ } else {
1809
+ /* this macro (from png.h) composites the foreground
1810
+ * and background values and puts the result back into
1811
+ * the first argument (== fg byte here: safe) */
1812
+ alpha_composite(r, r, a, bg_red);
1813
+ alpha_composite(g, g, a, bg_green);
1814
+ alpha_composite(b, b, a, bg_blue);
1815
+ red = ((ush)r << 8);
1816
+ green = ((ush)g << 8);
1817
+ blue = ((ush)b << 8);
1818
+ }
1819
+ pixel = ((red >> RShift) & RMask) |
1820
+ ((green >> GShift) & GMask) |
1821
+ ((blue >> BShift) & BMask);
1822
+ /* recall that we set ximage->byte_order = MSBFirst above */
1823
+ *dest++ = (char)((pixel >> 8) & 0xff);
1824
+ *dest++ = (char)( pixel & 0xff);
1825
+ }
1826
+ }
1827
+ /* display after every 16 lines */
1828
+ if (((row+1) & 0xf) == 0) {
1829
+ XPutImage(display, window, gc, ximage, 0, (int)lastrow, 0,
1830
+ (int)lastrow, rpng2_info.width, 16);
1831
+ XFlush(display);
1832
+ lastrow = row + 1;
1833
+ }
1834
+ }
1835
+
1836
+ } else /* depth == 8 */ {
1837
+
1838
+ /* GRR: add 8-bit support */
1839
+
1840
+ }
1841
+
1842
+ Trace((stderr, "calling final XPutImage()\n"))
1843
+ if (lastrow < startrow+height) {
1844
+ XPutImage(display, window, gc, ximage, 0, (int)lastrow, 0,
1845
+ (int)lastrow, rpng2_info.width, rpng2_info.height-lastrow);
1846
+ XFlush(display);
1847
+ }
1848
+
1849
+ } /* end function rpng2_x_redisplay_image() */
1850
+
1851
+
1852
+
1853
+
1854
+
1855
+ #ifdef FEATURE_LOOP
1856
+
1857
+ static void rpng2_x_reload_bg_image(void)
1858
+ {
1859
+ char *dest;
1860
+ uch r1, r2, g1, g2, b1, b2;
1861
+ uch r1_inv, r2_inv, g1_inv, g2_inv, b1_inv, b2_inv;
1862
+ int k, hmax, max;
1863
+ int xidx, yidx, yidx_max;
1864
+ int even_odd_vert, even_odd_horiz, even_odd;
1865
+ int invert_gradient2 = (bg[pat].type & 0x08);
1866
+ int invert_column;
1867
+ ulg i, row;
1868
+
1869
+
1870
+ bgscale = (pat == 0)? 8 : bgscale_default;
1871
+ yidx_max = bgscale - 1;
1872
+
1873
+ /*---------------------------------------------------------------------------
1874
+ Vertical gradients (ramps) in NxN squares, alternating direction and
1875
+ colors (N == bgscale).
1876
+ ---------------------------------------------------------------------------*/
1877
+
1878
+ if ((bg[pat].type & 0x07) == 0) {
1879
+ uch r1_min = rgb[bg[pat].rgb1_min].r;
1880
+ uch g1_min = rgb[bg[pat].rgb1_min].g;
1881
+ uch b1_min = rgb[bg[pat].rgb1_min].b;
1882
+ uch r2_min = rgb[bg[pat].rgb2_min].r;
1883
+ uch g2_min = rgb[bg[pat].rgb2_min].g;
1884
+ uch b2_min = rgb[bg[pat].rgb2_min].b;
1885
+ int r1_diff = rgb[bg[pat].rgb1_max].r - r1_min;
1886
+ int g1_diff = rgb[bg[pat].rgb1_max].g - g1_min;
1887
+ int b1_diff = rgb[bg[pat].rgb1_max].b - b1_min;
1888
+ int r2_diff = rgb[bg[pat].rgb2_max].r - r2_min;
1889
+ int g2_diff = rgb[bg[pat].rgb2_max].g - g2_min;
1890
+ int b2_diff = rgb[bg[pat].rgb2_max].b - b2_min;
1891
+
1892
+ for (row = 0; row < rpng2_info.height; ++row) {
1893
+ yidx = (int)(row % bgscale);
1894
+ even_odd_vert = (int)((row / bgscale) & 1);
1895
+
1896
+ r1 = r1_min + (r1_diff * yidx) / yidx_max;
1897
+ g1 = g1_min + (g1_diff * yidx) / yidx_max;
1898
+ b1 = b1_min + (b1_diff * yidx) / yidx_max;
1899
+ r1_inv = r1_min + (r1_diff * (yidx_max-yidx)) / yidx_max;
1900
+ g1_inv = g1_min + (g1_diff * (yidx_max-yidx)) / yidx_max;
1901
+ b1_inv = b1_min + (b1_diff * (yidx_max-yidx)) / yidx_max;
1902
+
1903
+ r2 = r2_min + (r2_diff * yidx) / yidx_max;
1904
+ g2 = g2_min + (g2_diff * yidx) / yidx_max;
1905
+ b2 = b2_min + (b2_diff * yidx) / yidx_max;
1906
+ r2_inv = r2_min + (r2_diff * (yidx_max-yidx)) / yidx_max;
1907
+ g2_inv = g2_min + (g2_diff * (yidx_max-yidx)) / yidx_max;
1908
+ b2_inv = b2_min + (b2_diff * (yidx_max-yidx)) / yidx_max;
1909
+
1910
+ dest = (char *)bg_data + row*bg_rowbytes;
1911
+ for (i = 0; i < rpng2_info.width; ++i) {
1912
+ even_odd_horiz = (int)((i / bgscale) & 1);
1913
+ even_odd = even_odd_vert ^ even_odd_horiz;
1914
+ invert_column =
1915
+ (even_odd_horiz && (bg[pat].type & 0x10));
1916
+ if (even_odd == 0) { /* gradient #1 */
1917
+ if (invert_column) {
1918
+ *dest++ = r1_inv;
1919
+ *dest++ = g1_inv;
1920
+ *dest++ = b1_inv;
1921
+ } else {
1922
+ *dest++ = r1;
1923
+ *dest++ = g1;
1924
+ *dest++ = b1;
1925
+ }
1926
+ } else { /* gradient #2 */
1927
+ if ((invert_column && invert_gradient2) ||
1928
+ (!invert_column && !invert_gradient2))
1929
+ {
1930
+ *dest++ = r2; /* not inverted or */
1931
+ *dest++ = g2; /* doubly inverted */
1932
+ *dest++ = b2;
1933
+ } else {
1934
+ *dest++ = r2_inv;
1935
+ *dest++ = g2_inv; /* singly inverted */
1936
+ *dest++ = b2_inv;
1937
+ }
1938
+ }
1939
+ }
1940
+ }
1941
+
1942
+ /*---------------------------------------------------------------------------
1943
+ Soft gradient-diamonds with scale = bgscale. Code contributed by Adam
1944
+ M. Costello.
1945
+ ---------------------------------------------------------------------------*/
1946
+
1947
+ } else if ((bg[pat].type & 0x07) == 1) {
1948
+
1949
+ hmax = (bgscale-1)/2; /* half the max weight of a color */
1950
+ max = 2*hmax; /* the max weight of a color */
1951
+
1952
+ r1 = rgb[bg[pat].rgb1_max].r;
1953
+ g1 = rgb[bg[pat].rgb1_max].g;
1954
+ b1 = rgb[bg[pat].rgb1_max].b;
1955
+ r2 = rgb[bg[pat].rgb2_max].r;
1956
+ g2 = rgb[bg[pat].rgb2_max].g;
1957
+ b2 = rgb[bg[pat].rgb2_max].b;
1958
+
1959
+ for (row = 0; row < rpng2_info.height; ++row) {
1960
+ yidx = (int)(row % bgscale);
1961
+ if (yidx > hmax)
1962
+ yidx = bgscale-1 - yidx;
1963
+ dest = (char *)bg_data + row*bg_rowbytes;
1964
+ for (i = 0; i < rpng2_info.width; ++i) {
1965
+ xidx = (int)(i % bgscale);
1966
+ if (xidx > hmax)
1967
+ xidx = bgscale-1 - xidx;
1968
+ k = xidx + yidx;
1969
+ *dest++ = (k*r1 + (max-k)*r2) / max;
1970
+ *dest++ = (k*g1 + (max-k)*g2) / max;
1971
+ *dest++ = (k*b1 + (max-k)*b2) / max;
1972
+ }
1973
+ }
1974
+
1975
+ /*---------------------------------------------------------------------------
1976
+ Radial "starburst" with azimuthal sinusoids; [eventually number of sinu-
1977
+ soids will equal bgscale?]. This one is slow but very cool. Code con-
1978
+ tributed by Pieter S. van der Meulen (originally in Smalltalk).
1979
+ ---------------------------------------------------------------------------*/
1980
+
1981
+ } else if ((bg[pat].type & 0x07) == 2) {
1982
+ uch ch;
1983
+ int ii, x, y, hw, hh, grayspot;
1984
+ double freq, rotate, saturate, gray, intensity;
1985
+ double angle=0.0, aoffset=0.0, maxDist, dist;
1986
+ double red=0.0, green=0.0, blue=0.0, hue, s, v, f, p, q, t;
1987
+
1988
+ hh = (int)(rpng2_info.height / 2);
1989
+ hw = (int)(rpng2_info.width / 2);
1990
+
1991
+ /* variables for radial waves:
1992
+ * aoffset: number of degrees to rotate hue [CURRENTLY NOT USED]
1993
+ * freq: number of color beams originating from the center
1994
+ * grayspot: size of the graying center area (anti-alias)
1995
+ * rotate: rotation of the beams as a function of radius
1996
+ * saturate: saturation of beams' shape azimuthally
1997
+ */
1998
+ angle = CLIP(angle, 0.0, 360.0);
1999
+ grayspot = CLIP(bg[pat].bg_gray, 1, (hh + hw));
2000
+ freq = MAX((double)bg[pat].bg_freq, 0.0);
2001
+ saturate = (double)bg[pat].bg_bsat * 0.1;
2002
+ rotate = (double)bg[pat].bg_brot * 0.1;
2003
+ gray = 0.0;
2004
+ intensity = 0.0;
2005
+ maxDist = (double)((hw*hw) + (hh*hh));
2006
+
2007
+ for (row = 0; row < rpng2_info.height; ++row) {
2008
+ y = (int)(row - hh);
2009
+ dest = (char *)bg_data + row*bg_rowbytes;
2010
+ for (i = 0; i < rpng2_info.width; ++i) {
2011
+ x = (int)(i - hw);
2012
+ angle = (x == 0)? PI_2 : atan((double)y / (double)x);
2013
+ gray = (double)MAX(ABS(y), ABS(x)) / grayspot;
2014
+ gray = MIN(1.0, gray);
2015
+ dist = (double)((x*x) + (y*y)) / maxDist;
2016
+ intensity = cos((angle+(rotate*dist*PI)) * freq) *
2017
+ gray * saturate;
2018
+ intensity = (MAX(MIN(intensity,1.0),-1.0) + 1.0) * 0.5;
2019
+ hue = (angle + PI) * INV_PI_360 + aoffset;
2020
+ s = gray * ((double)(ABS(x)+ABS(y)) / (double)(hw + hh));
2021
+ s = MIN(MAX(s,0.0), 1.0);
2022
+ v = MIN(MAX(intensity,0.0), 1.0);
2023
+
2024
+ if (s == 0.0) {
2025
+ ch = (uch)(v * 255.0);
2026
+ *dest++ = ch;
2027
+ *dest++ = ch;
2028
+ *dest++ = ch;
2029
+ } else {
2030
+ if ((hue < 0.0) || (hue >= 360.0))
2031
+ hue -= (((int)(hue / 360.0)) * 360.0);
2032
+ hue /= 60.0;
2033
+ ii = (int)hue;
2034
+ f = hue - (double)ii;
2035
+ p = (1.0 - s) * v;
2036
+ q = (1.0 - (s * f)) * v;
2037
+ t = (1.0 - (s * (1.0 - f))) * v;
2038
+ if (ii == 0) { red = v; green = t; blue = p; }
2039
+ else if (ii == 1) { red = q; green = v; blue = p; }
2040
+ else if (ii == 2) { red = p; green = v; blue = t; }
2041
+ else if (ii == 3) { red = p; green = q; blue = v; }
2042
+ else if (ii == 4) { red = t; green = p; blue = v; }
2043
+ else if (ii == 5) { red = v; green = p; blue = q; }
2044
+ *dest++ = (uch)(red * 255.0);
2045
+ *dest++ = (uch)(green * 255.0);
2046
+ *dest++ = (uch)(blue * 255.0);
2047
+ }
2048
+ }
2049
+ }
2050
+ }
2051
+
2052
+ } /* end function rpng2_x_reload_bg_image() */
2053
+
2054
+
2055
+
2056
+
2057
+
2058
+ static int is_number(char *p)
2059
+ {
2060
+ while (*p) {
2061
+ if (!isdigit(*p))
2062
+ return FALSE;
2063
+ ++p;
2064
+ }
2065
+ return TRUE;
2066
+ }
2067
+
2068
+ #endif /* FEATURE_LOOP */
2069
+
2070
+
2071
+
2072
+
2073
+
2074
+ static void rpng2_x_cleanup(void)
2075
+ {
2076
+ if (bg_image && bg_data) {
2077
+ free(bg_data);
2078
+ bg_data = NULL;
2079
+ }
2080
+
2081
+ if (rpng2_info.image_data) {
2082
+ free(rpng2_info.image_data);
2083
+ rpng2_info.image_data = NULL;
2084
+ }
2085
+
2086
+ if (rpng2_info.row_pointers) {
2087
+ free(rpng2_info.row_pointers);
2088
+ rpng2_info.row_pointers = NULL;
2089
+ }
2090
+
2091
+ if (ximage) {
2092
+ if (ximage->data) {
2093
+ free(ximage->data); /* we allocated it, so we free it */
2094
+ ximage->data = (char *)NULL; /* instead of XDestroyImage() */
2095
+ }
2096
+ XDestroyImage(ximage);
2097
+ ximage = NULL;
2098
+ }
2099
+
2100
+ if (have_gc)
2101
+ XFreeGC(display, gc);
2102
+
2103
+ if (have_window)
2104
+ XDestroyWindow(display, window);
2105
+
2106
+ if (have_colormap)
2107
+ XFreeColormap(display, colormap);
2108
+
2109
+ if (have_nondefault_visual)
2110
+ XFree(visual_list);
2111
+ }
2112
+
2113
+
2114
+
2115
+
2116
+
2117
+ static int rpng2_x_msb(ulg u32val)
2118
+ {
2119
+ int i;
2120
+
2121
+ for (i = 31; i >= 0; --i) {
2122
+ if (u32val & 0x80000000L)
2123
+ break;
2124
+ u32val <<= 1;
2125
+ }
2126
+ return i;
2127
+ }