Sha256: a184db6da96fd6d542e0a4ab0e7ee2f857034fbde047996be9117d3f773adc55

Contents?: true

Size: 1.13 KB

Versions: 13

Compression:

Stored size: 1.13 KB

Contents

#!/usr/bin/env 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.font_weight(Magick::NormalWeight)
gc.font_style(Magick::NormalStyle)
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

13 entries across 13 versions & 3 rubygems

Version Path
rmagick-windows-2.16.5 doc/ex/grav.rb
rmagick-windows-2.16.4 doc/ex/grav.rb
rmagick-windows-2.16.3 doc/ex/grav.rb
rmagick-windows-2.16.2 doc/ex/grav.rb
rmagick-windows-2.16.1 doc/ex/grav.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/rmagick-2.16.0/doc/ex/grav.rb
rmagick-2.16.0 doc/ex/grav.rb
rmagick-2.15.4 doc/ex/grav.rb
rmagick-2.15.3 doc/ex/grav.rb
rmagick-2.15.2 doc/ex/grav.rb
rmagick-2.15.1 doc/ex/grav.rb
rmagick-2.15.0 doc/ex/grav.rb
rmagick-2.14.0 doc/ex/grav.rb