Sha256: 32a6bd2fb457b9137b1200fb48e1ed51dc8ada69483b641614ce83364d7f4325

Contents?: true

Size: 1018 Bytes

Versions: 37

Compression:

Stored size: 1018 Bytes

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.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.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

37 entries across 37 versions & 2 rubygems

Version Path
rmagick-2.13.4 doc/ex/flatten_images.rb
rmagick-2.13.3 doc/ex/flatten_images.rb
rmagick-2.13.3.rc1 doc/ex/flatten_images.rb
rmagick-2.13.2 doc/ex/flatten_images.rb
rdp-rmagick-0.0.0 doc/ex/flatten_images.rb
rmagick-2.13.1 doc/ex/flatten_images.rb
rmagick-2.12.2 doc/ex/flatten_images.rb
rmagick-2.12.1 doc/ex/flatten_images.rb
rmagick-2.12.0 doc/ex/flatten_images.rb
rmagick-2.11.1 doc/ex/flatten_images.rb
rmagick-2.10.0 doc/ex/flatten_images.rb
rmagick-2.11.0 doc/ex/flatten_images.rb
rmagick-1.15.10 doc/ex/flatten_images.rb
rmagick-1.15.12 doc/ex/flatten_images.rb
rmagick-1.15.11 doc/ex/flatten_images.rb
rmagick-1.15.14 doc/ex/flatten_images.rb
rmagick-1.15.13 doc/ex/flatten_images.rb
rmagick-1.15.15 doc/ex/flatten_images.rb
rmagick-1.15.16 doc/ex/flatten_images.rb
rmagick-1.15.17 doc/ex/flatten_images.rb