Sha256: ac061172790342c9bc3a254dfa65e16593a59f0a1a1881db0cddc90ed5e90bbd

Contents?: true

Size: 772 Bytes

Versions: 4

Compression:

Stored size: 772 Bytes

Contents

require 'rvg/rvg'
include Magick

RVG.dpi = 90

rvg = RVG.new(10.cm, 3.5.cm).viewbox(0, 0, 100, 35) do |canvas|
    canvas.background_fill = 'white'
    canvas.desc = "Example Use02 - Chain 'styles' to 'use'"
    r = RVG::Group.new do |grp|
            grp.rect(60, 10).styles(:fill=>'yellow')
        end
    canvas.rect(99.6, 34.6, 0.1, 0.1).styles(:fill=>'none', :stroke=>'blue', :stroke_width=>0.2)

    # Since the rectangle specified the fill color the :fill style is ignored here.
    # However, since the rectangle did not specify a stroke color, the :stroke style
    # specified here is respected.
    canvas.use(r, 20, 5).styles(:fill=>'green', :stroke=>'red')
    canvas.use(r, 20, 20).styles(:fill=>'green', :stroke=>'blue')
end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rmagick-1.8.0 doc/ex/Use02.rb
rmagick-1.8.1 doc/ex/Use02.rb
rmagick-1.8.3 doc/ex/Use02.rb
rmagick-1.8.2 doc/ex/Use02.rb