rdp-rmagick 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (388) hide show
  1. data/ChangeLog +769 -0
  2. data/Doxyfile +1514 -0
  3. data/README-Mac-OSX.txt +1 -0
  4. data/README.md +231 -0
  5. data/build_tarball.rake +215 -0
  6. data/doc/comtasks.html +287 -0
  7. data/doc/constants.html +1581 -0
  8. data/doc/css/doc.css +299 -0
  9. data/doc/css/popup.css +34 -0
  10. data/doc/css/ref.css +67 -0
  11. data/doc/draw.html +3269 -0
  12. data/doc/ex/InitialCoords.rb +23 -0
  13. data/doc/ex/NewCoordSys.rb +32 -0
  14. data/doc/ex/OrigCoordSys.rb +18 -0
  15. data/doc/ex/PreserveAspectRatio.rb +205 -0
  16. data/doc/ex/RotateScale.rb +37 -0
  17. data/doc/ex/Skew.rb +38 -0
  18. data/doc/ex/Use01.rb +16 -0
  19. data/doc/ex/Use02.rb +21 -0
  20. data/doc/ex/Use03.rb +16 -0
  21. data/doc/ex/ViewBox.rb +33 -0
  22. data/doc/ex/adaptive_threshold.rb +10 -0
  23. data/doc/ex/add_noise.rb +17 -0
  24. data/doc/ex/affine.rb +48 -0
  25. data/doc/ex/affine_transform.rb +20 -0
  26. data/doc/ex/arc.rb +49 -0
  27. data/doc/ex/arcpath.rb +33 -0
  28. data/doc/ex/arcs01.rb +28 -0
  29. data/doc/ex/arcs02.rb +61 -0
  30. data/doc/ex/average.rb +15 -0
  31. data/doc/ex/axes.rb +64 -0
  32. data/doc/ex/baseline_shift01.rb +18 -0
  33. data/doc/ex/bilevel_channel.rb +9 -0
  34. data/doc/ex/blur_image.rb +12 -0
  35. data/doc/ex/border.rb +10 -0
  36. data/doc/ex/bounding_box.rb +44 -0
  37. data/doc/ex/cbezier1.rb +42 -0
  38. data/doc/ex/cbezier2.rb +42 -0
  39. data/doc/ex/cbezier3.rb +42 -0
  40. data/doc/ex/cbezier4.rb +43 -0
  41. data/doc/ex/cbezier5.rb +43 -0
  42. data/doc/ex/cbezier6.rb +53 -0
  43. data/doc/ex/channel.rb +26 -0
  44. data/doc/ex/charcoal.rb +12 -0
  45. data/doc/ex/chop.rb +29 -0
  46. data/doc/ex/circle.rb +33 -0
  47. data/doc/ex/circle01.rb +17 -0
  48. data/doc/ex/clip_path.rb +60 -0
  49. data/doc/ex/coalesce.rb +60 -0
  50. data/doc/ex/color_fill_to_border.rb +29 -0
  51. data/doc/ex/color_floodfill.rb +28 -0
  52. data/doc/ex/color_histogram.rb +48 -0
  53. data/doc/ex/color_reset.rb +11 -0
  54. data/doc/ex/colorize.rb +16 -0
  55. data/doc/ex/colors.rb +64 -0
  56. data/doc/ex/compose_mask.rb +23 -0
  57. data/doc/ex/composite.rb +135 -0
  58. data/doc/ex/composite_layers.rb +53 -0
  59. data/doc/ex/composite_tiled.rb +23 -0
  60. data/doc/ex/contrast.rb +36 -0
  61. data/doc/ex/crop.rb +31 -0
  62. data/doc/ex/crop_with_gravity.rb +46 -0
  63. data/doc/ex/cubic01.rb +45 -0
  64. data/doc/ex/cubic02.rb +94 -0
  65. data/doc/ex/cycle_colormap.rb +21 -0
  66. data/doc/ex/dissolve.rb +13 -0
  67. data/doc/ex/drawcomp.rb +42 -0
  68. data/doc/ex/drop_shadow.rb +60 -0
  69. data/doc/ex/edge.rb +11 -0
  70. data/doc/ex/ellipse.rb +45 -0
  71. data/doc/ex/ellipse01.rb +22 -0
  72. data/doc/ex/emboss.rb +11 -0
  73. data/doc/ex/enhance.rb +28 -0
  74. data/doc/ex/equalize.rb +11 -0
  75. data/doc/ex/evenodd.rb +43 -0
  76. data/doc/ex/fill_pattern.rb +26 -0
  77. data/doc/ex/flatten_images.rb +36 -0
  78. data/doc/ex/flip.rb +11 -0
  79. data/doc/ex/flop.rb +11 -0
  80. data/doc/ex/font_styles.rb +34 -0
  81. data/doc/ex/fonts.rb +20 -0
  82. data/doc/ex/frame.rb +12 -0
  83. data/doc/ex/gaussian_blur.rb +11 -0
  84. data/doc/ex/get_multiline_type_metrics.rb +42 -0
  85. data/doc/ex/get_pixels.rb +48 -0
  86. data/doc/ex/get_type_metrics.rb +146 -0
  87. data/doc/ex/gradientfill.rb +27 -0
  88. data/doc/ex/grav.rb +46 -0
  89. data/doc/ex/gravity.rb +79 -0
  90. data/doc/ex/group.rb +26 -0
  91. data/doc/ex/hatchfill.rb +27 -0
  92. data/doc/ex/image.rb +46 -0
  93. data/doc/ex/images/Apple.miff +0 -0
  94. data/doc/ex/images/Ballerina.jpg +0 -0
  95. data/doc/ex/images/Ballerina3.jpg +0 -0
  96. data/doc/ex/images/Button_0.gif +0 -0
  97. data/doc/ex/images/Button_1.gif +0 -0
  98. data/doc/ex/images/Button_2.gif +0 -0
  99. data/doc/ex/images/Button_3.gif +0 -0
  100. data/doc/ex/images/Button_4.gif +0 -0
  101. data/doc/ex/images/Button_5.gif +0 -0
  102. data/doc/ex/images/Button_6.gif +0 -0
  103. data/doc/ex/images/Button_7.gif +0 -0
  104. data/doc/ex/images/Button_8.gif +0 -0
  105. data/doc/ex/images/Button_9.gif +0 -0
  106. data/doc/ex/images/Button_A.gif +0 -0
  107. data/doc/ex/images/Button_B.gif +0 -0
  108. data/doc/ex/images/Button_C.gif +0 -0
  109. data/doc/ex/images/Button_D.gif +0 -0
  110. data/doc/ex/images/Button_E.gif +0 -0
  111. data/doc/ex/images/Button_F.gif +0 -0
  112. data/doc/ex/images/Button_G.gif +0 -0
  113. data/doc/ex/images/Button_H.gif +0 -0
  114. data/doc/ex/images/Button_I.gif +0 -0
  115. data/doc/ex/images/Button_J.gif +0 -0
  116. data/doc/ex/images/Button_K.gif +0 -0
  117. data/doc/ex/images/Button_L.gif +0 -0
  118. data/doc/ex/images/Button_M.gif +0 -0
  119. data/doc/ex/images/Button_N.gif +0 -0
  120. data/doc/ex/images/Button_O.gif +0 -0
  121. data/doc/ex/images/Button_P.gif +0 -0
  122. data/doc/ex/images/Button_Q.gif +0 -0
  123. data/doc/ex/images/Button_R.gif +0 -0
  124. data/doc/ex/images/Button_S.gif +0 -0
  125. data/doc/ex/images/Button_T.gif +0 -0
  126. data/doc/ex/images/Button_U.gif +0 -0
  127. data/doc/ex/images/Button_V.gif +0 -0
  128. data/doc/ex/images/Button_W.gif +0 -0
  129. data/doc/ex/images/Button_X.gif +0 -0
  130. data/doc/ex/images/Button_Y.gif +0 -0
  131. data/doc/ex/images/Button_Z.gif +0 -0
  132. data/doc/ex/images/Cheetah.jpg +0 -0
  133. data/doc/ex/images/Coffee.wmf +0 -0
  134. data/doc/ex/images/Flower_Hat.jpg +0 -0
  135. data/doc/ex/images/Gold_Statue.jpg +0 -0
  136. data/doc/ex/images/Hot_Air_Balloons.jpg +0 -0
  137. data/doc/ex/images/Hot_Air_Balloons_H.jpg +0 -0
  138. data/doc/ex/images/Leaf.miff +0 -0
  139. data/doc/ex/images/No.wmf +0 -0
  140. data/doc/ex/images/Polynesia.jpg +0 -0
  141. data/doc/ex/images/Red_Rocks.jpg +0 -0
  142. data/doc/ex/images/Rocks_On_Beach.miff +0 -0
  143. data/doc/ex/images/Shorts.jpg +0 -0
  144. data/doc/ex/images/Snake.wmf +0 -0
  145. data/doc/ex/images/Violin.jpg +0 -0
  146. data/doc/ex/images/Yellow_Rose.miff +0 -0
  147. data/doc/ex/images/big-duck.gif +0 -0
  148. data/doc/ex/images/duck.gif +0 -0
  149. data/doc/ex/images/duck0.gif +0 -0
  150. data/doc/ex/images/duck1.gif +0 -0
  151. data/doc/ex/images/duck10.gif +0 -0
  152. data/doc/ex/images/duck11.gif +0 -0
  153. data/doc/ex/images/duck12.gif +0 -0
  154. data/doc/ex/images/duck13.gif +0 -0
  155. data/doc/ex/images/duck14.gif +0 -0
  156. data/doc/ex/images/duck15.gif +0 -0
  157. data/doc/ex/images/duck2.gif +0 -0
  158. data/doc/ex/images/duck3.gif +0 -0
  159. data/doc/ex/images/duck4.gif +0 -0
  160. data/doc/ex/images/duck5.gif +0 -0
  161. data/doc/ex/images/duck6.gif +0 -0
  162. data/doc/ex/images/duck7.gif +0 -0
  163. data/doc/ex/images/duck8.gif +0 -0
  164. data/doc/ex/images/duck9.gif +0 -0
  165. data/doc/ex/images/graydient230x6.gif +0 -0
  166. data/doc/ex/images/logo400x83.gif +0 -0
  167. data/doc/ex/images/model.miff +0 -0
  168. data/doc/ex/images/notimplemented.gif +0 -0
  169. data/doc/ex/images/smile.miff +0 -0
  170. data/doc/ex/images/spin.gif +0 -0
  171. data/doc/ex/implode.rb +34 -0
  172. data/doc/ex/level.rb +11 -0
  173. data/doc/ex/level_colors.rb +11 -0
  174. data/doc/ex/line.rb +42 -0
  175. data/doc/ex/line01.rb +23 -0
  176. data/doc/ex/mask.rb +36 -0
  177. data/doc/ex/matte_fill_to_border.rb +40 -0
  178. data/doc/ex/matte_floodfill.rb +33 -0
  179. data/doc/ex/matte_replace.rb +40 -0
  180. data/doc/ex/median_filter.rb +28 -0
  181. data/doc/ex/modulate.rb +11 -0
  182. data/doc/ex/mono.rb +23 -0
  183. data/doc/ex/morph.rb +26 -0
  184. data/doc/ex/mosaic.rb +35 -0
  185. data/doc/ex/motion_blur.rb +11 -0
  186. data/doc/ex/negate.rb +11 -0
  187. data/doc/ex/negate_channel.rb +9 -0
  188. data/doc/ex/nested_rvg.rb +21 -0
  189. data/doc/ex/nonzero.rb +43 -0
  190. data/doc/ex/normalize.rb +11 -0
  191. data/doc/ex/oil_paint.rb +11 -0
  192. data/doc/ex/opacity.rb +37 -0
  193. data/doc/ex/ordered_dither.rb +11 -0
  194. data/doc/ex/path.rb +64 -0
  195. data/doc/ex/pattern1.rb +25 -0
  196. data/doc/ex/pattern2.rb +26 -0
  197. data/doc/ex/polaroid.rb +28 -0
  198. data/doc/ex/polygon.rb +24 -0
  199. data/doc/ex/polygon01.rb +23 -0
  200. data/doc/ex/polyline.rb +23 -0
  201. data/doc/ex/polyline01.rb +23 -0
  202. data/doc/ex/posterize.rb +8 -0
  203. data/doc/ex/preview.rb +9 -0
  204. data/doc/ex/qbezierpath.rb +52 -0
  205. data/doc/ex/quad01.rb +36 -0
  206. data/doc/ex/quantize-m.rb +25 -0
  207. data/doc/ex/radial_blur.rb +9 -0
  208. data/doc/ex/raise.rb +8 -0
  209. data/doc/ex/random_threshold_channel.rb +13 -0
  210. data/doc/ex/rect01.rb +15 -0
  211. data/doc/ex/rect02.rb +22 -0
  212. data/doc/ex/rectangle.rb +35 -0
  213. data/doc/ex/reduce_noise.rb +28 -0
  214. data/doc/ex/remap.rb +12 -0
  215. data/doc/ex/remap_images.rb +21 -0
  216. data/doc/ex/resize_to_fill.rb +10 -0
  217. data/doc/ex/resize_to_fit.rb +10 -0
  218. data/doc/ex/roll.rb +9 -0
  219. data/doc/ex/rotate.rb +45 -0
  220. data/doc/ex/rotate_f.rb +14 -0
  221. data/doc/ex/roundrect.rb +34 -0
  222. data/doc/ex/rubyname.rb +30 -0
  223. data/doc/ex/rvg_clippath.rb +14 -0
  224. data/doc/ex/rvg_linecap.rb +43 -0
  225. data/doc/ex/rvg_linejoin.rb +41 -0
  226. data/doc/ex/rvg_opacity.rb +19 -0
  227. data/doc/ex/rvg_pattern.rb +26 -0
  228. data/doc/ex/rvg_stroke_dasharray.rb +12 -0
  229. data/doc/ex/segment.rb +11 -0
  230. data/doc/ex/sepiatone.rb +8 -0
  231. data/doc/ex/shade.rb +11 -0
  232. data/doc/ex/shadow.rb +31 -0
  233. data/doc/ex/shave.rb +15 -0
  234. data/doc/ex/shear.rb +10 -0
  235. data/doc/ex/sketch.rb +18 -0
  236. data/doc/ex/skewx.rb +52 -0
  237. data/doc/ex/skewy.rb +47 -0
  238. data/doc/ex/smile.rb +125 -0
  239. data/doc/ex/solarize.rb +11 -0
  240. data/doc/ex/sparse_color.rb +55 -0
  241. data/doc/ex/splice.rb +9 -0
  242. data/doc/ex/spread.rb +11 -0
  243. data/doc/ex/stegano.rb +55 -0
  244. data/doc/ex/stroke_dasharray.rb +43 -0
  245. data/doc/ex/stroke_fill.rb +11 -0
  246. data/doc/ex/stroke_linecap.rb +44 -0
  247. data/doc/ex/stroke_linejoin.rb +48 -0
  248. data/doc/ex/stroke_width.rb +49 -0
  249. data/doc/ex/swirl.rb +17 -0
  250. data/doc/ex/text.rb +37 -0
  251. data/doc/ex/text01.rb +17 -0
  252. data/doc/ex/text_align.rb +36 -0
  253. data/doc/ex/text_antialias.rb +38 -0
  254. data/doc/ex/text_styles.rb +21 -0
  255. data/doc/ex/text_undercolor.rb +28 -0
  256. data/doc/ex/texture_fill_to_border.rb +34 -0
  257. data/doc/ex/texture_floodfill.rb +32 -0
  258. data/doc/ex/texturefill.rb +25 -0
  259. data/doc/ex/threshold.rb +13 -0
  260. data/doc/ex/to_blob.rb +14 -0
  261. data/doc/ex/translate.rb +39 -0
  262. data/doc/ex/transparent.rb +38 -0
  263. data/doc/ex/transpose.rb +9 -0
  264. data/doc/ex/transverse.rb +9 -0
  265. data/doc/ex/tref01.rb +25 -0
  266. data/doc/ex/triangle01.rb +16 -0
  267. data/doc/ex/trim.rb +24 -0
  268. data/doc/ex/tspan01.rb +18 -0
  269. data/doc/ex/tspan02.rb +19 -0
  270. data/doc/ex/tspan03.rb +21 -0
  271. data/doc/ex/unsharp_mask.rb +28 -0
  272. data/doc/ex/viewex.rb +35 -0
  273. data/doc/ex/vignette.rb +12 -0
  274. data/doc/ex/watermark.rb +28 -0
  275. data/doc/ex/wave.rb +9 -0
  276. data/doc/ex/wet_floor.rb +59 -0
  277. data/doc/ex/writing_mode01.rb +27 -0
  278. data/doc/ex/writing_mode02.rb +26 -0
  279. data/doc/ilist.html +2056 -0
  280. data/doc/image1.html +4680 -0
  281. data/doc/image2.html +3665 -0
  282. data/doc/image3.html +4522 -0
  283. data/doc/imageattrs.html +1638 -0
  284. data/doc/imusage.html +514 -0
  285. data/doc/index.html +416 -0
  286. data/doc/info.html +1499 -0
  287. data/doc/magick.html +565 -0
  288. data/doc/optequiv.html +2435 -0
  289. data/doc/rvg.html +975 -0
  290. data/doc/rvgclip.html +248 -0
  291. data/doc/rvggroup.html +305 -0
  292. data/doc/rvgimage.html +289 -0
  293. data/doc/rvgpattern.html +475 -0
  294. data/doc/rvgshape.html +406 -0
  295. data/doc/rvgstyle.html +270 -0
  296. data/doc/rvgtext.html +465 -0
  297. data/doc/rvgtspan.html +238 -0
  298. data/doc/rvgtut.html +530 -0
  299. data/doc/rvguse.html +145 -0
  300. data/doc/rvgxform.html +294 -0
  301. data/doc/scripts/doc.js +22 -0
  302. data/doc/scripts/stripeTables.js +23 -0
  303. data/doc/struct.html +1339 -0
  304. data/doc/usage.html +1621 -0
  305. data/examples/constitute.rb +7 -0
  306. data/examples/crop_with_gravity.rb +46 -0
  307. data/examples/demo.rb +324 -0
  308. data/examples/describe.rb +44 -0
  309. data/examples/find_similar_region.rb +34 -0
  310. data/examples/histogram.rb +325 -0
  311. data/examples/identify.rb +187 -0
  312. data/examples/image_opacity.rb +29 -0
  313. data/examples/import_export.rb +31 -0
  314. data/examples/pattern_fill.rb +38 -0
  315. data/examples/rotating_text.rb +45 -0
  316. data/examples/spinner.rb +50 -0
  317. data/examples/thumbnail.rb +65 -0
  318. data/examples/vignette.rb +79 -0
  319. data/ext/RMagick/Makefile +180 -0
  320. data/ext/RMagick/RMagick2.so +0 -0
  321. data/ext/RMagick/extconf.h +119 -0
  322. data/ext/RMagick/extconf.rb +406 -0
  323. data/ext/RMagick/mkmf.log +3022 -0
  324. data/ext/RMagick/rmagick.c +394 -0
  325. data/ext/RMagick/rmagick.h +1307 -0
  326. data/ext/RMagick/rmagick.o +0 -0
  327. data/ext/RMagick/rmdraw.c +1991 -0
  328. data/ext/RMagick/rmdraw.o +0 -0
  329. data/ext/RMagick/rmenum.c +1224 -0
  330. data/ext/RMagick/rmenum.o +0 -0
  331. data/ext/RMagick/rmfill.c +717 -0
  332. data/ext/RMagick/rmfill.o +0 -0
  333. data/ext/RMagick/rmilist.c +1217 -0
  334. data/ext/RMagick/rmilist.o +0 -0
  335. data/ext/RMagick/rmimage.c +15099 -0
  336. data/ext/RMagick/rmimage.o +0 -0
  337. data/ext/RMagick/rminfo.c +2567 -0
  338. data/ext/RMagick/rminfo.o +0 -0
  339. data/ext/RMagick/rmmain.c +1705 -0
  340. data/ext/RMagick/rmmain.o +0 -0
  341. data/ext/RMagick/rmmontage.c +511 -0
  342. data/ext/RMagick/rmmontage.o +0 -0
  343. data/ext/RMagick/rmpixel.c +1103 -0
  344. data/ext/RMagick/rmpixel.o +0 -0
  345. data/ext/RMagick/rmstruct.c +1047 -0
  346. data/ext/RMagick/rmstruct.o +0 -0
  347. data/ext/RMagick/rmutil.c +1730 -0
  348. data/ext/RMagick/rmutil.o +0 -0
  349. data/lib/RMagick.rb +1962 -0
  350. data/lib/rvg/clippath.rb +48 -0
  351. data/lib/rvg/container.rb +131 -0
  352. data/lib/rvg/deep_equal.rb +56 -0
  353. data/lib/rvg/describable.rb +53 -0
  354. data/lib/rvg/embellishable.rb +417 -0
  355. data/lib/rvg/misc.rb +740 -0
  356. data/lib/rvg/paint.rb +55 -0
  357. data/lib/rvg/pathdata.rb +131 -0
  358. data/lib/rvg/rvg.rb +283 -0
  359. data/lib/rvg/stretchable.rb +168 -0
  360. data/lib/rvg/stylable.rb +124 -0
  361. data/lib/rvg/text.rb +187 -0
  362. data/lib/rvg/to_c.rb +103 -0
  363. data/lib/rvg/transformable.rb +133 -0
  364. data/lib/rvg/units.rb +66 -0
  365. data/metaconfig +7 -0
  366. data/post-clean.rb +12 -0
  367. data/post-install.rb +50 -0
  368. data/post-setup.rb +254 -0
  369. data/rmagick.gemspec +20 -0
  370. data/setup.rb +1585 -0
  371. data/test/Draw.rb +121 -0
  372. data/test/Image1.rb +762 -0
  373. data/test/Image2.rb +1308 -0
  374. data/test/Image3.rb +1001 -0
  375. data/test/ImageList1.rb +808 -0
  376. data/test/ImageList2.rb +389 -0
  377. data/test/Image_attributes.rb +682 -0
  378. data/test/Import_Export.rb +116 -0
  379. data/test/Info.rb +349 -0
  380. data/test/Magick.rb +364 -0
  381. data/test/Pixel.rb +120 -0
  382. data/test/Preview.rb +62 -0
  383. data/test/all_basic.rb +39 -0
  384. data/test/cmyk.icm +0 -0
  385. data/test/srgb.icm +0 -0
  386. data/test/test.0 +0 -0
  387. data/uninstall.rb +74 -0
  388. metadata +455 -0
Binary file
@@ -0,0 +1,1705 @@
1
+ /**************************************************************************//**
2
+ * Contains all module, class, method declarations. Defines all constants.
3
+ * Contains Magick module methods.
4
+ *
5
+ * Copyright © 2002 - 2009 by Timothy P. Hunter
6
+ *
7
+ * Changes since Nov. 2009 copyright © by Benjamin Thomas and Omer Bar-or
8
+ *
9
+ * @file rmmain.c
10
+ * @version $Id: rmmain.c,v 1.303 2009/12/20 02:33:33 baror Exp $
11
+ * @author Tim Hunter
12
+ ******************************************************************************/
13
+
14
+ #define MAIN // Define external variables
15
+ #include "rmagick.h"
16
+ #include "magick/version.h"
17
+
18
+ /*----------------------------------------------------------------------------\
19
+ | External declarations
20
+ \----------------------------------------------------------------------------*/
21
+ void Init_RMagick(void);
22
+
23
+ static void test_Magick_version(void);
24
+ static void version_constants(void);
25
+
26
+
27
+
28
+
29
+ /*
30
+ * Handle transferring ImageMagick memory allocations/frees to Ruby.
31
+ * These functions have the same signature as the equivalent C functions.
32
+ */
33
+ #if defined(HAVE_SETMAGICKMEMORYMETHODS)
34
+ /**
35
+ * Allocate memory.
36
+ *
37
+ * No Ruby usage (internal function)
38
+ *
39
+ * @param size the size of memory to allocate
40
+ * @return pointer to a block of memory
41
+ */
42
+ static void *rm_malloc(size_t size)
43
+ {
44
+ void *p;
45
+ // int old_state;
46
+
47
+ // old_state = rb_gc_disable();
48
+ p = xmalloc((long)size);
49
+ // if (!RTEST(old_state))
50
+ // {
51
+ // rb_gc_enable();
52
+ // }
53
+
54
+ return p;
55
+ }
56
+
57
+
58
+
59
+
60
+ /**
61
+ * Reallocate memory.
62
+ *
63
+ * No Ruby usage (internal function)
64
+ *
65
+ * @param ptr pointer to the existing block of memory
66
+ * @param size the new size of memory to allocate
67
+ * @return pointer to a block of memory
68
+ */
69
+ static void *rm_realloc(void *ptr, size_t size)
70
+ {
71
+ void *p;
72
+ // int old_state;
73
+
74
+ // old_state = rb_gc_disable();
75
+ p = xrealloc(ptr, (long)size);
76
+ // if (!RTEST(old_state))
77
+ // {
78
+ // rb_gc_enable();
79
+ // }
80
+
81
+ return p;
82
+ }
83
+
84
+
85
+
86
+
87
+ /**
88
+ * Free memory.
89
+ *
90
+ * No Ruby usage (internal function)
91
+ *
92
+ * @param ptr pointer to the existing block of memory
93
+ */
94
+ static void rm_free(void *ptr)
95
+ {
96
+ xfree(ptr);
97
+ }
98
+
99
+
100
+ /**
101
+ * Use managed memory.
102
+ *
103
+ * No Ruby usage (internal function)
104
+ */
105
+ static void set_managed_memory(void)
106
+ {
107
+ ID enable_mm = rb_intern("RMAGICK_ENABLE_MANAGED_MEMORY");
108
+
109
+ if (RTEST(rb_const_defined(rb_cObject, enable_mm)) && RTEST(rb_const_get(rb_cObject, enable_mm)))
110
+ {
111
+ rb_warning("RMagick: %s", "managed memory enabled. This is an experimental feature.");
112
+ SetMagickMemoryMethods(rm_malloc, rm_realloc, rm_free);
113
+ rb_define_const(Module_Magick, "MANAGED_MEMORY", Qtrue);
114
+ }
115
+ else
116
+ {
117
+ rb_define_const(Module_Magick, "MANAGED_MEMORY", Qfalse);
118
+ }
119
+ }
120
+ #endif
121
+
122
+
123
+
124
+
125
+ /**
126
+ * Define the classes and constants.
127
+ *
128
+ * No Ruby usage (internal function)
129
+ */
130
+ void
131
+ Init_RMagick2(void)
132
+ {
133
+ volatile VALUE observable;
134
+
135
+ MagickCoreGenesis("RMagick", MagickFalse);
136
+
137
+ test_Magick_version();
138
+
139
+ Module_Magick = rb_define_module("Magick");
140
+
141
+ #if defined(HAVE_SETMAGICKMEMORYMETHODS)
142
+ set_managed_memory();
143
+ #else
144
+ rb_define_const(Module_Magick, "MANAGED_MEMORY", Qfalse);
145
+ #endif
146
+
147
+ /*-----------------------------------------------------------------------*/
148
+ /* Create IDs for frequently used methods, etc. */
149
+ /*-----------------------------------------------------------------------*/
150
+
151
+ rm_ID_trace_proc = rb_intern("@trace_proc");
152
+ rm_ID_call = rb_intern("call");
153
+ rm_ID_changed = rb_intern("changed");
154
+ rm_ID_cur_image = rb_intern("cur_image");
155
+ rm_ID_dup = rb_intern("dup");
156
+ rm_ID_fill = rb_intern("fill");
157
+ rm_ID_flag = rb_intern("flag");
158
+ rm_ID_from_s = rb_intern("from_s");
159
+ rm_ID_Geometry = rb_intern("Geometry");
160
+ rm_ID_GeometryValue = rb_intern("GeometryValue");
161
+ rm_ID_has_key_q = rb_intern("has_key?");
162
+ rm_ID_height = rb_intern("height");
163
+ rm_ID_initialize_copy = rb_intern("initialize_copy");
164
+ rm_ID_length = rb_intern("length");
165
+ rm_ID_notify_observers = rb_intern("notify_observers");
166
+ rm_ID_new = rb_intern("new");
167
+ rm_ID_push = rb_intern("push");
168
+ rm_ID_spaceship = rb_intern("<=>");
169
+ rm_ID_to_i = rb_intern("to_i");
170
+ rm_ID_to_s = rb_intern("to_s");
171
+ rm_ID_values = rb_intern("values");
172
+ rm_ID_width = rb_intern("width");
173
+ rm_ID_x = rb_intern("x");
174
+ rm_ID_y = rb_intern("y");
175
+
176
+ /*-----------------------------------------------------------------------*/
177
+ /* Module Magick methods */
178
+ /*-----------------------------------------------------------------------*/
179
+
180
+ rb_define_module_function(Module_Magick, "colors", Magick_colors, 0);
181
+ rb_define_module_function(Module_Magick, "fonts", Magick_fonts, 0);
182
+ rb_define_module_function(Module_Magick, "init_formats", Magick_init_formats, 0);
183
+ rb_define_module_function(Module_Magick, "limit_resource", Magick_limit_resource, -1);
184
+ rb_define_module_function(Module_Magick, "set_cache_threshold", Magick_set_cache_threshold, 1);
185
+ rb_define_module_function(Module_Magick, "set_log_event_mask", Magick_set_log_event_mask, -1);
186
+ rb_define_module_function(Module_Magick, "set_log_format", Magick_set_log_format, 1);
187
+
188
+ /*-----------------------------------------------------------------------*/
189
+ /* Class Magick::Image methods */
190
+ /*-----------------------------------------------------------------------*/
191
+
192
+ Class_Image = rb_define_class_under(Module_Magick, "Image", rb_cObject);
193
+
194
+ // Define an alias for Object#display before we override it
195
+ rb_define_alias(Class_Image, "__display__", "display");
196
+
197
+ rb_define_alloc_func(Class_Image, Image_alloc);
198
+ rb_define_method(Class_Image, "initialize", Image_initialize, -1);
199
+
200
+ rb_define_singleton_method(Class_Image, "combine", Image_combine, -1);
201
+ rb_define_singleton_method(Class_Image, "constitute", Image_constitute, 4);
202
+ rb_define_singleton_method(Class_Image, "_load", Image__load, 1);
203
+ rb_define_singleton_method(Class_Image, "capture", Image_capture, -1);
204
+ rb_define_singleton_method(Class_Image, "ping", Image_ping, 1);
205
+ rb_define_singleton_method(Class_Image, "read", Image_read, 1);
206
+ rb_define_singleton_method(Class_Image, "read_inline", Image_read_inline, 1);
207
+ rb_define_singleton_method(Class_Image, "from_blob", Image_from_blob, 1);
208
+
209
+ DCL_ATTR_WRITER(Image, alpha)
210
+ DCL_ATTR_ACCESSOR(Image, background_color)
211
+ DCL_ATTR_READER(Image, base_columns)
212
+ DCL_ATTR_READER(Image, base_filename)
213
+ DCL_ATTR_READER(Image, base_rows)
214
+ DCL_ATTR_ACCESSOR(Image, bias)
215
+ DCL_ATTR_ACCESSOR(Image, black_point_compensation)
216
+ DCL_ATTR_ACCESSOR(Image, blur)
217
+ DCL_ATTR_ACCESSOR(Image, border_color)
218
+ DCL_ATTR_READER(Image, bounding_box)
219
+ DCL_ATTR_ACCESSOR(Image, chromaticity)
220
+ DCL_ATTR_ACCESSOR(Image, color_profile)
221
+ DCL_ATTR_READER(Image, colors)
222
+ DCL_ATTR_ACCESSOR(Image, colorspace)
223
+ DCL_ATTR_READER(Image, columns)
224
+ DCL_ATTR_ACCESSOR(Image, compose)
225
+ DCL_ATTR_ACCESSOR(Image, compression)
226
+ DCL_ATTR_ACCESSOR(Image, delay)
227
+ DCL_ATTR_ACCESSOR(Image, density)
228
+ DCL_ATTR_READER(Image, depth)
229
+ DCL_ATTR_READER(Image, directory)
230
+ DCL_ATTR_ACCESSOR(Image, dispose)
231
+ DCL_ATTR_ACCESSOR(Image, endian)
232
+ DCL_ATTR_ACCESSOR(Image, extract_info)
233
+ DCL_ATTR_READER(Image, filename)
234
+ DCL_ATTR_READER(Image, filesize)
235
+ DCL_ATTR_ACCESSOR(Image, filter)
236
+ DCL_ATTR_ACCESSOR(Image, format)
237
+ DCL_ATTR_ACCESSOR(Image, fuzz)
238
+ DCL_ATTR_ACCESSOR(Image, gamma)
239
+ DCL_ATTR_ACCESSOR(Image, geometry)
240
+ DCL_ATTR_ACCESSOR(Image, gravity)
241
+ DCL_ATTR_ACCESSOR(Image, image_type)
242
+ DCL_ATTR_ACCESSOR(Image, interlace)
243
+ DCL_ATTR_ACCESSOR(Image, iptc_profile)
244
+ DCL_ATTR_ACCESSOR(Image, iterations) // do not document! Only used by Image#iterations=
245
+ DCL_ATTR_WRITER(Image, mask)
246
+ DCL_ATTR_ACCESSOR(Image, matte)
247
+ DCL_ATTR_ACCESSOR(Image, matte_color)
248
+ DCL_ATTR_READER(Image, mean_error_per_pixel)
249
+ DCL_ATTR_READER(Image, mime_type)
250
+ DCL_ATTR_WRITER(Image, monitor)
251
+ DCL_ATTR_READER(Image, montage)
252
+ DCL_ATTR_READER(Image, normalized_mean_error)
253
+ DCL_ATTR_READER(Image, normalized_maximum_error)
254
+ DCL_ATTR_READER(Image, number_colors)
255
+ DCL_ATTR_ACCESSOR(Image, offset)
256
+ DCL_ATTR_WRITER(Image, opacity)
257
+ DCL_ATTR_ACCESSOR(Image, orientation)
258
+ DCL_ATTR_ACCESSOR(Image, page)
259
+ DCL_ATTR_ACCESSOR(Image, pixel_interpolation_method)
260
+ DCL_ATTR_READER(Image, quality)
261
+ DCL_ATTR_READER(Image, quantum_depth)
262
+ DCL_ATTR_ACCESSOR(Image, rendering_intent)
263
+ DCL_ATTR_READER(Image, rows)
264
+ DCL_ATTR_READER(Image, scene)
265
+ DCL_ATTR_ACCESSOR(Image, start_loop)
266
+ DCL_ATTR_ACCESSOR(Image, class_type)
267
+ DCL_ATTR_ACCESSOR(Image, ticks_per_second)
268
+ DCL_ATTR_READER(Image, total_colors)
269
+ DCL_ATTR_READER(Image, total_ink_density)
270
+ DCL_ATTR_ACCESSOR(Image, transparent_color)
271
+ DCL_ATTR_ACCESSOR(Image, units)
272
+ DCL_ATTR_ACCESSOR(Image, virtual_pixel_method)
273
+ DCL_ATTR_ACCESSOR(Image, x_resolution)
274
+ DCL_ATTR_ACCESSOR(Image, y_resolution)
275
+
276
+ rb_define_method(Class_Image, "adaptive_blur", Image_adaptive_blur, -1);
277
+ rb_define_method(Class_Image, "adaptive_blur_channel", Image_adaptive_blur_channel, -1);
278
+ rb_define_method(Class_Image, "adaptive_resize", Image_adaptive_resize, -1);
279
+ rb_define_method(Class_Image, "adaptive_sharpen", Image_adaptive_sharpen, -1);
280
+ rb_define_method(Class_Image, "adaptive_sharpen_channel", Image_adaptive_sharpen_channel, -1);
281
+ rb_define_method(Class_Image, "adaptive_threshold", Image_adaptive_threshold, -1);
282
+ rb_define_method(Class_Image, "add_compose_mask", Image_add_compose_mask, 1);
283
+ rb_define_method(Class_Image, "add_noise", Image_add_noise, 1);
284
+ rb_define_method(Class_Image, "add_noise_channel", Image_add_noise_channel, -1);
285
+ rb_define_method(Class_Image, "add_profile", Image_add_profile, 1);
286
+ rb_define_method(Class_Image, "affine_transform", Image_affine_transform, 1);
287
+ rb_define_method(Class_Image, "remap", Image_remap, -1);
288
+ rb_define_method(Class_Image, "alpha", Image_alpha, -1);
289
+ rb_define_method(Class_Image, "alpha?", Image_alpha_q, 0);
290
+ rb_define_method(Class_Image, "[]", Image_aref, 1);
291
+ rb_define_method(Class_Image, "[]=", Image_aset, 2);
292
+ rb_define_method(Class_Image, "auto_gamma_channel", Image_auto_gamma_channel, -1);
293
+ rb_define_method(Class_Image, "auto_level_channel", Image_auto_level_channel, -1);
294
+ rb_define_method(Class_Image, "auto_orient", Image_auto_orient, 0);
295
+ rb_define_method(Class_Image, "auto_orient!", Image_auto_orient_bang, 0);
296
+ rb_define_method(Class_Image, "properties", Image_properties, 0);
297
+ rb_define_method(Class_Image, "bilevel_channel", Image_bilevel_channel, -1);
298
+ rb_define_method(Class_Image, "black_threshold", Image_black_threshold, -1);
299
+ rb_define_method(Class_Image, "blend", Image_blend, -1);
300
+ rb_define_method(Class_Image, "blue_shift", Image_blue_shift, -1);
301
+ rb_define_method(Class_Image, "blur_image", Image_blur_image, -1);
302
+ rb_define_method(Class_Image, "blur_channel", Image_blur_channel, -1);
303
+ rb_define_method(Class_Image, "border", Image_border, 3);
304
+ rb_define_method(Class_Image, "border!", Image_border_bang, 3);
305
+ rb_define_method(Class_Image, "change_geometry", Image_change_geometry, 1);
306
+ rb_define_method(Class_Image, "change_geometry!", Image_change_geometry, 1);
307
+ rb_define_method(Class_Image, "changed?", Image_changed_q, 0);
308
+ rb_define_method(Class_Image, "channel", Image_channel, 1);
309
+ // An alias for compare_channel
310
+ rb_define_method(Class_Image, "channel_compare", Image_compare_channel, -1);
311
+ rb_define_method(Class_Image, "check_destroyed", Image_check_destroyed, 0);
312
+ rb_define_method(Class_Image, "compare_channel", Image_compare_channel, -1);
313
+ rb_define_method(Class_Image, "channel_depth", Image_channel_depth, -1);
314
+ rb_define_method(Class_Image, "channel_extrema", Image_channel_extrema, -1);
315
+ rb_define_method(Class_Image, "channel_mean", Image_channel_mean, -1);
316
+ rb_define_method(Class_Image, "charcoal", Image_charcoal, -1);
317
+ rb_define_method(Class_Image, "chop", Image_chop, 4);
318
+ rb_define_method(Class_Image, "clut_channel", Image_clut_channel, -1);
319
+ rb_define_method(Class_Image, "clone", Image_clone, 0);
320
+ rb_define_method(Class_Image, "color_flood_fill", Image_color_flood_fill, 5);
321
+ rb_define_method(Class_Image, "color_histogram", Image_color_histogram, 0);
322
+ rb_define_method(Class_Image, "colorize", Image_colorize, -1);
323
+ rb_define_method(Class_Image, "colormap", Image_colormap, -1);
324
+ rb_define_method(Class_Image, "composite", Image_composite, -1);
325
+ rb_define_method(Class_Image, "composite!", Image_composite_bang, -1);
326
+ rb_define_method(Class_Image, "composite_affine", Image_composite_affine, 2);
327
+ rb_define_method(Class_Image, "composite_channel", Image_composite_channel, -1);
328
+ rb_define_method(Class_Image, "composite_channel!", Image_composite_channel_bang, -1);
329
+ rb_define_method(Class_Image, "composite_mathematics", Image_composite_mathematics, -1);
330
+ rb_define_method(Class_Image, "composite_tiled", Image_composite_tiled, -1);
331
+ rb_define_method(Class_Image, "composite_tiled!", Image_composite_tiled_bang, -1);
332
+ rb_define_method(Class_Image, "compress_colormap!", Image_compress_colormap_bang, 0);
333
+ rb_define_method(Class_Image, "contrast", Image_contrast, -1);
334
+ rb_define_method(Class_Image, "contrast_stretch_channel", Image_contrast_stretch_channel, -1);
335
+ rb_define_method(Class_Image, "convolve", Image_convolve, 2);
336
+ rb_define_method(Class_Image, "convolve_channel", Image_convolve_channel, -1);
337
+ rb_define_method(Class_Image, "copy", Image_copy, 0);
338
+ rb_define_method(Class_Image, "crop", Image_crop, -1);
339
+ rb_define_method(Class_Image, "crop!", Image_crop_bang, -1);
340
+ rb_define_method(Class_Image, "cycle_colormap", Image_cycle_colormap, 1);
341
+ rb_define_method(Class_Image, "decipher", Image_decipher, 1);
342
+ rb_define_method(Class_Image, "define", Image_define, 2);
343
+ rb_define_method(Class_Image, "deskew", Image_deskew, -1);
344
+ rb_define_method(Class_Image, "delete_compose_mask", Image_delete_compose_mask, 0);
345
+ rb_define_method(Class_Image, "delete_profile", Image_delete_profile, 1);
346
+ rb_define_method(Class_Image, "despeckle", Image_despeckle, 0);
347
+ rb_define_method(Class_Image, "destroy!", Image_destroy_bang, 0);
348
+ rb_define_method(Class_Image, "destroyed?", Image_destroyed_q, 0);
349
+ rb_define_method(Class_Image, "difference", Image_difference, 1);
350
+ rb_define_method(Class_Image, "dispatch", Image_dispatch, -1);
351
+ rb_define_method(Class_Image, "displace", Image_displace, -1);
352
+ rb_define_method(Class_Image, "display", Image_display, 0);
353
+ rb_define_method(Class_Image, "dissolve", Image_dissolve, -1);
354
+ rb_define_method(Class_Image, "distort", Image_distort, -1);
355
+ rb_define_method(Class_Image, "distortion_channel", Image_distortion_channel, -1);
356
+ rb_define_method(Class_Image, "_dump", Image__dump, 1);
357
+ rb_define_method(Class_Image, "dup", Image_dup, 0);
358
+ rb_define_method(Class_Image, "each_profile", Image_each_profile, 0);
359
+ rb_define_method(Class_Image, "edge", Image_edge, -1);
360
+ rb_define_method(Class_Image, "emboss", Image_emboss, -1);
361
+ rb_define_method(Class_Image, "encipher", Image_encipher, 1);
362
+ rb_define_method(Class_Image, "enhance", Image_enhance, 0);
363
+ rb_define_method(Class_Image, "equalize", Image_equalize, 0);
364
+ rb_define_method(Class_Image, "equalize_channel", Image_equalize_channel, -1);
365
+ rb_define_method(Class_Image, "erase!", Image_erase_bang, 0);
366
+ rb_define_method(Class_Image, "excerpt", Image_excerpt, 4);
367
+ rb_define_method(Class_Image, "excerpt!", Image_excerpt_bang, 4);
368
+ rb_define_method(Class_Image, "export_pixels", Image_export_pixels, -1);
369
+ rb_define_method(Class_Image, "export_pixels_to_str", Image_export_pixels_to_str, -1);
370
+ rb_define_method(Class_Image, "extent", Image_extent, -1);
371
+ rb_define_method(Class_Image, "find_similar_region", Image_find_similar_region, -1);
372
+ rb_define_method(Class_Image, "flip", Image_flip, 0);
373
+ rb_define_method(Class_Image, "flip!", Image_flip_bang, 0);
374
+ rb_define_method(Class_Image, "flop", Image_flop, 0);
375
+ rb_define_method(Class_Image, "flop!", Image_flop_bang, 0);
376
+ rb_define_method(Class_Image, "frame", Image_frame, -1);
377
+ rb_define_method(Class_Image, "function_channel", Image_function_channel, -1);
378
+ rb_define_method(Class_Image, "gamma_channel", Image_gamma_channel, -1);
379
+ rb_define_method(Class_Image, "gamma_correct", Image_gamma_correct, -1);
380
+ rb_define_method(Class_Image, "gaussian_blur", Image_gaussian_blur, -1);
381
+ rb_define_method(Class_Image, "gaussian_blur_channel", Image_gaussian_blur_channel, -1);
382
+ rb_define_method(Class_Image, "get_pixels", Image_get_pixels, 4);
383
+ rb_define_method(Class_Image, "gray?", Image_gray_q, 0);
384
+ rb_define_method(Class_Image, "grey?", Image_gray_q, 0);
385
+ rb_define_method(Class_Image, "histogram?", Image_histogram_q, 0);
386
+ rb_define_method(Class_Image, "implode", Image_implode, -1);
387
+ rb_define_method(Class_Image, "import_pixels", Image_import_pixels, -1);
388
+ rb_define_method(Class_Image, "initialize_copy", Image_init_copy, 1);
389
+ rb_define_method(Class_Image, "inspect", Image_inspect, 0);
390
+ rb_define_method(Class_Image, "level2", Image_level2, -1);
391
+ rb_define_method(Class_Image, "level_channel", Image_level_channel, -1);
392
+ rb_define_method(Class_Image, "level_colors", Image_level_colors, -1);
393
+ rb_define_method(Class_Image, "levelize_channel", Image_levelize_channel, -1);
394
+ rb_define_method(Class_Image, "linear_stretch", Image_linear_stretch, -1);
395
+ rb_define_method(Class_Image, "liquid_rescale", Image_liquid_rescale, -1);
396
+ rb_define_method(Class_Image, "magnify", Image_magnify, 0);
397
+ rb_define_method(Class_Image, "magnify!", Image_magnify_bang, 0);
398
+ rb_define_method(Class_Image, "map", Image_map, -1);
399
+ rb_define_method(Class_Image, "marshal_dump", Image_marshal_dump, 0);
400
+ rb_define_method(Class_Image, "marshal_load", Image_marshal_load, 1);
401
+ rb_define_method(Class_Image, "mask", Image_mask, -1);
402
+ rb_define_method(Class_Image, "matte_flood_fill", Image_matte_flood_fill, 5);
403
+ rb_define_method(Class_Image, "median_filter", Image_median_filter, -1);
404
+ rb_define_method(Class_Image, "minify", Image_minify, 0);
405
+ rb_define_method(Class_Image, "minify!", Image_minify_bang, 0);
406
+ rb_define_method(Class_Image, "modulate", Image_modulate, -1);
407
+ rb_define_method(Class_Image, "monochrome?", Image_monochrome_q, 0);
408
+ rb_define_method(Class_Image, "motion_blur", Image_motion_blur, -1);
409
+ rb_define_method(Class_Image, "negate", Image_negate, -1);
410
+ rb_define_method(Class_Image, "negate_channel", Image_negate_channel, -1);
411
+ rb_define_method(Class_Image, "normalize", Image_normalize, 0);
412
+ rb_define_method(Class_Image, "normalize_channel", Image_normalize_channel, -1);
413
+ rb_define_method(Class_Image, "oil_paint", Image_oil_paint, -1);
414
+ rb_define_method(Class_Image, "opaque", Image_opaque, 2);
415
+ rb_define_method(Class_Image, "opaque_channel", Image_opaque_channel, -1);
416
+ rb_define_method(Class_Image, "opaque?", Image_opaque_q, 0);
417
+ rb_define_method(Class_Image, "ordered_dither", Image_ordered_dither, -1);
418
+ rb_define_method(Class_Image, "paint_transparent", Image_paint_transparent, -1);
419
+ rb_define_method(Class_Image, "palette?", Image_palette_q, 0);
420
+ rb_define_method(Class_Image, "pixel_color", Image_pixel_color, -1);
421
+ rb_define_method(Class_Image, "polaroid", Image_polaroid, -1);
422
+ rb_define_method(Class_Image, "posterize", Image_posterize, -1);
423
+ // rb_define_method(Class_Image, "plasma", Image_plasma, 6);
424
+ rb_define_method(Class_Image, "preview", Image_preview, 1);
425
+ rb_define_method(Class_Image, "profile!", Image_profile_bang, 2);
426
+ rb_define_method(Class_Image, "quantize", Image_quantize, -1);
427
+ rb_define_method(Class_Image, "quantum_operator", Image_quantum_operator, -1);
428
+ rb_define_method(Class_Image, "radial_blur", Image_radial_blur, 1);
429
+ rb_define_method(Class_Image, "radial_blur_channel", Image_radial_blur_channel, -1);
430
+ rb_define_method(Class_Image, "raise", Image_raise, -1);
431
+ rb_define_method(Class_Image, "random_threshold_channel", Image_random_threshold_channel, -1);
432
+ rb_define_method(Class_Image, "recolor", Image_recolor, 1);
433
+ rb_define_method(Class_Image, "reduce_noise", Image_reduce_noise, 1);
434
+ rb_define_method(Class_Image, "resize", Image_resize, -1);
435
+ rb_define_method(Class_Image, "resize!", Image_resize_bang, -1);
436
+ rb_define_method(Class_Image, "roll", Image_roll, 2);
437
+ rb_define_method(Class_Image, "rotate", Image_rotate, -1);
438
+ rb_define_method(Class_Image, "rotate!", Image_rotate_bang, -1);
439
+ rb_define_method(Class_Image, "sample", Image_sample, -1);
440
+ rb_define_method(Class_Image, "sample!", Image_sample_bang, -1);
441
+ rb_define_method(Class_Image, "scale", Image_scale, -1);
442
+ rb_define_method(Class_Image, "scale!", Image_scale_bang, -1);
443
+ rb_define_method(Class_Image, "segment", Image_segment, -1);
444
+ rb_define_method(Class_Image, "selective_blur_channel", Image_selective_blur_channel, -1);
445
+ rb_define_method(Class_Image, "separate", Image_separate, -1);
446
+ rb_define_method(Class_Image, "sepiatone", Image_sepiatone, -1);
447
+ rb_define_method(Class_Image, "set_channel_depth", Image_set_channel_depth, 2);
448
+ rb_define_method(Class_Image, "shade", Image_shade, -1);
449
+ rb_define_method(Class_Image, "shadow", Image_shadow, -1);
450
+ rb_define_method(Class_Image, "sharpen", Image_sharpen, -1);
451
+ rb_define_method(Class_Image, "sharpen_channel", Image_sharpen_channel, -1);
452
+ rb_define_method(Class_Image, "shave", Image_shave, 2);
453
+ rb_define_method(Class_Image, "shave!", Image_shave_bang, 2);
454
+ rb_define_method(Class_Image, "shear", Image_shear, 2);
455
+ rb_define_method(Class_Image, "sigmoidal_contrast_channel", Image_sigmoidal_contrast_channel, -1);
456
+ rb_define_method(Class_Image, "signature", Image_signature, 0);
457
+ rb_define_method(Class_Image, "sketch", Image_sketch, -1);
458
+ rb_define_method(Class_Image, "solarize", Image_solarize, -1);
459
+ rb_define_method(Class_Image, "<=>", Image_spaceship, 1);
460
+ rb_define_method(Class_Image, "sparse_color", Image_sparse_color, -1);
461
+ rb_define_method(Class_Image, "splice", Image_splice, -1);
462
+ rb_define_method(Class_Image, "spread", Image_spread, -1);
463
+ rb_define_method(Class_Image, "stegano", Image_stegano, 2);
464
+ rb_define_method(Class_Image, "stereo", Image_stereo, 1);
465
+ rb_define_method(Class_Image, "strip!", Image_strip_bang, 0);
466
+ rb_define_method(Class_Image, "store_pixels", Image_store_pixels, 5);
467
+ rb_define_method(Class_Image, "swirl", Image_swirl, 1);
468
+ rb_define_method(Class_Image, "sync_profiles", Image_sync_profiles, 0);
469
+ rb_define_method(Class_Image, "texture_flood_fill", Image_texture_flood_fill, 5);
470
+ rb_define_method(Class_Image, "threshold", Image_threshold, 1);
471
+ rb_define_method(Class_Image, "thumbnail", Image_thumbnail, -1);
472
+ rb_define_method(Class_Image, "thumbnail!", Image_thumbnail_bang, -1);
473
+ rb_define_method(Class_Image, "tint", Image_tint, -1);
474
+ rb_define_method(Class_Image, "to_color", Image_to_color, 1);
475
+ rb_define_method(Class_Image, "to_blob", Image_to_blob, 0);
476
+ rb_define_method(Class_Image, "transparent", Image_transparent, -1);
477
+ rb_define_method(Class_Image, "transparent_chroma", Image_transparent_chroma, -1);
478
+ rb_define_method(Class_Image, "transpose", Image_transpose, 0);
479
+ rb_define_method(Class_Image, "transpose!", Image_transpose_bang, 0);
480
+ rb_define_method(Class_Image, "transverse", Image_transverse, 0);
481
+ rb_define_method(Class_Image, "transverse!", Image_transverse_bang, 0);
482
+ rb_define_method(Class_Image, "trim", Image_trim, -1);
483
+ rb_define_method(Class_Image, "trim!", Image_trim_bang, -1);
484
+ rb_define_method(Class_Image, "undefine", Image_undefine, 1);
485
+ rb_define_method(Class_Image, "unique_colors", Image_unique_colors, 0);
486
+ rb_define_method(Class_Image, "unsharp_mask", Image_unsharp_mask, -1);
487
+ rb_define_method(Class_Image, "unsharp_mask_channel", Image_unsharp_mask_channel, -1);
488
+ rb_define_method(Class_Image, "vignette", Image_vignette, -1);
489
+ rb_define_method(Class_Image, "watermark", Image_watermark, -1);
490
+ rb_define_method(Class_Image, "wave", Image_wave, -1);
491
+ rb_define_method(Class_Image, "wet_floor", Image_wet_floor, -1);
492
+ rb_define_method(Class_Image, "white_threshold", Image_white_threshold, -1);
493
+ rb_define_method(Class_Image, "write", Image_write, 1);
494
+
495
+ /*-----------------------------------------------------------------------*/
496
+ /* Class Magick::ImageList methods (see also RMagick.rb) */
497
+ /*-----------------------------------------------------------------------*/
498
+
499
+ Class_ImageList = rb_define_class_under(Module_Magick, "ImageList", rb_cObject);
500
+
501
+ // Define an alias for Object#display before we override it
502
+ rb_define_alias(Class_ImageList, "__display__", "display");
503
+ rb_define_method(Class_ImageList, "remap", ImageList_remap, -1);
504
+ rb_define_method(Class_ImageList, "animate", ImageList_animate, -1);
505
+ rb_define_method(Class_ImageList, "append", ImageList_append, 1);
506
+ rb_define_method(Class_ImageList, "average", ImageList_average, 0);
507
+ rb_define_method(Class_ImageList, "coalesce", ImageList_coalesce, 0);
508
+ rb_define_method(Class_ImageList, "composite_layers", ImageList_composite_layers, -1);
509
+ rb_define_method(Class_ImageList, "deconstruct", ImageList_deconstruct, 0);
510
+ rb_define_method(Class_ImageList, "display", ImageList_display, 0);
511
+ rb_define_method(Class_ImageList, "flatten_images", ImageList_flatten_images, 0);
512
+ rb_define_method(Class_ImageList, "fx", ImageList_fx, -1);
513
+ rb_define_method(Class_ImageList, "map", ImageList_map, -1);
514
+ rb_define_method(Class_ImageList, "montage", ImageList_montage, 0);
515
+ rb_define_method(Class_ImageList, "morph", ImageList_morph, 1);
516
+ rb_define_method(Class_ImageList, "mosaic", ImageList_mosaic, 0);
517
+ rb_define_method(Class_ImageList, "optimize_layers", ImageList_optimize_layers, 1);
518
+ rb_define_method(Class_ImageList, "quantize", ImageList_quantize, -1);
519
+ rb_define_method(Class_ImageList, "to_blob", ImageList_to_blob, 0);
520
+ rb_define_method(Class_ImageList, "write", ImageList_write, 1);
521
+
522
+ /*-----------------------------------------------------------------------*/
523
+ /* Class Magick::Draw methods */
524
+ /*-----------------------------------------------------------------------*/
525
+
526
+ Class_Draw = rb_define_class_under(Module_Magick, "Draw", rb_cObject);
527
+ rb_define_alloc_func(Class_Draw, Draw_alloc);
528
+
529
+ DCL_ATTR_WRITER(Draw, affine)
530
+ DCL_ATTR_WRITER(Draw, align)
531
+ DCL_ATTR_WRITER(Draw, decorate)
532
+ DCL_ATTR_WRITER(Draw, density)
533
+ DCL_ATTR_WRITER(Draw, encoding)
534
+ DCL_ATTR_WRITER(Draw, fill)
535
+ DCL_ATTR_WRITER(Draw, fill_pattern)
536
+ DCL_ATTR_WRITER(Draw, font)
537
+ DCL_ATTR_WRITER(Draw, font_family)
538
+ DCL_ATTR_WRITER(Draw, font_stretch)
539
+ DCL_ATTR_WRITER(Draw, font_style)
540
+ DCL_ATTR_WRITER(Draw, font_weight)
541
+ DCL_ATTR_WRITER(Draw, gravity)
542
+ DCL_ATTR_WRITER(Draw, interline_spacing)
543
+ DCL_ATTR_WRITER(Draw, interword_spacing)
544
+ DCL_ATTR_WRITER(Draw, kerning)
545
+ DCL_ATTR_WRITER(Draw, pointsize)
546
+ DCL_ATTR_WRITER(Draw, rotation)
547
+ DCL_ATTR_WRITER(Draw, stroke)
548
+ DCL_ATTR_WRITER(Draw, stroke_pattern)
549
+ DCL_ATTR_WRITER(Draw, stroke_width)
550
+ DCL_ATTR_WRITER(Draw, text_antialias)
551
+ DCL_ATTR_WRITER(Draw, tile)
552
+ DCL_ATTR_WRITER(Draw, undercolor)
553
+
554
+ rb_define_method(Class_Draw, "annotate", Draw_annotate, 6);
555
+ rb_define_method(Class_Draw, "clone", Draw_clone, 0);
556
+ rb_define_method(Class_Draw, "composite", Draw_composite, -1);
557
+ rb_define_method(Class_Draw, "draw", Draw_draw, 1);
558
+ rb_define_method(Class_Draw, "dup", Draw_dup, 0);
559
+ rb_define_method(Class_Draw, "get_type_metrics", Draw_get_type_metrics, -1);
560
+ rb_define_method(Class_Draw, "get_multiline_type_metrics", Draw_get_multiline_type_metrics, -1);
561
+ rb_define_method(Class_Draw, "initialize", Draw_initialize, 0);
562
+ rb_define_method(Class_Draw, "initialize_copy", Draw_init_copy, 1);
563
+ rb_define_method(Class_Draw, "inspect", Draw_inspect, 0);
564
+ rb_define_method(Class_Draw, "marshal_dump", Draw_marshal_dump, 0);
565
+ rb_define_method(Class_Draw, "marshal_load", Draw_marshal_load, 1);
566
+ rb_define_method(Class_Draw, "primitive", Draw_primitive, 1);
567
+
568
+ /*-----------------------------------------------------------------------*/
569
+ /* Class Magick::DrawOptions is identical to Magick::Draw but with */
570
+ /* only the attribute writer methods. This is the object that is passed */
571
+ /* to the block associated with the Draw.new method call. */
572
+ /*-----------------------------------------------------------------------*/
573
+
574
+ Class_DrawOptions = rb_define_class_under(Class_Image, "DrawOptions", rb_cObject);
575
+
576
+ rb_define_alloc_func(Class_DrawOptions, DrawOptions_alloc);
577
+
578
+ rb_define_method(Class_DrawOptions, "initialize", DrawOptions_initialize, 0);
579
+
580
+ SHARE_ATTR_WRITER(DrawOptions, Draw, affine)
581
+ SHARE_ATTR_WRITER(DrawOptions, Draw, align)
582
+ SHARE_ATTR_WRITER(DrawOptions, Draw, decorate)
583
+ SHARE_ATTR_WRITER(DrawOptions, Draw, density)
584
+ SHARE_ATTR_WRITER(DrawOptions, Draw, encoding)
585
+ SHARE_ATTR_WRITER(DrawOptions, Draw, fill)
586
+ SHARE_ATTR_WRITER(DrawOptions, Draw, fill_pattern)
587
+ SHARE_ATTR_WRITER(DrawOptions, Draw, font)
588
+ SHARE_ATTR_WRITER(DrawOptions, Draw, font_family)
589
+ SHARE_ATTR_WRITER(DrawOptions, Draw, font_stretch)
590
+ SHARE_ATTR_WRITER(DrawOptions, Draw, font_style)
591
+ SHARE_ATTR_WRITER(DrawOptions, Draw, font_weight)
592
+ SHARE_ATTR_WRITER(DrawOptions, Draw, gravity)
593
+ SHARE_ATTR_WRITER(DrawOptions, Draw, pointsize)
594
+ SHARE_ATTR_WRITER(DrawOptions, Draw, rotation)
595
+ SHARE_ATTR_WRITER(DrawOptions, Draw, stroke)
596
+ SHARE_ATTR_WRITER(DrawOptions, Draw, stroke_pattern)
597
+ SHARE_ATTR_WRITER(DrawOptions, Draw, stroke_width)
598
+ SHARE_ATTR_WRITER(DrawOptions, Draw, text_antialias)
599
+ SHARE_ATTR_WRITER(DrawOptions, Draw, tile)
600
+ SHARE_ATTR_WRITER(DrawOptions, Draw, undercolor)
601
+
602
+ /*-----------------------------------------------------------------------*/
603
+ /* Class Magick::Pixel */
604
+ /*-----------------------------------------------------------------------*/
605
+
606
+ Class_Pixel = rb_define_class_under(Module_Magick, "Pixel", rb_cObject);
607
+
608
+ // include Observable in Pixel for Image::View class
609
+ (void) rb_require("observer");
610
+ observable = rb_const_get(rb_cObject, rb_intern("Observable"));
611
+ rb_include_module(Class_Pixel, observable);
612
+
613
+ // include Comparable
614
+ rb_include_module(Class_Pixel, rb_mComparable);
615
+
616
+ // Magick::Pixel has 4 constructors: "new" "from_color", "from_hsla",
617
+ // and the deprecated "from_HSL".
618
+ rb_define_alloc_func(Class_Pixel, Pixel_alloc);
619
+ rb_define_singleton_method(Class_Pixel, "from_color", Pixel_from_color, 1);
620
+ rb_define_singleton_method(Class_Pixel, "from_HSL", Pixel_from_HSL, 1);
621
+ rb_define_singleton_method(Class_Pixel, "from_hsla", Pixel_from_hsla, -1);
622
+
623
+ // Define the RGBA attributes
624
+ DCL_ATTR_ACCESSOR(Pixel, red)
625
+ DCL_ATTR_ACCESSOR(Pixel, green)
626
+ DCL_ATTR_ACCESSOR(Pixel, blue)
627
+ DCL_ATTR_ACCESSOR(Pixel, opacity)
628
+
629
+ // Define the CMYK attributes
630
+ DCL_ATTR_ACCESSOR(Pixel, cyan)
631
+ DCL_ATTR_ACCESSOR(Pixel, magenta)
632
+ DCL_ATTR_ACCESSOR(Pixel, yellow)
633
+ DCL_ATTR_ACCESSOR(Pixel, black)
634
+
635
+
636
+ // Define the instance methods
637
+ rb_define_method(Class_Pixel, "<=>", Pixel_spaceship, 1);
638
+ rb_define_method(Class_Pixel, "===", Pixel_case_eq, 1);
639
+ rb_define_method(Class_Pixel, "eql?", Pixel_eql_q, 1);
640
+ rb_define_method(Class_Pixel, "initialize", Pixel_initialize, -1);
641
+ rb_define_method(Class_Pixel, "initialize_copy", Pixel_init_copy, 1);
642
+ rb_define_method(Class_Pixel, "clone", Pixel_clone, 0);
643
+ rb_define_method(Class_Pixel, "dup", Pixel_dup, 0);
644
+ rb_define_method(Class_Pixel, "fcmp", Pixel_fcmp, -1);
645
+ rb_define_method(Class_Pixel, "hash", Pixel_hash, 0);
646
+ rb_define_method(Class_Pixel, "intensity", Pixel_intensity, 0);
647
+ rb_define_method(Class_Pixel, "marshal_dump", Pixel_marshal_dump, 0);
648
+ rb_define_method(Class_Pixel, "marshal_load", Pixel_marshal_load, 1);
649
+ rb_define_method(Class_Pixel, "to_color", Pixel_to_color, -1);
650
+ rb_define_method(Class_Pixel, "to_HSL", Pixel_to_HSL, 0); // deprecated
651
+ rb_define_method(Class_Pixel, "to_hsla", Pixel_to_hsla, 0);
652
+ rb_define_method(Class_Pixel, "to_s", Pixel_to_s, 0);
653
+
654
+ /*-----------------------------------------------------------------------*/
655
+ /* Class Magick::ImageList::Montage methods */
656
+ /*-----------------------------------------------------------------------*/
657
+
658
+ Class_Montage = rb_define_class_under(Class_ImageList, "Montage", rb_cObject);
659
+
660
+ rb_define_alloc_func(Class_Montage, Montage_alloc);
661
+
662
+ rb_define_method(Class_Montage, "initialize", Montage_initialize, 0);
663
+ rb_define_method(Class_Montage, "freeze", rm_no_freeze, 0);
664
+
665
+ // These accessors supply optional arguments for Magick::ImageList::Montage.new
666
+ DCL_ATTR_WRITER(Montage, background_color)
667
+ DCL_ATTR_WRITER(Montage, border_color)
668
+ DCL_ATTR_WRITER(Montage, border_width)
669
+ DCL_ATTR_WRITER(Montage, compose)
670
+ DCL_ATTR_WRITER(Montage, filename)
671
+ DCL_ATTR_WRITER(Montage, fill)
672
+ DCL_ATTR_WRITER(Montage, font)
673
+ DCL_ATTR_WRITER(Montage, frame)
674
+ DCL_ATTR_WRITER(Montage, geometry)
675
+ DCL_ATTR_WRITER(Montage, gravity)
676
+ DCL_ATTR_WRITER(Montage, matte_color)
677
+ DCL_ATTR_WRITER(Montage, pointsize)
678
+ DCL_ATTR_WRITER(Montage, shadow)
679
+ DCL_ATTR_WRITER(Montage, stroke)
680
+ DCL_ATTR_WRITER(Montage, texture)
681
+ DCL_ATTR_WRITER(Montage, tile)
682
+ DCL_ATTR_WRITER(Montage, title)
683
+
684
+ /*-----------------------------------------------------------------------*/
685
+ /* Class Magick::Image::Info */
686
+ /*-----------------------------------------------------------------------*/
687
+
688
+ Class_Info = rb_define_class_under(Class_Image, "Info", rb_cObject);
689
+
690
+ rb_define_alloc_func(Class_Info, Info_alloc);
691
+
692
+ rb_define_method(Class_Info, "initialize", Info_initialize, 0);
693
+ rb_define_method(Class_Info, "channel", Info_channel, -1);
694
+ rb_define_method(Class_Info, "freeze", rm_no_freeze, 0);
695
+ rb_define_method(Class_Info, "define", Info_define, -1);
696
+ rb_define_method(Class_Info, "[]=", Info_aset, -1);
697
+ rb_define_method(Class_Info, "[]", Info_aref, -1);
698
+ rb_define_method(Class_Info, "undefine", Info_undefine, 2);
699
+
700
+ DCL_ATTR_ACCESSOR(Info, antialias)
701
+ DCL_ATTR_ACCESSOR(Info, attenuate)
702
+ DCL_ATTR_ACCESSOR(Info, authenticate)
703
+ DCL_ATTR_ACCESSOR(Info, background_color)
704
+ DCL_ATTR_ACCESSOR(Info, border_color)
705
+ DCL_ATTR_ACCESSOR(Info, caption)
706
+ DCL_ATTR_ACCESSOR(Info, colorspace)
707
+ DCL_ATTR_ACCESSOR(Info, comment)
708
+ DCL_ATTR_ACCESSOR(Info, compression)
709
+ DCL_ATTR_ACCESSOR(Info, delay)
710
+ DCL_ATTR_ACCESSOR(Info, density)
711
+ DCL_ATTR_ACCESSOR(Info, depth)
712
+ DCL_ATTR_ACCESSOR(Info, dispose)
713
+ DCL_ATTR_ACCESSOR(Info, dither)
714
+ DCL_ATTR_ACCESSOR(Info, endian)
715
+ DCL_ATTR_ACCESSOR(Info, extract)
716
+ DCL_ATTR_ACCESSOR(Info, filename)
717
+ DCL_ATTR_ACCESSOR(Info, fill)
718
+ DCL_ATTR_ACCESSOR(Info, font)
719
+ DCL_ATTR_ACCESSOR(Info, format)
720
+ DCL_ATTR_ACCESSOR(Info, fuzz)
721
+ DCL_ATTR_ACCESSOR(Info, gravity)
722
+ DCL_ATTR_ACCESSOR(Info, group)
723
+ DCL_ATTR_ACCESSOR(Info, image_type)
724
+ DCL_ATTR_ACCESSOR(Info, interlace)
725
+ DCL_ATTR_ACCESSOR(Info, label)
726
+ DCL_ATTR_ACCESSOR(Info, matte_color)
727
+ DCL_ATTR_WRITER(Info, monitor)
728
+ DCL_ATTR_ACCESSOR(Info, monochrome)
729
+ DCL_ATTR_ACCESSOR(Info, number_scenes)
730
+ DCL_ATTR_ACCESSOR(Info, orientation)
731
+ DCL_ATTR_ACCESSOR(Info, origin) // new in 6.3.1
732
+ DCL_ATTR_ACCESSOR(Info, page)
733
+ DCL_ATTR_ACCESSOR(Info, pointsize)
734
+ DCL_ATTR_ACCESSOR(Info, quality)
735
+ DCL_ATTR_ACCESSOR(Info, sampling_factor)
736
+ DCL_ATTR_ACCESSOR(Info, scene)
737
+ DCL_ATTR_ACCESSOR(Info, server_name)
738
+ DCL_ATTR_ACCESSOR(Info, size)
739
+ DCL_ATTR_ACCESSOR(Info, stroke)
740
+ DCL_ATTR_ACCESSOR(Info, stroke_width)
741
+ DCL_ATTR_WRITER(Info, texture)
742
+ DCL_ATTR_ACCESSOR(Info, tile_offset)
743
+ DCL_ATTR_ACCESSOR(Info, transparent_color)
744
+ DCL_ATTR_ACCESSOR(Info, undercolor)
745
+ DCL_ATTR_ACCESSOR(Info, units)
746
+ DCL_ATTR_ACCESSOR(Info, view)
747
+
748
+
749
+ /*-----------------------------------------------------------------------*/
750
+ /* Class Magick::Image::PolaroidOptions */
751
+ /*-----------------------------------------------------------------------*/
752
+
753
+ Class_PolaroidOptions = rb_define_class_under(Class_Image, "PolaroidOptions", rb_cObject);
754
+
755
+ rb_define_alloc_func(Class_PolaroidOptions, PolaroidOptions_alloc);
756
+
757
+ rb_define_method(Class_PolaroidOptions, "initialize", PolaroidOptions_initialize, 0);
758
+
759
+ DCL_ATTR_WRITER(PolaroidOptions, shadow_color)
760
+ DCL_ATTR_WRITER(PolaroidOptions, border_color)
761
+ // The other attribute writer methods are implemented by Draw's functions
762
+ SHARE_ATTR_WRITER(PolaroidOptions, Draw, align)
763
+ SHARE_ATTR_WRITER(PolaroidOptions, Draw, decorate)
764
+ SHARE_ATTR_WRITER(PolaroidOptions, Draw, density)
765
+ SHARE_ATTR_WRITER(PolaroidOptions, Draw, encoding)
766
+ SHARE_ATTR_WRITER(PolaroidOptions, Draw, fill)
767
+ SHARE_ATTR_WRITER(PolaroidOptions, Draw, fill_pattern)
768
+ SHARE_ATTR_WRITER(PolaroidOptions, Draw, font)
769
+ SHARE_ATTR_WRITER(PolaroidOptions, Draw, font_family)
770
+ SHARE_ATTR_WRITER(PolaroidOptions, Draw, font_stretch)
771
+ SHARE_ATTR_WRITER(PolaroidOptions, Draw, font_style)
772
+ SHARE_ATTR_WRITER(PolaroidOptions, Draw, font_weight)
773
+ SHARE_ATTR_WRITER(PolaroidOptions, Draw, gravity)
774
+ SHARE_ATTR_WRITER(PolaroidOptions, Draw, pointsize)
775
+ SHARE_ATTR_WRITER(PolaroidOptions, Draw, stroke)
776
+ SHARE_ATTR_WRITER(PolaroidOptions, Draw, stroke_pattern)
777
+ SHARE_ATTR_WRITER(PolaroidOptions, Draw, stroke_width)
778
+ SHARE_ATTR_WRITER(PolaroidOptions, Draw, text_antialias)
779
+ SHARE_ATTR_WRITER(PolaroidOptions, Draw, undercolor)
780
+
781
+
782
+ /*-----------------------------------------------------------------------*/
783
+ /* Magick::******Fill classes and methods */
784
+ /*-----------------------------------------------------------------------*/
785
+
786
+ // class Magick::GradientFill
787
+ Class_GradientFill = rb_define_class_under(Module_Magick, "GradientFill", rb_cObject);
788
+
789
+ rb_define_alloc_func(Class_GradientFill, GradientFill_alloc);
790
+
791
+ rb_define_method(Class_GradientFill, "initialize", GradientFill_initialize, 6);
792
+ rb_define_method(Class_GradientFill, "fill", GradientFill_fill, 1);
793
+
794
+ // class Magick::TextureFill
795
+ Class_TextureFill = rb_define_class_under(Module_Magick, "TextureFill", rb_cObject);
796
+
797
+ rb_define_alloc_func(Class_TextureFill, TextureFill_alloc);
798
+
799
+ rb_define_method(Class_TextureFill, "initialize", TextureFill_initialize, 1);
800
+ rb_define_method(Class_TextureFill, "fill", TextureFill_fill, 1);
801
+
802
+ /*-----------------------------------------------------------------------*/
803
+ /* Class Magick::ImageMagickError < StandardError */
804
+ /* Class Magick::FatalImageMagickError < StandardError */
805
+ /*-----------------------------------------------------------------------*/
806
+
807
+ Class_ImageMagickError = rb_define_class_under(Module_Magick, "ImageMagickError", rb_eStandardError);
808
+ rb_define_method(Class_ImageMagickError, "initialize", ImageMagickError_initialize, -1);
809
+ rb_define_attr(Class_ImageMagickError, MAGICK_LOC, True, False);
810
+
811
+ Class_FatalImageMagickError = rb_define_class_under(Module_Magick, "FatalImageMagickError", rb_eStandardError);
812
+
813
+
814
+ /*-----------------------------------------------------------------------*/
815
+ /* Class Magick::DestroyedImageError < StandardError */
816
+ /*-----------------------------------------------------------------------*/
817
+ Class_DestroyedImageError = rb_define_class_under(Module_Magick, "DestroyedImageError", rb_eStandardError);
818
+
819
+
820
+ // Miscellaneous fixed-point constants
821
+ DEF_CONST(MaxRGB);
822
+ DEF_CONST(QuantumRange);
823
+ DEF_CONST(QuantumDepth);
824
+ DEF_CONST(OpaqueOpacity);
825
+ DEF_CONST(TransparentOpacity);
826
+
827
+ version_constants();
828
+
829
+ /*-----------------------------------------------------------------------*/
830
+ /* Class Magick::Enum */
831
+ /*-----------------------------------------------------------------------*/
832
+
833
+ // includes Comparable
834
+ Class_Enum = rb_define_class_under(Module_Magick, "Enum", rb_cObject);
835
+ rb_include_module(Class_Enum, rb_mComparable);
836
+
837
+ rb_define_alloc_func(Class_Enum, Enum_alloc);
838
+
839
+ rb_define_method(Class_Enum, "initialize", Enum_initialize, 2);
840
+ rb_define_method(Class_Enum, "to_s", Enum_to_s, 0);
841
+ rb_define_method(Class_Enum, "to_i", Enum_to_i, 0);
842
+ rb_define_method(Class_Enum, "<=>", Enum_spaceship, 1);
843
+ rb_define_method(Class_Enum, "===", Enum_case_eq, 1);
844
+
845
+ // AlignType constants
846
+ DEF_ENUM(AlignType)
847
+ ENUMERATOR(UndefinedAlign)
848
+ ENUMERATOR(LeftAlign)
849
+ ENUMERATOR(CenterAlign)
850
+ ENUMERATOR(RightAlign)
851
+ END_ENUM
852
+
853
+ // AlphaChannelType constants
854
+ DEF_ENUM(AlphaChannelType)
855
+ ENUMERATOR(UndefinedAlphaChannel)
856
+ ENUMERATOR(ActivateAlphaChannel)
857
+ ENUMERATOR(DeactivateAlphaChannel)
858
+ ENUMERATOR(ResetAlphaChannel) /* deprecated */
859
+ ENUMERATOR(SetAlphaChannel)
860
+ #if defined(HAVE_ENUM_COPYALPHACHANNEL)
861
+ ENUMERATOR(CopyAlphaChannel)
862
+ ENUMERATOR(ExtractAlphaChannel)
863
+ ENUMERATOR(OpaqueAlphaChannel)
864
+ ENUMERATOR(ShapeAlphaChannel)
865
+ ENUMERATOR(TransparentAlphaChannel)
866
+ #endif
867
+ #if defined(HAVE_ENUM_BACKGROUNDALPHACHANNEL)
868
+ ENUMERATOR(BackgroundAlphaChannel)
869
+ #endif
870
+ END_ENUM
871
+
872
+ // AnchorType constants (for Draw#text_anchor - these are not defined by ImageMagick)
873
+ DEF_ENUM(AnchorType)
874
+ ENUMERATOR(StartAnchor)
875
+ ENUMERATOR(MiddleAnchor)
876
+ ENUMERATOR(EndAnchor)
877
+ END_ENUM
878
+
879
+ // ChannelType constants
880
+ DEF_ENUM(ChannelType)
881
+ ENUMERATOR(UndefinedChannel)
882
+ ENUMERATOR(RedChannel)
883
+ ENUMERATOR(CyanChannel)
884
+ ENUMERATOR(GreenChannel)
885
+ ENUMERATOR(MagentaChannel)
886
+ ENUMERATOR(BlueChannel)
887
+ ENUMERATOR(YellowChannel)
888
+ ENUMERATOR(OpacityChannel)
889
+
890
+
891
+ ENUMERATOR(BlackChannel)
892
+ ENUMERATOR(MatteChannel)
893
+ ENUMERATOR(IndexChannel)
894
+ ENUMERATOR(GrayChannel)
895
+ ENUMERATOR(AllChannels)
896
+
897
+ // Define alternate names for ChannelType enums for Image::Info#channel=
898
+ // AlphaChannel == OpacityChannel
899
+ _enum = rm_enum_new(Class_ChannelType, ID2SYM(rb_intern("AlphaChannel")), INT2FIX(OpacityChannel));
900
+ rb_define_const(Module_Magick, "AlphaChannel", _enum);
901
+
902
+ // DefaultChannels
903
+ _enum = rm_enum_new(Class_ChannelType, ID2SYM(rb_intern("DefaultChannels")), INT2FIX(0xff & ~OpacityChannel));
904
+ rb_define_const(Module_Magick, "DefaultChannels", _enum);
905
+
906
+ // HueChannel == RedChannel
907
+ _enum = rm_enum_new(Class_ChannelType, ID2SYM(rb_intern("HueChannel")), INT2FIX(RedChannel));
908
+ rb_define_const(Module_Magick, "HueChannel", _enum);
909
+
910
+ // LuminosityChannel = BlueChannel
911
+ _enum = rm_enum_new(Class_ChannelType, ID2SYM(rb_intern("LuminosityChannel")), INT2FIX(BlueChannel));
912
+ rb_define_const(Module_Magick, "LuminosityChannel", _enum);
913
+
914
+ // SaturationChannel = GreenChannel
915
+ _enum = rm_enum_new(Class_ChannelType, ID2SYM(rb_intern("SaturationChannel")), INT2FIX(GreenChannel));
916
+ rb_define_const(Module_Magick, "SaturationChannel", _enum);
917
+
918
+
919
+ END_ENUM
920
+
921
+ // ClassType constants
922
+ DEF_ENUM(ClassType)
923
+ ENUMERATOR(UndefinedClass)
924
+ ENUMERATOR(PseudoClass)
925
+ ENUMERATOR(DirectClass)
926
+ END_ENUM
927
+
928
+ // ColorspaceType constants
929
+ DEF_ENUM(ColorspaceType)
930
+ ENUMERATOR(UndefinedColorspace)
931
+ ENUMERATOR(RGBColorspace)
932
+ ENUMERATOR(GRAYColorspace)
933
+ ENUMERATOR(TransparentColorspace)
934
+ ENUMERATOR(OHTAColorspace)
935
+ ENUMERATOR(XYZColorspace)
936
+ ENUMERATOR(YCbCrColorspace)
937
+ ENUMERATOR(YCCColorspace)
938
+ ENUMERATOR(YIQColorspace)
939
+ ENUMERATOR(YPbPrColorspace)
940
+ ENUMERATOR(YUVColorspace)
941
+ ENUMERATOR(CMYKColorspace)
942
+ rb_define_const(Module_Magick, "SRGBColorspace"
943
+ , rm_enum_new(Class_ColorspaceType
944
+ , ID2SYM(rb_intern("SRGBColorspace"))
945
+ , INT2FIX(sRGBColorspace)));
946
+ ENUMERATOR(HSLColorspace)
947
+ ENUMERATOR(HWBColorspace)
948
+ ENUMERATOR(HSBColorspace)
949
+ ENUMERATOR(LABColorspace)
950
+ ENUMERATOR(Rec601LumaColorspace)
951
+ ENUMERATOR(Rec601YCbCrColorspace)
952
+ ENUMERATOR(Rec709LumaColorspace)
953
+ ENUMERATOR(Rec709YCbCrColorspace)
954
+ ENUMERATOR(LogColorspace)
955
+ ENUMERATOR(CMYColorspace)
956
+ END_ENUM
957
+
958
+ // ComplianceType constants are defined as enums but used as bit flags
959
+ DEF_ENUM(ComplianceType)
960
+ ENUMERATOR(UndefinedCompliance)
961
+
962
+ // AllCompliance is 0xffff, not too useful for us!
963
+ rb_define_const(Module_Magick, "AllCompliance"
964
+ , rm_enum_new(Class_ComplianceType
965
+ , ID2SYM(rb_intern("AllCompliance"))
966
+ , INT2FIX(SVGCompliance|X11Compliance|XPMCompliance)));
967
+
968
+ ENUMERATOR(NoCompliance)
969
+ ENUMERATOR(SVGCompliance)
970
+ ENUMERATOR(X11Compliance)
971
+ ENUMERATOR(XPMCompliance)
972
+ END_ENUM
973
+
974
+ // CompositeOperator constants
975
+ DEF_ENUM(CompositeOperator)
976
+ ENUMERATOR(UndefinedCompositeOp)
977
+ ENUMERATOR(NoCompositeOp)
978
+ ENUMERATOR(AddCompositeOp)
979
+ ENUMERATOR(AtopCompositeOp)
980
+ ENUMERATOR(BlendCompositeOp)
981
+ #if defined(HAVE_ENUM_BLURCOMPOSITEOP)
982
+ ENUMERATOR(BlurCompositeOp)
983
+ #endif
984
+ ENUMERATOR(BumpmapCompositeOp)
985
+ ENUMERATOR(ChangeMaskCompositeOp)
986
+ ENUMERATOR(ClearCompositeOp)
987
+ ENUMERATOR(ColorBurnCompositeOp)
988
+ ENUMERATOR(ColorDodgeCompositeOp)
989
+ ENUMERATOR(ColorizeCompositeOp)
990
+ ENUMERATOR(CopyBlackCompositeOp)
991
+ ENUMERATOR(CopyBlueCompositeOp)
992
+ ENUMERATOR(CopyCompositeOp)
993
+ ENUMERATOR(CopyCyanCompositeOp)
994
+ ENUMERATOR(CopyGreenCompositeOp)
995
+ ENUMERATOR(CopyMagentaCompositeOp)
996
+ ENUMERATOR(CopyOpacityCompositeOp)
997
+ ENUMERATOR(CopyRedCompositeOp)
998
+ ENUMERATOR(CopyYellowCompositeOp)
999
+ ENUMERATOR(DarkenCompositeOp)
1000
+ #if defined(HAVE_ENUM_DISTORTCOMPOSITEOP)
1001
+ ENUMERATOR(DistortCompositeOp)
1002
+ #endif
1003
+ ENUMERATOR(DivideCompositeOp)
1004
+ ENUMERATOR(DstAtopCompositeOp)
1005
+ ENUMERATOR(DstCompositeOp)
1006
+ ENUMERATOR(DstInCompositeOp)
1007
+ ENUMERATOR(DstOutCompositeOp)
1008
+ ENUMERATOR(DstOverCompositeOp)
1009
+ ENUMERATOR(DifferenceCompositeOp)
1010
+ ENUMERATOR(DisplaceCompositeOp)
1011
+ ENUMERATOR(DissolveCompositeOp)
1012
+ ENUMERATOR(ExclusionCompositeOp)
1013
+ ENUMERATOR(HardLightCompositeOp)
1014
+ ENUMERATOR(HueCompositeOp)
1015
+ ENUMERATOR(InCompositeOp)
1016
+ ENUMERATOR(LightenCompositeOp)
1017
+ #if defined(HAVE_ENUM_LINEARBURNCOMPOSITEOP)
1018
+ ENUMERATOR(LinearBurnCompositeOp)
1019
+ #endif
1020
+ #if defined(HAVE_ENUM_LINEARDODGECOMPOSITEOP)
1021
+ ENUMERATOR(LinearDodgeCompositeOp)
1022
+ #endif
1023
+ ENUMERATOR(LinearLightCompositeOp)
1024
+ ENUMERATOR(LuminizeCompositeOp)
1025
+ ENUMERATOR(MinusCompositeOp)
1026
+ ENUMERATOR(ModulateCompositeOp)
1027
+ ENUMERATOR(MultiplyCompositeOp)
1028
+ ENUMERATOR(OutCompositeOp)
1029
+ ENUMERATOR(OverCompositeOp)
1030
+ ENUMERATOR(OverlayCompositeOp)
1031
+ #if defined(HAVE_ENUM_PEGTOPLIGHTCOMPOSITEOP)
1032
+ ENUMERATOR(PegtopLightCompositeOp)
1033
+ #endif
1034
+ #if defined(HAVE_ENUM_PINLIGHTCOMPOSITEOP)
1035
+ ENUMERATOR(PinLightCompositeOp)
1036
+ #endif
1037
+ ENUMERATOR(PlusCompositeOp)
1038
+ ENUMERATOR(ReplaceCompositeOp) // synonym for CopyCompositeOp
1039
+ ENUMERATOR(SaturateCompositeOp)
1040
+ ENUMERATOR(ScreenCompositeOp)
1041
+ ENUMERATOR(SoftLightCompositeOp)
1042
+ ENUMERATOR(SrcAtopCompositeOp)
1043
+ ENUMERATOR(SrcCompositeOp)
1044
+ ENUMERATOR(SrcInCompositeOp)
1045
+ ENUMERATOR(SrcOutCompositeOp)
1046
+ ENUMERATOR(SrcOverCompositeOp)
1047
+ ENUMERATOR(SubtractCompositeOp)
1048
+ ENUMERATOR(ThresholdCompositeOp)
1049
+ #if defined(HAVE_ENUM_VIVIDLIGHTCOMPOSITEOP)
1050
+ ENUMERATOR(VividLightCompositeOp)
1051
+ #endif
1052
+ ENUMERATOR(XorCompositeOp)
1053
+ END_ENUM
1054
+
1055
+ // CompressionType constants
1056
+ DEF_ENUM(CompressionType)
1057
+ ENUMERATOR(UndefinedCompression)
1058
+ ENUMERATOR(NoCompression)
1059
+ #if defined(HAVE_ENUM_B44COMPRESSION)
1060
+ ENUMERATOR(B44Compression)
1061
+ #endif
1062
+ #if defined(HAVE_ENUM_B44ACOMPRESSION)
1063
+ ENUMERATOR(B44ACompression)
1064
+ #endif
1065
+ ENUMERATOR(BZipCompression)
1066
+ #if defined(HAVE_ENUM_DXT1COMPRESSION)
1067
+ ENUMERATOR(DXT1Compression)
1068
+ #endif
1069
+ #if defined(HAVE_ENUM_DXT3COMPRESSION)
1070
+ ENUMERATOR(DXT3Compression)
1071
+ #endif
1072
+ #if defined(HAVE_ENUM_DXT5COMPRESSION)
1073
+ ENUMERATOR(DXT5Compression)
1074
+ #endif
1075
+ ENUMERATOR(FaxCompression)
1076
+ ENUMERATOR(Group4Compression)
1077
+ ENUMERATOR(JPEGCompression)
1078
+ ENUMERATOR(JPEG2000Compression)
1079
+ ENUMERATOR(LosslessJPEGCompression)
1080
+ ENUMERATOR(LZWCompression)
1081
+ #if defined(HAVE_ENUM_PIZCOMPRESSION)
1082
+ ENUMERATOR(PizCompression)
1083
+ #endif
1084
+ #if defined(HAVE_ENUM_PXR24COMPRESSION)
1085
+ ENUMERATOR(Pxr24Compression)
1086
+ #endif
1087
+ ENUMERATOR(RLECompression)
1088
+ ENUMERATOR(ZipCompression)
1089
+ #if defined(HAVE_ENUM_ZIPSCOMPRESSION)
1090
+ ENUMERATOR(ZipSCompression)
1091
+ #endif
1092
+ END_ENUM
1093
+
1094
+ // DecorationType constants
1095
+ DEF_ENUM(DecorationType)
1096
+ ENUMERATOR(NoDecoration)
1097
+ ENUMERATOR(UnderlineDecoration)
1098
+ ENUMERATOR(OverlineDecoration)
1099
+ ENUMERATOR(LineThroughDecoration)
1100
+ END_ENUM
1101
+
1102
+ // DisposeType constants
1103
+ DEF_ENUM(DisposeType)
1104
+ ENUMERATOR(UndefinedDispose)
1105
+ ENUMERATOR(BackgroundDispose)
1106
+ ENUMERATOR(NoneDispose)
1107
+ ENUMERATOR(PreviousDispose)
1108
+ END_ENUM
1109
+
1110
+ // DistortImage "method" argument values
1111
+ DEF_ENUM(DistortImageMethod)
1112
+ ENUMERATOR(UndefinedDistortion)
1113
+ ENUMERATOR(AffineDistortion)
1114
+ ENUMERATOR(AffineProjectionDistortion)
1115
+ ENUMERATOR(ArcDistortion)
1116
+ #if defined(HAVE_ENUM_POLARDISTORTION)
1117
+ ENUMERATOR(PolarDistortion)
1118
+ #endif
1119
+ #if defined(HAVE_ENUM_DEPOLARDISTORTION)
1120
+ ENUMERATOR(DePolarDistortion)
1121
+ #endif
1122
+ #if defined(HAVE_ENUM_BARRELDISTORTION)
1123
+ ENUMERATOR(BarrelDistortion)
1124
+ #endif
1125
+ ENUMERATOR(BilinearDistortion)
1126
+ #if defined(HAVE_ENUM_BILINEARFORWARDDISTORTION)
1127
+ ENUMERATOR(BilinearForwardDistortion)
1128
+ #endif
1129
+ #if defined(HAVE_ENUM_BILINEARREVERSEDISTORTION)
1130
+ ENUMERATOR(BilinearReverseDistortion)
1131
+ #endif
1132
+ ENUMERATOR(PerspectiveDistortion)
1133
+ ENUMERATOR(PerspectiveProjectionDistortion)
1134
+ #if defined(HAVE_ENUM_POLYNOMIALDISTORTION)
1135
+ ENUMERATOR(PolynomialDistortion)
1136
+ #endif
1137
+ ENUMERATOR(ScaleRotateTranslateDistortion)
1138
+ #if defined(HAVE_ENUM_SHEPARDSDISTORTION)
1139
+ ENUMERATOR(ShepardsDistortion)
1140
+ #endif
1141
+ #if defined(HAVE_ENUM_BARRELINVERSEDISTORTION)
1142
+ ENUMERATOR(BarrelInverseDistortion)
1143
+ #endif
1144
+ END_ENUM
1145
+
1146
+ #if defined(HAVE_TYPE_DITHERMETHOD)
1147
+ DEF_ENUM(DitherMethod)
1148
+ ENUMERATOR(UndefinedDitherMethod)
1149
+ #if defined(HAVE_ENUM_NODITHERMETHOD)
1150
+ ENUMERATOR(NoDitherMethod)
1151
+ #endif
1152
+ ENUMERATOR(RiemersmaDitherMethod)
1153
+ ENUMERATOR(FloydSteinbergDitherMethod)
1154
+ END_ENUM
1155
+ #endif
1156
+
1157
+ DEF_ENUM(EndianType)
1158
+ ENUMERATOR(UndefinedEndian)
1159
+ ENUMERATOR(LSBEndian)
1160
+ ENUMERATOR(MSBEndian)
1161
+ END_ENUM
1162
+
1163
+ // FilterTypes constants
1164
+ DEF_ENUM(FilterTypes)
1165
+ ENUMERATOR(UndefinedFilter)
1166
+ ENUMERATOR(PointFilter)
1167
+ ENUMERATOR(BoxFilter)
1168
+ ENUMERATOR(TriangleFilter)
1169
+ ENUMERATOR(HermiteFilter)
1170
+ ENUMERATOR(HanningFilter)
1171
+ ENUMERATOR(HammingFilter)
1172
+ ENUMERATOR(BlackmanFilter)
1173
+ ENUMERATOR(GaussianFilter)
1174
+ ENUMERATOR(QuadraticFilter)
1175
+ ENUMERATOR(CubicFilter)
1176
+ ENUMERATOR(CatromFilter)
1177
+ ENUMERATOR(MitchellFilter)
1178
+ ENUMERATOR(LanczosFilter)
1179
+ ENUMERATOR(BesselFilter)
1180
+ ENUMERATOR(SincFilter)
1181
+ #if defined(HAVE_ENUM_KAISERFILTER)
1182
+ ENUMERATOR(KaiserFilter)
1183
+ #endif
1184
+ #if defined(HAVE_ENUM_WELSHFILTER)
1185
+ ENUMERATOR(WelshFilter)
1186
+ #endif
1187
+ #if defined(HAVE_ENUM_PARZENFILTER)
1188
+ ENUMERATOR(ParzenFilter)
1189
+ #endif
1190
+ #if defined(HAVE_ENUM_LAGRANGEFILTER)
1191
+ ENUMERATOR(LagrangeFilter)
1192
+ #endif
1193
+ #if defined(HAVE_ENUM_BOHMANFILTER)
1194
+ ENUMERATOR(BohmanFilter)
1195
+ #endif
1196
+ #if defined(HAVE_ENUM_BARTLETTFILTER)
1197
+ ENUMERATOR(BartlettFilter)
1198
+ #endif
1199
+ END_ENUM
1200
+
1201
+ // GravityType constants
1202
+ DEF_ENUM(GravityType)
1203
+ ENUMERATOR(UndefinedGravity)
1204
+ ENUMERATOR(ForgetGravity)
1205
+ ENUMERATOR(NorthWestGravity)
1206
+ ENUMERATOR(NorthGravity)
1207
+ ENUMERATOR(NorthEastGravity)
1208
+ ENUMERATOR(WestGravity)
1209
+ ENUMERATOR(CenterGravity)
1210
+ ENUMERATOR(EastGravity)
1211
+ ENUMERATOR(SouthWestGravity)
1212
+ ENUMERATOR(SouthGravity)
1213
+ ENUMERATOR(SouthEastGravity)
1214
+ ENUMERATOR(StaticGravity)
1215
+ END_ENUM
1216
+
1217
+ // ImageType constants
1218
+ DEF_ENUM(ImageType)
1219
+ ENUMERATOR(UndefinedType)
1220
+ ENUMERATOR(BilevelType)
1221
+ ENUMERATOR(GrayscaleType)
1222
+ ENUMERATOR(GrayscaleMatteType)
1223
+ ENUMERATOR(PaletteType)
1224
+ ENUMERATOR(PaletteMatteType)
1225
+ ENUMERATOR(TrueColorType)
1226
+ ENUMERATOR(TrueColorMatteType)
1227
+ ENUMERATOR(ColorSeparationType)
1228
+ ENUMERATOR(ColorSeparationMatteType)
1229
+ ENUMERATOR(OptimizeType)
1230
+ ENUMERATOR(PaletteBilevelMatteType)
1231
+ END_ENUM
1232
+
1233
+ // InterlaceType constants
1234
+ DEF_ENUM(InterlaceType)
1235
+ ENUMERATOR(UndefinedInterlace)
1236
+ ENUMERATOR(NoInterlace)
1237
+ ENUMERATOR(LineInterlace)
1238
+ ENUMERATOR(PlaneInterlace)
1239
+ ENUMERATOR(PartitionInterlace)
1240
+ ENUMERATOR(GIFInterlace)
1241
+ ENUMERATOR(JPEGInterlace)
1242
+ ENUMERATOR(PNGInterlace)
1243
+ END_ENUM
1244
+
1245
+ DEF_ENUM(InterpolatePixelMethod)
1246
+ ENUMERATOR(UndefinedInterpolatePixel)
1247
+ ENUMERATOR(AverageInterpolatePixel)
1248
+ ENUMERATOR(BicubicInterpolatePixel)
1249
+ ENUMERATOR(BilinearInterpolatePixel)
1250
+ ENUMERATOR(FilterInterpolatePixel)
1251
+ ENUMERATOR(IntegerInterpolatePixel)
1252
+ ENUMERATOR(MeshInterpolatePixel)
1253
+ ENUMERATOR(NearestNeighborInterpolatePixel)
1254
+ #if defined(HAVE_SPLINEINTERPOLATEPIXEL)
1255
+ ENUMERATOR(SplineInterpolatePixel)
1256
+ #endif
1257
+ END_ENUM
1258
+
1259
+ #if defined(HAVE_TYPE_MAGICKFUNCTION)
1260
+ DEF_ENUM(MagickFunction)
1261
+ ENUMERATOR(UndefinedFunction)
1262
+ ENUMERATOR(PolynomialFunction)
1263
+ ENUMERATOR(SinusoidFunction)
1264
+ #if defined(HAVE_ENUM_ARCSINFUNCTION)
1265
+ ENUMERATOR(ArcsinFunction)
1266
+ #endif
1267
+ #if defined(HAVE_ENUM_ARCTANFUNCTION)
1268
+ ENUMERATOR(ArctanFunction)
1269
+ #endif
1270
+ END_ENUM
1271
+ #endif
1272
+
1273
+ #if defined(HAVE_TYPE_IMAGELAYERMETHOD)
1274
+ DEF_ENUM(ImageLayerMethod)
1275
+ #else
1276
+ DEF_ENUM(MagickLayerMethod)
1277
+ #endif
1278
+ ENUMERATOR(UndefinedLayer)
1279
+ ENUMERATOR(CompareAnyLayer)
1280
+ ENUMERATOR(CompareClearLayer)
1281
+ ENUMERATOR(CompareOverlayLayer)
1282
+ ENUMERATOR(OptimizeLayer)
1283
+ ENUMERATOR(OptimizePlusLayer)
1284
+ ENUMERATOR(CoalesceLayer)
1285
+ ENUMERATOR(DisposeLayer)
1286
+ ENUMERATOR(OptimizeTransLayer)
1287
+ #if defined(HAVE_ENUM_OPTIMIZEIMAGELAYER)
1288
+ ENUMERATOR(OptimizeImageLayer)
1289
+ #endif
1290
+ ENUMERATOR(RemoveDupsLayer)
1291
+ ENUMERATOR(RemoveZeroLayer)
1292
+ ENUMERATOR(CompositeLayer)
1293
+ #if defined(HAVE_ENUM_MERGELAYER)
1294
+ ENUMERATOR(MergeLayer)
1295
+ #endif
1296
+ #if defined(HAVE_ENUM_MOSAICLAYER)
1297
+ ENUMERATOR(MosaicLayer)
1298
+ #endif
1299
+ #if defined(HAVE_ENUM_FLATTENLAYER)
1300
+ ENUMERATOR(FlattenLayer)
1301
+ #endif
1302
+ #if defined(HAVE_ENUM_TRIMBOUNDSLAYER)
1303
+ ENUMERATOR(TrimBoundsLayer)
1304
+ #endif
1305
+ END_ENUM
1306
+
1307
+ DEF_ENUM(MetricType)
1308
+ ENUMERATOR(UndefinedMetric)
1309
+ ENUMERATOR(AbsoluteErrorMetric)
1310
+ ENUMERATOR(MeanAbsoluteErrorMetric)
1311
+ ENUMERATOR(MeanErrorPerPixelMetric)
1312
+ ENUMERATOR(MeanSquaredErrorMetric)
1313
+ ENUMERATOR(PeakAbsoluteErrorMetric)
1314
+ ENUMERATOR(PeakSignalToNoiseRatioMetric)
1315
+ ENUMERATOR(RootMeanSquaredErrorMetric)
1316
+ END_ENUM
1317
+
1318
+ // NoiseType constants
1319
+ DEF_ENUM(NoiseType)
1320
+ ENUMERATOR(UniformNoise)
1321
+ ENUMERATOR(GaussianNoise)
1322
+ ENUMERATOR(MultiplicativeGaussianNoise)
1323
+ ENUMERATOR(ImpulseNoise)
1324
+ ENUMERATOR(LaplacianNoise)
1325
+ ENUMERATOR(PoissonNoise)
1326
+ ENUMERATOR(RandomNoise)
1327
+ END_ENUM
1328
+
1329
+ // Orientation constants
1330
+ DEF_ENUM(OrientationType)
1331
+ ENUMERATOR(UndefinedOrientation)
1332
+ ENUMERATOR(TopLeftOrientation)
1333
+ ENUMERATOR(TopRightOrientation)
1334
+ ENUMERATOR(BottomRightOrientation)
1335
+ ENUMERATOR(BottomLeftOrientation)
1336
+ ENUMERATOR(LeftTopOrientation)
1337
+ ENUMERATOR(RightTopOrientation)
1338
+ ENUMERATOR(RightBottomOrientation)
1339
+ ENUMERATOR(LeftBottomOrientation)
1340
+ END_ENUM
1341
+
1342
+ // Paint method constants
1343
+ DEF_ENUM(PaintMethod)
1344
+ ENUMERATOR(PointMethod)
1345
+ ENUMERATOR(ReplaceMethod)
1346
+ ENUMERATOR(FloodfillMethod)
1347
+ ENUMERATOR(FillToBorderMethod)
1348
+ ENUMERATOR(ResetMethod)
1349
+ END_ENUM
1350
+
1351
+ // PreviewType
1352
+ DEF_ENUM(PreviewType)
1353
+ ENUMERATOR(UndefinedPreview)
1354
+ ENUMERATOR(RotatePreview)
1355
+ ENUMERATOR(ShearPreview)
1356
+ ENUMERATOR(RollPreview)
1357
+ ENUMERATOR(HuePreview)
1358
+ ENUMERATOR(SaturationPreview)
1359
+ ENUMERATOR(BrightnessPreview)
1360
+ ENUMERATOR(GammaPreview)
1361
+ ENUMERATOR(SpiffPreview)
1362
+ ENUMERATOR(DullPreview)
1363
+ ENUMERATOR(GrayscalePreview)
1364
+ ENUMERATOR(QuantizePreview)
1365
+ ENUMERATOR(DespecklePreview)
1366
+ ENUMERATOR(ReduceNoisePreview)
1367
+ ENUMERATOR(AddNoisePreview)
1368
+ ENUMERATOR(SharpenPreview)
1369
+ ENUMERATOR(BlurPreview)
1370
+ ENUMERATOR(ThresholdPreview)
1371
+ ENUMERATOR(EdgeDetectPreview)
1372
+ ENUMERATOR(SpreadPreview)
1373
+ ENUMERATOR(SolarizePreview)
1374
+ ENUMERATOR(ShadePreview)
1375
+ ENUMERATOR(RaisePreview)
1376
+ ENUMERATOR(SegmentPreview)
1377
+ ENUMERATOR(SwirlPreview)
1378
+ ENUMERATOR(ImplodePreview)
1379
+ ENUMERATOR(WavePreview)
1380
+ ENUMERATOR(OilPaintPreview)
1381
+ ENUMERATOR(CharcoalDrawingPreview)
1382
+ ENUMERATOR(JPEGPreview)
1383
+ END_ENUM
1384
+
1385
+ DEF_ENUM(QuantumExpressionOperator)
1386
+ ENUMERATOR(UndefinedQuantumOperator)
1387
+ ENUMERATOR(AddQuantumOperator)
1388
+ ENUMERATOR(AndQuantumOperator)
1389
+ ENUMERATOR(DivideQuantumOperator)
1390
+ ENUMERATOR(LShiftQuantumOperator)
1391
+ ENUMERATOR(MaxQuantumOperator)
1392
+ ENUMERATOR(MinQuantumOperator)
1393
+ ENUMERATOR(MultiplyQuantumOperator)
1394
+ ENUMERATOR(OrQuantumOperator)
1395
+ ENUMERATOR(RShiftQuantumOperator)
1396
+ ENUMERATOR(SubtractQuantumOperator)
1397
+ ENUMERATOR(XorQuantumOperator)
1398
+ #if defined(HAVE_ENUM_POWEVALUATEOPERATOR)
1399
+ ENUMERATOR(PowQuantumOperator)
1400
+ #endif
1401
+ #if defined(HAVE_ENUM_LOGEVALUATEOPERATOR)
1402
+ ENUMERATOR(LogQuantumOperator)
1403
+ #endif
1404
+ #if defined(HAVE_ENUM_THRESHOLDEVALUATEOPERATOR)
1405
+ ENUMERATOR(ThresholdQuantumOperator)
1406
+ #endif
1407
+ #if defined(HAVE_ENUM_THRESHOLDBLACKEVALUATEOPERATOR)
1408
+ ENUMERATOR(ThresholdBlackQuantumOperator)
1409
+ #endif
1410
+ #if defined(HAVE_ENUM_THRESHOLDWHITEEVALUATEOPERATOR)
1411
+ ENUMERATOR(ThresholdWhiteQuantumOperator)
1412
+ #endif
1413
+ #if defined(HAVE_ENUM_GAUSSIANNOISEEVALUATEOPERATOR)
1414
+ ENUMERATOR(GaussianNoiseQuantumOperator)
1415
+ #endif
1416
+ #if defined(HAVE_ENUM_IMPULSENOISEEVALUATEOPERATOR)
1417
+ ENUMERATOR(ImpulseNoiseQuantumOperator)
1418
+ #endif
1419
+ #if defined(HAVE_ENUM_LAPLACIANNOISEEVALUATEOPERATOR)
1420
+ ENUMERATOR(LaplacianNoiseQuantumOperator)
1421
+ #endif
1422
+ #if defined(HAVE_ENUM_MULTIPLICATIVENOISEEVALUATEOPERATOR)
1423
+ ENUMERATOR(MultiplicativeNoiseQuantumOperator)
1424
+ #endif
1425
+ #if defined(HAVE_ENUM_POISSONNOISEEVALUATEOPERATOR)
1426
+ ENUMERATOR(PoissonNoiseQuantumOperator)
1427
+ #endif
1428
+ #if defined(HAVE_ENUM_UNIFORMNOISEEVALUATEOPERATOR)
1429
+ ENUMERATOR(UniformNoiseQuantumOperator)
1430
+ #endif
1431
+ #if defined(HAVE_ENUM_COSINEEVALUATEOPERATOR)
1432
+ ENUMERATOR(CosineQuantumOperator)
1433
+ #endif
1434
+ #if defined(HAVE_ENUM_SINEEVALUATEOPERATOR)
1435
+ ENUMERATOR(SineQuantumOperator)
1436
+ #endif
1437
+ #if defined(HAVE_ENUM_ADDMODULUSEVALUATEOPERATOR)
1438
+ ENUMERATOR(AddModulusQuantumOperator)
1439
+ #endif
1440
+ END_ENUM
1441
+
1442
+ // RenderingIntent
1443
+ DEF_ENUM(RenderingIntent)
1444
+ ENUMERATOR(UndefinedIntent)
1445
+ ENUMERATOR(SaturationIntent)
1446
+ ENUMERATOR(PerceptualIntent)
1447
+ ENUMERATOR(AbsoluteIntent)
1448
+ ENUMERATOR(RelativeIntent)
1449
+ END_ENUM
1450
+
1451
+ // ResolutionType constants
1452
+ DEF_ENUM(ResolutionType)
1453
+ ENUMERATOR(UndefinedResolution)
1454
+ ENUMERATOR(PixelsPerInchResolution)
1455
+ ENUMERATOR(PixelsPerCentimeterResolution)
1456
+ END_ENUM
1457
+
1458
+ #if defined(HAVE_SPARSECOLORIMAGE)
1459
+ DEF_ENUM(SparseColorMethod)
1460
+ ENUMERATOR(UndefinedColorInterpolate)
1461
+ ENUMERATOR(BarycentricColorInterpolate)
1462
+ ENUMERATOR(BilinearColorInterpolate)
1463
+ //ENUMERATOR(PolynomialColorInterpolate)
1464
+ ENUMERATOR(ShepardsColorInterpolate)
1465
+ ENUMERATOR(VoronoiColorInterpolate)
1466
+ END_ENUM
1467
+ #endif
1468
+
1469
+ // SpreadMethod
1470
+ DEF_ENUM(SpreadMethod)
1471
+ ENUMERATOR(UndefinedSpread)
1472
+ ENUMERATOR(PadSpread)
1473
+ ENUMERATOR(ReflectSpread)
1474
+ ENUMERATOR(RepeatSpread)
1475
+ END_ENUM
1476
+
1477
+ // StorageType
1478
+ DEF_ENUM(StorageType)
1479
+ ENUMERATOR(UndefinedPixel)
1480
+ ENUMERATOR(CharPixel)
1481
+ ENUMERATOR(DoublePixel)
1482
+ ENUMERATOR(FloatPixel)
1483
+ ENUMERATOR(IntegerPixel)
1484
+ ENUMERATOR(LongPixel)
1485
+ ENUMERATOR(QuantumPixel)
1486
+ ENUMERATOR(ShortPixel)
1487
+ END_ENUM
1488
+
1489
+ // StretchType constants
1490
+ DEF_ENUM(StretchType)
1491
+ ENUMERATOR(NormalStretch)
1492
+ ENUMERATOR(UltraCondensedStretch)
1493
+ ENUMERATOR(ExtraCondensedStretch)
1494
+ ENUMERATOR(CondensedStretch)
1495
+ ENUMERATOR(SemiCondensedStretch)
1496
+ ENUMERATOR(SemiExpandedStretch)
1497
+ ENUMERATOR(ExpandedStretch)
1498
+ ENUMERATOR(ExtraExpandedStretch)
1499
+ ENUMERATOR(UltraExpandedStretch)
1500
+ ENUMERATOR(AnyStretch)
1501
+ END_ENUM
1502
+
1503
+ // StyleType constants
1504
+ DEF_ENUM(StyleType)
1505
+ ENUMERATOR(NormalStyle)
1506
+ ENUMERATOR(ItalicStyle)
1507
+ ENUMERATOR(ObliqueStyle)
1508
+ ENUMERATOR(AnyStyle)
1509
+ END_ENUM
1510
+
1511
+ // VirtualPixelMethod
1512
+ DEF_ENUM(VirtualPixelMethod)
1513
+ ENUMERATOR(UndefinedVirtualPixelMethod)
1514
+ ENUMERATOR(EdgeVirtualPixelMethod)
1515
+ ENUMERATOR(MirrorVirtualPixelMethod)
1516
+ ENUMERATOR(TileVirtualPixelMethod)
1517
+ ENUMERATOR(TransparentVirtualPixelMethod)
1518
+ ENUMERATOR(BackgroundVirtualPixelMethod)
1519
+ ENUMERATOR(DitherVirtualPixelMethod)
1520
+ ENUMERATOR(RandomVirtualPixelMethod)
1521
+ ENUMERATOR(ConstantVirtualPixelMethod)
1522
+ ENUMERATOR(MaskVirtualPixelMethod)
1523
+ ENUMERATOR(BlackVirtualPixelMethod)
1524
+ ENUMERATOR(GrayVirtualPixelMethod)
1525
+ ENUMERATOR(WhiteVirtualPixelMethod)
1526
+ #if defined(HAVE_ENUM_HORIZONTALTILEVIRTUALPIXELMETHOD)
1527
+ ENUMERATOR(HorizontalTileVirtualPixelMethod)
1528
+ #endif
1529
+ #if defined(HAVE_ENUM_VERTICALTILEVIRTUALPIXELMETHOD)
1530
+ ENUMERATOR(VerticalTileVirtualPixelMethod)
1531
+ #endif
1532
+ #if defined(HAVE_ENUM_HORIZONTALTILEEDGEVIRTUALPIXELMETHOD)
1533
+ ENUMERATOR(HorizontalTileEdgeVirtualPixelMethod)
1534
+ #endif
1535
+ #if defined(HAVE_ENUM_VERTICALTILEEDGEVIRTUALPIXELMETHOD)
1536
+ ENUMERATOR(VerticalTileEdgeVirtualPixelMethod)
1537
+ #endif
1538
+ #if defined(HAVE_ENUM_CHECKERTILEVIRTUALPIXELMETHOD)
1539
+ ENUMERATOR(CheckerTileVirtualPixelMethod)
1540
+ #endif
1541
+ END_ENUM
1542
+ // WeightType constants
1543
+ DEF_ENUM(WeightType)
1544
+ ENUMERATOR(AnyWeight)
1545
+ ENUMERATOR(NormalWeight)
1546
+ ENUMERATOR(BoldWeight)
1547
+ ENUMERATOR(BolderWeight)
1548
+ ENUMERATOR(LighterWeight)
1549
+ END_ENUM
1550
+
1551
+ /*-----------------------------------------------------------------------*/
1552
+ /* Struct classes */
1553
+ /*-----------------------------------------------------------------------*/
1554
+
1555
+ // Pass NULL as the structure name to keep them from polluting the Struct
1556
+ // namespace. The only way to use these classes is via the Magick:: namespace.
1557
+
1558
+ // Magick::AffineMatrix
1559
+ Class_AffineMatrix = rb_struct_define(NULL, "sx", "rx", "ry", "sy", "tx", "ty", NULL);
1560
+ rb_define_const(Module_Magick, "AffineMatrix", Class_AffineMatrix);
1561
+
1562
+ // Magick::Primary
1563
+ Class_Primary = rb_struct_define(NULL, "x", "y", "z", NULL);
1564
+ rb_define_method(Class_Primary, "to_s", PrimaryInfo_to_s, 0);
1565
+ rb_define_const(Module_Magick, "Primary", Class_Primary);
1566
+
1567
+ // Magick::Chromaticity
1568
+ Class_Chromaticity = rb_struct_define(NULL
1569
+ , "red_primary"
1570
+ , "green_primary"
1571
+ , "blue_primary"
1572
+ , "white_point"
1573
+ , NULL);
1574
+ rb_define_method(Class_Chromaticity, "to_s", ChromaticityInfo_to_s, 0);
1575
+ rb_define_const(Module_Magick, "Chromaticity", Class_Chromaticity);
1576
+
1577
+ // Magick::Color
1578
+ Class_Color = rb_struct_define(NULL, "name", "compliance", "color", NULL);
1579
+ rb_define_method(Class_Color, "to_s", Color_to_s, 0);
1580
+ rb_define_const(Module_Magick, "Color", Class_Color);
1581
+
1582
+ // Magick::Point
1583
+ Class_Point = rb_struct_define(NULL, "x", "y", NULL);
1584
+ rb_define_const(Module_Magick, "Point", Class_Point);
1585
+
1586
+ // Magick::Rectangle
1587
+ Class_Rectangle = rb_struct_define(NULL, "width", "height", "x", "y", NULL);
1588
+ rb_define_method(Class_Rectangle, "to_s", RectangleInfo_to_s, 0);
1589
+ rb_define_const(Module_Magick, "Rectangle", Class_Rectangle);
1590
+
1591
+ // Magick::Segment
1592
+ Class_Segment = rb_struct_define(NULL, "x1", "y1", "x2", "y2", NULL);
1593
+ rb_define_method(Class_Segment, "to_s", SegmentInfo_to_s, 0);
1594
+ rb_define_const(Module_Magick, "Segment", Class_Segment);
1595
+
1596
+ // Magick::Font
1597
+ Class_Font = rb_struct_define(NULL, "name", "description",
1598
+ "family", "style", "stretch", "weight",
1599
+ "encoding", "foundry", "format", NULL);
1600
+ rb_define_method(Class_Font, "to_s", Font_to_s, 0);
1601
+ rb_define_const(Module_Magick, "Font", Class_Font);
1602
+
1603
+ // Magick::TypeMetric
1604
+ Class_TypeMetric = rb_struct_define(NULL, "pixels_per_em", "ascent", "descent",
1605
+ "width", "height", "max_advance", "bounds",
1606
+ "underline_position", "underline_thickness", NULL);
1607
+ rb_define_method(Class_TypeMetric, "to_s", TypeMetric_to_s, 0);
1608
+ rb_define_const(Module_Magick, "TypeMetric", Class_TypeMetric);
1609
+
1610
+
1611
+ /*-----------------------------------------------------------------------*/
1612
+ /* Error handlers */
1613
+ /*-----------------------------------------------------------------------*/
1614
+
1615
+ SetFatalErrorHandler(rm_fatal_error_handler);
1616
+ SetErrorHandler(rm_error_handler);
1617
+ SetWarningHandler(rm_warning_handler);
1618
+
1619
+ }
1620
+
1621
+
1622
+
1623
+
1624
+ /**
1625
+ * Ensure the version of ImageMagick we're running with matches the version we
1626
+ * were compiled with.
1627
+ *
1628
+ * No Ruby usage (internal function)
1629
+ *
1630
+ * Notes:
1631
+ * - Bypass the test by defining the constant RMAGICK_BYPASS_VERSION_TEST to
1632
+ * 'true' at the top level, before requiring 'RMagick'
1633
+ */
1634
+ static void
1635
+ test_Magick_version(void)
1636
+ {
1637
+ unsigned long version_number;
1638
+ const char *version_str;
1639
+ int x, n;
1640
+ ID bypass = rb_intern("RMAGICK_BYPASS_VERSION_TEST");
1641
+
1642
+ if (RTEST(rb_const_defined(rb_cObject, bypass)) && RTEST(rb_const_get(rb_cObject, bypass)))
1643
+ {
1644
+ return;
1645
+ }
1646
+
1647
+ version_str = GetMagickVersion(&version_number);
1648
+ if (version_number != MagickLibVersion)
1649
+ {
1650
+ // Extract the string "ImageMagick X.Y.Z"
1651
+ n = 0;
1652
+ for (x = 0; version_str[x] != '\0'; x++)
1653
+ {
1654
+ if (version_str[x] == ' ' && ++n == 2)
1655
+ {
1656
+ break;
1657
+ }
1658
+ }
1659
+
1660
+ rb_raise(rb_eRuntimeError,
1661
+ "This installation of RMagick was configured with %s %s but %.*s is in use.\n" ,
1662
+ MagickPackageName, MagickLibVersionText, x, version_str);
1663
+ }
1664
+
1665
+ }
1666
+
1667
+
1668
+
1669
+
1670
+
1671
+ /**
1672
+ * Create Version, Magick_version, and Version_long constants.
1673
+ *
1674
+ * No Ruby usage (internal function)
1675
+ */
1676
+ static void
1677
+ version_constants(void)
1678
+ {
1679
+ const char *mgk_version;
1680
+ volatile VALUE str;
1681
+ char long_version[1000];
1682
+
1683
+ mgk_version = GetMagickVersion(NULL);
1684
+
1685
+ str = rb_str_new2(mgk_version);
1686
+ rb_obj_freeze(str);
1687
+ rb_define_const(Module_Magick, "Magick_version", str);
1688
+
1689
+ str = rb_str_new2(Q(RMAGICK_VERSION_STRING));
1690
+ rb_obj_freeze(str);
1691
+ rb_define_const(Module_Magick, "Version", str);
1692
+
1693
+ sprintf(long_version,
1694
+ "This is %s ($Date: 2009/12/20 02:33:33 $) Copyright (C) 2009 by Timothy P. Hunter\n"
1695
+ "Built with %s\n"
1696
+ "Built for %s\n"
1697
+ "Web page: http://rmagick.rubyforge.org\n"
1698
+ "Email: rmagick@rubyforge.org\n",
1699
+ Q(RMAGICK_VERSION_STRING), mgk_version, Q(RUBY_VERSION_STRING));
1700
+
1701
+ str = rb_str_new2(long_version);
1702
+ rb_obj_freeze(str);
1703
+ rb_define_const(Module_Magick, "Long_version", str);
1704
+
1705
+ }