Sha256: c0d328ff688425fa5a7be17fc309aa283cdae5178080cdcaf5ba746ad44e1b5c

Contents?: true

Size: 871 Bytes

Versions: 59

Compression:

Stored size: 871 Bytes

Contents

require 'rvg/rvg'

rvg = Magick::RVG.new(300, 300) do |canvas|
    canvas.background_fill = 'white'
    triangles = Magick::RVG::Pattern.new(16, 16).viewbox(0,0, 50,50) do |pat|
        pat.rect(50, 50).styles(:fill=>'darkblue')
        pat.polygon(0,0, 25,50, 50,0, 0,0).styles(:fill=>'yellow', :stroke=>'red')
    end

    canvas.ellipse(130, 60, 150, 75).styles(:stroke_width=>16, :fill=>'none', :stroke=>triangles)

    hat = Magick::Image.read('images/Flower_Hat.jpg').first

    hats = Magick::RVG::Pattern.new(hat.columns/4.0, hat.rows/4.0) do |pat|
        pat.image(hat, hat.columns/4.0, hat.rows/4.0)
    end

    canvas.g.translate(0, 150) do |grp|
        grp.ellipse(130, 60, 150, 75).styles(:fill=>hats)
    end

    canvas.rect(299, 299, 0, 0).styles(:fill=>'none', :stroke=>'blue')
    canvas.line(1, 150, 299, 150)
end

rvg.draw.write('rvg_pattern.gif')

Version data entries

59 entries across 59 versions & 2 rubygems

Version Path
rmagick-2.13.4 doc/ex/rvg_pattern.rb
rmagick-2.13.3 doc/ex/rvg_pattern.rb
rmagick-2.13.3.rc1 doc/ex/rvg_pattern.rb
rmagick-2.13.2 doc/ex/rvg_pattern.rb
rdp-rmagick-0.0.0 doc/ex/rvg_pattern.rb
rmagick-2.13.1 doc/ex/rvg_pattern.rb
rmagick-2.12.2 doc/ex/rvg_pattern.rb
rmagick-2.12.1 doc/ex/rvg_pattern.rb
rmagick-2.12.0 doc/ex/rvg_pattern.rb
rmagick-2.11.1 doc/ex/rvg_pattern.rb
rmagick-2.10.0 doc/ex/rvg_pattern.rb
rmagick-2.11.0 doc/ex/rvg_pattern.rb
rmagick-1.10.1 doc/ex/rvg_pattern.rb
rmagick-1.10.0 doc/ex/rvg_pattern.rb
rmagick-1.11.1 doc/ex/rvg_pattern.rb
rmagick-1.11.0 doc/ex/rvg_pattern.rb
rmagick-1.12.0 doc/ex/rvg_pattern.rb
rmagick-1.13.0 doc/ex/rvg_pattern.rb
rmagick-1.15.1 doc/ex/rvg_pattern.rb
rmagick-1.15.10 doc/ex/rvg_pattern.rb