[Pkg-ruby-extras-maintainers] r305 - in packages: . librmagick-ruby librmagick-ruby/branches librmagick-ruby/branches/upstream librmagick-ruby/branches/upstream/current librmagick-ruby/branches/upstream/current/doc librmagick-ruby/branches/upstream/current/doc/ex

Lucas Nussbaum lucas-guest at costa.debian.org
Wed Jan 25 19:01:02 UTC 2006


Author: lucas-guest
Date: 2006-01-25 19:01:00 +0000 (Wed, 25 Jan 2006)
New Revision: 305

Added:
   packages/librmagick-ruby/
   packages/librmagick-ruby/branches/
   packages/librmagick-ruby/branches/upstream/
   packages/librmagick-ruby/branches/upstream/current/
   packages/librmagick-ruby/branches/upstream/current/doc/
   packages/librmagick-ruby/branches/upstream/current/doc/ex/
   packages/librmagick-ruby/branches/upstream/current/doc/ex/Adispatch.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/Zconstitute.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/adaptive_threshold.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/add_noise.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/affine.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/affine_transform.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/arc.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/arcpath.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/average.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/axes.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/bilevel_channel.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/blur_image.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/border.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/bounding_box.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier1.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier2.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier3.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier4.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier5.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier6.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/channel.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/charcoal.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/chop.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/circle.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/clip_path.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/coalesce.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/color_fill_to_border.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/color_floodfill.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/color_histogram.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/color_reset.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/colorize.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/colors.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/composite.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/contrast.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/crop.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/crop_with_gravity.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/cycle_colormap.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/demo.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/drawcomp.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/drop_shadow.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/edge.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/ellipse.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/emboss.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/enhance.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/equalize.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/evenodd.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/flatten_images.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/flip.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/flop.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/font_styles.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/fonts.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/frame.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/gaussian_blur.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/get_multiline_type_metrics.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/get_pixels.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/get_type_metrics.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/gradientfill.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/grav.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/gravity.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/hatchfill.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/implode.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/level.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/level_channel.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/line.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/map.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/map_f.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/matte_fill_to_border.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/matte_floodfill.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/matte_replace.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/median_filter.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/modulate.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/mono.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/morph.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/mosaic.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/motion_blur.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/negate.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/negate_channel.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/nested_rvg.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/nonzero.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/normalize.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/oil_paint.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/opacity.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/opaque.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/ordered_dither.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/path.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/pattern1.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/pattern2.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/polygon.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/polyline.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/posterize.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/preview.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/qbezierpath.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/quantize-m.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/radial_blur.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/raise.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/random_threshold_channel.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/rectangle.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/reduce_noise.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/roll.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/rotate.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/rotate_f.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/roundrect.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/rubyname.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/rvg_linecap.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/rvg_opacity.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/rvg_stroke_dasharray.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/segment.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/sepiatone.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/shade.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/shave.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/shear.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/skewx.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/skewy.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/smile.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/solarize.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/splice.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/spread.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/stegano.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_dasharray.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_fill.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_linecap.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_linejoin.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_width.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/swirl.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/text.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/text_align.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/text_antialias.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/text_styles.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/text_undercolor.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/texture_fill_to_border.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/texture_floodfill.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/texturefill.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/threshold.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/to_blob.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/translate.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/transparent.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/unsharp_mask.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/viewex.rb
   packages/librmagick-ruby/branches/upstream/current/doc/ex/wave.rb
   packages/librmagick-ruby/tags/
Log:
[svn-inject] Installing original source of librmagick-ruby

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/Adispatch.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/Adispatch.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/Adispatch.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,43 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+f = Magick::Image.read("images/Flower_Hat.jpg").first
+
+pixels = f.dispatch(0,0,f.columns,f.rows,"RGB")
+
+# Write the pixels to a file, to be loaded in the Zconstitute.rb
+# example.  Ruby 1.6.8 # loads the Pixels array much faster if we break
+# the array into many small pieces and concatenate them together, so this
+# program generates such a sequence.
+
+first = true
+total = pixels.length
+
+File.open('pixels-array', 'w') { |txt|
+    txt.puts("Width = #{f.columns}")
+    txt.puts("Height = #{f.rows}")
+    txt.puts('Pixels = [')
+    x = 0
+    pixels.each do |p|
+        txt.printf("%3d,", p)
+        x = x.succ
+        txt.printf("\n") if x % 25 == 0
+        if x % 1000 == 0
+            if first
+                txt.puts(']')
+                first = false
+            else
+                txt.puts('])')
+            end
+            txt.print('Pixels.concat([')
+        end
+    end
+
+    if first
+        txt.puts(']')
+        first = false
+    else
+        txt.puts('])')
+    end
+}
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/Zconstitute.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/Zconstitute.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/Zconstitute.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,9 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+load 'pixels-array'
+
+image = Magick::Image.constitute(Width, Height, "RGB", Pixels)
+
+image.write("constitute.jpg")
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/adaptive_threshold.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/adaptive_threshold.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/adaptive_threshold.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,19 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#adaptive_threshold method
+
+img = Magick::Image.read("images/Flower_Hat.jpg").first
+
+begin
+    result = img.adaptive_threshold
+
+# Substitute the standard "Not Implemented" image
+rescue NotImplementedError
+    result = Magick::Image.read("images/notimplemented.gif").first
+    result.resize!(img.columns, img.rows)
+end
+
+result.write("adaptive_threshold.jpg")
+exit
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/add_noise.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/add_noise.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/add_noise.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,18 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+include Magick
+
+# Demonstrate the Image#add_noise method
+NOISE_TYPES = [UniformNoise, GaussianNoise,
+               MultiplicativeGaussianNoise,
+               ImpulseNoise, LaplacianNoise,
+               PoissonNoise]
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+NOISE_TYPES.each do |noise|
+    copy = img.add_noise(noise)
+    copy.write "add_noise_#{noise.to_s}.jpg"
+
+end
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/affine.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/affine.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/affine.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,48 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the affine primitive. Transform the
+# coordinate space to put the origin in the lower
+# left corner.
+
+imgl = Magick::ImageList.new
+imgl.new_image 200, 200, Magick::HatchFill.new('white','lightcyan2')
+
+gc = Magick::Draw.new
+
+max_x = imgl.columns
+max_y = imgl.rows
+
+# Translate the y origin to the bottom of the window.
+# Invert the y points by scaling by -1. Combine the
+# two operations using the affine method. That is, the
+# affine method is equivalent to:
+#       gc.translate 0, max_y
+#       gc.scale 1, -1
+gc.affine(1, 0, 0, -1, 0, max_y)
+gc.stroke('gray50')
+gc.fill('gray50')
+gc.stroke_width(1)
+
+# Draw up-pointing arrow.
+gc.polyline(10, 10, 10, max_y-10, 5, max_y-15, 15, max_y-15, 10, max_y-10)
+
+# Draw right-pointing arrow
+gc.polyline(10, 10, max_x-10, 10, max_x-15, 5, max_x-15, 15, max_x-10, 10)
+
+gc.draw(imgl)
+
+# Add labels. Use a different graphics context with a "normal"
+# coordinate system so the text isn't inverted.
+text_gc = Magick::Draw.new
+text_gc.pointsize(14)
+text_gc.font_weight(Magick::NormalWeight)
+text_gc.stroke('transparent')
+text_gc.text(15, max_y-15, "'0,0'")
+text_gc.text(max_x-20, max_y-16, "'+x'")
+text_gc.text(12, 15, "'+y'")
+text_gc.draw(imgl)
+
+imgl.border!(1, 1, "lightcyan2")
+
+imgl.write("affine.gif")

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/affine_transform.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/affine_transform.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/affine_transform.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,20 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#affine_transform method
+
+img = Magick::Image.read("images/Flower_Hat.jpg").first
+
+# Construct a simple affine matrix
+flipflop = Magick::AffineMatrix.new(1, Math::PI/6, Math::PI/6, 1, 0, 0)
+
+# Apply the transform
+img = img.affine_transform(flipflop)
+
+# Scale the image, make the background transparent,
+# and write it to a JPEG file.
+img.scale!(250.0/img.rows)
+img = img.matte_replace(0,0)
+img.write("affine_transform.jpg")
+
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/arc.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/arc.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/arc.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,47 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+i = Magick::Image.new(300, 220, Magick::HatchFill.new("white","lightcyan2"))
+gc = Magick::Draw.new
+
+# Draw the border rectangle.
+gc.fill_opacity(0)
+gc.stroke_width(1)
+gc.stroke('gray50')
+gc.rectangle(40, 50, 250, 180)
+
+# Draw the circles around the rectangle corners and
+# arc endpoints. All the circles have a 3-pixel radius.
+gc.circle(40,   50,  40+3,  50)
+gc.circle(250, 180, 250+3, 180)
+gc.circle(250, 114, 250+3, 114)
+gc.circle(146,  50, 146+3,  50)
+
+# Annotate
+gc.stroke('transparent')
+gc.fill("black")
+gc.fill_opacity(1)
+
+# xMagick recognizes the braces as delimiters.
+gc.gravity(Magick::NorthWestGravity)
+gc.text(43, 45, "{40, 50}")
+gc.text(195, 118, "{0 degrees}")
+
+gc.gravity(Magick::SouthEastGravity)
+gc.text(300-250, 220-195, "{250, 180}")
+
+gc.gravity(Magick::NorthGravity)
+gc.text(0, 67, "{270 degrees}")
+
+# Draw the arc
+gc.fill_opacity(0)
+gc.stroke('red').stroke_width(3)
+gc.arc(40, 50, 250,180, 0, 270)
+
+# Draw on the canvas
+gc.draw(i)
+
+i.border!(1,1, "lightcyan2")
+
+#i.display
+i.write("arc.gif")

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/arcpath.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/arcpath.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/arcpath.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,33 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the "path" drawing primitive.
+
+imgl = Magick::ImageList.new
+imgl.new_image(450, 200, Magick::HatchFill.new('white','lightcyan2'))
+
+gc = Magick::Draw.new
+
+# Draw "pie chart"
+gc.fill('red')
+gc.stroke('blue')
+gc.stroke_width(2)
+gc.path('M110,100 h-75 a75,75 0 1,0 75,-75 z')
+gc.fill('yellow')
+gc.path('M97.5,87.5 v-75 a75,75 0 0,0 -75,75 z')
+
+# Draw wiggly line
+gc.fill_opacity(0)
+gc.stroke('#00cd00')
+gc.stroke_width(3)
+gc.path('M200,175 l 25,-12.5 ' +
+                'a12.5,12.5 -15 0,1 25,-12.5 l 25,-12.5 ' +
+                'a12.5,25   -15 0,1 25,-12.5 l 25,-12.5 ' +
+                'a12.5,37.5 -15 0,1 25,-12.5 l 25,-12.5 ' +
+                'a12.5,50   -15 0,1 25,-12.5 l 25,-12.5')
+
+gc.draw imgl
+imgl.border!(1,1, "lightcyan2")
+
+imgl.write('arcpath.gif')
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/average.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/average.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/average.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,15 @@
+#! /usr/local/bin/ruby -w
+# Demonstrate ImageList#average method
+require 'RMagick'
+
+images = Magick::ImageList.new("images/Button_A.gif", "images/Button_B.gif", "images/Button_C.gif")
+
+group = images.append false
+group.compression = Magick::LZWCompression
+group.write "average_before.gif"
+
+average_image = images.average
+
+average_image.compression = Magick::LZWCompression
+average_image.write "average_after.gif"
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/axes.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/axes.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/axes.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,64 @@
+#!/usr/local/bin/ruby -w
+
+require 'RMagick'
+
+# Demonstrate the use of RMagick's Draw class
+# and show the default coordinate system.
+
+# Create a canvas to draw on. Use the HatchFill class to
+# cross-hatch the background with light gray lines every 10 pixels.
+canvas = Magick::ImageList.new
+canvas.new_image(250, 250, Magick::HatchFill.new('white', 'gray90'))
+
+# Draw a border around the edges of the canvas.
+border = Magick::Draw.new
+border.stroke('thistle')
+border.fill_opacity(0)
+border.rectangle(0,0, canvas.rows-1, canvas.columns-1)
+border.draw(canvas)
+
+# Draw gold axes with arrow-heads.
+axes = Magick::Draw.new
+axes.fill_opacity(0)
+axes.stroke('gold3')
+axes.stroke_width(4)
+axes.stroke_linecap('round')
+axes.stroke_linejoin('round')
+axes.polyline(18,canvas.rows-10, 10,canvas.rows-3, 3,canvas.rows-10,
+              10,canvas.rows-10, 10,10, canvas.columns-10,10,
+              canvas.columns-10,3, canvas.columns-3,10, canvas.columns-10, 18)
+axes.draw(canvas)
+
+# Draw a red circle to show the direction of rotation.
+# Make it slightly transparent so the hatching will show through.
+circle = Magick::Draw.new
+circle.stroke('tomato')
+circle.fill_opacity(0)
+circle.stroke_opacity(0.75)
+circle.stroke_width(6)
+circle.stroke_linecap('round')
+circle.stroke_linejoin('round')
+circle.ellipse(canvas.rows/2,canvas.columns/2, 80, 80, 0, 315)
+circle.polyline(180,70, 173,78, 190,78, 191,62)
+circle.draw(canvas)
+
+# Label the axes and the circle.
+labels = Magick::Draw.new
+labels.fill('black')
+labels.stroke('transparent')
+labels.font_family('helvetica')
+labels.font_style(Magick::ItalicStyle)
+labels.pointsize(14)
+labels.gravity(Magick::NorthWestGravity)
+labels.text(20,30, "'0,0'")
+labels.gravity(Magick::NorthEastGravity)
+labels.text(20,30, "'+x'")
+labels.gravity(Magick::SouthWestGravity)
+labels.text(20,20, "'+y'")
+labels.gravity(Magick::CenterGravity)
+labels.text(0,0, "Rotation")
+labels.draw(canvas)
+
+#canvas.display
+canvas.write("axes.gif")
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/bilevel_channel.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/bilevel_channel.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/bilevel_channel.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,20 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+include Magick
+
+img = Image.read('images/Flower_Hat.jpg').first
+
+begin
+
+result = img.bilevel_channel(2*MaxRGB/3, RedChannel)
+
+# Substitute the standard "Not Implemented" image
+rescue NotImplementedError
+    result = Magick::Image.read("images/notimplemented.gif").first
+    result.resize!(img.columns, img.rows)
+end
+
+result.write('bilevel_channel.jpg')
+exit
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/blur_image.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/blur_image.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/blur_image.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,12 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#blur_image method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+# Make a blurry copy.
+img = img.blur_image(0.0,2.5)
+
+img.write('blur_image.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/border.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/border.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/border.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,10 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#border method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img.border!(10,10,'rgb(255,110,140)')
+img.write('border.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/bounding_box.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/bounding_box.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/bounding_box.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,42 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+include Magick
+
+img = Image.new(200,200) { self.background_color = "#ffffcc" }
+
+# Draw a blue circle.
+gc = Draw.new
+gc.stroke_width(5)
+gc.stroke("blue")
+gc.fill_opacity(0)
+gc.circle(100,100, 100,150)
+gc.draw(img)
+
+# Get the bounding box. Use the values to draw
+# a gray square surrounding the circle. Highlight
+# the corners with tiny red circles.
+
+bb = img.bounding_box
+gc = Draw.new
+gc.stroke("gray50")
+gc.fill_opacity(0)
+gc.rectangle(bb.x, bb.y, bb.x+bb.width, bb.y+bb.height)
+gc.stroke("red")
+gc.circle(bb.x, bb.y, bb.x+2, bb.y+2)
+gc.circle(bb.x+bb.width, bb.y, bb.x+bb.width+2, bb.y+2)
+gc.circle(bb.x, bb.y+bb.height, bb.x+2, bb.y+bb.height+2)
+gc.circle(bb.x+bb.width, bb.y+bb.height, bb.x+bb.width+2, bb.y+bb.height+2)
+
+
+gc.fill("black")
+gc.stroke("transparent")
+gc.text(bb.x-15, bb.y-5, "\'#{bb.x},#{bb.y}\'")
+gc.text(bb.x+bb.width-15, bb.y-5, "\'#{bb.x+bb.width},#{bb.y}\'")
+gc.text(bb.x-15, bb.y+bb.height+15, "\'#{bb.x},#{bb.y+bb.height}\'")
+gc.text(bb.x+bb.width-15, bb.y+bb.height+15, "\'#{bb.x+bb.width},#{bb.y+bb.height}\'")
+
+
+gc.draw(img)
+
+img.write("bounding_box.gif")
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier1.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier1.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier1.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,40 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(390, 140, Magick::HatchFill.new('white','lightcyan2'))
+gc = Magick::Draw.new
+
+# Draw Bezier curve
+gc.stroke('red')
+gc.stroke_width(2)
+gc.fill_opacity(0)
+gc.bezier(20,120, 20,20, 320, 20, 320,120)
+
+# Draw circles around endpoints
+gc.fill_opacity(0)
+gc.stroke('gray50').stroke_width(1)
+gc.circle(20,120, 23, 123)
+gc.circle(320,120, 323, 123)
+
+# Draw filled circles around control points
+gc.line(20,120, 20,20)
+gc.line(320,120, 320,20)
+gc.fill_opacity(1)
+gc.fill('gray50')
+gc.circle(20,20, 23,23)
+gc.circle(320,20, 323,23)
+
+# Annotate
+gc.fill('black')
+gc.stroke('transparent')
+gc.text(27,120, "'20,120'")
+gc.text(27,20, "'20,20'")
+gc.text(327,120, "'320,120'")
+gc.text(327,20, "'320,20'")
+gc.draw(imgl)
+
+imgl.border!(1, 1, "lightcyan2")
+imgl.write('cbezier1.gif')
+exit(0)
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier2.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier2.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier2.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,40 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(470, 150, Magick::HatchFill.new('white','lightcyan2'))
+gc = Magick::Draw.new
+
+# Draw Bezier curve
+gc.stroke('red')
+gc.stroke_width(3)
+gc.fill_opacity(0)
+gc.bezier(25,125, 100,25, 400,25, 325,125)
+
+# Draw circles around end points
+gc.fill_opacity(0)
+gc.stroke('gray50').stroke_width(1)
+gc.circle(25,125, 28, 128)
+gc.circle(325,125, 328, 123)
+
+# Draw filled circles around control points
+gc.line(25,125, 100,25)
+gc.line(325,125, 400,25)
+gc.fill_opacity(1)
+gc.fill('gray50')
+gc.circle(100,25, 103,28)
+gc.circle(400,25, 403,28)
+
+# Annotate
+gc.fill('black')
+gc.stroke('transparent')
+gc.text(34,125, "'25,125'")
+gc.text(107,25, "'100,25'")
+gc.text(335,125, "'325,125'")
+gc.text(405,25, "'400,25'")
+
+gc.draw(imgl)
+imgl.border!(1,1, "lightcyan2")
+imgl.write('cbezier2.gif')
+exit(0)
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier3.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier3.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier3.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,40 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(540, 200, Magick::HatchFill.new('white','lightcyan2'))
+gc = Magick::Draw.new
+
+# Draw Bezier curve
+gc.stroke('red')
+gc.stroke_width(3)
+gc.fill_opacity(0)
+gc.bezier(100,150, 25,50, 475, 50, 400,150)
+
+# Draw circles around endpoints
+gc.fill_opacity(0)
+gc.stroke('gray50').stroke_width(1)
+gc.circle(100,150, 103, 153)
+gc.circle(400,150, 403, 153)
+gc.line(100,150, 25,50)
+gc.line(400,150, 475,50)
+
+# Draw filled circles around control points
+gc.fill_opacity(1)
+gc.fill('gray50')
+gc.circle(25,50, 28,53)
+gc.circle(475,50, 478,53)
+
+# Annotate
+gc.fill('black')
+gc.stroke('transparent')
+gc.text(107,150, "'100,150'")
+gc.text(30,50,  "'25,50'")
+gc.text(409,150, "'400,150'")
+gc.text(480,50, "'475,50'")
+
+gc.draw(imgl)
+imgl.border!(1,1, "lightcyan2")
+imgl.write('cbezier3.gif')
+exit(0)
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier4.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier4.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier4.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,41 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(390, 360, Magick::HatchFill.new('white','lightcyan2'))
+gc = Magick::Draw.new
+
+# Draw Bezier curve
+gc.stroke('red')
+gc.stroke_width(3)
+gc.fill_opacity(0)
+gc.bezier(20,180, 20,30, 320, 330, 320,180)
+
+# Draw circles around endpoints
+gc.fill_opacity(0)
+gc.stroke('gray50').stroke_width(1)
+gc.circle(20,180, 23, 183)
+gc.circle(320,180, 323, 183)
+
+# Draw filled circles around control points
+gc.line(20,180, 20,30)
+gc.line(320,180, 320,330)
+gc.fill_opacity(1)
+gc.fill('gray50')
+gc.circle(20,30, 23,33)
+gc.circle(320,330, 323,333)
+
+# Annotate
+gc.fill('black')
+gc.stroke('transparent')
+gc.text(29,180, "'20,180'")
+gc.text(29,33,  "'20,30'")
+gc.text(329,330, "'320,330'")
+gc.text(329,180, "'320,180'")
+
+gc.draw(imgl)
+imgl.border!(1,1, "lightcyan2")
+
+imgl.write('cbezier4.gif')
+exit(0)
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier5.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier5.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier5.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,41 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(390, 150, Magick::HatchFill.new('white','lightcyan2'))
+gc = Magick::Draw.new
+
+# Draw Bezier curve
+gc.stroke('red')
+gc.stroke_width(3)
+gc.fill_opacity(0)
+gc.bezier(20,120, 95,20, 245,20, 320,120)
+
+# Draw circles around endpoints
+gc.fill_opacity(0)
+gc.stroke('gray50').stroke_width(1)
+gc.circle(20,120, 23, 123)
+gc.circle(320,120, 323, 123)
+
+# Draw filled circles around control points
+gc.line(20,120, 95,20)
+gc.line(320,120, 245,20)
+gc.fill_opacity(1)
+gc.fill('gray50')
+gc.circle(95,20, 98,23)
+gc.circle(245,20, 248,23)
+
+# Annotate
+gc.fill('black')
+gc.stroke('transparent')
+gc.text(29,120, "'20,120'")
+gc.text(104,20,  "'95,20'")
+gc.text(254,20,  "'245,20'")
+gc.text(329,120, "'320,120'")
+
+gc.draw(imgl)
+imgl.border!(1,1, 'lightcyan2')
+
+imgl.write('cbezier5.gif')
+exit(0)
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier6.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier6.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/cbezier6.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,51 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(400, 300, Magick::HatchFill.new('white','lightcyan2'))
+
+gc = Magick::Draw.new
+
+# Draw Bezier curve
+gc.stroke('red')
+gc.stroke_width(2)
+gc.fill_opacity(0)
+gc.bezier(50,150, 50,50, 200,50, 200,150, 200,250, 350,250, 350,150)
+
+# Draw filled circles for the control points
+gc.fill('gray50')
+gc.stroke('gray50')
+gc.fill_opacity(1)
+gc.circle(50,50, 53,53)
+gc.circle(200,50, 203,53)
+gc.circle(200,250, 203,253)
+gc.circle(350,250, 353,253)
+
+# Draw circles on the points the curve passes through
+gc.fill_opacity(0)
+gc.circle(50,150, 53,153)
+gc.circle(200,150, 203,153)
+gc.circle(350,150, 353,153)
+
+# Draw the gray lines between points and control points
+gc.line(50,50, 50,150)
+gc.line(200,50, 200,250)
+gc.line(350,150, 350,250)
+
+# Annotate
+gc.fill('black')
+gc.stroke('transparent')
+gc.text(30,170, "'50,150'")
+gc.text(30, 40, "'50,50'")
+gc.text(180,40, "'200,50'")
+gc.text(210,155,"'200,150'")
+gc.text(180,270,"'200,250'")
+gc.text(330,270,"'350,250'")
+gc.text(330,140,"'350,150'")
+gc.draw(imgl)
+
+imgl.border!(1,1, 'lightcyan2')
+
+imgl.write("cbezier6.gif")
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/channel.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/channel.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/channel.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,26 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+include Magick
+
+img = Image.read('images/Flower_Hat.jpg').first
+imgs = ImageList.new
+
+imgs << img
+imgs << img.channel(RedChannel)
+imgs.cur_image['Label'] = 'RedChannel'
+imgs <<  img.channel(GreenChannel)
+imgs.cur_image['Label'] = 'GreenChannel'
+imgs << img.channel(BlueChannel)
+imgs.cur_image['Label'] = 'BlueChannel'
+
+result = imgs.montage {
+    self.tile = "2x2"
+    self.background_color = 'black'
+    self.stroke = 'transparent'
+    self.fill = 'white'
+    self.geometry = Geometry.new(img.columns/2, img.rows/2, 5, 5)
+    }
+
+result.write('channel.jpg')
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/charcoal.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/charcoal.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/charcoal.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,12 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#charcoal method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img = img.charcoal(0.75)
+
+img.write('charcoal.jpg')
+
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/chop.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/chop.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/chop.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,29 @@
+#!/usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#chop method
+
+img = Magick::Image.read('images/Flower_Hat.jpg')[0]
+
+# Chop the specified rectangle out of the img.
+chopped = img.chop(0, img.rows/2, img.columns/2, img.rows)
+
+# Make a "before" image by highlighting the chopped area.
+gc = Magick::Draw.new
+gc.fill('white')
+gc.stroke('transparent')
+gc.fill_opacity(0.25)
+gc.rectangle(0, img.rows/2, img.columns/2, img.rows)
+gc.draw(img)
+
+img.write('chop_before.jpg')
+
+# Create a image to use as a background for
+# the after image. Make the chopped image the
+# same size as before the chop.
+bg = Magick::Image.new(img.columns, img.rows)
+
+chopped = bg.composite(chopped, Magick::NorthEastGravity, Magick::OverCompositeOp)
+
+chopped.write('chop_after.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/circle.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/circle.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/circle.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,31 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(250, 250, Magick::HatchFill.new('white','LightCyan2'))
+
+gc = Magick::Draw.new
+
+# Draw the circle
+gc.fill_opacity(0)
+gc.stroke('red').stroke_width(3)
+gc.circle(125,125, 25, 125)
+
+# Draw a little gray circle on the perimeter
+gc.stroke_width(1)
+gc.stroke('gray50')
+gc.circle(25,125,28,128)
+
+# Draw a dot at the center
+gc.fill_opacity(1)
+gc.circle(125,125, 128,128)
+
+# Annotate the dots
+gc.fill('black')
+gc.stroke('transparent')
+gc.text(132,125, "'125,125'")
+gc.text(32,125, "'25,125'")
+gc.draw(imgl)
+
+imgl.border!(1,1, 'lightcyan2')
+imgl.write("circle.gif")

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/clip_path.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/clip_path.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/clip_path.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,56 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+
+points = [145, 65, 174,151, 264,151, 192,205,
+          218,291, 145,240,  72,291,  98,205,
+           26,151, 116,151]
+
+pr = Magick::Draw.new
+
+# Define a clip-path.
+# The name of the clip-path is "example"
+pr.define_clip_path('example') {
+    pr.polygon(*points)
+    }
+
+# Enable the clip-path
+pr.clip_path('example')
+
+# Composite the Flower Hat image over
+# the background using the clip-path
+girl = Magick::ImageList.new
+girl.read("images/Flower_Hat.jpg")
+
+cols = rows = nil
+
+# Our final image is about 290 pixels wide, so here
+# we widen our picture to fit. The change_geometry
+# method will adjust the height proportionately.
+
+girl.change_geometry("290") do |c,r|
+    pr.composite(0,0, c, r, girl)
+    cols = c
+    rows = r
+end
+
+# Create a canvas to draw on, a bit bigger than the star.
+canvas = Magick::Image.new(cols, rows)
+
+star = Magick::Draw.new
+star.stroke('black')
+star.fill('black')
+star.polygon(*points)
+star.draw(canvas)
+canvas = canvas.blur_image(0, 20)
+
+# Draw the star over the background
+pr.draw(canvas)
+
+# Crop away all the solid white border pixels.
+crop = canvas.bounding_box
+canvas.crop!(crop.x, crop.y, crop.width, crop.height)
+
+canvas.write("clip_path.gif")
+
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/coalesce.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/coalesce.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/coalesce.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,60 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+buttons = Magick::ImageList.new
+
+# Read 25 alphabet image files, scale to 1/4 size
+letter = 'A'
+26.times {
+    if letter != 'M'            # "M" is not the same size as the other letters
+        tiny = Magick::Image.read('images/Button_' + letter + '.gif').first
+        tiny.scale! 0.25
+        buttons << tiny
+    end
+    letter.succ!
+    }
+
+# Create a image that will hold the alphabet images in 5 rows and 5 columns.
+cells = Magick::ImageList.new
+cells.new_image buttons.columns*5, buttons.rows*5 do
+    self.background_color = "#000000ff"     # transparent
+    end
+cells.matte = true
+
+offset = Magick::Rectangle.new(0,0,0,0)
+
+# Create 2 arrays from which we can randomly choose row,col pairs
+row = [0]*5 + [1]*5 + [2]*5 + [3]*5 + [4]*5
+col = (0..4).to_a * 5
+
+# The coalesce method composites the 2nd image over the 1st, the 3rd image
+# over the result, and so forth, respecting the page offset of the images.
+
+srand 1234
+25.times { |i|
+    # Randomly select a row and column for this copy of the "tinya" image.
+    # Compute the x,y position of this copy in pixels and store the
+    # result in the image's page attribute. Append a copy of the image
+    # to the image array in "a".
+    n = rand row.length
+    x = row.delete_at n
+    y = col.delete_at n
+
+    button = buttons[i]
+    offset.x = x*button.columns
+    offset.y = y*button.rows
+    button.page = offset
+    button.matte = true
+    cells << button
+    }
+
+puts "This may take a few seconds..."
+cells.delay = 10
+cells.iterations = 10000
+res = cells.coalesce
+res.write "coalesce_anim.gif"
+res[25].write "coalesce.gif"
+exit
+
+
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/color_fill_to_border.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/color_fill_to_border.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/color_fill_to_border.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,29 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#color_fill_to_border method
+
+before = Magick::Image.new(200,200) {
+    self.background_color = 'white'
+    self.border_color = 'black'
+    }
+before.border!(1,1,'black')
+
+circle = Magick::Draw.new
+circle.fill('transparent')
+circle.stroke('black')
+circle.stroke_width(2)
+circle.circle(100,100,180,100)
+circle.fill('plum1')
+circle.stroke('transparent')
+circle.circle( 60,100, 40,100)
+circle.circle(140,100,120,100)
+circle.circle(100, 60,100, 40)
+circle.circle(100,140,100,120)
+circle.draw(before)
+
+before.write('color_fill_to_border_before.gif')
+
+after = before.color_fill_to_border(100,100, 'aquamarine')
+after.write('color_fill_to_border_after.gif')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/color_floodfill.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/color_floodfill.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/color_floodfill.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,28 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#color_floodfill method
+
+before = Magick::Image.new(200,200) { self.background_color = 'white' }
+before.border!(1,1,'black')
+
+circle = Magick::Draw.new
+circle.fill('transparent')
+circle.stroke_width(2)
+circle.stroke('black')
+circle.circle(100,100,180,100)
+circle.fill('plum1')
+circle.stroke('transparent')
+circle.circle( 60,100, 40,100)
+circle.circle(140,100,120,100)
+circle.circle(100, 60,100, 40)
+circle.circle(100,140,100,120)
+circle.draw(before)
+
+before.write('color_floodfill_before.gif')
+
+aquamarine = Magick::Pixel.from_color('aquamarine')
+after = before.color_floodfill(100,100, aquamarine)
+
+after.write('color_floodfill_after.gif')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/color_histogram.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/color_histogram.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/color_histogram.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,60 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+include Magick
+
+NUM_COLORS = 256
+HIST_HEIGHT = 200
+
+img = Image.read('images/Hot_Air_Balloons_H.jpg').first
+img = img.quantize(NUM_COLORS)
+
+begin
+    hist = img.color_histogram
+rescue NotImplementedError
+    img = Image.read('images/notimplemented.gif').first
+    img.write('color_histogram.gif')
+    exit
+end
+
+# sort pixels by increasing count
+begin
+    pixels = hist.keys.sort_by {|pixel| hist[pixel] }
+rescue NameError    # No sort_by?
+    pixels = hist.keys.sort { |p, q| hist[p] <=> hist[q] }
+end
+
+scale = HIST_HEIGHT / (hist.values.max*1.025)   # put 2.5% air at the top
+
+gc = Draw.new
+gc.stroke_width(1)
+gc.affine(1, 0, 0, -scale, 0, HIST_HEIGHT)
+
+# handle images with fewer than NUM_COLORS colors
+start = NUM_COLORS - img.number_colors
+
+pixels.each { |pixel|
+    gc.stroke(pixel.to_color)
+    gc.line(start, 0, start, hist[pixel])
+    start = start.succ
+}
+
+hatch = HatchFill.new("white", "gray95")
+canvas = Image.new(NUM_COLORS, HIST_HEIGHT, hatch)
+gc.draw(canvas)
+
+text = Draw.new
+text.annotate(canvas, 0, 0, 0, 20, "Color Frequency\nHistogram") {
+    self.pointsize = 10
+    self.gravity = NorthGravity
+    self.stroke = 'transparent'
+    }
+
+canvas.border!(1, 1, "white")
+canvas.border!(1, 1, "black")
+canvas.border!(3, 3, "white")
+#canvas.display
+canvas.write("color_histogram.gif")
+
+exit
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/color_reset.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/color_reset.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/color_reset.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#color_reset! method
+
+f = Magick::Image.new(100,100) { self.background_color = 'white' }
+red = Magick::Pixel.from_color('red')
+f.color_reset!(red)
+#f.display
+f.write('color_reset.gif')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/colorize.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/colorize.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/colorize.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,16 @@
+#!/usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#colorize method by converting
+# a full-color image to "sepia-tone"
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+# Convert the color image to monochrome
+mono = img.quantize(256, Magick::GRAYColorspace)
+
+# Colorize with a 30% blend of a brownish-orange color
+colorized = mono.colorize(0.30, 0.30, 0.30, '#cc9933')
+
+colorized.write('colorize.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/colors.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/colors.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/colors.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,65 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+include Magick
+
+puts("Creating colors.miff. This may take a few seconds...")
+
+colors = ImageList.new
+
+# Add a row of "null" colors so we'll have
+# room to add the title at the top.
+4.times { colors.read('null:') }
+
+puts("\tCreating color swatches...")
+
+# Create a 200x25 image for each named color.
+# Label with the name, RGB values, and compliance type.
+colors { |c|
+    if c.name !~ /grey/ then    # omit SVG 'grays'
+        colors.new_image(200, 25) {
+            self.background_color = c.color
+            self.border_color = 'gray50'
+            }
+        rgb  = sprintf('#%02x%02x%02x', c.color.red&0xff,  c.color.green&0xff, c.color.blue&0xff)
+        rgb += sprintf('%02x', c.color.opacity&0xff) if c.color.opacity != 0
+        m = /(.*?)Compliance/.match c.compliance.to_s
+        colors.cur_image['Label'] = "#{c.name} (#{rgb}) #{m[1]}"
+    end
+}
+
+puts("\tCreating montage...")
+
+# Montage. Each image will have 40 tiles.
+# There will be 16 images.
+montage = colors.montage {
+    self.geometry = '200x25+10+5'
+    self.gravity = CenterGravity
+    self.tile = '4x10'
+    self.background_color = 'black'
+    self.border_width = 1
+    self.fill = 'white'
+    self.stroke = 'transparent'
+}
+
+# Add the title at the top, over the 'null:'
+# tiles we added at the very beginning.
+title = Draw.new
+title.annotate(montage, 0,0,0,20, 'Named Colors') {
+    self.font_family = 'Helvetica'
+    self.fill = 'white'
+    self.stroke = 'transparent'
+    self.pointsize = 32
+    self.font_weight = BoldWeight
+    self.gravity = NorthGravity
+}
+
+puts("\tWriting ./colors.miff")
+montage.each { |f| f.compression = ZipCompression }
+montage.write('colors.miff')
+
+# Make a small sample of the full montage to display in the HTML file.
+sample = montage[8].crop(55, 325, 495, 110)
+sample.page = Rectangle.new(495,110)
+sample.write('colors.gif')
+
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/composite.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/composite.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/composite.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,135 @@
+#! /usr/local/bin/ruby -w
+
+# Demonstrate the effects of various composite operators.
+# Based on ImageMagick's composite test.
+
+require 'RMagick'
+include Magick
+
+ROWS = 70
+COLS = 70
+COLOR_A = "#999966"
+COLOR_B = "#990066"
+
+img = Image.new(COLS, ROWS)
+triangle = Draw.new
+triangle.fill(COLOR_A)
+triangle.stroke('transparent')
+triangle.polygon(0,0, COLS,0, 0,ROWS, 0,0)
+triangle.draw(img)
+image_A = img.transparent('white', TransparentOpacity)
+image_A['Label'] = 'A'
+
+img = Image.new(COLS, ROWS)
+triangle = Draw.new
+triangle.fill(COLOR_B)
+triangle.stroke('transparent')
+triangle.polygon(0,0, COLS,ROWS, COLS,0, 0,0)
+triangle.draw(img)
+image_B = img.transparent('white', TransparentOpacity)
+image_B['Label'] = 'B'
+
+list = ImageList.new
+null = Image.read("xc:white") { self.size = Geometry.new(COLS,ROWS) }
+null = null.first.transparent('white', TransparentOpacity)
+null.border_color = 'transparent'
+granite =  Image.read("granite:")
+
+list << null.copy
+list << image_A
+list << image_B
+list << null.copy
+
+
+list << image_B.composite(image_A, CenterGravity, OverCompositeOp)
+list.cur_image['Label'] = 'A over B'
+list << image_A.composite(image_B, CenterGravity, OverCompositeOp)
+list.cur_image['Label'] = 'B over A'
+
+list << image_B.composite(image_A, CenterGravity, InCompositeOp)
+list.cur_image['Label'] = 'A in B'
+list << image_A.composite(image_B, CenterGravity, InCompositeOp)
+list.cur_image['Label'] = 'B in A'
+
+list << image_B.composite(image_A, CenterGravity, OutCompositeOp)
+list.cur_image['Label'] = 'A out B'
+list << image_A.composite(image_B, CenterGravity, OutCompositeOp)
+list.cur_image['Label'] = 'B out A'
+
+list << image_B.composite(image_A, CenterGravity, AtopCompositeOp)
+list.cur_image['Label'] = 'A atop B'
+list << image_A.composite(image_B, CenterGravity, AtopCompositeOp)
+list.cur_image['Label'] = 'B atop A'
+
+list << image_B.composite(image_A, CenterGravity, XorCompositeOp)
+list.cur_image['Label'] = 'A xor B'
+
+list << image_B.composite(image_A, CenterGravity, MultiplyCompositeOp)
+list.cur_image['Label'] = 'A multiply B'
+
+list << image_B.composite(image_A, CenterGravity, ScreenCompositeOp)
+list.cur_image['Label'] = 'A screen B'
+
+list << image_B.composite(image_A, CenterGravity, DarkenCompositeOp)
+list.cur_image['Label'] = 'A darken B'
+
+list << image_B.composite(image_A, CenterGravity, LightenCompositeOp)
+list.cur_image['Label'] = 'A lighten B'
+
+list << image_B.composite(image_A, CenterGravity, PlusCompositeOp)
+list.cur_image['Label'] = 'A plus B'
+
+list << image_B.composite(image_A, CenterGravity, MinusCompositeOp)
+list.cur_image['Label'] = 'A minus B'
+
+list << image_B.composite(image_A, CenterGravity, AddCompositeOp)
+list.cur_image['Label'] = 'A add B'
+
+list << image_B.composite(image_A, CenterGravity, SubtractCompositeOp)
+list.cur_image['Label'] = 'A subtract B'
+
+list << image_B.composite(image_A, CenterGravity, DifferenceCompositeOp)
+list.cur_image['Label'] = 'A difference B'
+
+list << image_B.composite(image_A, CenterGravity, HueCompositeOp)
+list.cur_image['Label'] = 'A hue B'
+
+list << image_B.composite(image_A, CenterGravity, SaturateCompositeOp)
+list.cur_image['Label'] = 'A saturate B'
+
+list << image_B.composite(image_A, CenterGravity, LuminizeCompositeOp)
+list.cur_image['Label'] = 'A luminize B'
+
+list << image_B.composite(image_A, CenterGravity, ColorizeCompositeOp)
+list.cur_image['Label'] = 'A colorize B'
+
+list << image_B.composite(image_A, CenterGravity, BumpmapCompositeOp)
+list.cur_image['Label'] = 'A bumpmap B'
+
+list << image_B.composite(image_A, CenterGravity, DissolveCompositeOp)
+list.cur_image['Label'] = 'A dissolve B'
+
+list << image_B.composite(image_A, CenterGravity, ThresholdCompositeOp)
+list.cur_image['Label'] = 'A threshold B'
+
+list << image_B.composite(image_A, CenterGravity, ModulateCompositeOp)
+list.cur_image['Label'] = 'A modulate B'
+
+list << image_A.composite(image_B, CenterGravity, ModulateCompositeOp)
+list.cur_image['Label'] = 'B modulate A'
+
+list << image_B.composite(image_A, CenterGravity, OverlayCompositeOp)
+list.cur_image['Label'] = 'A overlay B'
+
+montage = list.montage {
+    self.geometry = Geometry.new(COLS, ROWS, 3, 3)
+    rows = (list.size+3) / 4
+    self.tile = Geometry.new(4, rows)
+    self.texture = granite[0]
+    self.fill = 'white'
+    self.stroke = 'transparent'
+}
+
+montage.write('composite.gif')
+exit
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/contrast.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/contrast.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/contrast.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,37 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#contrast method
+
+img = Magick::ImageList.new('images/Flower_Hat.jpg')
+img.resize!(0.5)
+
+# Prepare to label each image with a number from 1 to 4
+legend = Magick::Draw.new
+legend.font_family = 'Helvetica'
+legend.stroke = 'transparent'
+legend.pointsize = 12
+legend.gravity = Magick::SouthEastGravity
+
+# Add 3 images, each one having slightly less contrast
+f = 1
+3.times {
+    img << img.contrast
+
+    # Annotate the previous image
+    legend.annotate(img[f-1], 0,0,7,10, f.to_s)
+    f += 1
+    }
+
+# Annotate the last image
+legend.annotate(img, 0,0,7,10, f.to_s)
+
+# Montage into a single image
+imgs = img.montage {
+    self.geometry = Magick::Geometry.new(img.columns, img.rows)
+    self.tile = "2x2"
+    }
+
+imgs.write('contrast.jpg')
+#imgs.display
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/crop.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/crop.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/crop.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,31 @@
+#!/usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#crop method
+
+img = Magick::Image.read('images/Flower_Hat.jpg')[0]
+
+# Crop the specified rectangle out of the img.
+chopped = img.crop(23, 81, 107, 139)
+
+# Go back to the original and highlight the area
+# corresponding to the retained rectangle.
+rect = Magick::Draw.new
+rect.stroke('transparent')
+rect.fill('white')
+rect.fill_opacity(0.25)
+rect.rectangle(23, 81, 107+23, 139+81)
+rect.draw(img)
+
+img.write('crop_before.jpg')
+
+# Create a image to use as a background for
+# the "after" image.
+bg = Magick::Image.new(img.columns, img.rows)
+
+# Composite the the "after" (chopped) image on the background
+bg = bg.composite(chopped, 23, 81, Magick::OverCompositeOp)
+
+bg.write('crop_after.jpg')
+
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/crop_with_gravity.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/crop_with_gravity.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/crop_with_gravity.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,46 @@
+#! /usr/local/bin/ruby -w
+
+#=======================================================#
+# Thanks to Robert Wagner for the idea of allowing a    #
+# GravityType instead of the x- and y-offset arguments! #
+#=======================================================#
+
+# Demo the use of the GravityType argument to Image#crop.
+
+require 'RMagick'
+include Magick
+
+shorts = Image.read('images/Shorts.jpg').first
+
+regwidth = shorts.columns/2
+regheight = shorts.rows/2
+
+mask = Image.new(regwidth, regheight) { self.background_color = 'white'}
+mask.opacity = 0.50 * TransparentOpacity
+
+black = Image.new(shorts.columns, shorts.rows) {self.background_color = 'black'}
+pairs = ImageList.new
+
+[NorthWestGravity, NorthGravity, NorthEastGravity,
+ WestGravity, CenterGravity, EastGravity,
+ SouthWestGravity, SouthGravity, SouthEastGravity].each do |gravity|
+    pattern = shorts.composite(mask, gravity, OverCompositeOp)
+    cropped = shorts.crop(gravity, regwidth, regheight)
+    result = black.composite(cropped, gravity, OverCompositeOp)
+    result.border_color = "white"
+    pairs << pattern
+    pairs << result
+end
+
+# Montage into a single image
+montage = pairs.montage {
+    self.geometry = "#{pairs.columns}x#{pairs.rows}+0+0"
+    self.tile = "6x3"
+    self.border_width = 1
+    }
+montage.write('crop_with_gravity.miff')
+#montage.display
+
+
+
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/cycle_colormap.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/cycle_colormap.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/cycle_colormap.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,21 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#cycle_colormap method
+
+balloons = Magick::Image.read('images/Hot_Air_Balloons.jpg').first
+balloons = balloons.quantize(256, Magick::RGBColorspace)
+
+jump = balloons.colors / 10
+
+animation = Magick::ImageList.new
+animation[0] = balloons
+
+5.times { animation << animation.cycle_colormap(jump) }
+4.times { animation << animation.cycle_colormap(-jump) }
+
+animation.delay=20
+animation.iterations = 10000
+#animation.animate
+animation.write('cycle_colormap.gif')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/demo.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/demo.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/demo.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,324 @@
+#!/usr/local/bin/ruby -w
+#
+# Simple demo program for RMagick
+#
+# Concept and algorithms lifted from Magick++ demo script written
+# by Bob Friesenhahn.
+#
+require 'RMagick'
+include Magick
+
+#
+#   RMagick version of Magick++/demo/demo.cpp
+#
+
+Font = "Helvetica"
+
+begin
+    puts "Read images..."
+
+    model = ImageList.new("images/model.miff")
+    model.border_color = "black"
+    model.background_color = "black"
+    model.cur_image[:Label] = "RMagick"
+
+    smile = ImageList.new("images/smile.miff")
+    smile.border_color = "black"
+    smile.cur_image[:Label] = "Smile"
+
+    #
+    #   Create image stack
+    #
+    puts "Creating thumbnails"
+
+    # Construct an initial list containing five copies of a null
+    # image. This will give us room to fit the logo at the top.
+    # Notice I specify the width and height of the images via the
+    # optional "size" attribute in the parm block associated with
+    # the read method. There are two more examples of this, below.
+    example = ImageList.new
+    5.times { example.read("NULL:black") { self.size = "70x70"} }
+
+    puts "   add noise..."
+    example << model.add_noise(LaplacianNoise)
+    example.cur_image[:Label] = "Add Noise"
+
+    puts "   annotate..."
+    example << model.cur_image.copy
+    example.cur_image[:Label] = "Annotate"
+    draw = Draw.new
+    draw.annotate(example, 0, 0, 0, 20, "RMagick") {
+        self.pointsize = 18;
+        self.font = Font;
+        self.stroke = "gold"
+        self.fill = "gold"
+        self.gravity = NorthGravity
+        }
+
+    puts "   blur..."
+    example << model.blur_image(0.0, 1.5)
+    example.cur_image[:Label] = "Blur"
+
+    puts "   border..."
+    example << model.border(6, 6, "gold")
+    example.cur_image[:Label] = "Border"
+
+    puts "   channel..."
+    example << model.channel(RedChannel)
+    example.cur_image[:Label] = "Channel"
+
+    puts "   charcoal..."
+    example << model.charcoal
+    example.cur_image[:Label] = "Charcoal"
+
+    puts "   composite..."
+    example << model.composite(smile, 35, 65, OverCompositeOp)
+    example.cur_image[:Label] = "Composite"
+
+    puts "   contrast..."
+    example << model.contrast(false)
+    example.cur_image[:Label] = "Contrast"
+
+    puts "   convolve..."
+    kernel = [ 1, 1, 1, 1, 4, 1, 1, 1, 1 ]
+    example << model.convolve(3, kernel)
+    example.cur_image[:Label] = "Convolve"
+
+    puts "   crop..."
+    example << model.crop(25, 50, 80, 80)
+    example.cur_image[:Label] = "Crop"
+
+    puts "   despeckle..."
+    example << model.despeckle
+    example.cur_image[:Label] = "Despeckle"
+
+    puts "   draw..."
+    example << model.cur_image.copy
+    example.cur_image[:Label] = "Draw"
+    gc = Draw.new
+    gc.fill "black"
+    gc.fill_opacity 0
+    gc.stroke "gold"
+    gc.stroke_width 2
+    gc.circle 60,90, 60,120
+    gc.draw(example)
+
+    puts "   edge..."
+    example << model.edge(0)
+    example.cur_image[:Label] = "Detect Edges"
+
+    puts "   emboss..."
+    example << model.emboss
+    example.cur_image[:Label] = "Emboss"
+
+    puts "   equalize..."
+    example << model.equalize
+    example.cur_image[:Label] = "Equalize"
+
+    puts "   explode..."
+    example << model.implode(-1)
+    example.background_color = "#000000ff"
+    example.cur_image[:Label] = "Explode"
+
+    puts "   flip..."
+    example << model.flip
+    example.cur_image[:Label] = "Flip"
+
+    puts "   flop..."
+    example << model.flop
+    example.cur_image[:Label] = "Flop"
+
+    puts "   frame..."
+    example << model.frame
+    example.cur_image[:Label] = "Frame"
+
+    puts "   gamma..."
+    example << model.gamma_correct(1.6)
+    example.cur_image[:Label] = "Gamma"
+
+    puts "   gaussian blur..."
+    example << model.gaussian_blur(1, 1.5)
+    example.cur_image[:Label] = "Gaussian Blur"
+
+    # To add an Image in one of ImageMagick's built-in formats,
+    # call the read method. The filename specifies the format and
+    # any parameters it needs. The gradient format can be created in
+    # any size. Specify the desired size by assigning it, in the form
+    # "WxH", to the optional "size" attribute in the block associated
+    # with the read method. Here we create a gradient image that is
+    # the same size as the model image.
+    puts "   gradient..."
+    example.read("gradient:#20a0ff-#ffff00") {
+        self.size = Geometry.new(model.columns, model.rows)
+        }
+    example.cur_image[:Label] = "Gradient"
+
+    puts "   grayscale..."
+    example << model.cur_image.quantize(256, GRAYColorspace)
+    example.cur_image[:Label] = "Grayscale"
+
+    puts "   implode..."
+    example << model.implode(0.5)
+    example.cur_image[:Label] = "Implode"
+
+    puts "   median filter..."
+    example << model.median_filter(0)
+    example.cur_image[:Label] = "Median Filter"
+
+    puts "   modulate..."
+    example << model.modulate(1.10, 1.10, 1.10)
+    example.cur_image[:Label] = "Modulate"
+
+    puts "   monochrome..."
+    example << model.cur_image.quantize(2, GRAYColorspace, false)
+    example.cur_image[:Label] = "Monochrome"
+
+    puts "   negate..."
+    example << model.negate
+    example.cur_image[:Label] = "Negate"
+
+    puts "   normalize..."
+    example << model.normalize
+    example.cur_image[:Label] = "Normalize"
+
+    puts "   oil paint..."
+    example << model.oil_paint(3.0)
+    example.cur_image[:Label] = "Oil Paint"
+
+    # The plasma format is very similar to the gradient format, above.
+    puts "   plasma..."
+    example.read("plasma:fractal") {
+        self.size = Geometry.new(model.columns, model.rows)
+        }
+    example.cur_image[:Label] = "Plasma"
+
+    puts "   quantize..."
+    example << model.cur_image.quantize
+    example.cur_image[:Label] = "Quantize"
+
+    puts "   raise..."
+    example << model.raise
+    example.cur_image[:Label] = "Raise"
+
+    puts "   reduce noise..."
+    example << model.reduce_noise(3.0)
+    example.cur_image[:Label] = "Reduce Noise"
+
+    puts "   resize..."
+    example << model.resize(0.50)
+    example.cur_image[:Label] = "Resize"
+
+    puts "   roll..."
+    example << model.roll(20, 10)
+    example.cur_image[:Label] = "Roll"
+
+    puts "   rotate..."
+    example << model.rotate(45).transparent("black")
+    example.cur_image[:Label] = "Rotate"
+
+    puts "   scale..."
+    example << model.scale(0.60)
+    example.cur_image[:Label] = "Scale"
+
+    puts "   segment..."
+    example << model.segment
+    example.cur_image[:Label] = "Segment"
+
+    puts "   shade..."
+    example << model.shade(false, 30, 30)
+    example.cur_image[:Label] = "Shade"
+
+    puts "   sharpen..."
+    example << model.sharpen(0.0, 1.0)
+    example.cur_image[:Label] = "Sharpen"
+
+    puts "   shave..."
+    example << model.shave(10, 10)
+    example.cur_image[:Label] = "Shave"
+
+    puts "   shear..."
+    example << model.shear(45, 45).transparent("black")
+    example.cur_image[:Label] = "Shear"
+
+    puts "   spread..."
+    example << model.spread(3)
+    example.cur_image[:Label] = "Spread"
+
+    puts "   solarize..."
+    example << model.solarize(50.0)
+    example.cur_image[:Label] = "Solarize"
+
+    puts "   swirl..."
+    temp = model.copy
+    temp.background_color = "#000000ff"
+    example << temp.swirl(90)
+    example.cur_image[:Label] = "Swirl"
+
+    puts "   unsharp mask..."
+    example << model.unsharp_mask(0.0, 1.0, 1.0, 0.05)
+    example.cur_image[:Label] = "Unsharp Mask"
+
+    puts "   wave..."
+    temp = model.copy
+    temp.cur_image[:Label] = "Wave"
+    temp.matte = true
+    temp.background_color = "#000000ff"
+    example << temp.wave(25, 150)
+
+    #
+    #   Create image montage - notice the optional
+    #   montage parameters are supplied via a block
+    #
+
+    puts "Montage images..."
+
+    montage = example.montage {
+        self.geometry = "130x194+10+5>"
+        self.gravity = CenterGravity
+        self.border_width = 1
+        rows = (example.size + 4) / 5
+        self.tile = Geometry.new(5,rows)
+        self.compose = OverCompositeOp
+
+        # Use the ImageMagick built-in "granite" format
+        # as the background texture.
+
+#       self.texture = Image.read("granite:").first
+        self.background_color = "white"
+        self.font = Font;
+        self.pointsize = 18;
+        self.fill = "#600"
+        self.filename = "RMagick Demo"
+#       self.shadow = true
+#       self.frame = "20x20+4+4"
+    }
+
+    # Add the ImageMagick logo to the top of the montage. The "logo:"
+    # format is a fixed-size image, so I don't need to specify a size.
+    puts "Adding logo image..."
+    logo = Image.read("logo:").first
+    if /GraphicsMagick/.match Magick_version then
+        logo.resize!(200.0/logo.rows)
+    else
+        logo.crop!(98, 0, 461, 455).resize!(0.45)
+    end
+
+    # Create a new Image for the composited montage and logo
+    montage_image = ImageList.new
+    montage_image << montage.composite(logo, 245, 0, OverCompositeOp)
+
+    # Write the result to a file
+    montage_image.compression = RunlengthEncodedCompression
+    montage_image.matte = false
+    puts "Writing image ./rm_demo_out.miff"
+    montage_image.write "rm_demo_out.miff"
+
+    # Uncomment the following lines to display image to screen
+    # puts "Displaying image..."
+    # montage_image.display
+
+rescue
+    puts "Caught exception: #{$!}"
+end
+
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/drawcomp.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/drawcomp.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/drawcomp.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,42 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+
+# Read the snake image file and scale to 200 pixels high.
+begin
+    snake = Magick::ImageList.new("images/Snake.wmf")
+    snake.scale!(200.0/snake.rows)
+
+    # Read the coffee cup image and scale to 200 pixels high.
+    coffee = Magick::ImageList.new("images/Coffee.wmf")
+    coffee.scale!(200.0/coffee.rows)
+
+    # We want the "no" symbol to be a little smaller.
+    # Read and scale to 150 pixels high.
+    sign = Magick::ImageList.new("images/No.wmf")
+    sign.scale!(150.0/sign.rows)
+
+    # Change the white pixels in the sign to transparent.
+    sign = sign.matte_replace(0,0)
+
+    # Create a "nosnake" draw object. Add a composite
+    # primitive that composites the "no" symbol over
+    # the snake. Draw it.
+    nosnake = Magick::Draw.new
+    nosnake.composite((snake.columns-sign.columns)/2,
+                      (snake.rows-sign.rows)/2, 0, 0, sign)
+    nosnake.draw(snake)
+
+    # Repeat for the coffee cup.
+    nocoffee = Magick::Draw.new
+    nocoffee.composite((coffee.columns-sign.columns)/2,
+                       (coffee.columns-sign.columns)/2, 0, 0, sign)
+    nocoffee.draw(coffee)
+
+    coffee.write("drawcomp1.gif")
+    snake.write("drawcomp2.gif")
+
+rescue Magick::ImageMagickError
+    puts "#{$0}: ImageMagickError - #{$!}"
+end
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/drop_shadow.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/drop_shadow.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/drop_shadow.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,60 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Add a drop shadow to a text string. This example
+# uses a 3-image animation to show each step of the
+# process
+
+Rows = 60
+Cols = 250
+Text = 'Ruby rocks!'
+
+# This imagelist will contain the animation frames
+anim = Magick::ImageList.new
+
+ex = Magick::Image.new(Cols, Rows)
+
+# Create a Draw object to draw the text with. Most of the text
+# attributes are shared between the shadow and the foreground.
+
+text = Magick::Draw.new
+text.gravity = Magick::CenterGravity
+text.pointsize = 36
+text.font_weight = Magick::BoldWeight
+text.font_style = Magick::ItalicStyle
+text.stroke = 'transparent'
+
+# Draw the shadow text first. The color is a very light gray.
+# Position the text to the right and down.
+text.annotate(ex, 0,0,2,2, Text) {
+    self.fill = 'gray60'
+    }
+
+# Save the first frame of the animation.
+anim << ex.copy
+
+# Blur the shadow. Save a copy of the image as the 2nd frame.
+ex = ex.blur_image(0,3)
+anim << ex.copy
+
+# Add the foreground text in solid black. Position it
+# to the left and up from the shadow text.
+text.annotate(ex, 0,0,-1,-1, Text) {
+    self.fill = 'maroon'
+    }
+
+# Save yet another copy of the image as the 3rd frame.
+anim << ex.copy
+
+# Set the delay between frames to 1 second.
+anim.delay = 100
+
+# Set the delay after the last frame to 3 seconds.
+anim.cur_image.delay = 300
+
+# Iterate forever.
+anim.iterations = 0
+
+#anim.animate
+anim.write('drop_shadow.gif')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/edge.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/edge.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/edge.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#edge method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img = img.edge(5)
+
+img.write('edge.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/ellipse.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/ellipse.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/ellipse.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,43 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(360, 250, Magick::HatchFill.new('white','LightCyan2'))
+
+gc = Magick::Draw.new
+
+gc.fill_opacity(0)
+gc.stroke('red').stroke_width(3)
+
+# Draw ellipse
+gc.ellipse(180,125, 150,75, 0, 270)
+
+# Draw horizontal width line
+gc.stroke('gray50').stroke_width(1)
+gc.line(180-150, 125, 180, 125)
+
+# Draw vertical height line
+gc.line(180, 125-75, 180, 125)
+gc.fill_opacity(0)
+
+# Draw arcStart circle
+gc.circle(180+150, 125, 180+150+3, 125+3)
+
+# Draw arcEnd circle
+gc.circle(180, 125-75, 180+3, 125-75+3)
+
+# Annotate
+gc.fill_opacity(1)
+gc.circle(180,125, 183,128)
+gc.fill('black')
+gc.stroke('transparent')
+gc.text(187,125, "'180,125'")
+gc.text(253, 118, "'Start 0 degrees'")
+gc.text(187, 50, "'End 270 degrees'")
+gc.text(120, 100, "'Height=75'")
+gc.text(85, 140, "'Width=150'")
+gc.draw(imgl)
+
+imgl.border!(1,1, "LightCyan2")
+
+imgl.write("ellipse.gif")

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/emboss.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/emboss.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/emboss.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#edge method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img = img.emboss
+
+img.write('emboss.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/enhance.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/enhance.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/enhance.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,28 @@
+#!/usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#enhance method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+img = img.add_noise(Magick::UniformNoise)
+
+eimg = img.enhance
+
+# Zoom in so we can see the change
+img.resize!(3)
+eimg.resize!(3)
+
+# Make a before-and-after composite
+eimg.crop!(Magick::EastGravity, eimg.columns/2, eimg.rows)
+img = img.composite(eimg, Magick::EastGravity, Magick::OverCompositeOp)
+
+# Draw a black line between the before and after parts.
+line = Magick::Draw.new
+line.line(img.columns/2, 0, img.columns/2, img.rows)
+line.draw(img)
+
+# Crop everything but the face.
+img.crop!(Magick::CenterGravity, 250, 200)
+
+img.write('enhance.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/equalize.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/equalize.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/equalize.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#equalize method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img = img.equalize
+
+img.write('equalize.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/evenodd.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/evenodd.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/evenodd.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,43 @@
+#! /usr/local/bin/ruby -w
+require 'rvg/rvg'
+
+Magick::RVG.dpi = 90
+
+rvg = Magick::RVG.new(12.cm, 4.cm).viewbox(0, 0, 1200, 400) do |canvas|
+    canvas.background_fill = 'white'
+    canvas.desc = "Example fillrule - nonzero - demonstrates fill_rule=>'nonzero'"
+
+    canvas.rect(1195, 393, 1, 1).styles(:fill=>'none', :stroke=>'blue')
+
+    triangle = Magick::RVG::Group.new do |defs|
+        defs.path("M 16,0 L -8,9 v-18 z").styles(:fill=>'black', :stroke=>'none')
+    end
+
+    canvas.g.styles(:clip_rule=>'evenodd', :fill=>'red', :stroke=>'black', :stroke_width=>3) do |grp|
+        grp.path("M 250,75 L 323,301 131,161 369,161 177,301 z")
+        grp.use(triangle).translate(306.21, 249).rotate(72)
+        grp.use(triangle).translate(175.16,193.2).rotate(216)
+        grp.use(triangle).translate(314.26,161).rotate(0)
+        grp.use(triangle).translate(221.16,268.8).rotate(144)
+        grp.use(triangle).translate(233.21,126.98).rotate(288)
+        grp.path("M 600,81 A 107,107 0 0,1 600,295 A 107,107 0 0,1 600,81 z" +
+                 "M 600,139 A 49,49 0 0,1 600,237 A 49,49 0 0,1 600,139 z")
+        grp.use(triangle).translate(600,188).rotate(0).translate(107,0).rotate(90)
+        grp.use(triangle).translate(600,188).rotate(120).translate(107,0).rotate(90)
+        grp.use(triangle).translate(600,188).rotate(240).translate(107,0).rotate(90)
+        grp.use(triangle).translate(600,188).rotate(60).translate(49,0).rotate(90)
+        grp.use(triangle).translate(600,188).rotate(180).translate(49,0).rotate(90)
+        grp.use(triangle).translate(600,188).rotate(300).translate(49,0).rotate(90)
+        grp.path("M 950,81 A 107,107 0 0,1 950,295 A 107,107 0 0,1 950,81 z" +
+                 "M 950,139 A 49,49 0 0,0 950,237 A 49,49 0 0,0 950,139 z")
+        grp.use(triangle).translate(950,188).rotate(0).translate(107,0).rotate(90)
+        grp.use(triangle).translate(950,188).rotate(120).translate(107,0).rotate(90)
+        grp.use(triangle).translate(950,188).rotate(240).translate(107,0).rotate(90)
+        grp.use(triangle).translate(950,188).rotate(60).translate(49,0).rotate(-90)
+        grp.use(triangle).translate(950,188).rotate(180).translate(49,0).rotate(-90)
+        grp.use(triangle).translate(950,188).rotate(300).translate(49,0).rotate(-90)
+    end
+end
+
+rvg.draw.write('evenodd.gif')
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/flatten_images.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/flatten_images.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/flatten_images.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,38 @@
+#! /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

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/flip.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/flip.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/flip.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#flip method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img.flip!
+
+img.write('flip.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/flop.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/flop.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/flop.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#flop method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img.flop!
+
+img.write('flop.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/font_styles.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/font_styles.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/font_styles.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,28 @@
+#! /usr/local/bin/ruby -w
+require 'rvg/rvg'
+
+
+rvg = Magick::RVG.new(200, 250) do |canvas|
+    canvas.background_fill = 'white'
+
+    canvas.g do |grp|
+        grp.text(10, 30, "default size")
+        grp.text(10, 50, ":font_size=>14").styles(:font_size=>14)
+        grp.text(10, 70, ":font_size=>16").styles(:font_size=>16)
+        grp.text(10,100, ":font_size=>24").styles(:font_size=>24)
+    end
+
+    canvas.g.styles(:font_size=>14) do |grp|
+        grp.text( 8, 120, ":font_family=>'Courier'").styles(:font_family=>'Courier')
+        grp.text(10, 140, ":font_weight=>'bold'").styles(:font_weight=>'bold')
+        grp.text(10, 160, ":font_stretch=>'normal'").styles(:font_stretch=>'normal')
+        grp.text(10, 180, ":font_stretch=>'condensed'").styles(:font_stretch=>'condensed')
+        grp.text(10, 200, ":font_style=>'italic'").styles(:font_style=>'italic')
+        grp.text(10, 220, ":font_weight=>900").styles(:font_weight=>900)
+    end
+
+    canvas.rect(199, 249).styles(:fill=>'none', :stroke=>'blue')
+end
+
+rvg.draw.write('font_styles.gif')
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/fonts.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/fonts.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/fonts.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,20 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Compute column widths
+name_length = 0
+family_length = 0
+Magick::fonts { |font|
+    if font.name.length > name_length
+        name_length = font.name.length
+    end
+    if font.family.length > family_length
+        family_length = font.family.length
+    end
+}
+
+# Print all fonts
+Magick::fonts { |font|
+    printf("%-*s %-*s %d %s\t%s\n", name_length, font.name,
+        family_length, font.family, font.weight, font.style, font.stretch)
+}

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/frame.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/frame.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/frame.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,12 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#frame method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img.matte_color="gray75"
+img = img.frame
+
+img.write('frame.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/gaussian_blur.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/gaussian_blur.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/gaussian_blur.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#gaussian_blur method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img = img.gaussian_blur(0.0, 3.0)
+
+img.write('gaussian_blur.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/get_multiline_type_metrics.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/get_multiline_type_metrics.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/get_multiline_type_metrics.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,53 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+include Magick
+
+TEXT = 'get\nmultiline\ntype\nmetrics'
+
+background = Image.new(200, 200)
+gc = Draw.new
+
+# Draw the text centered on the background
+gc.annotate(background, 0, 0, 0, 0, TEXT) do |gc|
+    gc.font_family = 'Verdana'
+    gc.pointsize = 36
+    gc.gravity = CenterGravity
+    gc.stroke = 'none'
+end
+
+begin
+
+    # Get the metrics
+    metrics = gc.get_multiline_type_metrics(background, TEXT)
+
+    # Compute the corners for a rectangle surrounding the text
+    x = (background.columns - metrics.width) / 2
+    y = (background.rows - metrics.height) / 2
+
+    # Draw 2 rectangles over the text.
+    gc = Draw.new
+    gc.stroke('red')
+    gc.stroke_width(5)
+    gc.stroke_linejoin('round')
+    gc.fill('cyan')
+    gc.fill_opacity(0.10)
+    gc.rectangle(x, y, x+metrics.width, y+metrics.height)
+
+    gc.stroke('white')
+    gc.stroke_width(1)
+    gc.fill('none')
+    gc.rectangle(x, y, x+metrics.width, y+metrics.height)
+    gc.draw(background)
+
+    background.border!(1,1, 'blue')
+
+# Substitute the standard "Not Implemented" image
+rescue NotImplementedError
+    not_implemented = Magick::Image.read("images/notimplemented.gif").first
+    not_implemented.resize!(background.columns, background.rows)
+    background = not_implemented
+end
+
+background.write('get_multiline_type_metrics.gif')
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/get_pixels.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/get_pixels.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/get_pixels.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,48 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate partial transparency and the get_pixels and
+# store_pixels methods by creating an image that goes from
+# full-color on the left to monochrome on the right.
+
+# Read the colorful picture of a rock formation. Scale
+# it to 300 pixels high because we don't want a big picture.
+rocks = Magick::Image.read('images/Red_Rocks.jpg').first
+rocks.scale!(250.0/rocks.rows)
+
+# Make a monochrome copy. See Image#quantize for details
+grayrocks = rocks.quantize(256, Magick::GRAYColorspace)
+
+rows = grayrocks.rows
+cols = grayrocks.columns
+
+# Create an array of opacity values, proceeding from
+# transparent to opaque. The array should have as many
+# elements as there are columns in the image. The first
+# element should be TransparentOpacity and each succeeding
+# element slightly more opaque than its predecessor.
+step = Magick::TransparentOpacity / cols.to_f
+opacity_steps = Array.new(cols)
+cols.times { |x|
+    opacity_steps[x] = Magick::TransparentOpacity - Integer(x * step)
+    if opacity_steps[x] < Magick::OpaqueOpacity
+        opacity_steps[x] = Magick::OpaqueOpacity
+    end
+}
+
+# Get each row of pixels from the mono image.
+# Copy the pre-computed opacity values to the pixels.
+# Store the pixels back.
+rows.times { |y|
+    pixels = grayrocks.get_pixels(0, y, cols, 1)
+    pixels.each_with_index { |p,x| p.opacity = opacity_steps[x] }
+    grayrocks.store_pixels(0, y, cols, 1, pixels)
+}
+
+# Composite the mono version of the image over the color version.
+grayrocks.matte = true
+combine = rocks.composite(grayrocks, Magick::CenterGravity, Magick::OverCompositeOp)
+#combine.display
+combine.write 'get_pixels.jpg'
+exit
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/get_type_metrics.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/get_type_metrics.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/get_type_metrics.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,140 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+include Magick
+
+# Add a method for drawing braces.
+class Draw
+
+    # (w,h) - width & height of rectangle enclosing brace.
+    # Normally the brace is drawn with its opening to the
+    # left and its lower point on the origin.
+    #
+    # Set w < 0 to draw right-opening brace. Set h < 0 to
+    # position top point at origin.
+    #
+    # The placement & orientation is affected by the
+    # current user coordinate system.
+    def brace(w, h)
+        raise(ArgumentError, "width must be != 0") unless w != 0
+        raise(ArgumentError, "height must be != 0") unless h != 0
+        path("M0,0 Q#{w},0 #{w/2.0},#{-h/4.0} T#{w},#{-h/2.0}" +
+             "Q0,#{-h/2.0} #{w/2.0},#{-(3.0*h/4.0)} T0,#{-h}")
+    end
+
+end     # class Draw
+
+
+
+
+Origin_x = 110
+Origin_y = 220
+Glyph = 'g'
+
+canvas = Image.new(410,300,HatchFill.new('white', 'lightcyan2'))
+
+# Draw a big lowercase 'g' on the canvas. Leave room on all sides for
+# the labels. Use 'undercolor' to set off the glyph.
+glyph = Draw.new
+glyph.annotate(canvas, 0, 0, Origin_x, Origin_y, Glyph) do |opts|
+    opts.pointsize = 124
+    opts.stroke = 'none'
+    opts.fill = 'black'
+    opts.font_family = 'Times'
+    opts.undercolor = '#ffff00c0'
+end
+
+# Call get_type_metrics. This is what this example's all about.
+metrics = glyph.get_type_metrics(canvas, Glyph)
+
+gc = Draw.new
+
+# Draw the origin as a big red dot.
+gc.stroke('red')
+gc.fill('red')
+gc.circle(Origin_x, Origin_y, Origin_x, Origin_y+2)
+
+# All our lines will be medium-gray, dashed, and thin.
+gc.stroke('gray50')
+gc.stroke_dasharray(5,2)
+gc.stroke_width(1)
+gc.fill('none')
+
+# baseline
+gc.line(Origin_x-10, Origin_y, Origin_x+metrics.width+20, Origin_y)
+
+# a vertical line through the origin
+gc.line(Origin_x, 30, Origin_x, 270)
+
+# descent
+gc.line(Origin_x-10, Origin_y-metrics.descent, Origin_x+metrics.width+20, Origin_y-metrics.descent)
+
+# ascent
+gc.line(Origin_x-10, Origin_y-metrics.ascent, Origin_x+metrics.width+20, Origin_y-metrics.ascent)
+
+# height
+gc.line(Origin_x-10, Origin_y-metrics.height, Origin_x+metrics.width+10, Origin_y-metrics.height)
+
+# width
+gc.line(Origin_x+metrics.width, 30, Origin_x+metrics.width, 270)
+
+# max_advance
+gc.line(Origin_x+metrics.max_advance, Origin_y-metrics.descent-10,
+        Origin_x+metrics.max_advance, 270)
+
+gc.draw(canvas)
+
+# Draw the braces and labels. Position the braces by transforming the
+# user coordinate system with translate and rotate methods.
+gc = Draw.new
+gc.font_family('Times')
+gc.pointsize(13)
+gc.fill('none')
+gc.stroke('black')
+gc.stroke_width(1)
+
+# between origin and descent
+gc.push
+gc.translate(Origin_x+metrics.width+23, Origin_y)
+gc.brace(10, metrics.descent)
+gc.pop
+
+# between origin and ascent
+gc.push
+gc.translate(Origin_x+metrics.width+23, Origin_y)
+gc.brace(10, metrics.ascent)
+gc.pop
+
+# between origin and height
+gc.push
+gc.translate(Origin_x-13, Origin_y-metrics.height)
+gc.rotate(180)
+gc.brace(10, metrics.height)
+gc.pop
+
+# between origin and width
+gc.push
+gc.translate(Origin_x+metrics.width, 27.0)
+gc.rotate(-90)
+gc.brace(10, metrics.width)
+gc.pop
+
+# between origin and max_advance
+gc.push
+gc.translate(Origin_x, Origin_y-metrics.descent+14)
+gc.rotate(90)
+gc.brace(10, metrics.max_advance)
+gc.pop
+
+# Add labels
+gc.stroke('none')
+gc.fill('black')
+gc.text(Origin_x+metrics.width+40, Origin_y-(metrics.ascent/2)+4, 'ascent')
+gc.text(Origin_x+metrics.width+40, Origin_y-(metrics.descent/2)+4, 'descent')
+gc.text(Origin_x-60, Origin_y-metrics.height/2+4, 'height')
+gc.text(Origin_x+(metrics.width/2)-15, 15, 'width')
+gc.text(Origin_x+(metrics.max_advance)/2-38, 290, "max_advance")
+
+gc.draw(canvas)
+canvas.border!(1,1,'blue')
+canvas.write('get_type_metrics.gif')
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/gradientfill.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/gradientfill.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/gradientfill.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,27 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the GradientFill class
+
+Rows = 100
+Cols = 300
+
+Start = "#900"
+End = "#000"
+
+fill = Magick::GradientFill.new(0, 0, 0, Rows, Start, End)
+img = Magick::Image.new(Cols, Rows, fill);
+
+# Annotate the filled image with the code that created the fill.
+
+ann = Magick::Draw.new
+ann.annotate(img, 0,0,0,0, "GradientFill.new(0, 0, 0, #{Rows}, '#{Start}', '#{End}')") {
+    self.gravity = Magick::CenterGravity
+    self.fill = 'white'
+    self.stroke = 'transparent'
+    self.pointsize = 14
+    }
+
+#img.display
+img.write("gradientfill.gif")
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/grav.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/grav.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/grav.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,44 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(400,200, Magick::HatchFill.new('white', 'lightcyan2'))
+
+gc = Magick::Draw.new
+
+# Draw blue lines to indicate positioning
+gc.stroke('blue')
+gc.fill('transparent')
+gc.rectangle(20,20, 380,180)
+gc.line(200,20, 200,180)
+gc.line(20,100, 380,100)
+
+# Draw text at all 9 compass points.
+gc.stroke('transparent')
+gc.fill('black')
+gc.gravity(Magick::NorthWestGravity)
+gc.text(20,20, 'NorthWestGravity')
+gc.gravity(Magick::NorthGravity)
+gc.text( 0,20, 'NorthGravity')
+gc.gravity(Magick::NorthEastGravity)
+gc.text(20,20, 'NorthEastGravity')
+gc.gravity(Magick::WestGravity)
+gc.text(20, 0, 'WestGravity')
+gc.gravity(Magick::CenterGravity)
+gc.text( 0, 0, 'CenterGravity')
+gc.gravity(Magick::EastGravity)
+gc.text(20, 0, 'EastGravity')
+gc.gravity(Magick::SouthWestGravity)
+gc.text(20,20, 'SouthWestGravity')
+gc.gravity(Magick::SouthGravity)
+gc.text( 0,20, 'SouthGravity')
+gc.gravity(Magick::SouthEastGravity)
+gc.text(20,20, 'SouthEastGravity')
+gc.draw(imgl)
+
+imgl.border!(1,1, "lightcyan2")
+
+imgl.write("grav.gif")
+exit
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/gravity.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/gravity.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/gravity.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,80 @@
+#! /usr/local/bin/ruby -w
+#
+#   A RMagick version of Magick++/demo/gravity.cpp
+#
+
+require 'RMagick'
+
+x, y = 100, 100
+
+begin
+
+    pic = Magick::ImageList.new
+
+    lines = Magick::Draw.new
+    lines.stroke "#600"
+    lines.fill_opacity 0
+    lines.line 300,100, 300,500
+    lines.line 100,300, 500,300
+    lines.rectangle 100,100, 500,500
+
+    draw = Magick::Draw.new
+    draw.pointsize = 30
+    draw.font = "Helvetica"
+    draw.fill = "#600"
+    draw.undercolor = "red"
+
+    0.step(330, 30) { |angle|
+        puts "angle #{angle}"
+        pic.new_image(600, 600) { self.background_color = "white" }
+
+        lines.draw pic
+
+        draw.annotate(pic, 0,0,x,y, "NorthWest") {
+            self.gravity = Magick::NorthWestGravity
+            self.rotation = angle
+        }
+        draw.annotate(pic, 0,0,0,y, "North") {
+            self.gravity = Magick::NorthGravity
+            self.rotation = angle
+        }
+        draw.annotate(pic, 0,0,x,y, "NorthEast") {
+            self.gravity = Magick::NorthEastGravity
+            self.rotation = angle
+        }
+        draw.annotate(pic, 0,0,x,0, "East") {
+            self.gravity = Magick::EastGravity
+            self.rotation = angle
+        }
+        draw.annotate(pic, 0,0,0,0, "Center") {
+            self.gravity = Magick::CenterGravity
+            self.rotation = angle
+        }
+        draw.annotate(pic, 0,0,x,y, "SouthEast") {
+            self.gravity = Magick::SouthEastGravity
+            self.rotation = angle
+        }
+        draw.annotate(pic, 0,0,0,y, "South") {
+            self.gravity = Magick::SouthGravity
+            self.rotation = angle
+        }
+        draw.annotate(pic, 0,0,x,y, "SouthWest") {
+            self.gravity =  Magick::SouthWestGravity
+            self.rotation = angle
+        }
+        draw.annotate(pic, 0,0,x,0, "West") {
+            self.gravity = Magick::WestGravity
+            self.rotation = angle
+        }
+    }
+
+    puts "Writing image \"rb_gravity_out.miff\"..."
+    pic.delay = 20
+    pic.write "./rm_gravity_out.miff"
+
+rescue
+    puts "#{$!} exception raised."
+    exit 1
+end
+
+exit 0

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/hatchfill.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/hatchfill.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/hatchfill.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,27 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the HatchFill class
+
+Cols = 300
+Rows = 100
+
+Background = "white"
+Foreground = "LightCyan2"
+
+fill = Magick::HatchFill.new(Background, Foreground)
+img = Magick::ImageList.new
+img.new_image(Cols, Rows, fill)
+
+# Annotate the filled image with the code that created the fill.
+
+ann = Magick::Draw.new
+ann.annotate(img, 0,0,0,0, "HatchFill.new('#{Background}', '#{Foreground}')") {
+    self.gravity = Magick::CenterGravity
+    self.fill = 'black'
+    self.stroke = 'transparent'
+    self.pointsize = 14
+    }
+#img.display
+img.write('hatchfill.gif')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/implode.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/implode.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/implode.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,32 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+legend = Magick::Draw.new
+legend.stroke = 'transparent'
+legend.fill = 'white'
+legend.gravity = Magick::SouthGravity
+
+frames = Magick::ImageList.new
+
+implosion = 0.25
+8.times {
+    frames << img.implode(implosion)
+    legend.annotate(frames, 0,0,10,20, sprintf("% 4.2f", implosion))
+    implosion -= 0.10
+    }
+
+7.times {
+    implosion += 0.10
+    frames << img.implode(implosion)
+    legend.annotate(frames, 0,0,10,20, sprintf("% 4.2f", implosion))
+    }
+
+frames.delay = 10
+frames.iterations = 0
+puts "Producing animation..."
+
+frames.write("implode.gif")
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/level.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/level.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/level.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,12 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#level method
+
+before = Magick::Image.read('images/Flower_Hat.jpg').first
+
+# Allow the white-point argument to default.
+# Brighten up the mid-tones a bit.
+after = before.level(0,1.50)
+after.write('level.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/level_channel.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/level_channel.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/level_channel.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,33 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#level_channel method
+
+before = Magick::Image.read('images/Flower_Hat.jpg').first
+
+# Let the final argument default
+begin
+    red   = before.level_channel(Magick::RedChannel,  Magick::MaxRGB, 2)
+    green = before.level_channel(Magick::GreenChannel,Magick::MaxRGB, 2)
+    blue  = before.level_channel(Magick::BlueChannel, Magick::MaxRGB, 2)
+
+    # Composite the green image over the middle of the red image.
+    # Composite the blue image over the right-hand side of the red image.
+    green.crop!(red.columns/3, 0, red.columns/3, red.rows)
+    blue.crop!(red.columns/3*2+1, 0, red.columns/3+1, red.rows)
+    result = red.composite(green, Magick::CenterGravity, Magick::OverCompositeOp)
+    result = result.composite(blue, Magick::EastGravity, Magick::OverCompositeOp)
+
+    # Draw a black line between each of the three images.
+    line = Magick::Draw.new
+    line.line(result.columns/3, 0, result.columns/3, result.rows)
+    line.line(result.columns/3*2+1, 0, result.columns/3*2+1, result.rows)
+    line.draw(result)
+
+# Substitute the standard "Not Implemented" image
+rescue NotImplementedError
+    result = Magick::Image.read("images/notimplemented.gif").first
+end
+
+result.write('level_channel.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/line.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/line.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/line.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,40 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(250, 250, Magick::HatchFill.new('white','LightCyan2'))
+
+gc = Magick::Draw.new
+
+gc.stroke_linejoin('round')
+
+# Draw 3 lines in 3 colors.
+# Make each line 2 pixels wide.
+gc.stroke('red')
+gc.stroke_width(3)
+gc.line(50,50, 50,200)
+gc.stroke('blue')
+gc.line(50,200, 200,200)
+gc.stroke('green')
+gc.line(200,200, 50,50)
+
+# Identify the endpoints with gray circles
+gc.stroke('gray50')
+gc.stroke_width(1)
+gc.fill_opacity(0)
+gc.circle(50,50, 53,53)
+gc.circle(50,200, 53,203)
+gc.circle(200,200, 203,203)
+
+# Annotate the endpoints
+gc.fill('black')
+gc.stroke('transparent')
+gc.text(30,40, "'50,50'")
+gc.text(30,220, "'50,200'")
+gc.text(180, 220, "'200,200'")
+
+gc.draw(imgl)
+imgl.border!(1,1, "LightCyan2")
+
+imgl.write("line.gif")
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/map.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/map.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/map.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,28 @@
+#! /usr/local/bin/ruby -w
+
+# Demonstrate the map, append, and composite methods by
+# mapping the colors in three separate images into the
+# 216 "Web-safe" colors.
+
+require 'RMagick'
+
+# Read three images.
+unmapped = Magick::ImageList.new("images/Hot_Air_Balloons.jpg","images/Violin.jpg","images/Polynesia.jpg")
+
+# "Read" the Netscape 216-color cube
+map = Magick::ImageList.new "netscape:"
+
+# Map the group of unmapped into the Netscape colors
+$stdout.sync = true
+printf "Mapping... Please be patient, this may take a few seconds... "
+mapped = unmapped.map map, false
+puts "Done."
+
+# Use the append method to arrange the unmapped images
+# side-by-side into a single image. Repeat for the mapped images.
+before = unmapped.append false
+before.write 'map_before.jpg'
+
+after = mapped.append false
+after.write 'map_after.jpg'
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/map_f.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/map_f.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/map_f.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,15 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#map method
+
+img = Magick::Image.read('images/Flower_Hat.jpg')[0]
+
+# "Read" the builtin Netscape format, which
+# contains the 216 colors in the Netscape palette.
+nsmap = Magick::Image.read('netscape:')[0]
+
+# Map the original image colors into the Netscape colors.
+after = img.map(nsmap)
+
+after.write('map_f.jpg')

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/matte_fill_to_border.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/matte_fill_to_border.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/matte_fill_to_border.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,42 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+include Magick
+
+img = Image.new(200,200)
+img.compression = LZWCompression
+
+bg = Image.read('plasma:fractal') {
+    self.size = '200x200'
+    }
+
+gc = Draw.new
+gc.stroke_width(2)
+gc.stroke('black')
+gc.fill('white')
+gc.roundrectangle(0, 0, 199, 199, 8, 8)
+
+gc.fill('black')
+gc.circle(100,  45, 100,  25)
+gc.circle( 45, 100,  25, 100)
+gc.circle(100, 155, 100, 175)
+gc.circle(155, 100, 175, 100)
+
+gc.draw(img)
+
+img.write('matte_fill_to_border_before.gif')
+
+# Set the border color. Set the fuzz attribute so that
+# the matte fill will fill the aliased pixels around
+# the edges of the black circles.
+img.border_color = 'black'
+img.fuzz = 10
+img = img.matte_fill_to_border(100, 100)
+
+# Composite the image over a nice bright background
+# so that the transparent pixels will be obvious.
+img = bg[0].composite(img, CenterGravity, OverCompositeOp)
+
+img.write('matte_fill_to_border_after.gif')
+exit
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/matte_floodfill.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/matte_floodfill.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/matte_floodfill.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,35 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+include Magick
+
+img = Image.new(200,200)
+img.compression = LZWCompression
+
+bg = Image.read('plasma:fractal') {
+    self.size = '200x200'
+    }
+
+gc = Draw.new
+gc.stroke_width(2)
+gc.stroke('black')
+gc.fill('white')
+gc.roundrectangle(0, 0, 199, 199, 8, 8)
+
+gc.fill('yellow')
+gc.stroke('red')
+gc.circle(100, 100, 100,  25)
+gc.draw(img)
+
+img.write('matte_floodfill_before.gif')
+
+img.fuzz = 100
+img = img.matte_floodfill(100, 100)
+
+# Composite the image over a nice bright background
+# so that the transparent pixels will be obvious.
+img = bg[0].composite(img, CenterGravity, OverCompositeOp)
+
+img.write('matte_floodfill_after.gif')
+exit
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/matte_replace.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/matte_replace.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/matte_replace.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,42 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+include Magick
+
+img = Image.new(200,200)
+img.compression = LZWCompression
+
+bg = Image.read('plasma:fractal') {
+    self.size = '200x200'
+    }
+
+gc = Draw.new
+gc.stroke_width(2)
+gc.stroke('black')
+gc.fill('white')
+gc.roundrectangle(0, 0, 199, 199, 8, 8)
+
+gc.fill('black')
+gc.circle(100,  45, 100,  25)
+gc.circle( 45, 100,  25, 100)
+gc.circle(100, 155, 100, 175)
+gc.circle(155, 100, 175, 100)
+
+gc.draw(img)
+
+img.write('matte_replace_before.gif')
+
+# Set the border color. Set the fuzz attribute so that
+# the matte fill will fill the aliased pixels around
+# the edges of the black circles.
+img.border_color = 'black'
+img.fuzz = 10
+img = img.matte_replace(100, 45)
+
+# Composite the image over a nice bright background
+# so that the transparent pixels will be obvious.
+img = bg[0].composite(img, CenterGravity, OverCompositeOp)
+
+img.write('matte_replace_after.gif')
+exit
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/median_filter.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/median_filter.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/median_filter.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,28 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#median_filter method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+img = img.add_noise(Magick::UniformNoise)
+
+eimg = img.median_filter(0.05)
+
+# Zoom in so we can see the change
+img.resize!(3)
+eimg.resize!(3)
+
+# Make a before-and-after composite
+eimg.crop!(eimg.columns/2, 0, eimg.columns/2, eimg.rows)
+img = img.composite(eimg, Magick::EastGravity, Magick::OverCompositeOp)
+
+# Draw a black line between the before and after parts.
+line = Magick::Draw.new
+line.line(img.columns/2, 0, img.columns/2, img.rows)
+line.draw(img)
+
+# Crop everything but the face.
+img.crop!(Magick::CenterGravity, 250, 200)
+
+img.write('median_filter.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/modulate.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/modulate.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/modulate.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#!/usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#modulate method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img = img.modulate(0.85)
+
+img.write('modulate.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/mono.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/mono.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/mono.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,23 @@
+#!/usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the ImageListImage#quantize method by converting
+# a color image into a monochrome image.
+
+# Read the large color cheetah image and scale it to a third
+# of its size.
+cheetah = Magick::Image.read("images/Cheetah.jpg").first
+cheetah.scale!(0.33)
+
+# Quantize the cheetah image into 256 colors in the GRAY colorspace.
+mono_cheetah = cheetah.quantize 256, Magick::GRAYColorspace
+
+# Cut the top off the monochrome cheetah image.
+mono_bottom = mono_cheetah.crop 0, mono_cheetah.rows/2, mono_cheetah.columns, mono_cheetah.rows/2
+
+# Composite the half-height mono cheetah onto the bottom of
+# the original color cheetah.
+before_after = cheetah.composite mono_bottom, 0, cheetah.rows/2, Magick::OverCompositeOp
+
+before_after.write "mono.jpg"
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/morph.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/morph.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/morph.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,26 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+
+# Demonstrate the morph method
+
+# Read 4 digit image files. Create an
+# animated morph sequence by inserting 8
+# in-between images between each pair of digits.
+
+i = Magick::ImageList.new
+number = '0'
+4.times do
+    i.read "images/Button_" + number + ".gif"
+    number.succ!
+    end
+
+puts "This may take a few seconds..."
+morph = i.morph 8
+morph.delay = 12
+morph.iterations = 10000
+# Display the resulting sequence as an animation.
+# morph.animate(12)
+morph.write "morph.gif"
+exit
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/mosaic.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/mosaic.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/mosaic.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,35 @@
+#!/usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the mosaic method
+
+a = Magick::ImageList.new
+
+letter = 'A'
+26.times do
+    # 'M' is not the same size as the other letters.
+    if letter != 'M'
+        a.read("images/Button_"+letter+".gif")
+    end
+    letter.succ!
+end
+
+# Make a copy of "a" with all the images quarter-sized
+b = Magick::ImageList.new
+page = Magick::Rectangle.new(0,0,0,0)
+a.scene = 0
+5.times do |i|
+    5.times do |j|
+        b << a.scale(0.25)
+        page.x = j * b.columns
+        page.y = i * b.rows
+        b.page = page
+        (a.scene += 1) rescue a.scene = 0
+    end
+end
+
+# Make a 5x5 mosaic
+mosaic = b.mosaic
+mosaic.write("mosaic.gif")
+# mosaic.display
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/motion_blur.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/motion_blur.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/motion_blur.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#blur_image method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img = img.motion_blur(0,7,180)
+
+img.write('motion_blur.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/negate.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/negate.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/negate.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#negate method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img = img.negate
+
+img.write('negate.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/negate_channel.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/negate_channel.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/negate_channel.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,19 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#negate_channel method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+begin
+
+result = img.negate_channel(false, Magick::GreenChannel)
+
+# Substitute the standard "Not Implemented" image
+rescue NotImplementedError
+    result = Magick::Image.read("images/notimplemented.gif").first
+    result.resize!(img.columns, img.rows)
+end
+
+result.write('negate_channel.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/nested_rvg.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/nested_rvg.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/nested_rvg.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,21 @@
+#! /usr/local/bin/ruby -w
+
+require 'rvg/rvg'
+
+target = Magick::RVG.new.viewbox(0,0,200,200) do |targ|
+    targ.g.styles(:stroke_width=>20, :stroke=>'#ff5600', :fill=>'#abd600') do |grp|
+        grp.circle(90, 100, 100)
+        grp.circle(60, 100, 100)
+        grp.circle(30, 100, 100)
+    end
+end
+
+rvg = Magick::RVG.new(258, 100) do |canvas|
+    canvas.background_fill = '#51396b'
+    canvas.use(target, 0, 0, 100, 100)
+    canvas.use(target, 100, 16.6667, 66.7, 66.7)
+    canvas.use(target, 166.6667, 25, 50, 50)
+    canvas.use(target, 216.6667, 30, 40, 40)
+end
+
+rvg.draw.write('nested_rvg.gif')

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/nonzero.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/nonzero.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/nonzero.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,43 @@
+#! /usr/local/bin/ruby -w
+require 'rvg/rvg'
+
+Magick::RVG.dpi = 90
+
+rvg = Magick::RVG.new(12.cm, 4.cm).viewbox(0, 0, 1200, 400) do |canvas|
+    canvas.background_fill = 'white'
+    canvas.desc = "Example fillrule - nonzero - demonstrates fill_rule=>'nonzero'"
+
+    canvas.rect(1195, 393, 1, 1).styles(:fill=>'none', :stroke=>'blue')
+
+    triangle = Magick::RVG::Group.new do |defs|
+        defs.path("M 16,0 L -8,9 v-18 z").styles(:fill=>'black', :stroke=>'none')
+    end
+
+    canvas.g.styles(:fill_rule=>'nonzero', :fill=>'red', :stroke=>'black', :stroke_width=>3) do |grp|
+        grp.path("M 250,75 L 323,301 131,161 369,161 177,301 z")
+        grp.use(triangle).translate(306.21, 249).rotate(72)
+        grp.use(triangle).translate(175.16,193.2).rotate(216)
+        grp.use(triangle).translate(314.26,161).rotate(0)
+        grp.use(triangle).translate(221.16,268.8).rotate(144)
+        grp.use(triangle).translate(233.21,126.98).rotate(288)
+        grp.path("M 600,81 A 107,107 0 0,1 600,295 A 107,107 0 0,1 600,81 z" +
+                 "M 600,139 A 49,49 0 0,1 600,237 A 49,49 0 0,1 600,139 z")
+        grp.use(triangle).translate(600,188).rotate(0).translate(107,0).rotate(90)
+        grp.use(triangle).translate(600,188).rotate(120).translate(107,0).rotate(90)
+        grp.use(triangle).translate(600,188).rotate(240).translate(107,0).rotate(90)
+        grp.use(triangle).translate(600,188).rotate(60).translate(49,0).rotate(90)
+        grp.use(triangle).translate(600,188).rotate(180).translate(49,0).rotate(90)
+        grp.use(triangle).translate(600,188).rotate(300).translate(49,0).rotate(90)
+        grp.path("M 950,81 A 107,107 0 0,1 950,295 A 107,107 0 0,1 950,81 z" +
+                 "M 950,139 A 49,49 0 0,0 950,237 A 49,49 0 0,0 950,139 z")
+        grp.use(triangle).translate(950,188).rotate(0).translate(107,0).rotate(90)
+        grp.use(triangle).translate(950,188).rotate(120).translate(107,0).rotate(90)
+        grp.use(triangle).translate(950,188).rotate(240).translate(107,0).rotate(90)
+        grp.use(triangle).translate(950,188).rotate(60).translate(49,0).rotate(-90)
+        grp.use(triangle).translate(950,188).rotate(180).translate(49,0).rotate(-90)
+        grp.use(triangle).translate(950,188).rotate(300).translate(49,0).rotate(-90)
+    end
+end
+
+rvg.draw.write('nonzero.gif')
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/normalize.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/normalize.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/normalize.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#normalize method
+
+img = Magick::Image.read('images/Hot_Air_Balloons.jpg').first
+
+img = img.normalize
+
+img.write('normalize.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/oil_paint.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/oil_paint.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/oil_paint.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#oil_paint method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img = img.oil_paint
+
+img.write('oil_paint.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/opacity.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/opacity.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/opacity.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,38 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+include Magick
+
+canvas = Image.new(260, 125)
+gc = Draw.new
+gc.fill('black')
+gc.rectangle(10,20, 250,90)
+
+gc.stroke('blue')
+gc.fill('yellow')
+gc.stroke_width(10)
+
+gc.opacity('25%')
+gc.roundrectangle(20,20, 60,90, 5,5)
+
+gc.opacity('50%')
+gc.roundrectangle(80,20, 120,90, 5,5)
+
+gc.opacity(0.75)
+gc.roundrectangle(140,20, 180,90, 5,5)
+
+gc.opacity(1)
+gc.roundrectangle(200,20, 240,90, 5,5)
+
+gc.stroke('transparent')
+gc.fill('black')
+gc.gravity(SouthGravity)
+gc.text(-90,20, '"25%%"')
+gc.text(-30,20, '"50%%"')
+gc.text( 30,20, '"75%%"')
+gc.text( 90,20, '"100%%"')
+
+gc.draw(canvas)
+
+canvas.write("opacity.gif")
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/opaque.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/opaque.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/opaque.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,14 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+include Magick
+
+# Demonstrate the Image#opaque method.
+
+img = Image.read('images/Flower_Hat.jpg').first
+
+# Allow non-exact matches
+img.fuzz = 25
+img = img.opaque('white', 'red')
+
+img.write('opaque.jpg')
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/ordered_dither.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/ordered_dither.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/ordered_dither.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#ordered_dither method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img = img.ordered_dither
+
+img.write('ordered_dither.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/path.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/path.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/path.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,62 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(390, 240, Magick::HatchFill.new('white','lightcyan2'))
+
+gc = Magick::Draw.new
+
+# Draw path
+gc.fill_opacity 0
+gc.stroke 'red'
+gc.stroke_width 3
+gc.path "M20,120 C20,20 170,20 170,120 S320,220 320,120"
+
+# Annotate
+# Show end points
+gc.fill_opacity 0
+gc.stroke 'gray50'
+gc.stroke_width 1
+gc.circle  20,120,  23, 123
+gc.circle 170,120, 173, 123
+gc.circle 320,120, 323, 123
+
+# Show control points
+gc.fill_opacity 1
+gc.circle  20, 20,  23,  23
+gc.circle 170, 20, 173,  23
+gc.circle 320,220, 323, 223
+
+# Show connector lines
+gc.line  20,120,  20, 20
+gc.line 170, 20, 170,220
+gc.line 320,220, 320,120
+
+# Show auto control point
+gc.fill_opacity 0
+gc.stroke 'blue'
+gc.stroke_width 3
+gc.circle 170,220, 173,223
+
+# Add labels
+gc.stroke "#000000ff"       # unset stroke color
+gc.fill 'black'
+
+# Add end point labels
+gc.text  30,125, "'20,120'"
+gc.text 180,125, "'170,120'"
+gc.text 330,125, "'320,120'"
+
+# Add control point labels
+gc.text  30, 25, "'20,20'"
+gc.text 180, 25, "'170,20'"
+gc.text 330,225, "'320,320'"
+
+# Add auto control point label
+gc.text 180,225, "'auto ctl point'"
+
+gc.draw imgl
+
+imgl.border!(1,1, 'lightcyan2')
+imgl.write 'path.gif'
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/pattern1.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/pattern1.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/pattern1.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,25 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+
+gc = Magick::Draw.new
+gc.pattern('triangles', 0, 0, 16, 16) {
+    gc.fill('darkblue')
+    gc.rectangle(0,0, 16,16)
+    gc.fill('yellow')
+    gc.stroke('red')
+    gc.polygon(0,0, 8,16, 16,0, 0,0)
+}
+
+gc.stroke('triangles')
+gc.stroke_width(16)
+gc.fill('none')
+gc.ellipse(150, 75, 130, 60, 0, 360)
+
+img = Magick::Image.new(300, 150, Magick::HatchFill.new('white','lightcyan2',8))
+gc.draw(img)
+
+img.border!(1,1, "lightcyan2")
+
+img.write('pattern1.gif')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/pattern2.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/pattern2.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/pattern2.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,26 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+
+hat = Magick::Image.read("images/Flower_Hat.jpg").first
+hat.resize!(0.25)
+
+# Construct a pattern using the hat image
+gc = Magick::Draw.new
+gc.pattern('hat', 0, 0, hat.columns, hat.rows) {
+    gc.composite(0, 0, 0, 0, hat)
+}
+
+# Set the fill to the hat "pattern." Draw an ellipse
+gc.fill('hat')
+gc.ellipse(150, 75, 140, 70, 0, 360)
+
+# Create a canvas to draw on
+img = Magick::Image.new(300, 150, Magick::HatchFill.new('white','lightcyan2',8))
+
+# Draw the ellipse using the fill
+gc.draw(img)
+
+img.border!(1,1, "lightcyan2")
+img.write('pattern2.gif')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/polygon.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/polygon.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/polygon.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,24 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(290, 200, Magick::HatchFill.new('white','lightcyan2'))
+
+gc = Magick::Draw.new
+gc.stroke('blue').stroke_width(3)
+
+# Draw red 5-pointed star
+gc.fill('red')
+gc.polygon( 75,37.5,     89.5,80.5, 134.5,80.5,   98.5,107.5,
+           111.5,150.5,  75,125,    38.5,150.5,   51.5,107.5,
+           15.5,80.5,    60.5,80.5)
+# Draw green hexagon
+gc.fill('lime')
+gc.polygon(225,37.5,  279,68.75, 279,131.25,
+           225,162.5, 171,131.3, 171,68.75)
+
+gc.draw(imgl)
+imgl.border!(1,1, "lightcyan2")
+
+imgl.write("polygon.gif")
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/polyline.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/polyline.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/polyline.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,23 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(300, 100, Magick::HatchFill.new('white','lightcyan2'))
+
+points = [12,93.75,   37,93.75,  37,81.25,  62,81.25,
+          62,93.75,   87,93.75,  87,62,    112,62,    112,93.75,
+          137,93.75, 137,43.75, 162,43.75, 162,93.75,
+          187,93.75, 187,25,    212,25,    212,93.75, 237,93.75,
+          237,6.25,  262,6.25,  262,93.75, 287,93.75]
+
+gc = Magick::Draw.new
+gc.stroke('blue').stroke_width(3)
+gc.fill_opacity(0)
+gc.polyline(*points)
+
+gc.draw(imgl)
+
+imgl.border!(1,1, "lightcyan2")
+
+imgl.write("polyline.gif")
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/posterize.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/posterize.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/posterize.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,19 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+include Magick
+
+img = Image.read('images/Flower_Hat.jpg').first
+
+begin
+
+result = img.posterize
+
+# Substitute the standard "Not Implemented" image
+rescue NotImplementedError
+    result = Magick::Image.read("images/notimplemented.gif").first
+    result.resize!(img.columns, img.rows)
+end
+
+result.write('posterize.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/preview.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/preview.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/preview.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,16 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+
+img = Magick::Image.read("images/Flower_Hat.jpg").first
+
+begin
+    preview = img.preview(Magick::SolarizePreview)
+rescue NotImplementedError
+    img = Magick::Image.read('images/notimplemented.gif').first
+    img.write('preview.jpg')
+    exit
+end
+preview.minify.write('preview.jpg')
+exit
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/qbezierpath.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/qbezierpath.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/qbezierpath.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,49 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(500, 300, Magick::HatchFill.new('white','lightcyan2'))
+
+gc = Magick::Draw.new
+
+# Draw path with quadratic bezier commands
+gc.fill_opacity 0
+gc.stroke 'red'
+gc.stroke_width 3
+gc.path "M20,150 Q120,25 220,150 T420,150"
+
+# Annotate
+# Show end points
+gc.fill_opacity 1
+gc.stroke 'grey50'
+gc.stroke_width 1
+gc.circle 20,150,   23, 153
+gc.circle 220,150, 223, 153
+gc.circle 420,150, 423, 153
+
+# Show control points
+gc.fill 'black'
+gc.stroke 'transparent'
+gc.circle 120,25,  123, 28
+gc.circle 320,275, 323, 278
+
+# Show connector lines
+gc.line  20,150, 120,25
+gc.line 120,25,  320,275
+gc.line 320,275, 420,150
+
+# Add labels
+# Add end point labels
+gc.text  30,155, "'20,150'"
+gc.text 230,155, "'220,150'"
+gc.text 430,155, "'420,150'"
+
+# Add control point labels
+gc.text 130,30, "'120,25'"
+gc.text 330,280, "'320,275'"
+
+gc.draw imgl
+
+imgl.border!(1,1, "lightcyan2")
+#imgl.display
+imgl.write "qbezierpath.gif"

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/quantize-m.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/quantize-m.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/quantize-m.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,25 @@
+#! /usr/local/bin/ruby -w
+
+# Demonstrate the ImageList#quantize method
+
+require 'RMagick'
+
+snapshots = Magick::ImageList.new "images/Ballerina.jpg","images/Gold_Statue.jpg","images/Shorts.jpg"
+
+# Quantize all 3 images to a single set of 16 colors in the RGB colorspace
+$stdout.sync=true
+printf "Quantizing... Please be patient, this may take a couple of seconds... "
+quant = snapshots.quantize 16
+puts "Done."
+
+# Now we create the "before" and "after" images.
+# Arrange the original images side-by-side into a
+# single image.
+old = snapshots.append false
+old.write('quantize-m_before.jpg')
+
+# Repeat for the quantized images.
+new = quant.append false
+new.write('quantize-m_after.jpg')
+
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/radial_blur.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/radial_blur.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/radial_blur.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,19 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#radial_blur method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+# Make a blurry copy.
+begin
+    result = img.radial_blur(10.0)
+
+# Substitute the standard "Not Implemented" image
+rescue NotImplementedError
+    result = Magick::Image.read("images/notimplemented.gif").first
+    result.resize!(img.columns, img.rows)
+end
+
+result.write('radial_blur.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/raise.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/raise.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/raise.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+include Magick
+
+# Demonstrate the Image#raise method.
+img = Image.read('images/Flower_Hat.jpg').first
+
+img = img.raise
+
+img.write('raise.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/random_threshold_channel.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/random_threshold_channel.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/random_threshold_channel.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,18 @@
+#!/home/software/ruby-1.6.8/bin/ruby -w
+
+# Demonstrate the random_channel_threshold method
+
+require 'RMagick'
+include Magick
+
+img = Image.read('images/Flower_Hat.jpg').first
+
+begin
+    geom = Geometry.new(MaxRGB/2)
+    img2 = img.random_threshold_channel(geom, RedChannel)
+rescue NotImplementedError
+    img2 = Image.read('images/notimplemented.gif').first
+end
+
+img2.write('random_threshold_channel.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/rectangle.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/rectangle.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/rectangle.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,33 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(300, 200, Magick::HatchFill.new('white','lightcyan2'))
+
+gc = Magick::Draw.new
+
+gc.fill_opacity(0)
+gc.stroke('red')
+gc.stroke_width(3)
+
+# Draw rectangle
+gc.rectangle(20,20, 280, 180)
+
+# Outline corners
+gc.stroke_width(1)
+gc.stroke('gray50')
+gc.circle(20,20, 23,23)
+gc.circle(280, 180, 283, 183)
+
+# Annotate
+gc.fill('black')
+gc.stroke('transparent')
+gc.text(30,35, "'20,20'")
+gc.text(230,175, "'280,180'")
+
+gc.draw(imgl)
+imgl.border!(1,1, 'lightcyan2')
+
+imgl.write("rectangle.gif")
+exit
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/reduce_noise.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/reduce_noise.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/reduce_noise.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,28 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#reduce_noise method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+img = img.add_noise(Magick::UniformNoise)
+
+eimg = img.reduce_noise(0)
+
+# Zoom in so we can see the change
+img.resize!(3)
+eimg.resize!(3)
+
+# Make a before-and-after composite
+eimg.crop!(eimg.columns/2, 0, eimg.columns/2, eimg.rows)
+img = img.composite(eimg, Magick::EastGravity, Magick::OverCompositeOp)
+
+# Draw a black line between the before and after parts.
+line = Magick::Draw.new
+line.line(img.columns/2, 0, img.columns/2, img.rows)
+line.draw(img)
+
+# Crop everything but the face.
+img.crop!(Magick::CenterGravity, 250, 200)
+
+img.write('reduce_noise.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/roll.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/roll.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/roll.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,9 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img = img.roll(img.columns/4, img.rows/4)
+
+img.write('roll.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/rotate.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/rotate.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/rotate.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,43 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(200, 200, Magick::HatchFill.new('white','lightcyan2'))
+
+gc = Magick::Draw.new
+
+# Move the origin to the center.
+gc.translate(100, 100)
+max_x = imgl.columns/2
+max_y = imgl.rows/2
+
+# Rotate 45 degrees
+gc.rotate(45)
+
+gc.stroke('red')
+gc.stroke_width(3)
+
+# Draw down-pointing arrow
+gc.line(0, -max_y,   0, max_y)
+gc.line(0,  max_y,  10, max_y-10)
+gc.line(0,  max_y, -10, max_y-10)
+
+# Draw right-pointing arrow
+gc.line(-max_x, 0, max_x,     0)
+gc.line( max_x, 0, max_x-10, -10)
+gc.line( max_x, 0, max_x-10,  10)
+
+# Add labels
+gc.fill('black')
+gc.stroke('transparent')
+
+gc.text(8, 15, "'0,0'")
+gc.text(110, 16, "x")
+gc.text(12, 115, "y")
+
+gc.draw(imgl)
+
+imgl.border!(1,1, "lightcyan2")
+
+imgl.write("rotate.gif")
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/rotate_f.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/rotate_f.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/rotate_f.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,14 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#rotate method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img.rotate!(45)
+
+# Make the corners transparent
+img = img.matte_replace(0,0)
+
+img.write('rotate_f.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/roundrect.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/roundrect.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/roundrect.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,32 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(300, 200, Magick::HatchFill.new('white','LightCyan2'))
+
+gc = Magick::Draw.new
+
+gc.fill_opacity(0)
+gc.stroke('red')
+gc.stroke_width(3)
+
+# Draw rounded rectangle
+gc.roundrectangle(20,20, 280,180, 8, 8)
+
+gc.stroke('gray50')
+gc.stroke_width(1)
+
+gc.circle(20,20, 23,23)
+gc.circle(280,180, 283,183)
+
+# Annotate
+gc.fill('black')
+gc.stroke('transparent')
+gc.text(30,35, "'20,20'")
+gc.text(230, 175, "'280,180'")
+
+gc.draw(imgl)
+imgl.border!(1,1, "lightcyan2")
+
+imgl.write("roundrect.gif")
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/rubyname.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/rubyname.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/rubyname.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,31 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the annotate method
+
+Text = 'RMagick'
+
+granite = Magick::ImageList.new('granite:')
+canvas = Magick::ImageList.new
+canvas.new_image(300, 100, Magick::TextureFill.new(granite))
+
+text = Magick::Draw.new
+text.font_family = 'helvetica'
+text.pointsize = 52
+text.gravity = Magick::CenterGravity
+
+text.annotate(canvas, 0,0,2,2, Text) {
+    self.fill = 'gray83'
+}
+
+text.annotate(canvas, 0,0,-1.5,-1.5, Text) {
+    self.fill = 'gray40'
+}
+
+text.annotate(canvas, 0,0,0,0, Text) {
+    self.fill = 'darkred'
+}
+
+#canvas.display
+canvas.write('rubyname.gif')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/rvg_linecap.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/rvg_linecap.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/rvg_linecap.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,43 @@
+#! /usr/local/bin/ruby -w
+require 'rvg/rvg'
+
+Magick::RVG.dpi = 90
+
+BUTT   = {:stroke=>'black', :stroke_width=>70, :stroke_linecap=>'butt'}
+ROUND  = {:stroke=>'black', :stroke_width=>70, :stroke_linecap=>'round'}
+SQUARE = {:stroke=>'black', :stroke_width=>70, :stroke_linecap=>'square'}
+THIN   = {:stroke=>'#ffcccc', :stroke_width=>5}
+TEXT   = {:text_anchor=>'middle', :font_size=>50, :font_family=>'Verdana'}
+CIRCLE = {:fill=>'#ffcccc', :stroke=>'none'}
+
+rvg = Magick::RVG.new(12.cm, 2.cm).viewbox(0, 0, 1200, 200) do |canvas|
+    canvas.background_fill = 'white'
+    canvas.desc = "Example linecap - demonstrates three stroke-linecap values"
+
+    canvas.g.translate(200, 75) do |butt|
+        butt.line(-125, 0, 125, 0).styles(BUTT)
+        butt.line(-125, 0, 125, 0).styles(THIN)
+        butt.circle(8, -125, 0).styles(CIRCLE)
+        butt.circle(8,  125, 0).styles(CIRCLE)
+        butt.text(0, 90, "'butt' cap").styles(TEXT)
+    end
+    canvas.g.translate(600, 75) do |round|
+        round.line(-125, 0, 125, 0).styles(ROUND)
+        round.line(-125, 0, 125, 0).styles(THIN)
+        round.circle(8, -125, 0).styles(CIRCLE)
+        round.circle(8,  125, 0).styles(CIRCLE)
+        round.text(0, 90, "'round' cap").styles(TEXT)
+    end
+
+    canvas.g.translate(1000, 75) do |square|
+        square.line(-125, 0, 125, 0).styles(SQUARE)
+        square.line(-125, 0, 125, 0).styles(THIN)
+        square.circle(8, -125, 0).styles(CIRCLE)
+        square.circle(8,  125, 0).styles(CIRCLE)
+        square.text(0, 90, "'square' cap").styles(TEXT)
+    end
+    canvas.rect(1192, 195, 1, 1).styles(:stroke=>'blue', :fill=>'none')
+end
+
+rvg.draw.write('rvg_linecap.gif')
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/rvg_opacity.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/rvg_opacity.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/rvg_opacity.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,19 @@
+#! /usr/local/bin/ruby -w
+require 'rvg/rvg'
+
+FONT_STYLES = {:font_size=>20, :font_weight=>'bold', :fill=>'white'}
+
+rvg = Magick::RVG.new(450, 150) do |canvas|
+    canvas.background_fill = 'white'
+    canvas.rect(400, 50, 25, 50)
+    canvas.circle(40, 100, 75).styles(:opacity=>0.25, :stroke=>'blue', :fill=>'#00ff00',:stroke_width=>8)
+    canvas.text(83, 83, '0.25').styles(FONT_STYLES)
+    canvas.circle(40, 225, 75).styles(:opacity=>0.50, :stroke=>'blue', :fill=>'#00ff00',:stroke_width=>8)
+    canvas.text(208, 83, '0.50').styles(FONT_STYLES)
+    canvas.circle(40, 350, 75).styles(:opacity=>0.75, :stroke=>'blue', :fill=>'#00ff00',:stroke_width=>8)
+    canvas.text(333, 83, '0.75').styles(FONT_STYLES)
+    canvas.rect(449,149).styles(:fill=>'none',:stroke=>'blue')
+end
+
+rvg.draw.write('rvg_opacity.gif')
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/rvg_stroke_dasharray.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/rvg_stroke_dasharray.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/rvg_stroke_dasharray.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,12 @@
+#! /usr/local/bin/ruby -w
+require 'rvg/rvg'
+
+rvg = Magick::RVG.new(200, 100) do |canvas|
+            canvas.background_fill = 'white'
+            canvas.rect(150, 50, 25, 25).round(6).
+                    styles(:fill=>'none', :stroke=>'purple', :stroke_width=>10, :stroke_dasharray=>[10,5])
+            canvas.rect(199, 99).styles(:fill=>'none', :stroke=>'blue')
+      end
+
+rvg.draw.write('rvg_stroke_dasharray.gif')
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/segment.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/segment.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/segment.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#segment method.
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img = img.segment(Magick::YUVColorspace, 0.4, 0.4)
+
+img.write('segment.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/sepiatone.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/sepiatone.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/sepiatone.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,15 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+include Magick
+
+img = Image.read('images/Flower_Hat.jpg').first
+
+begin
+    sepiatone = img.sepiatone(MaxRGB * 0.8)
+rescue NotImplementedError
+    sepiatone = Image.read('images/notimplemented.gif').first
+end
+
+sepiatone.write('sepiatone.jpg')
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/shade.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/shade.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/shade.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate Image#shade
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img = img.shade(true, 50, 50)
+
+img.write('shade.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/shave.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/shave.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/shave.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,15 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#shave method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img = img.shave(20, 25)
+
+# Add a border so the shaved image is the
+# same size as the original image.
+img.border!(20, 25, 'white')
+
+img.write('shave.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/shear.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/shear.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/shear.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,10 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#shear method.
+
+img = Magick::Image.read("images/Flower_Hat.jpg").first
+img = img.shear(-30,-30)
+#img.display
+img.write('shear.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/skewx.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/skewx.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/skewx.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,50 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(250, 250, Magick::HatchFill.new('white','lightcyan2'))
+
+gc = Magick::Draw.new
+
+# Move the origin to the center.
+gc.translate(125, 125)
+max_x = imgl.columns/2
+max_y = imgl.rows/2 - 5
+
+# Skew x 30 degrees
+gc.skewx(30)
+
+# Draw down-pointing arrow
+gc.fill('red')
+gc.stroke('red')
+gc.stroke_width(3)
+gc.line(0, -max_y,  0, max_y)
+gc.line(0,  max_y,  7, max_y-7)
+gc.line(0,  max_y, -7, max_y-7)
+
+# Draw right-pointing arrow
+gc.stroke('gray50')
+gc.stroke_width(1)
+gc.line(-max_x, 0, max_x,    0)
+gc.line( max_x, 0, max_x-5, -5)
+gc.line( max_x, 0, max_x-5,  5)
+
+gc.draw(imgl)
+
+# Add labels using "normal" skew
+gc = Magick::Draw.new
+gc.pointsize(14)
+gc.stroke('transparent')
+gc.gravity(Magick::CenterGravity)
+gc.text(10, -10, "'0,0'")
+gc.gravity(Magick::EastGravity)
+gc.text(10, 10, "'+x'")
+gc.gravity(Magick::SouthGravity)
+gc.text(0, 20, "'+y'")
+
+gc.draw(imgl)
+
+imgl.border!(1,1, "lightcyan2")
+
+imgl.write("skewx.gif")
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/skewy.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/skewy.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/skewy.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,45 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(250, 250, Magick::HatchFill.new('white','lightcyan2'))
+
+gc = Magick::Draw.new
+
+# Move the origin to the center.
+gc.translate(125, 125)
+max_x = imgl.columns/2
+max_y = imgl.rows/2
+
+# Skew y 30 degrees
+gc.skewy(30)
+
+# Draw down-pointing arrow
+gc.fill('gray50')
+gc.line(0, -max_y,   0, max_y)
+gc.line(0,  max_y,  10, max_y-10)
+gc.line(0,  max_y, -10, max_y-10)
+
+# Draw right-pointing arrow
+gc.stroke('red')
+gc.stroke_width(3)
+gc.line(-max_x+10, 0, max_x-10,   0)
+gc.line( max_x-10, 0, max_x-20, -10)
+gc.line( max_x-10, 0, max_x-20,  10)
+
+gc.draw(imgl)
+
+# Add labels
+gc = Magick::Draw.new
+gc.pointsize(14)
+gc.stroke('transparent')
+gc.gravity(Magick::CenterGravity)
+gc.text(15, 0, "'0,0'")
+gc.gravity(Magick::EastGravity)
+gc.text(10, 0, "'+x'")
+gc.gravity(Magick::SouthGravity)
+gc.text(10, 20, "'+y'")
+gc.draw(imgl)
+
+imgl.border!(1,1, 'lightcyan2')
+imgl.write("skewy.gif")

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/smile.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/smile.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/smile.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,125 @@
+#! /usr/local/bin/ruby -w
+# RMagick version of ImageMagick's "smile.c" example program.
+
+require 'RMagick'
+include Magick
+
+SmileWidth = 48
+SmileHeight = 48
+SmileBits = [
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
+    1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
+    1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+    0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
+    0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+    0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
+    0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1,
+    1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
+    1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
+    1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+    0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+    1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0 ]
+
+	img = Image.new(SmileWidth, SmileHeight)
+    
+    q = Array.new                           # Create an array of pixels one
+    SmileWidth.times do                     # row long
+        q << Magick::Pixel.new(0,0,0,0)
+    end
+
+	n = 0
+    SmileHeight.times do |y|                # Store pixels a row at a time
+        SmileWidth.times do |x|             # Build a row of pixels
+            q[x].red   = MaxRGB * SmileBits[n]
+            q[x].green = MaxRGB * SmileBits[n]
+            q[x].blue  = MaxRGB * SmileBits[n]
+			n += 1
+        end
+                                            # Store the row of pixels
+        img.store_pixels(0, y, SmileWidth, 1, q)
+    end
+
+#   img.display                               # Now display the result
+    img.write('smile.gif')
+    exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/solarize.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/solarize.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/solarize.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#solarize method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img = img.solarize(127.5)
+
+img.write('solarize.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/splice.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/splice.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/splice.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,16 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+include Magick
+
+# Demonstrate the splice method.
+
+img = Image.read('images/Flower_Hat.jpg').first
+
+begin
+    spliced_img = img.splice(img.columns/2, img.rows/2, 20, 20, 'gray80')
+    spliced_img.write('splice.jpg')
+rescue NotImplementedError
+    not_implemented = Magick::Image.read("images/notimplemented.gif").first
+    not_implemented.write('splice.jpg')
+end
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/spread.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/spread.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/spread.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#spread method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img = img.spread
+
+img.write('spread.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/stegano.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/stegano.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/stegano.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,66 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#stegano method.
+
+# Create a small watermark from the Snake image by
+# shrinking it and converting it to B&W.
+begin
+    watermark = Magick::Image.read('images/Snake.wmf').first
+    watermark.scale!(64.0/watermark.rows)
+    watermark = watermark.quantize(256, Magick::GRAYColorspace)
+    wmrows = watermark.rows
+    wmcols = watermark.columns
+
+    # Read the image in which we'll hide the watermark.
+    img = Magick::Image.read('images/Flower_Hat.jpg').first
+    img.scale!(250.0/img.rows)
+
+    # Embed the watermark starting at offset 91.
+    puts 'Embedding watermark...'
+    stegano = img.stegano(watermark, 91)
+    puts 'Watermark embedded'
+
+    # Write the watermarked image in MIFF format. Note that
+    # the format must be lossless - Image#stegano doesn't work
+    # with lossy formats like JPEG.
+    stegano.write('img.miff')
+
+    # Read the image and retrieve the watermark. The size
+    # attribute describes the size and offset of the watermark.
+
+    # This can take some time. Keep track of how far along we are.
+    # We have to be careful, though. Recent versions of ImageMagick support the
+    # Info#monitor= method and deprecate Magick.set_monitor, so don't use
+    # Magick.set_monitor if Info#monitor= is supported.
+
+    monitor = Proc.new do |text, quantum, span|
+        printf("Extracting watermark...%3.0f%% complete\n", ((1.0-(quantum/span.to_f))*100.0))
+        true
+        end
+
+    stegano = Magick::Image.read('stegano:img.miff') do
+        self.size = Magick::Geometry.new(wmcols, wmrows, 91)
+        begin
+            self.monitor = monitor
+        rescue NotImplementedError
+            Magick.set_monitor(monitor)
+        end
+    end
+
+    begin
+        stegano[0].monitor = nil
+    rescue NotImplementedError
+        Magick.set_monitor(nil)
+    end
+
+    # We don't need this any more.
+    File.delete('img.miff')
+
+    stegano[0].write('stegano.gif')
+
+rescue Magick::ImageMagickError
+    puts "#{$0}: ImageMagickError - #{$!}"
+end
+
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_dasharray.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_dasharray.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_dasharray.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,41 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(500,180, Magick::HatchFill.new('white','lightcyan2'))
+gc = Magick::Draw.new
+
+gc.stroke_width(5)
+gc.fill('transparent')
+
+gc.stroke_dasharray(30,10, 10,10)
+gc.stroke('green')
+gc.line(10, 20, 490, 20)
+
+gc.stroke_dasharray(5,10,5)
+gc.stroke_dashoffset(10)
+gc.stroke('blue')
+gc.line(10, 80, 490, 80)
+
+gc.stroke_dasharray(10,10)
+gc.stroke_dashoffset(0)
+gc.stroke('red')
+gc.line(10, 140, 490, 140)
+
+gc.fill('black')
+gc.stroke('transparent')
+
+gc.gravity(Magick::CenterGravity)
+gc.text( 0, -60, "'gc.stroke_dasharray(30, 10, 10, 10)'")
+gc.text( 0,   0, "'gc.stroke_dasharray(5, 10, 5)'")
+gc.text( 0,  12, "'gc.stroke_dashoffset(10)'")
+gc.text( 0,  60, "'gc.stroke_dasharray(10, 10)'")
+
+gc.draw(imgl)
+
+imgl.border!(1,1,"lightcyan2")
+#imgl.display
+imgl.write("stroke_dasharray.gif")
+exit
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_fill.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_fill.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_fill.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,11 @@
+#! /usr/local/bin/ruby -w
+require 'rvg/rvg'
+
+rvg = Magick::RVG.new(150, 150) do |canvas|
+    canvas.background_fill = ''
+    canvas.circle(40, 75, 75).styles(:stroke=>'blue', :fill=>'#00ff00',:stroke_width=>8)
+    canvas.rect(149,149).styles(:fill=>'none',:stroke=>'blue')
+end
+
+rvg.draw.write('stroke_fill.gif')
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_linecap.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_linecap.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_linecap.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,44 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(615, 100)
+
+gc = Magick::Draw.new
+gc.stroke('black').stroke_width(30)
+
+# Draw thick line with "butt" linecap
+gc.stroke_linecap('butt')
+gc.line(25,50, 175,50)
+
+# Draw thick line with "round" linecap
+gc.stroke_linecap('round')
+gc.line(225,50, 375,50)
+
+# Draw thick line with "square" linecap
+gc.stroke_linecap('square')
+gc.line(425,50, 575,50)
+
+# Show line endpoints in pink
+gc.fill('lightpink')
+gc.stroke('lightpink').stroke_width(3)
+gc.line(25,50, 175,50)
+gc.circle(25,50, 27,52).circle(175,50,177,52)
+gc.line(225,50, 375,50)
+gc.circle(225,50, 227,52).circle(375,50,377,52)
+gc.line(425,50, 575, 50)
+gc.circle(425,50, 427,52).circle(575,50,577,52)
+
+# Annotate
+gc.fill('black')
+gc.stroke('transparent')
+gc.pointsize(14)
+gc.font_weight(Magick::BoldWeight)
+
+gc.text(55,90, "\"'butt' cap\"")
+gc.text(250,90, "\"'round' cap\"")
+gc.text(450,90, "\"'square' cap\"")
+
+gc.draw(imgl)
+
+imgl.write("stroke_linecap.gif")

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_linejoin.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_linejoin.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_linejoin.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,48 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(400, 150) { self.background_color = 'white' }
+
+gc = Magick::Draw.new
+
+gc.stroke('black').stroke_width(15)
+gc.fill_opacity(0)
+gc.stroke_linecap('butt')
+
+# Draw lines with miter join
+gc.stroke_linejoin('miter')
+gc.polyline(25,100, 75,25, 125,100)
+
+# Draw lines with round join
+gc.stroke_linejoin('round')
+gc.polyline(150,100, 200,25, 250,100)
+
+# Draw lines with bevel join
+gc.stroke_linejoin('bevel')
+gc.polyline(275,100, 325,25, 375,100)
+
+# Show line endpoints in pink
+gc.fill('lightpink').fill_opacity(0)
+gc.stroke('lightpink').stroke_width(2)
+gc.stroke_linejoin('miter')
+gc.polyline(25,100, 75,25, 125,100)
+gc.polyline(150,100, 200,25, 250,100)
+gc.polyline(275,100, 325,25, 375,100)
+gc.fill_opacity(1)
+gc.circle(75,25, 76,26)
+gc.circle(200,25, 201,26)
+gc.circle(325,25, 326,26)
+
+# Annotate
+gc.fill('black')
+gc.stroke('transparent')
+gc.pointsize(14)
+gc.font_weight(Magick::BoldWeight)
+gc.text(35,120, "\"'miter' join\"")
+gc.text(160,120, "\"'round' join\"")
+gc.text(280,120, "\"'bevel' join\"")
+
+gc.draw(imgl)
+
+imgl.write("stroke_linejoin.gif")

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_width.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_width.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/stroke_width.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,47 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(500,80, Magick::HatchFill.new('white','lightcyan2'))
+
+gc = Magick::Draw.new
+
+# Draw 5-pixel wide line
+gc.stroke('LightPink')
+gc.stroke_width(5)
+gc.line(10,30, 130,30)
+
+# Draw 10-pixel wide line
+gc.stroke('LightSkyBlue2')
+gc.stroke_width(10)
+gc.line(130,30, 230,30)
+
+# Draw 20-pixel wide line
+gc.stroke('GreenYellow')
+gc.stroke_width(20)
+gc.line(230,30,370,30)
+
+# Draw 40-pixel wide line
+gc.stroke('MediumOrchid2')
+gc.stroke_width(40)
+gc.line(370,30,490,30)
+
+# Draw 1-pixel wide line through the center
+gc.stroke('black')
+gc.stroke_width(1)
+gc.line(10,30,490,30)
+
+# Annotate
+gc.fill('black')
+gc.stroke('transparent')
+gc.text(60,70,"'5'")
+gc.text(180,70,"'10'")
+gc.text(300,70,"'20'")
+gc.text(420,70,"'40'")
+
+gc.draw(imgl)
+imgl.border!(1,1,"lightcyan2")
+
+imgl.write('stroke_width.gif')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/swirl.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/swirl.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/swirl.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,17 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#swirl method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+# Make an animated image.
+animation = Magick::ImageList.new
+animation << img.copy
+30.step(360,45) { |degrees| animation << img.swirl(degrees) }
+
+animation.delay = 20
+animation.iterations = 10000
+
+animation.write('swirl.gif')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/text.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/text.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/text.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,32 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(190,190)
+
+sample = Magick::Draw.new
+sample.stroke('transparent')
+sample.font_family('times')
+sample.pointsize(24)
+
+sample.font_style(Magick::NormalStyle)
+sample.text(20,40, 'NormalStyle')
+
+sample.font_style(Magick::ItalicStyle)
+sample.text(20,70, 'ItalicStyle')
+
+sample.font_style(Magick::ObliqueStyle)
+sample.text(20,100, 'ObliqueStyle')
+
+sample.font_style(Magick::NormalStyle)
+sample.font_weight(Magick::BoldWeight)
+sample.text(20,130, 'BoldWeight')
+
+sample.font_weight(Magick::LighterWeight)
+sample.text(20,160, 'LighterWeight')
+
+sample.draw(imgl)
+
+imgl.write('text.gif')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/text_align.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/text_align.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/text_align.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,36 @@
+#! /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

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/text_antialias.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/text_antialias.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/text_antialias.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,33 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(275, 170) { self.background_color = "white" }
+
+gc = Magick::Draw.new
+gc.fill('black')
+gc.stroke('transparent')
+
+gc.font_family('courier')
+gc.font_weight(Magick::BoldWeight)
+gc.pointsize(200)
+
+# Turn off antialiasing
+gc.text_antialias(false)
+gc.text(15, 145, 'A')
+
+# Turn it back on
+gc.text_antialias(true)
+gc.text(145, 145, 'A')
+
+gc.draw(imgl)
+
+# Blow up the image so we can
+# easily see the image, then
+# crop to a representative portion.
+imgl.resize!(3).crop!(235,270, 365,180)
+imgl.page = Magick::Rectangle.new(365, 180)
+imgl.border!(1,1,"black")
+imgl.write("text_antialias.gif")
+exit
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/text_styles.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/text_styles.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/text_styles.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,21 @@
+#! /usr/local/bin/ruby -w
+require 'rvg/rvg'
+
+
+rvg = Magick::RVG.new(200, 100) do |canvas|
+    canvas.background_fill = 'white'
+
+    canvas.g.styles(:font_size=>16) do |grp|
+        grp.text( 30, 30, ":text_anchor=>'start'").styles(:text_anchor=>'start')
+        grp.circle(1, 30, 30).styles(:stroke=>'red')
+        grp.text(100, 50, ":text_anchor=>'middle'").styles(:text_anchor=>'middle')
+        grp.circle(1, 100, 50).styles(:stroke=>'red')
+        grp.text(170, 70, ":text_anchor=>'end'").styles(:text_anchor=>'end')
+        grp.circle(1, 170, 70).styles(:stroke=>'red')
+    end
+
+    canvas.rect(199, 99).styles(:fill=>'none', :stroke=>'blue')
+end
+
+rvg.draw.write('text_styles.gif')
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/text_undercolor.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/text_undercolor.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/text_undercolor.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,26 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Draw#text_undercolor method
+
+canvas = Magick::Image.new(250, 100)  {self.background_color ='white'}
+
+gc = Magick::Draw.new
+
+gc.stroke('transparent')
+gc.pointsize(16)
+gc.gravity(Magick::CenterGravity)
+
+gc.text_undercolor('cyan')
+gc.text(0,-20,"text_undercolor('cyan')")
+
+gc.text_undercolor('yellow')
+gc.text(0,0,"text_undercolor('yellow')")
+
+gc.text_undercolor('pink')
+gc.text(0,20,"text_undercolor('pink')")
+
+gc.draw(canvas)
+
+canvas.write('text_undercolor.gif')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/texture_fill_to_border.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/texture_fill_to_border.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/texture_fill_to_border.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,34 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#texture_fill_to_border method
+# This example is nearly identical to the color_fill_to_border example.
+
+before = Magick::Image.new(200,200) {
+    self.background_color = 'white'
+    self.border_color = 'black'
+    }
+before.border!(1,1,'black')
+
+circle = Magick::Draw.new
+circle.fill('transparent')
+circle.stroke('black')
+circle.stroke_width(2)
+circle.circle(100,100,180,100)
+circle.fill('plum1')
+circle.stroke('transparent')
+circle.circle( 60,100, 40,100)
+circle.circle(140,100,120,100)
+circle.circle(100, 60,100, 40)
+circle.circle(100,140,100,120)
+circle.draw(before)
+
+before.compression = Magick::LZWCompression
+before.write('texture_fill_to_border_before.gif')
+
+hat = Magick::Image.read('images/Flower_Hat.jpg').first
+hat.resize!(0.3)
+after = before.texture_fill_to_border(100,100, hat)
+
+after.write('texture_fill_to_border_after.gif')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/texture_floodfill.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/texture_floodfill.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/texture_floodfill.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,32 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#texture_floodfill method
+# This example is nearly identical to the color_floodfill example.
+
+before = Magick::Image.new(200,200) { self.background_color = 'white' }
+before.border!(1,1,'black')
+
+circle = Magick::Draw.new
+circle.fill('transparent')
+circle.stroke_width(2)
+circle.stroke('black')
+circle.circle(100,100,180,100)
+circle.fill('plum1')
+circle.stroke('transparent')
+circle.circle( 60,100, 40,100)
+circle.circle(140,100,120,100)
+circle.circle(100, 60,100, 40)
+circle.circle(100,140,100,120)
+circle.draw(before)
+
+before.compression = Magick::LZWCompression
+before.write('texture_floodfill_before.gif')
+
+hat = Magick::Image.read('images/Flower_Hat.jpg').first
+hat.resize!(0.3)
+before.fuzz = 25
+after = before.texture_floodfill(100,100, hat)
+
+after.write('texture_floodfill_after.gif')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/texturefill.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/texturefill.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/texturefill.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,25 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Magick::TextureFill class.
+
+granite = Magick::Image.read('granite:').first
+fill = Magick::TextureFill.new(granite)
+img = Magick::ImageList.new
+img.new_image(300, 100, fill)
+
+# Annotate the filled image with the code that created the fill.
+
+ann = Magick::Draw.new
+ann.annotate(img, 0,0,0,0, "TextureFill.new(granite)") {
+    self.gravity = Magick::CenterGravity
+    self.fill = 'white'
+    self.font_weight = Magick::BoldWeight
+    self.stroke = 'transparent'
+    self.pointsize = 14
+    }
+
+#img.display
+img.write("texturefill.gif")
+exit
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/threshold.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/threshold.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/threshold.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,13 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#threshold method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+# Use a threshold of 55% of MaxRGB.
+img = img.threshold(Magick::MaxRGB*0.55)
+
+#img.display
+img.write('threshold.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/to_blob.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/to_blob.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/to_blob.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,14 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+before = Magick::Image.read("images/Flower_Hat.jpg").first
+before.resize!(0.50)  # make it small so this example will run fast
+
+blob = before.to_blob
+# We could pass the format, depth, and geometry as optional
+# arguments to `from_blob' but that is not required.
+after = Magick::Image.from_blob(blob)
+
+after[0].write("to_blob.gif")
+exit
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/translate.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/translate.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/translate.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,37 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+imgl = Magick::ImageList.new
+imgl.new_image(250, 250, Magick::HatchFill.new('white','lightcyan2'))
+
+gc = Magick::Draw.new
+gc.stroke('red')
+gc.stroke_width(2)
+
+# Move the origin to the center.
+gc.translate(125, 125)
+max_x = imgl.columns/2
+max_y = imgl.rows/2
+
+# Draw down-pointing arrow
+gc.line(0, -max_y,   0, max_y)
+gc.line(0,  max_y,  10, max_y-10)
+gc.line(0,  max_y, -10, max_y-10)
+
+# Draw right-pointing arrow
+gc.line(-max_x, 0, max_x,     0)
+gc.line( max_x, 0, max_x-10, -10)
+gc.line( max_x, 0, max_x-10,  10)
+
+# Add labels
+gc.fill('black')
+gc.stroke('transparent')
+gc.text(8, 15, "'0,0'")
+gc.text(110, 16, "x")
+gc.text(12, 115, "y")
+
+gc.draw(imgl)
+
+imgl.border!(1,1, "lightcyan2")
+
+imgl.write("translate.gif")

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/transparent.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/transparent.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/transparent.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,38 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#transparent method.
+# Change all black pixels in the image to transparent.
+
+before = Magick::Image.new(200,200) {
+    self.background_color = 'black'
+    }
+
+circle = Magick::Draw.new
+circle.fill('transparent')
+circle.stroke('white')
+circle.stroke_width(8)
+circle.circle(100,100,180,100)
+circle.fill('transparent')
+circle.stroke('white')
+circle.circle( 60,100, 40,100)
+circle.circle(140,100,120,100)
+circle.circle(100, 60,100, 40)
+circle.circle(100,140,100,120)
+circle.draw(before)
+
+before.compression = Magick::LZWCompression
+before.write('transparent_before.gif')
+
+before.fuzz = 100
+after = before.transparent('black', Magick::TransparentOpacity)
+
+# Different way of reading an image - start with an imagelist.
+# Use the plasma image as a background so we can see that
+# the black pixels have been made transparent.
+bg = Magick::ImageList.new
+bg.read('plasma:purple-gold') { self.size = '200x200' }
+
+after = bg.composite(after, Magick::CenterGravity, Magick::OverCompositeOp)
+after.write('transparent_after.gif')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/unsharp_mask.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/unsharp_mask.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/unsharp_mask.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,28 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+# Demonstrate the Image#enhance method
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+eimg = img.unsharp_mask(3.0, 1.0, 1.0, 0.05)
+
+img.resize!(3)
+eimg.resize!(3)
+
+# Make a before-and-after composite
+eimg.crop!(eimg.columns/2, 0, eimg.columns/2, eimg.rows)
+img = img.composite(eimg, Magick::EastGravity, Magick::OverCompositeOp)
+
+# Draw a black line between the before and after parts.
+line = Magick::Draw.new
+line.line(img.columns/2, 0, img.columns/2, img.rows)
+line.draw(img)
+
+# Zoom in so we can see the change,
+# then crop everything but the face.
+img.crop!(Magick::CenterGravity, 250, 200)
+
+#img.display
+img.write('unsharp_mask.jpg')
+exit

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/viewex.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/viewex.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/viewex.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,36 @@
+#! /usr/local/bin/ruby -w
+
+require 'RMagick'
+include Magick
+
+img = Image.new(40, 40) {self.background_color = 'lightcyan2'}
+
+# The view is 400 pixels square, starting
+# column 10, row 5 from the top of the image.
+img.view( 10, 5, 20, 20) do |view|
+
+    # Set all the pixels in the view to green.
+    view[][] = Pixel.new(0, MaxRGB)
+
+    # Change the top and bottom rows to red.
+    view[0][] = 'red'
+    view[-1,1][] = 'red'
+
+    # Set 6 pixels to black.
+    view[[13,15]][[12,14,16]] = 'black'
+
+    # Set 1 pixel to yellow.
+    view[5][7] = 'yellow'
+
+    # Change the green channel of all the
+    # pixels on row 8.
+    view[8][].green = MaxRGB/2
+
+    # Change the blue channel of 8 pixels
+    # on column 10.
+    view[4,8][10].blue = MaxRGB
+end
+
+img.scale(5).write("viewex.gif")
+exit
+

Added: packages/librmagick-ruby/branches/upstream/current/doc/ex/wave.rb
===================================================================
--- packages/librmagick-ruby/branches/upstream/current/doc/ex/wave.rb	2006-01-25 18:27:01 UTC (rev 304)
+++ packages/librmagick-ruby/branches/upstream/current/doc/ex/wave.rb	2006-01-25 19:01:00 UTC (rev 305)
@@ -0,0 +1,9 @@
+#! /usr/local/bin/ruby -w
+require 'RMagick'
+
+img = Magick::Image.read('images/Flower_Hat.jpg').first
+
+img = img.wave
+
+img.write('wave.jpg')
+exit




More information about the pkg-ruby-extras-maintainers mailing list