From d501816f1c8c604a73c990f171929bc3e753de8a Mon Sep 17 00:00:00 2001 From: Watson Date: Thu, 16 May 2024 19:32:36 +0900 Subject: [PATCH] Update document (#27) --- comtasks.html | 55 +++++----- constants.html | 6 +- draw.html | 18 ++-- ilist.html | 10 +- image1.html | 38 +++---- image2.html | 32 +++--- image3.html | 79 +++++++------- imageattrs.html | 4 +- imusage.html | 6 +- index.html | 6 +- info.html | 12 +-- magick.html | 4 +- optequiv.html | 4 +- rvg.html | 8 +- rvgclip.html | 4 +- rvggroup.html | 4 +- rvgimage.html | 4 +- rvgpattern.html | 4 +- rvgshape.html | 12 +-- rvgstyle.html | 4 +- rvgtext.html | 4 +- rvgtspan.html | 4 +- rvgtut.html | 114 ++++++++++---------- rvguse.html | 4 +- rvgxform.html | 4 +- struct.html | 8 +- usage.html | 272 +++++++++++++++++++++++------------------------- 27 files changed, 352 insertions(+), 372 deletions(-) diff --git a/comtasks.html b/comtasks.html index 3ee705c..41aceee 100644 --- a/comtasks.html +++ b/comtasks.html @@ -4,7 +4,7 @@ - RMagick 6.0.0: Common Tasks + RMagick 6.0.1: Common Tasks @@ -25,7 +25,7 @@ - + @@ -64,30 +64,29 @@

Getting information about an image

 require "rmagick"
-ARGV.each { |file|
-    puts file
-    img = Magick::Image::read(file).first
-    puts "   Format: #{img.format}"
-    puts "   Geometry: #{img.columns}x#{img.rows}"
-    puts "   Class: " + case img.class_type
-                            when Magick::DirectClass
-                                "DirectClass"
-                            when Magick::PseudoClass
-                                "PseudoClass"
-                        end
-    puts "   Depth: #{img.depth} bits-per-pixel"
-    puts "   Colors: #{img.number_colors}"
-    puts "   Filesize: #{img.filesize}"
-    puts "   Resolution: #{img.x_resolution.to_i}x#{img.y_resolution.to_i} "+
-        "pixels/#{img.units == Magick::PixelsPerInchResolution ?
-        "inch" : "centimeter"}"
-    if img.properties.length > 0
-        puts "   Properties:"
-        img.properties { |name,value|
-            puts %Q|      #{name} = "#{value}"|
-        }
-    end
-    }
+ARGV.each do |file|
+  puts file
+  img = Magick::Image.read(file).first
+  puts "   Format: #{img.format}"
+  puts "   Geometry: #{img.columns}x#{img.rows}"
+  puts "   Class: " + case img.class_type
+                      when Magick::DirectClass
+                        "DirectClass"
+                      when Magick::PseudoClass
+                        "PseudoClass"
+                      end
+  puts "   Depth: #{img.depth} bits-per-pixel"
+  puts "   Colors: #{img.number_colors}"
+  puts "   Filesize: #{img.filesize}"
+  puts "   Resolution: #{img.x_resolution.to_i}x#{img.y_resolution.to_i} " +
+       "pixels/#{img.units == Magick::PixelsPerInchResolution ? 'inch' : 'centimeter'}"
+  next if img.properties.length <= 0
+
+  puts "   Properties:"
+  img.properties do |name, value|
+    puts %(      #{name} = "#{value}")
+  end
+end
 
@@ -109,7 +108,7 @@

Making thumbnails

>. All four are equally easy to use. Specify the number of columns and rows you want the thumbnail to have, like this:

-img = Image.new "bigimage.gif"
+img = Magick::Image.new "bigimage.gif"
 thumb = img.scale(125, 125)
 thumb.write "thumb.gif"
 
Making thumbnails image to 25% of its original size, do this:

-img = Image.new "bigimage.gif"
+img = Magick::Image.new "bigimage.gif"
 thumb = img.scale(0.25)
 thumb.write "thumb.gif"
 
- RMagick 6.0.0: Constants + RMagick 6.0.1: Constants @@ -57,7 +57,7 @@ - + @@ -417,7 +417,7 @@

ColorspaceType

Each version of ImageMagick defines a subset of the colorspaces listed below. To list the subset supported by your version, issue the command:

-ruby -rRMagick -e"Magick::ColorspaceType.values {|cs| puts cs}"
+ruby -r rmagick -e"Magick::ColorspaceType.values {|cs| puts cs}"
 
diff --git a/draw.html b/draw.html index cf2ad64..5b88bf5 100644 --- a/draw.html +++ b/draw.html @@ -4,7 +4,7 @@ - RMagick 6.0.0: class Draw + RMagick 6.0.1: class Draw @@ -20,7 +20,7 @@ - + @@ -291,7 +291,7 @@

Returns

Example

-gc = Draw.new
+gc = Magick::Draw.new
 
@@ -364,12 +364,12 @@

Example

 title.annotate(montage, 0,0,0,40, 'Named Colors') { |options|
-    options.font_family = 'Helvetica'
-    options.fill = 'white'
-    options.stroke = 'transparent'
-    options.pointsize = 32
-    options.font_weight = BoldWeight
-    options.gravity = NorthGravity
+  options.font_family = 'Helvetica'
+  options.fill = 'white'
+  options.stroke = 'transparent'
+  options.pointsize = 32
+  options.font_weight = BoldWeight
+  options.gravity = NorthGravity
 }
 
diff --git a/ilist.html b/ilist.html index 555764d..a4eab4e 100644 --- a/ilist.html +++ b/ilist.html @@ -4,7 +4,7 @@ - RMagick 6.0.0: class ImageList + RMagick 6.0.1: class ImageList @@ -14,7 +14,7 @@ - + @@ -1702,9 +1702,9 @@

Example

i = Magick::ImageList.new number = '0' 4.times do - i.read "images/Button_" + number + ".gif" - number.succ! - end + i.read "images/Button_" + number + ".gif" + number.succ! +end diff --git a/image1.html b/image1.html index b19a23e..53ffd82 100644 --- a/image1.html +++ b/image1.html @@ -4,7 +4,7 @@ - RMagick 6.0.0: class Image (class methods and instance methods a-d) + RMagick 6.0.1: class Image (class methods and instance methods a-d) @@ -39,7 +39,7 @@ - + @@ -342,7 +342,7 @@

Returns

Example

-img = Image.capture { |options|
+img = Magick::Image.capture { |options|
   options.filename = "root"
 }
 
Returns

Example

-image = Image.constitute(width, height, "RGB", pixels)
+image = Magick::Image.constitute(width, height, "RGB", pixels)
 
@@ -465,7 +465,7 @@

Magick API

from_blob

-

Image.from_blob(string) [ { optional arguments } ] -> array

+

Magick::Image.from_blob(string) [ { optional arguments } ] -> array

@@ -536,7 +536,7 @@

Returns

Example

-img = Image.new(256, 64) { |options|
+img = Magick::Image.new(256, 64) { |options|
   options.background_color = 'red'
 }
 
Returns

Example

-cheetah = Image.ping("Cheetah.jpg") »
- [Cheetah.jpg JPEG 1024x768 DirectClass 8-bit 101684b]
+cheetah = Magick::Image.ping("Cheetah.jpg") » [Cheetah.jpg JPEG 1024x768 DirectClass 8-bit 101684b]
 p cheetah[0].rows » 768
 p cheetah[0].columns » 1024
 
Returns

Example

-animated = Image.read("animated.gif") »
-[animated.gif GIF 127x120+0+0 PseudoClass 256c 8-bit 54395b
-animated.gif[1] GIF 127x120+0+0 PseudoClass 256c 8-bit 54395b,
-animated.gif[2] GIF 127x120+0+0 PseudoClass 256c 8-bit 54395b]
+animated = Magick::Image.read("animated.gif") » [animated.gif GIF 127x120+0+0 PseudoClass 256c 8-bit 54395b
+                                              »  animated.gif[1] GIF 127x120+0+0 PseudoClass 256c 8-bit 54395b,
+                                              »  animated.gif[2] GIF 127x120+0+0 PseudoClass 256c 8-bit 54395b]
 
@@ -687,7 +685,7 @@

Returns

Example

 content = "R0lGODlhnAEuAferAAAAAAcIBggJBgw..."
-img = Image.read_inline(content)
+img = Magick::Image.read_inline(content)
 
@@ -1348,7 +1346,7 @@

Returns

Example

-    img.add_profile('my_cmyk.icm')
+img.add_profile('my_cmyk.icm')
 
@@ -2165,10 +2163,10 @@

Returns

Example

-mona = Image.read('MonaLisa.jpg').first
+mona = Magick::Image.read('MonaLisa.jpg').first
 mona.change_geometry!('320x240') { |cols, rows, img|
- img.resize!(cols, rows)
- }
+  img.resize!(cols, rows)
+}
 
@@ -3378,11 +3376,9 @@

Returns

Example

-f = Image.read('cbezier1.gif').first »
- cbezier1.gif GIF 500x350+0+0 PseudoClass 128c 8-bit 177503b
+f = Magick::Image.read('cbezier1.gif').first » cbezier1.gif GIF 500x350+0+0 PseudoClass 128c 8-bit 177503b
 f.colors » 128
-f.compress_colormap! »
- cbezier1.gif GIF 500x350+0+0 PseudoClass 108c 8-bit 177503b
+f.compress_colormap! » cbezier1.gif GIF 500x350+0+0 PseudoClass 108c 8-bit 177503b
 f.colors » 108
 
diff --git a/image2.html b/image2.html index 5bf19ee..ceea6ce 100644 --- a/image2.html +++ b/image2.html @@ -4,7 +4,7 @@ - RMagick 6.0.0: class Image (instance methods e-o) + RMagick 6.0.1: class Image (instance methods e-o) @@ -41,7 +41,7 @@ - + @@ -1125,8 +1125,7 @@

Returns

Example

-img2 = img.function_channel(Magick::PolynomialFunction,
-                            -25, 53, -36, 8.3, 0.2)
+img2 = img.function_channel(Magick::PolynomialFunction, -25, 53, -36, 8.3, 0.2)
 
@@ -1247,7 +1246,7 @@

Returns

Example

-

gaussian_blur(0.0, 3.0)

+

img.gaussian_blur(0.0, 3.0)

Returns

Example

-image.get_exif_by_entry('Make') » [["Make", "Canon"]]
-image.get_exif_by_entry("ShutterSpeedValue") »
-    [["ShutterSpeedValue", "189/32"]]
-image.get_exif_by_entry() »
-    [["Make", "Canon"], ["ShutterSpeedValue", "189/32"] ...]
+image.get_exif_by_entry('Make')              » [["Make", "Canon"]]
+image.get_exif_by_entry("ShutterSpeedValue") » [["ShutterSpeedValue", "189/32"]]
+image.get_exif_by_entry()                    » [["Make", "Canon"], ["ShutterSpeedValue", "189/32"] ...]
 
@@ -1393,10 +1390,9 @@

Returns

Example

-image.get_exif_by_number(271) » {271=>"Canon"}
+image.get_exif_by_number(271)   » {271=>"Canon"}
 image.get_exif_by_number(37377) » {37377=>"189/32"}
-image.get_exif_by_number() »
-    {271=>"Canon", 37377=>"189/32" ...}
+image.get_exif_by_number()      » {271=>"Canon", 37377=>"189/32" ...}
 
@@ -2217,10 +2213,10 @@

Example

pixels argument. Note that this example assumes that ImageMagick is configured with QuantumDepth=8.

-hat = Image.read("Flower_Hat.jpg").first
+hat = Magick::Image.read("Flower_Hat.jpg").first
 pixels = hat.export_pixels(0, 0, hat.columns, hat.rows, "RGB")
 char_buffer = pixels.pack("C*")
-img = Image.new(hat.columns, hat.rows)
+img = Magick::Image.new(hat.columns, hat.rows)
 img.import_pixels(0, 0, hat.columns, hat.rows, "RGB", char_buffer, CharPixel)
 
@@ -2349,7 +2345,7 @@

Returns

Example

-

level(0,1.50)

+

img.level(0,1.50)

Returns

Example

-

modulate(0.85)

+

img.modulate(0.85)

Returns

Example

-

negate_channel(false, GreenChannel)

+

img.negate_channel(false, GreenChannel)

- RMagick 6.0.0: class Image (instance methods p-w) + RMagick 6.0.1: class Image (instance methods p-w) @@ -46,7 +46,7 @@ -

+ @@ -587,7 +587,9 @@

Example

This half-size preview demonstrates the SolarizePreview argument.

- preview example + preview example

Magick API

@@ -866,7 +868,7 @@

Example

Divide the red component of all the pixels in the image by 2:

-img.quantum_operator(DivideQuantumOperator, 2, RedChannel)
+img.quantum_operator(Magick::DivideQuantumOperator, 2, Magick::RedChannel)
 
@@ -1069,8 +1071,8 @@

Returns

Example

-geom = Geometry.new(QuantumRange/2)
-random_threshold_channel(geom, RedChannel)
+geom = Magick::Geometry.new(Magick::QuantumRange/2)
+random_threshold_channel(geom, Magick::RedChannel)
 
@@ -1896,7 +1898,7 @@

Returns

Example

-

segment(YUVColorspace, 0.4, 0.4)

+

img.segment(YUVColorspace, 0.4, 0.4)

Returns

Example

-

shade(true, 50, 50)

+

img.shade(true, 50, 50)

Returns

Example

-img = Image.read('ex/images/Flower_Hat.jpg').first »
-  ex/images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9761b
-img.properties »
-  {"comment"=>"File written by Adobe Photoshop\250 4.0"}
-img.signature »
-  "485e01ecba1a1f47924d67b887cb07b474f695841733796dfa3c2876965c7e8b"
-img.properties »
-  {"signature"=>"485e01ecba1a1f47924d67b887cb07b474f695841733796dfa3c2876965c7e8b",
-   "comment"=>"File written by Adobe Photoshop\250 4.0"}
+img = Magick::Image.read('ex/images/Flower_Hat.jpg').first » ex/images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9761b
+img.properties » {"comment"=>"File written by Adobe Photoshop\250 4.0"}
+img.signature  » "485e01ecba1a1f47924d67b887cb07b474f695841733796dfa3c2876965c7e8b"
+img.properties » {"signature"=>"485e01ecba1a1f47924d67b887cb07b474f695841733796dfa3c2876965c7e8b",
+               » "comment"=>"File written by Adobe Photoshop\250 4.0"}
 
@@ -3228,7 +3226,7 @@

Returns

Example

-

threshold(QuantumRange*0.55)

+

img.threshold(Magick::QuantumRange * 0.55)

Returns

Example

-img = Image.read("images/Cheetah.jpg").first
-thumbnail = img.thumbnail(img.columns*0.09, img.rows*0.09)
+img = Magick::Image.read("images/Cheetah.jpg").first
+thumbnail = img.thumbnail(img.columns * 0.09, img.rows * 0.09)
 
@@ -3389,12 +3387,9 @@

Returns

Example

-img = Image.read('ex/images/Flower_Hat.jpg').first
-» ex/images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9761b
-pixel = img.pixel_color(img.columns/2, img.rows/2)
-» #<struct Pixel red=216, green=147, blue=106, opacity=0>
-img.to_color(pixel)
-» "#D8936A"
+img = Magick::Image.read('ex/images/Flower_Hat.jpg').first » ex/images/Flower_Hat.jpg JPEG 200x250 DirectClass 8-bit 9761b
+pixel = img.pixel_color(img.columns/2, img.rows/2)         » #<struct Pixel red=216, green=147, blue=106, opacity=0>
+img.to_color(pixel)                                        » "#D8936A"
 
@@ -3919,32 +3914,32 @@

Examples

view example

-img = Image.new(40, 40) { |options| options.background_color = 'lightcyan2'}
+img = Magick::Image.new(40, 40) { |options| options.background_color = 'lightcyan2'}
 
 # The view is 400 pixels square, starting at
 # 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, QuantumRange)
+  # Set all the pixels in the view to green.
+  view[][] = Pixel.new(0, Magick::QuantumRange)
 
-    # Change the top and bottom rows to red.
-    view[0][] = 'red'
-    view[-1,1][] = 'red'
+  # 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 6 pixels to black.
+  view[[13,15]][[12,14,16]] = 'black'
 
-    # Set 1 pixel to yellow.
-    view[5][7] = 'yellow'
+  # Set 1 pixel to yellow.
+  view[5][7] = 'yellow'
 
-    # Change the green channel of all the
-    # pixels on row 8.
-    view[8][].green = QuantumRange/2
+  # Change the green channel of all the
+  # pixels on row 8.
+  view[8][].green = Magick::QuantumRange/2
 
-    # Change the blue channel of 8 pixels
-    # on column 10.
-    view[4,8][10].blue = QuantumRange
+  # Change the blue channel of 8 pixels
+  # on column 10.
+  view[4,8][10].blue = Magick::QuantumRange
 end
 
diff --git a/imageattrs.html b/imageattrs.html index 003e104..d0c3e7d 100644 --- a/imageattrs.html +++ b/imageattrs.html @@ -4,7 +4,7 @@ - RMagick 6.0.0: class Image (attribute methods) + RMagick 6.0.1: class Image (attribute methods) @@ -20,7 +20,7 @@ - + diff --git a/imusage.html b/imusage.html index f39ee12..7862dbc 100644 --- a/imusage.html +++ b/imusage.html @@ -4,7 +4,7 @@ - RMagick 6.0.0: ImageMagick Conventions + RMagick 6.0.1: ImageMagick Conventions @@ -64,7 +64,7 @@ - + @@ -373,7 +373,7 @@

Built-in image formats

pixels wide and 200 pixels high, use:

-i = Image.read("gradient:red-blue") { |options| options.size = "100x200" }
+i = Magick::Image.read("gradient:red-blue") { |options| options.size = "100x200" }
 
diff --git a/index.html b/index.html index b254163..4f83175 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - RMagick 6.0.0 User's Guide and Reference + RMagick 6.0.1 User's Guide and Reference @@ -102,7 +102,7 @@

Ruby+ImageMagickTM
- Version 6.0.0 + Version 6.0.1

User's Guide and Reference

@@ -277,7 +277,7 @@

What is RMagick?

About this document

- This document describes Version 6.0.0 of RMagick. It is divided into 4 parts. The first is this page. The second part is a user's guide covering both + This document describes Version 6.0.1 of RMagick. It is divided into 4 parts. The first is this page. The second part is a user's guide covering both RMagick and ImageMagick usage and conventions. The third part is a reference guide to the ImageList, Image, and Draw classes. This guide includes many examples. The fourth part covers Ruby Vector Graphics (RVG). RVG is a facade for Draw that provides a high-level API for scalable vector graphics. The RVG section includes a tutorial and complete reference documentation. diff --git a/info.html b/info.html index 7a2fa4c..866bea5 100644 --- a/info.html +++ b/info.html @@ -4,7 +4,7 @@ - RMagick 6.0.0: class Image::Info - Optional method arguments + RMagick 6.0.1: class Image::Info - Optional method arguments @@ -38,7 +38,7 @@ -

+ @@ -247,8 +247,8 @@

The "user" option

For example,

-img = Magick::Image.new(10,10) do
-   self['user'] = __FILE__ + ':' + __LINE__.to_s
+img = Magick::Image.new(10,10) do |options|
+  options['user'] = __FILE__ + ':' + __LINE__.to_s
 end » 10x10 DirectClass 16-bit user:test.rb:3
 
@@ -267,7 +267,7 @@

Returns

Example

-self["tiff", "bits-per-sample"] = 2
+options["tiff", "bits-per-sample"] = 2
 
@@ -309,7 +309,7 @@

Returns

Example

-self["tiff", "bits-per-sample"] » 2
+options["tiff", "bits-per-sample"] » 2
 
diff --git a/magick.html b/magick.html index aeb0530..557937c 100644 --- a/magick.html +++ b/magick.html @@ -4,7 +4,7 @@ - RMagick 6.0.0: module Magick + RMagick 6.0.1: module Magick @@ -19,7 +19,7 @@ - + diff --git a/optequiv.html b/optequiv.html index eae54a4..d359bc7 100644 --- a/optequiv.html +++ b/optequiv.html @@ -4,7 +4,7 @@ - RMagick 6.0.0: Magick Command Options and Their Equivalent Methods + RMagick 6.0.1: Magick Command Options and Their Equivalent Methods @@ -63,7 +63,7 @@ - + diff --git a/rvgclip.html b/rvgclip.html index 3267c1a..576d9ed 100644 --- a/rvgclip.html +++ b/rvgclip.html @@ -4,7 +4,7 @@ - RMagick 6.0.0: RVG Reference: RVG::ClipPath Class + RMagick 6.0.1: RVG Reference: RVG::ClipPath Class @@ -22,7 +22,7 @@ - + diff --git a/rvggroup.html b/rvggroup.html index e3e465a..00484dc 100644 --- a/rvggroup.html +++ b/rvggroup.html @@ -4,7 +4,7 @@ - RMagick 6.0.0: RVG Reference: RVG::Group Class + RMagick 6.0.1: RVG Reference: RVG::Group Class @@ -22,7 +22,7 @@ - + diff --git a/rvgimage.html b/rvgimage.html index 13aa7b8..e29523a 100644 --- a/rvgimage.html +++ b/rvgimage.html @@ -4,7 +4,7 @@ - RMagick 6.0.0: RVG Reference: RVG::Image Class + RMagick 6.0.1: RVG Reference: RVG::Image Class @@ -22,7 +22,7 @@ - + diff --git a/rvgpattern.html b/rvgpattern.html index a22cea3..0a96473 100644 --- a/rvgpattern.html +++ b/rvgpattern.html @@ -4,7 +4,7 @@ - RMagick 6.0.0: RVG Reference: RVG::Pattern Class + RMagick 6.0.1: RVG Reference: RVG::Pattern Class @@ -22,7 +22,7 @@ - + diff --git a/rvgshape.html b/rvgshape.html index f4c23e7..d0dae09 100644 --- a/rvgshape.html +++ b/rvgshape.html @@ -4,7 +4,7 @@ - RMagick 6.0.0: RVG Reference: Shapes + RMagick 6.0.1: RVG Reference: Shapes @@ -23,7 +23,7 @@ - + @@ -266,10 +266,10 @@
Arguments
one array is shorter than the other, the shorter array is extended by duplicating its elements as necessary. The combined arrays must describe at least 2 pairs of [x,y] coordinates. For example
-    x = [1, 3, 5, 7, 9]
-    y = [2,4]
-    canvas.polygon(x, y)
-    # is equivalent to canvas.polygon(1,2, 3,4, 5,2, 7,4, 9,2)
+x = [1, 3, 5, 7, 9]
+y = [2,4]
+canvas.polygon(x, y)
+# is equivalent to canvas.polygon(1,2, 3,4, 5,2, 7,4, 9,2)
 
diff --git a/rvgstyle.html b/rvgstyle.html index 597661e..628805e 100644 --- a/rvgstyle.html +++ b/rvgstyle.html @@ -4,7 +4,7 @@ - RMagick 6.0.0: RVG Reference: Styles + RMagick 6.0.1: RVG Reference: Styles @@ -22,7 +22,7 @@ - + diff --git a/rvgtext.html b/rvgtext.html index 9abf28f..2aca13b 100644 --- a/rvgtext.html +++ b/rvgtext.html @@ -4,7 +4,7 @@ - RMagick 6.0.0: RVG Reference: RVG::Text Class + RMagick 6.0.1: RVG Reference: RVG::Text Class @@ -28,7 +28,7 @@ - + diff --git a/rvgtspan.html b/rvgtspan.html index e80f8cb..912ca46 100644 --- a/rvgtspan.html +++ b/rvgtspan.html @@ -4,7 +4,7 @@ - RMagick 6.0.0: RVG Reference: RVG::Tspan Class + RMagick 6.0.1: RVG Reference: RVG::Tspan Class @@ -22,7 +22,7 @@ - + diff --git a/rvgtut.html b/rvgtut.html index bec37e0..b04f492 100644 --- a/rvgtut.html +++ b/rvgtut.html @@ -7,7 +7,7 @@ - RMagick 6.0.0: RVG Tutorial + RMagick 6.0.1: RVG Tutorial - + @@ -120,13 +120,11 @@

Basic concepts

it on your monitor

-1. require "rmagick"
-2. include Magick
-3.
-4. cat = ImageList.new("Cheetah.jpg")
-5. cat.display
-6. exit
+require "rmagick"
 
+cat = Magick::ImageList.new("Cheetah.jpg")
+cat.display
+exit
 
@@ -176,13 +174,12 @@

Basic concepts

Going back to the example, let's make one modification.

-1. require "rmagick"
-2. include Magick
-3.
-4. cat = ImageList.new("Cheetah.jpg")
-5. smallcat = cat.minify
-6. smallcat.display
-7. exit
+require "rmagick"
+
+cat = Magick::ImageList.new("Cheetah.jpg")
+smallcat = cat.minify
+smallcat.display
+exit
 
@@ -201,14 +198,13 @@

Basic concepts

Here's how to write the small cheetah to a file in GIF format.

-1. require "rmagick"
-2. include Magick
-3.
-4. cat = ImageList.new("Cheetah.jpg")
-5. smallcat = cat.minify
-6. smallcat.display
-7. smallcat.write("Small-Cheetah.gif")
-8. exit
+require "rmagick"
+
+cat = Magick::ImageList.new("Cheetah.jpg")
+smallcat = cat.minify
+smallcat.display
+smallcat.write("Small-Cheetah.gif")
+exit
 
@@ -260,9 +256,9 @@

Reading, writing, and creating images

 require "rmagick"
-include Magick
+
 # Create a 100x100 red image.
-f = Image.new(100,100) { |options| options.background_color = "red" }
+f = MagickImage.new(100,100) { |options| options.background_color = "red" }
 f.display
 exit
 
Reading, writing, and creating images ImageList#write to combine all the images in those files (remember, each input file can contain multiple images) into one animated GIF file.

-#!/usr/bin/env ruby -w
 require "rmagick"
-anim = ImageList.new("start.gif", "middle.gif", "finish.gif")
+
+anim = Magick::ImageList.new("start.gif", "middle.gif", "finish.gif")
 anim.write("animated.gif")
 exit
 
Drawing

As an example, here's the section of the Ruby program that created the circle in the center of the above image.

- 1. !# /usr/local/bin/ruby -w
- 2. require "rmagick"
- 3.
- 4. canvas = Magick::ImageList.new
- 5. canvas.new_image(250, 250, Magick::HatchFill.new('white', 'gray90'))
- 6.
- 7. circle = Magick::Draw.new
- 8. circle.stroke('tomato')
- 9. circle.fill_opacity(0)
-10. circle.stroke_opacity(0.75)
-11. circle.stroke_width(6)
-12. circle.stroke_linecap('round')
-13. circle.stroke_linejoin('round')
-14. circle.ellipse(canvas.rows/2,canvas.columns/2, 80, 80, 0, 315)
-15. circle.polyline(180,70, 173,78, 190,78, 191,62)
-16. circle.draw(canvas)
+require "rmagick"
+
+canvas = Magick::ImageList.new
+canvas.new_image(250, 250, Magick::HatchFill.new('white', 'gray90'))
+
+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)
 
@@ -1332,36 +1327,35 @@

Annotation

annotate example
- 1.   #! /usr/local/bin/ruby -w
- 2.   require "rmagick"
- 3.
- 4.   # Demonstrate the annotate method
- 5.
- 6.   Text = 'RMagick'
- 7.
- 8.   granite = Magick::ImageList.new('granite:')
- 9.   canvas = Magick::ImageList.new
-10.   canvas.new_image(300, 100, Magick::TextureFill.new(granite))
-11.
-12.   text = Magick::Draw.new
-13.   text.font_family = 'helvetica'
-14.   text.pointsize = 52
-15.   text.gravity = Magick::CenterGravity
-16.
-17.   text.annotate(canvas, 0,0,2,2, Text) { |options|
-18.      options.fill = 'gray83'
-19.   }
-20.
-21.   text.annotate(canvas, 0,0,-1.5,-1.5, Text) { |options|
-22.      options.fill = 'gray40'
-23.   }
-24.
-25.   text.annotate(canvas, 0,0,0,0, Text) { |options|
-26.      options.fill = 'darkred'
-27.   }
-28.
-29.   canvas.write('rubyname.gif')
-30.   exit
+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) { |options|
+  options.fill = 'gray83'
+}
+
+text.annotate(canvas, 0,0,-1.5,-1.5, Text) { |options|
+  options.fill = 'gray40'
+}
+
+text.annotate(canvas, 0,0,0,0, Text) { |options|
+  options.fill = 'darkred'
+}
+
+canvas.write('rubyname.gif')
+exit