Sha256: 5846ced697e1923d1a2e9959a2bb898615ab4d80fc2f53c200dad48c082d6d51

Contents?: true

Size: 1.5 KB

Versions: 6

Compression:

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

6 entries across 6 versions & 1 rubygems

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