Skip to content
Newer
Older
100644 976 lines (705 sloc) 26.6 KB
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
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. Nume…
rmagick authored Jan 7, 2008
7 "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org" />
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
8
df65846 Replace version number placeholder "MAJOR.MINOR.TEENY" with "0.0.0"
rmagick authored Jan 14, 2007
9 <title>RMagick 0.0.0: RVG Reference: RVG Class</title>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
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 Jan 3, 2006
14 "Copyright (C) 2006 by Timothy P. Hunter" />
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
15 <link rel="stylesheet" type="text/css" href="css/doc.css" />
16 <script type="text/javascript" src="scripts/doc.js">
17 </script>
18 <script type="text/javascript">
19 //<![CDATA[
20 //]]>
21 </script>
22 <style type="text/css">
23 /*<![CDATA[*/
24 }
25 /*]]>*/
26 </style>
27 </head>
28
29 <body>
df65846 Replace version number placeholder "MAJOR.MINOR.TEENY" with "0.0.0"
rmagick authored Jan 14, 2007
30 <h6 id="header">RMagick 0.0.0 User's Guide and Reference</h6>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
31
32 <div class="nav">
33 &laquo;&nbsp;<a href="rvgtut.html">Prev</a> | <a href=
34 "index.html">Contents</a> | <a href=
35 "rvggroup.html">Next</a>&nbsp;&raquo;
36 </div>
37
38 <h1>class RVG <span class="superclass">&lt; Object</span></h1>
39
40 <div id="toc">
41 <h2>Table of Contents</h2>
42
43 <h3>class methods</h3>
44
45 <ul>
d6f71b0 Fix misspelled and otherwise broken links.
rmagick authored Aug 21, 2007
46 <li><a href="#RVG_new">new</a></li>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
47 </ul>
48
49 <h3>attributes</h3>
50
51 <div class="toccol">
52 <ul>
53 <li><a href=
54 "#RVG_background_fill">background_fill=</a></li>
55
56 <li><a href=
57 "#RVG_background_fill_opacity">background_fill_opacity=</a></li>
58
59 <li><a href=
60 "#RVG_background_image">background_image=</a></li>
61
62 <li><a href=
63 "#RVG_background_pattern">background_pattern=</a></li>
64
65 <li><a href=
66 "#RVG_background_position">background_position=</a></li>
67 </ul>
68 </div>
69
70 <div class="toccol">
71 <ul>
72 <li><a href="#RVG_canvas">canvas</a></li>
73
74 <li><a href="#RVG_desc">desc, desc=</a></li>
75
76 <li><a href="#RVG_height">height</a></li>
77
78 <li><a href="#RVG_metadata">metadata, metadata=</a></li>
79 </ul>
80 </div>
81
82 <div class="toccol">
83 <ul>
84 <li><a href="#RVG_title">title, title=</a></li>
85
86 <li><a href="#RVG_width">width</a></li>
87
88 <li><a href="#RVG_x">x</a></li>
89
90 <li><a href="#RVG_y">y</a></li>
91 </ul>
92 </div>
93
94 <h3>instance methods</h3>
95
96 <div>
97 <div class="toccol">
98 <ul>
99 <li><a href="#RVG_draw">draw</a></li>
100
101 <li><a href="#RVG_g">g</a></li>
102
103 <li><a href="#RVG_image">image</a></li>
104 </ul>
105 </div>
106
107 <div class="toccol">
108 <ul>
109 <li><a href=
110 "#RVG_preserve_aspect_ratio">preserve_aspect_ratio</a></li>
111
112 <li><a href="#RVG_rvg">rvg</a></li>
113
114 <li><a href="#RVG_text">text</a></li>
115 </ul>
116 </div>
117
118 <div class="toccol">
119 <ul>
120 <li><a href="#RVG_use">use</a></li>
121
122 <li><a href="#RVG_viewbox">viewbox</a></li>
123 </ul>
124 </div>
125 </div>
126
127 <h3>shared methods</h3>
128
129 <p>In addition to the methods listed above, <code>class
130 RVG</code> also implements the <a href=
131 "rvgstyle.html">styles</a> method, the <a href=
132 "rvgshape.html">shape methods</a> and the <a href=
133 "rvgxform.html">transform methods</a>.</p>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
134
135 <h3>Units</h3>
136
137 <div class="toccol">
138 <ul>
139 <li><a href="#units">Units conversion methods</a></li>
140 </ul>
141 </div>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
142 </div>
143
144 <h2 class="methods">class methods</h2>
145
146 <div class="sig">
147 <h3 id="RVG_new">new</h3>
148
149 <p>RVG.new(<span class="arg">width</span>=nil, <span class=
150 "arg">height</span>=nil) [ <span class="arg">{ |canvas| drawing
b39952f Change "aClass" convention to just "class" in method signatures. Nume…
rmagick authored Jan 7, 2008
151 method calls }</span> ] -&gt; <em>rvg</em></p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
152 </div>
153
154 <div class="desc">
155 <h4>Description</h4>
156
157 <p>Creates a container that can have its own coordinate system.
158 Within the block, call drawing methods on <em>canvas</em> to
159 render shapes, text, and raster images in the container.</p>
160
161 <p>An RVG object is always the outermost container for a
3946c97 Fix errors in href targets
rmagick authored May 2, 2005
162 drawing. Call the <a href="#RVG_draw">draw</a> method on the
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
163 returned RVG object to produce the final image.</p>
164
165 <h4>Arguments</h4>
166
167 <p>If the RVG object is the outermost container, <span class=
168 "arg">width</span> and <span class="arg">height</span> are
169 required and specify the width and height of the final drawing
170 in pixels. You can call <a href="#units">conversion methods</a>
171 to use units such as inches and millimeters instead of
172 pixels.</p>
173
c1941fb Fix trivial typos
rmagick authored Jun 3, 2005
174 <p>Otherwise, <span class="arg">width</span> and <span class=
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
175 "arg">height</span> specify the area of the viewbox. If the RVG
176 object will be used as an argument to the <a href=
3946c97 Fix errors in href targets
rmagick authored May 2, 2005
177 "rvguse.html#use">use</a> method, then <span class=
178 "arg">width</span> and <span class="arg">height</span> may be
179 omitted here, then specified as arguments to
180 <code>use</code>.</p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
181
182 <h4>Returns</h4>
183
184 <p>An RVG object</p>
185
186 <h4>Example</h4>
187
188 <p>See the <a href="rvgtut.html">tutorial</a> for a simple
189 example. The image below demonstrates an advanced use of
190 <code>RVG.new</code>. This example creates an RVG object that
191 draws an orange-and-green target. The <span class=
192 "arg">width</span> and <span class="arg">height</span>
193 arguments are omitted in the <code>RVG.new</code> call.
194 Instead, the viewport width and height are specified as
3946c97 Fix errors in href targets
rmagick authored May 2, 2005
195 arguments to 4 invocations of <a href=
196 "rvguse.html#use">use</a>. Each <code>use</code> specifies a
197 different viewport size, so the same RVG object draws 4
198 different-sized targets.</p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
199
200 <p>Click the image to see the example script.</p>
201
202 <p><a href="javascript:popup('nested_rvg.rb.html')"><img src=
203 "ex/nested_rvg.gif" title="Click to see the example script"
204 alt="nested RVG example" /></a></p>
205
206 <h4>See also</h4>
207
3946c97 Fix errors in href targets
rmagick authored May 2, 2005
208 <p><a href="rvggroup.html">Group</a></p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
209 </div>
210
211 <h2 class="methods">attributes</h2>
212
213 <div class="sig">
214 <h3 id='RVG_background_fill'>background_fill=</h3>
215
216 <p><span class="arg">canvas</span>.background_fill =
217 <span class="arg">value</span></p>
218 </div>
219
220 <div class="desc">
221 <h4>Description</h4>
222
223 <p>Specify a background fill color. The attribute value may be
224 either a <a href="struct.html#Pixel">pixel</a> or a <a href=
225 "imusage.html#color_names">color name.</a> The default fill
b67c2f4 Minor edits
rmagick authored Feb 1, 2009
226 color is "#00000000". This color is usually called "none". This
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
227 attribute has no effect on nested RVG objects.</p>
228
229 <h4>Example</h4>
230 <pre>
231 canvas.background_fill = 'white'
232 </pre>
233
234 <h4>Returns</h4><span class="arg">value</span>
235 </div>
236
237 <div class="sig">
238 <h3 id='RVG_background_fill_opacity'>
239 background_fill_opacity=</h3>
240
241 <p><span class="arg">canvas</span>.background_fill_opacity =
242 <span class="arg">value</span></p>
243 </div>
244
245 <div class="desc">
246 <h4>Description</h4>
247
248 <p>Specify the opacity of the background fill color when the
249 <a href="#RVG_background_fill">background fill</a> is not the
250 default. The value is a number between 0.0 (fully transparent)
251 and 1.0 (fully opaque). The default is 1.0. The attribute is
252 ignored unless <code>background_fill</code> is specified. This
253 attribute has no effect on nested RVG objects.</p>
254
255 <h4>Example</h4>
256 <pre>
257 canvas.background_fill = 'white'
258 canvas.background_fill_opacity = 0.50
259 </pre>
260
261 <h4>Returns</h4><span class="arg">value</span>
262 </div>
263
264 <div class="sig">
265 <h3 id='RVG_background_image'>background_image=</h3>
266
267 <p><span class="arg">canvas</span>.background_image =
b39952f Change "aClass" convention to just "class" in method signatures. Nume…
rmagick authored Jan 7, 2008
268 <span class="arg">image</span></p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
269 </div>
270
271 <div class="desc">
272 <h4>Description</h4>
273
274 <p>Specify an image to be used as the canvas background. The
275 value is an <a href="image1.html#new">Image</a> object. This
276 attribute has no effect on nested RVG objects.</p>
277
278 <h4>Example</h4>
279 <pre>
280 canvas.background_image = Magick::Image.read('myBackground.gif').first
281 </pre>
282
b39952f Change "aClass" convention to just "class" in method signatures. Nume…
rmagick authored Jan 7, 2008
283 <h4>Returns</h4><span class="arg">image</span>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
284
285 <h4>See also</h4>
286
287 <p><a href=
288 "#RVG_background_position">background_position=</a></p>
289 </div>
290
291 <div class="sig">
292 <h3 id='RVG_background_pattern'>background_pattern=</h3>
293
294 <p><span class="arg">canvas</span>.background_pattern =
b39952f Change "aClass" convention to just "class" in method signatures. Nume…
rmagick authored Jan 7, 2008
295 <span class="arg">fill</span></p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
296 </div>
297
298 <div class="desc">
299 <h4>Description</h4>
300
301 <p>Specify an <a href="struct.html#fill">Fill object</a> to
302 fill the canvas background. This attribute has no effect on
303 nested RVG objects.</p>
304
305 <h4>Example</h4>
306 <pre>
307 canvas.background_pattern = Magick::GradientFill.new(0, 0, 0, 100, "#900", "#000")
308 </pre>
309
38641e0 Fix spelling errors
rmagick authored Feb 16, 2008
310 <h4>Returns</h4><p>a Fill object</p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
311 </div>
312
313 <div class="sig">
314 <h3 id='RVG_background_position'>background_position=</h3>
315
316 <p><span class="arg">canvas</span>.background_position =
317 <span class="arg">pos</span></p>
318 </div>
319
320 <div class="desc">
321 <h4>Description</h4>
322
323 <p>If the dimensions of the image specified by <a href=
324 "#RVG_background_image">background_image</a> do not exactly
325 match the canvas dimensions, this attribute specifies how to
326 position the image on the background. This attribute has no
327 effect on nested RVG objects.</p>
328
329 <h4>Argument</h4>The value of <span class="arg">pos</span> can
330 be any one of the following symbols :
331
332 <dl>
333 <dt>:scaled</dt>
334
335 <dd>The image is scaled to fit. The image proportions are not
336 retained.</dd>
337
338 <dt>:tiled</dt>
339
340 <dd>The image is tiled across the background.</dd>
341
342 <dt>:fit</dt>
343
344 <dd>The image is scaled to fit. The image proportions are
345 retained. Any part of the background that is not covered by
346 the image is colored with the <a href=
347 "#RVG_background_color">background color</a>.</dd>
348 </dl>
349
350 <h4>Example</h4>
351 <pre>
352 canvas.background_image = Magick::Image.read('myBackground.gif').first
353 canvas.background_position = :scaled
354 </pre>
355
356 <h4>Returns</h4><span class="arg">pos</span>
357 </div>
358
359 <div class="sig">
360 <h3 id='RVG_canvas'>canvas</h3>
361
b39952f Change "aClass" convention to just "class" in method signatures. Nume…
rmagick authored Jan 7, 2008
362 <p><span class="arg">rvg</span>.canvas -&gt; image</p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
363 </div>
364
365 <div class="desc">
366 <h4>Description</h4>
367
368 <p>After the <a href="#RVG_draw">draw</a> method has been used,
369 returns the rendered image. This is the same image that
370 <a href="#RVG_draw">draw</a> returns.</p>
371
372 <h4>Returns</h4>
373
374 <p>An image</p>
375 </div>
376
377 <div class="sig">
378 <h3 id="RVG_desc">desc, desc=</h3>
379
380 <p><span class="arg">rvg</span>.desc -&gt; <span class=
b39952f Change "aClass" convention to just "class" in method signatures. Nume…
rmagick authored Jan 7, 2008
381 "arg">string</span><br />
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
382 <span class="arg">rvg</span>.desc = <span class=
b39952f Change "aClass" convention to just "class" in method signatures. Nume…
rmagick authored Jan 7, 2008
383 "arg">string</span></p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
384 </div>
385
386 <div class="desc">
387 <h4>Description</h4>Use the <code>desc</code> attribute to
388 assign a text description to the drawing. The description will
389 be assigned to the "desc" property of the resulting image. This
390 attribute has no effect on nested RVG objects.
391 </div>
392
393 <div class="sig">
394 <h3 id='RVG_height'>height</h3>
395
396 <p><span class="arg">rvg</span>.height -&gt; <span class=
397 "arg">height</span></p>
398 </div>
399
400 <div class="desc">
401 <h4>Description</h4>
402
403 <p>The height of the RVG object in user coordinates.</p>
404
405 <h4>See also</h4>
406
407 <p><a href="#RVG_width">width</a></p>
408 </div>
409
410 <div class="sig">
411 <h3 id="RVG_metadata">metadata, metadata=</h3>
412
413 <p><span class="arg">rvg</span>.metadata -&gt; <span class=
b39952f Change "aClass" convention to just "class" in method signatures. Nume…
rmagick authored Jan 7, 2008
414 "arg">string</span><br />
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
415 <span class="arg">rvg</span>.metadata = <span class=
b39952f Change "aClass" convention to just "class" in method signatures. Nume…
rmagick authored Jan 7, 2008
416 "arg">string</span></p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
417 </div>
418
419 <div class="desc">
420 <h4>Description</h4>Use the <code>metadata</code> attribute to
421 assign additional metadata to the drawing. The metadata string
422 will be assigned to the "metadata" property of the resulting
423 image. This attribute has no effect on nested RVG objects.
424 </div>
425
426 <div class="sig">
427 <h3 id="RVG_title">title, title=</h3>
428
429 <p><span class="arg">rvg</span>.title -&gt; <span class=
b39952f Change "aClass" convention to just "class" in method signatures. Nume…
rmagick authored Jan 7, 2008
430 "arg">string</span><br />
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
431 <span class="arg">rvg</span>.title = <span class=
b39952f Change "aClass" convention to just "class" in method signatures. Nume…
rmagick authored Jan 7, 2008
432 "arg">string</span></p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
433 </div>
434
435 <div class="desc">
436 <h4>Description</h4>Use the <code>title</code> attribute to
437 assign a title to the drawing. The title will be assigned to
438 the "title" property of the resulting image. This attribute has
439 no effect on nested RVG objects.
440 </div>
441
442 <div class="sig">
443 <h3 id='RVG_width'>width</h3>
444
445 <p><span class="arg">rvg</span>.width -&gt; <span class=
446 "arg">width</span></p>
447 </div>
448
449 <div class="desc">
450 <h4>Description</h4>
451
452 <p>The width of the RVG object in user coordinates.</p>
453
454 <h4>See also</h4>
455
456 <p><a href="#RVG_height">height</a></p>
457 </div>
458
459 <div class="sig">
460 <h3 id='RVG_x'>x</h3>
461
462 <p><span class="arg">rvg</span>.x -&gt; <span class=
463 "arg">x-offset</span></p>
464 </div>
465
466 <div class="desc">
467 <h4>Description</h4>
468
469 <p>If this RVG object is nested within another RVG object,
470 returns the x-offset in user coordinates from the upper-left
471 corner of the enclosing RVG object.</p>
472
473 <h4>See also</h4>
474
475 <p><a href="#RVG_y">y</a></p>
476 </div>
477
478 <div class="sig">
479 <h3 id='RVG_y'>y</h3>
480
481 <p><span class="arg">rvg</span>.y -&gt; <span class=
482 "arg">y-offset</span></p>
483 </div>
484
485 <div class="desc">
486 <h4>Description</h4>
487
488 <p>If this RVG object is nested within another RVG object,
489 returns the y-offset in user coordinates from the upper-left
490 corner of the enclosing RVG object.</p>
491
492 <h4>See also</h4>
493
494 <p><a href="#RVG_x">x</a></p>
495 </div>
496
497 <h2 class="methods">instance methods</h2>
498
499 <div class="sig">
500 <h3 id='RVG_draw'>draw</h3>
501
b39952f Change "aClass" convention to just "class" in method signatures. Nume…
rmagick authored Jan 7, 2008
502 <p><span class="arg">rvg</span>.draw -&gt; image</p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
503 </div>
504
505 <div class="desc">
506 <h4>Description</h4>
507
508 <p>Causes all the drawing objects that have been added to the
509 canvas to be rendered.</p>
510
45629df Minor changes
rmagick authored Apr 10, 2005
511 <p>Regardless of the order in which methods were called,
512 <code>draw</code> executes the methods in this order:</p>
513
da2f0e1 Minor changes
rmagick authored Apr 10, 2005
514 <ol>
45629df Minor changes
rmagick authored Apr 10, 2005
515 <li>transforms, in the order they were called.</li>
516
517 <li><code>viewbox</code> and
518 <code>preserve_aspect_ratio</code></li>
519
520 <li>styles</li>
521
522 <li>nested groups, RVG objects, shapes, text, and images, in
523 the order they were added to the containing object</li>
da2f0e1 Minor changes
rmagick authored Apr 10, 2005
524 </ol>
45629df Minor changes
rmagick authored Apr 10, 2005
525
526 <p>Nested groups and RVG objects also follow this sequence.</p>
da2f0e1 Minor changes
rmagick authored Apr 10, 2005
527
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
528 <h4>Returns</h4>
529
530 <p>An image</p>
531
532 <h4>Example</h4>
533 <pre>
534 img = rvg.draw
535 img.write('myDrawing.jpg')
536 </pre>
537 </div>
538
539 <div class="sig">
540 <h3 id='RVG_g'>g</h3>
541
542 <p><span class="arg">rvg.</span>g [{|<span class=
543 "arg">grp</span>| ...}] -&gt; <span class=
b39952f Change "aClass" convention to just "class" in method signatures. Nume…
rmagick authored Jan 7, 2008
544 "arg">group</span></p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
545 </div>
546
547 <div class="desc">
548 <h4>Description</h4>
549
45629df Minor changes
rmagick authored Apr 10, 2005
550 <p>Calls <a href="rvggroup.html#new">RVG::Group.new</a> to
551 construct a group and adds it to the enclosing RVG object.
552 Yields to a block if one is present, passing the new group as
553 an argument.</p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
554
555 <h4>Returns</h4>
556
557 <p>Returns the new group, so <code>RVG::Group</code> methods
558 can be chained to this method.</p>
559 </div>
560
561 <div class="sig">
562 <h3 id='RVG_image'>image</h3>
563
564 <p><span class="arg">rvg.</span>image(<span class=
565 "arg">raster_image</span>, <span class="arg">width</span>=nil,
566 <span class="arg">height</span>=nil, <span class=
567 "arg">x</span>=0, <span class="arg">y</span>=0) -&gt;
b39952f Change "aClass" convention to just "class" in method signatures. Nume…
rmagick authored Jan 7, 2008
568 <span class="arg">image</span></p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
569 </div>
570
571 <div class="desc">
572 <h4>Description</h4>
573
45629df Minor changes
rmagick authored Apr 10, 2005
574 <p>Calls <a href="rvgimage.html#new">RVG::Image.new</a> to
575 construct an image and adds it to the enclosing RVG object.</p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
576
577 <h4>Returns</h4>
578
579 <p>Returns the new image, so <code>RVG::Image</code> methods
580 can be chained to this method.</p>
581
582 <h4>Notes</h4>
583
584 <p>An <code>RVG::Image</code> object is <em>not</em> the same
585 as a <a href="image1.html">Magick::Image</a> object!</p>
586 </div>
587
588 <div class="sig">
589 <h3 id='RVG_preserve_aspect_ratio'>preserve_aspect_ratio</h3>
590
591 <p><span class=
592 "arg">rvg</span>.preserve_aspect_ratio(<span class=
593 "arg">align</span>, <span class=
594 "arg">meet_or_slice</span>='meet') [{|<span class=
595 "arg">self</span>| ...}] -&gt; <span class=
596 "arg">self</span></p>
597 </div>
598
599 <div class="desc">
600 <h4>Description</h4>
601
602 <p>If you use the <a href="#RVG_viewbox">viewbox</a> method and
603 the user coordinate system does not scale uniformly to the
604 default coordinate system (for example, the width and height of
605 the RVG object is 4x3 and the user coordinate system is 16x9),
606 use the <code>preserve_aspect_ratio</code> method to specify
607 whether or not the content is stretched to fit. If not, you can
608 specify how to fit the content into the space.</p>
609
610 <p><code>Preserve_aspect_ratio</code> yields to a block if one
611 is present, passing <span class="arg">self</span> as an
612 argument.</p>
613
614 <h4>Arguments</h4>
615
616 <dl>
617 <dt>align</dt>
618
619 <dd>
620 When the value of the <code>meet_or_slice</code> argument
621 is 'meet' or 'slice', this argument controls the placement
622 of the content within the viewport. The <code>align</code>
38641e0 Fix spelling errors
rmagick authored Feb 16, 2008
623 argument is the concatenation of an <em>x</em>-alignment and
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
624 a <em>y</em>-alignment. The values are shown in these
625 lists:
626
627 <h6><em>x</em>-alignment</h6>
628
629 <dl>
630 <dt>xMin</dt>
631
632 <dd>align the minimum <em>x</em> value of the content
633 with the left corner of the viewport.</dd>
634
635 <dt>xMid</dt>
636
637 <dd>vertically center the content within the
638 viewport.</dd>
639
640 <dt>xMax</dt>
641
642 <dd>align the maximum <em>x</em> value of the content
643 with the right corner of the viewport.</dd>
644 </dl>
645
646 <h6><em>y</em>-alignment</h6>
647
648 <dl>
649 <dt>YMin</dt>
650
651 <dd>align the minimum <em>y</em> value of the content
652 with the top of the viewport.</dd>
653
654 <dt>YMid</dt>
655
656 <dd>horizontally center the content within the
657 viewport.</dd>
658
659 <dt>YMax</dt>
660
661 <dd>align the maximum <em>y</em> value of the content
662 with the bottom of the viewport</dd>
663 </dl>
664 </dd>
665
666 <dt>meet_or_slice</dt>
667
668 <dd>
669 This argument can have one of these three values:
670
671 <dl>
672 <dt>'none'</dt>
673
674 <dd>The content is scaled as necessary so that it fits
675 exactly within the viewport. The aspect ratio is
676 <em>not</em> maintained.</dd>
677
678 <dt>'meet'</dt>
679
680 <dd>The content is scaled as necessary so that the larger
681 dimension exactly fits the viewport. There may be some
682 unused space in the viewport. The aspect ratio is
683 maintained.</dd>
684
685 <dt>'slice'</dt>
686
687 <dd>The content is scaled as necessary so that the
688 smaller dimension exactly fits the viewport. Some of the
689 content in the larger dimension may be cut off. The
690 aspect ratio is maintained.</dd>
691 </dl>
692 </dd>
693 </dl>
694
695 <h4>Example</h4>
696
697 <p><a href=
698 "javascript:popup('PreserveAspectRatio.rb.html')"><img src=
699 "ex/PreserveAspectRatio.gif" title=
700 "Click to see the example script" alt=
701 "preserve_aspect_ratio example" /></a></p>
702
703 <h4>Returns</h4>
704
705 <p><span class="arg">Self</span>, so other <code>RVG</code>
706 methods can be chained to this method.</p>
707
708 <h4>See Also</h4>
709
710 <p><a href="#RVG_viewbox">viewbox</a></p>
711 </div>
712
713 <div class="sig">
714 <h3 id="RVG_rvg">rvg</h3>
715
716 <p><span class="arg">rvg</span>.rvg(<span class=
717 "arg">width</span>, <span class="arg">height</span>,
718 <span class="arg">x</span>=0, <span class="arg">y</span>=0)
b39952f Change "aClass" convention to just "class" in method signatures. Nume…
rmagick authored Jan 7, 2008
719 [{|<span class="arg">new_rvg</span>| ...}] -&gt;
720 <em>self</em></p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
721 </div>
722
723 <div class="desc">
724 <h4>Description</h4>
725
726 <p>This method constructs a new RVG object and adds it to the
727 enclosing RVG object. Each nested RVG object can use the
728 <a href="#RVG_viewbox">viewbox</a> method to define its own
729 coordinate system. The <code>rvg</code> method yields to a
730 block, passing the nested RVG object as an argument. Within the
731 block, any drawing objects added to the nested RVG object are
732 rendered within the nested RVG object's viewport.</p>
733
734 <h4>Arguments</h4>
735
736 <dl>
737 <dt>width, height</dt>
738
739 <dd>Specifies the viewport width and height. The units are in
740 the user coordinate system of the parent container.</dd>
741
742 <dt>x, y</dt>
743
744 <dd>The x- and y-axis offsets of the viewport upper-left
745 corner. The units are in the user coordinate system of the
746 parent container.</dd>
747 </dl>
748
749 <h4>Example</h4>
750
751 <p>See the example for <a href=
752 "#RVG_preserve_aspect_ratio">preserve_aspect_ratio</a>.</p>
753
754 <h4>Returns</h4>
755
756 <p>The <code>RVG</code> object, so other <code>RVG</code>
757 methods can be chained to this method.</p>
758 </div>
759
760 <div class="sig">
761 <h3 id='RVG_text'>text</h3>
762
763 <p><span class="arg">rvg.</span>text(<span class=
764 "arg">x</span>=0, <span class="arg">y</span>=0, <span class=
38641e0 Fix spelling errors
rmagick authored Feb 16, 2008
765 "arg">text</span>=nil) [{|<span class="arg">text</span>| ...}]
b39952f Change "aClass" convention to just "class" in method signatures. Nume…
rmagick authored Jan 7, 2008
766 -&gt; <em>text</em></p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
767 </div>
768
769 <div class="desc">
770 <h4>Description</h4>
771
45629df Minor changes
rmagick authored Apr 10, 2005
772 <p>Calls <a href="rvgtext.html#new">RVG::Text.new</a> to
773 construct a text object and adds it to the enclosing RVG
774 object. Yields to a block if one is present, passing the new
775 text object as an argument.</p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
776
777 <h4>Returns</h4>
778
779 <p>The <code>RVG::Text</code> object, so other
780 <code>RVG::Text</code> methods can be chained to this
781 method.</p>
782 </div>
783
784 <div class="sig">
785 <h3 id="RVG_use">use</h3>
786
787 <p><span class="arg">rvg</span>.use(<span class=
788 "arg">obj</span>, <span class="arg">x</span>=0, <span class=
789 "arg">y</span>=0, <span class="arg">width</span>=nil,
b39952f Change "aClass" convention to just "class" in method signatures. Nume…
rmagick authored Jan 7, 2008
790 <span class="arg">height</span>=nil) -&gt; <em>use</em></p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
791 </div>
792
793 <div class="desc">
794 <h4>Description</h4>
795
45629df Minor changes
rmagick authored Apr 10, 2005
796 <p>Calls <a href="rvguse.html#new">RVG::Use.new</a> to
c1941fb Fix trivial typos
rmagick authored Jun 3, 2005
797 construct a <code>use</code> object and adds it to the RVG
45629df Minor changes
rmagick authored Apr 10, 2005
798 object.</p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
799
800 <p>When the referenced argument is another RVG object,
801 <span class="arg">width</span> and <span class=
802 "arg">height</span> can be used to specify the width and height
803 of the viewport. If present and non-nil, these arguments
804 override any width and height specified when the RVG object was
805 created. You must specify the viewport size either when
806 creating the RVG object or when referencing it with
807 <code>use</code>.</p>
808
45629df Minor changes
rmagick authored Apr 10, 2005
809 <h4>Examples</h4>
810
811 <p>See <a href="rvguse.html#new">RVG::Use.new</a></p>
812
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
813 <h4>Returns</h4>
814
815 <p>The <code>RVG::Use</code> object, so other
816 <code>RVG::Use</code> methods can be chained to this
817 method.</p>
818 </div>
819
820 <div class="sig">
821 <h3 id="RVG_viewbox">viewbox</h3>
822
b2e34b4 Minor edits
rmagick authored Apr 23, 2005
823 <p><span class="arg">rvg</span>.viewbox(<span class=
824 "arg">min_x</span>, <span class="arg">min_y</span>,
825 <span class="arg">width</span>, <span class=
826 "arg">height</span>) [{|<span class="arg">self</span>| ...}]
b39952f Change "aClass" convention to just "class" in method signatures. Nume…
rmagick authored Jan 7, 2008
827 -&gt; <em>self</em></p>
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
828 </div>
829
830 <div class="desc">
831 <h4>Description</h4>
832
833 <p>The area of the RVG object is called the <em>viewport</em>.
834 By default the origin of the coordinate system for an RVG
835 object is (0,0). The user coordinates are pixels and the width
836 and height are established by the <span class=
837 "arg">width</span> and <span class="arg">height</span>
838 arguments to <code>RVG.new</code>.</p>
839
840 <p>Use the <code>viewbox</code> method to superimpose a user
841 coordinate system on the viewport. The <code>viewbox</code>
842 method lets you set up a coordinate system using the units of
843 your choice.</p>
844
845 <p>The <code>viewbox</code> method yields to a block if one is
846 present, passing <code>self</code> as an argument.</p>
847
848 <h4>Arguments</h4>
849
850 <dl>
851 <dt>min_x, min_y</dt>
852
853 <dd>The minimum <em>x</em>-coordinate and
854 <em>y</em>-coordinate of the user coordinate system.</dd>
855
856 <dt>width, height</dt>
857
858 <dd>The width and height of the user coordinate system.</dd>
859 </dl>
860
861 <h4>Example</h4>
862
863 <p>In the following examples, because the <code>viewbox</code>
864 method specifies the dimensions of the coordinate system, the
865 dimensions specified for the graphic objects can remain the
866 same while the size of the canvas changes.</p>
867
868 <p><strong>Rendered into a 300x200 viewport</strong><a href=
869 "javascript:popup('ViewBox.rb.html')"><img src=
870 "ex/ViewBox_300x200.gif" title=
871 "Click to see the example script" alt=
872 "viewbox 300x200 example" /></a></p>
873
874 <p><strong>Rendered into a 150x200 viewport</strong><a href=
875 "javascript:popup('ViewBox.rb.html')"><img src=
876 "ex/ViewBox_150x200.gif" title=
877 "Click to see the example script" alt=
878 "viewbox 150x200 example" /></a></p>
879
880 <h4>Returns</h4>
881
882 <p><span class="arg">Self</span>, so other <code>RVG</code>
883 methods may be chained to <code>viewbox</code>.</p>
884
885 <h4>See Also</h4>
886
887 <p><a href=
888 "#RVG_preserve_aspect_ratio">preserve_aspect_ratio</a></p>
889 </div>
890
f98e28f Document units conversion methods
rmagick authored May 3, 2005
891 <h2 id="units" class="methods">Units</h2>
892
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
893 <div style="margin-left: 235px; margin-top:1em">
894 <p>RVG supports a subset of the unit identifiers defined by the
895 SVG specification. In RVG, unit identifiers are methods in the
896 Float and Fixnum classes. The units are (for the most part)
897 defined in terms of "dots per inch," accordingly, the unit
898 identifier methods are added only if the value</p>
899 <pre>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
900 Magick::RVG.dpi = NN
901 </pre>
902
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
903 <p>is defined, where NN is the number of "dots" (pixels) per
904 inch you wish to use. (Hint: 90 is a good default.)</p>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
905
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
906 <p>For example, to specify a length of 10 inches, you can
907 use</p>
908 <pre>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
909 Magick::RVG.dpi = 90
910 length = 10.in # =&gt; 900 pixels
911 </pre>
912
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
913 <p>If the dpi is defined, the following methods are added to
914 <code>Float</code> and <code>Fixnum</code></p>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
915
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
916 <dl>
917 <dt>px</dt>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
918
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
919 <dd>Pixel. The default unit of measurement.</dd>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
920
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
921 <dt>in</dt>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
922
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
923 <dd>Converts inches to pixels</dd>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
924
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
925 <dt>mm</dt>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
926
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
927 <dd>Converts millimeters to pixels</dd>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
928
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
929 <dt>cm</dt>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
930
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
931 <dd>Converts centimeters to pixels</dd>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
932
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
933 <dt>pt</dt>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
934
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
935 <dd>Converts points to pixels. There are 72 points to the
936 inch.</dd>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
937
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
938 <dt>pc</dt>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
939
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
940 <dd>Converts picas to pixels. There are 12 points to the
941 pica.</dd>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
942
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
943 <dt>deg</dt>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
944
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
945 <dd>Degrees. The default unit of rotation.</dd>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
946
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
947 <dt>rad</dt>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
948
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
949 <dd>Converts radians to degrees.</dd>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
950
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
951 <dt>grad</dt>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
952
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
953 <dd>Converts grads to degrees. There are 400 grads in a
954 circle.</dd>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
955
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
956 <dt>pct</dt>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
957
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
958 <dd>This conversion takes an numeric argument and returns a
959 percentage of the argument. For example 20.pct(150) -&gt;
960 30</dd>
961 </dl>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
962
e0ec773 Pretty up the "units" section
rmagick authored Sep 6, 2006
963 <p>SVG also supports <em>em</em> and <em>ex</em>, which are
964 measurements based on the font size. RVG does not.</p>
965 </div>
f98e28f Document units conversion methods
rmagick authored May 3, 2005
966
dabe7e9 Merged from RVG
rmagick authored Apr 1, 2005
967 <p class="spacer">&nbsp;</p>
968
969 <div class="nav">
970 &laquo; <a href="rvgtut.html">Prev</a> | <a href=
971 "index.html">Contents</a> | <a href="rvggroup.html">Next</a>
972 &raquo;
973 </div>
974 </body>
975 </html>
Something went wrong with that request. Please try again.