rmagick 3.2.0 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rmagick might be problematic. Click here for more details.

Files changed (420) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +63 -0
  3. data/.devcontainer/Dockerfile +14 -0
  4. data/.devcontainer/ImageMagick6/devcontainer.json +11 -0
  5. data/.devcontainer/devcontainer.json +11 -0
  6. data/.devcontainer/setup-repo.sh +10 -0
  7. data/.devcontainer/setup-user.sh +45 -0
  8. data/.editorconfig +3 -0
  9. data/.github/ISSUE_TEMPLATE.md +17 -0
  10. data/.github/workflows/ci.yml +79 -0
  11. data/.gitignore +3 -1
  12. data/.rspec +1 -0
  13. data/.rubocop.yml +24 -0
  14. data/.rubocop_todo.yml +151 -297
  15. data/.yardopts +5 -0
  16. data/CHANGELOG.md +233 -0
  17. data/CODE_OF_CONDUCT.md +122 -7
  18. data/CONTRIBUTING.md +14 -10
  19. data/README.md +326 -0
  20. data/Rakefile +16 -22
  21. data/before_install_linux.sh +22 -28
  22. data/before_install_osx.sh +57 -2
  23. data/ext/RMagick/extconf.rb +149 -105
  24. data/ext/RMagick/rmagick.c +77 -104
  25. data/ext/RMagick/rmagick.h +121 -103
  26. data/ext/RMagick/rmdraw.c +364 -436
  27. data/ext/RMagick/rmenum.c +106 -114
  28. data/ext/RMagick/rmfill.c +149 -70
  29. data/ext/RMagick/rmilist.c +225 -367
  30. data/ext/RMagick/rmimage.c +4751 -4405
  31. data/ext/RMagick/rminfo.c +574 -787
  32. data/ext/RMagick/rmkinfo.c +51 -121
  33. data/ext/RMagick/rmmain.c +454 -286
  34. data/ext/RMagick/rmmontage.c +64 -130
  35. data/ext/RMagick/rmpixel.c +488 -437
  36. data/ext/RMagick/rmstruct.c +83 -96
  37. data/ext/RMagick/rmutil.c +302 -214
  38. data/lib/rmagick/version.rb +1 -1
  39. data/lib/rmagick_internal.rb +138 -93
  40. data/lib/rvg/clippath.rb +2 -1
  41. data/lib/rvg/container.rb +10 -5
  42. data/lib/rvg/describable.rb +1 -1
  43. data/lib/rvg/embellishable.rb +5 -4
  44. data/lib/rvg/misc.rb +15 -12
  45. data/lib/rvg/paint.rb +2 -1
  46. data/lib/rvg/pathdata.rb +12 -11
  47. data/lib/rvg/rvg.rb +12 -8
  48. data/lib/rvg/stylable.rb +9 -7
  49. data/lib/rvg/text.rb +11 -6
  50. data/lib/rvg/transformable.rb +3 -2
  51. data/lib/rvg/units.rb +1 -1
  52. data/rmagick.gemspec +10 -11
  53. metadata +52 -423
  54. data/.appveyor.yml +0 -45
  55. data/.circleci/config.yml +0 -56
  56. data/.ruby-version +0 -1
  57. data/.simplecov +0 -27
  58. data/.travis.yml +0 -62
  59. data/Doxyfile +0 -1514
  60. data/README.textile +0 -259
  61. data/benchmarks/memory/README.md +0 -50
  62. data/benchmarks/memory/image_new.rb +0 -8
  63. data/benchmarks/memory/rmagick.gnuplot +0 -16
  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 -52
  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 -41
  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 -16
  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 -45
  145. data/doc/ex/get_type_metrics.rb +0 -142
  146. data/doc/ex/gradientfill.rb +0 -27
  147. data/doc/ex/grav.rb +0 -45
  148. data/doc/ex/gravity.rb +0 -78
  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.png +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.png +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.png +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 -37
  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 -26
  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 -126
  299. data/doc/ex/solarize.rb +0 -11
  300. data/doc/ex/sparse_color.rb +0 -55
  301. data/doc/ex/splice.rb +0 -8
  302. data/doc/ex/spread.rb +0 -11
  303. data/doc/ex/stegano.rb +0 -54
  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 -570
  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 -323
  368. data/examples/describe.rb +0 -41
  369. data/examples/find_similar_region.rb +0 -34
  370. data/examples/histogram.rb +0 -312
  371. data/examples/identify.rb +0 -174
  372. data/examples/image_opacity.rb +0 -28
  373. data/examples/import_export.rb +0 -31
  374. data/examples/pattern_fill.rb +0 -37
  375. data/examples/rotating_text.rb +0 -45
  376. data/examples/spinner.rb +0 -49
  377. data/examples/thumbnail.rb +0 -64
  378. data/examples/vignette.rb +0 -78
  379. data/lib/obsolete.rb +0 -66
  380. data/spec/rmagick/ImageList1_spec.rb +0 -24
  381. data/spec/rmagick/draw_spec.rb +0 -155
  382. data/spec/rmagick/image/blue_shift_spec.rb +0 -14
  383. data/spec/rmagick/image/channel_entropy_spec.rb +0 -9
  384. data/spec/rmagick/image/composite_spec.rb +0 -72
  385. data/spec/rmagick/image/constitute_spec.rb +0 -13
  386. data/spec/rmagick/image/dispatch_spec.rb +0 -16
  387. data/spec/rmagick/image/from_blob_spec.rb +0 -12
  388. data/spec/rmagick/image/ping_spec.rb +0 -12
  389. data/spec/rmagick/image/properties_spec.rb +0 -27
  390. data/spec/rmagick/image/read_spec.rb +0 -28
  391. data/spec/spec_helper.rb +0 -10
  392. data/spec/support/issue_200/app.rb +0 -8
  393. data/test/Draw.rb +0 -351
  394. data/test/Enum.rb +0 -228
  395. data/test/Fill.rb +0 -93
  396. data/test/Image1.rb +0 -627
  397. data/test/Image2.rb +0 -1426
  398. data/test/Image3.rb +0 -1091
  399. data/test/ImageList1.rb +0 -858
  400. data/test/ImageList2.rb +0 -406
  401. data/test/Image_attributes.rb +0 -666
  402. data/test/Import_Export.rb +0 -115
  403. data/test/Info.rb +0 -444
  404. data/test/KernelInfo.rb +0 -67
  405. data/test/Magick.rb +0 -311
  406. data/test/Pixel.rb +0 -285
  407. data/test/PolaroidOptions.rb +0 -23
  408. data/test/Preview.rb +0 -26
  409. data/test/Struct.rb +0 -45
  410. data/test/appearance/Montage.rb +0 -26
  411. data/test/appearance/appearance_assertion.rb +0 -13
  412. data/test/appearance/expected/montage_border_color.jpg +0 -0
  413. data/test/cmyk.icm +0 -0
  414. data/test/lib/Obsolete.rb +0 -30
  415. data/test/lib/internal/Draw.rb +0 -823
  416. data/test/lib/internal/Geometry.rb +0 -98
  417. data/test/lib/internal/Magick.rb +0 -40
  418. data/test/srgb.icm +0 -0
  419. data/test/test_all_basic.rb +0 -49
  420. data/test/tmpnam_test.rb +0 -50
data/ext/RMagick/rminfo.c CHANGED
@@ -13,33 +13,10 @@
13
13
  #include "rmagick.h"
14
14
 
15
15
 
16
- /*
17
- * Define functions to get/set attributes in Image::Info that
18
- * use the Get/SetImageOption API.
19
- */
20
- //! Option attribute reader. For Image::Info.
21
- #define OPTION_ATTR_READER(opt, key) \
22
- VALUE Info_##opt(VALUE self)\
23
- {\
24
- return get_option(self, #key);\
25
- }
26
- //! Option attribute writer. For Image::Info.
27
- #define OPTION_ATTR_WRITER(opt, key) \
28
- VALUE Info_##opt##_eq(VALUE self, VALUE string)\
29
- {\
30
- return set_option(self, #key, string);\
31
- }
32
- //! Option attribute accessor. For Image::Info.
33
- #define OPTION_ATTR_ACCESSOR(opt, key)\
34
- OPTION_ATTR_READER(opt, key)\
35
- OPTION_ATTR_WRITER(opt, key)
36
-
37
-
38
16
  /**
39
17
  * Return the value of the specified option.
40
18
  *
41
- * Ruby usage:
42
- * - @verbatim Info#get_option(key) @endverbatim
19
+ * No Ruby usage (internal function)
43
20
  *
44
21
  * @param self this object
45
22
  * @param key the option key
@@ -65,8 +42,7 @@ get_option(VALUE self, const char *key)
65
42
  * Set the specified option to this value. If the value is nil just unset any
66
43
  * current value.
67
44
  *
68
- * Ruby usage:
69
- * - @verbatim Info#set_option(key,string) @endverbatim
45
+ * No Ruby usage (internal function)
70
46
  *
71
47
  * @param self this object
72
48
  * @param key the option key
@@ -77,18 +53,19 @@ static VALUE
77
53
  set_option(VALUE self, const char *key, VALUE string)
78
54
  {
79
55
  Info *info;
80
- char *value;
81
56
 
82
57
  Data_Get_Struct(self, Info, info);
83
58
 
84
59
  if (NIL_P(string))
85
60
  {
86
- (void) DeleteImageOption(info, key);
61
+ DeleteImageOption(info, key);
87
62
  }
88
63
  else
89
64
  {
90
- value = StringValuePtr(string);
91
- (void) SetImageOption(info, key, value);
65
+ char *value;
66
+
67
+ value = StringValueCStr(string);
68
+ SetImageOption(info, key, value);
92
69
  }
93
70
  return string;
94
71
  }
@@ -110,29 +87,30 @@ set_option(VALUE self, const char *key, VALUE string)
110
87
  static VALUE set_color_option(VALUE self, const char *option, VALUE color)
111
88
  {
112
89
  Info *info;
113
- char *name;
114
90
  PixelColor pp;
115
- ExceptionInfo *exception;
116
91
  MagickBooleanType okay;
117
92
 
118
93
  Data_Get_Struct(self, Info, info);
119
94
 
120
95
  if (NIL_P(color))
121
96
  {
122
- (void) DeleteImageOption(info, option);
97
+ DeleteImageOption(info, option);
123
98
  }
124
99
  else
125
100
  {
126
- name = StringValuePtr(color);
101
+ char *name;
102
+ ExceptionInfo *exception;
103
+
104
+ name = StringValueCStr(color);
127
105
  exception = AcquireExceptionInfo();
128
106
  okay = QueryColorCompliance(name, AllCompliance, &pp, exception);
129
- (void) DestroyExceptionInfo(exception);
107
+ DestroyExceptionInfo(exception);
130
108
  if (!okay)
131
109
  {
132
110
  rb_raise(rb_eArgError, "invalid color name `%s'", name);
133
111
  }
134
112
 
135
- (void) SetImageOption(info, option, name);
113
+ SetImageOption(info, option, name);
136
114
  }
137
115
 
138
116
  return color;
@@ -188,81 +166,79 @@ static VALUE get_dbl_option(VALUE self, const char *option)
188
166
  static VALUE set_dbl_option(VALUE self, const char *option, VALUE value)
189
167
  {
190
168
  Info *info;
191
- char buff[50];
192
- double d;
193
- long n;
194
- int len;
195
169
 
196
170
  Data_Get_Struct(self, Info, info);
197
171
 
198
172
  if (NIL_P(value))
199
173
  {
200
- (void) DeleteImageOption(info, option);
174
+ DeleteImageOption(info, option);
201
175
  }
202
176
  else
203
177
  {
178
+ char buff[50];
179
+ double d;
180
+ int len;
181
+ long n;
182
+
204
183
  d = NUM2DBL(value);
205
184
  n = floor(d);
206
185
  if (d == n)
207
186
  {
208
- len = sprintf(buff, "%-10ld", n);
187
+ len = snprintf(buff, sizeof(buff), "%-10ld", n);
209
188
  }
210
189
  else
211
190
  {
212
- len = sprintf(buff, "%-10.2f", d);
191
+ len = snprintf(buff, sizeof(buff), "%-10.2f", d);
213
192
  }
214
193
  memset(buff+len, '\0', sizeof(buff)-len);
215
- (void) SetImageOption(info, option, buff);
194
+ SetImageOption(info, option, buff);
216
195
  }
217
196
 
218
197
  return value;
219
198
  }
220
199
 
221
200
 
222
- #if 0
223
201
  /**
224
- * Convert a PixelPacket to a hex-format color name.
225
- *
226
- * No Ruby usage (internal function)
202
+ * Get antialias value
227
203
  *
228
- * @param pp the pixel packet
229
- * @param name pointer to the name
230
- * @return the name
204
+ * @return [Boolean] true if antialias is enabled
231
205
  */
232
- static char *pixel_packet_to_hexname(PixelPacket *pp, char *name)
206
+ VALUE
207
+ Info_antialias(VALUE self)
233
208
  {
234
- MagickPixel mpp;
235
-
236
- rm_init_magickpixel(NULL, &mpp);
237
- rm_set_magick_pixel_packet(pp, &mpp);
238
- (void) GetColorTuple(&mpp, MagickTrue, name);
239
- return name;
209
+ IMPLEMENT_ATTR_READER(Info, antialias, boolean);
240
210
  }
241
- #endif
242
-
243
211
 
244
- DEF_ATTR_ACCESSOR(Info, antialias, bool)
212
+ /**
213
+ * Set antialias value
214
+ *
215
+ * @param val [Boolean] true or false
216
+ * @return [Boolean] the given value
217
+ */
218
+ VALUE
219
+ Info_antialias_eq(VALUE self, VALUE val)
220
+ {
221
+ IMPLEMENT_ATTR_WRITER(Info, antialias, boolean);
222
+ }
245
223
 
246
224
  /** Maximum length of a format (@see Info_aref) */
247
225
  #define MAX_FORMAT_LEN 60
248
226
 
249
227
  /**
250
- * Get the value of an option set by Info[]=
228
+ * Get the value of the specified option for the specified format.
251
229
  *
252
- * Ruby usage:
253
- * - @verbatim Info[format, key] @endverbatim
254
- * - @verbatim Info[key] @endverbatim
230
+ * - The 2 argument form is the original form. Added support for a single
231
+ * argument after ImageMagick started using Set/GetImageOption for options
232
+ * that aren't represented by fields in the ImageInfo structure.
255
233
  *
256
- * Notes:
257
- * - The 2 argument form is the original form. Added support for a single
258
- * argument after ImageMagick started using Set/GetImageOption for options
259
- * that aren't represented by fields in the ImageInfo structure.
234
+ * @overload [](format, key)
235
+ * @param format [String] An image format name such as "ps" or "tiff".
236
+ * @param key [String] A string that identifies the option.
260
237
  *
261
- * @param argc number of input arguments
262
- * @param argv array of input arguments
263
- * @param self this object
264
- * @return the option value
265
- * @see Info_aset
238
+ * @overload [](key)
239
+ * @param key [String] A string that identifies the option.
240
+ *
241
+ * @return [String] The value of the option.
266
242
  */
267
243
  VALUE
268
244
  Info_aref(int argc, VALUE *argv, VALUE self)
@@ -287,8 +263,7 @@ Info_aref(int argc, VALUE *argv, VALUE self)
287
263
  break;
288
264
 
289
265
  case 1:
290
- strncpy(fkey, StringValuePtr(argv[0]), sizeof(fkey)-1);
291
- fkey[sizeof(fkey)-1] = '\0';
266
+ strlcpy(fkey, StringValueCStr(argv[0]), sizeof(fkey));
292
267
  break;
293
268
 
294
269
  default:
@@ -309,26 +284,23 @@ Info_aref(int argc, VALUE *argv, VALUE self)
309
284
 
310
285
 
311
286
  /**
312
- * Call SetImageOption
287
+ * Define an option. An alternative to {Info#define}.
288
+ * Use this method to set options for reading or writing certain image formats.
313
289
  *
314
- * Ruby usage:
315
- * - @verbatim Info[format, key]= @endverbatim
316
- * - @verbatim Info[key]= @endverbatim
290
+ * - Essentially the same function as {Info#define} but paired with {Info#[]}
291
+ * - If the value is nil it is equivalent to {Info#undefine}.
317
292
  *
318
- * Notes:
319
- * - Essentially the same function as Info_define but paired with Info_aref
320
- * - If the value is nil it is equivalent to Info_undefine.
321
- * - The 2 argument form is the original form. Added support for a single
322
- * argument after ImageMagick started using Set/GetImageOption for options
323
- * that aren't represented by fields in the ImageInfo structure.
324
- *
325
- * @param argc number of input arguments
326
- * @param argv array of input arguments
327
- * @param self this object
328
- * @return self
329
- * @see Info_aref
330
- * @see Info_define
331
- * @see Info_undefine
293
+ * @overload []=(format, key)
294
+ * @param format [String] An image format name such as "ps" or "tiff".
295
+ * @param key [String] A string that identifies the option.
296
+ *
297
+ * @overload []=(key)
298
+ * @param key [String] A string that identifies the option.
299
+ *
300
+ * @return [Magick::Image::Info] self
301
+ * @see #[]
302
+ * @see #define
303
+ * @see #undefine
332
304
  */
333
305
  VALUE
334
306
  Info_aset(int argc, VALUE *argv, VALUE self)
@@ -338,8 +310,6 @@ Info_aset(int argc, VALUE *argv, VALUE self)
338
310
  char *format_p, *key_p, *value_p = NULL;
339
311
  long format_l, key_l;
340
312
  char ckey[MaxTextExtent];
341
- unsigned int okay;
342
-
343
313
 
344
314
  Data_Get_Struct(self, Info, info);
345
315
 
@@ -354,14 +324,13 @@ Info_aset(int argc, VALUE *argv, VALUE self)
354
324
  rb_raise(rb_eArgError, "%.60s:%.1024s not defined - too long", format_p, key_p);
355
325
  }
356
326
 
357
- (void) snprintf(ckey, sizeof(ckey), "%.60s:%.*s", format_p, (int)(sizeof(ckey)-MAX_FORMAT_LEN), key_p);
327
+ snprintf(ckey, sizeof(ckey), "%.60s:%.*s", format_p, (int)(sizeof(ckey)-MAX_FORMAT_LEN), key_p);
358
328
 
359
329
  value = argv[2];
360
330
  break;
361
331
 
362
332
  case 2:
363
- strncpy(ckey, StringValuePtr(argv[0]), sizeof(ckey)-1);
364
- ckey[sizeof(ckey)-1] = '\0';
333
+ strlcpy(ckey, StringValueCStr(argv[0]), sizeof(ckey));
365
334
 
366
335
  value = argv[1];
367
336
  break;
@@ -373,13 +342,15 @@ Info_aset(int argc, VALUE *argv, VALUE self)
373
342
 
374
343
  if (NIL_P(value))
375
344
  {
376
- (void) DeleteImageOption(info, ckey);
345
+ DeleteImageOption(info, ckey);
377
346
  }
378
347
  else
379
348
  {
349
+ unsigned int okay;
350
+
380
351
  /* Allow any argument that supports to_s */
381
- value = rm_to_s(value);
382
- value_p = StringValuePtr(value);
352
+ value = rb_String(value);
353
+ value_p = StringValueCStr(value);
383
354
 
384
355
  okay = SetImageOption(info, ckey, value_p);
385
356
  if (!okay)
@@ -396,13 +367,9 @@ Info_aset(int argc, VALUE *argv, VALUE self)
396
367
 
397
368
 
398
369
  /**
399
- * Get the attenuate attribute.
370
+ * Get the attenuate value.
400
371
  *
401
- * Ruby usage:
402
- * - @verbatim Info#attenuate @endverbatim
403
- *
404
- * @param self this object
405
- * @return the attenuate
372
+ * @return [Float] the attenuate
406
373
  */
407
374
  VALUE
408
375
  Info_attenuate(VALUE self)
@@ -412,14 +379,10 @@ Info_attenuate(VALUE self)
412
379
 
413
380
 
414
381
  /**
415
- * Set the attenuate attribute.
382
+ * Set the attenuate value.
416
383
  *
417
- * Ruby usage:
418
- * - @verbatim Info#attenuate= @endverbatim
419
- *
420
- * @param self this object
421
- * @param value the attenuate
422
- * @return self
384
+ * @param value [Float] the attenuate
385
+ * @return [Float] the attenuate
423
386
  */
424
387
  VALUE
425
388
  Info_attenuate_eq(VALUE self, VALUE value)
@@ -429,13 +392,9 @@ Info_attenuate_eq(VALUE self, VALUE value)
429
392
 
430
393
 
431
394
  /**
432
- * Get the authenticate attribute.
433
- *
434
- * Ruby usage:
435
- * - @verbatim Info#authenticate @endverbatim
395
+ * Get the authenticate value.
436
396
  *
437
- * @param self this object
438
- * @return the authenticate
397
+ * @return [String] the authenticate
439
398
  */
440
399
  VALUE
441
400
  Info_authenticate(VALUE self)
@@ -443,19 +402,19 @@ Info_authenticate(VALUE self)
443
402
  Info *info;
444
403
 
445
404
  Data_Get_Struct(self, Info, info);
405
+ #if defined(IMAGEMAGICK_7)
406
+ return C_str_to_R_str(GetImageOption(info, "authenticate"));
407
+ #else
446
408
  return C_str_to_R_str(info->authenticate);
409
+ #endif
447
410
  }
448
411
 
449
412
 
450
413
  /**
451
- * Set the authenticate attribute.
452
- *
453
- * Ruby usage:
454
- * - @verbatim Info#authenticate= @endverbatim
414
+ * Set the authenticate value.
455
415
  *
456
- * @param self this object
457
- * @param passwd_arg the authenticating password
458
- * @return passwd_arg
416
+ * @param passwd_arg [String] the authenticating password
417
+ * @return [String] the given value
459
418
  */
460
419
  VALUE
461
420
  Info_authenticate_eq(VALUE self, VALUE passwd_arg)
@@ -467,9 +426,19 @@ Info_authenticate_eq(VALUE self, VALUE passwd_arg)
467
426
 
468
427
  if (!NIL_P(passwd_arg))
469
428
  {
470
- passwd = StringValuePtr(passwd_arg);
429
+ passwd = StringValueCStr(passwd_arg);
471
430
  }
472
431
 
432
+ #if defined(IMAGEMAGICK_7)
433
+ if (passwd)
434
+ {
435
+ SetImageOption(info, "authenticate", passwd);
436
+ }
437
+ else
438
+ {
439
+ RemoveImageOption(info, "authenticate");
440
+ }
441
+ #else
473
442
  if (info->authenticate)
474
443
  {
475
444
  magick_free(info->authenticate);
@@ -479,6 +448,7 @@ Info_authenticate_eq(VALUE self, VALUE passwd_arg)
479
448
  {
480
449
  magick_clone_string(&info->authenticate, passwd);
481
450
  }
451
+ #endif
482
452
 
483
453
  return passwd_arg;
484
454
  }
@@ -487,12 +457,8 @@ Info_authenticate_eq(VALUE self, VALUE passwd_arg)
487
457
  /**
488
458
  * Return the name of the background color as a String
489
459
  *
490
- * Ruby usage:
491
- * - @verbatim Info#background_color @endverbatim
492
- *
493
- * @param self this object
494
- * @return the name of the background color
495
- * @see Image_background_color
460
+ * @return [String] the name of the background color
461
+ * @see Image#background_color
496
462
  */
497
463
  VALUE
498
464
  Info_background_color(VALUE self)
@@ -507,38 +473,25 @@ Info_background_color(VALUE self)
507
473
  /**
508
474
  * Set the background color.
509
475
  *
510
- * Ruby usage:
511
- * - @verbatim Info#background_color= @endverbatim
512
- *
513
- * Notes:
514
- * - Color should be a string
515
- *
516
- * @param self this object
517
- * @param bc_arg the background color
518
- * @return bc_arg
519
- * @throw ArgumentError
476
+ * @param bc_arg [Magick::Pixel, String] the background color
477
+ * @return [Magick::Pixel, String] the given color
520
478
  */
521
479
  VALUE
522
480
  Info_background_color_eq(VALUE self, VALUE bc_arg)
523
481
  {
524
482
  Info *info;
525
- //char colorname[MaxTextExtent];
526
483
 
527
484
  Data_Get_Struct(self, Info, info);
528
485
  Color_to_PixelColor(&info->background_color, bc_arg);
529
- //SetImageOption(info, "background", pixel_packet_to_hexname(&info->background_color, colorname));
486
+
530
487
  return bc_arg;
531
488
  }
532
489
 
533
490
  /**
534
491
  * Return the name of the border color as a String.
535
492
  *
536
- * Ruby usage:
537
- * - @verbatim Info#border_color @endverbatim
538
- *
539
- * @param self this object
540
- * @return the border color
541
- * @see Image_border_color
493
+ * @return [String] the border color name
494
+ * @see Image#border_color
542
495
  */
543
496
  VALUE
544
497
  Info_border_color(VALUE self)
@@ -552,39 +505,26 @@ Info_border_color(VALUE self)
552
505
  /**
553
506
  * set the border color
554
507
  *
555
- * Ruby usage:
556
- * - @verbatim Info#border_color= @endverbatim
557
- *
558
- * Notes:
559
- * - Color should be a string
560
- *
561
- * @param self this object
562
- * @param bc_arg the border color
563
- * @return bc_arg
564
- * @throw ArgumentError
508
+ * @param bc_arg [Magick::Pixel, String] the border color
509
+ * @return [Magick::Pixel, String] the given color
565
510
  */
566
511
  VALUE
567
512
  Info_border_color_eq(VALUE self, VALUE bc_arg)
568
513
  {
569
514
  Info *info;
570
- //char colorname[MaxTextExtent];
571
515
 
572
516
  Data_Get_Struct(self, Info, info);
573
517
  Color_to_PixelColor(&info->border_color, bc_arg);
574
- //SetImageOption(info, "bordercolor", pixel_packet_to_hexname(&info->border_color, colorname));
518
+
575
519
  return bc_arg;
576
520
  }
577
521
 
578
522
 
579
523
 
580
524
  /**
581
- * Emulate the -caption option.
525
+ * Get a caption of image
582
526
  *
583
- * Ruby usage:
584
- * - @verbatim Info#caption @endverbatim
585
- *
586
- * @param self this object
587
- * @return the caption
527
+ * @return [String] the caption
588
528
  */
589
529
  VALUE
590
530
  Info_caption(VALUE self)
@@ -595,14 +535,10 @@ Info_caption(VALUE self)
595
535
 
596
536
 
597
537
  /**
598
- * Emulate the -caption option.
599
- *
600
- * Ruby usage:
601
- * - @verbatim Info#caption= @endverbatim
538
+ * Assigns a caption to an image.
602
539
  *
603
- * @param self this object
604
- * @param caption the caption
605
- * @return self
540
+ * @param caption [String] the caption
541
+ * @return [String] the given value
606
542
  */
607
543
  VALUE
608
544
  Info_caption_eq(VALUE self, VALUE caption)
@@ -614,19 +550,13 @@ Info_caption_eq(VALUE self, VALUE caption)
614
550
  /**
615
551
  * Set the channels
616
552
  *
617
- * Ruby usage:
618
- * - @verbatim Info#channel @endverbatim
619
- * - @verbatim Info#channel(channel) @endverbatim
620
- * - @verbatim Info#channel(channel, ...) @endverbatim
553
+ * @overload channel(channel = Magick::AllChannels)
554
+ * @param channel [Magick::ChannelType] the channel
621
555
  *
622
- * Notes:
623
- * - Default channel is AllChannels
624
- * - Thanks to Douglas Sellers.
556
+ * @overload channel(*channels)
557
+ * @param channels [Magick::ChannelType] the multiple arguments of channel
625
558
  *
626
- * @param argc number of input arguments
627
- * @param argv array of input arguments
628
- * @param self this object
629
- * @return self
559
+ * @return [Magick::Image::Info] self
630
560
  */
631
561
  VALUE
632
562
  Info_channel(int argc, VALUE *argv, VALUE self)
@@ -652,11 +582,7 @@ Info_channel(int argc, VALUE *argv, VALUE self)
652
582
  /**
653
583
  * Get the colorspace type.
654
584
  *
655
- * Ruby usage:
656
- * - @verbatim Info#colorspace @endverbatim
657
- *
658
- * @param self this object
659
- * @return the colorspace type
585
+ * @return [Magick::ColorspaceType] the colorspace type
660
586
  */
661
587
  VALUE
662
588
  Info_colorspace(VALUE self)
@@ -670,13 +596,8 @@ Info_colorspace(VALUE self)
670
596
  /**
671
597
  * Set the colorspace type
672
598
  *
673
- * Ruby usage:
674
- * - @verbatim Info#colorspace= @endverbatim
675
- *
676
- * @param self this object
677
- * @param colorspace the colorspace type
678
- * @return colorspace
679
- * @throw ArgumentError
599
+ * @param colorspace [Magick::ColorspaceType] the colorspace type
600
+ * @return [Magick::ColorspaceType] the given colorspace
680
601
  */
681
602
  VALUE
682
603
  Info_colorspace_eq(VALUE self, VALUE colorspace)
@@ -688,16 +609,31 @@ Info_colorspace_eq(VALUE self, VALUE colorspace)
688
609
  return colorspace;
689
610
  }
690
611
 
691
- OPTION_ATTR_ACCESSOR(comment, Comment)
612
+ /**
613
+ * Get the comment.
614
+ *
615
+ * @return [String] the comment
616
+ */
617
+ VALUE Info_comment(VALUE self)
618
+ {
619
+ return get_option(self, "Comment");
620
+ }
621
+
622
+ /**
623
+ * Set the comment
624
+ *
625
+ * @param string [String] the comment
626
+ * @return [String] the given comment
627
+ */
628
+ VALUE Info_comment_eq(VALUE self, VALUE string)
629
+ {
630
+ return set_option(self, "Comment", string);
631
+ }
692
632
 
693
633
  /**
694
634
  * Get the compression type.
695
635
  *
696
- * Ruby usage:
697
- * - @verbatim Info#compression @endverbatim
698
- *
699
- * @param self this object
700
- * @return the compression type
636
+ * @return [Magick::CompressionType] the compression type
701
637
  */
702
638
  VALUE
703
639
  Info_compression(VALUE self)
@@ -711,13 +647,8 @@ Info_compression(VALUE self)
711
647
  /**
712
648
  * Set the compression type
713
649
  *
714
- * Ruby usage:
715
- * - @verbatim Info#compression= @endverbatim
716
- *
717
- * @param self this object
718
- * @param type the compression type
719
- * @return type
720
- * @throw ArgumentError
650
+ * @param type [Magick::CompressionType] the compression type
651
+ * @return [Magick::CompressionType] the given type
721
652
  */
722
653
  VALUE
723
654
  Info_compression_eq(VALUE self, VALUE type)
@@ -730,20 +661,14 @@ Info_compression_eq(VALUE self, VALUE type)
730
661
  }
731
662
 
732
663
  /**
733
- * Call SetImageOption
664
+ * Define an option.
734
665
  *
735
- * Ruby usage:
736
- * - @verbatim Info#define(format, key) @endverbatim
737
- * - @verbatim Info#define(format, key, value) @endverbatim
666
+ * @overload Info#define(format, key, value = "")
667
+ * @param format [String] An image format name such as "ps" or "tiff".
668
+ * @param key [String] A string that identifies the option.
669
+ * @param value [String] A value of option
738
670
  *
739
- * Notes:
740
- * - Default value is the empty string
741
- * - This is the only method in Info that is not an attribute accessor.
742
- *
743
- * @param argc number of input arguments
744
- * @param argv array of input arguments
745
- * @param self this object
746
- * @return self
671
+ * @return [Magick::Image::Info] self
747
672
  */
748
673
  VALUE
749
674
  Info_define(int argc, VALUE *argv, VALUE self)
@@ -763,7 +688,7 @@ Info_define(int argc, VALUE *argv, VALUE self)
763
688
  case 3:
764
689
  /* Allow any argument that supports to_s */
765
690
  fmt_arg = rb_String(argv[2]);
766
- value = (const char *)StringValuePtr(fmt_arg);
691
+ value = (const char *)StringValueCStr(fmt_arg);
767
692
  case 2:
768
693
  key = rm_str2cstr(argv[1], &key_l);
769
694
  format = rm_str2cstr(argv[0], &format_l);
@@ -776,9 +701,9 @@ Info_define(int argc, VALUE *argv, VALUE self)
776
701
  {
777
702
  rb_raise(rb_eArgError, "%.20s:%.20s not defined - format or key too long", format, key);
778
703
  }
779
- (void) sprintf(ckey, "%s:%s", format, key);
704
+ snprintf(ckey, sizeof(ckey), "%s:%s", format, key);
780
705
 
781
- (void) DeleteImageOption(info, ckey);
706
+ DeleteImageOption(info, ckey);
782
707
  okay = SetImageOption(info, ckey, value);
783
708
  if (!okay)
784
709
  {
@@ -792,16 +717,9 @@ Info_define(int argc, VALUE *argv, VALUE self)
792
717
  }
793
718
 
794
719
  /**
795
- * Get the delay attribute.
796
- *
797
- * Ruby usage:
798
- * - @verbatim Info#delay @endverbatim
799
- *
800
- * Notes:
801
- * - Convert from string to numeric
720
+ * Get the delay value.
802
721
  *
803
- * @param self this object
804
- * @return the delay
722
+ * @return [Numeric, nil] the delay
805
723
  */
806
724
  VALUE
807
725
  Info_delay(VALUE self)
@@ -809,13 +727,14 @@ Info_delay(VALUE self)
809
727
  Info *info;
810
728
  const char *delay;
811
729
  char *p;
812
- long d;
813
730
 
814
731
  Data_Get_Struct(self, Info, info);
815
732
 
816
733
  delay = GetImageOption(info, "delay");
817
734
  if (delay)
818
735
  {
736
+ long d;
737
+
819
738
  d = strtol(delay, &p, 10);
820
739
  if (*p != '\0')
821
740
  {
@@ -841,71 +760,58 @@ arg_is_integer(VALUE arg)
841
760
  }
842
761
 
843
762
  /**
844
- * Set the delay attribute.
845
- *
846
- * Ruby usage:
847
- * - @verbatim Info#delay= @endverbatim
763
+ * Set the delay value.
848
764
  *
849
- * Notes:
850
- * - Convert from numeric value to string.
851
- *
852
- * @param self this object
853
- * @param string the delay
854
- * @return string
765
+ * @param string [String] the delay
766
+ * @return [String] the given value
855
767
  */
856
768
  VALUE
857
769
  Info_delay_eq(VALUE self, VALUE string)
858
770
  {
859
771
  Info *info;
860
- int delay;
861
772
  int not_num;
862
- char dstr[20];
863
773
 
864
774
  Data_Get_Struct(self, Info, info);
865
775
 
866
776
  if (NIL_P(string))
867
777
  {
868
- (void) DeleteImageOption(info, "delay");
778
+ DeleteImageOption(info, "delay");
869
779
  }
870
780
  else
871
781
  {
782
+ char dstr[20];
783
+ int delay;
784
+
872
785
  not_num = 0;
873
- (void) rb_protect(arg_is_integer, string, &not_num);
786
+ rb_protect(arg_is_integer, string, &not_num);
874
787
  if (not_num)
875
788
  {
876
789
  rb_raise(rb_eTypeError, "failed to convert %s into Integer", rb_class2name(CLASS_OF(string)));
877
790
  }
878
791
  delay = NUM2INT(string);
879
- sprintf(dstr, "%d", delay);
880
- (void) SetImageOption(info, "delay", dstr);
792
+ snprintf(dstr, sizeof(dstr), "%d", delay);
793
+ SetImageOption(info, "delay", dstr);
881
794
  }
882
795
  return string;
883
796
  }
884
797
 
885
798
  /**
886
- * Get the density attribute
887
- *
888
- * Ruby usage:
889
- * - @verbatim Info#density @endverbatim
799
+ * Get the density value
890
800
  *
891
- * @param self this object
892
- * @return the density
801
+ * @return [String] the density
893
802
  */
894
- DEF_ATTR_READER(Info, density, str)
803
+ VALUE
804
+ Info_density(VALUE self)
805
+ {
806
+ IMPLEMENT_ATTR_READER(Info, density, str);
807
+ }
895
808
 
896
809
  /**
897
- * Set the text rendering density
898
- *
899
- * Ruby usage:
900
- * - @verbatim Info#density= @endverbatim
901
- *
902
- * Notes:
903
- * - density should be a string, e.g., "72x72"
810
+ * Set the text rendering density geometry
904
811
  *
905
- * @param self this object
906
- * @param density_arg the density
907
- * @return density_arg
908
- * @throw ArgumentError
812
+ * @param density_arg [String] the density
813
+ * @return [String] the given value
814
+ * @see https://www.imagemagick.org/Magick++/Geometry.html
909
815
  */
910
816
  VALUE
911
817
  Info_density_eq(VALUE self, VALUE density_arg)
@@ -923,8 +829,8 @@ Info_density_eq(VALUE self, VALUE density_arg)
923
829
  return self;
924
830
  }
925
831
 
926
- density = rm_to_s(density_arg);
927
- dens = StringValuePtr(density);
832
+ density = rb_String(density_arg);
833
+ dens = StringValueCStr(density);
928
834
  if (!IsGeometry(dens))
929
835
  {
930
836
  rb_raise(rb_eArgError, "invalid density geometry: %s", dens);
@@ -938,26 +844,21 @@ Info_density_eq(VALUE self, VALUE density_arg)
938
844
  }
939
845
 
940
846
  /**
941
- * Get the depth attribute
942
- *
943
- * Ruby usage:
944
- * - @verbatim Info#depth @endverbatim
847
+ * Get the depth value
945
848
  *
946
- * @param self this object
947
- * @return the depth
849
+ * @return [Numeric] the depth
948
850
  */
949
- DEF_ATTR_READER(Info, depth, int)
851
+ VALUE
852
+ Info_depth(VALUE self)
853
+ {
854
+ IMPLEMENT_ATTR_READER(Info, depth, int);
855
+ }
950
856
 
951
857
  /**
952
- * Set the depth (8, 16, 32).
953
- *
954
- * Ruby usage:
955
- * - @verbatim Info#depth= @endverbatim
858
+ * Set the depth (8, 16, 32, 64).
956
859
  *
957
- * @param self this object
958
- * @param depth the depth
959
- * @return depth
960
- * @throw ArgumentError
860
+ * @param depth [Numeric] the depth
861
+ * @return [Numeric] the given depth
961
862
  */
962
863
  VALUE
963
864
  Info_depth_eq(VALUE self, VALUE depth)
@@ -1040,17 +941,12 @@ DisposeType rm_dispose_to_enum(const char *name)
1040
941
  * Retrieve the dispose option string and convert it to a DisposeType
1041
942
  * enumerator.
1042
943
  *
1043
- * Ruby usage:
1044
- * - @verbatim Info#dispose @endverbatim
1045
- *
1046
- * @param self this object
1047
- * @return a DisposeType enumerator
944
+ * @return [Magick::DisposeType] a DisposeType enumerator
1048
945
  */
1049
946
  VALUE
1050
947
  Info_dispose(VALUE self)
1051
948
  {
1052
949
  Info *info;
1053
- int x;
1054
950
  ID dispose_id;
1055
951
  const char *dispose;
1056
952
 
@@ -1059,10 +955,10 @@ Info_dispose(VALUE self)
1059
955
  dispose_id = rb_intern("UndefinedDispose");
1060
956
 
1061
957
  // Map the dispose option string to a DisposeType enumerator.
1062
- dispose=GetImageOption(info, "dispose");
958
+ dispose = GetImageOption(info, "dispose");
1063
959
  if (dispose)
1064
960
  {
1065
- for (x = 0; x < N_DISPOSE_OPTIONS; x++)
961
+ for (int x = 0; x < N_DISPOSE_OPTIONS; x++)
1066
962
  {
1067
963
  if (strcmp(dispose, Dispose_Option[x].string) == 0)
1068
964
  {
@@ -1078,12 +974,8 @@ Info_dispose(VALUE self)
1078
974
  /**
1079
975
  * Convert a DisposeType enumerator into the equivalent dispose option string.
1080
976
  *
1081
- * Ruby usage:
1082
- * - @verbatim Info#dispose= @endverbatim
1083
- *
1084
- * @param self this object
1085
- * @param disp the DisposeType enumerator
1086
- * @return disp
977
+ * @param disp [Magic::DisposeType] the DisposeType enumerator
978
+ * @return [Magic::DisposeType] the given value
1087
979
  */
1088
980
  VALUE
1089
981
  Info_dispose_eq(VALUE self, VALUE disp)
@@ -1097,7 +989,7 @@ Info_dispose_eq(VALUE self, VALUE disp)
1097
989
 
1098
990
  if (NIL_P(disp))
1099
991
  {
1100
- (void) DeleteImageOption(info, "dispose");
992
+ DeleteImageOption(info, "dispose");
1101
993
  return self;
1102
994
  }
1103
995
 
@@ -1113,21 +1005,38 @@ Info_dispose_eq(VALUE self, VALUE disp)
1113
1005
  }
1114
1006
  }
1115
1007
 
1116
- (void) SetImageOption(info, "dispose", option);
1008
+ SetImageOption(info, "dispose", option);
1117
1009
  return disp;
1118
1010
  }
1119
1011
 
1120
- DEF_ATTR_ACCESSOR(Info, dither, bool)
1121
-
1012
+ /**
1013
+ * Get dither value
1014
+ *
1015
+ * @return [Boolean] true if dither is enabled
1016
+ */
1017
+ VALUE
1018
+ Info_dither(VALUE self)
1019
+ {
1020
+ IMPLEMENT_ATTR_READER(Info, dither, boolean);
1021
+ }
1122
1022
 
1123
1023
  /**
1124
- * Get the endian attribute.
1024
+ * Set dither value
1125
1025
  *
1126
- * Ruby usage:
1127
- * - @verbatim Info#endian @endverbatim
1026
+ * @param val [Boolean] true if dither will be enabled
1027
+ * @return [Boolean] true if dither is enabled
1028
+ */
1029
+ VALUE
1030
+ Info_dither_eq(VALUE self, VALUE val)
1031
+ {
1032
+ IMPLEMENT_ATTR_WRITER(Info, dither, boolean);
1033
+ }
1034
+
1035
+
1036
+ /**
1037
+ * Get the endian value.
1128
1038
  *
1129
- * @param self this object
1130
- * @return the endian (Magick::MSBEndian or Magick::LSBEndian)
1039
+ * @return [Magick::EndianType] the endian
1131
1040
  */
1132
1041
  VALUE
1133
1042
  Info_endian(VALUE self)
@@ -1140,14 +1049,10 @@ Info_endian(VALUE self)
1140
1049
 
1141
1050
 
1142
1051
  /**
1143
- * Set the endian attribute.
1052
+ * Set the endian value.
1144
1053
  *
1145
- * Ruby usage:
1146
- * - @verbatim Info#endian= @endverbatim
1147
- *
1148
- * @param self this object
1149
- * @param endian the endian (Magick::MSBEndian or Magick::LSBEndian)
1150
- * @return endian
1054
+ * @param endian [Magick::EndianType] the endian
1055
+ * @return [Magick::EndianType] the given endian
1151
1056
  */
1152
1057
  VALUE
1153
1058
  Info_endian_eq(VALUE self, VALUE endian)
@@ -1167,32 +1072,23 @@ Info_endian_eq(VALUE self, VALUE endian)
1167
1072
 
1168
1073
 
1169
1074
  /**
1170
- * Get the extract string, e.g. "200x200+100+100"
1075
+ * Get the extract geometry, e.g. "200x200+100+100"
1171
1076
  *
1172
- * Ruby usage:
1173
- * - @verbatim Info#extract @endverbatim
1174
- *
1175
- * Notes:
1176
- * - Defined for ImageMagick 5.5.6 and later
1177
- *
1178
- * @param self this object
1179
- * @return the extract string
1077
+ * @return [String] the extract string
1078
+ * @see https://www.imagemagick.org/Magick++/Geometry.html
1180
1079
  */
1181
- DEF_ATTR_READER(Info, extract, str)
1080
+ VALUE
1081
+ Info_extract(VALUE self)
1082
+ {
1083
+ IMPLEMENT_ATTR_READER(Info, extract, str);
1084
+ }
1182
1085
 
1183
1086
  /**
1184
- * Set the extract string, e.g. "200x200+100+100"
1087
+ * Set the extract geometry.
1185
1088
  *
1186
- * Ruby usage:
1187
- * - @verbatim Info#extract= @endverbatim
1188
- *
1189
- * Notes:
1190
- * - Defined for ImageMagick 5.5.6 and later
1191
- *
1192
- * @param self this object
1193
- * @param extract_arg the extract string
1194
- * @return extract_arg
1195
- * @throw ArgumentError
1089
+ * @param extract_arg [String] the extract string
1090
+ * @return [String] the given value
1091
+ * @see https://www.imagemagick.org/Magick++/Geometry.html
1196
1092
  */
1197
1093
  VALUE
1198
1094
  Info_extract_eq(VALUE self, VALUE extract_arg)
@@ -1210,8 +1106,8 @@ Info_extract_eq(VALUE self, VALUE extract_arg)
1210
1106
  return self;
1211
1107
  }
1212
1108
 
1213
- extract = rm_to_s(extract_arg);
1214
- extr = StringValuePtr(extract);
1109
+ extract = rb_String(extract_arg);
1110
+ extr = StringValueCStr(extract);
1215
1111
  if (!IsGeometry(extr))
1216
1112
  {
1217
1113
  rb_raise(rb_eArgError, "invalid extract geometry: %s", extr);
@@ -1226,17 +1122,11 @@ Info_extract_eq(VALUE self, VALUE extract_arg)
1226
1122
 
1227
1123
 
1228
1124
  /**
1229
- * Get the "filename".
1230
- *
1231
- * Ruby usage:
1232
- * - @verbatim Info#filename @endverbatim
1125
+ * Get the "filename" value.
1233
1126
  *
1234
- * Notes:
1235
- * - Only used for Image_capture
1236
- *
1237
- * @param self this object
1238
- * @return the filename ("" if filename not set)
1239
- * @see Image_capture
1127
+ * @return [String] the file name ("" if filename not set)
1128
+ * @note Only used for Image#capture
1129
+ * @see Image#capture
1240
1130
  */
1241
1131
  VALUE
1242
1132
  Info_filename(VALUE self)
@@ -1248,37 +1138,32 @@ Info_filename(VALUE self)
1248
1138
  }
1249
1139
 
1250
1140
  /**
1251
- * Set the "filename".
1252
- *
1253
- * Ruby usage:
1254
- * - @verbatim Info#filename= @endverbatim
1255
- *
1256
- * Notes:
1257
- * - Only used for Image_capture
1141
+ * Set the "filename" value.
1258
1142
  *
1259
- * @param self this object
1260
- * @param filename the filename
1261
- * @return filename
1262
- * @see Image_capture
1143
+ * @param filename [String] the file name
1144
+ * @return [String] the given file name
1145
+ * @note Only used for Image#capture
1146
+ * @see Image#capture
1263
1147
  */
1264
1148
  VALUE
1265
1149
  Info_filename_eq(VALUE self, VALUE filename)
1266
1150
  {
1267
1151
  Info *info;
1268
- char *fname;
1269
1152
 
1270
1153
  Data_Get_Struct(self, Info, info);
1271
1154
 
1272
1155
  // Allow "nil" - remove current filename
1273
- if (NIL_P(filename) || StringValuePtr(filename) == NULL)
1156
+ if (NIL_P(filename) || StringValueCStr(filename) == NULL)
1274
1157
  {
1275
1158
  info->filename[0] = '\0';
1276
1159
  }
1277
1160
  else
1278
1161
  {
1162
+ char *fname;
1163
+
1279
1164
  // Otherwise copy in filename
1280
- fname = StringValuePtr(filename);
1281
- strncpy(info->filename, fname, MaxTextExtent);
1165
+ fname = StringValueCStr(filename);
1166
+ strlcpy(info->filename, fname, sizeof(info->filename));
1282
1167
  }
1283
1168
  return filename;
1284
1169
  }
@@ -1287,11 +1172,7 @@ Info_filename_eq(VALUE self, VALUE filename)
1287
1172
  /**
1288
1173
  * Return the fill color as a String.
1289
1174
  *
1290
- * Ruby usage:
1291
- * - @verbatim Info#fill @endverbatim
1292
- *
1293
- * @param self this object
1294
- * @return the fill color
1175
+ * @return [String] the fill color
1295
1176
  */
1296
1177
  VALUE
1297
1178
  Info_fill(VALUE self)
@@ -1302,13 +1183,8 @@ Info_fill(VALUE self)
1302
1183
  /**
1303
1184
  * Set the fill color
1304
1185
  *
1305
- * Ruby usage:
1306
- * - @verbatim Info#fill= @endverbatim
1307
- *
1308
- * @param self this object
1309
- * @param color the fill color (as a String)
1310
- * @return self
1311
- * @throw ArgumentError
1186
+ * @param color [String] the fill color
1187
+ * @return [String] the given value
1312
1188
  */
1313
1189
  VALUE
1314
1190
  Info_fill_eq(VALUE self, VALUE color)
@@ -1320,39 +1196,36 @@ Info_fill_eq(VALUE self, VALUE color)
1320
1196
  /**
1321
1197
  * Get the text font.
1322
1198
  *
1323
- * Ruby usage:
1324
- * - @verbatim Info#font @endverbatim
1325
- *
1326
- * @param self this object
1327
- * @return the font
1199
+ * @return [String] the font
1328
1200
  */
1329
- DEF_ATTR_READER(Info, font, str)
1201
+ VALUE
1202
+ Info_font(VALUE self)
1203
+ {
1204
+ IMPLEMENT_ATTR_READER(Info, font, str);
1205
+ }
1330
1206
 
1331
1207
  /**
1332
1208
  * Set the text font.
1333
1209
  *
1334
- * Ruby usage:
1335
- * - @verbatim Info#font= @endverbatim
1336
- *
1337
- * @param self this object
1338
- * @param font_arg the font (as a String)
1339
- * @return font_arg
1210
+ * @param font_arg [String] the font
1211
+ * @return [String] the given font
1340
1212
  */
1341
1213
  VALUE
1342
1214
  Info_font_eq(VALUE self, VALUE font_arg)
1343
1215
  {
1344
1216
  Info *info;
1345
- char *font;
1346
1217
 
1347
1218
  Data_Get_Struct(self, Info, info);
1348
- if (NIL_P(font_arg) || StringValuePtr(font_arg) == NULL)
1219
+ if (NIL_P(font_arg) || StringValueCStr(font_arg) == NULL)
1349
1220
  {
1350
1221
  magick_free(info->font);
1351
1222
  info->font = NULL;
1352
1223
  }
1353
1224
  else
1354
1225
  {
1355
- font = StringValuePtr(font_arg);
1226
+ char *font;
1227
+
1228
+ font = StringValueCStr(font_arg);
1356
1229
  magick_clone_string(&info->font, font);
1357
1230
  }
1358
1231
  return font_arg;
@@ -1361,24 +1234,21 @@ Info_font_eq(VALUE self, VALUE font_arg)
1361
1234
  /**
1362
1235
  * Return the image encoding format.
1363
1236
  *
1364
- * Ruby usage:
1365
- * - @verbatim Info#format @endverbatim
1366
- *
1367
- * @param self this object
1368
- * @return the encoding format
1237
+ * @return [String, nil] the encoding format
1369
1238
  */
1370
1239
  VALUE Info_format(VALUE self)
1371
1240
  {
1372
1241
  Info *info;
1373
- const MagickInfo *magick_info ;
1374
- ExceptionInfo *exception;
1375
1242
 
1376
1243
  Data_Get_Struct(self, Info, info);
1377
1244
  if (*info->magick)
1378
1245
  {
1246
+ const MagickInfo *magick_info;
1247
+ ExceptionInfo *exception;
1248
+
1379
1249
  exception = AcquireExceptionInfo();
1380
1250
  magick_info = GetMagickInfo(info->magick, exception);
1381
- (void) DestroyExceptionInfo(exception);
1251
+ DestroyExceptionInfo(exception);
1382
1252
 
1383
1253
  return magick_info ? rb_str_new2(magick_info->name) : Qnil;
1384
1254
  }
@@ -1389,12 +1259,8 @@ VALUE Info_format(VALUE self)
1389
1259
  /**
1390
1260
  * Set the image encoding format.
1391
1261
  *
1392
- * Ruby usage:
1393
- * - @verbatim Info#format= @endverbatim
1394
- *
1395
- * @param self this object
1396
- * @param magick the encoding format
1397
- * @return magick
1262
+ * @param magick [String] the encoding format
1263
+ * @return [String] the given format
1398
1264
  */
1399
1265
  VALUE
1400
1266
  Info_format_eq(VALUE self, VALUE magick)
@@ -1406,47 +1272,44 @@ Info_format_eq(VALUE self, VALUE magick)
1406
1272
 
1407
1273
  Data_Get_Struct(self, Info, info);
1408
1274
 
1409
- mgk = StringValuePtr(magick);
1275
+ mgk = StringValueCStr(magick);
1410
1276
 
1411
1277
  exception = AcquireExceptionInfo();
1412
1278
  m = GetMagickInfo(mgk, exception);
1413
- CHECK_EXCEPTION()
1414
- (void) DestroyExceptionInfo(exception);
1279
+ CHECK_EXCEPTION();
1280
+ DestroyExceptionInfo(exception);
1415
1281
 
1416
1282
  if (!m)
1417
1283
  {
1418
1284
  rb_raise(rb_eArgError, "unknown format: %s", mgk);
1419
1285
  }
1420
1286
 
1421
- strncpy(info->magick, m->name, MaxTextExtent-1);
1287
+ strlcpy(info->magick, m->name, sizeof(info->magick));
1422
1288
  return magick;
1423
1289
  }
1424
1290
 
1425
1291
  /**
1426
1292
  * Get the fuzz.
1427
1293
  *
1428
- * Ruby usage:
1429
- * - @verbatim Info#fuzz @endverbatim
1430
- *
1431
- * @param self this object
1432
- * @return the fuzz
1433
- * @see Image_fuzz
1294
+ * @return [Float] the fuzz
1295
+ * @see Image#fuzz
1434
1296
  */
1435
- DEF_ATTR_READER(Info, fuzz, dbl)
1297
+ VALUE
1298
+ Info_fuzz(VALUE self)
1299
+ {
1300
+ IMPLEMENT_ATTR_READER(Info, fuzz, dbl);
1301
+ }
1436
1302
 
1437
1303
  /**
1438
1304
  * Set the fuzz.
1439
1305
  *
1440
- * Ruby usage:
1441
- * - @verbatim Info#fuzz=number @endverbatim
1442
- * - @verbatim Info#fuzz=NN% @endverbatim
1443
- *
1444
- * @param self this object
1445
- * @param fuzz the fuzz
1446
- * @return fuzz
1447
- * @see Image_fuzz_eq
1306
+ * @param fuzz [Float, String] the fuzz with Float or
1307
+ * percent format "xx%" with String
1308
+ * @return [Float, String] the given value
1309
+ * @see Image#fuzz=
1448
1310
  */
1449
- VALUE Info_fuzz_eq(VALUE self, VALUE fuzz)
1311
+ VALUE
1312
+ Info_fuzz_eq(VALUE self, VALUE fuzz)
1450
1313
  {
1451
1314
  Info *info;
1452
1315
 
@@ -1473,8 +1336,7 @@ static struct
1473
1336
  { "SouthEast", "SouthEastGravity", SouthEastGravity},
1474
1337
  { "South", "SouthGravity", SouthGravity},
1475
1338
  { "SouthWest", "SouthWestGravity", SouthWestGravity},
1476
- { "West", "WestGravity", WestGravity},
1477
- { "Static", "StaticGravity", StaticGravity}
1339
+ { "West", "WestGravity", WestGravity}
1478
1340
  };
1479
1341
 
1480
1342
  /** Number of gravity options */
@@ -1510,17 +1372,12 @@ GravityType rm_gravity_to_enum(const char *name)
1510
1372
  /**
1511
1373
  * Return the value of the gravity option as a GravityType enumerator.
1512
1374
  *
1513
- * Ruby usage:
1514
- * - @verbatim Info#gravity @endverbatim
1515
- *
1516
- * @param self this object
1517
- * @return the gravity enumerator
1375
+ * @return [Magick::GravityType] the gravity enumerator
1518
1376
  */
1519
1377
  VALUE Info_gravity(VALUE self)
1520
1378
  {
1521
1379
  Info *info;
1522
1380
  const char *gravity;
1523
- int x;
1524
1381
  ID gravity_id;
1525
1382
 
1526
1383
  Data_Get_Struct(self, Info, info);
@@ -1528,10 +1385,10 @@ VALUE Info_gravity(VALUE self)
1528
1385
  gravity_id = rb_intern("UndefinedGravity");
1529
1386
 
1530
1387
  // Map the gravity option string to a GravityType enumerator.
1531
- gravity=GetImageOption(info, "gravity");
1388
+ gravity = GetImageOption(info, "gravity");
1532
1389
  if (gravity)
1533
1390
  {
1534
- for (x = 0; x < N_GRAVITY_OPTIONS; x++)
1391
+ for (int x = 0; x < N_GRAVITY_OPTIONS; x++)
1535
1392
  {
1536
1393
  if (strcmp(gravity, Gravity_Option[x].string) == 0)
1537
1394
  {
@@ -1548,12 +1405,8 @@ VALUE Info_gravity(VALUE self)
1548
1405
  * Convert a GravityType enum to a gravity option name and store in the Info
1549
1406
  * structure.
1550
1407
  *
1551
- * Ruby usage:
1552
- * - @verbatim Info#gravity= @endverbatim
1553
- *
1554
- * @param self this object
1555
- * @param grav the gravity enumerator
1556
- * @return grav
1408
+ * @param grav [Magick::GravityType] the gravity enumerator
1409
+ * @return [Magick::GravityType] the given gravity
1557
1410
  */
1558
1411
  VALUE
1559
1412
  Info_gravity_eq(VALUE self, VALUE grav)
@@ -1567,7 +1420,7 @@ Info_gravity_eq(VALUE self, VALUE grav)
1567
1420
 
1568
1421
  if (NIL_P(grav))
1569
1422
  {
1570
- (void) DeleteImageOption(info, "gravity");
1423
+ DeleteImageOption(info, "gravity");
1571
1424
  return self;
1572
1425
  }
1573
1426
 
@@ -1583,66 +1436,15 @@ Info_gravity_eq(VALUE self, VALUE grav)
1583
1436
  }
1584
1437
  }
1585
1438
 
1586
- (void) SetImageOption(info, "gravity", option);
1439
+ SetImageOption(info, "gravity", option);
1587
1440
  return grav;
1588
1441
  }
1589
1442
 
1590
1443
 
1591
- /**
1592
- * Get the group attribute.
1593
- *
1594
- * Ruby usage:
1595
- * - @verbatim Info#group @endverbatim
1596
- *
1597
- * @param self this object
1598
- * @return the group
1599
- * @deprecated This method has been deprecated.
1600
- */
1601
- VALUE
1602
- Info_group(VALUE self)
1603
- {
1604
- Info *info;
1605
-
1606
- rb_warning("Info#group is deprecated");
1607
- (void) rm_check_destroyed(self);
1608
- Data_Get_Struct(self, Info, info);
1609
- return C_long_to_R_long(info->group);
1610
- }
1611
-
1612
-
1613
- /**
1614
- * Set the group attribute.
1615
- *
1616
- * Ruby usage:
1617
- * - @verbatim Info#group= @endverbatim
1618
- *
1619
- * @param self this object
1620
- * @param value the group
1621
- * @return value
1622
- * @deprecated This method has been deprecated.
1623
- */
1624
- VALUE
1625
- Info_group_eq(VALUE self, VALUE value)
1626
- {
1627
- Info *info;
1628
-
1629
- rb_warning("Info#group= is deprecated");
1630
- (void) rm_check_destroyed(self);
1631
- rb_check_frozen(self);
1632
- Data_Get_Struct(self, Info, info);
1633
- info->group = R_long_to_C_long(value);
1634
- return value;
1635
- }
1636
-
1637
-
1638
1444
  /**
1639
1445
  * Get the classification type.
1640
1446
  *
1641
- * Ruby usage:
1642
- * - @verbatim Info#image_type @endverbatim
1643
- *
1644
- * @param self this object
1645
- * @return the classification type
1447
+ * @return [Magick::ImageType] the classification type
1646
1448
  */
1647
1449
  VALUE
1648
1450
  Info_image_type(VALUE self)
@@ -1656,13 +1458,8 @@ Info_image_type(VALUE self)
1656
1458
  /**
1657
1459
  * Set the classification type.
1658
1460
  *
1659
- * Ruby usage:
1660
- * - @verbatim Info#image_type= @endverbatim
1661
- *
1662
- * @param self this object
1663
- * @param type the classification type
1664
- * @return type
1665
- * @throw ArgumentError
1461
+ * @param type [Magick::ImageType] the classification type
1462
+ * @return [Magick::ImageType] the given type
1666
1463
  */
1667
1464
  VALUE
1668
1465
  Info_image_type_eq(VALUE self, VALUE type)
@@ -1677,11 +1474,7 @@ Info_image_type_eq(VALUE self, VALUE type)
1677
1474
  /**
1678
1475
  * Get the interlace type.
1679
1476
  *
1680
- * Ruby usage:
1681
- * - @verbatim Info#interlace @endverbatim
1682
- *
1683
- * @param self this object
1684
- * @return the interlace type
1477
+ * @return [Magick::InterlaceType] the interlace type
1685
1478
  */
1686
1479
  VALUE
1687
1480
  Info_interlace(VALUE self)
@@ -1695,13 +1488,8 @@ Info_interlace(VALUE self)
1695
1488
  /**
1696
1489
  * Set the interlace type
1697
1490
  *
1698
- * Ruby usage:
1699
- * - @verbatim Info#interlace= @endverbatim
1700
- *
1701
- * @param self this object
1702
- * @param inter the interlace type
1703
- * @return inter
1704
- * @throw ArgumentError
1491
+ * @param inter [Magick::InterlaceType] the interlace type
1492
+ * @return [Magick::InterlaceType] the given interlace
1705
1493
  */
1706
1494
  VALUE
1707
1495
  Info_interlace_eq(VALUE self, VALUE inter)
@@ -1713,17 +1501,32 @@ Info_interlace_eq(VALUE self, VALUE inter)
1713
1501
  return inter;
1714
1502
  }
1715
1503
 
1716
- OPTION_ATTR_ACCESSOR(label, Label)
1504
+ /**
1505
+ * Get the label.
1506
+ *
1507
+ * @return [String] the label
1508
+ */
1509
+ VALUE Info_label(VALUE self)
1510
+ {
1511
+ return get_option(self, "Label");
1512
+ }
1513
+
1514
+ /**
1515
+ * Set the label.
1516
+ *
1517
+ * @param string [String] the label
1518
+ * @return [String] the given label
1519
+ */
1520
+ VALUE Info_label_eq(VALUE self, VALUE string)
1521
+ {
1522
+ return set_option(self, "Label", string);
1523
+ }
1717
1524
 
1718
1525
  /**
1719
1526
  * Return the name of the matte color as a String.
1720
1527
  *
1721
- * Ruby usage:
1722
- * - @verbatim Info#matte_color @endverbatim
1723
- *
1724
- * @param self this object
1725
- * @return the name of the matte color
1726
- * @see Image_matte_color
1528
+ * @return [String] the name of the matte color
1529
+ * @see Image#matte_color
1727
1530
  */
1728
1531
  VALUE
1729
1532
  Info_matte_color(VALUE self)
@@ -1737,36 +1540,27 @@ Info_matte_color(VALUE self)
1737
1540
  /**
1738
1541
  * Set the matte color.
1739
1542
  *
1740
- * Ruby usage:
1741
- * - @verbatim Info#matte_color= @endverbatim
1742
- *
1743
- * @param self this object
1744
- * @param matte_arg the name of the matte as a String
1745
- * @return matte_arg
1746
- * @throw ArgumentError
1543
+ * @param matte_arg [Magick::Pixel, String] the name of the matte as a String
1544
+ * @return [Magick::Pixel, String] the given value
1747
1545
  */
1748
1546
  VALUE
1749
1547
  Info_matte_color_eq(VALUE self, VALUE matte_arg)
1750
1548
  {
1751
1549
  Info *info;
1752
- //char colorname[MaxTextExtent];
1753
1550
 
1754
1551
  Data_Get_Struct(self, Info, info);
1755
1552
  Color_to_PixelColor(&info->matte_color, matte_arg);
1756
- //SetImageOption(info, "mattecolor", pixel_packet_to_hexname(&info->matte_color, colorname));
1553
+
1757
1554
  return matte_arg;
1758
1555
  }
1759
1556
 
1760
1557
  /**
1761
1558
  * Establish a progress monitor.
1762
1559
  *
1763
- * Ruby usage:
1764
- * - @verbatim Info#monitor= @endverbatim
1765
- *
1766
- * @param self this object
1767
- * @param monitor the monitor
1768
- * @return monitor
1769
- * @see Image_monitor_eq
1560
+ * @param monitor [Proc] the monitor
1561
+ * @return [Proc] monitor
1562
+ * @see Image#monitor=
1563
+ * @deprecated Magick::Image::Info#monitor= is deprecated. This method will be removed in RMagick 5.0.
1770
1564
  */
1771
1565
  VALUE
1772
1566
  Info_monitor_eq(VALUE self, VALUE monitor)
@@ -1775,33 +1569,70 @@ Info_monitor_eq(VALUE self, VALUE monitor)
1775
1569
 
1776
1570
  Data_Get_Struct(self, Info, info);
1777
1571
 
1572
+ rb_warning("Magick::Image::Info#monitor= is deprecated. This method will be removed in RMagick 5.0.");
1573
+
1778
1574
  if (NIL_P(monitor))
1779
1575
  {
1780
1576
  info->progress_monitor = NULL;
1781
1577
  }
1782
1578
  else
1783
1579
  {
1784
- (void) SetImageInfoProgressMonitor(info, rm_progress_monitor, (void *)monitor);
1580
+ SetImageInfoProgressMonitor(info, rm_progress_monitor, (void *)monitor);
1785
1581
  }
1786
1582
 
1787
1583
  return monitor;
1788
1584
  }
1789
1585
 
1586
+ /**
1587
+ * Get the monochrome value.
1588
+ *
1589
+ * @return [Boolean] true or false
1590
+ */
1591
+ VALUE
1592
+ Info_monochrome(VALUE self)
1593
+ {
1594
+ IMPLEMENT_ATTR_READER(Info, monochrome, boolean);
1595
+ }
1790
1596
 
1597
+ /**
1598
+ * Set the monochrome value.
1599
+ *
1600
+ * @param val [Boolean] true or false
1601
+ * @return [Boolean] the given value
1602
+ */
1603
+ VALUE
1604
+ Info_monochrome_eq(VALUE self, VALUE val)
1605
+ {
1606
+ IMPLEMENT_ATTR_WRITER(Info, monochrome, boolean);
1607
+ }
1791
1608
 
1609
+ /**
1610
+ * Get the scene number of an image or the first image in a sequence.
1611
+ *
1612
+ * @return [Numeric] the scene number
1613
+ */
1614
+ VALUE
1615
+ Info_number_scenes(VALUE self)
1616
+ {
1617
+ IMPLEMENT_ATTR_READER(Info, number_scenes, ulong);
1618
+ }
1792
1619
 
1793
- DEF_ATTR_ACCESSOR(Info, monochrome, bool)
1794
-
1795
- DEF_ATTR_ACCESSOR(Info, number_scenes, ulong)
1620
+ /**
1621
+ * Set the scene number of an image or the first image in a sequence.
1622
+ *
1623
+ * @param val [Numeric] the scene number
1624
+ * @return [Numeric] the given value
1625
+ */
1626
+ VALUE
1627
+ Info_number_scenes_eq(VALUE self, VALUE val)
1628
+ {
1629
+ IMPLEMENT_ATTR_WRITER(Info, number_scenes, ulong);
1630
+ }
1796
1631
 
1797
1632
  /**
1798
1633
  * Return the orientation attribute as an OrientationType enum value.
1799
1634
  *
1800
- * Ruby usage:
1801
- * - @verbatim Info#orientation @endverbatim
1802
- *
1803
- * @param self this object
1804
- * @return the orientation
1635
+ * @return [Magick::OrientationType] the orientation
1805
1636
  */
1806
1637
  VALUE
1807
1638
  Info_orientation(VALUE self)
@@ -1816,13 +1647,8 @@ Info_orientation(VALUE self)
1816
1647
  /**
1817
1648
  * Set the Orientation type.
1818
1649
  *
1819
- * Ruby usage:
1820
- * - @verbatim Info#Orientation= @endverbatim
1821
- *
1822
- * @param self this object
1823
- * @param inter the orientation type as an OrientationType enum value
1824
- * @return inter
1825
- * @throw ArgumentError
1650
+ * @param inter [Magick::OrientationType] the orientation type as an OrientationType enum value
1651
+ * @return [Magick::OrientationType] the given value
1826
1652
  */
1827
1653
  VALUE
1828
1654
  Info_orientation_eq(VALUE self, VALUE inter)
@@ -1838,11 +1664,8 @@ Info_orientation_eq(VALUE self, VALUE inter)
1838
1664
  /**
1839
1665
  * Return origin geometry.
1840
1666
  *
1841
- * Ruby usage:
1842
- * - @verbatim Info#origin @endverbatim
1843
- *
1844
- * @param self this object
1845
- * @return the origin geometry
1667
+ * @return [String] the origin geometry
1668
+ * @see https://www.imagemagick.org/Magick++/Geometry.html
1846
1669
  */
1847
1670
  VALUE
1848
1671
  Info_origin(VALUE self)
@@ -1861,12 +1684,12 @@ Info_origin(VALUE self)
1861
1684
  * Set origin geometry. Argument may be a Geometry object as well as a geometry
1862
1685
  * string.
1863
1686
  *
1864
- * Ruby usage:
1865
- * - @verbatim Info#origin=+-x+-y @endverbatim
1687
+ * The geometry format is
1688
+ * +-x+-y
1866
1689
  *
1867
- * @param self this object
1868
- * @param origin_arg the origin geometry
1869
- * @return origin_arg
1690
+ * @param origin_arg [String] the origin geometry
1691
+ * @return [String] the given value
1692
+ * @see https://www.imagemagick.org/Magick++/Geometry.html
1870
1693
  */
1871
1694
  VALUE
1872
1695
  Info_origin_eq(VALUE self, VALUE origin_arg)
@@ -1879,12 +1702,12 @@ Info_origin_eq(VALUE self, VALUE origin_arg)
1879
1702
 
1880
1703
  if (NIL_P(origin_arg))
1881
1704
  {
1882
- (void) DeleteImageOption(info, "origin");
1705
+ DeleteImageOption(info, "origin");
1883
1706
  return self;
1884
1707
  }
1885
1708
 
1886
- origin_str = rm_to_s(origin_arg);
1887
- origin = GetPageGeometry(StringValuePtr(origin_str));
1709
+ origin_str = rb_String(origin_arg);
1710
+ origin = GetPageGeometry(StringValueCStr(origin_str));
1888
1711
 
1889
1712
  if (IsGeometry(origin) == MagickFalse)
1890
1713
  {
@@ -1892,7 +1715,7 @@ Info_origin_eq(VALUE self, VALUE origin_arg)
1892
1715
  rb_raise(rb_eArgError, "invalid origin geometry");
1893
1716
  }
1894
1717
 
1895
- (void) SetImageOption(info, "origin", origin);
1718
+ SetImageOption(info, "origin", origin);
1896
1719
  magick_free(origin);
1897
1720
 
1898
1721
  RB_GC_GUARD(origin_str);
@@ -1904,11 +1727,7 @@ Info_origin_eq(VALUE self, VALUE origin_arg)
1904
1727
  /**
1905
1728
  * Get the Postscript page geometry.
1906
1729
  *
1907
- * Ruby usage:
1908
- * - @verbatim Info_page @endverbatim
1909
- *
1910
- * @param self this object
1911
- * @return the page geometry
1730
+ * @return [String] the page geometry
1912
1731
  */
1913
1732
  VALUE
1914
1733
  Info_page(VALUE self)
@@ -1924,12 +1743,9 @@ Info_page(VALUE self)
1924
1743
  * Store the Postscript page geometry. Argument may be a Geometry object as well
1925
1744
  * as a geometry string.
1926
1745
  *
1927
- * Ruby usage:
1928
- * - @verbatim Info#page= @endverbatim
1929
- *
1930
- * @param self this object
1931
- * @param page_arg the geometry
1932
- * @return page_arg
1746
+ * @param page_arg [String] the geometry
1747
+ * @return [String] the given value
1748
+ * @see https://www.imagemagick.org/Magick++/Geometry.html
1933
1749
  */
1934
1750
  VALUE
1935
1751
  Info_page_eq(VALUE self, VALUE page_arg)
@@ -1945,8 +1761,8 @@ Info_page_eq(VALUE self, VALUE page_arg)
1945
1761
  info->page = NULL;
1946
1762
  return self;
1947
1763
  }
1948
- geom_str = rm_to_s(page_arg);
1949
- geometry=GetPageGeometry(StringValuePtr(geom_str));
1764
+ geom_str = rb_String(page_arg);
1765
+ geometry = GetPageGeometry(StringValueCStr(geom_str));
1950
1766
  if (*geometry == '\0')
1951
1767
  {
1952
1768
  magick_free(info->page);
@@ -1960,17 +1776,56 @@ Info_page_eq(VALUE self, VALUE page_arg)
1960
1776
  return page_arg;
1961
1777
  }
1962
1778
 
1963
- DEF_ATTR_ACCESSOR(Info, pointsize, dbl)
1964
- DEF_ATTR_ACCESSOR(Info, quality, ulong)
1779
+ /**
1780
+ * Get the point size.
1781
+ *
1782
+ * @return [Float] the point size
1783
+ */
1784
+ VALUE
1785
+ Info_pointsize(VALUE self)
1786
+ {
1787
+ IMPLEMENT_ATTR_READER(Info, pointsize, dbl);
1788
+ }
1965
1789
 
1966
1790
  /**
1967
- * Get sampling factors used by JPEG or MPEG-2 encoder and YUV decoder/encoder.
1791
+ * Set the point size.
1792
+ *
1793
+ * @param val [Float] the point size
1794
+ * @return [Float] the given value
1795
+ */
1796
+ VALUE
1797
+ Info_pointsize_eq(VALUE self, VALUE val)
1798
+ {
1799
+ IMPLEMENT_ATTR_WRITER(Info, pointsize, dbl);
1800
+ }
1801
+
1802
+ /**
1803
+ * Get the compression level for JPEG, etc.
1968
1804
  *
1969
- * Ruby usage:
1970
- * - @verbatim Info#sampling_factor @endverbatim
1805
+ * @return [Numeric] the compression level
1806
+ */
1807
+ VALUE
1808
+ Info_quality(VALUE self)
1809
+ {
1810
+ IMPLEMENT_ATTR_READER(Info, quality, ulong);
1811
+ }
1812
+
1813
+ /**
1814
+ * Get the compression level for JPEG, etc.
1971
1815
  *
1972
- * @param self this object
1973
- * @return the sampling factors
1816
+ * @param val [Numeric] the compression level
1817
+ * @return [Numeric] the given value
1818
+ */
1819
+ VALUE
1820
+ Info_quality_eq(VALUE self, VALUE val)
1821
+ {
1822
+ IMPLEMENT_ATTR_WRITER(Info, quality, ulong);
1823
+ }
1824
+
1825
+ /**
1826
+ * Get sampling factors used by JPEG or MPEG-2 encoder and YUV decoder/encoder.
1827
+ *
1828
+ * @return [String, nil] the sampling factors
1974
1829
  */
1975
1830
  VALUE
1976
1831
  Info_sampling_factor(VALUE self)
@@ -1991,12 +1846,8 @@ Info_sampling_factor(VALUE self)
1991
1846
  /**
1992
1847
  * Set sampling factors used by JPEG or MPEG-2 encoder and YUV decoder/encoder.
1993
1848
  *
1994
- * Ruby usage:
1995
- * - @verbatim Info#sampling_factor= @endverbatim
1996
- *
1997
- * @param self this object
1998
- * @param sampling_factor the sampling factors
1999
- * @return sampling_factor
1849
+ * @param sampling_factor [String] the sampling factors
1850
+ * @return [String] the given value
2000
1851
  */
2001
1852
  VALUE
2002
1853
  Info_sampling_factor_eq(VALUE self, VALUE sampling_factor)
@@ -2029,11 +1880,7 @@ Info_sampling_factor_eq(VALUE self, VALUE sampling_factor)
2029
1880
  /**
2030
1881
  * Get the scene number.
2031
1882
  *
2032
- * Ruby usage:
2033
- * - @verbatim Info#scene @endverbatim
2034
- *
2035
- * @param self this object
2036
- * @return the scene number
1883
+ * @return [Numeric] the scene number
2037
1884
  */
2038
1885
  VALUE
2039
1886
  Info_scene(VALUE self)
@@ -2048,12 +1895,8 @@ Info_scene(VALUE self)
2048
1895
  /**
2049
1896
  * Set the scene number.
2050
1897
  *
2051
- * Ruby usage:
2052
- * - @verbatim Info#scene= @endverbatim
2053
- *
2054
- * @param self this object
2055
- * @param scene the scene number
2056
- * @return scene
1898
+ * @param scene [Numeric] the scene number
1899
+ * @return [Numeric] the given value
2057
1900
  */
2058
1901
  VALUE
2059
1902
  Info_scene_eq(VALUE self, VALUE scene)
@@ -2064,8 +1907,8 @@ Info_scene_eq(VALUE self, VALUE scene)
2064
1907
  Data_Get_Struct(self, Info, info);
2065
1908
  info->scene = NUM2ULONG(scene);
2066
1909
 
2067
- (void) snprintf(buf, sizeof(buf), "%-ld", info->scene);
2068
- (void) SetImageOption(info, "scene", buf);
1910
+ snprintf(buf, sizeof(buf), "%"RMIuSIZE"", info->scene);
1911
+ SetImageOption(info, "scene", buf);
2069
1912
 
2070
1913
  return scene;
2071
1914
  }
@@ -2074,40 +1917,37 @@ Info_scene_eq(VALUE self, VALUE scene)
2074
1917
  /**
2075
1918
  * Get the server name.
2076
1919
  *
2077
- * Ruby usage:
2078
- * - @verbatim Info#server_name @endverbatim
2079
- *
2080
- * @param self this object
2081
- * @return the server name
1920
+ * @return [String] the server name
2082
1921
  */
2083
- DEF_ATTR_READER(Info, server_name, str)
1922
+ VALUE
1923
+ Info_server_name(VALUE self)
1924
+ {
1925
+ IMPLEMENT_ATTR_READER(Info, server_name, str);
1926
+ }
2084
1927
 
2085
1928
 
2086
1929
  /**
2087
1930
  * Set the server name.
2088
1931
  *
2089
- * Ruby usage:
2090
- * - @verbatim Info#server_name= @endverbatim
2091
- *
2092
- * @param self this object
2093
- * @param server_arg the server name as a String
2094
- * @return server_arg
1932
+ * @param server_arg [String] the server name
1933
+ * @return [String] the given value
2095
1934
  */
2096
1935
  VALUE
2097
1936
  Info_server_name_eq(VALUE self, VALUE server_arg)
2098
1937
  {
2099
1938
  Info *info;
2100
- char *server;
2101
1939
 
2102
1940
  Data_Get_Struct(self, Info, info);
2103
- if (NIL_P(server_arg) || StringValuePtr(server_arg) == NULL)
1941
+ if (NIL_P(server_arg) || StringValueCStr(server_arg) == NULL)
2104
1942
  {
2105
1943
  magick_free(info->server_name);
2106
1944
  info->server_name = NULL;
2107
1945
  }
2108
1946
  else
2109
1947
  {
2110
- server = StringValuePtr(server_arg);
1948
+ char *server;
1949
+
1950
+ server = StringValueCStr(server_arg);
2111
1951
  magick_clone_string(&info->server_name, server);
2112
1952
  }
2113
1953
  return server_arg;
@@ -2116,25 +1956,21 @@ Info_server_name_eq(VALUE self, VALUE server_arg)
2116
1956
  /**
2117
1957
  * Get ths size
2118
1958
  *
2119
- * Ruby usage:
2120
- * - @verbatim Info#size @endverbatim
2121
- *
2122
- * @param self this object
2123
- * @return the size as a Geometry object
1959
+ * @return [String] the size as a Geometry object
1960
+ * @see https://www.imagemagick.org/Magick++/Geometry.html
2124
1961
  */
2125
- DEF_ATTR_READER(Info, size, str)
1962
+ VALUE
1963
+ Info_size(VALUE self)
1964
+ {
1965
+ IMPLEMENT_ATTR_READER(Info, size, str);
1966
+ }
2126
1967
 
2127
1968
  /**
2128
- * Set the size (either as a Geometry object or a Geometry string, i.e.
2129
- * WxH{+-}x{+-}y)
2130
- *
2131
- * Ruby usage:
2132
- * - @verbatim Info#size= @endverbatim
1969
+ * Set the size (either as a Geometry object or a Geometry string
2133
1970
  *
2134
- * @param self this object
2135
- * @param size_arg the size
2136
- * @return size_arg
2137
- * @throw ArgumentError
1971
+ * @param size_arg [String] the size
1972
+ * @return [String] the given value
1973
+ * @see https://www.imagemagick.org/Magick++/Geometry.html
2138
1974
  */
2139
1975
  VALUE
2140
1976
  Info_size_eq(VALUE self, VALUE size_arg)
@@ -2152,8 +1988,8 @@ Info_size_eq(VALUE self, VALUE size_arg)
2152
1988
  return self;
2153
1989
  }
2154
1990
 
2155
- size = rm_to_s(size_arg);
2156
- sz = StringValuePtr(size);
1991
+ size = rb_String(size_arg);
1992
+ sz = StringValueCStr(size);
2157
1993
  if (!IsGeometry(sz))
2158
1994
  {
2159
1995
  rb_raise(rb_eArgError, "invalid size geometry: %s", sz);
@@ -2170,11 +2006,7 @@ Info_size_eq(VALUE self, VALUE size_arg)
2170
2006
  /**
2171
2007
  * Return the stroke color as a String.
2172
2008
  *
2173
- * Ruby usage:
2174
- * - @verbatim Info#stroke @endverbatim
2175
- *
2176
- * @param self this object
2177
- * @return the stroke color
2009
+ * @return [String] the stroke color
2178
2010
  */
2179
2011
  VALUE
2180
2012
  Info_stroke(VALUE self)
@@ -2185,13 +2017,8 @@ Info_stroke(VALUE self)
2185
2017
  /**
2186
2018
  * Set the stroke color
2187
2019
  *
2188
- * Ruby usage:
2189
- * - @verbatim Info#stroke= @endverbatim
2190
- *
2191
- * @param self this object
2192
- * @param color the stroke color as a String
2193
- * @return self
2194
- * @throw ArgumentError
2020
+ * @param color [String] the stroke color
2021
+ * @return [String] the given value
2195
2022
  */
2196
2023
  VALUE
2197
2024
  Info_stroke_eq(VALUE self, VALUE color)
@@ -2201,16 +2028,9 @@ Info_stroke_eq(VALUE self, VALUE color)
2201
2028
 
2202
2029
 
2203
2030
  /**
2204
- * Support for caption: format.
2205
- *
2206
- * Ruby usage:
2207
- * - @verbatim Info#stroke_width @endverbatim
2031
+ * Get stroke width.
2208
2032
  *
2209
- * Notes:
2210
- * - Supported in ImageMagick >= 6.3.2-6
2211
- *
2212
- * @param self this object
2213
- * @return the stroke width
2033
+ * @return [Float] the stroke width
2214
2034
  */
2215
2035
  VALUE
2216
2036
  Info_stroke_width(VALUE self)
@@ -2220,17 +2040,10 @@ Info_stroke_width(VALUE self)
2220
2040
 
2221
2041
 
2222
2042
  /**
2223
- * Support for caption: format.
2043
+ * Set stroke width.
2224
2044
  *
2225
- * Ruby usage:
2226
- * - @verbatim Info#stroke_width= @endverbatim
2227
- *
2228
- * Notes:
2229
- * - Supported in ImageMagick >= 6.3.2-6
2230
- *
2231
- * @param self this object
2232
- * @param stroke_width the stroke width
2233
- * @return self
2045
+ * @param stroke_width [Float] the stroke width
2046
+ * @return [Float] the given value
2234
2047
  */
2235
2048
  VALUE
2236
2049
  Info_stroke_width_eq(VALUE self, VALUE stroke_width)
@@ -2242,12 +2055,8 @@ Info_stroke_width_eq(VALUE self, VALUE stroke_width)
2242
2055
  /**
2243
2056
  * Set name of texture to tile onto the image background.
2244
2057
  *
2245
- * Ruby usage:
2246
- * - @verbatim Image::Info#texture= @endverbatim
2247
- *
2248
- * @param self this object
2249
- * @param texture the name of the texture image
2250
- * @return texture
2058
+ * @param texture [Magick::Image] the texture image
2059
+ * @return [Magick::Image] the given image
2251
2060
  */
2252
2061
  VALUE
2253
2062
  Info_texture_eq(VALUE self, VALUE texture)
@@ -2274,7 +2083,7 @@ Info_texture_eq(VALUE self, VALUE texture)
2274
2083
 
2275
2084
  // Create a temp copy of the texture and store its name in the texture field
2276
2085
  image = rm_check_destroyed(texture);
2277
- rm_write_temp_image(image, name);
2086
+ rm_write_temp_image(image, name, sizeof(name));
2278
2087
 
2279
2088
  magick_clone_string(&info->texture, name);
2280
2089
 
@@ -2283,14 +2092,36 @@ Info_texture_eq(VALUE self, VALUE texture)
2283
2092
 
2284
2093
 
2285
2094
  /**
2286
- * info.tile_offset = [+/-]x[+/-]y.
2095
+ * Return tile_offset geometry.
2287
2096
  *
2288
- * Ruby usage:
2289
- * - @verbatim Image::Info#tile_offset= @endverbatim
2097
+ * @return [String, nil] the tile offset
2098
+ * @see https://www.imagemagick.org/Magick++/Geometry.html
2099
+ */
2100
+ VALUE
2101
+ Info_tile_offset(VALUE self)
2102
+ {
2103
+ Info *info;
2104
+ const char *tile_offset;
2105
+
2106
+ Data_Get_Struct(self, Info, info);
2107
+
2108
+ tile_offset = GetImageOption(info, "tile-offset");
2109
+
2110
+ if (!tile_offset)
2111
+ {
2112
+ return Qnil;
2113
+ }
2114
+
2115
+ return rb_str_new2(tile_offset);
2116
+ }
2117
+
2118
+
2119
+ /**
2120
+ * Set tile offset geometry.
2290
2121
  *
2291
- * @param self this object
2292
- * @param offset the offset
2293
- * @return offset
2122
+ * @param offset [String] the offset geometry
2123
+ * @return [String] the given value
2124
+ * @see https://www.imagemagick.org/Magick++/Geometry.html
2294
2125
  */
2295
2126
  VALUE
2296
2127
  Info_tile_offset_eq(VALUE self, VALUE offset)
@@ -2299,8 +2130,8 @@ Info_tile_offset_eq(VALUE self, VALUE offset)
2299
2130
  VALUE offset_str;
2300
2131
  char *tile_offset;
2301
2132
 
2302
- offset_str = rm_to_s(offset);
2303
- tile_offset = StringValuePtr(offset_str);
2133
+ offset_str = rb_String(offset);
2134
+ tile_offset = StringValueCStr(offset_str);
2304
2135
  if (!IsGeometry(tile_offset))
2305
2136
  {
2306
2137
  rb_raise(rb_eArgError, "invalid tile offset geometry: %s", tile_offset);
@@ -2308,8 +2139,8 @@ Info_tile_offset_eq(VALUE self, VALUE offset)
2308
2139
 
2309
2140
  Data_Get_Struct(self, Info, info);
2310
2141
 
2311
- (void) DeleteImageOption(info, "tile-offset");
2312
- (void) SetImageOption(info, "tile-offset", tile_offset);
2142
+ DeleteImageOption(info, "tile-offset");
2143
+ SetImageOption(info, "tile-offset", tile_offset);
2313
2144
 
2314
2145
  RB_GC_GUARD(offset_str);
2315
2146
 
@@ -2318,14 +2149,10 @@ Info_tile_offset_eq(VALUE self, VALUE offset)
2318
2149
 
2319
2150
 
2320
2151
  /**
2321
- * Return the name of the transparent color as a String.
2322
- *
2323
- * Ruby usage:
2324
- * - @verbatim Info#transparent_color @endverbatim
2152
+ * Return the name of the transparent color.
2325
2153
  *
2326
- * @param self this object
2327
- * @return the name of the transparent color
2328
- * @see Image_transparent_color
2154
+ * @return [String] the name of the transparent color
2155
+ * @see Image#transparent_color
2329
2156
  */
2330
2157
  VALUE
2331
2158
  Info_transparent_color(VALUE self)
@@ -2340,65 +2167,27 @@ Info_transparent_color(VALUE self)
2340
2167
  /**
2341
2168
  * Set the transparent color.
2342
2169
  *
2343
- * Ruby usage:
2344
- * - @verbatim Info#transparent_color= @endverbatim
2345
- *
2346
- * @param self this object
2347
- * @param tc_arg the transparent color as a String
2348
- * @return tc_arg
2349
- * @throw ArgumentError
2170
+ * @param tc_arg [String] the transparent color
2171
+ * @return [Magick::Pixel, String] the given value
2350
2172
  */
2351
2173
  VALUE
2352
2174
  Info_transparent_color_eq(VALUE self, VALUE tc_arg)
2353
2175
  {
2354
2176
  Info *info;
2355
- //char colorname[MaxTextExtent];
2356
2177
 
2357
2178
  Data_Get_Struct(self, Info, info);
2358
2179
  Color_to_PixelColor(&info->transparent_color, tc_arg);
2359
- //SetImageOption(info, "transparent", pixel_packet_to_hexname(&info->transparent_color, colorname));
2360
- return tc_arg;
2361
- }
2362
-
2363
-
2364
- /**
2365
- * Return tile_offset attribute values.
2366
- *
2367
- * Ruby usage:
2368
- * - @verbatim Image::Info#tile_offset @endverbatim
2369
- *
2370
- * @param self this object
2371
- * @return the tile offset
2372
- */
2373
- VALUE
2374
- Info_tile_offset(VALUE self)
2375
- {
2376
- Info *info;
2377
- const char *tile_offset;
2378
2180
 
2379
- Data_Get_Struct(self, Info, info);
2380
-
2381
- tile_offset = GetImageOption(info, "tile-offset");
2382
-
2383
- if (!tile_offset)
2384
- {
2385
- return Qnil;
2386
- }
2387
-
2388
- return rb_str_new2(tile_offset);
2181
+ return tc_arg;
2389
2182
  }
2390
2183
 
2391
2184
 
2392
2185
  /**
2393
2186
  * Undefine image option.
2394
2187
  *
2395
- * Ruby usage:
2396
- * - @verbatim Info#undefine(format,key) @endverbatim
2397
- *
2398
- * @param self this object
2399
- * @param format the format
2400
- * @param key the key
2401
- * @return self
2188
+ * @param format [String] the format
2189
+ * @param key [String] the key
2190
+ * @return [Magick::Info] self
2402
2191
  */
2403
2192
  VALUE
2404
2193
  Info_undefine(VALUE self, VALUE format, VALUE key)
@@ -2419,20 +2208,16 @@ Info_undefine(VALUE self, VALUE format, VALUE key)
2419
2208
  snprintf(fkey, sizeof(fkey), "%.60s:%.*s", format_p, (int)(MaxTextExtent-61), key_p);
2420
2209
 
2421
2210
  Data_Get_Struct(self, Info, info);
2422
- (void) DeleteImageOption(info, fkey);
2211
+ DeleteImageOption(info, fkey);
2423
2212
 
2424
2213
  return self;
2425
2214
  }
2426
2215
 
2427
2216
 
2428
2217
  /**
2429
- * Return the undercolor color as a String.
2218
+ * Return the undercolor color.
2430
2219
  *
2431
- * Ruby usage:
2432
- * - @verbatim Info#undercolor @endverbatim
2433
- *
2434
- * @param self this object
2435
- * @return the undercolor
2220
+ * @return [String] the undercolor
2436
2221
  */
2437
2222
  VALUE
2438
2223
  Info_undercolor(VALUE self)
@@ -2443,13 +2228,8 @@ Info_undercolor(VALUE self)
2443
2228
  /**
2444
2229
  * Set the undercolor color.
2445
2230
  *
2446
- * Ruby usage:
2447
- * - @verbatim Info#undercolor= @endverbatim
2448
- *
2449
- * @param self this object
2450
- * @param color the undercolor color as a String
2451
- * @return self
2452
- * @throw ArgumentError
2231
+ * @param color [String] the undercolor color
2232
+ * @return [String] the given value
2453
2233
  */
2454
2234
  VALUE
2455
2235
  Info_undercolor_eq(VALUE self, VALUE color)
@@ -2460,11 +2240,7 @@ Info_undercolor_eq(VALUE self, VALUE color)
2460
2240
  /**
2461
2241
  * Get the resolution type.
2462
2242
  *
2463
- * Ruby usage:
2464
- * - @verbatim Info#units @endverbatim
2465
- *
2466
- * @param self this object
2467
- * @return the resolution type
2243
+ * @return [Magick::ResolutionType] the resolution type
2468
2244
  */
2469
2245
  VALUE
2470
2246
  Info_units(VALUE self)
@@ -2478,13 +2254,8 @@ Info_units(VALUE self)
2478
2254
  /**
2479
2255
  * Set the resolution type
2480
2256
  *
2481
- * Ruby usage:
2482
- * - @verbatim Info#units= @endverbatim
2483
- *
2484
- * @param self this object
2485
- * @param units the resolution type
2486
- * @return units
2487
- * @throw ArgumentError
2257
+ * @param units [Magick::ResolutionType] the resolution type
2258
+ * @return [Magick::ResolutionType] the given value
2488
2259
  */
2489
2260
  VALUE
2490
2261
  Info_units_eq(VALUE self, VALUE units)
@@ -2499,11 +2270,7 @@ Info_units_eq(VALUE self, VALUE units)
2499
2270
  /**
2500
2271
  * Get FlashPix viewing parameters.
2501
2272
  *
2502
- * Ruby usage:
2503
- * - @verbatim Info#view @endverbatim
2504
- *
2505
- * @param self this object.
2506
- * @return the viewing parameters
2273
+ * @return [String] the viewing parameters
2507
2274
  */
2508
2275
  VALUE
2509
2276
  Info_view(VALUE self)
@@ -2511,18 +2278,18 @@ Info_view(VALUE self)
2511
2278
  Info *info;
2512
2279
 
2513
2280
  Data_Get_Struct(self, Info, info);
2281
+ #if defined(IMAGEMAGICK_7)
2282
+ return C_str_to_R_str(GetImageOption(info, "fpx:view"));
2283
+ #else
2514
2284
  return C_str_to_R_str(info->view);
2285
+ #endif
2515
2286
  }
2516
2287
 
2517
2288
  /**
2518
2289
  * Set FlashPix viewing parameters.
2519
2290
  *
2520
- * Ruby usage:
2521
- * - @verbatim Info#view= @endverbatim
2522
- *
2523
- * @param self this object
2524
- * @param view_arg the viewing parameters
2525
- * @return view_arg
2291
+ * @param view_arg [String] the viewing parameters
2292
+ * @return [String] the given value
2526
2293
  */
2527
2294
  VALUE
2528
2295
  Info_view_eq(VALUE self, VALUE view_arg)
@@ -2534,9 +2301,19 @@ Info_view_eq(VALUE self, VALUE view_arg)
2534
2301
 
2535
2302
  if (!NIL_P(view_arg))
2536
2303
  {
2537
- view = StringValuePtr(view_arg);
2304
+ view = StringValueCStr(view_arg);
2538
2305
  }
2539
2306
 
2307
+ #if defined(IMAGEMAGICK_7)
2308
+ if (view)
2309
+ {
2310
+ SetImageOption(info, "fpx:view", view);
2311
+ }
2312
+ else
2313
+ {
2314
+ RemoveImageOption(info, "fpx:view");
2315
+ }
2316
+ #else
2540
2317
  if (info->view)
2541
2318
  {
2542
2319
  magick_free(info->view);
@@ -2546,12 +2323,13 @@ Info_view_eq(VALUE self, VALUE view_arg)
2546
2323
  {
2547
2324
  magick_clone_string(&info->view, view);
2548
2325
  }
2326
+ #endif
2549
2327
  return view_arg;
2550
2328
  }
2551
2329
 
2552
2330
 
2553
2331
  /**
2554
- * If there is a texture image, delete it before destroying the ImageInfo
2332
+ * If there is a texture image, delete it before destroying the Image::Info
2555
2333
  * structure.
2556
2334
  *
2557
2335
  * No Ruby usage (internal function)
@@ -2570,12 +2348,12 @@ destroy_Info(void *infoptr)
2570
2348
  info->texture = NULL;
2571
2349
  }
2572
2350
 
2573
- (void) DestroyImageInfo(info);
2351
+ DestroyImageInfo(info);
2574
2352
  }
2575
2353
 
2576
2354
 
2577
2355
  /**
2578
- * Create an ImageInfo object.
2356
+ * Create an Image::Info object.
2579
2357
  *
2580
2358
  * No Ruby usage (internal function)
2581
2359
  *
@@ -2627,10 +2405,11 @@ rm_info_new(void)
2627
2405
  /**
2628
2406
  * If an initializer block is present, run it.
2629
2407
  *
2630
- * Ruby usage:
2631
- * - @verbatim Info#initialize @endverbatim
2408
+ * @overload initialize
2409
+ *
2410
+ * @overload initialize
2411
+ * @yield [Magick::Image::Info]
2632
2412
  *
2633
- * @param self this object
2634
2413
  * @return self
2635
2414
  */
2636
2415
  VALUE
@@ -2638,8 +2417,16 @@ Info_initialize(VALUE self)
2638
2417
  {
2639
2418
  if (rb_block_given_p())
2640
2419
  {
2641
- // Run the block in self's context
2642
- (void) rb_obj_instance_eval(0, NULL, self);
2420
+ if (rb_proc_arity(rb_block_proc()) == 0)
2421
+ {
2422
+ // Run the block in self's context
2423
+ rb_warn("passing a block without an image argument is deprecated");
2424
+ rb_obj_instance_eval(0, NULL, self);
2425
+ }
2426
+ else
2427
+ {
2428
+ rb_yield(self);
2429
+ }
2643
2430
  }
2644
2431
  return self;
2645
2432
  }