ruby-iup 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (323) hide show
  1. data/Rakefile +97 -0
  2. data/doc/README +10 -0
  3. data/doc/build_install.txt +77 -0
  4. data/examples/README +16 -0
  5. data/examples/ctrl/cbox.rb +221 -0
  6. data/examples/ctrl/checkboard.rb +33 -0
  7. data/examples/ctrl/degrade.rb +73 -0
  8. data/examples/ctrl/example1.rb +53 -0
  9. data/examples/ctrl/example2.rb +39 -0
  10. data/examples/ctrl/iupcolorbar.rb +95 -0
  11. data/examples/ctrl/iupcolorbrowser.rb +45 -0
  12. data/examples/ctrl/iupdial.rb +117 -0
  13. data/examples/ctrl/iupgauge.rb +242 -0
  14. data/examples/ctrl/iupgetcolor.rb +8 -0
  15. data/examples/ctrl/iupgetparam.rb +62 -0
  16. data/examples/ctrl/iupglcanvas.rb +172 -0
  17. data/examples/ctrl/iupmask.rb +15 -0
  18. data/examples/ctrl/iupmatrix.rb +39 -0
  19. data/examples/ctrl/iupplot2.rb +603 -0
  20. data/examples/ctrl/iuptabs.rb +22 -0
  21. data/examples/ctrl/iuptree.rb +190 -0
  22. data/examples/ctrl/iupval.rb +71 -0
  23. data/examples/ctrl/numbering.rb +46 -0
  24. data/examples/ctrl/sample.rb +166 -0
  25. data/examples/dlg/iupalarm.rb +14 -0
  26. data/examples/dlg/iupfiledlg.rb +19 -0
  27. data/examples/dlg/iupgetfile.rb +19 -0
  28. data/examples/dlg/iuplistdialog.rb +26 -0
  29. data/examples/dlg/iupmessage.rb +5 -0
  30. data/examples/dlg/iupscanf.rb +17 -0
  31. data/examples/elem/iupbutton.rb +197 -0
  32. data/examples/elem/iupcanvas.rb +27 -0
  33. data/examples/elem/iupcanvas2.rb +113 -0
  34. data/examples/elem/iupcanvas3.rb +62 -0
  35. data/examples/elem/iupdialog.rb +71 -0
  36. data/examples/elem/iupdialog2.rb +25 -0
  37. data/examples/elem/iupfill.rb +51 -0
  38. data/examples/elem/iupframe.rb +25 -0
  39. data/examples/elem/iuphbox.rb +68 -0
  40. data/examples/elem/iupimage.rb +113 -0
  41. data/examples/elem/iupitem.rb +60 -0
  42. data/examples/elem/iuplabel.rb +57 -0
  43. data/examples/elem/iuplist.rb +41 -0
  44. data/examples/elem/iuplist2.rb +125 -0
  45. data/examples/elem/iupmenu.rb +32 -0
  46. data/examples/elem/iupmultiline.rb +24 -0
  47. data/examples/elem/iupmultiline2.rb +156 -0
  48. data/examples/elem/iupradio.rb +32 -0
  49. data/examples/elem/iupseparator.rb +81 -0
  50. data/examples/elem/iupsubmenu.rb +85 -0
  51. data/examples/elem/iuptext.rb +61 -0
  52. data/examples/elem/iuptimer.rb +36 -0
  53. data/examples/elem/iuptoggle.rb +110 -0
  54. data/examples/elem/iupvbox.rb +87 -0
  55. data/examples/elem/iupzbox.rb +60 -0
  56. data/examples/elem/mdisample.rb +376 -0
  57. data/examples/elem/progressbar.rb +294 -0
  58. data/examples/elem/scrollbar.rb +66 -0
  59. data/examples/elem/tray.rb +90 -0
  60. data/examples/func/iupgetattribute.rb +32 -0
  61. data/examples/func/iupidle.rb +48 -0
  62. data/ext/extconf.rb +27 -0
  63. data/ext/iup-linux/include/cd.h +494 -0
  64. data/ext/iup-linux/include/cd_canvas.hpp +358 -0
  65. data/ext/iup-linux/include/cd_old.h +158 -0
  66. data/ext/iup-linux/include/cd_private.h +362 -0
  67. data/ext/iup-linux/include/cdcgm.h +34 -0
  68. data/ext/iup-linux/include/cdclipbd.h +22 -0
  69. data/ext/iup-linux/include/cddbuf.h +23 -0
  70. data/ext/iup-linux/include/cddebug.h +24 -0
  71. data/ext/iup-linux/include/cddgn.h +23 -0
  72. data/ext/iup-linux/include/cddxf.h +22 -0
  73. data/ext/iup-linux/include/cdemf.h +22 -0
  74. data/ext/iup-linux/include/cdgdiplus.h +29 -0
  75. data/ext/iup-linux/include/cdimage.h +23 -0
  76. data/ext/iup-linux/include/cdirgb.h +30 -0
  77. data/ext/iup-linux/include/cdiup.h +22 -0
  78. data/ext/iup-linux/include/cdlua.h +39 -0
  79. data/ext/iup-linux/include/cdlua3_private.h +120 -0
  80. data/ext/iup-linux/include/cdlua5_private.h +141 -0
  81. data/ext/iup-linux/include/cdluaim.h +24 -0
  82. data/ext/iup-linux/include/cdluaiup.h +27 -0
  83. data/ext/iup-linux/include/cdluapdf.h +27 -0
  84. data/ext/iup-linux/include/cdmf.h +24 -0
  85. data/ext/iup-linux/include/cdmf_private.h +32 -0
  86. data/ext/iup-linux/include/cdnative.h +26 -0
  87. data/ext/iup-linux/include/cdpdf.h +38 -0
  88. data/ext/iup-linux/include/cdpicture.h +22 -0
  89. data/ext/iup-linux/include/cdprint.h +23 -0
  90. data/ext/iup-linux/include/cdps.h +37 -0
  91. data/ext/iup-linux/include/cdwmf.h +22 -0
  92. data/ext/iup-linux/include/im.h +282 -0
  93. data/ext/iup-linux/include/im_attrib.h +116 -0
  94. data/ext/iup-linux/include/im_attrib_flat.h +39 -0
  95. data/ext/iup-linux/include/im_binfile.h +214 -0
  96. data/ext/iup-linux/include/im_capture.h +365 -0
  97. data/ext/iup-linux/include/im_color.h +465 -0
  98. data/ext/iup-linux/include/im_colorhsi.h +61 -0
  99. data/ext/iup-linux/include/im_complex.h +160 -0
  100. data/ext/iup-linux/include/im_convert.h +127 -0
  101. data/ext/iup-linux/include/im_counter.h +69 -0
  102. data/ext/iup-linux/include/im_dib.h +195 -0
  103. data/ext/iup-linux/include/im_file.h +111 -0
  104. data/ext/iup-linux/include/im_format.h +79 -0
  105. data/ext/iup-linux/include/im_format_all.h +576 -0
  106. data/ext/iup-linux/include/im_format_avi.h +87 -0
  107. data/ext/iup-linux/include/im_format_ecw.h +93 -0
  108. data/ext/iup-linux/include/im_format_jp2.h +78 -0
  109. data/ext/iup-linux/include/im_format_raw.h +64 -0
  110. data/ext/iup-linux/include/im_format_wmv.h +100 -0
  111. data/ext/iup-linux/include/im_image.h +403 -0
  112. data/ext/iup-linux/include/im_kernel.h +315 -0
  113. data/ext/iup-linux/include/im_lib.h +191 -0
  114. data/ext/iup-linux/include/im_math.h +368 -0
  115. data/ext/iup-linux/include/im_math_op.h +219 -0
  116. data/ext/iup-linux/include/im_palette.h +172 -0
  117. data/ext/iup-linux/include/im_plus.h +73 -0
  118. data/ext/iup-linux/include/im_process.h +35 -0
  119. data/ext/iup-linux/include/im_process_ana.h +221 -0
  120. data/ext/iup-linux/include/im_process_glo.h +170 -0
  121. data/ext/iup-linux/include/im_process_loc.h +577 -0
  122. data/ext/iup-linux/include/im_process_pon.h +712 -0
  123. data/ext/iup-linux/include/im_raw.h +34 -0
  124. data/ext/iup-linux/include/im_util.h +277 -0
  125. data/ext/iup-linux/include/imlua.h +83 -0
  126. data/ext/iup-linux/include/iup.h +255 -0
  127. data/ext/iup-linux/include/iup_pplot.h +40 -0
  128. data/ext/iup-linux/include/iupcb.h +25 -0
  129. data/ext/iup-linux/include/iupcbox.h +23 -0
  130. data/ext/iup-linux/include/iupcbs.h +42 -0
  131. data/ext/iup-linux/include/iupcells.h +130 -0
  132. data/ext/iup-linux/include/iupcolorbar.h +126 -0
  133. data/ext/iup-linux/include/iupcompat.h +62 -0
  134. data/ext/iup-linux/include/iupcontrols.h +40 -0
  135. data/ext/iup-linux/include/iupcpi.h +76 -0
  136. data/ext/iup-linux/include/iupdef.h +520 -0
  137. data/ext/iup-linux/include/iupdial.h +64 -0
  138. data/ext/iup-linux/include/iupgauge.h +57 -0
  139. data/ext/iup-linux/include/iupgc.h +20 -0
  140. data/ext/iup-linux/include/iupgetparam.h +27 -0
  141. data/ext/iup-linux/include/iupgl.h +101 -0
  142. data/ext/iup-linux/include/iupim.h +21 -0
  143. data/ext/iup-linux/include/iupkey.h +290 -0
  144. data/ext/iup-linux/include/iuplua.h +41 -0
  145. data/ext/iup-linux/include/iuplua_pplot.h +26 -0
  146. data/ext/iup-linux/include/iupluacontrols.h +27 -0
  147. data/ext/iup-linux/include/iupluagl.h +26 -0
  148. data/ext/iup-linux/include/iupluaim.h +26 -0
  149. data/ext/iup-linux/include/iupluaole.h +26 -0
  150. data/ext/iup-linux/include/iupmask.h +52 -0
  151. data/ext/iup-linux/include/iupmatrix.h +69 -0
  152. data/ext/iup-linux/include/iupole.h +24 -0
  153. data/ext/iup-linux/include/iupsbox.h +20 -0
  154. data/ext/iup-linux/include/iupspeech.h +23 -0
  155. data/ext/iup-linux/include/iupspin.h +21 -0
  156. data/ext/iup-linux/include/iuptabs.h +79 -0
  157. data/ext/iup-linux/include/iuptree.h +93 -0
  158. data/ext/iup-linux/include/iupval.h +46 -0
  159. data/ext/iup-linux/include/lauxlib.h +174 -0
  160. data/ext/iup-linux/include/lua.h +388 -0
  161. data/ext/iup-linux/include/lua.hpp +9 -0
  162. data/ext/iup-linux/include/luaconf.h +763 -0
  163. data/ext/iup-linux/include/lualib.h +53 -0
  164. data/ext/iup-linux/include/old_im.h +59 -0
  165. data/ext/iup-linux/include/wd.h +78 -0
  166. data/ext/iup-linux/include/wd_old.h +85 -0
  167. data/ext/iup-linux/libcd.so +0 -0
  168. data/ext/iup-linux/libcdcontextplus.so +0 -0
  169. data/ext/iup-linux/libcdluacontextplus51.so +0 -0
  170. data/ext/iup-linux/libcdpdf.so +0 -0
  171. data/ext/iup-linux/libfreetype.so +0 -0
  172. data/ext/iup-linux/libim.so +0 -0
  173. data/ext/iup-linux/libim_fftw.so +0 -0
  174. data/ext/iup-linux/libim_jp2.so +0 -0
  175. data/ext/iup-linux/libim_process.so +0 -0
  176. data/ext/iup-linux/libiup.so +0 -0
  177. data/ext/iup-linux/libiup_pplot.so +0 -0
  178. data/ext/iup-linux/libiupcd.so +0 -0
  179. data/ext/iup-linux/libiupcontrols.so +0 -0
  180. data/ext/iup-linux/libiupgl.so +0 -0
  181. data/ext/iup-linux/libiupim.so +0 -0
  182. data/ext/iup-linux/libiupimglib.so +0 -0
  183. data/ext/iup-linux/libpdflib.so +0 -0
  184. data/ext/iup-win32/cd.dll +0 -0
  185. data/ext/iup-win32/cd.lib +0 -0
  186. data/ext/iup-win32/cdcontextplus.dll +0 -0
  187. data/ext/iup-win32/cdcontextplus.lib +0 -0
  188. data/ext/iup-win32/cdlua51.lib +0 -0
  189. data/ext/iup-win32/cdluacontextplus51.lib +0 -0
  190. data/ext/iup-win32/cdluaim51.lib +0 -0
  191. data/ext/iup-win32/cdluapdf51.lib +0 -0
  192. data/ext/iup-win32/cdpdf.dll +0 -0
  193. data/ext/iup-win32/cdpdf.lib +0 -0
  194. data/ext/iup-win32/freetype6.dll +0 -0
  195. data/ext/iup-win32/freetype6.lib +0 -0
  196. data/ext/iup-win32/im.dll +0 -0
  197. data/ext/iup-win32/im_avi.dll +0 -0
  198. data/ext/iup-win32/im_capture.dll +0 -0
  199. data/ext/iup-win32/im_ecw.dll +0 -0
  200. data/ext/iup-win32/im_fftw.dll +0 -0
  201. data/ext/iup-win32/im_jp2.dll +0 -0
  202. data/ext/iup-win32/im_process.dll +0 -0
  203. data/ext/iup-win32/im_wmv.dll +0 -0
  204. data/ext/iup-win32/include/cd.h +494 -0
  205. data/ext/iup-win32/include/cd_canvas.hpp +358 -0
  206. data/ext/iup-win32/include/cd_old.h +158 -0
  207. data/ext/iup-win32/include/cd_private.h +362 -0
  208. data/ext/iup-win32/include/cdcgm.h +34 -0
  209. data/ext/iup-win32/include/cdclipbd.h +22 -0
  210. data/ext/iup-win32/include/cddbuf.h +23 -0
  211. data/ext/iup-win32/include/cddebug.h +24 -0
  212. data/ext/iup-win32/include/cddgn.h +23 -0
  213. data/ext/iup-win32/include/cddxf.h +22 -0
  214. data/ext/iup-win32/include/cdemf.h +22 -0
  215. data/ext/iup-win32/include/cdgdiplus.h +29 -0
  216. data/ext/iup-win32/include/cdimage.h +23 -0
  217. data/ext/iup-win32/include/cdirgb.h +30 -0
  218. data/ext/iup-win32/include/cdiup.h +22 -0
  219. data/ext/iup-win32/include/cdlua.h +39 -0
  220. data/ext/iup-win32/include/cdlua3_private.h +120 -0
  221. data/ext/iup-win32/include/cdlua5_private.h +141 -0
  222. data/ext/iup-win32/include/cdluaim.h +24 -0
  223. data/ext/iup-win32/include/cdluaiup.h +27 -0
  224. data/ext/iup-win32/include/cdluapdf.h +27 -0
  225. data/ext/iup-win32/include/cdmf.h +24 -0
  226. data/ext/iup-win32/include/cdmf_private.h +32 -0
  227. data/ext/iup-win32/include/cdnative.h +26 -0
  228. data/ext/iup-win32/include/cdpdf.h +38 -0
  229. data/ext/iup-win32/include/cdpicture.h +22 -0
  230. data/ext/iup-win32/include/cdprint.h +23 -0
  231. data/ext/iup-win32/include/cdps.h +37 -0
  232. data/ext/iup-win32/include/cdwmf.h +22 -0
  233. data/ext/iup-win32/include/iup.h +255 -0
  234. data/ext/iup-win32/include/iup_pplot.h +40 -0
  235. data/ext/iup-win32/include/iupcb.h +25 -0
  236. data/ext/iup-win32/include/iupcbox.h +23 -0
  237. data/ext/iup-win32/include/iupcbs.h +42 -0
  238. data/ext/iup-win32/include/iupcells.h +130 -0
  239. data/ext/iup-win32/include/iupcolorbar.h +126 -0
  240. data/ext/iup-win32/include/iupcompat.h +62 -0
  241. data/ext/iup-win32/include/iupcontrols.h +40 -0
  242. data/ext/iup-win32/include/iupcpi.h +76 -0
  243. data/ext/iup-win32/include/iupdef.h +520 -0
  244. data/ext/iup-win32/include/iupdial.h +64 -0
  245. data/ext/iup-win32/include/iupgauge.h +57 -0
  246. data/ext/iup-win32/include/iupgc.h +20 -0
  247. data/ext/iup-win32/include/iupgetparam.h +27 -0
  248. data/ext/iup-win32/include/iupgl.h +101 -0
  249. data/ext/iup-win32/include/iupim.h +21 -0
  250. data/ext/iup-win32/include/iupkey.h +290 -0
  251. data/ext/iup-win32/include/iuplua.h +41 -0
  252. data/ext/iup-win32/include/iuplua_pplot.h +26 -0
  253. data/ext/iup-win32/include/iupluacontrols.h +27 -0
  254. data/ext/iup-win32/include/iupluagl.h +26 -0
  255. data/ext/iup-win32/include/iupluaim.h +26 -0
  256. data/ext/iup-win32/include/iupluaole.h +26 -0
  257. data/ext/iup-win32/include/iupmask.h +52 -0
  258. data/ext/iup-win32/include/iupmatrix.h +69 -0
  259. data/ext/iup-win32/include/iupole.h +24 -0
  260. data/ext/iup-win32/include/iupsbox.h +20 -0
  261. data/ext/iup-win32/include/iupspeech.h +23 -0
  262. data/ext/iup-win32/include/iupspin.h +21 -0
  263. data/ext/iup-win32/include/iuptabs.h +79 -0
  264. data/ext/iup-win32/include/iuptree.h +93 -0
  265. data/ext/iup-win32/include/iupval.h +46 -0
  266. data/ext/iup-win32/include/wd.h +78 -0
  267. data/ext/iup-win32/include/wd_old.h +85 -0
  268. data/ext/iup-win32/iup.dll +0 -0
  269. data/ext/iup-win32/iup.lib +0 -0
  270. data/ext/iup-win32/iup_pplot.dll +0 -0
  271. data/ext/iup-win32/iup_pplot.lib +0 -0
  272. data/ext/iup-win32/iupcd.dll +0 -0
  273. data/ext/iup-win32/iupcd.lib +0 -0
  274. data/ext/iup-win32/iupcontrols.dll +0 -0
  275. data/ext/iup-win32/iupcontrols.lib +0 -0
  276. data/ext/iup-win32/iupgl.dll +0 -0
  277. data/ext/iup-win32/iupgl.lib +0 -0
  278. data/ext/iup-win32/iupim.dll +0 -0
  279. data/ext/iup-win32/iupim.lib +0 -0
  280. data/ext/iup-win32/iupimglib.dll +0 -0
  281. data/ext/iup-win32/iupimglib.lib +0 -0
  282. data/ext/iup-win32/iuplua51.lib +0 -0
  283. data/ext/iup-win32/iuplua_pplot51.lib +0 -0
  284. data/ext/iup-win32/iupluacd51.lib +0 -0
  285. data/ext/iup-win32/iupluacontrols51.lib +0 -0
  286. data/ext/iup-win32/iupluagl51.lib +0 -0
  287. data/ext/iup-win32/iupluaim51.lib +0 -0
  288. data/ext/iup-win32/iupluaimglib51.lib +0 -0
  289. data/ext/iup-win32/iupluaole51.lib +0 -0
  290. data/ext/iup-win32/iupole.dll +0 -0
  291. data/ext/iup-win32/iupole.lib +0 -0
  292. data/ext/iup-win32/iupstub.lib +0 -0
  293. data/ext/iup-win32/pdflib.dll +0 -0
  294. data/ext/iup-win32/pdflib.lib +0 -0
  295. data/ext/iup.c +1261 -0
  296. data/ext/mkrf_conf.rb +72 -0
  297. data/ext/rb_cd.h +1525 -0
  298. data/ext/rb_iup.h +2446 -0
  299. data/ext/rb_iup_pplot.h +129 -0
  300. data/ext/rb_iupcb.h +13 -0
  301. data/ext/rb_iupcbox.h +40 -0
  302. data/ext/rb_iupcells.h +15 -0
  303. data/ext/rb_iupcolorbar.h +17 -0
  304. data/ext/rb_iupcompat.h +237 -0
  305. data/ext/rb_iupcontrols.h +28 -0
  306. data/ext/rb_iupdef.h +3 -0
  307. data/ext/rb_iupdial.h +24 -0
  308. data/ext/rb_iupgauge.h +15 -0
  309. data/ext/rb_iupgc.h +18 -0
  310. data/ext/rb_iupgetparam.h +72 -0
  311. data/ext/rb_iupgl.h +58 -0
  312. data/ext/rb_iupim.h +25 -0
  313. data/ext/rb_iupmask.h +189 -0
  314. data/ext/rb_iupmatrix.h +80 -0
  315. data/ext/rb_iupole.h +24 -0
  316. data/ext/rb_iupsbox.h +23 -0
  317. data/ext/rb_iupspeech.h +25 -0
  318. data/ext/rb_iupspin.h +29 -0
  319. data/ext/rb_iuptabs.h +29 -0
  320. data/ext/rb_iuptree.h +94 -0
  321. data/ext/rb_iupval.h +24 -0
  322. data/lib/README +1 -0
  323. metadata +391 -0
@@ -0,0 +1,72 @@
1
+ # extconf.rb for ruby-iup extension module.
2
+ #
3
+ # Copyright (C) 2008 Park Heesob <jmg3000@gmail.com>
4
+ #
5
+ # This program is distributed under the terms of the MIT license.
6
+ # See the included COPYRIGHT file for the terms of this license.
7
+ #
8
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
9
+ # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
11
+ # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
12
+ # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
13
+ # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
14
+ # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+
16
+ require 'rubygems'
17
+ require 'mkrf'
18
+ require 'rbconfig'
19
+
20
+ RUBYVER = " -DRUBY_VERSION=" + RUBY_VERSION.split(".").join
21
+
22
+ ldir = nil
23
+ Mkrf::Generator.new('iup') do |g|
24
+ case RUBY_PLATFORM
25
+ when /mswin32/
26
+ ldir = './iup-win32'
27
+ g.cflags << ' -DWIN32' + RUBYVER
28
+ g.include_header('iup.h', ldir+'/include')
29
+ g.include_library('iup.lib', 'IupVersion',ldir)
30
+ g.include_library('iupcd.lib', 'cdContextIup')
31
+ g.include_library('iupcontrols.lib', 'IupControlsOpen')
32
+ g.include_library('iupgl.lib', 'IupGLCanvas')
33
+ g.include_library('iupim.lib', 'IupLoadImage')
34
+ g.include_library('iupimglib.lib', 'IupImageLibOpen')
35
+ g.include_library('iupole.lib', 'IupOleControl')
36
+ g.include_library('iup_pplot.lib', 'IupPPlot')
37
+ g.include_library('cd.lib', 'cdVersion')
38
+ g.include_library('cdpdf.lib', 'cdContextPDF')
39
+ else
40
+ ldir = './iup-linux'
41
+ ENV['LD_LIBRARY_PATH'] = ldir
42
+ g.cflags << ' -Wall' + RUBYVER
43
+ g.include_header('iup.h', ldir+'/include')
44
+ g.include_library('iup', 'IupVersion',ldir)
45
+ g.include_library('iupcd', 'cdContextIup')
46
+ g.include_library('iupcontrols', 'IupControlsOpen')
47
+ g.include_library('iupgl', 'IupGLCanvas')
48
+ g.include_library('iupim', 'IupLoadImage')
49
+ g.include_library('iupimglib', 'IupImageLibOpen')
50
+ g.include_library('iupole', 'IupOleControl')
51
+ g.include_library('iup_pplot', 'IupPPlot')
52
+ g.include_library('cd', 'cdVersion')
53
+ g.include_library('cdpdf', 'cdContextPDF')
54
+ end
55
+ end
56
+ open("Rakefile", "a") do |rf|
57
+ if RUBY_PLATFORM =~ /win32/
58
+ rf.puts("task :default do")
59
+ Dir[ldir+"/*.dll"].each do |f|
60
+ # rf.puts("sh 'copy \"#{f}\" \"#{Config::CONFIG['bindir']}\"'".gsub('/'){'\\\\'})
61
+ rf.puts(" install '#{f}', '#{Config::CONFIG['bindir']}'")
62
+ end
63
+ rf.puts("end");
64
+ else
65
+ rf.puts("task :default do")
66
+ Dir[ldir+"/*.so"].each do |f|
67
+ rf.puts(" install '#{f}', '/usr/local/lib'")
68
+ end
69
+ rf.puts(" sh 'ldconfig'")
70
+ rf.puts("end");
71
+ end
72
+ end
@@ -0,0 +1,1525 @@
1
+ #include <ruby.h>
2
+ #include "cd.h"
3
+ #include "cdiup.h"
4
+ #include "cdpdf.h"
5
+
6
+ extern VALUE rb_cCdCanvas;
7
+
8
+ VALUE rb_cCdCanvas_initialize(VALUE self,VALUE v_canvas)
9
+ {
10
+ if(NUM2UINT(v_canvas)==0) return Qnil;
11
+ rb_iv_set(self,"@canvas",v_canvas);
12
+ return self;
13
+ }
14
+
15
+ VALUE rb_cdVersion(VALUE self)
16
+ {
17
+ char* v;
18
+ v = cdVersion();
19
+ return rb_str_new2(v);
20
+ }
21
+
22
+ VALUE rb_cdVersionDate(VALUE self)
23
+ {
24
+ char* v;
25
+ v = cdVersionDate();
26
+ return rb_str_new2(v);
27
+ }
28
+
29
+ VALUE rb_cdActiveCanvas(VALUE self)
30
+ {
31
+ cdCanvas* v;
32
+ v = cdActiveCanvas();
33
+ if(v==NULL) return Qnil;
34
+ return rb_funcall(rb_cCdCanvas,rb_intern("new"),1,UINT2NUM((unsigned)v));
35
+ }
36
+
37
+ VALUE rb_cdActivate(VALUE self)
38
+ {
39
+ int v;
40
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
41
+ v = cdActivate((cdCanvas*)NUM2UINT(v_canvas));
42
+ return UINT2NUM((unsigned)v);
43
+ }
44
+
45
+ VALUE rb_cdCreateCanvas(VALUE self,VALUE v_context,VALUE v_data)
46
+ {
47
+ cdCanvas* v;
48
+ void* data;
49
+ if(TYPE(v_data)==T_FIXNUM || TYPE(v_data)==T_BIGNUM)
50
+ data = (void*)NUM2UINT(v_data);
51
+ else if(TYPE(v_data)==T_STRING)
52
+ data = (void*)RSTRING(v_data)->ptr;
53
+ else {
54
+ VALUE v_ih = rb_iv_get(v_data,"@ihandle");
55
+ data = (void*)NUM2UINT(v_ih);
56
+ }
57
+ v = cdCreateCanvas((cdContext*)NUM2UINT(v_context),data);
58
+ if(v)
59
+ return rb_funcall(rb_cCdCanvas,rb_intern("new"),1,UINT2NUM((unsigned)v));
60
+ return Qnil;
61
+ }
62
+
63
+ VALUE rb_cdKillCanvas(VALUE self)
64
+ {
65
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
66
+ cdKillCanvas((cdCanvas*)NUM2UINT(v_canvas));
67
+ return Qnil;
68
+ }
69
+
70
+ VALUE rb_cdCanvasGetContext(VALUE self)
71
+ {
72
+ cdContext* v;
73
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
74
+ v = cdCanvasGetContext((cdCanvas*)NUM2UINT(v_canvas));
75
+ return UINT2NUM((unsigned)v);
76
+ }
77
+
78
+ VALUE rb_cdCanvasActivate(VALUE self)
79
+ {
80
+ cdCanvas* canvas = NULL;
81
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
82
+ int v;
83
+ if(v_canvas!=Qnil) canvas = (cdCanvas*)NUM2UINT(v_canvas);
84
+ v = cdActivate(canvas);
85
+ return UINT2NUM((unsigned)v);
86
+ }
87
+
88
+ VALUE rb_cdCanvasDeactivate(VALUE self)
89
+ {
90
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
91
+ cdCanvasDeactivate((cdCanvas*)NUM2UINT(v_canvas));
92
+ return Qnil;
93
+ }
94
+
95
+ VALUE rb_cdUseContextPlus(VALUE self,VALUE v_use)
96
+ {
97
+ int use = NUM2UINT(v_use);
98
+ int v;
99
+ v = cdUseContextPlus(use);
100
+ return UINT2NUM((unsigned)v);
101
+ }
102
+
103
+ VALUE rb_cdContextRegisterCallback(VALUE self,VALUE v_context,VALUE v_cb,VALUE v_func)
104
+ {
105
+ int cb = NUM2UINT(v_cb);
106
+ int v;
107
+ void *func = (void*)NUM2UINT(v_func);
108
+ v = cdContextRegisterCallback((cdContext*)NUM2UINT(v_context),cb,func);
109
+ return UINT2NUM((unsigned)v);
110
+ }
111
+
112
+ VALUE rb_cdContextCaps(VALUE self,VALUE v_context)
113
+ {
114
+ long v;
115
+ v = cdContextCaps((cdContext*)NUM2UINT(v_context));
116
+ return LONG2NUM(v);
117
+ }
118
+
119
+ VALUE rb_cdCanvasSimulate(VALUE self,VALUE v_mode)
120
+ {
121
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
122
+ int mode = NUM2UINT(v_mode);
123
+ int v;
124
+ v = cdCanvasSimulate((cdCanvas*)NUM2UINT(v_canvas),mode);
125
+ return INT2NUM(v);
126
+ }
127
+
128
+ VALUE rb_cdCanvasFlush(VALUE self)
129
+ {
130
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
131
+ cdCanvasFlush((cdCanvas*)NUM2UINT(v_canvas));
132
+ return Qnil;
133
+ }
134
+
135
+ VALUE rb_cdCanvasClear(VALUE self)
136
+ {
137
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
138
+ cdCanvasClear((cdCanvas*)NUM2UINT(v_canvas));
139
+ return Qnil;
140
+ }
141
+
142
+ VALUE rb_cdCanvasSaveState(VALUE self)
143
+ {
144
+ cdState* v;
145
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
146
+ v = cdCanvasSaveState((cdCanvas*)NUM2UINT(v_canvas));
147
+ return UINT2NUM((unsigned)v);
148
+ }
149
+
150
+ VALUE rb_cdCanvasRestoreState(VALUE self,VALUE v_state)
151
+ {
152
+ cdState* state = (cdState*)NUM2UINT(v_state);
153
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
154
+ cdCanvasRestoreState((cdCanvas*)NUM2UINT(v_canvas),state);
155
+ return Qnil;
156
+ }
157
+
158
+ VALUE rb_cdReleaseState(VALUE self,VALUE v_state)
159
+ {
160
+ cdState* state = (cdState*)NUM2UINT(v_state);
161
+ cdReleaseState(state);
162
+ return Qnil;
163
+ }
164
+
165
+ VALUE rb_cdCanvasSetAttribute(VALUE self,VALUE v_name,VALUE v_data)
166
+ {
167
+ const char* name = RSTRING(v_name)->ptr;
168
+ char* data = RSTRING(v_data)->ptr;
169
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
170
+ cdCanvasSetAttribute((cdCanvas*)NUM2UINT(v_canvas),name,data);
171
+ return Qnil;
172
+ }
173
+
174
+ VALUE rb_cdCanvasGetAttribute(VALUE self,VALUE v_name)
175
+ {
176
+ const char* name = RSTRING(v_name)->ptr;
177
+ char* v;
178
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
179
+ v = cdCanvasGetAttribute((cdCanvas*)NUM2UINT(v_canvas),name);
180
+ return rb_str_new2(v);
181
+ }
182
+
183
+ VALUE rb_cdCanvasPlay(VALUE self,VALUE v_context,VALUE v_xmin,VALUE v_xmax,VALUE v_ymin,VALUE v_ymax,VALUE v_data)
184
+ {
185
+ int xmin = NUM2INT(v_xmin);
186
+ int xmax = NUM2INT(v_xmax);
187
+ int ymin = NUM2INT(v_ymin);
188
+ int ymax = NUM2INT(v_ymax);
189
+ void *data = (void*)NUM2UINT(v_data);
190
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
191
+ int v;
192
+ v = cdCanvasPlay((cdCanvas*)NUM2UINT(v_canvas),(cdContext*)NUM2UINT(v_context),xmin,xmax,ymin,ymax,data);
193
+ return INT2NUM(v);
194
+ }
195
+
196
+ VALUE rb_cdCanvasGetSize(VALUE self,VALUE v_width,VALUE v_height,VALUE v_width_mm,VALUE v_height_mm)
197
+ {
198
+ int width;
199
+ int height;
200
+ double mm_width;
201
+ double mm_height;
202
+ VALUE v_r;
203
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
204
+ cdCanvasGetSize((cdCanvas*)NUM2UINT(v_canvas),&width,&height,&mm_width,&mm_height);
205
+ v_r = rb_ary_new3(4,INT2FIX(width),INT2FIX(height),rb_float_new(mm_width),rb_float_new(mm_height));
206
+ return v_r;
207
+ }
208
+
209
+ VALUE rb_cdCanvasUpdateYAxis(VALUE self,VALUE v_y)
210
+ {
211
+ int y = NUM2INT(v_y);
212
+ int v;
213
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
214
+ v = cdCanvasUpdateYAxis((cdCanvas*)NUM2UINT(v_canvas),&y);
215
+ return INT2NUM(y);
216
+ }
217
+
218
+ VALUE rb_cdfCanvasUpdateYAxis(VALUE self,VALUE v_y)
219
+ {
220
+ double y = RFLOAT(v_y)->value;
221
+ double v;
222
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
223
+ v = cdfCanvasUpdateYAxis((cdCanvas*)NUM2UINT(v_canvas),&y);
224
+ return rb_float_new(y);
225
+ }
226
+
227
+ VALUE rb_cdCanvasInvertYAxis(VALUE self,VALUE v_y)
228
+ {
229
+ int y = NUM2INT(v_y);
230
+ int v;
231
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
232
+ v = cdCanvasInvertYAxis((cdCanvas*)NUM2UINT(v_canvas),y);
233
+ return INT2NUM(y);
234
+ }
235
+
236
+ VALUE rb_cdfCanvasInvertYAxis(VALUE self,VALUE v_y)
237
+ {
238
+ double y = RFLOAT(v_y)->value;
239
+ double v;
240
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
241
+ v = cdfCanvasInvertYAxis((cdCanvas*)NUM2UINT(v_canvas),y);
242
+ return rb_float_new(v);
243
+ }
244
+
245
+ VALUE rb_cdCanvasMM2Pixel(VALUE self,VALUE v_mm_dx,VALUE v_mm_dy)
246
+ {
247
+ double mm_dx = RFLOAT(v_mm_dx)->value;
248
+ double mm_dy = RFLOAT(v_mm_dy)->value;
249
+ int dx;
250
+ int dy;
251
+ VALUE v_r;
252
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
253
+ cdCanvasMM2Pixel((cdCanvas*)NUM2UINT(v_canvas),mm_dx,mm_dy,&dx,&dy);
254
+ v_r = rb_ary_new3(2,INT2FIX(dx),INT2FIX(dy));
255
+ return v_r;
256
+ }
257
+
258
+ VALUE rb_cdCanvasPixel2MM(VALUE self,VALUE v_dx,VALUE v_dy)
259
+ {
260
+ double mm_dx;
261
+ double mm_dy;
262
+ int dx = NUM2INT(v_dx);
263
+ int dy = NUM2INT(v_dy);
264
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
265
+ VALUE v_r;
266
+ cdCanvasPixel2MM((cdCanvas*)NUM2UINT(v_canvas),dx,dy,&mm_dx,&mm_dy);
267
+ v_r = rb_ary_new3(2,rb_float_new(mm_dx),rb_float_new(mm_dy));
268
+ return v_r;
269
+ }
270
+
271
+ VALUE rb_cdfCanvasMM2Pixel(VALUE self,VALUE v_mm_dx,VALUE v_mm_dy,VALUE v_dx,VALUE v_dy)
272
+ {
273
+ double mm_dx = RFLOAT(v_mm_dx)->value;
274
+ double mm_dy = RFLOAT(v_mm_dy)->value;
275
+ double dx;
276
+ double dy;
277
+ VALUE v_r;
278
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
279
+ cdfCanvasMM2Pixel((cdCanvas*)NUM2UINT(v_canvas),mm_dx,mm_dy,&dx,&dy);
280
+ v_r = rb_ary_new3(2,rb_float_new(dx),rb_float_new(dy));
281
+ return v_r;
282
+ }
283
+
284
+ VALUE rb_cdfCanvasPixel2MM(VALUE self,VALUE v_dx,VALUE v_dy)
285
+ {
286
+ double mm_dx;
287
+ double mm_dy;
288
+ double dx = RFLOAT(v_dx)->value;
289
+ double dy = RFLOAT(v_dy)->value;
290
+ VALUE v_r;
291
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
292
+ cdfCanvasPixel2MM((cdCanvas*)NUM2UINT(v_canvas),dx,dy,&mm_dx,&mm_dy);
293
+ v_r = rb_ary_new3(2,rb_float_new(mm_dx),rb_float_new(mm_dy));
294
+ return v_r;
295
+ }
296
+
297
+ VALUE rb_cdCanvasOrigin(VALUE self,VALUE v_x,VALUE v_y)
298
+ {
299
+ int x = NUM2INT(v_x);
300
+ int y = NUM2INT(v_y);
301
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
302
+ cdCanvasOrigin((cdCanvas*)NUM2UINT(v_canvas),x,y);
303
+ return Qnil;
304
+ }
305
+
306
+ VALUE rb_cdfCanvasOrigin(VALUE self,VALUE v_x,VALUE v_y)
307
+ {
308
+ double x = RFLOAT(v_x)->value;
309
+ double y = RFLOAT(v_y)->value;
310
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
311
+ cdfCanvasOrigin((cdCanvas*)NUM2UINT(v_canvas),x,y);
312
+ return Qnil;
313
+ }
314
+
315
+ VALUE rb_cdCanvasGetOrigin(VALUE self)
316
+ {
317
+ int x;
318
+ int y;
319
+ VALUE v_r;
320
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
321
+ cdCanvasGetOrigin((cdCanvas*)NUM2UINT(v_canvas),&x,&y);
322
+ v_r = rb_ary_new3(2,INT2FIX(x),INT2FIX(y));
323
+ return v_r;
324
+ }
325
+
326
+ VALUE rb_cdfCanvasGetOrigin(VALUE self,VALUE v_x,VALUE v_y)
327
+ {
328
+ double x;
329
+ double y;
330
+ VALUE v_r;
331
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
332
+ cdfCanvasGetOrigin((cdCanvas*)NUM2UINT(v_canvas),&x,&y);
333
+ v_r = rb_ary_new3(2,rb_float_new(x),rb_float_new(y));
334
+ return v_r;
335
+ }
336
+
337
+ VALUE rb_cdCanvasTransform(VALUE self,VALUE v_matrix)
338
+ {
339
+ double *matrix = NULL;
340
+ int i;
341
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
342
+ if(v_matrix!=Qnil) {
343
+ matrix = xmalloc(sizeof(double)*6);
344
+ for(i=0;i<RARRAY(v_matrix)->len && i<6;i++)
345
+ matrix[i] = RFLOAT(RARRAY(v_matrix)->ptr[i])->value;
346
+ }
347
+ cdCanvasTransform((cdCanvas*)NUM2UINT(v_canvas),matrix);
348
+ if(matrix) free(matrix);
349
+ return Qnil;
350
+ }
351
+
352
+ VALUE rb_cdCanvasGetTransform(VALUE self)
353
+ {
354
+ double* v;
355
+ int i;
356
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
357
+ VALUE v_r = rb_ary_new();
358
+ v = cdCanvasGetTransform((cdCanvas*)NUM2UINT(v_canvas));
359
+ if(v==NULL) return Qnil;
360
+ for(i=0;i<6;i++)
361
+ rb_ary_push(v_r,rb_float_new(v[i]));
362
+ return v_r;
363
+ }
364
+
365
+ VALUE rb_cdCanvasTransformMultiply(VALUE self,VALUE v_matrix)
366
+ {
367
+ double *matrix = NULL;
368
+ int i;
369
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
370
+ if(v_matrix!=Qnil) {
371
+ matrix = xmalloc(sizeof(double)*6);
372
+ for(i=0;i<RARRAY(v_matrix)->len && i<6;i++)
373
+ matrix[i] = RFLOAT(RARRAY(v_matrix)->ptr[i])->value;
374
+ }
375
+ cdCanvasTransformMultiply((cdCanvas*)NUM2UINT(v_canvas),matrix);
376
+ return Qnil;
377
+ }
378
+
379
+ VALUE rb_cdCanvasTransformRotate(VALUE self,VALUE v_angle)
380
+ {
381
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
382
+ double angle = RFLOAT(v_angle)->value;
383
+ cdCanvasTransformRotate((cdCanvas*)NUM2UINT(v_canvas),angle);
384
+ return Qnil;
385
+ }
386
+
387
+ VALUE rb_cdCanvasTransformScale(VALUE self,VALUE v_sx,VALUE v_sy)
388
+ {
389
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
390
+ double sx = RFLOAT(v_sx)->value;
391
+ double sy = RFLOAT(v_sy)->value;
392
+ cdCanvasTransformScale((cdCanvas*)NUM2UINT(v_canvas),sx,sy);
393
+ return Qnil;
394
+ }
395
+
396
+ VALUE rb_cdCanvasTransformTranslate(VALUE self,VALUE v_dx,VALUE v_dy)
397
+ {
398
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
399
+ double dx = RFLOAT(v_dx)->value;
400
+ double dy = RFLOAT(v_dy)->value;
401
+ cdCanvasTransformTranslate((cdCanvas*)NUM2UINT(v_canvas),dx,dy);
402
+ return Qnil;
403
+ }
404
+
405
+ VALUE rb_cdCanvasTransformPoint(VALUE self,VALUE v_x,VALUE v_y)
406
+ {
407
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
408
+ int x = NUM2INT(v_x);
409
+ int y = NUM2INT(v_y);
410
+ int tx;
411
+ int ty;
412
+ VALUE v_r;
413
+ cdCanvasTransformPoint((cdCanvas*)NUM2UINT(v_canvas),x,y,&tx,&ty);
414
+ v_r = rb_ary_new3(2,INT2FIX(tx),INT2FIX(ty));
415
+ return v_r;
416
+ }
417
+
418
+ VALUE rb_cdfCanvasTransformPoint(VALUE self,VALUE v_x,VALUE v_y)
419
+ {
420
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
421
+ double x = RFLOAT(v_x)->value;
422
+ double y = RFLOAT(v_y)->value;
423
+ double tx;
424
+ double ty;
425
+ VALUE v_r;
426
+ cdfCanvasTransformPoint((cdCanvas*)NUM2UINT(v_canvas),x,y,&tx,&ty);
427
+ v_r = rb_ary_new3(2,rb_float_new(tx),rb_float_new(ty));
428
+ return v_r;
429
+ }
430
+
431
+ VALUE rb_cdCanvasClip(VALUE self,VALUE v_mode)
432
+ {
433
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
434
+ int mode = NUM2INT(v_mode);
435
+ int v;
436
+ v = cdCanvasClip((cdCanvas*)NUM2UINT(v_canvas),mode);
437
+ return UINT2NUM((unsigned)v);
438
+ }
439
+
440
+ VALUE rb_cdCanvasClipArea(VALUE self,VALUE v_xmin,VALUE v_xmax,VALUE v_ymin,VALUE v_ymax)
441
+ {
442
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
443
+ int xmin = NUM2INT(v_xmin);
444
+ int xmax = NUM2INT(v_xmax);
445
+ int ymin = NUM2INT(v_ymin);
446
+ int ymax = NUM2INT(v_ymax);
447
+ cdCanvasClipArea((cdCanvas*)NUM2UINT(v_canvas),xmin,xmax,ymin,ymax);
448
+ return Qnil;
449
+ }
450
+
451
+ VALUE rb_cdCanvasGetClipArea(VALUE self)
452
+ {
453
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
454
+ int xmin;
455
+ int xmax;
456
+ int ymin;
457
+ int ymax;
458
+ int v;
459
+ VALUE v_r;
460
+ v = cdCanvasGetClipArea((cdCanvas*)NUM2UINT(v_canvas),&xmin,&xmax,&ymin,&ymax);
461
+ v_r = rb_ary_new3(4,INT2FIX(xmin),INT2FIX(xmax),INT2FIX(ymin),INT2FIX(ymax));
462
+ return v_r;
463
+ }
464
+
465
+ VALUE rb_cdfCanvasClipArea(VALUE self,VALUE v_xmin,VALUE v_xmax,VALUE v_ymin,VALUE v_ymax)
466
+ {
467
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
468
+ double xmin = RFLOAT(v_xmin)->value;
469
+ double xmax = RFLOAT(v_xmax)->value;
470
+ double ymin = RFLOAT(v_ymin)->value;
471
+ double ymax = RFLOAT(v_ymax)->value;
472
+ cdfCanvasClipArea((cdCanvas*)NUM2UINT(v_canvas),xmin,xmax,ymin,ymax);
473
+ return Qnil;
474
+ }
475
+
476
+ VALUE rb_cdfCanvasGetClipArea(VALUE self,VALUE v_xmin,VALUE v_xmax,VALUE v_ymin,VALUE v_ymax)
477
+ {
478
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
479
+ double xmin;
480
+ double xmax;
481
+ double ymin;
482
+ double ymax;
483
+ int v;
484
+ VALUE v_r;
485
+ v = cdfCanvasGetClipArea((cdCanvas*)NUM2UINT(v_canvas),&xmin,&xmax,&ymin,&ymax);
486
+ v_r = rb_ary_new3(4,rb_float_new(xmin),rb_float_new(xmax),rb_float_new(ymin),rb_float_new(ymax));
487
+ return v_r;
488
+ }
489
+
490
+ VALUE rb_cdCanvasIsPointInRegion(VALUE self,VALUE v_x,VALUE v_y)
491
+ {
492
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
493
+ int x = NUM2INT(v_x);
494
+ int y = NUM2INT(v_y);
495
+ int v;
496
+ v = cdCanvasIsPointInRegion((cdCanvas*)NUM2UINT(v_canvas),x,y);
497
+ return UINT2NUM((unsigned)v);
498
+ }
499
+
500
+ VALUE rb_cdCanvasOffsetRegion(VALUE self,VALUE v_x,VALUE v_y)
501
+ {
502
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
503
+ int x = NUM2UINT(v_x);
504
+ int y = NUM2UINT(v_y);
505
+ cdCanvasOffsetRegion((cdCanvas*)NUM2UINT(v_canvas),x,y);
506
+ return Qnil;
507
+ }
508
+
509
+ VALUE rb_cdCanvasGetRegionBox(VALUE self)
510
+ {
511
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
512
+ int xmin;
513
+ int xmax;
514
+ int ymin;
515
+ int ymax;
516
+ VALUE v_r;
517
+ cdCanvasGetRegionBox((cdCanvas*)NUM2UINT(v_canvas),&xmin,&xmax,&ymin,&ymax);
518
+ v_r = rb_ary_new3(4,INT2FIX(xmin),INT2FIX(xmax),INT2FIX(ymin),INT2FIX(ymax));
519
+ return v_r;
520
+ }
521
+
522
+ VALUE rb_cdCanvasRegionCombineMode(VALUE self,VALUE v_mode)
523
+ {
524
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
525
+ int mode = NUM2INT(v_mode);
526
+ int v;
527
+ v = cdCanvasRegionCombineMode((cdCanvas*)NUM2UINT(v_canvas),mode);
528
+ return UINT2NUM((unsigned)v);
529
+ }
530
+
531
+ VALUE rb_cdCanvasPixel(VALUE self,VALUE v_x,VALUE v_y,VALUE v_color)
532
+ {
533
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
534
+ long int color = NUM2LONG(v_color);
535
+ int x = NUM2INT(v_x);
536
+ int y = NUM2INT(v_y);
537
+ cdCanvasPixel((cdCanvas*)NUM2UINT(v_canvas),x,y,color);
538
+ return Qnil;
539
+ }
540
+
541
+ VALUE rb_cdCanvasMark(VALUE self,VALUE v_x,VALUE v_y)
542
+ {
543
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
544
+ int x = NUM2INT(v_x);
545
+ int y = NUM2INT(v_y);
546
+ cdCanvasMark((cdCanvas*)NUM2UINT(v_canvas),x,y);
547
+ return Qnil;
548
+ }
549
+
550
+ VALUE rb_cdCanvasLine(VALUE self,VALUE v_x1,VALUE v_y1,VALUE v_x2,VALUE v_y2)
551
+ {
552
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
553
+ int x1 = NUM2INT(v_x1);
554
+ int y1 = NUM2INT(v_y1);
555
+ int x2 = NUM2INT(v_x2);
556
+ int y2 = NUM2INT(v_y2);
557
+ cdCanvasLine((cdCanvas*)NUM2UINT(v_canvas),x1,y1,x2,y2);
558
+ return Qnil;
559
+ }
560
+
561
+ VALUE rb_cdCanvasBegin(VALUE self,VALUE v_mode)
562
+ {
563
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
564
+ int mode = NUM2INT(v_mode);
565
+ cdCanvasBegin((cdCanvas*)NUM2UINT(v_canvas),mode);
566
+ return Qnil;
567
+ }
568
+
569
+ VALUE rb_cdCanvasVertex(VALUE self,VALUE v_x,VALUE v_y)
570
+ {
571
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
572
+ int x = NUM2INT(v_x);
573
+ int y = NUM2INT(v_y);
574
+ cdCanvasVertex((cdCanvas*)NUM2UINT(v_canvas),x,y);
575
+ return Qnil;
576
+ }
577
+
578
+ VALUE rb_cdCanvasEnd(VALUE self)
579
+ {
580
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
581
+ cdCanvasEnd((cdCanvas*)NUM2UINT(v_canvas));
582
+ return Qnil;
583
+ }
584
+
585
+ VALUE rb_cdCanvasRect(VALUE self,VALUE v_xmin,VALUE v_xmax,VALUE v_ymin,VALUE v_ymax)
586
+ {
587
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
588
+ int xmin = NUM2INT(v_xmin);
589
+ int xmax = NUM2INT(v_xmax);
590
+ int ymin = NUM2INT(v_ymin);
591
+ int ymax = NUM2INT(v_ymax);
592
+ cdCanvasRect((cdCanvas*)NUM2UINT(v_canvas),xmin,xmax,ymin,ymax);
593
+ return Qnil;
594
+ }
595
+
596
+ VALUE rb_cdCanvasBox(VALUE self,VALUE v_xmin,VALUE v_xmax,VALUE v_ymin,VALUE v_ymax)
597
+ {
598
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
599
+ int xmin = NUM2INT(v_xmin);
600
+ int xmax = NUM2INT(v_xmax);
601
+ int ymin = NUM2INT(v_ymin);
602
+ int ymax = NUM2INT(v_ymax);
603
+ cdCanvasBox((cdCanvas*)NUM2UINT(v_canvas),xmin,xmax,ymin,ymax);
604
+ return Qnil;
605
+ }
606
+
607
+ VALUE rb_cdCanvasArc(VALUE self,VALUE v_xc,VALUE v_yc,VALUE v_w,VALUE v_h,VALUE v_angle1,VALUE v_angle2)
608
+ {
609
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
610
+ int xc = NUM2INT(v_xc);
611
+ int yc = NUM2INT(v_yc);
612
+ int w = NUM2INT(v_w);
613
+ int h = NUM2INT(v_h);
614
+ double angle1 = RFLOAT(v_angle1)->value;
615
+ double angle2 = RFLOAT(v_angle2)->value;
616
+ cdCanvasArc((cdCanvas*)NUM2UINT(v_canvas),xc,yc,w,h,angle1,angle2);
617
+ return Qnil;
618
+ }
619
+
620
+ VALUE rb_cdCanvasSector(VALUE self,VALUE v_xc,VALUE v_yc,VALUE v_w,VALUE v_h,VALUE v_angle1,VALUE v_angle2)
621
+ {
622
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
623
+ int xc = NUM2INT(v_xc);
624
+ int yc = NUM2INT(v_yc);
625
+ int w = NUM2INT(v_w);
626
+ int h = NUM2INT(v_h);
627
+ double angle1 = RFLOAT(v_angle1)->value;
628
+ double angle2 = RFLOAT(v_angle2)->value;
629
+ cdCanvasSector((cdCanvas*)NUM2UINT(v_canvas),xc,yc,w,h,angle1,angle2);
630
+ return Qnil;
631
+ }
632
+
633
+ VALUE rb_cdCanvasChord(VALUE self,VALUE v_xc,VALUE v_yc,VALUE v_w,VALUE v_h,VALUE v_angle1,VALUE v_angle2)
634
+ {
635
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
636
+ int xc = NUM2INT(v_xc);
637
+ int yc = NUM2INT(v_yc);
638
+ int w = NUM2INT(v_w);
639
+ int h = NUM2INT(v_h);
640
+ double angle1 = RFLOAT(v_angle1)->value;
641
+ double angle2 = RFLOAT(v_angle2)->value;
642
+ cdCanvasChord((cdCanvas*)NUM2UINT(v_canvas),xc,yc,w,h,angle1,angle2);
643
+ return Qnil;
644
+ }
645
+
646
+ VALUE rb_cdCanvasText(VALUE self,VALUE v_x,VALUE v_y,VALUE v_s)
647
+ {
648
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
649
+ int x = NUM2INT(v_x);
650
+ int y = NUM2INT(v_y);
651
+ const char* s = RSTRING(v_s)->ptr;
652
+ cdCanvasText((cdCanvas*)NUM2UINT(v_canvas),x,y,s);
653
+ return Qnil;
654
+ }
655
+
656
+ VALUE rb_cdfCanvasLine(VALUE self,VALUE v_x1,VALUE v_y1,VALUE v_x2,VALUE v_y2)
657
+ {
658
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
659
+ double x1 = RFLOAT(v_x1)->value;
660
+ double y1 = RFLOAT(v_y1)->value;
661
+ double x2 = RFLOAT(v_x2)->value;
662
+ double y2 = RFLOAT(v_y2)->value;
663
+ cdfCanvasLine((cdCanvas*)NUM2UINT(v_canvas),x1,y1,x2,y2);
664
+ return Qnil;
665
+ }
666
+
667
+ VALUE rb_cdfCanvasVertex(VALUE self,VALUE v_x,VALUE v_y)
668
+ {
669
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
670
+ double x = RFLOAT(v_x)->value;
671
+ double y = RFLOAT(v_y)->value;
672
+ cdfCanvasVertex((cdCanvas*)NUM2UINT(v_canvas),x,y);
673
+ return Qnil;
674
+ }
675
+
676
+ VALUE rb_cdfCanvasRect(VALUE self,VALUE v_xmin,VALUE v_xmax,VALUE v_ymin,VALUE v_ymax)
677
+ {
678
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
679
+ double xmin = RFLOAT(v_xmin)->value;
680
+ double xmax = RFLOAT(v_xmax)->value;
681
+ double ymin = RFLOAT(v_ymin)->value;
682
+ double ymax = RFLOAT(v_ymax)->value;
683
+ cdfCanvasRect((cdCanvas*)NUM2UINT(v_canvas),xmin,xmax,ymin,ymax);
684
+ return Qnil;
685
+ }
686
+
687
+ VALUE rb_cdfCanvasBox(VALUE self,VALUE v_xmin,VALUE v_xmax,VALUE v_ymin,VALUE v_ymax)
688
+ {
689
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
690
+ double xmin = RFLOAT(v_xmin)->value;
691
+ double xmax = RFLOAT(v_xmax)->value;
692
+ double ymin = RFLOAT(v_ymin)->value;
693
+ double ymax = RFLOAT(v_ymax)->value;
694
+ cdfCanvasBox((cdCanvas*)NUM2UINT(v_canvas),xmin,xmax,ymin,ymax);
695
+ return Qnil;
696
+ }
697
+
698
+ VALUE rb_cdfCanvasArc(VALUE self,VALUE v_xc,VALUE v_yc,VALUE v_w,VALUE v_h,VALUE v_angle1,VALUE v_angle2)
699
+ {
700
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
701
+ double xc = RFLOAT(v_xc)->value;
702
+ double yc = RFLOAT(v_yc)->value;
703
+ double w = RFLOAT(v_w)->value;
704
+ double h = RFLOAT(v_h)->value;
705
+ double angle1 = RFLOAT(v_angle1)->value;
706
+ double angle2 = RFLOAT(v_angle2)->value;
707
+ cdfCanvasArc((cdCanvas*)NUM2UINT(v_canvas),xc,yc,w,h,angle1,angle2);
708
+ return Qnil;
709
+ }
710
+
711
+ VALUE rb_cdfCanvasSector(VALUE self,VALUE v_xc,VALUE v_yc,VALUE v_w,VALUE v_h,VALUE v_angle1,VALUE v_angle2)
712
+ {
713
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
714
+ double xc = RFLOAT(v_xc)->value;
715
+ double yc = RFLOAT(v_yc)->value;
716
+ double w = RFLOAT(v_w)->value;
717
+ double h = RFLOAT(v_h)->value;
718
+ double angle1 = RFLOAT(v_angle1)->value;
719
+ double angle2 = RFLOAT(v_angle2)->value;
720
+ cdfCanvasSector((cdCanvas*)NUM2UINT(v_canvas),xc,yc,w,h,angle1,angle2);
721
+ return Qnil;
722
+ }
723
+
724
+ VALUE rb_cdfCanvasChord(VALUE self,VALUE v_xc,VALUE v_yc,VALUE v_w,VALUE v_h,VALUE v_angle1,VALUE v_angle2)
725
+ {
726
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
727
+ double xc = RFLOAT(v_xc)->value;
728
+ double yc = RFLOAT(v_yc)->value;
729
+ double w = RFLOAT(v_w)->value;
730
+ double h = RFLOAT(v_h)->value;
731
+ double angle1 = RFLOAT(v_angle1)->value;
732
+ double angle2 = RFLOAT(v_angle2)->value;
733
+ cdfCanvasChord((cdCanvas*)NUM2UINT(v_canvas),xc,yc,w,h,angle1,angle2);
734
+ return Qnil;
735
+ }
736
+
737
+ VALUE rb_cdfCanvasText(VALUE self,VALUE v_x,VALUE v_y,VALUE v_s)
738
+ {
739
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
740
+ double x = RFLOAT(v_x)->value;
741
+ double y = RFLOAT(v_y)->value;
742
+ const char* s = RSTRING(v_s)->ptr;
743
+ cdfCanvasText((cdCanvas*)NUM2UINT(v_canvas),x,y,s);
744
+ return Qnil;
745
+ }
746
+
747
+ VALUE rb_cdCanvasSetBackground(VALUE self,VALUE v_color)
748
+ {
749
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
750
+ long color = NUM2LONG(v_color);
751
+ cdCanvasSetBackground((cdCanvas*)NUM2UINT(v_canvas),color);
752
+ return Qnil;
753
+ }
754
+
755
+ VALUE rb_cdCanvasSetForeground(VALUE self,VALUE v_color)
756
+ {
757
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
758
+ long color = NUM2LONG(v_color);
759
+ cdCanvasSetForeground((cdCanvas*)NUM2UINT(v_canvas),color);
760
+ return Qnil;
761
+ }
762
+
763
+ VALUE rb_cdCanvasBackground(VALUE self,VALUE v_color)
764
+ {
765
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
766
+ long color = NUM2LONG(v_color);
767
+ long v;
768
+ v = cdCanvasBackground((cdCanvas*)NUM2UINT(v_canvas),color);
769
+ return UINT2NUM((unsigned)v);
770
+ }
771
+
772
+ VALUE rb_cdCanvasForeground(VALUE self,VALUE v_color)
773
+ {
774
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
775
+ long color = NUM2LONG(v_color);
776
+ long v;
777
+ v = cdCanvasForeground((cdCanvas*)NUM2UINT(v_canvas),color);
778
+ return UINT2NUM((unsigned)v);
779
+ }
780
+
781
+ VALUE rb_cdCanvasBackOpacity(VALUE self,VALUE v_opacity)
782
+ {
783
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
784
+ int opacity = NUM2INT(v_opacity);
785
+ int v;
786
+ v = cdCanvasBackOpacity((cdCanvas*)NUM2UINT(v_canvas),opacity);
787
+ return UINT2NUM((unsigned)v);
788
+ }
789
+
790
+ VALUE rb_cdCanvasWriteMode(VALUE self,VALUE v_mode)
791
+ {
792
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
793
+ int mode = NUM2INT(v_mode);
794
+ int v;
795
+ v = cdCanvasWriteMode((cdCanvas*)NUM2UINT(v_canvas),mode);
796
+ return UINT2NUM((unsigned)v);
797
+ }
798
+
799
+ VALUE rb_cdCanvasLineStyle(VALUE self,VALUE v_style)
800
+ {
801
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
802
+ int style = NUM2INT(v_style);
803
+ int v;
804
+ v = cdCanvasLineStyle((cdCanvas*)NUM2UINT(v_canvas),style);
805
+ return UINT2NUM((unsigned)v);
806
+ }
807
+
808
+ VALUE rb_cdCanvasLineStyleDashes(VALUE self,VALUE v_dashes)
809
+ {
810
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
811
+ int dashes[100];
812
+ int i;
813
+ int count = RARRAY(v_dashes)->len;
814
+ for(i=0;i<count;i++)
815
+ dashes[i] = NUM2INT(RARRAY(v_dashes)->ptr[i]);
816
+ cdCanvasLineStyleDashes((cdCanvas*)NUM2UINT(v_canvas),dashes,count);
817
+ return Qnil;
818
+ }
819
+
820
+ VALUE rb_cdCanvasLineWidth(VALUE self,VALUE v_width)
821
+ {
822
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
823
+ int width = NUM2INT(v_width);
824
+ int v;
825
+ v = cdCanvasLineWidth((cdCanvas*)NUM2UINT(v_canvas),width);
826
+ return UINT2NUM((unsigned)v);
827
+ }
828
+
829
+ VALUE rb_cdCanvasLineJoin(VALUE self,VALUE v_join)
830
+ {
831
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
832
+ int join = NUM2INT(v_join);
833
+ int v;
834
+ v = cdCanvasLineJoin((cdCanvas*)NUM2UINT(v_canvas),join);
835
+ return UINT2NUM((unsigned)v);
836
+ }
837
+
838
+ VALUE rb_cdCanvasLineCap(VALUE self,VALUE v_cap)
839
+ {
840
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
841
+ int cap = NUM2INT(v_cap);
842
+ int v;
843
+ v = cdCanvasLineCap((cdCanvas*)NUM2UINT(v_canvas),cap);
844
+ return UINT2NUM((unsigned)v);
845
+ }
846
+
847
+ VALUE rb_cdCanvasInteriorStyle(VALUE self,VALUE v_style)
848
+ {
849
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
850
+ int style = NUM2INT(v_style);
851
+ int v;
852
+ v = cdCanvasInteriorStyle((cdCanvas*)NUM2UINT(v_canvas),style);
853
+ return UINT2NUM((unsigned)v);
854
+ }
855
+
856
+ VALUE rb_cdCanvasHatch(VALUE self,VALUE v_style)
857
+ {
858
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
859
+ int style = NUM2INT(v_style);
860
+ int v;
861
+ v = cdCanvasHatch((cdCanvas*)NUM2UINT(v_canvas),style);
862
+ return UINT2NUM((unsigned)v);
863
+ }
864
+
865
+ VALUE rb_cdCanvasStipple(VALUE self,VALUE v_w,VALUE v_h,VALUE v_stipple)
866
+ {
867
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
868
+ int w = NUM2INT(v_w);
869
+ int h = NUM2INT(v_h);
870
+ const unsigned char* stipple = (unsigned char*)RSTRING(v_stipple)->ptr;
871
+ cdCanvasStipple((cdCanvas*)NUM2UINT(v_canvas),w,h,stipple);
872
+ return Qnil;
873
+ }
874
+
875
+ VALUE rb_cdCanvasGetStipple(VALUE self)
876
+ {
877
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
878
+ int n;
879
+ int m;
880
+ char* v;
881
+ VALUE v_r;
882
+ v = (char*)cdCanvasGetStipple((cdCanvas*)NUM2UINT(v_canvas),&n,&m);
883
+ v_r = rb_ary_new3(3,rb_str_new(v,n*m),INT2FIX(n),INT2FIX(m));
884
+ return v_r;
885
+ }
886
+
887
+ VALUE rb_cdCanvasPattern(VALUE self,VALUE v_w,VALUE v_h,VALUE v_pattern)
888
+ {
889
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
890
+ int w = NUM2INT(v_w);
891
+ int h = NUM2INT(v_h);
892
+ long int pattern[100];
893
+ int i;
894
+ for(i=0;i<w*h && i<RARRAY(v_pattern)->len;i++)
895
+ pattern[i] = NUM2LONG(RARRAY(v_pattern)->ptr[i]);
896
+ cdCanvasPattern((cdCanvas*)NUM2UINT(v_canvas),w,h,pattern);
897
+ return Qnil;
898
+ }
899
+
900
+ VALUE rb_cdCanvasGetPattern(VALUE self)
901
+ {
902
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
903
+ int n;
904
+ int m;
905
+ long* v;
906
+ int i;
907
+ VALUE v_r,v_p;
908
+ v = cdCanvasGetPattern((cdCanvas*)NUM2UINT(v_canvas),&n,&m);
909
+ v_p = rb_ary_new();
910
+ for(i=0;i<n*m;i++)
911
+ rb_ary_push(v_p,LONG2NUM(v[i]));
912
+ v_r = rb_ary_new3(3,v_p,INT2FIX(n),INT2FIX(m));
913
+ return v_r;
914
+ }
915
+
916
+ VALUE rb_cdCanvasFillMode(VALUE self,VALUE v_mode)
917
+ {
918
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
919
+ int mode = NUM2INT(v_mode);
920
+ int v;
921
+ v = cdCanvasFillMode((cdCanvas*)NUM2UINT(v_canvas),mode);
922
+ return UINT2NUM((unsigned)v);
923
+ }
924
+
925
+ VALUE rb_cdCanvasFont(VALUE self,VALUE v_type_face,VALUE v_style,VALUE v_size)
926
+ {
927
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
928
+ const char* type_face = NULL;
929
+ int style = NUM2INT(v_style);
930
+ int size = NUM2INT(v_size);
931
+ int v;
932
+ if(v_type_face!=Qnil)
933
+ type_face = RSTRING(v_type_face)->ptr;
934
+ v = cdCanvasFont((cdCanvas*)NUM2UINT(v_canvas),type_face,style,size);
935
+ return UINT2NUM((unsigned)v);
936
+ }
937
+
938
+ VALUE rb_cdCanvasGetFont(VALUE self)
939
+ {
940
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
941
+ char type_face[100];
942
+ int style;
943
+ int size;
944
+ VALUE v_r;
945
+ cdCanvasGetFont((cdCanvas*)NUM2UINT(v_canvas),type_face,&style,&size);
946
+ v_r = rb_ary_new3(3,rb_str_new2(type_face),INT2FIX(style),INT2FIX(size));
947
+ return Qnil;
948
+ }
949
+
950
+ VALUE rb_cdCanvasNativeFont(VALUE self,VALUE v_font)
951
+ {
952
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
953
+ const char* font = RSTRING(v_font)->ptr;
954
+ char* v;
955
+ v = cdCanvasNativeFont((cdCanvas*)NUM2UINT(v_canvas),font);
956
+ return rb_str_new2(v);
957
+ }
958
+
959
+ VALUE rb_cdCanvasTextAlignment(VALUE self,VALUE v_alignment)
960
+ {
961
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
962
+ int alignment = NUM2INT(v_alignment);
963
+ int v;
964
+ v = cdCanvasTextAlignment((cdCanvas*)NUM2UINT(v_canvas),alignment);
965
+ return UINT2NUM((unsigned)v);
966
+ }
967
+
968
+ VALUE rb_cdCanvasTextOrientation(VALUE self,VALUE v_angle)
969
+ {
970
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
971
+ double angle = RFLOAT(v_angle)->value;
972
+ double v;
973
+ v = cdCanvasTextOrientation((cdCanvas*)NUM2UINT(v_canvas),angle);
974
+ return UINT2NUM((unsigned)v);
975
+ }
976
+
977
+ VALUE rb_cdCanvasMarkType(VALUE self,VALUE v_type)
978
+ {
979
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
980
+ int type = NUM2INT(v_type);
981
+ int v;
982
+ v = cdCanvasMarkType((cdCanvas*)NUM2UINT(v_canvas),type);
983
+ return UINT2NUM((unsigned)v);
984
+ }
985
+
986
+ VALUE rb_cdCanvasMarkSize(VALUE self,VALUE v_size)
987
+ {
988
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
989
+ int size = NUM2INT(v_size);
990
+ int v;
991
+ v = cdCanvasMarkSize((cdCanvas*)NUM2UINT(v_canvas),size);
992
+ return UINT2NUM((unsigned)v);
993
+ }
994
+
995
+ VALUE rb_cdCanvasVectorText(VALUE self,VALUE v_x,VALUE v_y,VALUE v_s)
996
+ {
997
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
998
+ int x = NUM2INT(v_x);
999
+ int y = NUM2INT(v_y);
1000
+ const char* s = RSTRING(v_s)->ptr;
1001
+ cdCanvasVectorText((cdCanvas*)NUM2UINT(v_canvas),x,y,s);
1002
+ return Qnil;
1003
+ }
1004
+
1005
+ VALUE rb_cdCanvasMultiLineVectorText(VALUE self,VALUE v_x,VALUE v_y,VALUE v_s)
1006
+ {
1007
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1008
+ int x = NUM2INT(v_x);
1009
+ int y = NUM2INT(v_y);
1010
+ const char* s = RSTRING(v_s)->ptr;
1011
+ cdCanvasMultiLineVectorText((cdCanvas*)NUM2UINT(v_canvas),x,y,s);
1012
+ return Qnil;
1013
+ }
1014
+
1015
+ VALUE rb_cdCanvasVectorFont(VALUE self,VALUE v_filename)
1016
+ {
1017
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1018
+ const char *filename = NULL;
1019
+ char *v;
1020
+ if(v_filename!=Qnil) filename = RSTRING(v_filename)->ptr;
1021
+ v = cdCanvasVectorFont((cdCanvas*)NUM2UINT(v_canvas),filename);
1022
+ if(v==NULL) return Qnil;
1023
+ return rb_str_new2(v);
1024
+ }
1025
+
1026
+ VALUE rb_cdCanvasVectorTextDirection(VALUE self,VALUE v_x1,VALUE v_y1,VALUE v_x2,VALUE v_y2)
1027
+ {
1028
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1029
+ int x1 = NUM2INT(v_x1);
1030
+ int y1 = NUM2INT(v_y1);
1031
+ int x2 = NUM2INT(v_x2);
1032
+ int y2 = NUM2INT(v_y2);
1033
+ cdCanvasVectorTextDirection((cdCanvas*)NUM2UINT(v_canvas),x1,y1,x2,y2);
1034
+ return Qnil;
1035
+ }
1036
+
1037
+ VALUE rb_cdCanvasVectorTextTransform(VALUE self,VALUE v_matrix)
1038
+ {
1039
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1040
+ double* v;
1041
+ double *matrix = NULL;
1042
+ int i;
1043
+ VALUE v_r;
1044
+ if(v_matrix!=Qnil) {
1045
+ matrix = xmalloc(sizeof(double)*6);
1046
+ for(i=0;i<RARRAY(v_matrix)->len && i<6;i++)
1047
+ matrix[i] = RFLOAT(RARRAY(v_matrix)->ptr[i])->value;
1048
+ }
1049
+ v = cdCanvasVectorTextTransform((cdCanvas*)NUM2UINT(v_canvas),matrix);
1050
+ if(matrix) free(matrix);
1051
+ v_r = rb_ary_new();
1052
+ for(i=0;i<6;i++)
1053
+ rb_ary_push(v_r,rb_float_new(v[i]));
1054
+ return v_r;
1055
+ }
1056
+
1057
+ VALUE rb_cdCanvasVectorTextSize(VALUE self,VALUE v_size_x,VALUE v_size_y,VALUE v_s)
1058
+ {
1059
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1060
+ int size_x = NUM2INT(v_size_x);
1061
+ int size_y = NUM2INT(v_size_y);
1062
+ const char* s = RSTRING(v_s)->ptr;
1063
+ cdCanvasVectorTextSize((cdCanvas*)NUM2UINT(v_canvas),size_x,size_y,s);
1064
+ return Qnil;
1065
+ }
1066
+
1067
+ VALUE rb_cdCanvasVectorCharSize(VALUE self,VALUE v_size)
1068
+ {
1069
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1070
+ int size = NUM2INT(v_size);
1071
+ int v;
1072
+ v = cdCanvasVectorCharSize((cdCanvas*)NUM2UINT(v_canvas),size);
1073
+ return UINT2NUM((unsigned)v);
1074
+ }
1075
+
1076
+ VALUE rb_cdCanvasGetVectorTextSize(VALUE self,VALUE v_s)
1077
+ {
1078
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1079
+ const char* s = RSTRING(v_s)->ptr;
1080
+ int x;
1081
+ int y;
1082
+ VALUE v_r;
1083
+ cdCanvasGetVectorTextSize((cdCanvas*)NUM2UINT(v_canvas),s,&x,&y);
1084
+ v_r = rb_ary_new3(2,INT2FIX(x),INT2FIX(y));
1085
+ return Qnil;
1086
+ }
1087
+
1088
+ VALUE rb_cdCanvasGetVectorTextBounds(VALUE self,VALUE v_s,VALUE v_x,VALUE v_y)
1089
+ {
1090
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1091
+ const char* s = RSTRING(v_s)->ptr;
1092
+ int x = NUM2INT(v_x);
1093
+ int y = NUM2INT(v_y);
1094
+ int rect[8];
1095
+ VALUE v_r;
1096
+ int i;
1097
+ cdCanvasGetVectorTextBounds((cdCanvas*)NUM2UINT(v_canvas),s,x,y,rect);
1098
+ v_r = rb_ary_new();
1099
+ for(i=0;i<8;i++)
1100
+ rb_ary_push(v_r,INT2FIX(rect[i]));
1101
+ return v_r;
1102
+ }
1103
+
1104
+ VALUE rb_cdCanvasGetFontDim(VALUE self)
1105
+ {
1106
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1107
+ int max_width;
1108
+ int height;
1109
+ int ascent;
1110
+ int descent;
1111
+ VALUE v_r;
1112
+ cdCanvasGetFontDim((cdCanvas*)NUM2UINT(v_canvas),&max_width,&height,&ascent,&descent);
1113
+ v_r = rb_ary_new3(4,INT2FIX(max_width),INT2FIX(height),INT2FIX(ascent),INT2FIX(descent));
1114
+ return v_r;
1115
+ }
1116
+
1117
+ VALUE rb_cdCanvasGetTextSize(VALUE self,VALUE v_s)
1118
+ {
1119
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1120
+ const char* s = RSTRING(v_s)->ptr;
1121
+ int width;
1122
+ int height;
1123
+ VALUE v_r;
1124
+ cdCanvasGetTextSize((cdCanvas*)NUM2UINT(v_canvas),s,&width,&height);
1125
+ v_r = rb_ary_new3(2,INT2FIX(width),INT2FIX(height));
1126
+ return v_r;
1127
+ }
1128
+
1129
+ VALUE rb_cdCanvasGetTextBox(VALUE self,VALUE v_x,VALUE v_y,VALUE v_s)
1130
+ {
1131
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1132
+ int x = NUM2INT(v_x);
1133
+ int y = NUM2INT(v_y);
1134
+ const char* s = RSTRING(v_s)->ptr;
1135
+ int xmin;
1136
+ int xmax;
1137
+ int ymin;
1138
+ int ymax;
1139
+ VALUE v_r;
1140
+ cdCanvasGetTextBox((cdCanvas*)NUM2UINT(v_canvas),x,y,s,&xmin,&xmax,&ymin,&ymax);
1141
+ v_r = rb_ary_new3(4,INT2FIX(xmin),INT2FIX(xmax),INT2FIX(ymin),INT2FIX(ymax));
1142
+ return v_r;
1143
+ }
1144
+
1145
+ VALUE rb_cdCanvasGetTextBounds(VALUE self,VALUE v_x,VALUE v_y,VALUE v_s)
1146
+ {
1147
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1148
+ int x = NUM2INT(v_x);
1149
+ int y = NUM2INT(v_y);
1150
+ const char* s = RSTRING(v_s)->ptr;
1151
+ int rect[8];
1152
+ VALUE v_r;
1153
+ int i;
1154
+ cdCanvasGetTextBounds((cdCanvas*)NUM2UINT(v_canvas),x,y,s,rect);
1155
+ v_r = rb_ary_new();
1156
+ for(i=0;i<8;i++)
1157
+ rb_ary_push(v_r,INT2FIX(rect[i]));
1158
+ return v_r;
1159
+ }
1160
+
1161
+ VALUE rb_cdCanvasGetColorPlanes(VALUE self)
1162
+ {
1163
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1164
+ int v;
1165
+ v = cdCanvasGetColorPlanes((cdCanvas*)NUM2UINT(v_canvas));
1166
+ return UINT2NUM((unsigned)v);
1167
+ }
1168
+
1169
+ VALUE rb_cdCanvasPalette(VALUE self,VALUE v_palette,VALUE v_mode)
1170
+ {
1171
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1172
+ int n = RARRAY(v_palette)->len;
1173
+ long int *palette = xmalloc(n*sizeof(long));
1174
+ int mode = NUM2INT(v_mode);
1175
+ int i;
1176
+ for(i=0;i<n;i++)
1177
+ palette[i] = NUM2LONG(RARRAY(v_palette)->ptr[i]);
1178
+ cdCanvasPalette((cdCanvas*)NUM2UINT(v_canvas),n,palette,mode);
1179
+ free(palette);
1180
+ return Qnil;
1181
+ }
1182
+
1183
+ VALUE rb_cdCanvasGetImageRGB(VALUE self,VALUE v_x,VALUE v_y,VALUE v_w,VALUE v_h)
1184
+ {
1185
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1186
+ int x = NUM2INT(v_x);
1187
+ int y = NUM2INT(v_y);
1188
+ int w = NUM2INT(v_w);
1189
+ int h = NUM2INT(v_h);
1190
+ unsigned char* r = (unsigned char*)xmalloc(w*h);
1191
+ unsigned char* g = (unsigned char*)xmalloc(w*h);
1192
+ unsigned char* b = (unsigned char*)xmalloc(w*h);
1193
+ VALUE v_r;
1194
+ cdCanvasGetImageRGB((cdCanvas*)NUM2UINT(v_canvas),r,g,b,x,y,w,h);
1195
+ v_r = rb_ary_new3(rb_str_new((char*)r,w*h),rb_str_new((char*)g,w*h),rb_str_new((char*)b,w*h));
1196
+ free(r);
1197
+ free(g);
1198
+ free(b);
1199
+ return v_r;
1200
+ }
1201
+
1202
+ VALUE rb_cdCanvasPutImageRectRGB(VALUE self,VALUE v_iw,VALUE v_ih,VALUE v_r,VALUE v_g,VALUE v_b,VALUE v_x,VALUE v_y,VALUE v_w,VALUE v_h,VALUE v_xmin,VALUE v_xmax,VALUE v_ymin,VALUE v_ymax)
1203
+ {
1204
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1205
+ int iw = NUM2INT(v_iw);
1206
+ int ih = NUM2INT(v_ih);
1207
+ const unsigned char* r = (unsigned char*)RSTRING(v_r)->ptr;
1208
+ const unsigned char* g = (unsigned char*)RSTRING(v_g)->ptr;
1209
+ const unsigned char* b = (unsigned char*)RSTRING(v_b)->ptr;
1210
+ int x = NUM2INT(v_x);
1211
+ int y = NUM2INT(v_y);
1212
+ int w = NUM2INT(v_w);
1213
+ int h = NUM2INT(v_h);
1214
+ int xmin = NUM2INT(v_xmin);
1215
+ int xmax = NUM2INT(v_xmax);
1216
+ int ymin = NUM2INT(v_ymin);
1217
+ int ymax = NUM2INT(v_ymax);
1218
+ cdCanvasPutImageRectRGB((cdCanvas*)NUM2UINT(v_canvas),iw,ih,r,g,b,x,y,w,h,xmin,xmax,ymin,ymax);
1219
+ return Qnil;
1220
+ }
1221
+
1222
+ VALUE rb_cdCanvasPutImageRectRGBA(VALUE self,VALUE v_iw,VALUE v_ih,VALUE v_r,VALUE v_g,VALUE v_b,VALUE v_a,VALUE v_x,VALUE v_y,VALUE v_w,VALUE v_h,VALUE v_xmin,VALUE v_xmax,VALUE v_ymin,VALUE v_ymax)
1223
+ {
1224
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1225
+ int iw = NUM2INT(v_iw);
1226
+ int ih = NUM2INT(v_ih);
1227
+ const unsigned char* r = (unsigned char*)RSTRING(v_r)->ptr;
1228
+ const unsigned char* g = (unsigned char*)RSTRING(v_g)->ptr;
1229
+ const unsigned char* b = (unsigned char*)RSTRING(v_b)->ptr;
1230
+ const unsigned char* a = NULL;
1231
+ int x = NUM2INT(v_x);
1232
+ int y = NUM2INT(v_y);
1233
+ int w = NUM2INT(v_w);
1234
+ int h = NUM2INT(v_h);
1235
+ int xmin = NUM2INT(v_xmin);
1236
+ int xmax = NUM2INT(v_xmax);
1237
+ int ymin = NUM2INT(v_ymin);
1238
+ int ymax = NUM2INT(v_ymax);
1239
+ if(v_a!=Qnil) a = (unsigned char*)RSTRING(v_a)->ptr;
1240
+ cdCanvasPutImageRectRGBA((cdCanvas*)NUM2UINT(v_canvas),iw,ih,r,g,b,a,x,y,w,h,xmin,xmax,ymin,ymax);
1241
+ return Qnil;
1242
+ }
1243
+
1244
+ VALUE rb_cdCanvasPutImageRectMap(VALUE self,VALUE v_iw,VALUE v_ih,VALUE v_index,VALUE v_colors,VALUE v_x,VALUE v_y,VALUE v_w,VALUE v_h,VALUE v_xmin,VALUE v_xmax,VALUE v_ymin,VALUE v_ymax)
1245
+ {
1246
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1247
+ int iw = NUM2INT(v_iw);
1248
+ int ih = NUM2INT(v_ih);
1249
+ const unsigned char* index = (unsigned char*)RSTRING(v_index)->ptr;
1250
+ long int *colors = xmalloc(RARRAY(v_colors)->len*sizeof(long));
1251
+ int x = NUM2INT(v_x);
1252
+ int y = NUM2INT(v_y);
1253
+ int w = NUM2INT(v_w);
1254
+ int h = NUM2INT(v_h);
1255
+ int xmin = NUM2INT(v_xmin);
1256
+ int xmax = NUM2INT(v_xmax);
1257
+ int ymin = NUM2INT(v_ymin);
1258
+ int ymax = NUM2INT(v_ymax);
1259
+ int i;
1260
+ for(i=0;i<RARRAY(v_colors)->len;i++)
1261
+ colors[i] = NUM2LONG(RARRAY(v_colors)->ptr[i]);
1262
+ cdCanvasPutImageRectMap((cdCanvas*)NUM2UINT(v_canvas),iw,ih,index,colors,x,y,w,h,xmin,xmax,ymin,ymax);
1263
+ free(colors);
1264
+ return Qnil;
1265
+ }
1266
+
1267
+ VALUE rb_cdCanvasCreateImage(VALUE self,VALUE v_w,VALUE v_h)
1268
+ {
1269
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1270
+ int w = NUM2INT(v_w);
1271
+ int h = NUM2INT(v_h);
1272
+ cdImage* v;
1273
+ v = cdCanvasCreateImage((cdCanvas*)NUM2UINT(v_canvas),w,h);
1274
+ return UINT2NUM((unsigned)v);
1275
+ }
1276
+
1277
+ VALUE rb_cdKillImage(VALUE self,VALUE v_image)
1278
+ {
1279
+ cdImage* image = (cdImage*)NUM2UINT(v_image);
1280
+ cdKillImage(image);
1281
+ return Qnil;
1282
+ }
1283
+
1284
+ VALUE rb_cdCanvasGetImage(VALUE self,VALUE v_image,VALUE v_x,VALUE v_y)
1285
+ {
1286
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1287
+ int x = NUM2INT(v_x);
1288
+ int y = NUM2INT(v_y);
1289
+ cdImage* image = (cdImage*)NUM2UINT(v_image);
1290
+ cdCanvasGetImage((cdCanvas*)NUM2UINT(v_canvas),image,x,y);
1291
+ return Qnil;
1292
+ }
1293
+
1294
+ VALUE rb_cdCanvasPutImageRect(VALUE self,VALUE v_image,VALUE v_x,VALUE v_y,VALUE v_xmin,VALUE v_xmax,VALUE v_ymin,VALUE v_ymax)
1295
+ {
1296
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1297
+ int x = NUM2INT(v_x);
1298
+ int y = NUM2INT(v_y);
1299
+ int xmin = NUM2INT(v_xmin);
1300
+ int xmax = NUM2INT(v_xmax);
1301
+ int ymin = NUM2INT(v_ymin);
1302
+ int ymax = NUM2INT(v_ymax);
1303
+ cdImage* image = (cdImage*)NUM2UINT(v_image);
1304
+ cdCanvasPutImageRect((cdCanvas*)NUM2UINT(v_canvas),image,x,y,xmin,xmax,ymin,ymax);
1305
+ return Qnil;
1306
+ }
1307
+
1308
+ VALUE rb_cdCanvasScrollArea(VALUE self,VALUE v_xmin,VALUE v_xmax,VALUE v_ymin,VALUE v_ymax,VALUE v_dx,VALUE v_dy)
1309
+ {
1310
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1311
+ int xmin = NUM2INT(v_xmin);
1312
+ int xmax = NUM2INT(v_xmax);
1313
+ int ymin = NUM2INT(v_ymin);
1314
+ int ymax = NUM2INT(v_ymax);
1315
+ int dx = NUM2INT(v_dx);
1316
+ int dy = NUM2INT(v_dy);
1317
+ cdCanvasScrollArea((cdCanvas*)NUM2UINT(v_canvas),xmin,xmax,ymin,ymax,dx,dy);
1318
+ return Qnil;
1319
+ }
1320
+
1321
+ VALUE rb_cdCreateBitmap(VALUE self,VALUE v_w,VALUE v_h,VALUE v_type)
1322
+ {
1323
+ int w = NUM2INT(v_w);
1324
+ int h = NUM2INT(v_h);
1325
+ int type = NUM2INT(v_type);
1326
+ cdBitmap* v;
1327
+ v = cdCreateBitmap(w,h,type);
1328
+ return UINT2NUM((unsigned)v);
1329
+ }
1330
+
1331
+ VALUE rb_cdInitBitmap(int argc,VALUE *argv,VALUE self)
1332
+ {
1333
+ int w = NUM2INT(argv[0]);
1334
+ int h = NUM2INT(argv[1]);
1335
+ int type = NUM2INT(argv[2]);
1336
+ cdBitmap* v;
1337
+ unsigned char* red = NULL;
1338
+ unsigned char* green = NULL;
1339
+ unsigned char* blue = NULL;
1340
+ unsigned char* alpha = NULL;
1341
+ unsigned char* index = NULL;
1342
+ long int* colors = NULL;
1343
+ int i;
1344
+ if(type==CD_RGBA) {
1345
+ red = (unsigned char*)RSTRING(argv[3])->ptr;
1346
+ green = (unsigned char*)RSTRING(argv[4])->ptr;
1347
+ blue = (unsigned char*)RSTRING(argv[5])->ptr;
1348
+ alpha = (unsigned char*)RSTRING(argv[6])->ptr;
1349
+ v = cdInitBitmap(w,h,type,red,green,blue,alpha);
1350
+ }
1351
+ else if(type==CD_RGB) {
1352
+ red = (unsigned char*)RSTRING(argv[3])->ptr;
1353
+ green = (unsigned char*)RSTRING(argv[4])->ptr;
1354
+ blue = (unsigned char*)RSTRING(argv[5])->ptr;
1355
+ v = cdInitBitmap(w,h,type,red,green,blue);
1356
+ }
1357
+ else if(type==CD_MAP) {
1358
+ index = (unsigned char*)RSTRING(argv[5])->ptr;
1359
+ colors = xmalloc(RARRAY(argv[4])->len);
1360
+ for(i=0;i<RARRAY(argv[4])->len;i++)
1361
+ colors[i] = RARRAY(argv[4])->ptr[i];
1362
+ v = cdInitBitmap(w,h,type,index,colors);
1363
+ }
1364
+ else {
1365
+ rb_raise(rb_eArgError,"Invalid Argument");
1366
+ }
1367
+ if(colors) free(colors);
1368
+ return UINT2NUM((unsigned)v);
1369
+ }
1370
+
1371
+
1372
+ VALUE rb_cdKillBitmap(VALUE self,VALUE v_bitmap)
1373
+ {
1374
+ cdKillBitmap((cdBitmap*)NUM2UINT(v_bitmap));
1375
+ return Qnil;
1376
+ }
1377
+
1378
+ VALUE rb_cdBitmapGetData(VALUE self,VALUE v_bitmap,VALUE v_dataptr)
1379
+ {
1380
+ int dataptr = NUM2INT(v_dataptr);
1381
+ char* v;
1382
+ v = (char*)cdBitmapGetData((cdBitmap*)NUM2UINT(v_bitmap),dataptr);
1383
+ return rb_str_new2(v);
1384
+ }
1385
+
1386
+ VALUE rb_cdBitmapSetRect(VALUE self,VALUE v_bitmap,VALUE v_xmin,VALUE v_xmax,VALUE v_ymin,VALUE v_ymax)
1387
+ {
1388
+ int xmin = NUM2INT(v_xmin);
1389
+ int xmax = NUM2INT(v_xmax);
1390
+ int ymin = NUM2INT(v_ymin);
1391
+ int ymax = NUM2INT(v_ymax);
1392
+ cdBitmapSetRect((cdBitmap*)NUM2UINT(v_bitmap),xmin,xmax,ymin,ymax);
1393
+ return Qnil;
1394
+ }
1395
+
1396
+ VALUE rb_cdCanvasPutBitmap(VALUE self,VALUE v_bitmap,VALUE v_x,VALUE v_y,VALUE v_w,VALUE v_h)
1397
+ {
1398
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1399
+ int x = NUM2INT(v_x);
1400
+ int y = NUM2INT(v_y);
1401
+ int w = NUM2INT(v_w);
1402
+ int h = NUM2INT(v_h);
1403
+ cdBitmap* bitmap = (cdBitmap*)NUM2UINT(v_bitmap);
1404
+ cdCanvasPutBitmap((cdCanvas*)NUM2UINT(v_canvas),bitmap,x,y,w,h);
1405
+ return Qnil;
1406
+ }
1407
+
1408
+ VALUE rb_cdCanvasGetBitmap(VALUE self,VALUE v_bitmap,VALUE v_x,VALUE v_y)
1409
+ {
1410
+ VALUE v_canvas = rb_iv_get(self,"@canvas");
1411
+ int x = NUM2INT(v_x);
1412
+ int y = NUM2INT(v_y);
1413
+ cdBitmap* bitmap = (cdBitmap*)NUM2UINT(v_bitmap);
1414
+ cdCanvasGetBitmap((cdCanvas*)NUM2UINT(v_canvas),bitmap,x,y);
1415
+ return Qnil;
1416
+ }
1417
+
1418
+ VALUE rb_cdBitmapRGB2Map(VALUE self,VALUE v_bitmap_rgb,VALUE v_bitmap_map)
1419
+ {
1420
+ cdBitmapRGB2Map((cdBitmap*)NUM2UINT(v_bitmap_rgb),(cdBitmap*)NUM2UINT(v_bitmap_map));
1421
+ return Qnil;
1422
+ }
1423
+
1424
+ VALUE rb_cdEncodeColor(VALUE self,VALUE v_red,VALUE v_green,VALUE v_blue)
1425
+ {
1426
+ unsigned char red = (unsigned char)NUM2INT(v_red);
1427
+ unsigned char green = (unsigned char)NUM2INT(v_green);
1428
+ unsigned char blue = (unsigned char)NUM2INT(v_blue);
1429
+ long v;
1430
+ v = cdEncodeColor(red,green,blue);
1431
+ return LONG2NUM(v);
1432
+ }
1433
+
1434
+ VALUE rb_cdDecodeColor(VALUE self,VALUE v_color)
1435
+ {
1436
+ unsigned char red;
1437
+ unsigned char green;
1438
+ unsigned char blue;
1439
+ VALUE v_r;
1440
+ cdDecodeColor((long)NUM2LONG(v_color),&red,&green,&blue);
1441
+ v_r = rb_ary_new3(3,INT2FIX(red),INT2FIX(green),INT2FIX(blue));
1442
+ return v_r;
1443
+ }
1444
+
1445
+ VALUE rb_cdDecodeAlpha(VALUE self,VALUE v_color)
1446
+ {
1447
+ char v;
1448
+ v = cdDecodeAlpha((long)NUM2LONG(v_color));
1449
+ return UINT2NUM((unsigned)v);
1450
+ }
1451
+
1452
+ VALUE rb_cdEncodeAlpha(VALUE self,VALUE v_color,VALUE v_alpha)
1453
+ {
1454
+ unsigned char alpha = (unsigned char)NUM2INT(v_alpha);
1455
+ long v;
1456
+ v = cdEncodeAlpha((long)NUM2LONG(v_color),alpha);
1457
+ return LONG2NUM(v);
1458
+ }
1459
+
1460
+ VALUE rb_cdAlpha(VALUE self,VALUE v_color)
1461
+ {
1462
+ char v;
1463
+ v = cdAlpha(NUM2LONG(v_color));
1464
+ return UINT2NUM((unsigned)v);
1465
+ }
1466
+
1467
+ VALUE rb_cdReserved(VALUE self,VALUE v_color)
1468
+ {
1469
+ char v;
1470
+ v = cdReserved(NUM2LONG(v_color));
1471
+ return UINT2NUM((unsigned)v);
1472
+ }
1473
+
1474
+ VALUE rb_cdRed(VALUE self,VALUE v_color)
1475
+ {
1476
+ char v;
1477
+ v = cdRed(NUM2LONG(v_color));
1478
+ return UINT2NUM((unsigned)v);
1479
+ }
1480
+
1481
+ VALUE rb_cdGreen(VALUE self,VALUE v_color)
1482
+ {
1483
+ char v;
1484
+ v = cdGreen(NUM2LONG(v_color));
1485
+ return UINT2NUM((unsigned)v);
1486
+ }
1487
+
1488
+ VALUE rb_cdBlue(VALUE self,VALUE v_color)
1489
+ {
1490
+ char v;
1491
+ v = cdBlue(NUM2LONG(v_color));
1492
+ return UINT2NUM((unsigned)v);
1493
+ }
1494
+
1495
+ VALUE rb_cdRGB2Map(VALUE self,VALUE v_width,VALUE v_height,VALUE v_red,VALUE v_green,VALUE v_blue,VALUE v_index,VALUE v_pal_size,VALUE v_color)
1496
+ {
1497
+ int width = NUM2INT(v_width);
1498
+ int height = NUM2INT(v_height);
1499
+ const unsigned char* red = (unsigned char*)RSTRING(v_red)->ptr;
1500
+ const unsigned char* green = (unsigned char*)RSTRING(v_green)->ptr;
1501
+ const unsigned char* blue = (unsigned char*)RSTRING(v_blue)->ptr;
1502
+ unsigned char* index = (unsigned char*)RSTRING(v_index)->ptr;
1503
+ int pal_size = NUM2INT(v_pal_size);
1504
+ int i;
1505
+ long *color = xmalloc(RARRAY(v_color)->len*sizeof(long));
1506
+ for(i=0;i<RARRAY(v_color)->len;i++)
1507
+ color[i] = NUM2LONG(RARRAY(v_color)->ptr[i]);
1508
+ cdRGB2Map(width,height,red,green,blue,index,pal_size,color);
1509
+ free(color);
1510
+ return Qnil;
1511
+ }
1512
+
1513
+ VALUE rb_cdContextIup()
1514
+ {
1515
+ cdContext* v;
1516
+ v = cdContextIup();
1517
+ return UINT2NUM((unsigned)v);
1518
+ }
1519
+
1520
+ VALUE rb_cdContextPDF()
1521
+ {
1522
+ cdContext* v;
1523
+ v = cdContextPDF();
1524
+ return UINT2NUM((unsigned)v);
1525
+ }