Sha256: 722fade5a59f1dff7d963fbd72a22cc063991192c3204b95b5e8caec42ba3c8a

Contents?: true

Size: 1.51 KB

Versions: 13

Compression:

Stored size: 1.51 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

13 entries across 13 versions & 3 rubygems

Version Path
rmagick-windows-2.16.5 doc/ex/rvg_linejoin.rb
rmagick-windows-2.16.4 doc/ex/rvg_linejoin.rb
rmagick-windows-2.16.3 doc/ex/rvg_linejoin.rb
rmagick-windows-2.16.2 doc/ex/rvg_linejoin.rb
rmagick-windows-2.16.1 doc/ex/rvg_linejoin.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/rmagick-2.16.0/doc/ex/rvg_linejoin.rb
rmagick-2.16.0 doc/ex/rvg_linejoin.rb
rmagick-2.15.4 doc/ex/rvg_linejoin.rb
rmagick-2.15.3 doc/ex/rvg_linejoin.rb
rmagick-2.15.2 doc/ex/rvg_linejoin.rb
rmagick-2.15.1 doc/ex/rvg_linejoin.rb
rmagick-2.15.0 doc/ex/rvg_linejoin.rb
rmagick-2.14.0 doc/ex/rvg_linejoin.rb