Sha256: 36cb33037604f3850edb785d6ee1847647d28ca8a3f56a2b07e317974e1ad5ea

Contents?: true

Size: 796 Bytes

Versions: 52

Compression:

Stored size: 796 Bytes

Contents

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

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

gc = Magick::Draw.new

# Move the origin to the center.
gc.translate(100, 100)
max_x = imgl.columns/2
max_y = imgl.rows/2

# Rotate 45 degrees
gc.rotate(45)

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

# Draw down-pointing arrow
gc.line(0, -max_y,   0, max_y)
gc.line(0,  max_y,  10, max_y-10)
gc.line(0,  max_y, -10, max_y-10)

# Draw right-pointing arrow
gc.line(-max_x, 0, max_x,     0)
gc.line( max_x, 0, max_x-10, -10)
gc.line( max_x, 0, max_x-10,  10)

# Add labels
gc.fill('black')
gc.stroke('transparent')

gc.text(8, 15, "'0,0'")
gc.text(110, 16, "x")
gc.text(12, 115, "y")

gc.draw(imgl)

imgl.border!(1,1, "lightcyan2")

imgl.write("rotate.gif")

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
rmagick-1.10.0 doc/ex/rotate.rb
rmagick-1.10.1 doc/ex/rotate.rb
rmagick-1.12.0 doc/ex/rotate.rb
rmagick-1.11.1 doc/ex/rotate.rb
rmagick-1.11.0 doc/ex/rotate.rb
rmagick-1.13.0 doc/ex/rotate.rb
rmagick-1.15.10 doc/ex/rotate.rb
rmagick-1.15.0 doc/ex/rotate.rb
rmagick-1.14.0 doc/ex/rotate.rb
rmagick-1.15.1 doc/ex/rotate.rb
rmagick-1.14.1 doc/ex/rotate.rb
rmagick-1.15.12 doc/ex/rotate.rb
rmagick-1.15.11 doc/ex/rotate.rb
rmagick-1.15.13 doc/ex/rotate.rb
rmagick-1.15.15 doc/ex/rotate.rb
rmagick-1.15.14 doc/ex/rotate.rb
rmagick-1.15.2 doc/ex/rotate.rb
rmagick-1.15.17 doc/ex/rotate.rb
rmagick-1.15.16 doc/ex/rotate.rb
rmagick-1.15.3 doc/ex/rotate.rb