Sha256: 8689246abc17dc1fac913e991a78e4d1c553d62d406e9399958f19829895093e

Contents?: true

Size: 743 Bytes

Versions: 4

Compression:

Stored size: 743 Bytes

Contents

#!/usr/bin/env 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].alpha(Magick::DeactivateAlphaChannel)

gc = Magick::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, Magick::CenterGravity, Magick::OverCompositeOp)

img.write('matte_floodfill_after.gif')
exit

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rmagick-4.1.0.rc2 doc/ex/matte_floodfill.rb
rmagick-4.1.0.rc1 doc/ex/matte_floodfill.rb
rmagick-4.0.0 doc/ex/matte_floodfill.rb
rmagick-3.2.0 doc/ex/matte_floodfill.rb