Sha256: e3e040d2d58b8913eff7b7ba31a9da69c31ccbc80531cc8354e9951e7954b62c

Contents?: true

Size: 1.07 KB

Versions: 52

Compression:

Stored size: 1.07 KB

Contents

#! /usr/local/bin/ruby -w

require 'RMagick'

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

gc = Magick::Draw.new

# Draw blue lines to indicate positioning
gc.stroke('blue')
gc.fill('transparent')
gc.rectangle(20,20, 380,180)
gc.line(200,20, 200,180)
gc.line(20,100, 380,100)

# Draw text at all 9 compass points.
gc.stroke('transparent')
gc.fill('black')
gc.gravity(Magick::NorthWestGravity)
gc.text(20,20, 'NorthWestGravity')
gc.gravity(Magick::NorthGravity)
gc.text( 0,20, 'NorthGravity')
gc.gravity(Magick::NorthEastGravity)
gc.text(20,20, 'NorthEastGravity')
gc.gravity(Magick::WestGravity)
gc.text(20, 0, 'WestGravity')
gc.gravity(Magick::CenterGravity)
gc.text( 0, 0, 'CenterGravity')
gc.gravity(Magick::EastGravity)
gc.text(20, 0, 'EastGravity')
gc.gravity(Magick::SouthWestGravity)
gc.text(20,20, 'SouthWestGravity')
gc.gravity(Magick::SouthGravity)
gc.text( 0,20, 'SouthGravity')
gc.gravity(Magick::SouthEastGravity)
gc.text(20,20, 'SouthEastGravity')
gc.draw(imgl)

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

imgl.write("grav.gif")
exit

Version data entries

52 entries across 52 versions & 1 rubygems

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