Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 407 lines (298 sloc) 11.788 kb
dabe7e9 Merged from RVG
rmagick authored
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
4 <html xmlns="http://www.w3.org/1999/xhtml">
5 <head>
6 <meta name="generator" content=
b39952f Change "aClass" convention to just "class" in method signatures. Numerou...
rmagick authored
7 "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org" />
dabe7e9 Merged from RVG
rmagick authored
8
df65846 Replace version number placeholder "MAJOR.MINOR.TEENY" with "0.0.0"
rmagick authored
9 <title>RMagick 0.0.0: RVG Reference: Shapes</title>
dabe7e9 Merged from RVG
rmagick authored
10 <meta http-equiv="Content-Type" content=
11 "text/html; charset=us-ascii" />
12 <meta name="GENERATOR" content="Quanta Plus" />
13 <meta name="Copyright" content=
3829d21 Change copyright date to 2006
rmagick authored
14 "Copyright (C) 2006 by Timothy P. Hunter" />
dabe7e9 Merged from RVG
rmagick authored
15 <link rel="stylesheet" type="text/css" href="css/doc.css" />
16 <link rel="stylesheet" type="text/css" href="css/ref.css" />
17 <script type="text/javascript" src="scripts/doc.js">
18 </script>
19 <script type="text/javascript">
20 //<![CDATA[
21 //]]>
22 </script>
23 <style type="text/css">
24 /*<![CDATA[*/
25 }
26 /*]]>*/
27 </style>
28 </head>
29
30 <body>
df65846 Replace version number placeholder "MAJOR.MINOR.TEENY" with "0.0.0"
rmagick authored
31 <h6 id="header">RMagick 0.0.0 User's Guide and Reference</h6>
dabe7e9 Merged from RVG
rmagick authored
32
33 <div class="nav">
34 &laquo;&nbsp;<a href="rvgstyle.html">Prev</a> | <a href=
35 "index.html">Contents</a> | <a href=
36 "rvgxform.html">Next</a>&nbsp;&raquo;
37 </div>
38
36823a0 Tidying
rmagick authored
39 <h1>The shape methods</h1>
dabe7e9 Merged from RVG
rmagick authored
40
41 <div id="toc">
42 <h2>Table of Contents</h2>
43
44 <h3>About the shape methods</h3>
45
46 <h3>Shape methods</h3>
47
b709733 Minor changes
rmagick authored
48 <div class="toccol">
49 <ul>
50 <li><a href="#circle">circle</a></li>
dabe7e9 Merged from RVG
rmagick authored
51
b709733 Minor changes
rmagick authored
52 <li><a href="#ellipse">ellipse</a></li>
dabe7e9 Merged from RVG
rmagick authored
53
b709733 Minor changes
rmagick authored
54 <li><a href="#line">line</a></li>
dabe7e9 Merged from RVG
rmagick authored
55
b709733 Minor changes
rmagick authored
56 <li><a href="#path">path</a></li>
dabe7e9 Merged from RVG
rmagick authored
57
b709733 Minor changes
rmagick authored
58 <li><a href="#polygon">polygon</a></li>
dabe7e9 Merged from RVG
rmagick authored
59
b709733 Minor changes
rmagick authored
60 <li><a href="#polyline">polyline</a></li>
dabe7e9 Merged from RVG
rmagick authored
61
b709733 Minor changes
rmagick authored
62 <li><a href="#rect">rect</a></li>
63 </ul>
64 </div>
dabe7e9 Merged from RVG
rmagick authored
65 </div>
66
67 <div class="subhd">
68 <h2>About the shape methods</h2>
69 </div>
70
71 <div class="intro">
72 <p>The shape methods listed below are defined in the <a href=
73 "rvg.html">RVG</a>, <a href="rvgclip.html">RVG::ClipPath</a>,
74 <a href="rvggroup.html">RVG::Group</a>, and <a href=
75 "rvgpattern.html">RVG::Pattern</a> classes. You can chain the
76 <a href="rvgstyle.html">styles</a> method and the <a href=
77 "rvgxform.html">transform methods</a> to the shape methods.</p>
78 </div>
79
80 <div class="subhd">
36823a0 Tidying
rmagick authored
81 <h2>shape</h2>
dabe7e9 Merged from RVG
rmagick authored
82 </div>
83
84 <div class="sig">
85 <h4 id='circle'>circle</h4>
86
87 <p><span class="arg">obj</span>.circle(<span class=
88 "arg">radius</span>, <span class="arg">cx</span>=0,
b39952f Change "aClass" convention to just "class" in method signatures. Numerou...
rmagick authored
89 <span class="arg">cy</span>=0) -&gt; <em>circle</em></p>
dabe7e9 Merged from RVG
rmagick authored
90 </div>
91
92 <div class='desc'>
93 <h5>Description</h5>
94
95 <p>Adds a circle to the target object. The arc of a circle
96 begins at the "3 o'clock" point on the radius and progresses
97 towards the "9 o'clock" point. The starting point and direction
98 of the arc are affected by the user space transform in the same
99 manner as the geometry of the object.</p>
100
101 <h5>Arguments</h5>
102
103 <dl>
104 <dt>radius</dt>
105
106 <dd>The radius of the circle</dd>
107
108 <dt>cx, cy</dt>
109
110 <dd>The center of the circle</dd>
111 </dl>
112
113 <h5>Example</h5>
114
115 <p><a href="javascript:popup('circle01.rb.html')"><img src=
116 "ex/circle01.gif" title="Click to see the example script" alt=
117 "circle example" /></a></p>
118 </div>
119
120 <div class="sig">
121 <h4 id='ellipse'>ellipse</h4>
122
123 <p><span class="arg">obj</span>.ellipse(<span class=
124 "arg">rx</span>, <span class="arg">ry</span>, <span class=
125 "arg">cx</span>=0, <span class="arg">cy</span>=0) -&gt;
b39952f Change "aClass" convention to just "class" in method signatures. Numerou...
rmagick authored
126 <em>ellipse</em></p>
dabe7e9 Merged from RVG
rmagick authored
127 </div>
128
129 <div class='desc'>
130 <h5>Description</h5>
131
132 <p>Adds an ellipse to the target object. The arc of an ellipse
133 begins at the "3 o'clock" point on the radius and progresses
134 towards the "9 o'clock" point. The starting point and direction
135 of the arc are affected by the user space transform in the same
136 manner as the geometry of the object.</p>
137
138 <h5>Arguments</h5>
139
140 <dl>
141 <dt>rx, ry</dt>
142
143 <dd>The <em>x</em>- and <em>y</em>-radii of the ellipse</dd>
144
145 <dt>cx, cy</dt>
146
147 <dd>The center of the ellipse</dd>
148 </dl>
149
150 <h5>Example</h5>
151
152 <p><a href="javascript:popup('ellipse01.rb.html')"><img src=
153 "ex/ellipse01.gif" title="Click to see the example script" alt=
154 "ellipse example" /></a></p>
155 </div>
156
157 <div class="sig">
158 <h4 id='line'>line</h4>
159
160 <p><span class="arg">obj</span>.line(<span class=
161 "arg">x1</span>=0, y1=0, <span class="arg">x2</span>=0,
b39952f Change "aClass" convention to just "class" in method signatures. Numerou...
rmagick authored
162 <span class="arg">y2</span>=0) -&gt; <em>line</em></p>
dabe7e9 Merged from RVG
rmagick authored
163 </div>
164
165 <div class='desc'>
166 <h5>Description</h5>
167
168 <p>Adds a line to the target object. Lines are never
169 filled.</p>
170
171 <h5>Arguments</h5>
172
173 <dl>
174 <dt>x1, y1</dt>
175
176 <dd>The starting point of the line</dd>
177
178 <dt>x2, y2</dt>
179
180 <dd>The ending point of the line</dd>
181 </dl>
182
183 <h5>Example</h5>
184
185 <p><a href="javascript:popup('line01.rb.html')"><img src=
186 "ex/line01.gif" title="Click to see the example script" alt=
187 "line example" /></a></p>
188 </div>
189
190 <div class="sig">
191 <h4 id='path'>path</h4>
192
193 <p><span class="arg">obj</span>.path(<span class=
b39952f Change "aClass" convention to just "class" in method signatures. Numerou...
rmagick authored
194 "arg">path_data</span>) -&gt; <em>path</em></p>
dabe7e9 Merged from RVG
rmagick authored
195 </div>
196
197 <div class="desc">
198 <h5>Description</h5>
199
200 <p>Adds a path to the target object.</p>
201
202 <h5>Arguments</h5>
203
204 <p>A path string. The path string has the same syntax as the
205 <strong>d=</strong> attribute on SVG's path element. See the
206 <a href="http://www.w3.org/TR/SVG11/paths.html">SVG
207 standard</a> for a complete description of the syntax.</p>
208
209 <h5>Examples</h5>
210
211 <p>moveto, lineto, and closepath commands<a href=
212 "javascript:popup('triangle01.rb.html')"><img src=
213 "ex/triangle01.gif" title="Click to see the example script"
214 alt="triangle example" /></a></p>
215
216 <p>simple uses of cubic B&eacute;zier commands within a
217 path<a href="javascript:popup('cubic01.rb.html')"><img src=
218 "ex/cubic01.gif" title="Click to see the example script" alt=
219 "cubic Bezier commands example" /></a></p>
220
221 <p>cubic B&eacute;zier commands change their shape according to
222 the position of the control points<a href=
223 "javascript:popup('cubic02.rb.html')"><img src="ex/cubic02.gif"
224 title="Click to see the example script" alt=
225 "cubic Bezier commands example" /></a></p>
226
227 <p>simple uses of quadratic B&eacute;zier commands within a
228 path <a href="javascript:popup('quad01.rb.html')"><img src=
229 "ex/quad01.gif" title="Click to see the example script" alt=
230 "quadratic Bezier commands example" /></a></p>
231
232 <p>simple uses of arc commands within a path<a href=
233 "javascript:popup('arcs01.rb.html')"><img src="ex/arcs01.gif"
234 title="Click to see the example script" alt=
235 "arc commands example" /></a></p>
236
237 <p>Elliptical arcs: The following illustrates the four
238 combinations of large-arc-flag and sweep-flag and the four
239 different arcs that will be drawn based on the values of these
240 flags. <a href="javascript:popup('arcs02.rb.html')"><img src=
241 "ex/arcs02.gif" title="Click to see the example script" alt=
242 "elliptical arc example" /></a></p>
243 </div>
244
245 <div class="sig">
246 <h4 id='polygon'>polygon</h4>
247
248 <p><span class="arg">obj</span>.polygon(<span class=
249 "arg">x1</span>, y1, <span class="arg">x2</span>, <span class=
b39952f Change "aClass" convention to just "class" in method signatures. Numerou...
rmagick authored
250 "arg">y2</span>...) -&gt; <em>polygon</em><br />
3ed196b Enhance RVG's polyline, polygon methods to accept array arguments
rmagick authored
251 <span class="arg">obj</span>.polygon(<span class=
b39952f Change "aClass" convention to just "class" in method signatures. Numerou...
rmagick authored
252 "arg">array</span>) -&gt; <em>polygon</em><br />
3ed196b Enhance RVG's polyline, polygon methods to accept array arguments
rmagick authored
253 <span class="arg">obj</span>.polygon(<span class=
254 "arg">array1</span>, <span class="arg">array2</span>) -&gt;
b39952f Change "aClass" convention to just "class" in method signatures. Numerou...
rmagick authored
255 <em>polygon</em></p>
dabe7e9 Merged from RVG
rmagick authored
256 </div>
257
258 <div class="desc">
259 <h5>Description</h5>
260
261 <p>Adds a closed shape consisting of a series of connected line
262 segments to the target object.</p>
263
264 <h5>Arguments</h5>
265
3ed196b Enhance RVG's polyline, polygon methods to accept array arguments
rmagick authored
266 <p>The arguments to <code>polygon</code> and <a href=
267 "#polyline">polyline</a> can be</p>
268
269 <ol>
270 <li>At least 4 numbers that describe the [x, y] coordinates
271 of the points of the polygon/polyline.</li>
272
273 <li>One array containing at least 4 numbers.</li>
274
275 <li>Two arrays. The first array is a list of x-coordinates.
276 The second array is a list of y-coordinates. Both arrays must
277 have at least one element. If one array is shorter than the
278 other, the shorter array is extended by duplicating its
279 elements as necessary. The combined arrays must describe at
280 least 2 pairs of [x,y] coordinates. For example
281 <pre>
282 x = [1, 3, 5, 7, 9]
283 y = [2,4]
284 canvas.polygon(x, y)
285 # is equivalent to canvas.polygon(1,2, 3,4, 5,2, 7,4, 9,2)
286 </pre>
287 </li>
288 </ol>
289
290 <p>It is an error to specify an odd number of coordinates.
291 Array arguments can be any objects that can be converted to
292 arrays by the Kernel#Array method.</p>
dabe7e9 Merged from RVG
rmagick authored
293
294 <h5>Example</h5>
295
296 <p><a href="javascript:popup('polygon01.rb.html')"><img src=
297 "ex/polygon01.gif" title="Click to see the example script" alt=
298 "polygon example" /></a></p>
299 </div>
300
301 <div class="sig">
302 <h4 id='polyline'>polyline</h4>
303
304 <p><span class="arg">obj</span>.polyline(<span class=
305 "arg">x1</span>, y1, <span class="arg">x2</span>, <span class=
b39952f Change "aClass" convention to just "class" in method signatures. Numerou...
rmagick authored
306 "arg">y2</span>...) -&gt; <em>polyline</em><br />
3ed196b Enhance RVG's polyline, polygon methods to accept array arguments
rmagick authored
307 <span class="arg">obj</span>.polyline(<span class=
b39952f Change "aClass" convention to just "class" in method signatures. Numerou...
rmagick authored
308 "arg">array</span>) -&gt; <em>polyline</em><br />
3ed196b Enhance RVG's polyline, polygon methods to accept array arguments
rmagick authored
309 <span class="arg">obj</span>.polyline(<span class=
310 "arg">array1</span>, <span class="arg">array2</span>) -&gt;
b39952f Change "aClass" convention to just "class" in method signatures. Numerou...
rmagick authored
311 <em>polyline</em></p>
dabe7e9 Merged from RVG
rmagick authored
312 </div>
313
314 <div class="desc">
315 <h5>Description</h5>
316
317 <p>Adds a set of connected lines segments to the target object.
318 Typically a polyline defines an open shape.</p>
319
320 <h5>Arguments</h5>
321
3ed196b Enhance RVG's polyline, polygon methods to accept array arguments
rmagick authored
322 <p>See <a href="#polygon">polygon</a></p>
dabe7e9 Merged from RVG
rmagick authored
323
324 <h5>Example</h5>
325
326 <p><a href="javascript:popup('polyline01.rb.html')"><img src=
327 "ex/polyline01.gif" title="Click to see the example script"
328 alt="polyline example" /></a></p>
329 </div>
330
331 <div class="sig">
332 <h4 id='rect'>rect</h4>
333
334 <p><span class="arg">obj</span>.rect(<span class=
335 "arg">width</span>, <span class="arg">height</span>,
336 <span class="arg">x</span>=0, <span class="arg">y</span>=0)
b39952f Change "aClass" convention to just "class" in method signatures. Numerou...
rmagick authored
337 -&gt; <em>rect</em></p>
dabe7e9 Merged from RVG
rmagick authored
338 </div>
339
340 <div class="desc">
341 <h5>Description</h5>
342
343 <p>Adds a rectangle to the target object.</p>
344
345 <h5>Arguments</h5>
346
347 <dl>
348 <dt>width, height</dt>
349
350 <dd>The width and height of the rectangle</dd>
351
352 <dt>x, y</dt>
353
354 <dd>The <em>x</em>- and <em>y</em>-axis coordinates of the
355 upper-left corner</dd>
356 </dl>
357
358 <h5>Example</h5>
359
360 <p><a href="javascript:popup('rect01.rb.html')"><img src=
361 "ex/rect01.gif" title="Click to see the example script" alt=
362 "rect example" /></a></p>
363
364 <h5>Rounded rectangles</h5>
365
366 <p>You can define a rounded rectangle by chaining the
367 <code>round</code> method to <code>rect</code>:</p>
368
369 <p><span class="arg">obj</span>.rect(<span class=
370 "arg">width</span>, <span class="arg">height</span>,
371 <span class="arg">x</span>=0, <span class=
372 "arg">y</span>=0).round(<code>rx</code>[, <code>ry</code>])</p>
373
da2f0e1 Minor changes
rmagick authored
374 <p>The round method accepts two arguments.</p>
375
376 <dl>
377 <dt>rx</dt>
378
379 <dd>The x-axis radius of the ellipse used to round off the
380 corners of the rectangle</dd>
381
382 <dt>ry</dt>
383
384 <dd>The y-axis radius of the ellipse used to round off the
385 corners of the rectangle</dd>
386 </dl>
387
388 <p>If the second argument is omitted it defaults to the value
389 of the first argument.</p>
dabe7e9 Merged from RVG
rmagick authored
390
391 <h5>Example</h5>
392
393 <p><a href="javascript:popup('rect02.rb.html')"><img src=
394 "ex/rect02.gif" title="Click to see the example script" alt=
395 "rect example" /></a></p>
396 </div>
397
398 <p class="spacer">&nbsp;</p>
399
400 <div class="nav">
401 &laquo; <a href="rvgstyle.html">Prev</a> | <a href=
402 "index.html">Contents</a> | <a href="rvgxform.html">Next</a>
403 &raquo;
404 </div>
405 </body>
406 </html>
Something went wrong with that request. Please try again.