Sha256: 0e1d249bf5f1bd57d3744934e6e4c30d4ba1ec5bdc6762c481c62c4a091a717a

Contents?: true

Size: 1.57 KB

Versions: 59

Compression:

Stored size: 1.57 KB

Contents

require 'rvg/rvg'

Magick::RVG.dpi = 90

MITER = {:stroke=>'black', :stroke_width=>70, :fill=>'none', :stroke_linejoin=>'miter'}
ROUND = {:stroke=>'black', :stroke_width=>70, :fill=>'none', :stroke_linejoin=>'round'}
BEVEL = {:stroke=>'black', :stroke_width=>70, :fill=>'none', :stroke_linejoin=>'bevel'}
THIN  = {:stroke=>'#ffcccc', :stroke_width=>5, :fill=>'none'}
TEXT   = {:text_anchor=>'middle', :font_size=>50, :font_family=>'Verdana'}
CIRCLE = {:fill=>'#ffcccc', :stroke=>'none'}

rvg = Magick::RVG.new(12.cm, 3.5.cm).viewbox(0, 0, 1200, 350) do |canvas|
    canvas.desc = 'Example linecap - demonstrates three stroke-linecap values'
    canvas.background_fill = 'white'

    canvas.g.translate(200, 75) do |miter|
        miter.path("M -125,150 L 0,0 L 125,150").styles(MITER)
        miter.path("M -125,150 L 0,0 L 125,150").styles(THIN)
        miter.circle(8).styles(CIRCLE)
        miter.text(0, 230, "'miter' join").styles(TEXT)
    end

    canvas.g.translate(600, 75) do |round|
        round.path("M -125,150 L 0,0 L 125,150").styles(ROUND)
        round.path("M -125,150 L 0,0 L 125,150").styles(THIN)
        round.circle(8).styles(CIRCLE)
        round.text(0, 230, "'round' join").styles(TEXT)
    end

    canvas.g.translate(1000, 75) do |bevel|
        bevel.path("M -125,150 L 0,0 L 125,150").styles(BEVEL)
        bevel.path("M -125,150 L 0,0 L 125,150").styles(THIN)
        bevel.circle(8).styles(CIRCLE)
        bevel.text(0, 230, "'bevel' join").styles(TEXT)
    end

    canvas.rect(1192, 345, 1, 1).styles(:stroke=>'blue', :fill=>'none')
end

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

Version data entries

59 entries across 59 versions & 2 rubygems

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