Sha256: edfe2400c8134303384171e42a28d94a43980805f02d44075c19c06bf29ee499

Contents?: true

Size: 719 Bytes

Versions: 13

Compression:

Stored size: 719 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].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('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

13 entries across 13 versions & 3 rubygems

Version Path
rmagick-windows-2.16.5 doc/ex/matte_floodfill.rb
rmagick-windows-2.16.4 doc/ex/matte_floodfill.rb
rmagick-windows-2.16.3 doc/ex/matte_floodfill.rb
rmagick-windows-2.16.2 doc/ex/matte_floodfill.rb
rmagick-windows-2.16.1 doc/ex/matte_floodfill.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/rmagick-2.16.0/doc/ex/matte_floodfill.rb
rmagick-2.16.0 doc/ex/matte_floodfill.rb
rmagick-2.15.4 doc/ex/matte_floodfill.rb
rmagick-2.15.3 doc/ex/matte_floodfill.rb
rmagick-2.15.2 doc/ex/matte_floodfill.rb
rmagick-2.15.1 doc/ex/matte_floodfill.rb
rmagick-2.15.0 doc/ex/matte_floodfill.rb
rmagick-2.14.0 doc/ex/matte_floodfill.rb