Sha256: 1c2ec3b6f827f152a75d2cf7f8837f5b7b14985a945f9c582547065b5ab0c3a4

Contents?: true

Size: 764 Bytes

Versions: 4

Compression:

Stored size: 764 Bytes

Contents

require 'rvg/rvg'
include Magick

RVG.dpi = 90

rvg = RVG.new(12.cm, 4.cm).viewbox(0, 0, 1200, 400) do |canvas|
    canvas.background_fill = 'white'
    canvas.desc = "Example polygon01 - star and hexagon"

    # Show outline of canvas using the 'rect' method
    canvas.rect(1195, 395, 1, 1).styles(:fill=>'none', :stroke=>'blue', :stroke_width=>2)

    canvas.polygon(350,75,379,161,469,161,397,215,
                    423,301,350,250,277,301,303,215,
                    231,161,321,161).styles(:fill=>'red', :stroke=>'blue', :stroke_width=>10)

    canvas.polygon(850,75,958,137.5,958,262.5,
                    850,325,742,262.6,742,137.5).
                    styles(:fill=>'lime', :stroke=>'blue', :stroke_width=>10)

end

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

Version data entries

4 entries across 4 versions & 1 rubygems

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