Sha256: b03d02f416a9421cbd6fb741c209c02b33001685dcefdb9fc2cc45590edf1c33

Contents?: true

Size: 993 Bytes

Versions: 13

Compression:

Stored size: 993 Bytes

Contents

#!/usr/bin/env 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

13 entries across 13 versions & 3 rubygems

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