Sha256: 74a7507072360a92bfafd1dec134b06982aa7ddadb5d33cddc99b81196647540

Contents?: true

Size: 1.05 KB

Versions: 30

Compression:

Stored size: 1.05 KB

Contents

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

# Demonstrate flatten_images method. Create an image with a drop-shadow effect.

require 'RMagick'

RMagick = 'RMagick'

i = Magick::ImageList.new

# Create a background image with a gradient fill
i.new_image(200, 100, Magick::GradientFill.new(100,50, 100, 50, "khaki1", "turquoise"))

# Create a transparent image for the text shadow
i.new_image(200, 100) { self.background_color = 'transparent' }
primitives = Magick::Draw.new
primitives.annotate i, 0, 0, 2, 2, RMagick do
    self.pointsize = 32
    self.font = "Helvetica"
    self.fill = "gray50"
    self.gravity = Magick::CenterGravity
    end

# Create another transparent image for the text itself
i.new_image(200, 100) { self.background_color = 'transparent' }
primitives = Magick::Draw.new
primitives.annotate i, 0, 0, -2, -2, RMagick do
    self.pointsize = 32
    self.font = "Helvetica"
    self.fill = "red"
    self.stroke = "black"
    self.gravity = Magick::CenterGravity
    end

# Flatten all 3 into a single image.
# i.display
i.flatten_images.write "flatten_images.gif"
exit

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rmagick-1.10.0 doc/ex/flatten_images.rb
rmagick-1.10.1 doc/ex/flatten_images.rb
rmagick-1.11.1 doc/ex/flatten_images.rb
rmagick-1.12.0 doc/ex/flatten_images.rb
rmagick-1.13.0 doc/ex/flatten_images.rb
rmagick-1.11.0 doc/ex/flatten_images.rb
rmagick-1.15.1 doc/ex/flatten_images.rb
rmagick-1.14.0 doc/ex/flatten_images.rb
rmagick-1.14.1 doc/ex/flatten_images.rb
rmagick-1.15.0 doc/ex/flatten_images.rb
rmagick-1.15.2 doc/ex/flatten_images.rb
rmagick-1.15.3 doc/ex/flatten_images.rb
rmagick-1.15.4 doc/ex/flatten_images.rb
rmagick-1.15.7 doc/ex/flatten_images.rb
rmagick-1.15.5 doc/ex/flatten_images.rb
rmagick-1.15.6 doc/ex/flatten_images.rb
rmagick-1.15.8 doc/ex/flatten_images.rb
rmagick-1.15.9 doc/ex/flatten_images.rb
rmagick-1.7.1 doc/ex/flatten_images.rb
rmagick-1.7.2 doc/ex/flatten_images.rb