Sha256: ca27a2641c7bebb98131954c951836adfed8c250831abbdc197235da76ebe18f

Contents?: true

Size: 1.62 KB

Versions: 59

Compression:

Stored size: 1.62 KB

Contents

#! /usr/local/bin/ruby -w
require 'rvg/rvg'

Magick::RVG.dpi = 90

BUTT   = {:stroke=>'black', :stroke_width=>70, :stroke_linecap=>'butt'}
ROUND  = {:stroke=>'black', :stroke_width=>70, :stroke_linecap=>'round'}
SQUARE = {:stroke=>'black', :stroke_width=>70, :stroke_linecap=>'square'}
THIN   = {:stroke=>'#ffcccc', :stroke_width=>5}
TEXT   = {:text_anchor=>'middle', :font_size=>50, :font_family=>'Verdana'}
CIRCLE = {:fill=>'#ffcccc', :stroke=>'none'}

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

    canvas.g.translate(200, 75) do |butt|
        butt.line(-125, 0, 125, 0).styles(BUTT)
        butt.line(-125, 0, 125, 0).styles(THIN)
        butt.circle(8, -125, 0).styles(CIRCLE)
        butt.circle(8,  125, 0).styles(CIRCLE)
        butt.text(0, 90, "'butt' cap").styles(TEXT)
    end
    canvas.g.translate(600, 75) do |round|
        round.line(-125, 0, 125, 0).styles(ROUND)
        round.line(-125, 0, 125, 0).styles(THIN)
        round.circle(8, -125, 0).styles(CIRCLE)
        round.circle(8,  125, 0).styles(CIRCLE)
        round.text(0, 90, "'round' cap").styles(TEXT)
    end

    canvas.g.translate(1000, 75) do |square|
        square.line(-125, 0, 125, 0).styles(SQUARE)
        square.line(-125, 0, 125, 0).styles(THIN)
        square.circle(8, -125, 0).styles(CIRCLE)
        square.circle(8,  125, 0).styles(CIRCLE)
        square.text(0, 90, "'square' cap").styles(TEXT)
    end
    canvas.rect(1192, 195, 1, 1).styles(:stroke=>'blue', :fill=>'none')
end

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

Version data entries

59 entries across 59 versions & 2 rubygems

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