rmagick 1.9.3 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rmagick might be problematic. Click here for more details.

Files changed (62) hide show
  1. data/ChangeLog +18 -0
  2. data/README.html +12 -12
  3. data/README.txt +10 -10
  4. data/configure +728 -367
  5. data/configure.ac +134 -69
  6. data/doc/comtasks.html +11 -3
  7. data/doc/constants.html +162 -40
  8. data/doc/draw.html +2 -2
  9. data/doc/ex/crop_resized.rb +10 -0
  10. data/doc/ex/get_type_metrics.rb +26 -22
  11. data/doc/ex/vignette.rb +19 -0
  12. data/doc/ilist.html +0 -5
  13. data/doc/image1.html +219 -49
  14. data/doc/image2.html +115 -47
  15. data/doc/image3.html +105 -23
  16. data/doc/imageattrs.html +4 -23
  17. data/doc/imusage.html +1 -1
  18. data/doc/index.html +8 -9
  19. data/doc/info.html +23 -3
  20. data/doc/magick.html +1 -1
  21. data/doc/rvg.html +1 -1
  22. data/doc/rvgclip.html +1 -1
  23. data/doc/rvggroup.html +1 -1
  24. data/doc/rvgimage.html +1 -1
  25. data/doc/rvgpattern.html +1 -1
  26. data/doc/rvgshape.html +1 -1
  27. data/doc/rvgstyle.html +1 -1
  28. data/doc/rvgtext.html +3 -3
  29. data/doc/rvgtspan.html +1 -1
  30. data/doc/rvgtut.html +119 -101
  31. data/doc/rvguse.html +1 -1
  32. data/doc/rvgxform.html +1 -1
  33. data/doc/struct.html +17 -11
  34. data/doc/usage.html +22 -4
  35. data/examples/histogram.rb +48 -12
  36. data/examples/spinner.rb +49 -0
  37. data/ext/RMagick/MANIFEST +4 -1
  38. data/ext/RMagick/rmagick.h +62 -33
  39. data/ext/RMagick/rmagick_config.h.in +28 -31
  40. data/ext/RMagick/rmdraw.c +14 -6
  41. data/ext/RMagick/rmfill.c +2 -2
  42. data/ext/RMagick/rmilist.c +8 -36
  43. data/ext/RMagick/rmimage.c +370 -97
  44. data/ext/RMagick/rminfo.c +6 -6
  45. data/ext/RMagick/rmmain.c +114 -25
  46. data/ext/RMagick/rmutil.c +98 -35
  47. data/lib/RMagick.rb +17 -2
  48. data/lib/rvg/clippath.rb +2 -2
  49. data/lib/rvg/container.rb +2 -2
  50. data/lib/rvg/describable.rb +2 -2
  51. data/lib/rvg/embellishable.rb +2 -2
  52. data/lib/rvg/misc.rb +3 -3
  53. data/lib/rvg/paint.rb +2 -2
  54. data/lib/rvg/pathdata.rb +2 -2
  55. data/lib/rvg/rvg.rb +2 -2
  56. data/lib/rvg/stretchable.rb +2 -2
  57. data/lib/rvg/stylable.rb +2 -2
  58. data/lib/rvg/text.rb +2 -2
  59. data/lib/rvg/transformable.rb +2 -2
  60. data/lib/rvg/units.rb +2 -2
  61. data/rmagick.gemspec +1 -1
  62. metadata +362 -353
@@ -4,14 +4,14 @@
4
4
  <html xmlns="http://www.w3.org/1999/xhtml">
5
5
  <head>
6
6
  <meta name="generator" content=
7
- "HTML Tidy for Mac OS X (vers 1st September 2004), see www.w3.org" />
7
+ "HTML Tidy for Linux/x86 (vers 1st December 2004), see www.w3.org" />
8
8
 
9
9
  <title>RMagick: class Image (attribute methods)</title>
10
10
  <meta http-equiv="Content-Type" content=
11
11
  "text/html; charset=us-ascii" />
12
12
  <meta name="GENERATOR" content="Quanta Plus" />
13
13
  <meta name="Copyright" content=
14
- "Copyright (C) 2005 by Timothy P. Hunter" />
14
+ "Copyright (C) 2006 by Timothy P. Hunter" />
15
15
  <link rel="stylesheet" type="text/css" href="css/doc.css" />
16
16
  <script type="text/javascript" src="scripts/doc.js">
17
17
  </script>
@@ -1200,27 +1200,8 @@ blur_image is 100% complete.
1200
1200
 
1201
1201
  <h4>Returns</h4>
1202
1202
 
1203
- <p>One of the following OrientationType values:</p>
1204
-
1205
- <ul>
1206
- <li>UndefinedOrientation</li>
1207
-
1208
- <li>TopLeftOrientation</li>
1209
-
1210
- <li>TopRightOrientation</li>
1211
-
1212
- <li>BottomRightOrientation</li>
1213
-
1214
- <li>BottomLeftOrientation</li>
1215
-
1216
- <li>LeftTopOrientation</li>
1217
-
1218
- <li>RightTopOrientation</li>
1219
-
1220
- <li>RightBottomOrientation</li>
1221
-
1222
- <li>LeftBottomOrientation</li>
1223
- </ul>
1203
+ <p>An <a href=
1204
+ "constants.html#OrientationType">OrientationType</a> value.</p>
1224
1205
 
1225
1206
  <h4>Magick API</h4>Available in ImageMagick 6.0.0.
1226
1207
 
@@ -11,7 +11,7 @@
11
11
  "text/html; charset=us-ascii" />
12
12
  <meta name="GENERATOR" content="Quanta Plus" />
13
13
  <meta name="Copyright" content=
14
- "Copyright (C) 2005 by Timothy P. Hunter" />
14
+ "Copyright (C) 2006 by Timothy P. Hunter" />
15
15
  <link rel="stylesheet" type="text/css" href="css/doc.css" />
16
16
  <script type="text/javascript" src="scripts/doc.js">
17
17
  </script>
@@ -11,7 +11,7 @@
11
11
  "text/html; charset=us-ascii" />
12
12
  <meta name="GENERATOR" content="Quanta Plus" />
13
13
  <meta name="Copyright" content=
14
- "Copyright (C) 2005 by Timothy P. Hunter" />
14
+ "Copyright (C) 2006 by Timothy P. Hunter" />
15
15
  <link rel="stylesheet" type="text/css" href="css/doc.css" />
16
16
  <style type="text/css">
17
17
  /*<![CDATA[*/
@@ -232,7 +232,7 @@
232
232
  </ul>
233
233
  </div>
234
234
 
235
- <h2 id="Introduction">Introduction</h2>
235
+ <h2 id="#introduction">Introduction</h2>
236
236
 
237
237
  <h3>What is RMagick?</h3>
238
238
 
@@ -395,13 +395,12 @@
395
395
  <p>For quickest results, include the RMagick, &times;Magick and
396
396
  Ruby version numbers, along with a thorough description of the
397
397
  problem. RMagick will tell you both its version number and
398
- &times;Magick's version number. Simply bring up irb and print the
399
- <code>Magick::Long_version</code> constant:</p>
398
+ &times;Magick's version number. Simply bring up irb and run this
399
+ command: <code>ruby -r RMagick -e "puts Magick::Long_version"</code></p>
400
400
  <pre class="example" id="version">
401
- irb(main):001:0&gt; puts Magick::Long_version
402
- This is RMagick 1.7.0 ($Date: 2005/06/12 22:13:21 $) Copyright (C) 2004 by Timothy P. Hunter
403
- Built with GraphicsMagick 1.1.4 2004-11-13 Q8 http://www.GraphicsMagick.org/
404
- Built for ruby 1.8.1 (2003-12-25) [i686-linux]
401
+ This is RMagick 1.10.0 ($Date: 2006/01/08 00:21:58 $) Copyright (C) 2006 by Timothy P. Hunter
402
+ Built with ImageMagick 6.2.6 01/03/06 Q8 http://www.imagemagick.org
403
+ Built for ruby 1.8.3 (2005-09-21) [i686-linux]
405
404
  Web page: http://rmagick.rubyforge.org
406
405
  Email: rmagick@rubyforge.org
407
406
  </pre>
@@ -438,7 +437,7 @@ Email: rmagick@rubyforge.org
438
437
  Notices</a></h3>
439
438
 
440
439
  <ul>
441
- <li>RMagick is copyright &copy; 2005 by Timothy P. Hunter.</li>
440
+ <li>RMagick is copyright &copy; 2006 by Timothy P. Hunter.</li>
442
441
 
443
442
  <li>ImageMagick is copyright &copy; 2005 ImageMagick
444
443
  Studio.</li>
@@ -4,7 +4,7 @@
4
4
  <html xmlns="http://www.w3.org/1999/xhtml">
5
5
  <head>
6
6
  <meta name="generator" content=
7
- "HTML Tidy for Linux/x86 (vers 1st March 2005), see www.w3.org" />
7
+ "HTML Tidy for Linux/x86 (vers 1st December 2004), see www.w3.org" />
8
8
 
9
9
  <title>RMagick: class Image::Info - Optional method
10
10
  arguments</title>
@@ -12,7 +12,7 @@
12
12
  "text/html; charset=us-ascii" />
13
13
  <meta name="GENERATOR" content="Quanta Plus" />
14
14
  <meta name="Copyright" content=
15
- "Copyright (C) 2005 by Timothy P. Hunter" />
15
+ "Copyright (C) 2006 by Timothy P. Hunter" />
16
16
  <link rel="stylesheet" type="text/css" href="css/doc.css" />
17
17
  <script type="text/javascript" src="scripts/doc.js">
18
18
  </script>
@@ -133,6 +133,8 @@
133
133
 
134
134
  <div class="toccol">
135
135
  <ul>
136
+ <li><a href="#orientation">orientation</a></li>
137
+
136
138
  <li><a href="#page">page</a></li>
137
139
 
138
140
  <li><a href="#pointsize">pointsize</a></li>
@@ -859,7 +861,7 @@ self.undefine("tiff", "bits-per-sample")
859
861
  <h4>Arguments</h4>
860
862
 
861
863
  <p>See <a href=
862
- "http://www.imagemagick.org/www/formats.html">File
864
+ "http://www.imagemagick.org/script/formats.php">File
863
865
  Formats</a>.</p>
864
866
  </div>
865
867
 
@@ -1066,6 +1068,24 @@ self.undefine("tiff", "bits-per-sample")
1066
1068
  <code>subrange</code> attribute.</p>
1067
1069
  </div>
1068
1070
 
1071
+ <div class="sig">
1072
+ <h3 id="orientation">orientation</h3>
1073
+
1074
+ <p><span class="arg">self</span>.orientation=<span class=
1075
+ "arg">anOrientationType</span></p>
1076
+ </div>
1077
+
1078
+ <div class="desc">
1079
+ <h4>Description</h4>
1080
+
1081
+ <p>Specify the orientation of the image pixels.</p>
1082
+
1083
+ <h4>Argument</h4>
1084
+
1085
+ <p>An <a href=
1086
+ "constants.html#OrientationType">OrientationType</a> value.</p>
1087
+ </div>
1088
+
1069
1089
  <div class="sig">
1070
1090
  <h3 id="page">page</h3>
1071
1091
 
@@ -11,7 +11,7 @@
11
11
  "text/html; charset=us-ascii" />
12
12
  <meta name="GENERATOR" content="Quanta Plus" />
13
13
  <meta name="Copyright" content=
14
- "Copyright (C) 2005 by Timothy P. Hunter" />
14
+ "Copyright (C) 2006 by Timothy P. Hunter" />
15
15
  <link rel="stylesheet" type="text/css" href="css/doc.css" />
16
16
  <script type="text/javascript" src="scripts/doc.js">
17
17
  </script>
@@ -11,7 +11,7 @@
11
11
  "text/html; charset=us-ascii" />
12
12
  <meta name="GENERATOR" content="Quanta Plus" />
13
13
  <meta name="Copyright" content=
14
- "Copyright (C) 2005 by Timothy P. Hunter" />
14
+ "Copyright (C) 2006 by Timothy P. Hunter" />
15
15
  <link rel="stylesheet" type="text/css" href="css/doc.css" />
16
16
  <script type="text/javascript" src="scripts/doc.js">
17
17
  </script>
@@ -11,7 +11,7 @@
11
11
  "text/html; charset=us-ascii" />
12
12
  <meta name="GENERATOR" content="Quanta Plus" />
13
13
  <meta name="Copyright" content=
14
- "Copyright (C) 2005 by Timothy P. Hunter" />
14
+ "Copyright (C) 2006 by Timothy P. Hunter" />
15
15
  <link rel="stylesheet" type="text/css" href="css/doc.css" />
16
16
  <script type="text/javascript" src="scripts/doc.js">
17
17
  </script>
@@ -11,7 +11,7 @@
11
11
  "text/html; charset=us-ascii" />
12
12
  <meta name="GENERATOR" content="Quanta Plus" />
13
13
  <meta name="Copyright" content=
14
- "Copyright (C) 2005 by Timothy P. Hunter" />
14
+ "Copyright (C) 2006 by Timothy P. Hunter" />
15
15
  <link rel="stylesheet" type="text/css" href="css/doc.css" />
16
16
  <script type="text/javascript" src="scripts/doc.js">
17
17
  </script>
@@ -11,7 +11,7 @@
11
11
  "text/html; charset=us-ascii" />
12
12
  <meta name="GENERATOR" content="Quanta Plus" />
13
13
  <meta name="Copyright" content=
14
- "Copyright (C) 2005 by Timothy P. Hunter" />
14
+ "Copyright (C) 2006 by Timothy P. Hunter" />
15
15
  <link rel="stylesheet" type="text/css" href="css/doc.css" />
16
16
  <script type="text/javascript" src="scripts/doc.js">
17
17
  </script>
@@ -11,7 +11,7 @@
11
11
  "text/html; charset=us-ascii" />
12
12
  <meta name="GENERATOR" content="Quanta Plus" />
13
13
  <meta name="Copyright" content=
14
- "Copyright (C) 2005 by Timothy P. Hunter" />
14
+ "Copyright (C) 2006 by Timothy P. Hunter" />
15
15
  <link rel="stylesheet" type="text/css" href="css/doc.css" />
16
16
  <script type="text/javascript" src="scripts/doc.js">
17
17
  </script>
@@ -11,7 +11,7 @@
11
11
  "text/html; charset=us-ascii" />
12
12
  <meta name="GENERATOR" content="Quanta Plus" />
13
13
  <meta name="Copyright" content=
14
- "Copyright (C) 2005 by Timothy P. Hunter" />
14
+ "Copyright (C) 2006 by Timothy P. Hunter" />
15
15
  <link rel="stylesheet" type="text/css" href="css/doc.css" />
16
16
  <link rel="stylesheet" type="text/css" href="css/ref.css" />
17
17
  <script type="text/javascript" src="scripts/doc.js">
@@ -11,7 +11,7 @@
11
11
  "text/html; charset=us-ascii" />
12
12
  <meta name="GENERATOR" content="Quanta Plus" />
13
13
  <meta name="Copyright" content=
14
- "Copyright (C) 2005 by Timothy P. Hunter" />
14
+ "Copyright (C) 2006 by Timothy P. Hunter" />
15
15
  <link rel="stylesheet" type="text/css" href="css/doc.css" />
16
16
  <script type="text/javascript" src="scripts/doc.js">
17
17
  </script>
@@ -11,7 +11,7 @@
11
11
  "text/html; charset=us-ascii" />
12
12
  <meta name="GENERATOR" content="Quanta Plus" />
13
13
  <meta name="Copyright" content=
14
- "Copyright (C) 2005 by Timothy P. Hunter" />
14
+ "Copyright (C) 2006 by Timothy P. Hunter" />
15
15
  <link rel="stylesheet" type="text/css" href="css/doc.css" />
16
16
  <script type="text/javascript" src="scripts/doc.js">
17
17
  </script>
@@ -242,8 +242,8 @@
242
242
  <h3 id='tspan'>tspan</h3>
243
243
 
244
244
  <p><span class="arg">text</span>.tspan(<span class=
245
- "arg">string</span>=0, <span class="arg">x</span>=nil,
246
- <span class="arg">y</span>=0) [ <span class="arg">{ |tspan|
245
+ "arg">string</span>=nil, <span class="arg">x</span>=nil,
246
+ <span class="arg">y</span>=nil) [ <span class="arg">{ |tspan|
247
247
  ...}</span> ] -&gt; aTspan</p>
248
248
  </div>
249
249
 
@@ -11,7 +11,7 @@
11
11
  "text/html; charset=us-ascii" />
12
12
  <meta name="GENERATOR" content="Quanta Plus" />
13
13
  <meta name="Copyright" content=
14
- "Copyright (C) 2005 by Timothy P. Hunter" />
14
+ "Copyright (C) 2006 by Timothy P. Hunter" />
15
15
  <link rel="stylesheet" type="text/css" href="css/doc.css" />
16
16
  <script type="text/javascript" src="scripts/doc.js">
17
17
  </script>
@@ -3,7 +3,7 @@
3
3
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
4
 
5
5
  <html xmlns="http://www.w3.org/1999/xhtml">
6
- <!-- $Id: rvgtut.html,v 1.6 2005/06/03 23:18:53 rmagick Exp $ -->
6
+ <!-- $Id: rvgtut.html,v 1.7 2005/11/26 15:03:05 rmagick Exp $ -->
7
7
 
8
8
  <head>
9
9
  <meta name="generator" content=
@@ -62,43 +62,44 @@
62
62
  </div>
63
63
  </div>
64
64
  <pre class="example">
65
- 1 require 'rvg/rvg'
66
- 2 include Magick
65
+ 1 require 'rvg/rvg'
66
+ 2 include magick
67
67
  3
68
- 4 RVG::dpi = 72
68
+ 4 RVG::dpi = 72
69
69
  5
70
- 6 rvg = RVG.new(2.5.in, 2.5.in).viewbox(0,0,250,250) do |canvas|
71
- 7 canvas.background_fill = 'white'
70
+ 6 rvg = rvg.new(2.5.in, 2.5.in).viewbox(0,0,250,250) do |canvas|
71
+ 7 canvas.background_fill = 'white'
72
72
  8
73
- 9 canvas.g.translate(100, 150).rotate(-30).styles(:fill=&gt;'yellow',
74
- 10 :stroke=&gt;'black', :stroke_width=&gt;2) do |body|
73
+ 9 canvas.g.translate(100, 150).rotate(-30) do |body|
74
+ 10 body.styles(:fill=&gt;'yellow', :stroke=&gt;'black', :stroke_width=&gt;2)
75
75
  11 body.ellipse(50, 30)
76
- 12 body.rect(45, 20, -20, -10).skewX(-35)
76
+ 12 body.rect(45, 20, -20, -10).skewx(-35)
77
77
  13 end
78
78
  14
79
- 15 canvas.g.translate(130, 83).styles(:stroke=&gt;'black', :stroke_width=&gt;2) do |head|
80
- 16 head.circle(30).styles(:fill=&gt;'yellow')
81
- 17 head.circle(5, 10, -5).styles(:fill=&gt;'black')
82
- 18 head.polygon(30,0, 70,5, 30,10, 62,25, 23,20).styles(:fill=&gt;'orange')
83
- 19 end
84
- 20
85
- 21 foot = RVG::Group.new do |_foot|
86
- 22 _foot.path('M0,0 v30 l30,10 l5,-10, l-5,-10 l-30,10z').
87
- 23 styles(:stroke_width=&gt;2, :fill=&gt;'orange', :stroke=&gt;'black')
88
- 24 end
89
- 25 canvas.use(foot).translate(75, 188).rotate(15)
90
- 26 canvas.use(foot).translate(100, 185).rotate(-15)
91
- 27
92
- 28 canvas.text(125, 30) do |title|
93
- 29 title.tspan("duck|").styles(:text_anchor=&gt;'end', :font_size=&gt;20,
94
- 30 :font_family=&gt;'Helvetica', :fill=&gt;'black')
95
- 31 title.tspan("type").styles(:font_size=&gt;22,
96
- 32 :font_family=&gt;'Times', :font_style=&gt;'italic', :fill=&gt;'red')
97
- 33 end
98
- 34 canvas.rect(249,249).styles(:stroke=&gt;'blue', :fill=&gt;'none')
99
- 35 end
100
- 36
101
- 37 rvg.draw.write('duck.gif')
79
+ 15 canvas.g.translate(130, 83) do |head|
80
+ 16 head.styles(:stroke=&gt;'black', :stroke_width=&gt;2)
81
+ 17 head.circle(30).styles(:fill=&gt;'yellow')
82
+ 18 head.circle(5, 10, -5).styles(:fill=&gt;'black')
83
+ 19 head.polygon(30,0, 70,5, 30,10, 62,25, 23,20).styles(:fill=&gt;'orange')
84
+ 20 end
85
+ 21
86
+ 22 foot = rvg::group.new do |_foot|
87
+ 23 _foot.path('m0,0 v30 l30,10 l5,-10, l-5,-10 l-30,10z').
88
+ 24 styles(:stroke_width=&gt;2, :fill=&gt;'orange', :stroke=&gt;'black')
89
+ 25 end
90
+ 26 canvas.use(foot).translate(75, 188).rotate(15)
91
+ 27 canvas.use(foot).translate(100, 185).rotate(-15)
92
+ 28
93
+ 29 canvas.text(125, 30) do |title|
94
+ 30 title.tspan("duck|").styles(:text_anchor=&gt;'end', :font_size=&gt;20,
95
+ 31 :font_family=&gt;'helvetica', :fill=&gt;'black')
96
+ 32 title.tspan("type").styles(:font_size=&gt;22,
97
+ 33 :font_family=&gt;'times', :font_style=&gt;'italic', :fill=&gt;'red')
98
+ 34 end
99
+ 35 canvas.rect(249,249).styles(:stroke=&gt;'blue', :fill=&gt;'none')
100
+ 36 end
101
+ 37
102
+ 38 rvg.draw.write('duck.gif')
102
103
  </pre>
103
104
 
104
105
  <h2>Summary</h2>
@@ -207,11 +208,11 @@
207
208
 
208
209
  <h2>Lines 9-13</h2>
209
210
  <pre class="example">
210
- 9 canvas.g.translate(100, 150).rotate(-30).styles(:fill=&gt;'yellow',
211
- 10 :stroke=&gt;'black', :stroke_width=&gt;2) do |body|
212
- 11 body.ellipse(50, 30)
213
- 12 body.rect(45, 20, -20, -10).skewX(-35)
214
- 13 end
211
+ 9 canvas.g.translate(100, 150).rotate(-30) do |body|
212
+ 10 body.styles(:fill=&gt;'yellow', :stroke=&gt;'black', :stroke_width=&gt;2)
213
+ 11 body.ellipse(50, 30)
214
+ 12 body.rect(45, 20, -20, -10).skewx(-35)
215
+ 13 end
215
216
  </pre>
216
217
 
217
218
  <p>There's a lot going on in these few lines - seven method calls
@@ -227,15 +228,14 @@
227
228
  <code>g</code> method yields if a block is present. In this
228
229
  example, there is no block associated with <code>g</code>, so
229
230
  <code>g</code> returns the new group. The <code>g</code> method
230
- adds the group to the content of the container, so when the
231
- container is drawn the graphic objects in the group will be drawn
232
- as well. The three methods chained to <code>g</code> -
233
- <code>translate</code>, <code>rotate</code>, and
234
- <code>styles</code> - modify the group by adding <em>coordinate
235
- system transforms</em> and by modifying the default
236
- <em>styles</em>.</p>
237
-
238
- <p>(Okay, there <em>is</em> a block, but there are 3 method calls
231
+ adds the group to the content of its container. In this example,
232
+ the group's container is the canvas object created in line 6. The
233
+ graphic objects in the group are drawn as part of drawing the
234
+ container. The <code>translate</code> and <code>rotate</code>
235
+ chained to <code>g</code> modify the group by adding
236
+ <em>coordinate system transforms</em>.</p>
237
+
238
+ <p>(Okay, there <em>is</em> a block, but there are 2 method calls
239
239
  between <code>g</code> and the block. I'll explain more
240
240
  later.)</p>
241
241
 
@@ -267,7 +267,7 @@
267
267
  "duck body" /></p>
268
268
 
269
269
  <div style="position:absolute; left:200px;top:0">
270
- <p><strong>The other transform methods</strong></p>
270
+ <p><strong>The transform methods</strong></p>
271
271
 
272
272
  <p>There are six transform methods. In addition to
273
273
  <code>translate</code> and <code>rotate</code>, there's
@@ -286,10 +286,13 @@
286
286
  values are, well, style values. In this example there are three
287
287
  style names. The :fill style sets the fill color to 'yellow'. The
288
288
  :stroke style sets the outline color to 'black'. The
289
- :stroke_width style sets the width of the outline to 2. The
290
- <code>styles</code> method is a real workhorse. It's defined in
291
- almost every class in RVG and there are many other style names in
292
- addition to these three..</p>
289
+ :stroke_width style sets the width of the outline to 2. I want
290
+ the styles to apply to all objects within the group so in line 10
291
+ I call <code>styles</code> on the new group object.</p>
292
+
293
+ <p>The <code>styles</code> method is a real workhorse. It's
294
+ defined in almost every class in RVG and there are many other
295
+ style names in addition to these three..</p>
293
296
 
294
297
  <h3>Basic shapes</h3>
295
298
 
@@ -309,8 +312,22 @@
309
312
  centered on the origin. The upper-left corner of the rectangle is
310
313
  slightly up and to the left of the origin.</p>
311
314
 
312
- <p><img src="ex/images/duck3.gif" alt="default coordinate system"
313
- width="180" height="180" /></p>
315
+ <div style="position:relative">
316
+ <p><img src="ex/images/duck3.gif" alt=
317
+ "default coordinate system" width="180" height="180" /></p>
318
+
319
+ <div style="position:absolute; left:200px;top:0">
320
+ <p><strong>The shape methods</strong></p>
321
+
322
+ <p>There are 7 shape methods. In addition to
323
+ <code>ellipse</code> and <code>rect</code>, there's
324
+ <code>circle</code>, <code>line</code>, <code>path</code>,
325
+ <code>polygon</code>, and <code>polyline</code>. You can also
326
+ think of text as a shape. Shapes are stroked and filled, and
327
+ can be modified by the transform methods and the
328
+ <code>styles</code> method.</p>
329
+ </div>
330
+ </div>
314
331
 
315
332
  <h3>SkewX</h3>
316
333
 
@@ -330,27 +347,27 @@
330
347
  <p><img src="ex/images/duck4.gif" width="180" height="180" alt=
331
348
  "duck wing" /></p>
332
349
 
333
- <p>That's it for the body. Let's tie up one loose end before I
334
- move on. I said earlier that container constructors (such as
350
+ <p>That's it for the body. Let's tie up one loose end before
351
+ moving on. I said earlier that container constructors (such as
335
352
  <code>g</code>) yield to a block if present. In this case,
336
- though, there are three intervening method calls -
337
- <code>translate</code>, <code>rotate</code>, and
338
- <code>styles</code> - between <code>g</code> and the block. The
339
- <code>style</code> method and the transform methods will all
340
- yield when there is an associated block, so I can easily chain
341
- them to a container constructor and still use a block argument to
342
- define the graphic objects in the group. Method chaining is a
343
- common RVG idiom. You'll see it a lot in the examples.</p>
353
+ though, the <code>translate</code> and <code>rotate</code>
354
+ methods intervene between <code>g</code> and the block. All the
355
+ transform methods yield when there is an associated block, so I
356
+ can easily chain them to a container constructor and still use a
357
+ block argument to define the graphic objects in the group. Method
358
+ chaining is a common RVG idiom. You'll see it a lot in the
359
+ examples.</p>
344
360
 
345
361
  <p>The next group draws the head.</p>
346
362
 
347
- <h2>Lines 15-19</h2>
363
+ <h2>Lines 15-20</h2>
348
364
  <pre class="example">
349
- 15 canvas.g.translate(130, 83).styles(:stroke=&gt;'black', :stroke_width=&gt;2) do |head|
350
- 16 head.circle(30).styles(:fill=&gt;'yellow')
351
- 17 head.circle(5, 10, -5).styles(:fill=&gt;'black')
352
- 18 head.polygon(30,0, 70,5, 30,10, 62,25, 23,20).styles(:fill=&gt;'orange')
353
- 19 end
365
+ 15 canvas.g.translate(130, 83) do |head|
366
+ 16 head.styles(:stroke=&gt;'black', :stroke_width=&gt;2)
367
+ 17 head.circle(30).styles(:fill=&gt;'yellow')
368
+ 18 head.circle(5, 10, -5).styles(:fill=&gt;'black')
369
+ 19 head.polygon(30,0, 70,5, 30,10, 62,25, 23,20).styles(:fill=&gt;'orange')
370
+ 20 end
354
371
  </pre>
355
372
 
356
373
  <p>This section is very similar to the previous one. I'm defining
@@ -361,14 +378,16 @@
361
378
  <p><img src="ex/images/duck6.gif" width="180" height="180" alt=
362
379
  "duck head" /></p>
363
380
 
364
- <p>Notice that I can use <code>styles</code> on shapes as well as
365
- containers. In this group each shape has its own fill color. (The
366
- styles defined on the group propogate to the contained shapes,
367
- unless you override them.) The yellow circle forms the head. The
368
- <code>circle</code> method takes 3 parameters. The first
369
- parameter is the radius of the circle. The other two parameters
370
- are the (x,y) coordinate of the center. If omitted, as here, they
371
- default to (0,0). I use a small black circle for the eye.</p>
381
+ <p>In line 16 I define the <code>stroke</code> and
382
+ <code>stroke_width</code> styles on the group. Styles defined on
383
+ the group propogate to shapes within the group unless you
384
+ override them. To do that, call <code>styles</code> on the
385
+ shapes. In this group each shape has its own fill color. The
386
+ yellow circle forms the head. The <code>circle</code> method
387
+ takes 3 parameters. The first parameter is the radius of the
388
+ circle. The other two parameters are the (x,y) coordinate of the
389
+ center. If omitted, as here, they default to (0,0). I use a small
390
+ black circle for the eye.</p>
372
391
 
373
392
  <p>Last, I use the <code>polygon</code> method to draw the beak.
374
393
  This method draws a polygon from a series of (x,y) coordinates.
@@ -380,28 +399,27 @@
380
399
  <p><img src="ex/images/duck8.gif" width="180" height="180" alt=
381
400
  "duck head final" /></p>
382
401
 
383
- <h2>Lines 21-24</h2>
402
+ <h2>Lines 22-25</h2>
384
403
  <pre class="example">
385
- 21 foot = RVG::Group.new do |_foot|
386
- 22 _foot.path('M0,0 v30 l30,10 l5,-10, l-5,-10 l-30,10z').
387
- 23 styles(:stroke_width=&gt;2, :fill=&gt;'orange', :stroke=&gt;'black')
388
- 24 end
404
+ 22 foot = rvg::group.new do |_foot|
405
+ 23 _foot.path('m0,0 v30 l30,10 l5,-10, l-5,-10 l-30,10z').
406
+ 24 styles(:stroke_width=&gt;2, :fill=&gt;'orange', :stroke=&gt;'black')
407
+ 25 end
389
408
  </pre>
390
409
 
391
410
  <p>Here I create a group by directly calling <code>new</code>
392
- instead of calling the <code>g</code> method on a container. The
393
- graphic objects within the group are not (yet) contained within
394
- the canvas and so will not be drawn when the canvas is drawn. You
395
- might think of the foot as not being attached to anything, like
396
- this:</p>
411
+ instead of calling the <code>g</code> method on a container. This
412
+ creates a group object that is not contained within the canvas.
413
+ You might think of the foot as not being attached to anything,
414
+ like this:</p>
397
415
 
398
416
  <p><img src="ex/images/duck9.gif" width="180" height="180" alt=
399
417
  "duck foot" /></p>
400
418
 
401
- <h2>Lines 25-26</h2>
419
+ <h2>Lines 26-27</h2>
402
420
  <pre class="example">
403
- 25 canvas.use(foot).translate(75, 188).rotate(15)
404
- 26 canvas.use(foot).translate(100, 185).rotate(-15)
421
+ 26 canvas.use(foot).translate(75, 188).rotate(15)
422
+ 27 canvas.use(foot).translate(100, 185).rotate(-15)
405
423
  </pre>
406
424
 
407
425
  <p>To add the group to the canvas I use the <code>use</code>
@@ -428,14 +446,14 @@
428
446
  <p><img src="ex/images/duck12.gif" width="180" height="180" alt=
429
447
  "final duck foot" /></p>
430
448
 
431
- <h2>Lines 28-33</h2>
449
+ <h2>Lines 29-34</h2>
432
450
  <pre class="example">
433
- 28 canvas.text(125, 30) do |title|
434
- 29 title.tspan("duck|").styles(:text_anchor=&gt;'end', :font_size=&gt;20,
435
- 30 :font_family=&gt;'Helvetica', :fill=&gt;'black')
436
- 31 title.tspan("type").styles(:font_size=&gt;22,
437
- 32 :font_family=&gt;'Times', :font_style=&gt;'italic', :fill=&gt;'red')
438
- 33 end
451
+ 29 canvas.text(125, 30) do |title|
452
+ 30 title.tspan("duck|").styles(:text_anchor=&gt;'end', :font_size=&gt;20,
453
+ 31 :font_family=&gt;'helvetica', :fill=&gt;'black')
454
+ 32 title.tspan("type").styles(:font_size=&gt;22,
455
+ 33 :font_family=&gt;'times', :font_style=&gt;'italic', :fill=&gt;'red')
456
+ 34 end
439
457
  </pre>
440
458
 
441
459
  <p>All I need now is a title for the picture. Text in RVG is a
@@ -461,9 +479,9 @@
461
479
  <p><img src="ex/images/duck14.gif" width="180" height="180" alt=
462
480
  "duck title" /></p>
463
481
 
464
- <h2>Line 34</h2>
482
+ <h2>Line 35</h2>
465
483
  <pre class="example">
466
- 34 canvas.rect(249,249).styles(:stroke=&gt;'blue', :fill=&gt;'none')
484
+ 35 canvas.rect(249,249).styles(:stroke=&gt;'blue', :fill=&gt;'none')
467
485
  </pre>
468
486
 
469
487
  <p>I'm almost done. All I need to do it add a blue border. (I'm
@@ -473,9 +491,9 @@
473
491
  <p><img src="ex/images/duck15.gif" width="180" height="180" alt=
474
492
  "duck with border" /></p>
475
493
 
476
- <h2>Line 37</h2>
494
+ <h2>Line 38</h2>
477
495
  <pre class="example">
478
- 37 rvg.draw.write('duck.gif')
496
+ 38 rvg.draw.write('duck.gif')
479
497
  </pre>
480
498
 
481
499
  <p>The <code>draw</code> method call doesn't occupy a lot of