Sha256: 5e4a011889e33cb7156abdffe92d68a33797fb2c8c1fca3ba2ce136b881207f0

Contents?: true

Size: 1.55 KB

Versions: 4

Compression:

Stored size: 1.55 KB

Contents

#!/usr/bin/env ruby

require 'RMagick'

if Magick::Magick_version =~ /ImageMagick/
  y = -15
else
  y = 1
end

results = Magick::ImageList.new

img = Magick::Image.new(270, 60)
img.matte = true

gc = Magick::Draw.new
gc.annotate(img, 0, 0, 0, y, "RUBY!") do
    gc.fill = '#c00'
    gc.stroke = 'black'
    gc.stroke_width = 2
    gc.font_weight = Magick::BoldWeight
    gc.gravity = Magick::SouthGravity
  if RUBY_PLATFORM =~ /mswin32/
    gc.font_family = "Georgia"
      gc.pointsize = 76
  else
      gc.font_family = "times"
    gc.pointsize = 80
  end
end

# Add a little bit of shading
if Magick.const_defined? "HardLightCompositeOp"
    shade = img.shade(true, 310, 30)
    img.composite!(shade, Magick::CenterGravity, Magick::HardLightCompositeOp)
end

# Create the default reflection
reflection = img.wet_floor

ilist = Magick::ImageList.new
ilist << img << reflection
results << ilist.append(true)

# Change the initial level of transparency and the rate of transition
ilist[1] = img.wet_floor(0.25, 0.5)
results << ilist.append(true)

# Add a slant
xform = Magick::AffineMatrix.new(1.0, 0.0, Math::PI/4.0, 1.0, 0.0, 0.0)
ilist[1] = ilist[1].affine_transform(xform)
results << ilist.append(true)

# Add a ripple
ilist[1] = ilist[1].rotate(90).wave(2, 20).rotate(-90)
results << ilist.append(true)

# Montage into a single demo image. Use a white background so
# there won't be any problems with transparency in the browser.
result = results.montage do
    self.geometry = '270x120'
    self.tile = '1x4'
    self.background_color = 'white'
end
result.write('wet_floor.gif')

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rmagick-1.15.14 doc/ex/wet_floor.rb
rmagick-1.15.15 doc/ex/wet_floor.rb
rmagick-1.15.16 doc/ex/wet_floor.rb
rmagick-1.15.17 doc/ex/wet_floor.rb