doc/ex/matte_replace.rb in rmagick-1.15.17 vs doc/ex/matte_replace.rb in rmagick-2.0.0
- old
+ new
@@ -1,17 +1,16 @@
#! /usr/local/bin/ruby -w
require 'RMagick'
-include Magick
-img = Image.new(200,200)
-img.compression = LZWCompression
+img = Magick::Image.new(200,200)
+img.compression = Magick::LZWCompression
-bg = Image.read('plasma:fractal') { self.size = '200x200' }
+bg = Magick::Image.read('plasma:fractal') { self.size = '200x200' }
bg[0].matte = false
-gc = Draw.new
+gc = Magick::Draw.new
gc.stroke_width(2)
gc.stroke('black')
gc.fill('white')
gc.roundrectangle(0, 0, 199, 199, 8, 8)
@@ -32,10 +31,10 @@
img.fuzz = 10
img = img.matte_replace(100, 45)
# Composite the image over a nice bright background
# so that the transparent pixels will be obvious.
-img = bg[0].composite(img, CenterGravity, OverCompositeOp)
+img = bg[0].composite(img, Magick::CenterGravity, Magick::OverCompositeOp)
img.write('matte_replace_after.gif')
exit