Sha256: 2673d0e33e40a038bad5bbc0d20a76a110114d2d9b404d1802d9db268c4a24b7

Contents?: true

Size: 995 Bytes

Versions: 67

Compression:

Stored size: 995 Bytes

Contents

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

imgl = Magick::ImageList.new
imgl.new_image(615, 100)

gc = Magick::Draw.new
gc.stroke('black').stroke_width(30)

# Draw thick line with "butt" linecap
gc.stroke_linecap('butt')
gc.line(25,50, 175,50)

# Draw thick line with "round" linecap
gc.stroke_linecap('round')
gc.line(225,50, 375,50)

# Draw thick line with "square" linecap
gc.stroke_linecap('square')
gc.line(425,50, 575,50)

# Show line endpoints in pink
gc.fill('lightpink')
gc.stroke('lightpink').stroke_width(3)
gc.line(25,50, 175,50)
gc.circle(25,50, 27,52).circle(175,50,177,52)
gc.line(225,50, 375,50)
gc.circle(225,50, 227,52).circle(375,50,377,52)
gc.line(425,50, 575, 50)
gc.circle(425,50, 427,52).circle(575,50,577,52)

# Annotate
gc.fill('black')
gc.stroke('transparent')
gc.pointsize(14)
gc.font_weight(Magick::BoldWeight)

gc.text(55,90, "\"'butt' cap\"")
gc.text(250,90, "\"'round' cap\"")
gc.text(450,90, "\"'square' cap\"")

gc.draw(imgl)

imgl.write("stroke_linecap.gif")

Version data entries

67 entries across 67 versions & 2 rubygems

Version Path
rmagick-1.15.10 doc/ex/stroke_linecap.rb
rmagick-1.14.1 doc/ex/stroke_linecap.rb
rmagick-1.14.0 doc/ex/stroke_linecap.rb
rmagick-1.15.15 doc/ex/stroke_linecap.rb
rmagick-1.15.14 doc/ex/stroke_linecap.rb
rmagick-1.15.13 doc/ex/stroke_linecap.rb
rmagick-1.15.11 doc/ex/stroke_linecap.rb
rmagick-1.15.12 doc/ex/stroke_linecap.rb
rmagick-1.15.3 doc/ex/stroke_linecap.rb
rmagick-1.15.17 doc/ex/stroke_linecap.rb
rmagick-1.15.16 doc/ex/stroke_linecap.rb
rmagick-1.15.4 doc/ex/stroke_linecap.rb
rmagick-1.15.2 doc/ex/stroke_linecap.rb
rmagick-1.15.8 doc/ex/stroke_linecap.rb
rmagick-1.15.5 doc/ex/stroke_linecap.rb
rmagick-1.15.6 doc/ex/stroke_linecap.rb
rmagick-1.15.7 doc/ex/stroke_linecap.rb
rmagick-1.7.2 doc/ex/stroke_linecap.rb
rmagick-1.7.1 doc/ex/stroke_linecap.rb
rmagick-1.15.9 doc/ex/stroke_linecap.rb