Sha256: 2c1d361c2406aa289ef1dde9d8ed4bc042c3d005f4b041304b60098f47c94c89

Contents?: true

Size: 1001 Bytes

Versions: 52

Compression:

Stored size: 1001 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

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

# Skew x 30 degrees
gc.skewx(30)

# Draw down-pointing arrow
gc.fill('red')
gc.stroke('red')
gc.stroke_width(3)
gc.line(0, -max_y,  0, max_y)
gc.line(0,  max_y,  7, max_y-7)
gc.line(0,  max_y, -7, max_y-7)

# Draw right-pointing arrow
gc.stroke('gray50')
gc.stroke_width(1)
gc.line(-max_x, 0, max_x,    0)
gc.line( max_x, 0, max_x-5, -5)
gc.line( max_x, 0, max_x-5,  5)

gc.draw(imgl)

# Add labels using "normal" skew
gc = Magick::Draw.new
gc.pointsize(14)
gc.stroke('transparent')
gc.gravity(Magick::CenterGravity)
gc.text(10, -10, "'0,0'")
gc.gravity(Magick::EastGravity)
gc.text(10, 10, "'+x'")
gc.gravity(Magick::SouthGravity)
gc.text(0, 20, "'+y'")

gc.draw(imgl)

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

imgl.write("skewx.gif")

Version data entries

52 entries across 52 versions & 1 rubygems

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