Sha256: ecd714b5d4b136af84d0548477ea15ba8ff41383bf858cc9d88ee33e5133d562

Contents?: true

Size: 690 Bytes

Versions: 10

Compression:

Stored size: 690 Bytes

Contents

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

require 'RMagick'
include Magick

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

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

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

gc.fill('yellow')
gc.stroke('red')
gc.circle(100, 100, 100,  25)
gc.draw(img)

img.write('matte_floodfill_before.gif')

img.fuzz = 100
img = img.matte_floodfill(100, 100)

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

img.write('matte_floodfill_after.gif')
exit

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rmagick-1.15.10 doc/ex/matte_floodfill.rb
rmagick-1.15.15 doc/ex/matte_floodfill.rb
rmagick-1.15.11 doc/ex/matte_floodfill.rb
rmagick-1.15.12 doc/ex/matte_floodfill.rb
rmagick-1.15.13 doc/ex/matte_floodfill.rb
rmagick-1.15.14 doc/ex/matte_floodfill.rb
rmagick-1.15.16 doc/ex/matte_floodfill.rb
rmagick-1.15.17 doc/ex/matte_floodfill.rb
rmagick-1.15.8 doc/ex/matte_floodfill.rb
rmagick-1.15.9 doc/ex/matte_floodfill.rb