Sha256: 71802ed2b45ac2a55f30d7506227c85fce4bb3d497ef8cc3e9851812af760132

Contents?: true

Size: 833 Bytes

Versions: 15

Compression:

Stored size: 833 Bytes

Contents

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

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

gc = Magick::Draw.new
gc.stroke('red')
gc.stroke_width(2)

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

# 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.font_weight(Magick::NormalWeight)
gc.font_style(Magick::NormalStyle)
gc.fill('black')
gc.stroke('transparent')
gc.text(8, 15, "'0,0'")
gc.text(105, 16, "x")
gc.text(12, 115, "y")

gc.draw(imgl)

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

imgl.write("translate.gif")

Version data entries

15 entries across 15 versions & 2 rubygems

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