rmagick 2.16.0 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (404) hide show
  1. checksums.yaml +5 -5
  2. data/.devcontainer/Dockerfile +14 -0
  3. data/.devcontainer/ImageMagick6/devcontainer.json +11 -0
  4. data/.devcontainer/devcontainer.json +11 -0
  5. data/.devcontainer/setup-repo.sh +10 -0
  6. data/.devcontainer/setup-user.sh +45 -0
  7. data/.editorconfig +3 -0
  8. data/.github/ISSUE_TEMPLATE.md +17 -0
  9. data/.github/workflows/ci.yml +138 -0
  10. data/.gitignore +7 -1
  11. data/.rspec +1 -0
  12. data/.rubocop.yml +37 -340
  13. data/.rubocop_todo.yml +448 -0
  14. data/.yardopts +5 -0
  15. data/CHANGELOG.md +455 -0
  16. data/CODE_OF_CONDUCT.md +122 -7
  17. data/CONTRIBUTING.md +37 -6
  18. data/Gemfile +0 -6
  19. data/README.md +316 -0
  20. data/Rakefile +74 -100
  21. data/before_install_linux.sh +65 -28
  22. data/before_install_osx.sh +58 -2
  23. data/ext/RMagick/extconf.rb +287 -393
  24. data/ext/RMagick/rmagick.c +106 -111
  25. data/ext/RMagick/rmagick.h +235 -331
  26. data/ext/RMagick/rmagick_gvl.h +224 -0
  27. data/ext/RMagick/rmdraw.c +516 -843
  28. data/ext/RMagick/rmenum.c +316 -755
  29. data/ext/RMagick/rmfill.c +281 -191
  30. data/ext/RMagick/rmilist.c +451 -456
  31. data/ext/RMagick/rmimage.c +6250 -5290
  32. data/ext/RMagick/rminfo.c +721 -894
  33. data/ext/RMagick/rmkinfo.c +228 -0
  34. data/ext/RMagick/rmmain.c +735 -521
  35. data/ext/RMagick/rmmontage.c +127 -172
  36. data/ext/RMagick/rmpixel.c +638 -431
  37. data/ext/RMagick/rmstruct.c +102 -282
  38. data/ext/RMagick/rmutil.c +450 -363
  39. data/lib/rmagick/version.rb +5 -4
  40. data/lib/rmagick.rb +2 -0
  41. data/lib/rmagick_internal.rb +349 -413
  42. data/lib/rvg/clippath.rb +3 -4
  43. data/lib/rvg/container.rb +30 -22
  44. data/lib/rvg/deep_equal.rb +11 -11
  45. data/lib/rvg/describable.rb +2 -2
  46. data/lib/rvg/embellishable.rb +63 -68
  47. data/lib/rvg/misc.rb +136 -139
  48. data/lib/rvg/paint.rb +2 -1
  49. data/lib/rvg/pathdata.rb +7 -8
  50. data/lib/rvg/rvg.rb +47 -46
  51. data/lib/rvg/stretchable.rb +22 -28
  52. data/lib/rvg/stylable.rb +12 -10
  53. data/lib/rvg/text.rb +169 -165
  54. data/lib/rvg/transformable.rb +17 -16
  55. data/lib/rvg/units.rb +5 -5
  56. data/rmagick.gemspec +16 -39
  57. metadata +114 -392
  58. data/.hound.yml +0 -2
  59. data/.simplecov +0 -27
  60. data/.travis.yml +0 -74
  61. data/Doxyfile +0 -1514
  62. data/README.textile +0 -251
  63. data/deprecated/RMagick.rb +0 -6
  64. data/doc/.cvsignore +0 -1
  65. data/doc/comtasks.html +0 -287
  66. data/doc/constants.html +0 -1581
  67. data/doc/css/doc.css +0 -299
  68. data/doc/css/popup.css +0 -34
  69. data/doc/css/ref.css +0 -67
  70. data/doc/draw.html +0 -3272
  71. data/doc/ex/InitialCoords.rb +0 -22
  72. data/doc/ex/NewCoordSys.rb +0 -30
  73. data/doc/ex/OrigCoordSys.rb +0 -16
  74. data/doc/ex/PreserveAspectRatio.rb +0 -204
  75. data/doc/ex/RotateScale.rb +0 -36
  76. data/doc/ex/Skew.rb +0 -38
  77. data/doc/ex/Use01.rb +0 -15
  78. data/doc/ex/Use02.rb +0 -20
  79. data/doc/ex/Use03.rb +0 -16
  80. data/doc/ex/ViewBox.rb +0 -31
  81. data/doc/ex/adaptive_threshold.rb +0 -9
  82. data/doc/ex/add_noise.rb +0 -16
  83. data/doc/ex/affine.rb +0 -48
  84. data/doc/ex/affine_transform.rb +0 -20
  85. data/doc/ex/arc.rb +0 -49
  86. data/doc/ex/arcpath.rb +0 -32
  87. data/doc/ex/arcs01.rb +0 -28
  88. data/doc/ex/arcs02.rb +0 -59
  89. data/doc/ex/average.rb +0 -15
  90. data/doc/ex/axes.rb +0 -64
  91. data/doc/ex/baseline_shift01.rb +0 -17
  92. data/doc/ex/bilevel_channel.rb +0 -8
  93. data/doc/ex/blur_image.rb +0 -12
  94. data/doc/ex/border.rb +0 -10
  95. data/doc/ex/bounding_box.rb +0 -42
  96. data/doc/ex/cbezier1.rb +0 -41
  97. data/doc/ex/cbezier2.rb +0 -41
  98. data/doc/ex/cbezier3.rb +0 -41
  99. data/doc/ex/cbezier4.rb +0 -42
  100. data/doc/ex/cbezier5.rb +0 -42
  101. data/doc/ex/cbezier6.rb +0 -53
  102. data/doc/ex/channel.rb +0 -25
  103. data/doc/ex/charcoal.rb +0 -12
  104. data/doc/ex/chop.rb +0 -29
  105. data/doc/ex/circle.rb +0 -33
  106. data/doc/ex/circle01.rb +0 -16
  107. data/doc/ex/clip_path.rb +0 -60
  108. data/doc/ex/coalesce.rb +0 -57
  109. data/doc/ex/color_fill_to_border.rb +0 -29
  110. data/doc/ex/color_floodfill.rb +0 -28
  111. data/doc/ex/color_histogram.rb +0 -47
  112. data/doc/ex/color_reset.rb +0 -11
  113. data/doc/ex/colorize.rb +0 -16
  114. data/doc/ex/colors.rb +0 -64
  115. data/doc/ex/compose_mask.rb +0 -22
  116. data/doc/ex/composite.rb +0 -133
  117. data/doc/ex/composite_layers.rb +0 -53
  118. data/doc/ex/composite_tiled.rb +0 -21
  119. data/doc/ex/contrast.rb +0 -36
  120. data/doc/ex/crop.rb +0 -31
  121. data/doc/ex/crop_with_gravity.rb +0 -42
  122. data/doc/ex/cubic01.rb +0 -43
  123. data/doc/ex/cubic02.rb +0 -91
  124. data/doc/ex/cycle_colormap.rb +0 -21
  125. data/doc/ex/dissolve.rb +0 -12
  126. data/doc/ex/drawcomp.rb +0 -42
  127. data/doc/ex/drop_shadow.rb +0 -60
  128. data/doc/ex/edge.rb +0 -11
  129. data/doc/ex/ellipse.rb +0 -45
  130. data/doc/ex/ellipse01.rb +0 -21
  131. data/doc/ex/emboss.rb +0 -11
  132. data/doc/ex/enhance.rb +0 -28
  133. data/doc/ex/equalize.rb +0 -11
  134. data/doc/ex/evenodd.rb +0 -42
  135. data/doc/ex/fill_pattern.rb +0 -23
  136. data/doc/ex/flatten_images.rb +0 -36
  137. data/doc/ex/flip.rb +0 -11
  138. data/doc/ex/flop.rb +0 -11
  139. data/doc/ex/font_styles.rb +0 -32
  140. data/doc/ex/fonts.rb +0 -20
  141. data/doc/ex/frame.rb +0 -12
  142. data/doc/ex/gaussian_blur.rb +0 -11
  143. data/doc/ex/get_multiline_type_metrics.rb +0 -41
  144. data/doc/ex/get_pixels.rb +0 -47
  145. data/doc/ex/get_type_metrics.rb +0 -141
  146. data/doc/ex/gradientfill.rb +0 -27
  147. data/doc/ex/grav.rb +0 -45
  148. data/doc/ex/gravity.rb +0 -80
  149. data/doc/ex/group.rb +0 -26
  150. data/doc/ex/hatchfill.rb +0 -27
  151. data/doc/ex/image.rb +0 -44
  152. data/doc/ex/images/Apple.miff +0 -0
  153. data/doc/ex/images/Ballerina.jpg +0 -0
  154. data/doc/ex/images/Ballerina3.jpg +0 -0
  155. data/doc/ex/images/Button_0.gif +0 -0
  156. data/doc/ex/images/Button_1.gif +0 -0
  157. data/doc/ex/images/Button_2.gif +0 -0
  158. data/doc/ex/images/Button_3.gif +0 -0
  159. data/doc/ex/images/Button_4.gif +0 -0
  160. data/doc/ex/images/Button_5.gif +0 -0
  161. data/doc/ex/images/Button_6.gif +0 -0
  162. data/doc/ex/images/Button_7.gif +0 -0
  163. data/doc/ex/images/Button_8.gif +0 -0
  164. data/doc/ex/images/Button_9.gif +0 -0
  165. data/doc/ex/images/Button_A.gif +0 -0
  166. data/doc/ex/images/Button_B.gif +0 -0
  167. data/doc/ex/images/Button_C.gif +0 -0
  168. data/doc/ex/images/Button_D.gif +0 -0
  169. data/doc/ex/images/Button_E.gif +0 -0
  170. data/doc/ex/images/Button_F.gif +0 -0
  171. data/doc/ex/images/Button_G.gif +0 -0
  172. data/doc/ex/images/Button_H.gif +0 -0
  173. data/doc/ex/images/Button_I.gif +0 -0
  174. data/doc/ex/images/Button_J.gif +0 -0
  175. data/doc/ex/images/Button_K.gif +0 -0
  176. data/doc/ex/images/Button_L.gif +0 -0
  177. data/doc/ex/images/Button_M.gif +0 -0
  178. data/doc/ex/images/Button_N.gif +0 -0
  179. data/doc/ex/images/Button_O.gif +0 -0
  180. data/doc/ex/images/Button_P.gif +0 -0
  181. data/doc/ex/images/Button_Q.gif +0 -0
  182. data/doc/ex/images/Button_R.gif +0 -0
  183. data/doc/ex/images/Button_S.gif +0 -0
  184. data/doc/ex/images/Button_T.gif +0 -0
  185. data/doc/ex/images/Button_U.gif +0 -0
  186. data/doc/ex/images/Button_V.gif +0 -0
  187. data/doc/ex/images/Button_W.gif +0 -0
  188. data/doc/ex/images/Button_X.gif +0 -0
  189. data/doc/ex/images/Button_Y.gif +0 -0
  190. data/doc/ex/images/Button_Z.gif +0 -0
  191. data/doc/ex/images/Cheetah.jpg +0 -0
  192. data/doc/ex/images/Coffee.wmf +0 -0
  193. data/doc/ex/images/Flower_Hat.jpg +0 -0
  194. data/doc/ex/images/Gold_Statue.jpg +0 -0
  195. data/doc/ex/images/Hot_Air_Balloons.jpg +0 -0
  196. data/doc/ex/images/Hot_Air_Balloons_H.jpg +0 -0
  197. data/doc/ex/images/Leaf.miff +0 -0
  198. data/doc/ex/images/No.wmf +0 -0
  199. data/doc/ex/images/Polynesia.jpg +0 -0
  200. data/doc/ex/images/Red_Rocks.jpg +0 -0
  201. data/doc/ex/images/Rocks_On_Beach.miff +0 -0
  202. data/doc/ex/images/Shorts.jpg +0 -0
  203. data/doc/ex/images/Snake.wmf +0 -0
  204. data/doc/ex/images/Violin.jpg +0 -0
  205. data/doc/ex/images/Yellow_Rose.miff +0 -0
  206. data/doc/ex/images/big-duck.gif +0 -0
  207. data/doc/ex/images/duck.gif +0 -0
  208. data/doc/ex/images/duck0.gif +0 -0
  209. data/doc/ex/images/duck1.gif +0 -0
  210. data/doc/ex/images/duck10.gif +0 -0
  211. data/doc/ex/images/duck11.gif +0 -0
  212. data/doc/ex/images/duck12.gif +0 -0
  213. data/doc/ex/images/duck13.gif +0 -0
  214. data/doc/ex/images/duck14.gif +0 -0
  215. data/doc/ex/images/duck15.gif +0 -0
  216. data/doc/ex/images/duck2.gif +0 -0
  217. data/doc/ex/images/duck3.gif +0 -0
  218. data/doc/ex/images/duck4.gif +0 -0
  219. data/doc/ex/images/duck5.gif +0 -0
  220. data/doc/ex/images/duck6.gif +0 -0
  221. data/doc/ex/images/duck7.gif +0 -0
  222. data/doc/ex/images/duck8.gif +0 -0
  223. data/doc/ex/images/duck9.gif +0 -0
  224. data/doc/ex/images/graydient230x6.gif +0 -0
  225. data/doc/ex/images/image_with_profile.jpg +0 -0
  226. data/doc/ex/images/logo400x83.gif +0 -0
  227. data/doc/ex/images/model.miff +0 -0
  228. data/doc/ex/images/notimplemented.gif +0 -0
  229. data/doc/ex/images/smile.miff +0 -0
  230. data/doc/ex/images/spin.gif +0 -0
  231. data/doc/ex/implode.rb +0 -34
  232. data/doc/ex/level.rb +0 -11
  233. data/doc/ex/level_colors.rb +0 -11
  234. data/doc/ex/line.rb +0 -41
  235. data/doc/ex/line01.rb +0 -21
  236. data/doc/ex/mask.rb +0 -35
  237. data/doc/ex/matte_fill_to_border.rb +0 -39
  238. data/doc/ex/matte_floodfill.rb +0 -32
  239. data/doc/ex/matte_replace.rb +0 -39
  240. data/doc/ex/median_filter.rb +0 -28
  241. data/doc/ex/modulate.rb +0 -11
  242. data/doc/ex/mono.rb +0 -23
  243. data/doc/ex/morph.rb +0 -25
  244. data/doc/ex/mosaic.rb +0 -35
  245. data/doc/ex/motion_blur.rb +0 -11
  246. data/doc/ex/negate.rb +0 -11
  247. data/doc/ex/negate_channel.rb +0 -9
  248. data/doc/ex/nested_rvg.rb +0 -21
  249. data/doc/ex/nonzero.rb +0 -42
  250. data/doc/ex/normalize.rb +0 -11
  251. data/doc/ex/oil_paint.rb +0 -11
  252. data/doc/ex/opacity.rb +0 -37
  253. data/doc/ex/ordered_dither.rb +0 -11
  254. data/doc/ex/path.rb +0 -63
  255. data/doc/ex/pattern1.rb +0 -25
  256. data/doc/ex/pattern2.rb +0 -26
  257. data/doc/ex/polaroid.rb +0 -27
  258. data/doc/ex/polygon.rb +0 -23
  259. data/doc/ex/polygon01.rb +0 -21
  260. data/doc/ex/polyline.rb +0 -22
  261. data/doc/ex/polyline01.rb +0 -21
  262. data/doc/ex/posterize.rb +0 -8
  263. data/doc/ex/preview.rb +0 -8
  264. data/doc/ex/qbezierpath.rb +0 -52
  265. data/doc/ex/quad01.rb +0 -34
  266. data/doc/ex/quantize-m.rb +0 -25
  267. data/doc/ex/radial_blur.rb +0 -9
  268. data/doc/ex/raise.rb +0 -8
  269. data/doc/ex/random_threshold_channel.rb +0 -13
  270. data/doc/ex/rect01.rb +0 -14
  271. data/doc/ex/rect02.rb +0 -20
  272. data/doc/ex/rectangle.rb +0 -34
  273. data/doc/ex/reduce_noise.rb +0 -28
  274. data/doc/ex/remap.rb +0 -11
  275. data/doc/ex/remap_images.rb +0 -19
  276. data/doc/ex/resize_to_fill.rb +0 -8
  277. data/doc/ex/resize_to_fit.rb +0 -8
  278. data/doc/ex/roll.rb +0 -9
  279. data/doc/ex/rotate.rb +0 -44
  280. data/doc/ex/rotate_f.rb +0 -14
  281. data/doc/ex/roundrect.rb +0 -33
  282. data/doc/ex/rubyname.rb +0 -30
  283. data/doc/ex/rvg_clippath.rb +0 -12
  284. data/doc/ex/rvg_linecap.rb +0 -42
  285. data/doc/ex/rvg_linejoin.rb +0 -40
  286. data/doc/ex/rvg_opacity.rb +0 -18
  287. data/doc/ex/rvg_pattern.rb +0 -26
  288. data/doc/ex/rvg_stroke_dasharray.rb +0 -11
  289. data/doc/ex/segment.rb +0 -11
  290. data/doc/ex/sepiatone.rb +0 -7
  291. data/doc/ex/shade.rb +0 -11
  292. data/doc/ex/shadow.rb +0 -30
  293. data/doc/ex/shave.rb +0 -15
  294. data/doc/ex/shear.rb +0 -10
  295. data/doc/ex/sketch.rb +0 -17
  296. data/doc/ex/skewx.rb +0 -51
  297. data/doc/ex/skewy.rb +0 -47
  298. data/doc/ex/smile.rb +0 -125
  299. data/doc/ex/solarize.rb +0 -11
  300. data/doc/ex/sparse_color.rb +0 -54
  301. data/doc/ex/splice.rb +0 -8
  302. data/doc/ex/spread.rb +0 -11
  303. data/doc/ex/stegano.rb +0 -55
  304. data/doc/ex/stroke_dasharray.rb +0 -42
  305. data/doc/ex/stroke_fill.rb +0 -10
  306. data/doc/ex/stroke_linecap.rb +0 -44
  307. data/doc/ex/stroke_linejoin.rb +0 -48
  308. data/doc/ex/stroke_width.rb +0 -49
  309. data/doc/ex/swirl.rb +0 -17
  310. data/doc/ex/text.rb +0 -37
  311. data/doc/ex/text01.rb +0 -16
  312. data/doc/ex/text_align.rb +0 -36
  313. data/doc/ex/text_antialias.rb +0 -37
  314. data/doc/ex/text_styles.rb +0 -19
  315. data/doc/ex/text_undercolor.rb +0 -28
  316. data/doc/ex/texture_fill_to_border.rb +0 -34
  317. data/doc/ex/texture_floodfill.rb +0 -32
  318. data/doc/ex/texturefill.rb +0 -24
  319. data/doc/ex/threshold.rb +0 -13
  320. data/doc/ex/to_blob.rb +0 -13
  321. data/doc/ex/translate.rb +0 -39
  322. data/doc/ex/transparent.rb +0 -38
  323. data/doc/ex/transpose.rb +0 -9
  324. data/doc/ex/transverse.rb +0 -9
  325. data/doc/ex/tref01.rb +0 -24
  326. data/doc/ex/triangle01.rb +0 -15
  327. data/doc/ex/trim.rb +0 -23
  328. data/doc/ex/tspan01.rb +0 -17
  329. data/doc/ex/tspan02.rb +0 -17
  330. data/doc/ex/tspan03.rb +0 -19
  331. data/doc/ex/unsharp_mask.rb +0 -28
  332. data/doc/ex/viewex.rb +0 -33
  333. data/doc/ex/vignette.rb +0 -12
  334. data/doc/ex/watermark.rb +0 -27
  335. data/doc/ex/wave.rb +0 -9
  336. data/doc/ex/wet_floor.rb +0 -58
  337. data/doc/ex/writing_mode01.rb +0 -26
  338. data/doc/ex/writing_mode02.rb +0 -26
  339. data/doc/ilist.html +0 -2056
  340. data/doc/image1.html +0 -4680
  341. data/doc/image2.html +0 -3665
  342. data/doc/image3.html +0 -4522
  343. data/doc/imageattrs.html +0 -1638
  344. data/doc/imusage.html +0 -514
  345. data/doc/index.html +0 -416
  346. data/doc/info.html +0 -1499
  347. data/doc/magick.html +0 -565
  348. data/doc/optequiv.html +0 -2435
  349. data/doc/rvg.html +0 -975
  350. data/doc/rvgclip.html +0 -248
  351. data/doc/rvggroup.html +0 -305
  352. data/doc/rvgimage.html +0 -289
  353. data/doc/rvgpattern.html +0 -475
  354. data/doc/rvgshape.html +0 -406
  355. data/doc/rvgstyle.html +0 -270
  356. data/doc/rvgtext.html +0 -465
  357. data/doc/rvgtspan.html +0 -238
  358. data/doc/rvgtut.html +0 -530
  359. data/doc/rvguse.html +0 -145
  360. data/doc/rvgxform.html +0 -294
  361. data/doc/scripts/doc.js +0 -22
  362. data/doc/scripts/stripeTables.js +0 -23
  363. data/doc/struct.html +0 -1339
  364. data/doc/usage.html +0 -1621
  365. data/examples/constitute.rb +0 -7
  366. data/examples/crop_with_gravity.rb +0 -42
  367. data/examples/demo.rb +0 -324
  368. data/examples/describe.rb +0 -43
  369. data/examples/find_similar_region.rb +0 -34
  370. data/examples/histogram.rb +0 -321
  371. data/examples/identify.rb +0 -185
  372. data/examples/image_opacity.rb +0 -29
  373. data/examples/import_export.rb +0 -31
  374. data/examples/pattern_fill.rb +0 -38
  375. data/examples/rotating_text.rb +0 -44
  376. data/examples/spinner.rb +0 -49
  377. data/examples/thumbnail.rb +0 -64
  378. data/examples/vignette.rb +0 -78
  379. data/spec/rmagick/ImageList1_spec.rb +0 -24
  380. data/spec/rmagick/draw_spec.rb +0 -156
  381. data/spec/rmagick/image/blue_shift_spec.rb +0 -16
  382. data/spec/rmagick/image/composite_spec.rb +0 -140
  383. data/spec/rmagick/image/constitute_spec.rb +0 -15
  384. data/spec/rmagick/image/dispatch_spec.rb +0 -18
  385. data/spec/rmagick/image/from_blob_spec.rb +0 -14
  386. data/spec/rmagick/image/ping_spec.rb +0 -14
  387. data/spec/rmagick/image/properties_spec.rb +0 -29
  388. data/spec/spec_helper.rb +0 -4
  389. data/test/Image1.rb +0 -565
  390. data/test/Image2.rb +0 -1304
  391. data/test/Image3.rb +0 -1030
  392. data/test/ImageList1.rb +0 -806
  393. data/test/ImageList2.rb +0 -385
  394. data/test/Image_attributes.rb +0 -697
  395. data/test/Import_Export.rb +0 -121
  396. data/test/Info.rb +0 -345
  397. data/test/Magick.rb +0 -321
  398. data/test/Pixel.rb +0 -116
  399. data/test/Preview.rb +0 -57
  400. data/test/cmyk.icm +0 -0
  401. data/test/srgb.icm +0 -0
  402. data/test/test_all_basic.rb +0 -38
  403. data/test/tmpnam_test.rb +0 -50
  404. data/wercker.yml +0 -10
data/ext/RMagick/rmenum.c CHANGED
@@ -18,9 +18,15 @@
18
18
 
19
19
  static VALUE Enum_type_values(VALUE);
20
20
  static VALUE Enum_type_inspect(VALUE);
21
+ static void rm_enum_free(void *magick_enum);
22
+ static size_t rm_enum_memsize(const void *magick_enum);
21
23
 
22
-
23
-
24
+ const rb_data_type_t rm_enum_data_type = {
25
+ "Magick::Enum",
26
+ { NULL, rm_enum_free, rm_enum_memsize, },
27
+ 0, 0,
28
+ RUBY_TYPED_FROZEN_SHAREABLE,
29
+ };
24
30
 
25
31
 
26
32
  /**
@@ -65,52 +71,80 @@ rm_enum_new(VALUE class, VALUE sym, VALUE val)
65
71
  return rb_obj_freeze(rb_class_new_instance(2, argv, class));
66
72
  }
67
73
 
74
+ /**
75
+ * Retrieve C string value of Enum.
76
+ *
77
+ * No Ruby usage (internal function)
78
+ *
79
+ * @param enum_type the Enum object
80
+ * @return the C string value of Enum object
81
+ */
82
+ static const char *
83
+ rm_enum_to_cstr(VALUE enum_type)
84
+ {
85
+ MagickEnum *magick_enum;
86
+
87
+ TypedData_Get_Struct(enum_type, MagickEnum, &rm_enum_data_type, magick_enum);
88
+ return rb_id2name(magick_enum->id);
89
+ }
68
90
 
69
91
  /**
70
- * Enum class alloc function.
92
+ * Free Enum or Enum subclass object
71
93
  *
72
94
  * No Ruby usage (internal function)
73
95
  *
74
- * @param class the Ruby class to use
75
- * @return a new enumerator
96
+ * @param magick_enum the enum
97
+ */
98
+ static void rm_enum_free(void *magick_enum)
99
+ {
100
+ xfree(magick_enum);
101
+ }
102
+
103
+ /**
104
+ * Get Enum object size.
105
+ *
106
+ * No Ruby usage (internal function)
107
+ *
108
+ * @param magick_enum the enum
109
+ */
110
+ static size_t rm_enum_memsize(const void *magick_enum)
111
+ {
112
+ return sizeof(MagickEnum);
113
+ }
114
+
115
+ /**
116
+ * Enum class alloc function.
117
+ *
118
+ * @return [Magick::Enum] a new enumerator
76
119
  */
77
120
  VALUE
78
121
  Enum_alloc(VALUE class)
79
122
  {
80
- MagickEnum *magick_enum;
81
- VALUE enumr;
82
-
83
- enumr = Data_Make_Struct(class, MagickEnum, NULL, NULL, magick_enum);
84
- rb_obj_freeze(enumr);
123
+ MagickEnum *magick_enum;
124
+ VALUE enumr;
85
125
 
86
- RB_GC_GUARD(enumr);
126
+ enumr = TypedData_Make_Struct(class, MagickEnum, &rm_enum_data_type, magick_enum);
127
+ rb_obj_freeze(enumr);
87
128
 
88
- return enumr;
129
+ return enumr;
89
130
  }
90
131
 
91
132
 
92
133
  /**
93
134
  * "Case equal" operator for Enum.
94
135
  *
95
- * Ruby usage:
96
- * - @verbatim Enum#=== @endverbatim
97
- *
98
- * Notes:
99
- * - Yes, I know "case equal" is a misnomer.
100
- *
101
- * @param self this object
102
- * @param other the other object
103
- * @return true or false
136
+ * @param other [Object] the other object
137
+ * @return [Boolean] true or false
104
138
  */
105
139
  VALUE
106
140
  Enum_case_eq(VALUE self, VALUE other)
107
141
  {
108
- MagickEnum *this, *that;
109
-
110
142
  if (CLASS_OF(self) == CLASS_OF(other))
111
143
  {
112
- Data_Get_Struct(self, MagickEnum, this);
113
- Data_Get_Struct(other, MagickEnum, that);
144
+ MagickEnum *this, *that;
145
+
146
+ TypedData_Get_Struct(self, MagickEnum, &rm_enum_data_type, this);
147
+ TypedData_Get_Struct(other, MagickEnum, &rm_enum_data_type, that);
114
148
  return this->val == that->val ? Qtrue : Qfalse;
115
149
  }
116
150
 
@@ -121,58 +155,43 @@ Enum_case_eq(VALUE self, VALUE other)
121
155
  /**
122
156
  * Initialize a new Enum instance.
123
157
  *
124
- * Ruby usage:
125
- * - @verbatim Enum#initialize(sym,val) @endverbatim
126
- *
127
- * @param self this object
128
- * @param sym the symbol
129
- * @param val the value for the symbol
130
- * @return self
158
+ * @param sym [Symbol] the symbol as enum name
159
+ * @param val [Numeric] the value for enum
160
+ * @return [Magick::Enum] self
131
161
  */
132
162
  VALUE
133
163
  Enum_initialize(VALUE self, VALUE sym, VALUE val)
134
164
  {
135
- MagickEnum *magick_enum;
165
+ MagickEnum *magick_enum;
136
166
 
137
- Data_Get_Struct(self, MagickEnum, magick_enum);
138
- magick_enum->id = rb_to_id(sym); /* convert symbol to ID */
139
- magick_enum->val = NUM2INT(val);
167
+ TypedData_Get_Struct(self, MagickEnum, &rm_enum_data_type, magick_enum);
168
+ magick_enum->id = rb_to_id(sym); /* convert symbol to ID */
169
+ magick_enum->val = NUM2INT(val);
140
170
 
141
- return self;
171
+ return self;
142
172
  }
143
173
 
144
174
 
145
175
  /**
146
176
  * Return the value of an enum.
147
177
  *
148
- * Ruby usage:
149
- * - @verbatim Enum#to_i @endverbatim
150
- *
151
- * @param self this object
152
- * @return this object's value
178
+ * @return [Numeric] this object's value
153
179
  */
154
180
  VALUE
155
181
  Enum_to_i(VALUE self)
156
182
  {
157
- MagickEnum *magick_enum;
183
+ MagickEnum *magick_enum;
158
184
 
159
- Data_Get_Struct(self, MagickEnum, magick_enum);
160
- return INT2NUM(magick_enum->val);
185
+ TypedData_Get_Struct(self, MagickEnum, &rm_enum_data_type, magick_enum);
186
+ return INT2NUM(magick_enum->val);
161
187
  }
162
188
 
163
189
 
164
190
  /**
165
191
  * Support Comparable module in Enum.
166
192
  *
167
- * Ruby usage:
168
- * - @verbatim Enum#<=> @endverbatim
169
- *
170
- * Notes:
171
- * - Enums must be instances of the same class to be equal.
172
- *
173
- * @param self this object
174
- * @param other the other object
175
- * @return -1, 0, 1, or nil
193
+ * @param other [Object] the other object
194
+ * @return [-1, 0, 1, nil] the result of compare
176
195
  */
177
196
  VALUE
178
197
  Enum_spaceship(VALUE self, VALUE other)
@@ -183,8 +202,8 @@ Enum_spaceship(VALUE self, VALUE other)
183
202
  return Qnil;
184
203
  }
185
204
 
186
- Data_Get_Struct(self, MagickEnum, this);
187
- Data_Get_Struct(other, MagickEnum, that);
205
+ TypedData_Get_Struct(self, MagickEnum, &rm_enum_data_type, this);
206
+ TypedData_Get_Struct(other, MagickEnum, &rm_enum_data_type, that);
188
207
 
189
208
  if (this->val > that->val)
190
209
  {
@@ -198,36 +217,54 @@ Enum_spaceship(VALUE self, VALUE other)
198
217
  return INT2FIX(0);
199
218
  }
200
219
 
220
+ /**
221
+ * Bitwise OR for enums
222
+ *
223
+ * @param another [Magick::Enum] the another enum
224
+ * @return [Magick::Enum] new Enum instance
225
+ */
226
+ VALUE
227
+ Enum_bitwise_or(VALUE self, VALUE another)
228
+ {
229
+ VALUE new_enum, cls;
230
+ MagickEnum *this, *that, *new_enum_data;
231
+
232
+ cls = CLASS_OF(self);
233
+ if (CLASS_OF(another) != cls)
234
+ {
235
+ rb_raise(rb_eArgError, "Expected class %s but got %s", rb_class2name(cls), rb_class2name(CLASS_OF(another)));
236
+ }
237
+
238
+ new_enum = Enum_alloc(cls);
239
+
240
+ TypedData_Get_Struct(self, MagickEnum, &rm_enum_data_type, this);
241
+ TypedData_Get_Struct(another, MagickEnum, &rm_enum_data_type, that);
242
+ TypedData_Get_Struct(new_enum, MagickEnum, &rm_enum_data_type, new_enum_data);
243
+
244
+ new_enum_data->id = rb_to_id(rb_sprintf("%s|%s", rb_id2name(this->id), rb_id2name(that->id)));
245
+ new_enum_data->val = this->val | that->val;
246
+
247
+ return new_enum;
248
+ }
201
249
 
202
250
  /**
203
251
  * Return the name of an enum.
204
252
  *
205
- * Ruby usage:
206
- * - @verbatim Enum#to_s @endverbatim
207
- *
208
- * @param self this object
209
- * @return the name
253
+ * @return [String] the name of an enum
210
254
  */
211
255
  VALUE
212
256
  Enum_to_s(VALUE self)
213
257
  {
214
- MagickEnum *magick_enum;
215
-
216
- Data_Get_Struct(self, MagickEnum, magick_enum);
217
- return rb_str_new2(rb_id2name(magick_enum->id));
258
+ return rb_str_new2(rm_enum_to_cstr(self));
218
259
  }
219
260
 
220
261
 
221
262
  /**
222
263
  * Initialize method for all Enum subclasses.
223
264
  *
224
- * Ruby usage:
225
- * - @verbatim xxx#initialize(sym,val) @endverbatim
226
- *
227
- * @param self this object
228
- * @param sym the symbol
229
- * @param val the value of the symbol
230
- * @return self
265
+ * @param sym [Symbol] the symbol as enum name
266
+ * @param val [Numeric] the value for enum
267
+ * @return [Magick::Enum] self
231
268
  */
232
269
  VALUE
233
270
  Enum_type_initialize(VALUE self, VALUE sym, VALUE val)
@@ -237,7 +274,7 @@ Enum_type_initialize(VALUE self, VALUE sym, VALUE val)
237
274
 
238
275
  super_argv[0] = sym;
239
276
  super_argv[1] = val;
240
- (void) rb_call_super(2, (const VALUE *)super_argv);
277
+ rb_call_super(2, (const VALUE *)super_argv);
241
278
 
242
279
  if (rb_cvar_defined(CLASS_OF(self), rb_intern(ENUMERATORS_CLASS_VAR)) != Qtrue)
243
280
  {
@@ -245,7 +282,7 @@ Enum_type_initialize(VALUE self, VALUE sym, VALUE val)
245
282
  }
246
283
 
247
284
  enumerators = rb_cv_get(CLASS_OF(self), ENUMERATORS_CLASS_VAR);
248
- (void) rb_ary_push(enumerators, self);
285
+ rb_ary_push(enumerators, self);
249
286
 
250
287
  RB_GC_GUARD(enumerators);
251
288
 
@@ -256,11 +293,7 @@ Enum_type_initialize(VALUE self, VALUE sym, VALUE val)
256
293
  /**
257
294
  * Enum subclass #inspect.
258
295
  *
259
- * Ruby usage:
260
- * - @verbatim xxx#inspect @endverbatim
261
- *
262
- * @param self this object
263
- * @return string representation of self
296
+ * @return [String] representation of self
264
297
  */
265
298
  static VALUE
266
299
  Enum_type_inspect(VALUE self)
@@ -268,8 +301,8 @@ Enum_type_inspect(VALUE self)
268
301
  char str[100];
269
302
  MagickEnum *magick_enum;
270
303
 
271
- Data_Get_Struct(self, MagickEnum, magick_enum);
272
- sprintf(str, "%.48s=%d", rb_id2name(magick_enum->id), magick_enum->val);
304
+ TypedData_Get_Struct(self, MagickEnum, &rm_enum_data_type, magick_enum);
305
+ snprintf(str, sizeof(str), "%.48s=%d", rb_id2name(magick_enum->id), magick_enum->val);
273
306
 
274
307
  return rb_str_new2(str);
275
308
  }
@@ -278,15 +311,14 @@ Enum_type_inspect(VALUE self)
278
311
  /**
279
312
  * Behaves like #each if a block is present, otherwise like #to_a.
280
313
  *
281
- * Ruby usage:
282
- * - @verbatim xxx.values @endverbatim
283
- * - @verbatim xxx.values {|v| } @endverbatim
314
+ * @overload values
315
+ * @return [Array<Magick::Enum>] the enum values
284
316
  *
285
- * Notes:
286
- * - Defined for each Enum subclass
287
- *
288
- * @param class the subclass
289
- * @return iterator over values if given block, a copy of the values otherwise
317
+ * @overload values
318
+ * iterator over values if given block
319
+ * @yield [val]
320
+ * @yieldparam val [Magick::Enum] an enum
321
+ * @return [Magick::Enum] self
290
322
  */
291
323
  static VALUE
292
324
  Enum_type_values(VALUE class)
@@ -301,7 +333,7 @@ Enum_type_values(VALUE class)
301
333
  {
302
334
  for (x = 0; x < RARRAY_LEN(enumerators); x++)
303
335
  {
304
- (void) rb_yield(rb_ary_entry(enumerators, x));
336
+ rb_yield(rb_ary_entry(enumerators, x));
305
337
  }
306
338
  rv = class;
307
339
  }
@@ -310,7 +342,7 @@ Enum_type_values(VALUE class)
310
342
  copy = rb_ary_new2(RARRAY_LEN(enumerators));
311
343
  for (x = 0; x < RARRAY_LEN(enumerators); x++)
312
344
  {
313
- (void) rb_ary_push(copy, rb_ary_entry(enumerators, x));
345
+ rb_ary_push(copy, rb_ary_entry(enumerators, x));
314
346
  }
315
347
  rb_obj_freeze(copy);
316
348
  rv = copy;
@@ -323,451 +355,209 @@ Enum_type_values(VALUE class)
323
355
  return rv;
324
356
  }
325
357
 
326
-
327
358
  /**
328
- * Construct a ClassType enum object for the specified value.
359
+ * Find enum object for the specified value.
329
360
  *
330
361
  * No Ruby usage (internal function)
331
362
  *
332
- * @param cls the class type
333
- * @return a new enumerator
363
+ * @param class the class type
364
+ * @param value the value for enum
365
+ * @return a enumerator
334
366
  */
335
- VALUE
336
- ClassType_new(ClassType cls)
337
- {
338
- const char *name;
339
-
340
- switch(cls)
341
- {
342
- default:
343
- case UndefinedClass:
344
- name = "UndefineClass";
345
- break;
346
- case DirectClass:
347
- name = "DirectClass";
348
- break;
349
- case PseudoClass:
350
- name = "PseudoClass";
351
- break;
352
- }
353
-
354
- return rm_enum_new(Class_ClassType, ID2SYM(rb_intern(name)), INT2FIX(cls));
355
- }
356
-
357
367
 
358
- /**
359
- * Construct a ColorspaceType enum object for the specified value.
360
- *
361
- * No Ruby usage (internal function)
362
- *
363
- * @param cs the ColorspaceType
364
- * @return a new ColorspaceType enumerator
365
- */
366
368
  VALUE
367
- ColorspaceType_new(ColorspaceType cs)
369
+ Enum_find(VALUE class, int val)
368
370
  {
369
- const char *name;
371
+ VALUE enumerators;
372
+ MagickEnum *magick_enum;
373
+ int x;
370
374
 
371
- switch(cs)
375
+ enumerators = rb_cv_get(class, ENUMERATORS_CLASS_VAR);
376
+ enumerators = rm_check_ary_type(enumerators);
377
+
378
+ for (x = 0; x < RARRAY_LEN(enumerators); x++)
372
379
  {
373
- default:
374
- case UndefinedColorspace:
375
- name = "UndefinedColorspace";
376
- break;
377
- case RGBColorspace:
378
- name = "RGBColorspace";
379
- break;
380
- case GRAYColorspace:
381
- name = "GRAYColorspace";
382
- break;
383
- case TransparentColorspace:
384
- name = "TransparentColorspace";
385
- break;
386
- case OHTAColorspace:
387
- name = "OHTAColorspace";
388
- break;
389
- case XYZColorspace:
390
- name = "XYZColorspace";
391
- break;
392
- case YCbCrColorspace:
393
- name = "YCbCrColorspace";
394
- break;
395
- case YCCColorspace:
396
- name = "YCCColorspace";
397
- break;
398
- case YIQColorspace:
399
- name = "YIQColorspace";
400
- break;
401
- case YPbPrColorspace:
402
- name = "YPbPrColorspace";
403
- break;
404
- case YUVColorspace:
405
- name = "YUVColorspace";
406
- break;
407
- case CMYKColorspace:
408
- name = "CMYKColorspace";
409
- break;
410
- case sRGBColorspace:
411
- name = "sRGBColorspace";
412
- break;
413
- case HSLColorspace:
414
- name = "HSLColorspace";
415
- break;
416
- case HWBColorspace:
417
- name = "HWBColorspace";
418
- break;
419
- case HSBColorspace:
420
- name = "HSBColorspace";
421
- break;
422
- case LabColorspace:
423
- name = "LabColorspace";
424
- break;
425
- case Rec601YCbCrColorspace:
426
- name = "Rec601YCbCrColorspace";
427
- break;
428
- case Rec601LumaColorspace:
429
- name = "Rec601LumaColorspace";
430
- break;
431
- case Rec709LumaColorspace:
432
- name = "Rec709LumaColorspace";
433
- break;
434
- case Rec709YCbCrColorspace:
435
- name = "Rec709YCbCrColorspace";
436
- break;
437
- case LogColorspace:
438
- name = "LogColorspace";
439
- break;
440
- case CMYColorspace:
441
- name = "CMYColorspace";
442
- break;
380
+ VALUE enumerator = rb_ary_entry(enumerators, x);
381
+ TypedData_Get_Struct(enumerator, MagickEnum, &rm_enum_data_type, magick_enum);
382
+ if (magick_enum->val == val)
383
+ {
384
+ return enumerator;
385
+ }
443
386
  }
444
387
 
445
- return rm_enum_new(Class_ColorspaceType, ID2SYM(rb_intern(name)), INT2FIX(cs));
446
-
388
+ return Qnil;
447
389
  }
448
390
 
449
391
 
450
392
  /**
451
- * Return the name of a CompositeOperator enum as a string.
393
+ * Returns a ClassType enum object for the specified value.
452
394
  *
453
395
  * No Ruby usage (internal function)
454
396
  *
455
- * @param op the CompositeOperator
456
- * @return the name
397
+ * @param cls the class type
398
+ * @return a new enumerator
457
399
  */
458
- static const char *
459
- CompositeOperator_name(CompositeOperator op)
400
+ VALUE
401
+ ClassType_find(ClassType cls)
460
402
  {
461
- switch (op)
462
- {
463
- ENUM_TO_NAME(UndefinedCompositeOp)
464
- ENUM_TO_NAME(NoCompositeOp)
465
- ENUM_TO_NAME(AddCompositeOp)
466
- ENUM_TO_NAME(AtopCompositeOp)
467
- #if defined(HAVE_ENUM_BLURCOMPOSITEOP)
468
- ENUM_TO_NAME(BlurCompositeOp)
469
- #endif
470
- ENUM_TO_NAME(BumpmapCompositeOp)
471
- ENUM_TO_NAME(ChangeMaskCompositeOp)
472
- ENUM_TO_NAME(ClearCompositeOp)
473
- ENUM_TO_NAME(ColorBurnCompositeOp)
474
- ENUM_TO_NAME(BlendCompositeOp)
475
- ENUM_TO_NAME(ColorDodgeCompositeOp)
476
- ENUM_TO_NAME(ExclusionCompositeOp)
477
- ENUM_TO_NAME(HardLightCompositeOp)
478
- ENUM_TO_NAME(SoftLightCompositeOp)
479
- ENUM_TO_NAME(ColorizeCompositeOp)
480
- ENUM_TO_NAME(CopyBlueCompositeOp)
481
- ENUM_TO_NAME(CopyCompositeOp)
482
- ENUM_TO_NAME(CopyCyanCompositeOp)
483
- ENUM_TO_NAME(CopyMagentaCompositeOp)
484
- ENUM_TO_NAME(CopyYellowCompositeOp)
485
- ENUM_TO_NAME(CopyBlackCompositeOp)
486
- ENUM_TO_NAME(CopyGreenCompositeOp)
487
- ENUM_TO_NAME(CopyOpacityCompositeOp)
488
- ENUM_TO_NAME(CopyRedCompositeOp)
489
- ENUM_TO_NAME(DarkenCompositeOp)
490
- #if defined(HAVE_ENUM_DISTORTCOMPOSITEOP)
491
- ENUM_TO_NAME(DistortCompositeOp)
492
- #endif
493
- ENUM_TO_NAME(DivideCompositeOp)
494
- ENUM_TO_NAME(DstAtopCompositeOp)
495
- ENUM_TO_NAME(DstCompositeOp)
496
- ENUM_TO_NAME(DstInCompositeOp)
497
- ENUM_TO_NAME(DstOutCompositeOp)
498
- ENUM_TO_NAME(DstOverCompositeOp)
499
- ENUM_TO_NAME(DifferenceCompositeOp)
500
- ENUM_TO_NAME(DisplaceCompositeOp)
501
- ENUM_TO_NAME(DissolveCompositeOp)
502
- ENUM_TO_NAME(HueCompositeOp)
503
- ENUM_TO_NAME(InCompositeOp)
504
- ENUM_TO_NAME(LightenCompositeOp)
505
- #if defined(HAVE_ENUM_LINEARBURNCOMPOSITEOP)
506
- ENUM_TO_NAME(LinearBurnCompositeOp)
507
- #endif
508
- #if defined(HAVE_ENUM_LINEARDODGECOMPOSITEOP)
509
- ENUM_TO_NAME(LinearDodgeCompositeOp)
510
- #endif
511
- ENUM_TO_NAME(LinearLightCompositeOp)
512
- ENUM_TO_NAME(LuminizeCompositeOp)
513
- #if defined(HAVE_ENUM_MATHEMATICSCOMPOSITEOP)
514
- ENUM_TO_NAME(MathematicsCompositeOp)
515
- #endif
516
- ENUM_TO_NAME(MinusCompositeOp)
517
- ENUM_TO_NAME(ModulateCompositeOp)
518
- ENUM_TO_NAME(MultiplyCompositeOp)
519
- ENUM_TO_NAME(OutCompositeOp)
520
- ENUM_TO_NAME(OverCompositeOp)
521
- ENUM_TO_NAME(OverlayCompositeOp)
522
- #if defined(HAVE_ENUM_PEGTOPLIGHTCOMPOSITEOP)
523
- ENUM_TO_NAME(PegtopLightCompositeOp)
524
- #endif
525
- #if defined(HAVE_ENUM_PINLIGHTCOMPOSITEOP)
526
- ENUM_TO_NAME(PinLightCompositeOp)
527
- #endif
528
- ENUM_TO_NAME(PlusCompositeOp)
529
- ENUM_TO_NAME(ReplaceCompositeOp)
530
- ENUM_TO_NAME(SaturateCompositeOp)
531
- ENUM_TO_NAME(ScreenCompositeOp)
532
- ENUM_TO_NAME(SrcAtopCompositeOp)
533
- ENUM_TO_NAME(SrcCompositeOp)
534
- ENUM_TO_NAME(SrcInCompositeOp)
535
- ENUM_TO_NAME(SrcOutCompositeOp)
536
- ENUM_TO_NAME(SrcOverCompositeOp)
537
- ENUM_TO_NAME(SubtractCompositeOp)
538
- ENUM_TO_NAME(ThresholdCompositeOp)
539
- #if defined(HAVE_ENUM_VIVIDLIGHTCOMPOSITEOP)
540
- ENUM_TO_NAME(VividLightCompositeOp)
541
- #endif
542
- ENUM_TO_NAME(XorCompositeOp)
543
- }
544
-
545
- return "UndefinedCompositeOp";
403
+ return Enum_find(Class_ClassType, cls);
546
404
  }
547
405
 
548
406
 
549
407
  /**
550
- * Construct a CompositeOperator enum object for the specified value.
408
+ * Returns a ColorspaceType enum object for the specified value.
551
409
  *
552
410
  * No Ruby usage (internal function)
553
411
  *
554
- * @param op the CompositeOperator
555
- * @return a new CompositeOperator enumerator
412
+ * @param cs the ColorspaceType
413
+ * @return a new ColorspaceType enumerator
556
414
  */
557
415
  VALUE
558
- CompositeOperator_new(CompositeOperator op)
416
+ ColorspaceType_find(ColorspaceType cs)
559
417
  {
560
- const char *name = CompositeOperator_name(op);
561
- return rm_enum_new(Class_CompositeOperator, ID2SYM(rb_intern(name)), INT2FIX(op));
418
+ return Enum_find(Class_ColorspaceType, cs);
562
419
  }
563
420
 
564
421
 
565
422
  /**
566
- * Return the name of a CompressionType enum as a string.
423
+ * Return the string representation of a ComplianceType value.
567
424
  *
568
425
  * No Ruby usage (internal function)
569
426
  *
570
- * @param ct the CompressionType
571
- * @return the name
427
+ * Notes:
428
+ * - xMagick will OR multiple compliance types so we have to arbitrarily pick
429
+ * one name.
430
+ * - Set the compliance argument to the selected value.
431
+ *
432
+ * @param c the ComplianceType value
433
+ * @return the string
572
434
  */
573
- static const char *
574
- CompressionType_name(CompressionType ct)
435
+ const char *
436
+ ComplianceType_name(ComplianceType *c)
575
437
  {
576
- switch (ct)
438
+ if ((*c & (SVGCompliance|X11Compliance|XPMCompliance))
439
+ == (SVGCompliance|X11Compliance|XPMCompliance))
577
440
  {
578
- ENUM_TO_NAME(UndefinedCompression)
579
- ENUM_TO_NAME(NoCompression)
580
- #if defined(HAVE_ENUM_B44COMPRESSION)
581
- ENUM_TO_NAME(B44Compression)
582
- #endif
583
- #if defined(HAVE_ENUM_B44ACOMPRESSION)
584
- ENUM_TO_NAME(B44ACompression)
585
- #endif
586
- ENUM_TO_NAME(BZipCompression)
587
- #if defined(HAVE_ENUM_DXT1COMPRESSION)
588
- ENUM_TO_NAME(DXT1Compression)
589
- #endif
590
- #if defined(HAVE_ENUM_DXT3COMPRESSION)
591
- ENUM_TO_NAME(DXT3Compression)
592
- #endif
593
- #if defined(HAVE_ENUM_DXT5COMPRESSION)
594
- ENUM_TO_NAME(DXT5Compression)
595
- #endif
596
- ENUM_TO_NAME(FaxCompression)
597
- ENUM_TO_NAME(Group4Compression)
598
- ENUM_TO_NAME(JPEGCompression)
599
- ENUM_TO_NAME(JPEG2000Compression)
600
- ENUM_TO_NAME(LosslessJPEGCompression)
601
- ENUM_TO_NAME(LZWCompression)
602
- #if defined(HAVE_ENUM_PIZCOMPRESSION)
603
- ENUM_TO_NAME(PizCompression)
604
- #endif
605
- #if defined(HAVE_ENUM_PXR24COMPRESSION)
606
- ENUM_TO_NAME(Pxr24Compression)
607
- #endif
608
- ENUM_TO_NAME(RLECompression)
609
- ENUM_TO_NAME(ZipCompression)
610
- #if defined(HAVE_ENUM_ZIPSCOMPRESSION)
611
- ENUM_TO_NAME(ZipSCompression)
612
- #endif
613
- }
614
-
615
- return "UndefinedCompression";
441
+ return "AllCompliance";
442
+ }
443
+ else if (*c & SVGCompliance)
444
+ {
445
+ *c = SVGCompliance;
446
+ return "SVGCompliance";
447
+ }
448
+ else if (*c & X11Compliance)
449
+ {
450
+ *c = X11Compliance;
451
+ return "X11Compliance";
452
+ }
453
+ else if (*c & XPMCompliance)
454
+ {
455
+ *c = XPMCompliance;
456
+ return "XPMCompliance";
457
+ }
458
+ else if (*c == NoCompliance)
459
+ {
460
+ *c = NoCompliance;
461
+ return "NoCompliance";
462
+ }
463
+ else
464
+ {
465
+ *c = UndefinedCompliance;
466
+ return "UndefinedCompliance";
467
+ }
616
468
  }
617
469
 
618
470
 
619
471
  /**
620
- * Construct a CompressionType enum object for the specified value.
472
+ * Returns a ComplianceType enum object for the specified value.
621
473
  *
622
474
  * No Ruby usage (internal function)
623
475
  *
624
- * @param ct the CompressionType
625
- * @return a new CompressionType enumerator
476
+ * @param compliance the C ComplianceType value
477
+ * @return the Ruby ComplianceType enum object
626
478
  */
627
479
  VALUE
628
- CompressionType_new(CompressionType ct)
480
+ ComplianceType_find(ComplianceType compliance)
629
481
  {
630
- const char *name = CompressionType_name(ct);
631
- return rm_enum_new(Class_CompressionType, ID2SYM(rb_intern(name)), INT2FIX(ct));
632
- }
482
+ ComplianceType c;
633
483
 
634
-
635
- /**
636
- * Return the name of a DisposeType enum as a string.
637
- *
638
- * No Ruby usage (internal function)
639
- *
640
- * @param type the DisposeType
641
- * @return the name
642
- */
643
- static const char *
644
- DisposeType_name(DisposeType type)
645
- {
646
- switch(type)
484
+ // Turn off undefined bits
485
+ if ((compliance & (SVGCompliance|X11Compliance|XPMCompliance))
486
+ == (SVGCompliance|X11Compliance|XPMCompliance))
647
487
  {
648
- ENUM_TO_NAME(UndefinedDispose)
649
- ENUM_TO_NAME(BackgroundDispose)
650
- ENUM_TO_NAME(NoneDispose)
651
- ENUM_TO_NAME(PreviousDispose)
488
+ c = SVGCompliance|X11Compliance|XPMCompliance;
652
489
  }
653
-
654
- return "UndefinedDispose";
490
+ else if (compliance & SVGCompliance)
491
+ {
492
+ c = SVGCompliance;
493
+ }
494
+ else if (compliance & X11Compliance)
495
+ {
496
+ c = X11Compliance;
497
+ }
498
+ else if (compliance & XPMCompliance)
499
+ {
500
+ c = XPMCompliance;
501
+ }
502
+ else if (compliance == NoCompliance)
503
+ {
504
+ c = NoCompliance;
505
+ }
506
+ else
507
+ {
508
+ c = UndefinedCompliance;
509
+ }
510
+ return Enum_find(Class_ComplianceType, c);
655
511
  }
656
512
 
657
513
 
658
514
  /**
659
- * Construct a DisposeType enum object for the specified value..new.
515
+ * Returns a CompositeOperator enum object for the specified value.
660
516
  *
661
517
  * No Ruby usage (internal function)
662
518
  *
663
- * @param type the DisposeType
664
- * @return a new DisposeType enumerator
519
+ * @param op the CompositeOperator
520
+ * @return a new CompositeOperator enumerator
665
521
  */
666
522
  VALUE
667
- DisposeType_new(DisposeType type)
523
+ CompositeOperator_find(CompositeOperator op)
668
524
  {
669
- const char *name = DisposeType_name(type);
670
- return rm_enum_new(Class_DisposeType, ID2SYM(rb_intern(name)), INT2FIX(type));
525
+ return Enum_find(Class_CompositeOperator, op);
671
526
  }
672
527
 
673
528
 
674
529
  /**
675
- * Return the name of a FilterTypes enum as a string.
530
+ * Returns a CompressionType enum object for the specified value.
676
531
  *
677
532
  * No Ruby usage (internal function)
678
533
  *
679
- * @param type the FilterTypes
680
- * @return the name
681
- */
682
- static const char *
683
- FilterTypes_name(FilterTypes type)
684
- {
685
- switch(type)
686
- {
687
- ENUM_TO_NAME(UndefinedFilter)
688
- ENUM_TO_NAME(PointFilter)
689
- ENUM_TO_NAME(BoxFilter)
690
- ENUM_TO_NAME(TriangleFilter)
691
- ENUM_TO_NAME(HermiteFilter)
692
- ENUM_TO_NAME(HanningFilter)
693
- ENUM_TO_NAME(HammingFilter)
694
- ENUM_TO_NAME(BlackmanFilter)
695
- ENUM_TO_NAME(GaussianFilter)
696
- ENUM_TO_NAME(QuadraticFilter)
697
- ENUM_TO_NAME(CubicFilter)
698
- ENUM_TO_NAME(CatromFilter)
699
- ENUM_TO_NAME(MitchellFilter)
700
- ENUM_TO_NAME(LanczosFilter)
701
- ENUM_TO_NAME(BesselFilter)
702
- ENUM_TO_NAME(SincFilter)
703
- #if defined(HAVE_ENUM_KAISERFILTER)
704
- ENUM_TO_NAME(KaiserFilter)
705
- #endif
706
- #if defined(HAVE_ENUM_WELSHFILTER)
707
- ENUM_TO_NAME(WelshFilter)
708
- #endif
709
- #if defined(HAVE_ENUM_PARZENFILTER)
710
- ENUM_TO_NAME(ParzenFilter)
711
- #endif
712
- #if defined(HAVE_ENUM_LAGRANGEFILTER)
713
- ENUM_TO_NAME(LagrangeFilter)
714
- #endif
715
- #if defined(HAVE_ENUM_BOHMANFILTER)
716
- ENUM_TO_NAME(BohmanFilter)
717
- #endif
718
- #if defined(HAVE_ENUM_BARTLETTFILTER)
719
- ENUM_TO_NAME(BartlettFilter)
720
- #endif
721
- #if defined(HAVE_ENUM_SENTINELFILTER)
722
- // not a real filter name - defeat gcc warning message
723
- case SentinelFilter:
724
- break;
725
- #endif
726
- }
727
-
728
- return "UndefinedFilter";
729
- }
730
-
731
-
732
- /**
733
- * Construct an FilterTypes enum object for the specified value.
734
- *
735
- * No Ruby usage (internal function)
736
- *
737
- * @param type the FilterTypes
738
- * @return a new FilterTypes enumerator
534
+ * @param ct the CompressionType
535
+ * @return a new CompressionType enumerator
739
536
  */
740
537
  VALUE
741
- FilterTypes_new(FilterTypes type)
538
+ CompressionType_find(CompressionType ct)
742
539
  {
743
- const char *name = FilterTypes_name(type);
744
- return rm_enum_new(Class_FilterTypes, ID2SYM(rb_intern(name)), INT2FIX(type));
540
+ return Enum_find(Class_CompressionType, ct);
745
541
  }
746
542
 
747
543
 
748
544
  /**
749
- * Return the name of a EndianType enum as a string.
545
+ * Returns a DisposeType enum object for the specified value..new.
750
546
  *
751
547
  * No Ruby usage (internal function)
752
548
  *
753
- * @param type the EndianType
754
- * @return the name
549
+ * @param type the DisposeType
550
+ * @return a new DisposeType enumerator
755
551
  */
756
- static const char *
757
- EndianType_name(EndianType type)
552
+ VALUE
553
+ DisposeType_find(DisposeType type)
758
554
  {
759
- switch(type)
760
- {
761
- ENUM_TO_NAME(UndefinedEndian)
762
- ENUM_TO_NAME(LSBEndian)
763
- ENUM_TO_NAME(MSBEndian)
764
- }
765
- return "UndefinedEndian";
555
+ return Enum_find(Class_DisposeType, type);
766
556
  }
767
557
 
768
558
 
769
559
  /**
770
- * Construct an EndianType enum object.
560
+ * Returns an EndianType enum object.
771
561
  *
772
562
  * No Ruby usage (internal function)
773
563
  *
@@ -775,46 +565,29 @@ EndianType_name(EndianType type)
775
565
  * @return a new EndianType enumerator
776
566
  */
777
567
  VALUE
778
- EndianType_new(EndianType type)
568
+ EndianType_find(EndianType type)
779
569
  {
780
- const char *name = EndianType_name(type);
781
- return rm_enum_new(Class_EndianType, ID2SYM(rb_intern(name)), INT2FIX(type));
570
+ return Enum_find(Class_EndianType, type);
782
571
  }
783
572
 
784
573
 
785
574
  /**
786
- * Return the name of a GravityType enum as a string.
575
+ * Returns a FilterType enum object for the specified value.
787
576
  *
788
577
  * No Ruby usage (internal function)
789
578
  *
790
- * @param type the GravityType
791
- * @return the name
579
+ * @param type the FilterType
580
+ * @return a new FilterType enumerator
792
581
  */
793
- static const char *
794
- GravityType_name(GravityType type)
582
+ VALUE
583
+ FilterType_find(FilterType type)
795
584
  {
796
- switch(type)
797
- {
798
- ENUM_TO_NAME(ForgetGravity)
799
- ENUM_TO_NAME(NorthWestGravity)
800
- ENUM_TO_NAME(NorthGravity)
801
- ENUM_TO_NAME(NorthEastGravity)
802
- ENUM_TO_NAME(WestGravity)
803
- ENUM_TO_NAME(CenterGravity)
804
- ENUM_TO_NAME(EastGravity)
805
- ENUM_TO_NAME(SouthWestGravity)
806
- ENUM_TO_NAME(SouthGravity)
807
- ENUM_TO_NAME(SouthEastGravity)
808
- ENUM_TO_NAME(StaticGravity)
809
- }
810
-
811
- // Defeat "duplicate case value" error.
812
- return "UndefinedGravity";
585
+ return Enum_find(Class_FilterType, type);
813
586
  }
814
587
 
815
588
 
816
589
  /**
817
- * Construct an GravityType enum object for the specified value.
590
+ * Returns a GravityType enum object for the specified value.
818
591
  *
819
592
  * No Ruby usage (internal function)
820
593
  *
@@ -822,46 +595,14 @@ GravityType_name(GravityType type)
822
595
  * @return a new GravityType enumerator
823
596
  */
824
597
  VALUE
825
- GravityType_new(GravityType type)
598
+ GravityType_find(GravityType type)
826
599
  {
827
- const char *name = GravityType_name(type);
828
- return rm_enum_new(Class_GravityType, ID2SYM(rb_intern(name)), INT2FIX(type));
600
+ return Enum_find(Class_GravityType, type);
829
601
  }
830
602
 
831
603
 
832
604
  /**
833
- * Return the name of a ImageType enum as a string.
834
- *
835
- * No Ruby usage (internal function)
836
- *
837
- * @param type the ImageType
838
- * @return the name
839
- */
840
- static const char *
841
- ImageType_name(ImageType type)
842
- {
843
- switch(type)
844
- {
845
- ENUM_TO_NAME(UndefinedType)
846
- ENUM_TO_NAME(BilevelType)
847
- ENUM_TO_NAME(GrayscaleType)
848
- ENUM_TO_NAME(GrayscaleMatteType)
849
- ENUM_TO_NAME(PaletteType)
850
- ENUM_TO_NAME(PaletteMatteType)
851
- ENUM_TO_NAME(TrueColorType)
852
- ENUM_TO_NAME(TrueColorMatteType)
853
- ENUM_TO_NAME(ColorSeparationType)
854
- ENUM_TO_NAME(ColorSeparationMatteType)
855
- ENUM_TO_NAME(OptimizeType)
856
- ENUM_TO_NAME(PaletteBilevelMatteType)
857
- }
858
-
859
- return "UndefinedType";
860
- }
861
-
862
-
863
- /**
864
- * Construct an ImageType enum object for the specified value.
605
+ * Returns an ImageType enum object for the specified value.
865
606
  *
866
607
  * No Ruby usage (internal function)
867
608
  *
@@ -869,42 +610,14 @@ ImageType_name(ImageType type)
869
610
  * @return a new ImageType enumerator
870
611
  */
871
612
  VALUE
872
- ImageType_new(ImageType type)
873
- {
874
- const char *name = ImageType_name(type);
875
- return rm_enum_new(Class_ImageType, ID2SYM(rb_intern(name)), INT2FIX(type));
876
- }
877
-
878
-
879
- /**
880
- * Return the name of a InterlaceType enum as a string.
881
- *
882
- * No Ruby usage (internal function)
883
- *
884
- * @param interlace the InterlaceType
885
- * @return the name
886
- */
887
- static const char *
888
- InterlaceType_name(InterlaceType interlace)
613
+ ImageType_find(ImageType type)
889
614
  {
890
- switch(interlace)
891
- {
892
- ENUM_TO_NAME(UndefinedInterlace)
893
- ENUM_TO_NAME(GIFInterlace)
894
- ENUM_TO_NAME(JPEGInterlace)
895
- ENUM_TO_NAME(PNGInterlace)
896
- ENUM_TO_NAME(NoInterlace)
897
- ENUM_TO_NAME(LineInterlace)
898
- ENUM_TO_NAME(PlaneInterlace)
899
- ENUM_TO_NAME(PartitionInterlace)
900
- }
901
-
902
- return "UndefinedInterlace";
615
+ return Enum_find(Class_ImageType, type);
903
616
  }
904
617
 
905
618
 
906
619
  /**
907
- * Construct an InterlaceType enum object for the specified value.
620
+ * Returns an InterlaceType enum object for the specified value.
908
621
  *
909
622
  * No Ruby usage (internal function)
910
623
  *
@@ -912,315 +625,164 @@ InterlaceType_name(InterlaceType interlace)
912
625
  * @return a new InterlaceType enumerator
913
626
  */
914
627
  VALUE
915
- InterlaceType_new(InterlaceType interlace)
916
- {
917
- const char *name = InterlaceType_name(interlace);
918
- return rm_enum_new(Class_InterlaceType, ID2SYM(rb_intern(name)), INT2FIX(interlace));
919
- }
920
-
921
-
922
- /**
923
- * Return the name of a InterpolatePixelMethod enum as a string.
924
- *
925
- * No Ruby usage (internal function)
926
- *
927
- * @param interpolate the InterpolatePixelMethod
928
- * @return the name
929
- */
930
- static const char *
931
- InterpolatePixelMethod_name(InterpolatePixelMethod interpolate)
628
+ InterlaceType_find(InterlaceType interlace)
932
629
  {
933
- switch(interpolate)
934
- {
935
- ENUM_TO_NAME(UndefinedInterpolatePixel)
936
- ENUM_TO_NAME(AverageInterpolatePixel)
937
- ENUM_TO_NAME(BicubicInterpolatePixel)
938
- ENUM_TO_NAME(BilinearInterpolatePixel)
939
- ENUM_TO_NAME(FilterInterpolatePixel)
940
- ENUM_TO_NAME(IntegerInterpolatePixel)
941
- ENUM_TO_NAME(MeshInterpolatePixel)
942
- ENUM_TO_NAME(NearestNeighborInterpolatePixel)
943
- ENUM_TO_NAME(SplineInterpolatePixel)
944
- }
945
-
946
- return "UndefinedInterpolatePixel";
630
+ return Enum_find(Class_InterlaceType, interlace);
947
631
  }
948
632
 
949
633
 
950
634
  /**
951
- * Construct an InterpolatePixelMethod enum object for the specified value.
635
+ * Returns an OrientationType enum object for the specified value.
952
636
  *
953
637
  * No Ruby usage (internal function)
954
638
  *
955
- * @param interpolate the InterpolatePixelMethod
956
- * @return a new InterpolatePixelMethod enumerator
639
+ * @param type the OrientationType
640
+ * @return a new OrientationType enumerator
957
641
  */
958
642
  VALUE
959
- InterpolatePixelMethod_new(InterpolatePixelMethod interpolate)
643
+ OrientationType_find(OrientationType type)
960
644
  {
961
- const char *name = InterpolatePixelMethod_name(interpolate);
962
- return rm_enum_new(Class_InterpolatePixelMethod, ID2SYM(rb_intern(name)), INT2FIX(interpolate));
645
+ return Enum_find(Class_OrientationType, type);
963
646
  }
964
647
 
965
648
 
966
649
  /**
967
- * Return the name of a MagickLayerMethod enum as a string.
650
+ * Returns a PixelInterpolateMethod enum object for the specified value.
968
651
  *
969
652
  * No Ruby usage (internal function)
970
653
  *
971
- * @param method the MagickLayerMethod
972
- * @return the name
973
- */
974
- static const char *
975
- LAYERMETHODTYPE_NAME(LAYERMETHODTYPE method)
976
- {
977
- switch(method)
978
- {
979
- ENUM_TO_NAME(UndefinedLayer)
980
- ENUM_TO_NAME(CompareAnyLayer)
981
- ENUM_TO_NAME(CompareClearLayer)
982
- ENUM_TO_NAME(CompareOverlayLayer)
983
- ENUM_TO_NAME(OptimizeLayer)
984
- ENUM_TO_NAME(OptimizePlusLayer)
985
- ENUM_TO_NAME(CoalesceLayer)
986
- ENUM_TO_NAME(DisposeLayer)
987
- ENUM_TO_NAME(OptimizeTransLayer)
988
- ENUM_TO_NAME(OptimizeImageLayer)
989
- ENUM_TO_NAME(RemoveDupsLayer)
990
- ENUM_TO_NAME(RemoveZeroLayer)
991
- ENUM_TO_NAME(CompositeLayer)
992
- #if defined(HAVE_ENUM_MERGELAYER)
993
- ENUM_TO_NAME(MergeLayer)
994
- #endif
995
- #if defined(HAVE_ENUM_MOSAICLAYER)
996
- ENUM_TO_NAME(MosaicLayer)
997
- #endif
998
- #if defined(HAVE_ENUM_FLATTENLAYER)
999
- ENUM_TO_NAME(FlattenLayer)
1000
- #endif
1001
- #if defined(HAVE_ENUM_TRIMBOUNDSLAYER)
1002
- ENUM_TO_NAME(TrimBoundsLayer)
1003
- #endif
1004
- }
1005
-
1006
- return "UndefinedLayer";
1007
- }
1008
-
1009
-
1010
- /**
1011
- * Construct an MagickLayerMethod enum object for the specified value.
1012
- *
1013
- * No Ruby usage (internal function)
1014
- *
1015
- * @param method the MagickLayerMethod
1016
- * @return a new MagickLayerMethod enumerator
654
+ * @param interpolate the PixelInterpolateMethod
655
+ * @return a new PixelInterpolateMethod enumerator
1017
656
  */
1018
657
  VALUE
1019
- LAYERMETHODTYPE_NEW(LAYERMETHODTYPE method)
658
+ PixelInterpolateMethod_find(PixelInterpolateMethod interpolate)
1020
659
  {
1021
- const char *name = LAYERMETHODTYPE_NAME(method);
1022
- return rm_enum_new(CLASS_LAYERMETHODTYPE, ID2SYM(rb_intern(name)), INT2FIX(method));
660
+ return Enum_find(Class_PixelInterpolateMethod, interpolate);
1023
661
  }
1024
662
 
1025
663
 
1026
664
  /**
1027
- * Return the name of a OrientationType enum as a string.
665
+ * Construct an RenderingIntent enum object for the specified value.
1028
666
  *
1029
667
  * No Ruby usage (internal function)
1030
668
  *
1031
- * @param type the OreintationType
1032
- * @return the name
669
+ * @param intent the RenderingIntent
670
+ * @return a new RenderingIntent enumerator
1033
671
  */
1034
- static const char *
1035
- OrientationType_name(OrientationType type)
672
+ VALUE
673
+ RenderingIntent_find(RenderingIntent intent)
1036
674
  {
1037
- switch(type)
1038
- {
1039
- ENUM_TO_NAME(UndefinedOrientation)
1040
- ENUM_TO_NAME(TopLeftOrientation)
1041
- ENUM_TO_NAME(TopRightOrientation)
1042
- ENUM_TO_NAME(BottomRightOrientation)
1043
- ENUM_TO_NAME(BottomLeftOrientation)
1044
- ENUM_TO_NAME(LeftTopOrientation)
1045
- ENUM_TO_NAME(RightTopOrientation)
1046
- ENUM_TO_NAME(RightBottomOrientation)
1047
- ENUM_TO_NAME(LeftBottomOrientation)
1048
- }
1049
-
1050
- return "UndefinedOrientation";
675
+ return Enum_find(Class_RenderingIntent, intent);
1051
676
  }
1052
677
 
1053
678
 
1054
679
  /**
1055
- * Construct an OrientationType enum object for the specified value.
680
+ * Returns a ResolutionType enum object for the specified value.
1056
681
  *
1057
682
  * No Ruby usage (internal function)
1058
683
  *
1059
- * @param type the OrientationType
1060
- * @return a new OrientationType enumerator
684
+ * @param type the ResolutionType
685
+ * @return a new ResolutionType enumerator
1061
686
  */
1062
687
  VALUE
1063
- OrientationType_new(OrientationType type)
688
+ ResolutionType_find(ResolutionType type)
1064
689
  {
1065
- const char *name = OrientationType_name(type);
1066
- return rm_enum_new(Class_OrientationType, ID2SYM(rb_intern(name)), INT2FIX(type));
690
+ return Enum_find(Class_ResolutionType, type);
1067
691
  }
1068
692
 
1069
693
 
1070
694
  /**
1071
- * Return the name of a RenderingIntent enum as a string.
695
+ * Return the string representation of a StorageType value.
1072
696
  *
1073
697
  * No Ruby usage (internal function)
1074
698
  *
1075
- * @param intent the RenderingIntent
699
+ * @param type the StorageType
1076
700
  * @return the name
1077
701
  */
1078
- static const char *
1079
- RenderingIntent_name(RenderingIntent intent)
702
+ const char *
703
+ StorageType_name(StorageType type)
1080
704
  {
1081
- switch(intent)
705
+ VALUE storage = Enum_find(Class_StorageType, type);
706
+ if (NIL_P(storage))
1082
707
  {
1083
- ENUM_TO_NAME(UndefinedIntent)
1084
- ENUM_TO_NAME(SaturationIntent)
1085
- ENUM_TO_NAME(PerceptualIntent)
1086
- ENUM_TO_NAME(AbsoluteIntent)
1087
- ENUM_TO_NAME(RelativeIntent)
708
+ return "UndefinedPixel";
1088
709
  }
1089
-
1090
- return "UndefinedIntent";
1091
- }
1092
-
1093
-
1094
- /**
1095
- * Construct an RenderingIntent enum object for the specified value.
1096
- *
1097
- * No Ruby usage (internal function)
1098
- *
1099
- * @param intent the RenderingIntent
1100
- * @return a new RenderingIntent enumerator
1101
- */
1102
- VALUE
1103
- RenderingIntent_new(RenderingIntent intent)
1104
- {
1105
- const char *name = RenderingIntent_name(intent);
1106
- return rm_enum_new(Class_RenderingIntent, ID2SYM(rb_intern(name)), INT2FIX(intent));
710
+ return rm_enum_to_cstr(storage);
1107
711
  }
1108
712
 
1109
713
 
1110
714
  /**
1111
- * Return the name of a ResolutionType enum as a string.
715
+ * Return the string representation of a StretchType value.
1112
716
  *
1113
717
  * No Ruby usage (internal function)
1114
718
  *
1115
- * @param type the ResolutionType
1116
- * @return the name
719
+ * @param stretch the StretchType value
720
+ * @return the string
1117
721
  */
1118
- static const char *
1119
- ResolutionType_name(ResolutionType type)
722
+ const char *
723
+ StretchType_name(StretchType type)
1120
724
  {
1121
- switch(type)
725
+ VALUE stretch = Enum_find(Class_StretchType, type);
726
+ if (NIL_P(stretch))
1122
727
  {
1123
- ENUM_TO_NAME(UndefinedResolution)
1124
- ENUM_TO_NAME(PixelsPerInchResolution)
1125
- ENUM_TO_NAME(PixelsPerCentimeterResolution)
728
+ return "UndefinedStretch";
1126
729
  }
1127
-
1128
- return "UndefinedResolution";
730
+ return rm_enum_to_cstr(stretch);
1129
731
  }
1130
732
 
1131
733
 
1132
734
  /**
1133
- * Construct an ResolutionType enum object for the specified value.
735
+ * Returns a StretchType enum for a specified StretchType value.
1134
736
  *
1135
737
  * No Ruby usage (internal function)
1136
738
  *
1137
- * @param type the ResolutionType
1138
- * @return a new ResolutionType enumerator
739
+ * @param stretch the C StretchType value
740
+ * @return a Ruby StretchType enum
1139
741
  */
1140
742
  VALUE
1141
- ResolutionType_new(ResolutionType type)
743
+ StretchType_find(StretchType stretch)
1142
744
  {
1143
- const char *name = ResolutionType_name(type);
1144
- return rm_enum_new(Class_ResolutionType, ID2SYM(rb_intern(name)), INT2FIX(type));
745
+ return Enum_find(Class_StretchType, stretch);
1145
746
  }
1146
747
 
1147
748
 
1148
749
  /**
1149
- * Return the string representation of a StorageType value.
750
+ * Return the string representation of a StyleType value.
1150
751
  *
1151
752
  * No Ruby usage (internal function)
1152
753
  *
1153
- * @param type the StorageType
1154
- * @return the name
754
+ * @param style the StyleType value
755
+ * @return the string
1155
756
  */
1156
757
  const char *
1157
- StorageType_name(StorageType type)
758
+ StyleType_name(StyleType type)
1158
759
  {
1159
- switch (type)
760
+ VALUE style = Enum_find(Class_StyleType, type);
761
+ if (NIL_P(style))
1160
762
  {
1161
- ENUM_TO_NAME(UndefinedPixel)
1162
- ENUM_TO_NAME(CharPixel)
1163
- ENUM_TO_NAME(DoublePixel)
1164
- ENUM_TO_NAME(FloatPixel)
1165
- ENUM_TO_NAME(IntegerPixel)
1166
- ENUM_TO_NAME(LongPixel)
1167
- ENUM_TO_NAME(QuantumPixel)
1168
- ENUM_TO_NAME(ShortPixel)
763
+ return "UndefinedStyle";
1169
764
  }
1170
-
1171
- return "UndefinedPixel";
765
+ return rm_enum_to_cstr(style);
1172
766
  }
1173
767
 
1174
768
 
1175
769
  /**
1176
- * Return the string representation of a VirtualPixelMethod value.
770
+ * Returns a StyleType enum for a specified StyleType value.
1177
771
  *
1178
772
  * No Ruby usage (internal function)
1179
773
  *
1180
- * @param method the VirtualPixelMethod
1181
- * @return the name
774
+ * @param style the C StyleType value
775
+ * @return a Ruby StyleType enum
1182
776
  */
1183
- static const char *
1184
- VirtualPixelMethod_name(VirtualPixelMethod method)
777
+ VALUE
778
+ StyleType_find(StyleType style)
1185
779
  {
1186
- switch (method)
1187
- {
1188
- ENUM_TO_NAME(UndefinedVirtualPixelMethod)
1189
- ENUM_TO_NAME(EdgeVirtualPixelMethod)
1190
- ENUM_TO_NAME(MirrorVirtualPixelMethod)
1191
- ENUM_TO_NAME(TileVirtualPixelMethod)
1192
- ENUM_TO_NAME(TransparentVirtualPixelMethod)
1193
- ENUM_TO_NAME(BackgroundVirtualPixelMethod)
1194
- ENUM_TO_NAME(DitherVirtualPixelMethod)
1195
- ENUM_TO_NAME(RandomVirtualPixelMethod)
1196
- ENUM_TO_NAME(ConstantVirtualPixelMethod)
1197
- ENUM_TO_NAME(MaskVirtualPixelMethod)
1198
- ENUM_TO_NAME(BlackVirtualPixelMethod)
1199
- ENUM_TO_NAME(GrayVirtualPixelMethod)
1200
- ENUM_TO_NAME(WhiteVirtualPixelMethod)
1201
- #if defined(HAVE_ENUM_HORIZONTALTILEVIRTUALPIXELMETHOD)
1202
- ENUM_TO_NAME(HorizontalTileVirtualPixelMethod)
1203
- #endif
1204
- #if defined(HAVE_ENUM_VERTICALTILEVIRTUALPIXELMETHOD)
1205
- ENUM_TO_NAME(VerticalTileVirtualPixelMethod)
1206
- #endif
1207
- #if defined(HAVE_ENUM_HORIZONTALTILEEDGEVIRTUALPIXELMETHOD)
1208
- ENUM_TO_NAME(HorizontalTileEdgeVirtualPixelMethod)
1209
- #endif
1210
- #if defined(HAVE_ENUM_VERTICALTILEEDGEVIRTUALPIXELMETHOD)
1211
- ENUM_TO_NAME(VerticalTileEdgeVirtualPixelMethod)
1212
- #endif
1213
- #if defined(HAVE_ENUM_CHECKERTILEVIRTUALPIXELMETHOD)
1214
- ENUM_TO_NAME(CheckerTileVirtualPixelMethod)
1215
- #endif
1216
- }
1217
-
1218
- return "UndefinedVirtualPixelMethod";
780
+ return Enum_find(Class_StyleType, style);
1219
781
  }
1220
782
 
1221
783
 
1222
784
  /**
1223
- * Construct a VirtualPixelMethod enum for a specified VirtualPixelMethod value.
785
+ * Returns a VirtualPixelMethod enum for a specified VirtualPixelMethod value.
1224
786
  *
1225
787
  * No Ruby usage (internal function)
1226
788
  *
@@ -1228,8 +790,7 @@ VirtualPixelMethod_name(VirtualPixelMethod method)
1228
790
  * @return a new VirtualPixelMethod enumerator
1229
791
  */
1230
792
  VALUE
1231
- VirtualPixelMethod_new(VirtualPixelMethod style)
793
+ VirtualPixelMethod_find(VirtualPixelMethod style)
1232
794
  {
1233
- const char *name = VirtualPixelMethod_name(style);
1234
- return rm_enum_new(Class_VirtualPixelMethod, ID2SYM(rb_intern(name)), INT2FIX(style));
795
+ return Enum_find(Class_VirtualPixelMethod, style);
1235
796
  }