File: rvgpattern.html

package info (click to toggle)
librmagick-ruby 2.13.1-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 4,444 kB
  • ctags: 1,716
  • sloc: ansic: 16,755; ruby: 9,730; makefile: 16; sh: 12
file content (475 lines) | stat: -rw-r--r-- 13,575 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta name="generator" content=
  "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org" />

  <title>RMagick 2.13.1: RVG Reference: RVG::Pattern Class</title>
  <meta http-equiv="Content-Type" content=
  "text/html; charset=us-ascii" />
  <meta name="GENERATOR" content="Quanta Plus" />
  <meta name="Copyright" content=
  "Copyright (C) 2006 by Timothy P. Hunter" />
  <link rel="stylesheet" type="text/css" href="css/doc.css" />
<script type="text/javascript" src="scripts/doc.js">
</script>
<script type="text/javascript">
  //<![CDATA[
  //]]>
</script>
<style type="text/css">
  /*<![CDATA[*/
    }
  /*]]>*/
</style>
</head>

<body>
  <h6 id="header">RMagick 2.13.1 User's Guide and Reference</h6>

  <div class="nav">
    &laquo;&nbsp;<a href="rvgimage.html">Prev</a> | <a href=
    "index.html">Contents</a> | <a href=
    "rvgclip.html">Next</a>&nbsp;&raquo;
  </div>

  <h1>class RVG::Pattern <span class="superclass">&lt;
  Object</span></h1>

  <div id="toc">
    <h2>Table of Contents</h2>

    <h3>class methods</h3>

    <ul>
      <li><a href="#new">new</a></li>
    </ul>

    <h3>instance methods</h3>

    <div>
      <div class="toccol">
        <ul>
          <li><a href="#g">g</a></li>

          <li><a href="#image">image</a></li>

          <li><a href=
          "#preserve_aspect_ratio">preserve_aspect_ratio</a></li>
        </ul>
      </div>

      <div class="toccol">
        <ul>
          <li><a href="#rvg">rvg</a></li>

          <li><a href="#RVG_text">text</a></li>
        </ul>
      </div>

      <div class="toccol">
        <ul>
          <li><a href="#RVG_use">use</a></li>

          <li><a href="#viewbox">viewbox</a></li>
        </ul>
      </div>
    </div>

    <h3>shared methods</h3>

    <p>In addition to the methods listed above, this class also
    implements the <a href="rvgstyle.html">styles</a> method, the
    <a href="rvgshape.html">shape methods</a> and the <a href=
    "rvgxform.html">transform methods</a>.</p>
  </div>

  <h2 class="methods">class methods</h2>

  <div class="sig">
    <h3 id="new">new</h3>

    <p>RVG::Pattern.new(<span class="arg">width</span>=0,
    <span class="arg">height</span>=0, <span class=
    "arg">x</span>=0, <span class="arg">y</span>=0) [ <span class=
    "arg">{ |pattern| drawing method calls }</span> ] -&gt;
    <em>pattern</em></p>
  </div>

  <div class="desc">
    <h4>Description</h4>

    <p>Creates a pattern that can be used with the
    <code>:fill</code> and <code>:stroke</code> styles.</p>

    <p>Define the pattern in the associated block. The pattern can
    be composed of <a href="rvgshape.html">shapes</a>, <a href=
    "rvgtext.html#new">text</a>, <a href="rvgimage.html#new">raster
    images</a>, <a href="rvggroup.html#new">groups</a>, and
    <a href="rvg.html#RVG_new">RVG objects</a>. You can use the
    <a href="rvguse.html#new">use</a> method to include graphic
    objects in the pattern.</p>

    <h4>Arguments</h4>

    <dl>
      <dt>width, height</dt>

      <dd>These arguments define the pattern viewport.</dd>

      <dt>x, y</dt>

      <dd>Specify the starting offset of the pattern. The pattern
      will be repeated at <span class=
      "arg">x</span><code>+m*width</code> and <span class=
      "arg">y</span><code>+n*height</code> offsets.</dd>
    </dl>

    <h4>Example</h4>

    <p><a href="javascript:popup('rvg_pattern.rb.html')"><img src=
    "ex/rvg_pattern.gif" title="Click to see the example script"
    alt="pattern example" /></a></p>
  </div>

  <h2 class="methods">instance methods</h2>

  <div class="sig">
    <h3 id='g'>g</h3>

    <p><span class="arg">pattern.</span>g [{|<span class=
    "arg">grp</span>| ...}] -&gt; <em>group</em></p>
  </div>

  <div class="desc">
    <h4>Description</h4>

    <p>Calls <a href="rvggroup.html#new">RVG::Group.new</a> to
    construct a group and adds it to the pattern. Yields to a block
    if one is present, passing the new group as an argument.</p>

    <h4>Returns</h4>

    <p>Returns the new group, so <code>RVG::Group</code> methods
    can be chained to this method.</p>
  </div>

  <div class="sig">
    <h3 id='image'>image</h3>

    <p><span class="arg">pattern.</span>image(<span class=
    "arg">raster_image</span>, <span class="arg">width</span>=nil,
    <span class="arg">height</span>=nil, <span class=
    "arg">x</span>=0, <span class="arg">y</span>=0) -&gt;
    <em>image</em></p>
  </div>

  <div class="desc">
    <h4>Description</h4>

    <p>Calls <a href="rvgimage.html#new">RVG::Image.new</a> to
    construct an image and adds it to the pattern.</p>

    <h4>Returns</h4>

    <p>Returns the new image, so <code>RVG::Image</code> methods
    can be chained to this method.</p>
  </div>

  <div class="sig">
    <h3 id='preserve_aspect_ratio'>preserve_aspect_ratio</h3>

    <p><span class=
    "arg">pattern</span>.preserve_aspect_ratio(<span class=
    "arg">align</span>, <span class=
    "arg">meet_or_slice</span>='meet') [{|<span class=
    "arg">self</span>| ...}] -&gt; <em>self</em></p>
  </div>

  <div class="desc">
    <h4>Description</h4>

    <p>If you use the <a href="#viewbox">viewbox</a> method and the
    user coordinate system does not scale uniformly to the default
    coordinate system, use the <code>preserve_aspect_ratio</code>
    method to specify whether or not the content is stretched to
    fit. If not, you can specify how to fit the content into the
    space.</p>

    <p><code>Preserve_aspect_ratio</code> yields to a block if one
    is present, passing <span class="arg">self</span> as an
    argument.</p>

    <h4>Arguments</h4>

    <dl>
      <dt>align</dt>

      <dd>
        When the value of the <code>meet_or_slice</code> argument
        is 'meet' or 'slice', this argument controls the placement
        of the content within the viewport. The <code>align</code>
        argument is the concatenation of an <em>x</em>-alignment and
        a <em>y</em>-alignment. The values are shown in these
        lists:

        <h6><em>x</em>-alignment</h6>

        <dl>
          <dt>xMin</dt>

          <dd>align the minimum <em>x</em> value of the content
          with the left corner of the viewport.</dd>

          <dt>xMid</dt>

          <dd>vertically center the content within the
          viewport.</dd>

          <dt>xMax</dt>

          <dd>align the maximum <em>x</em> value of the content
          with the right corner of the viewport.</dd>
        </dl>

        <h6><em>y</em>-alignment</h6>

        <dl>
          <dt>YMin</dt>

          <dd>align the minimum <em>y</em> value of the content
          with the top of the viewport.</dd>

          <dt>YMid</dt>

          <dd>horizontally center the content within the
          viewport.</dd>

          <dt>YMax</dt>

          <dd>align the maximum <em>y</em> value of the content
          with the bottom of the viewport</dd>
        </dl>
      </dd>

      <dt>meet_or_slice</dt>

      <dd>
        This argument can have one of these three values:

        <dl>
          <dt>'none'</dt>

          <dd>The content is scaled as necessary so that it fits
          exactly within the viewport. The aspect ratio is
          <em>not</em> maintained.</dd>

          <dt>'meet'</dt>

          <dd>The content is scaled as necessary so that the larger
          dimension exactly fits the viewport. There may be some
          unused space in the viewport. The aspect ratio is
          maintained.</dd>

          <dt>'slice'</dt>

          <dd>The content is scaled as necessary so that the
          smaller dimension exactly fits the viewport. Some of the
          content in the larger dimension may be cut off. The
          aspect ratio is maintained.</dd>
        </dl>
      </dd>
    </dl>

    <h4>Example</h4>

    <p>See the RVG class <a href=
    "rvg.html#RVG_preserve_aspect_ratio">example</a>.</p>

    <h4>Returns</h4>

    <p><span class="arg">Self</span>, so other
    <code>RVG::Pattern</code> methods can be chained to this
    method.</p>

    <h4>See Also</h4>

    <p><a href="#viewbox">viewbox</a></p>
  </div>

  <div class="sig">
    <h3 id="rvg">rvg</h3>

    <p><span class="arg">pattern</span>.rvg(<span class=
    "arg">width</span>, <span class="arg">height</span>,
    <span class="arg">x</span>=0, <span class="arg">y</span>=0)
    [{|<span class="arg">new_rvg</span>| ...}] -&gt;
    <em>pattern</em></p>
  </div>

  <div class="desc">
    <h4>Description</h4>

    <p>This method constructs a new RVG object and adds it to the
    pattern. Each nested RVG object can use the <a href=
    "rvg.html#RVG_viewbox">viewbox</a> method to define its own
    coordinate system. The <code>rvg</code> method yields to a
    block, passing the nested RVG object as an argument. Within the
    block, any drawing objects added to the nested RVG object are
    rendered within the nested RVG object's viewport.</p>

    <h4>Arguments</h4>

    <dl>
      <dt>width, height</dt>

      <dd>Specifies the viewport width and height. The units are in
      the user coordinate system of the parent container.</dd>

      <dt>x, y</dt>

      <dd>The x- and y-axis offsets of the viewport upper-left
      corner. The units are in the user coordinate system of the
      parent container.</dd>
    </dl>

    <h4>Example</h4>

    <p>See the example for <a href=
    "#RVG_preserve_aspect_ratio">preserve_aspect_ratio</a> in
    <code>class RVG</code>.</p>

    <h4>Returns</h4>

    <p>The <code>RVG</code> object, so other <code>RVG</code>
    methods can be chained to this method.</p>
  </div>

  <div class="sig">
    <h3 id='RVG_text'>text</h3>

    <p><span class="arg">pattern.</span>text(<span class=
    "arg">x</span>=0, <span class="arg">y</span>=0, <span class=
    "arg">text</span>=nil) [{|<span class="arg">text</span>| ...}]
    -&gt; <em>text</em></p>
  </div>

  <div class="desc">
    <h4>Description</h4>

    <p>Calls <a href="rvgtext.html#new">RVG::Text.new</a> to
    construct a text object and adds it to the pattern. Yields to a
    block if one is present, passing the new text object as an
    argument.</p>

    <h4>Returns</h4>

    <p>The <code>RVG::Text</code> object, so other
    <code>RVG::Text</code> methods can be chained to this
    method.</p>
  </div>

  <div class="sig">
    <h3 id="RVG_use">use</h3>

    <p><span class="arg">pattern</span>.use(<span class=
    "arg">obj</span>, <span class="arg">x</span>=0, <span class=
    "arg">y</span>=0, <span class="arg">width</span>=nil,
    <span class="arg">height</span>=nil) -&gt; <em>use</em></p>
  </div>

  <div class="desc">
    <h4>Description</h4>

    <p>Calls <a href="rvguse.html#new">RVG::Use.new</a> to
    constructs a <code>use</code> object and adds it to the
    pattern.</p>

    <p>When the referenced argument is an RVG object, <span class=
    "arg">width</span> and <span class="arg">height</span> can be
    used to specify the width and height of the viewport. If
    present and non-nil, these arguments override any width and
    height specified when the RVG object was created. You must
    specify the viewport size either when creating the RVG object
    or when referencing it with <code>use</code>.</p>

    <h4>Examples</h4>

    <p>See <a href="rvguse.html#new">RVG::Use.new</a></p>

    <h4>Returns</h4>

    <p>The <code>RVG::Use</code> object, so other
    <code>RVG::Use</code> methods can be chained to this
    method.</p>
  </div>

  <div class="sig">
    <h3 id="viewbox">viewbox</h3>

    <p><span class="arg">pattern</span>.viewbox(<span class=
    "arg">min_x</span>, <span class="arg">min_y</span>,
    <span class="arg">width</span>, <span class=
    "arg">height</span>) [{|<span class="arg">self</span>| ...}]
    -&gt; <em>self</em></p>
  </div>

  <div class="desc">
    <h4>Description</h4>

    <p>The area of the pattern is called the <em>viewport</em>. By
    default the origin of the coordinate system for an pattern is
    (0,0). The user coordinates are pixels and the width and height
    are established by the <span class="arg">width</span> and
    <span class="arg">height</span> arguments to
    <code>RVG::Pattern.new</code>.</p>

    <p>Use the <code>viewbox</code> method to superimpose a user
    coordinate system on the viewport. The <code>viewbox</code>
    method lets you set up a coordinate system using the units of
    your choice.</p>

    <p>The <code>viewbox</code> method yields to a block if one is
    present, passing <code>self</code> as an argument.</p>

    <h4>Arguments</h4>

    <dl>
      <dt>min_x, min_y</dt>

      <dd>The minimum <em>x</em>-coordinate and
      <em>y</em>-coordinate of the user coordinate system.</dd>

      <dt>width, height</dt>

      <dd>The width and height of the user coordinate system.</dd>
    </dl>

    <h4>Example</h4>

    <p>See the <a href="rvg.html#RVG_viewbox">example</a> for the
    <code>RVG</code> class.</p>

    <h4>Returns</h4>

    <p><span class="arg">Self</span>, so other
    <code>RVG::Pattern</code> methods may be chained to
    <code>viewbox</code>.</p>

    <h4>See Also</h4>

    <p><a href=
    "#preserve_aspect_ratio">preserve_aspect_ratio</a></p>
  </div>

  <p class="spacer">&nbsp;</p>

  <div class="nav">
    &laquo;&nbsp;<a href="rvgimage.html">Prev</a> | <a href=
    "index.html">Contents</a> | <a href=
    "rvgclip.html">Next</a>&nbsp;&raquo;
  </div>
</body>
</html>