Sha256: ebf9f9878c230dd1ce3e745c0010f9627e566c5f74fd03e13b47f8947ac6ac22

Contents?: true

Size: 748 Bytes

Versions: 6

Compression:

Stored size: 748 Bytes

Contents

require 'rvg/rvg'

Magick::RVG.dpi = 90

rvg = Magick::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

6 entries across 6 versions & 1 rubygems

Version Path
rmagick-4.1.0.rc2 doc/ex/polygon01.rb
rmagick-4.1.0.rc1 doc/ex/polygon01.rb
rmagick-4.0.0 doc/ex/polygon01.rb
rmagick-3.2.0 doc/ex/polygon01.rb
rmagick-3.1.0 doc/ex/polygon01.rb
rmagick-3.0.0 doc/ex/polygon01.rb