Sha256: fbe02f8e57804a72c27461219d5cd9f56ec3ef0f950ca7c2fce8158f2c341699

Contents?: true

Size: 647 Bytes

Versions: 15

Compression:

Stored size: 647 Bytes

Contents

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

imgl = Magick::ImageList.new
imgl.new_image(300, 200, Magick::HatchFill.new('white','lightcyan2'))

gc = Magick::Draw.new

gc.fill_opacity(0)
gc.stroke('red')
gc.stroke_width(3)

# Draw rectangle
gc.rectangle(20,20, 280, 180)

# Outline corners
gc.stroke_width(1)
gc.stroke('gray50')
gc.circle(20,20, 23,23)
gc.circle(280, 180, 283, 183)

# Annotate
gc.font_weight(Magick::NormalWeight)
gc.font_style(Magick::NormalStyle)
gc.fill('black')
gc.stroke('transparent')
gc.text(30,35, "'20,20'")
gc.text(230,175, "'280,180'")

gc.draw(imgl)
imgl.border!(1,1, 'lightcyan2')

imgl.write("rectangle.gif")
exit

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
rmagick-2.13.4 doc/ex/rectangle.rb
rmagick-2.13.3 doc/ex/rectangle.rb
rmagick-2.13.3.rc1 doc/ex/rectangle.rb
rmagick-2.13.2 doc/ex/rectangle.rb
rdp-rmagick-0.0.0 doc/ex/rectangle.rb
rmagick-2.13.1 doc/ex/rectangle.rb
rmagick-2.12.2 doc/ex/rectangle.rb
rmagick-2.12.1 doc/ex/rectangle.rb
rmagick-2.12.0 doc/ex/rectangle.rb
rmagick-2.11.1 doc/ex/rectangle.rb
rmagick-2.10.0 doc/ex/rectangle.rb
rmagick-2.11.0 doc/ex/rectangle.rb
rmagick-2.9.0 doc/ex/rectangle.rb
rmagick-2.9.1 doc/ex/rectangle.rb
rmagick-2.9.2 doc/ex/rectangle.rb