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