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
@@ -1,5 +1,5 @@
1
1
  module Magick
2
- VERSION = '3.2.0'
2
+ VERSION = '4.3.0'
3
3
  MIN_RUBY_VERSION = '2.3.0'
4
4
  MIN_IM_VERSION = '6.7.7'
5
5
  end
@@ -19,15 +19,39 @@ if RUBY_PLATFORM =~ /mingw/i
19
19
  end
20
20
 
21
21
  require 'English'
22
+ require 'observer'
22
23
  require 'RMagick2.so'
23
- require 'obsolete.rb'
24
24
 
25
25
  module Magick
26
26
  @formats = nil
27
27
  @trace_proc = nil
28
28
  @exit_block_set_up = nil
29
+ IMAGEMAGICK_VERSION = Magick::Magick_version.split[1].split('-').first
29
30
 
30
31
  class << self
32
+ # Describes the image formats supported by ImageMagick.
33
+ # If the optional block is present, calls the block once for each image format.
34
+ # The first argument, +k+, is the format name. The second argument, +v+, is the
35
+ # properties string described below.
36
+ #
37
+ # - +B+ is "*" if the format has native blob support, or " " otherwise.
38
+ # - +R+ is "r" if ImageMagick can read that format, or "-" otherwise.
39
+ # - +W+ is "w" if ImageMagick can write that format, or "-" otherwise.
40
+ # - +A+ is "+" if the format supports multi-image files, or "-" otherwise.
41
+ #
42
+ # @overload formats
43
+ # @return [Hash] the formats hash
44
+ #
45
+ # @overload formats
46
+ # @yield [k, v]
47
+ # @yieldparam k [String] the format name
48
+ # @yieldparam v [String] the properties string
49
+ # @return [Magick]
50
+ #
51
+ # @example
52
+ # p Magick.formats
53
+ # => {"3FR"=>" r-+", "3G2"=>" r-+", "3GP"=>" r-+", "A"=>"*rw+",
54
+ # ...
31
55
  def formats
32
56
  @formats ||= init_formats
33
57
 
@@ -39,17 +63,37 @@ module Magick
39
63
  end
40
64
  end
41
65
 
42
- # remove reference to the proc at exit
66
+ # If the Magick module attribute +trace_proc+ is set to a Proc object,
67
+ # RMagick calls the proc whenever an image is created or destroyed.
68
+ #
69
+ # You can use this proc to keep track of which images your program has created
70
+ # and which have been destroyed.
71
+ #
72
+ # @param p [Proc] The proc object.
73
+ # The following value will be passed into the proc object.
74
+ # - +which+ - A symbol that indicates which operation the proc is being called for.
75
+ # If the proc is called for an image creation, the value is +:c+.
76
+ # If called for an image destruction, the value is +:d+.
77
+ # - +description+ - A string describing the image. This is the same string that
78
+ # would be returned by calling the image's inspect method.
79
+ # - +id+ - A unique identifier for the image. This identifier is not the same as the object's +object_id+.
80
+ # - +method+ - The name of the method responsible for creating or destroying the image.
81
+ #
82
+ # @example
83
+ # Magick.trace_proc = proc do |which, description, id, method|
84
+ # ...
85
+ # end
86
+ #
87
+ # @deprecated Magick.trace_proc= is deprecated. This method will be removed in RMagick 5.0.
43
88
  def trace_proc=(p)
44
- m = Mutex.new
45
- m.synchronize do
46
- if @trace_proc.nil? && !p.nil? && !@exit_block_set_up
47
- at_exit { @trace_proc = nil }
48
- @exit_block_set_up = true
49
- end
89
+ warn 'Magick.trace_proc= is deprecated. This method will be removed in RMagick 5.0.'
50
90
 
51
- @trace_proc = p
91
+ if @trace_proc.nil? && !p.nil? && !@exit_block_set_up
92
+ at_exit { @trace_proc = nil }
93
+ @exit_block_set_up = true
52
94
  end
95
+
96
+ @trace_proc = p
53
97
  end
54
98
  end
55
99
 
@@ -67,12 +111,14 @@ module Magick
67
111
 
68
112
  class Geometry
69
113
  FLAGS = ['', '%', '!', '<', '>', '@', '^']
70
- RFLAGS = { '%' => PercentGeometry,
71
- '!' => AspectGeometry,
72
- '<' => LessGeometry,
73
- '>' => GreaterGeometry,
74
- '@' => AreaGeometry,
75
- '^' => MinimumGeometry }
114
+ RFLAGS = {
115
+ '%' => PercentGeometry,
116
+ '!' => AspectGeometry,
117
+ '<' => LessGeometry,
118
+ '>' => GreaterGeometry,
119
+ '@' => AreaGeometry,
120
+ '^' => MinimumGeometry
121
+ }
76
122
 
77
123
  attr_accessor :width, :height, :x, :y, :flag
78
124
 
@@ -131,7 +177,7 @@ module Magick
131
177
  str = ''
132
178
  if @width > 0
133
179
  fmt = @width.truncate == @width ? '%d' : '%.2f'
134
- str << format(fmt, @width)
180
+ str << sprintf(fmt, @width)
135
181
  str << '%' if @flag == PercentGeometry
136
182
  end
137
183
 
@@ -139,10 +185,10 @@ module Magick
139
185
 
140
186
  if @height > 0
141
187
  fmt = @height.truncate == @height ? '%d' : '%.2f'
142
- str << format(fmt, @height)
188
+ str << sprintf(fmt, @height)
143
189
  str << '%' if @flag == PercentGeometry
144
190
  end
145
- str << format('%+d%+d', @x, @y) if @x != 0 || @y != 0
191
+ str << sprintf('%+d%+d', @x, @y) if @x != 0 || @y != 0
146
192
  str << FLAGS[@flag.to_i] if @flag != PercentGeometry
147
193
  str
148
194
  end
@@ -233,20 +279,23 @@ module Magick
233
279
  # Apply coordinate transformations to support scaling (s), rotation (r),
234
280
  # and translation (t). Angles are specified in radians.
235
281
  def affine(sx, rx, ry, sy, tx, ty)
236
- primitive 'affine ' + format('%g,%g,%g,%g,%g,%g', sx, rx, ry, sy, tx, ty)
282
+ primitive 'affine ' + sprintf('%g,%g,%g,%g,%g,%g', sx, rx, ry, sy, tx, ty)
237
283
  end
238
284
 
239
285
  # Set alpha (make transparent) in image according to the specified
240
286
  # colorization rule
241
287
  def alpha(x, y, method)
242
288
  Kernel.raise ArgumentError, 'Unknown paint method' unless PAINT_METHOD_NAMES.key?(method.to_i)
243
- primitive 'matte ' + format('%g,%g, %s', x, y, PAINT_METHOD_NAMES[method.to_i])
289
+ name = Gem::Version.new(Magick::IMAGEMAGICK_VERSION) > Gem::Version.new('7.0.0') ? 'alpha ' : 'matte '
290
+ primitive name + sprintf('%g,%g, %s', x, y, PAINT_METHOD_NAMES[method.to_i])
244
291
  end
245
292
 
246
293
  # Draw an arc.
247
294
  def arc(start_x, start_y, end_x, end_y, start_degrees, end_degrees)
248
- primitive 'arc ' + format('%g,%g %g,%g %g,%g',
249
- start_x, start_y, end_x, end_y, start_degrees, end_degrees)
295
+ primitive 'arc ' + sprintf(
296
+ '%g,%g %g,%g %g,%g',
297
+ start_x, start_y, end_x, end_y, start_degrees, end_degrees
298
+ )
250
299
  end
251
300
 
252
301
  # Draw a bezier curve.
@@ -256,12 +305,12 @@ module Magick
256
305
  elsif points.length.odd?
257
306
  Kernel.raise ArgumentError, 'odd number of arguments specified'
258
307
  end
259
- primitive 'bezier ' + points.map! { |x| format('%g', x) }.join(',')
308
+ primitive 'bezier ' + points.map! { |x| sprintf('%g', x) }.join(',')
260
309
  end
261
310
 
262
311
  # Draw a circle
263
312
  def circle(origin_x, origin_y, perim_x, perim_y)
264
- primitive 'circle ' + format('%g,%g %g,%g', origin_x, origin_y, perim_x, perim_y)
313
+ primitive 'circle ' + sprintf('%g,%g %g,%g', origin_x, origin_y, perim_x, perim_y)
265
314
  end
266
315
 
267
316
  # Invoke a clip-path defined by def_clip_path.
@@ -285,7 +334,7 @@ module Magick
285
334
  # point, replace, floodfill, filltoborder,reset
286
335
  def color(x, y, method)
287
336
  Kernel.raise ArgumentError, "Unknown PaintMethod: #{method}" unless PAINT_METHOD_NAMES.key?(method.to_i)
288
- primitive 'color ' + format('%g,%g,%s', x, y, PAINT_METHOD_NAMES[method.to_i])
337
+ primitive 'color ' + sprintf('%g,%g,%s', x, y, PAINT_METHOD_NAMES[method.to_i])
289
338
  end
290
339
 
291
340
  # Specify EITHER the text decoration (none, underline, overline,
@@ -316,8 +365,10 @@ module Magick
316
365
 
317
366
  # Draw an ellipse
318
367
  def ellipse(origin_x, origin_y, width, height, arc_start, arc_end)
319
- primitive 'ellipse ' + format('%g,%g %g,%g %g,%g',
320
- origin_x, origin_y, width, height, arc_start, arc_end)
368
+ primitive 'ellipse ' + sprintf(
369
+ '%g,%g %g,%g %g,%g',
370
+ origin_x, origin_y, width, height, arc_start, arc_end
371
+ )
321
372
  end
322
373
 
323
374
  # Let anything through, but the only defined argument
@@ -383,7 +434,7 @@ module Magick
383
434
  def image(composite, x, y, width, height, image_file_path)
384
435
  Kernel.raise ArgumentError, 'Unknown composite' unless composite.is_a?(CompositeOperator)
385
436
  composite_name = composite.to_s.sub!('CompositeOp', '')
386
- primitive 'image ' + format('%s %g,%g %g,%g %s', composite_name, x, y, width, height, enquote(image_file_path))
437
+ primitive 'image ' + sprintf('%s %g,%g %g,%g %s', composite_name, x, y, width, height, enquote(image_file_path))
387
438
  end
388
439
 
389
440
  # IM 6.5.5-8 and later
@@ -424,15 +475,7 @@ module Magick
424
475
 
425
476
  # Draw a line
426
477
  def line(start_x, start_y, end_x, end_y)
427
- primitive 'line ' + format('%g,%g %g,%g', start_x, start_y, end_x, end_y)
428
- end
429
-
430
- # Set matte (make transparent) in image according to the specified
431
- # colorization rule
432
- def matte(x, y, method)
433
- Kernel.warn 'Draw#matte is deprecated. Use Draw#alpha instead.'
434
- Kernel.raise ArgumentError, 'Unknown paint method' unless PAINT_METHOD_NAMES.key?(method.to_i)
435
- primitive 'matte ' + format('%g,%g, %s', x, y, PAINT_METHOD_NAMES[method.to_i])
478
+ primitive 'line ' + sprintf('%g,%g %g,%g', start_x, start_y, end_x, end_y)
436
479
  end
437
480
 
438
481
  # Specify drawing fill and stroke opacities. If the value is a string
@@ -454,7 +497,7 @@ module Magick
454
497
  # as the argument to the 'fill' or 'stroke' methods
455
498
  def pattern(name, x, y, width, height)
456
499
  push('defs')
457
- push("pattern #{name} " + format('%g %g %g %g', x, y, width, height))
500
+ push("pattern #{name} " + sprintf('%g %g %g %g', x, y, width, height))
458
501
  push('graphic-context')
459
502
  yield
460
503
  ensure
@@ -465,13 +508,13 @@ module Magick
465
508
 
466
509
  # Set point to fill color.
467
510
  def point(x, y)
468
- primitive 'point ' + format('%g,%g', x, y)
511
+ primitive 'point ' + sprintf('%g,%g', x, y)
469
512
  end
470
513
 
471
514
  # Specify the font size in points. Yes, the primitive is "font-size" but
472
515
  # in other places this value is called the "pointsize". Give it both names.
473
516
  def pointsize(points)
474
- primitive 'font-size ' + format('%g', points)
517
+ primitive 'font-size ' + sprintf('%g', points)
475
518
  end
476
519
  alias font_size pointsize
477
520
 
@@ -482,7 +525,7 @@ module Magick
482
525
  elsif points.length.odd?
483
526
  Kernel.raise ArgumentError, 'odd number of points specified'
484
527
  end
485
- primitive 'polygon ' + points.map! { |x| format('%g', x) }.join(',')
528
+ primitive 'polygon ' + points.map! { |x| sprintf('%g', x) }.join(',')
486
529
  end
487
530
 
488
531
  # Draw a polyline
@@ -492,7 +535,7 @@ module Magick
492
535
  elsif points.length.odd?
493
536
  Kernel.raise ArgumentError, 'odd number of points specified'
494
537
  end
495
- primitive 'polyline ' + points.map! { |x| format('%g', x) }.join(',')
538
+ primitive 'polyline ' + points.map! { |x| sprintf('%g', x) }.join(',')
496
539
  end
497
540
 
498
541
  # Return to the previously-saved set of whatever
@@ -526,32 +569,36 @@ module Magick
526
569
 
527
570
  # Draw a rectangle
528
571
  def rectangle(upper_left_x, upper_left_y, lower_right_x, lower_right_y)
529
- primitive 'rectangle ' + format('%g,%g %g,%g',
530
- upper_left_x, upper_left_y, lower_right_x, lower_right_y)
572
+ primitive 'rectangle ' + sprintf(
573
+ '%g,%g %g,%g',
574
+ upper_left_x, upper_left_y, lower_right_x, lower_right_y
575
+ )
531
576
  end
532
577
 
533
578
  # Specify coordinate space rotation. "angle" is measured in degrees
534
579
  def rotate(angle)
535
- primitive 'rotate ' + format('%g', angle)
580
+ primitive 'rotate ' + sprintf('%g', angle)
536
581
  end
537
582
 
538
583
  # Draw a rectangle with rounded corners
539
584
  def roundrectangle(center_x, center_y, width, height, corner_width, corner_height)
540
- primitive 'roundrectangle ' + format('%g,%g,%g,%g,%g,%g',
541
- center_x, center_y, width, height, corner_width, corner_height)
585
+ primitive 'roundrectangle ' + sprintf(
586
+ '%g,%g,%g,%g,%g,%g',
587
+ center_x, center_y, width, height, corner_width, corner_height
588
+ )
542
589
  end
543
590
 
544
591
  # Specify scaling to be applied to coordinate space on subsequent drawing commands.
545
592
  def scale(x, y)
546
- primitive 'scale ' + format('%g,%g', x, y)
593
+ primitive 'scale ' + sprintf('%g,%g', x, y)
547
594
  end
548
595
 
549
596
  def skewx(angle)
550
- primitive 'skewX ' + format('%g', angle)
597
+ primitive 'skewX ' + sprintf('%g', angle)
551
598
  end
552
599
 
553
600
  def skewy(angle)
554
- primitive 'skewY ' + format('%g', angle)
601
+ primitive 'skewY ' + sprintf('%g', angle)
555
602
  end
556
603
 
557
604
  # Specify the object stroke, a color name or pattern name.
@@ -581,7 +628,7 @@ module Magick
581
628
 
582
629
  # Specify the initial offset in the dash pattern
583
630
  def stroke_dashoffset(value = 0)
584
- primitive 'stroke-dashoffset ' + format('%g', value)
631
+ primitive 'stroke-dashoffset ' + sprintf('%g', value)
585
632
  end
586
633
 
587
634
  def stroke_linecap(value)
@@ -608,7 +655,7 @@ module Magick
608
655
 
609
656
  # Specify stroke (outline) width in pixels.
610
657
  def stroke_width(pixels)
611
- primitive 'stroke-width ' + format('%g', pixels)
658
+ primitive 'stroke-width ' + sprintf('%g', pixels)
612
659
  end
613
660
 
614
661
  # Draw text at position x,y. Add quotes to text that is not already quoted.
@@ -626,7 +673,7 @@ module Magick
626
673
  # escape existing braces, surround with braces
627
674
  text = '{' + text.gsub(/[}]/) { |b| '\\' + b } + '}'
628
675
  end
629
- primitive 'text ' + format('%g,%g %s', x, y, text)
676
+ primitive 'text ' + sprintf('%g,%g %s', x, y, text)
630
677
  end
631
678
 
632
679
  # Specify text alignment relative to a given point
@@ -655,7 +702,7 @@ module Magick
655
702
  # Specify center of coordinate space to use for subsequent drawing
656
703
  # commands.
657
704
  def translate(x, y)
658
- primitive 'translate ' + format('%g,%g', x, y)
705
+ primitive 'translate ' + sprintf('%g,%g', x, y)
659
706
  end
660
707
  end # class Magick::Draw
661
708
 
@@ -863,7 +910,7 @@ module Magick
863
910
  else
864
911
  get_exif_by_number # ensure properties is populated with exif data
865
912
  tag.each do |num|
866
- rval = self[format('#%04X', num.to_i)]
913
+ rval = self[sprintf('#%04X', num.to_i)]
867
914
  hash[num] = rval == 'unknown' ? nil : rval
868
915
  end
869
916
  end
@@ -1071,7 +1118,7 @@ module Magick
1071
1118
 
1072
1119
  # Define a getter and a setter for each channel.
1073
1120
  %i[red green blue opacity].each do |c|
1074
- module_eval <<-END_EVAL
1121
+ module_eval <<-END_EVAL, __FILE__, __LINE__ + 1
1075
1122
  def #{c}
1076
1123
  return collect { |p| p.#{c} }
1077
1124
  end
@@ -1127,7 +1174,6 @@ module Magick
1127
1174
  each { |x| @view[x] = rv.dup }
1128
1175
  changed
1129
1176
  notify_observers(self)
1130
- nil
1131
1177
  end
1132
1178
 
1133
1179
  # A pixel has been modified. Tell the view.
@@ -1250,16 +1296,14 @@ module Magick
1250
1296
 
1251
1297
  protected
1252
1298
 
1253
- def is_an_image(obj)
1299
+ def assert_image(obj)
1254
1300
  Kernel.raise ArgumentError, "Magick::Image required (#{obj.class} given)" unless obj.is_a? Magick::Image
1255
- true
1256
1301
  end
1257
1302
 
1258
1303
  # Ensure array is always an array of Magick::Image objects
1259
- def is_an_image_array(ary)
1304
+ def assert_image_array(ary)
1260
1305
  Kernel.raise ArgumentError, "Magick::ImageList or array of Magick::Images required (#{ary.class} given)" unless ary.respond_to? :each
1261
- ary.each { |obj| is_an_image obj }
1262
- true
1306
+ ary.each { |obj| assert_image obj }
1263
1307
  end
1264
1308
 
1265
1309
  # Find old current image, update scene number
@@ -1291,7 +1335,7 @@ module Magick
1291
1335
  if n.nil?
1292
1336
  Kernel.raise IndexError, 'scene number out of bounds' unless @images.length.zero?
1293
1337
  @scene = nil
1294
- return @scene
1338
+ return
1295
1339
  elsif @images.length.zero?
1296
1340
  Kernel.raise IndexError, 'scene number out of bounds'
1297
1341
  end
@@ -1299,13 +1343,12 @@ module Magick
1299
1343
  n = Integer(n)
1300
1344
  Kernel.raise IndexError, 'scene number out of bounds' if n < 0 || n > length - 1
1301
1345
  @scene = n
1302
- @scene
1303
1346
  end
1304
1347
 
1305
1348
  # All the binary operators work the same way.
1306
1349
  # 'other' should be either an ImageList or an Array
1307
1350
  %w[& + - |].each do |op|
1308
- module_eval <<-END_BINOPS
1351
+ module_eval <<-END_BINOPS, __FILE__, __LINE__ + 1
1309
1352
  def #{op}(other)
1310
1353
  ilist = self.class.new
1311
1354
  begin
@@ -1315,7 +1358,7 @@ module Magick
1315
1358
  end
1316
1359
  current = get_current()
1317
1360
  a.each do |image|
1318
- is_an_image image
1361
+ assert_image image
1319
1362
  ilist << image
1320
1363
  end
1321
1364
  ilist.set_current current
@@ -1334,7 +1377,7 @@ module Magick
1334
1377
  end
1335
1378
 
1336
1379
  def <<(obj)
1337
- is_an_image obj
1380
+ assert_image obj
1338
1381
  @images << obj
1339
1382
  @scene = @images.length - 1
1340
1383
  self
@@ -1375,20 +1418,21 @@ module Magick
1375
1418
  def []=(*args)
1376
1419
  obj = @images.[]=(*args)
1377
1420
  if obj && obj.respond_to?(:each)
1378
- is_an_image_array(obj)
1421
+ assert_image_array(obj)
1379
1422
  set_current obj.last.__id__
1380
1423
  elsif obj
1381
- is_an_image(obj)
1424
+ assert_image(obj)
1382
1425
  set_current obj.__id__
1383
1426
  else
1384
1427
  set_current nil
1385
1428
  end
1386
- obj
1387
1429
  end
1388
1430
 
1389
- %i[at each each_index empty? fetch
1390
- first hash include? index length rindex sort!].each do |mth|
1391
- module_eval <<-END_SIMPLE_DELEGATES
1431
+ %i[
1432
+ at each each_index empty? fetch
1433
+ first hash include? index length rindex sort!
1434
+ ].each do |mth|
1435
+ module_eval <<-END_SIMPLE_DELEGATES, __FILE__, __LINE__ + 1
1392
1436
  def #{mth}(*args, &block)
1393
1437
  @images.#{mth}(*args, &block)
1394
1438
  end
@@ -1410,7 +1454,7 @@ module Magick
1410
1454
  # override Enumerable#collect
1411
1455
  def collect(&block)
1412
1456
  current = get_current
1413
- a = @images.collect(&block)
1457
+ a = @images.map(&block)
1414
1458
  ilist = self.class.new
1415
1459
  a.each { |image| ilist << image }
1416
1460
  ilist.set_current current
@@ -1418,8 +1462,8 @@ module Magick
1418
1462
  end
1419
1463
 
1420
1464
  def collect!(&block)
1421
- @images.collect!(&block)
1422
- is_an_image_array @images
1465
+ @images.map!(&block)
1466
+ assert_image_array @images
1423
1467
  self
1424
1468
  end
1425
1469
 
@@ -1428,7 +1472,6 @@ module Magick
1428
1472
  ditto = self.class.new
1429
1473
  @images.each { |f| ditto << f.copy }
1430
1474
  ditto.scene = @scene
1431
- ditto.taint if tainted?
1432
1475
  ditto
1433
1476
  end
1434
1477
 
@@ -1439,6 +1482,7 @@ module Magick
1439
1482
  end
1440
1483
 
1441
1484
  # ImageList#map took over the "map" name. Use alternatives.
1485
+ alias map collect
1442
1486
  alias __map__ collect
1443
1487
  alias map! collect!
1444
1488
  alias __map__! collect!
@@ -1463,7 +1507,7 @@ module Magick
1463
1507
  end
1464
1508
 
1465
1509
  def concat(other)
1466
- is_an_image_array other
1510
+ assert_image_array other
1467
1511
  other.each { |image| @images << image }
1468
1512
  @scene = length - 1
1469
1513
  self
@@ -1477,7 +1521,7 @@ module Magick
1477
1521
  end
1478
1522
 
1479
1523
  def delete(obj, &block)
1480
- is_an_image obj
1524
+ assert_image obj
1481
1525
  current = get_current
1482
1526
  a = @images.delete(obj, &block)
1483
1527
  set_current current
@@ -1502,12 +1546,11 @@ module Magick
1502
1546
  ditto = self.class.new
1503
1547
  @images.each { |img| ditto << img }
1504
1548
  ditto.scene = @scene
1505
- ditto.taint if tainted?
1506
1549
  ditto
1507
1550
  end
1508
1551
 
1509
1552
  def eql?(other)
1510
- is_an_image_array other
1553
+ assert_image_array other
1511
1554
  eql = other.eql?(@images)
1512
1555
  begin # "other" is another ImageList
1513
1556
  eql &&= @scene == other.scene
@@ -1518,10 +1561,10 @@ module Magick
1518
1561
  end
1519
1562
 
1520
1563
  def fill(*args, &block)
1521
- is_an_image args[0] unless block_given?
1564
+ assert_image args[0] unless block_given?
1522
1565
  current = get_current
1523
1566
  @images.fill(*args, &block)
1524
- is_an_image_array self
1567
+ assert_image_array self
1525
1568
  set_current current
1526
1569
  self
1527
1570
  end
@@ -1529,7 +1572,7 @@ module Magick
1529
1572
  # Override Enumerable's find_all
1530
1573
  def find_all(&block)
1531
1574
  current = get_current
1532
- a = @images.find_all(&block)
1575
+ a = @images.select(&block)
1533
1576
  ilist = self.class.new
1534
1577
  a.each { |image| ilist << image }
1535
1578
  ilist.set_current current
@@ -1553,14 +1596,12 @@ module Magick
1553
1596
  filenames.each do |f|
1554
1597
  Magick::Image.read(f, &block).each { |n| @images << n }
1555
1598
  end
1556
- if length > 0
1557
- @scene = length - 1 # last image in array
1558
- end
1559
- self
1599
+
1600
+ @scene = length - 1 if length > 0 # last image in array
1560
1601
  end
1561
1602
 
1562
1603
  def insert(index, *args)
1563
- args.each { |image| is_an_image image }
1604
+ args.each { |image| assert_image image }
1564
1605
  current = get_current
1565
1606
  @images.insert(index, *args)
1566
1607
  set_current current
@@ -1579,7 +1620,6 @@ module Magick
1579
1620
  n = Integer(n)
1580
1621
  Kernel.raise ArgumentError, 'iterations must be between 0 and 65535' if n < 0 || n > 65_535
1581
1622
  @images.each { |f| f.iterations = n }
1582
- self
1583
1623
  end
1584
1624
 
1585
1625
  def last(*args)
@@ -1660,7 +1700,7 @@ module Magick
1660
1700
 
1661
1701
  def push(*objs)
1662
1702
  objs.each do |image|
1663
- is_an_image image
1703
+ assert_image image
1664
1704
  @images << image
1665
1705
  end
1666
1706
  @scene = length - 1
@@ -1696,7 +1736,7 @@ module Magick
1696
1736
  end
1697
1737
 
1698
1738
  def replace(other)
1699
- is_an_image_array other
1739
+ assert_image_array other
1700
1740
  current = get_current
1701
1741
  @images.clear
1702
1742
  other.each { |image| @images << image }
@@ -1794,7 +1834,7 @@ module Magick
1794
1834
 
1795
1835
  # @scene -> new object
1796
1836
  def unshift(obj)
1797
- is_an_image obj
1837
+ assert_image obj
1798
1838
  @images.unshift(obj)
1799
1839
  @scene = 0
1800
1840
  self
@@ -1811,6 +1851,11 @@ module Magick
1811
1851
  alias indices values_at
1812
1852
  end # Magick::ImageList
1813
1853
 
1854
+ class Pixel
1855
+ # include Observable for Image::View class
1856
+ include Observable
1857
+ end
1858
+
1814
1859
  # Collects non-specific optional method arguments
1815
1860
  class OptionalMethodArguments
1816
1861
  def initialize(img)
data/lib/rvg/clippath.rb CHANGED
@@ -30,7 +30,8 @@ module Magick
30
30
  yield(self) if block_given?
31
31
  end
32
32
 
33
- def add_primitives(gc, _style) #:nodoc:
33
+ # @private
34
+ def add_primitives(gc, _style)
34
35
  name = __id__.to_s
35
36
  gc.define_clip_path(name) do
36
37
  gc.clip_units(@clip_path_units)
data/lib/rvg/container.rb CHANGED
@@ -6,7 +6,8 @@ module Magick
6
6
  class RVG
7
7
  # Content is simply an Array with a deep_copy method.
8
8
  # When unit-testing, it also has a deep_equal method.
9
- class Content < Array #:nodoc:
9
+ # @private
10
+ class Content < Array
10
11
  def deep_copy(h = {})
11
12
  me = __id__
12
13
  copy = h[me]
@@ -64,7 +65,8 @@ module Magick
64
65
  yield(self) if block_given?
65
66
  end
66
67
 
67
- def add_primitives(gc) #:nodoc:
68
+ # @private
69
+ def add_primitives(gc)
68
70
  gc.push
69
71
  add_transform_primitives(gc)
70
72
  add_style_primitives(gc)
@@ -73,13 +75,15 @@ module Magick
73
75
  end
74
76
 
75
77
  # Translate container according to #use arguments
76
- def ref(x, y, _width, _height) #:nodoc:
78
+ # @private
79
+ def ref(x, y, _width, _height)
77
80
  translate(x, y) if x != 0 || y != 0
78
81
  end
79
82
 
80
83
  # Append an arbitrary object to the group's content. Called
81
84
  # by #use to insert a non-container object into a group.
82
- def <<(obj) #:nodoc:
85
+ # @private
86
+ def <<(obj)
83
87
  @content << obj
84
88
  end
85
89
  end # class Group
@@ -113,7 +117,8 @@ module Magick
113
117
  @element.ref(x, y, width, height)
114
118
  end
115
119
 
116
- def add_primitives(gc) #:nodoc:
120
+ # @private
121
+ def add_primitives(gc)
117
122
  gc.push
118
123
  add_transform_primitives(gc)
119
124
  add_style_primitives(gc)
@@ -11,7 +11,7 @@ module Magick
11
11
  module Describable
12
12
  private
13
13
 
14
- def initialize(*args, &block) #:nodoc:
14
+ def initialize(*args, &block)
15
15
  super
16
16
  @title, @desc, @metadata = nil
17
17
  end