Sha256: 3c915315e3275c4f5882360e9a28d11b30655df4fea0924849fa3ec14d14e09e

Contents?: true

Size: 867 Bytes

Versions: 67

Compression:

Stored size: 867 Bytes

Contents

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

# Demonstrate the Draw#text_align method

canvas = Magick::Image.new(200, 100)
gc = Magick::Draw.new

# Draw three samples of text, each using
# a different alignment constant. Put the
# samples on different points on the y-axis
# so we can tell them apart.
gc.stroke('transparent')
gc.pointsize(16)
gc.fill('red')
gc.text_align(Magick::RightAlign)
gc.text(100, 30,  'RightAlign')
gc.fill('blue')
gc.text_align(Magick::CenterAlign)
gc.text(100, 50, 'CenterAlign')
gc.fill('green')
gc.text_align(Magick::LeftAlign)
gc.text(100, 70, 'LeftAlign')

# Now draw lines to show the points
# to which each sample is aligned.
gc.stroke('gray50')
gc.line(100, 10, 100, 90)
gc.line( 98, 30, 102, 30)
gc.line( 98, 50, 102, 50)
gc.line( 98, 70, 102, 70)

gc.draw(canvas)
canvas.border!(1,1,'gray50')
canvas.write('text_align.gif')
exit

Version data entries

67 entries across 67 versions & 2 rubygems

Version Path
rmagick-2.13.4 doc/ex/text_align.rb
rmagick-2.13.3 doc/ex/text_align.rb
rmagick-2.13.3.rc1 doc/ex/text_align.rb
rmagick-2.13.2 doc/ex/text_align.rb
rdp-rmagick-0.0.0 doc/ex/text_align.rb
rmagick-2.13.1 doc/ex/text_align.rb
rmagick-2.12.2 doc/ex/text_align.rb
rmagick-2.12.1 doc/ex/text_align.rb
rmagick-2.12.0 doc/ex/text_align.rb
rmagick-2.11.1 doc/ex/text_align.rb
rmagick-2.10.0 doc/ex/text_align.rb
rmagick-2.11.0 doc/ex/text_align.rb
rmagick-1.10.1 doc/ex/text_align.rb
rmagick-1.10.0 doc/ex/text_align.rb
rmagick-1.12.0 doc/ex/text_align.rb
rmagick-1.13.0 doc/ex/text_align.rb
rmagick-1.11.1 doc/ex/text_align.rb
rmagick-1.11.0 doc/ex/text_align.rb
rmagick-1.15.10 doc/ex/text_align.rb
rmagick-1.15.1 doc/ex/text_align.rb