Sha256: 6529969996c0db3f3680065b4953cfc0c9973d85771421208475b4b7ebd18884

Contents?: true

Size: 979 Bytes

Versions: 39

Compression:

Stored size: 979 Bytes

Contents

#! /usr/local/bin/ruby -w

require 'RMagick'

img = Magick::Image.new(200,200)
img.compression = Magick::LZWCompression

bg = Magick::Image.read('plasma:fractal') { self.size = '200x200' }
bg[0].matte = false

gc = Magick::Draw.new
gc.stroke_width(2)
gc.stroke('black')
gc.fill('white')
gc.roundrectangle(0, 0, 199, 199, 8, 8)

gc.fill('black')
gc.circle(100,  45, 100,  25)
gc.circle( 45, 100,  25, 100)
gc.circle(100, 155, 100, 175)
gc.circle(155, 100, 175, 100)

gc.draw(img)

img.write('matte_fill_to_border_before.gif')

# Set the border color. Set the fuzz attribute so that
# the matte fill will fill the aliased pixels around
# the edges of the black circles.
img.border_color = 'black'
img.fuzz = 10
img = img.matte_fill_to_border(100, 100)

# Composite the image over a nice bright background
# so that the transparent pixels will be obvious.
img = bg[0].composite(img, Magick::CenterGravity, Magick::OverCompositeOp)

img.write('matte_fill_to_border_after.gif')
exit

Version data entries

39 entries across 39 versions & 2 rubygems

Version Path
rmagick-2.13.4 doc/ex/matte_fill_to_border.rb
rmagick-2.13.3 doc/ex/matte_fill_to_border.rb
rmagick-2.13.3.rc1 doc/ex/matte_fill_to_border.rb
rmagick-2.13.2 doc/ex/matte_fill_to_border.rb
rdp-rmagick-0.0.0 doc/ex/matte_fill_to_border.rb
rmagick-2.13.1 doc/ex/matte_fill_to_border.rb
rmagick-2.12.2 doc/ex/matte_fill_to_border.rb
rmagick-2.12.1 doc/ex/matte_fill_to_border.rb
rmagick-2.12.0 doc/ex/matte_fill_to_border.rb
rmagick-2.11.1 doc/ex/matte_fill_to_border.rb
rmagick-2.10.0 doc/ex/matte_fill_to_border.rb
rmagick-2.11.0 doc/ex/matte_fill_to_border.rb
rmagick-1.15.10 doc/ex/matte_fill_to_border.rb
rmagick-1.15.11 doc/ex/matte_fill_to_border.rb
rmagick-1.15.14 doc/ex/matte_fill_to_border.rb
rmagick-1.15.15 doc/ex/matte_fill_to_border.rb
rmagick-1.15.12 doc/ex/matte_fill_to_border.rb
rmagick-1.15.13 doc/ex/matte_fill_to_border.rb
rmagick-1.15.17 doc/ex/matte_fill_to_border.rb
rmagick-1.15.16 doc/ex/matte_fill_to_border.rb