-
Notifications
You must be signed in to change notification settings - Fork 2
/
draw.html
3258 lines (2150 loc) · 86.1 KB
/
draw.html
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
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta name="generator" content="HTML Tidy for Linux/x86 (vers 7 December 2008), see www.w3.org" />
<title>RMagick 6.0.1: class Draw</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>
<style type="text/css">
/*<![CDATA[*/
/* Styles local to this page. */
/*]]>*/
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script>
hljs.configure({ cssSelector: "pre" });
hljs.highlightAll();
</script>
</head>
<body>
<h6 id="header">RMagick 6.0.1 User's Guide and Reference</h6>
<div class="nav">« <a href="image3.html">Prev</a> | <a href="index.html">Contents</a> | <a href="struct.html">Next</a> »</div>
<h1>class Draw <span class="superclass">< 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 class="toccol">
<ul>
<li><a href="#annotate">annotate</a></li>
<li><a href="#clone">clone</a></li>
<li><a href="#composite">composite</a></li>
</ul>
</div>
<div class="toccol">
<ul>
<li><a href="#draw">draw</a></li>
<li><a href="#dup">dup</a></li>
<li>
<a href="#get_multiline_type_metrics">get_multiline_type_metrics</a>
</li>
</ul>
</div>
<div class="toccol">
<ul>
<li><a href="#get_type_metrics">get_type_metrics</a></li>
<li><a href="#inspect">inspect</a></li>
<li><a href="#primitive">primitive</a></li>
</ul>
</div>
<h3>drawing primitive methods</h3>
<div class="toccol">
<ul>
<li><a href="#affine">affine</a></li>
<li><a href="#alpha">alpha</a></li>
<li><a href="#arc">arc</a></li>
<li><a href="#bezier">bezier</a></li>
<li><a href="#circle">circle</a></li>
<li><a href="#clip_path">clip_path</a></li>
<li><a href="#clip_rule">clip_rule</a></li>
<li><a href="#clip_units">clip_units</a></li>
<li><a href="#color">color</a></li>
<li><a href="#composite">composite</a></li>
<li><a href="#decorate">decorate</a></li>
<li><a href="#define_clip_path">define_clip_path</a></li>
<li><a href="#ellipse">ellipse</a></li>
<li><a href="#encoding">encoding</a></li>
<li><a href="#fill">fill</a></li>
<li><a href="#fill_opacity">fill_opacity</a></li>
<li><a href="#fill_rule">fill_rule</a></li>
<li><a href="#font">font</a></li>
<li><a href="#font_family">font_family</a></li>
<li><a href="#font_stretch">font_stretch</a></li>
</ul>
</div>
<div class="toccol">
<ul>
<li><a href="#font_style">font_style</a></li>
<li><a href="#font_weight">font_weight</a></li>
<li><a href="#gravity">gravity</a></li>
<li><a href="#interline_spacing">interline_spacing</a></li>
<li><a href="#interword_spacing">interword_spacing</a></li>
<li><a href="#kerning">kerning</a></li>
<li><a href="#line">line</a></li>
<li><a href="#matte">matte</a></li>
<li><a href="#opacity">opacity</a></li>
<li><a href="#path">path</a></li>
<li><a href="#pattern">pattern</a></li>
<li><a href="#point">point</a></li>
<li><a href="#pointsize">pointsize</a></li>
<li><a href="#polygon">polygon</a></li>
<li><a href="#polyline">polyline</a></li>
<li><a href="#pop">pop</a></li>
<li><a href="#push">push</a></li>
<li><a href="#rectangle">rectangle</a></li>
<li><a href="#rotate">rotate</a></li>
</ul>
</div>
<div class="toccol">
<ul>
<li><a href="#roundrectangle">roundrectangle</a></li>
<li><a href="#scale">scale</a></li>
<li><a href="#skewx">skewx</a></li>
<li><a href="#skewy">skewy</a></li>
<li><a href="#stroke">stroke</a></li>
<li><a href="#stroke_antialias">stroke_antialias</a></li>
<li><a href="#stroke_dasharray">stroke_dasharray</a></li>
<li><a href="#stroke_dashoffset">stroke_dashoffset</a></li>
<li><a href="#stroke_linecap">stroke_linecap</a></li>
<li><a href="#stroke_linejoin">stroke_linejoin</a></li>
<li><a href="#stroke_miterlimit">stroke_miterlimit</a></li>
<li><a href="#stroke_opacity">stroke_opacity</a></li>
<li><a href="#stroke_width">stroke_width</a></li>
<li><a href="#text">text</a></li>
<li><a href="#text_align">text_align</a></li>
<li><a href="#text_anchor">text_anchor</a></li>
<li><a href="#text_antialias">text_antialias</a></li>
<li><a href="#text_undercolor">text_undercolor</a></li>
<li><a href="#translate">translate</a></li>
</ul>
</div>
<h3>annotate attributes</h3>
<div class="toccol">
<ul>
<li><a href="#affine_eq">affine</a></li>
<li><a href="#align_eq">align</a></li>
<li><a href="#decorate_eq">decorate</a></li>
<li><a href="#density_eq">density</a></li>
<li><a href="#encoding_eq">encoding</a></li>
<li><a href="#fill_eq">fill</a></li>
<li><a href="#fill_pattern_eq">fill_pattern</a></li>
<li><a href="#font_eq">font</a></li>
</ul>
</div>
<div class="toccol">
<ul>
<li><a href="#font_family_eq">font_family</a></li>
<li><a href="#font_stretch_eq">font_stretch</a></li>
<li><a href="#font_style_eq">font_style</a></li>
<li><a href="#font_weight_eq">font_weight</a></li>
<li><a href="#gravity_eq">gravity</a></li>
<li><a href="#interline_spacing_eq">interline_spacing</a></li>
<li><a href="#interword_spacing_eq">interword_spacing</a></li>
<li><a href="#kerning_eq">kerning</a></li>
</ul>
</div>
<div class="toccol">
<ul>
<li><a href="#pointsize_eq">pointsize</a></li>
<li><a href="#rotation_eq">rotation</a></li>
<li><a href="#stroke_eq">stroke</a></li>
<li><a href="#stroke_pattern_eq">stroke_pattern</a></li>
<li><a href="#stroke_width_eq">stroke_width</a></li>
<li><a href="#text_antialias_eq">text_antialias</a></li>
<li><a href="#tile_eq">tile</a></li>
<li><a href="#undercolor_eq">undercolor</a></li>
</ul>
</div>
</div>
<h2 class="methods">class methods</h2>
<div class="sig">
<h3 id="new">new</h3>
<p>
Draw.new
<span class="arg">[ { optional parameters } ]</span> ->
<em>draw</em>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Creates a new Draw object.</p>
<h4>Arguments</h4>
<p>
If you plan to use the <code>annotate</code> method with this object you can initialize the <a href="#attributes">attributes</a> in the associated
block.
</p>
<h4>Returns</h4>
A new <code>Draw</code> object.
<h4>Example</h4>
<pre class="language-ruby">gc = Magick::Draw.new</pre>
</div>
<h2 class="methods">instance methods</h2>
<div class="sig">
<h3 id="annotate">annotate</h3>
<p>
<span class="arg">draw.</span>annotate(<span class="arg">img</span>, <span class="arg">width</span>, <span class="arg">height</span>,
<span class="arg">x</span>, <span class="arg">y</span>, <span class="arg">text</span>)
<span class="arg">[ { additional parameters } ]</span> ->
<em>self</em>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
Annotates a image with text. The text is positioned according to the
<code>gravity</code> attribute around the rectangle described by the <span class="arg">x</span>, <span class="arg">y</span>,
<span class="arg">width</span>, and <span class="arg">height</span> arguments. If either of the <span class="arg">width</span> or
<span class="arg">height</span> arguments are 0, uses the image width-<span class="arg">x</span> and the image height-<span class="arg">y</span>
to compute the rectangle width and height. The attributes described in
<a href="#attributes">annotate attributes</a>, below, influence the appearance and position of the text. These attributes may be set in the Draw object
before calling <code>annotate</code>, or within <code>annotate</code>'s optional <span class="arg">additional parameters</span> block.
</p>
<p><em>Note</em>: all of the <code>annotate</code> attributes are set-only.</p>
<h4>Arguments</h4>
<dl>
<dt>img</dt>
<dd>the image or imagelist to be annotated</dd>
<dt>width</dt>
<dd>width of the rectangle within which the text is positioned</dd>
<dt>height</dt>
<dd>height of the rectangle within which the text is positioned</dd>
<dt>x</dt>
<dd>x offset of the rectangle</dd>
<dt>y</dt>
<dd>y offset of the rectangle</dd>
<dt>text</dt>
<dd>the text</dd>
</dl>
<h4>Returns</h4>
<p>self</p>
<h4>Example</h4>
<p>
This example is an excerpt of
<a href="javascript:popup('colors.rb.html')" title="Click to see the example script">colors.rb</a>. Many other examples also use <code>annotate</code>.
</p>
<pre class="language-ruby">
title.annotate(montage, 0,0,0,40, 'Named Colors') { |options|
options.font_family = 'Helvetica'
options.fill = 'white'
options.stroke = 'transparent'
options.pointsize = 32
options.font_weight = BoldWeight
options.gravity = NorthGravity
}
</pre
>
<h4>Special characters</h4>
<p>
Escape a blank, quote, or apostrophe by preceding it with a backslash ("\"). To include a backslash in the text, use two consecutive backslashes. To
include a '%' in the text, use '%%'. You can include information about the image by including one or more of the special character sequences shown in
this table.
</p>
<table id="spec_chars_table" summary="annotate special characters" class="simple_table">
<caption>
Special characters
</caption>
<tr>
<th>Replaced by</th>
<th> </th>
</tr>
<tr>
<td>%b</td>
<td>file size in bytes</td>
</tr>
<tr>
<td>%c</td>
<td>"comment" property string</td>
</tr>
<tr>
<td>%d</td>
<td>directory in which the file resides</td>
</tr>
<tr>
<td>%e</td>
<td>filename extension</td>
</tr>
<tr>
<td>%f</td>
<td>original filename</td>
</tr>
<tr>
<td>%g</td>
<td>group number</td>
</tr>
<tr>
<td>%h</td>
<td>height</td>
</tr>
<tr>
<td>%i</td>
<td>current filename</td>
</tr>
<tr>
<td>%k</td>
<td>number of unique colors</td>
</tr>
<tr>
<td>%l</td>
<td>"label" property string</td>
</tr>
<tr>
<td>%m</td>
<td>file format</td>
</tr>
<tr>
<td>%n</td>
<td>number of images in the sequence (for RMagick, this is always 1)</td>
</tr>
<tr>
<td>%o</td>
<td>output filename</td>
</tr>
<tr>
<td>%p</td>
<td>page number (for RMagick, this is always 1)</td>
</tr>
<tr>
<td>%q</td>
<td>depth</td>
</tr>
<tr>
<td>%r</td>
<td>
A string of the form "ClasstypeColorspace," for example "DirectClassRGB". If the image's <em>matte</em> attribute is <code>true</code>, appends the
word "Matte" to the end of the string.
</td>
</tr>
<tr>
<td>%s</td>
<td>scene number (always 1)</td>
</tr>
<tr>
<td>%t</td>
<td>filename without extension</td>
</tr>
<tr>
<td>%u</td>
<td>unique temporary filename</td>
</tr>
<tr>
<td>%w</td>
<td>width</td>
</tr>
<tr>
<td>%x</td>
<td>x resolution</td>
</tr>
<tr>
<td>%y</td>
<td>y resolution</td>
</tr>
<tr>
<td>%z</td>
<td>depth</td>
</tr>
</table>
<h4>See also</h4>
<p>
This method is also defined in the
<a href="image1.html#annotate">Image</a> class.
</p>
<h4>Magick API</h4>
<p>AnnotateImage</p>
</div>
<div class="sig">
<h3 id="clone">clone</h3>
<p><span class="arg">draw</span>.clone -> <em>other_draw</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Same as <a href="#dup">dup</a> except the frozen state of the original is propagated to the copy.</p>
<h4>Returns</h4>
<p>A new Draw object.</p>
</div>
<div class="sig">
<h3 id="composite">composite</h3>
<p>
<span class="arg">draw</span>.composite(<span class="arg">x</span>, <span class="arg">y</span>, <span class="arg">width</span>,
<span class="arg">height</span>, <span class="arg">image</span>, [<span class="arg">operator</span>]) -> <em>self</em>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>This method draw the image using <a href="constants.html#CompositeOperator">CompositeOperator</a>.</p>
<h4>Arguments</h4>
<dl>
<dt>x</dt>
<dt>y</dt>
<dt>width</dt>
<dt>height</dt>
<dt>image</dt>
<dd>Either an imagelist or a image. If an imagelist, draws on the current image.</dd>
<dt>operator</dt>
<dd>Specify one of <a href="constants.html#CompositeOperator">CompositeOperator</a> enum.</dd>
</dl>
<h4>Returns</h4>
<p>self</p>
</div>
<div class="sig">
<h3 id="draw">draw</h3>
<p>
<span class="arg">draw</span>.draw(<span class="arg">img</span>) ->
<em>self</em>
</p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
Draws the list of graphic primitives on the specified image. Calling
<code>draw</code> does not affect the list of primitives. Each time you call <code>draw</code> the primitives will be re-executed from the beginning.
</p>
<h4>Arguments</h4>
<p>Either an imagelist or a image. If an imagelist, draws on the current image.</p>
<h4>Returns</h4>
<p>self</p>
<h4>Example</h4>
<p>See the other examples on this page.</p>
<h4>Magick API</h4>
<p>DrawImage</p>
</div>
<div class="sig">
<h3 id="dup">dup</h3>
<p><span class="arg">draw</span>.dup -> <em>other_draw</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Duplicate a <code>Draw</code> object.</p>
<h4>Returns</h4>
<p>An exact copy of the receiver, including the list of drawing primitives.</p>
<h4>See also</h4>
<p><a href="#clone">clone</a></p>
</div>
<div class="sig">
<h3 id="get_multiline_type_metrics">get_multiline_type_metrics</h3>
<p>
<span class="arg">draw</span>.get_multiline_type_metrics([<span class="arg">image</span>,] <span class="arg">string</span>) -> <em>type_metrics</em>
</p>
</div>
<div class="sig">
<h3 id="get_type_metrics">get_type_metrics</h3>
<p><span class="arg">draw</span>.get_type_metrics([<span class="arg">image</span>,] <span class="arg">string</span>) -> <em>type_metrics</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
Returns information for a specific string if rendered on a image. Metrics are derived from either the
<a href="#attributes"> annotate attributes</a> or from the <a href="info.html">image info attributes</a>, but not from any drawing primitive methods.
The <code>get_multiline_type_metrics</code> method is the same as <code>get_type_metrics</code>, except the former returns the maximum height and width
for multiple lines of text. (Text lines are separated by "\n" characters.)
</p>
<p>The Magick++ documentation for its TypeMetric class provides this useful additional information. (I've changed it a bit to use RMagick names.)</p>
<blockquote>
<p class="imquote">
The TypeMetric class provides the means to pass data from the Draw class's get_type_metric method to the user. It provides information regarding font
metrics such as ascent, descent, text width, text height, and maximum horizontal advance. The units of these font metrics are in pixels...(T)he
metrics are dependent on the current Image font (default Ghostscript's "Helvetica"), point size (default 12 points), and x/y resolution (default 72
DPI) settings.
</p>
<p class="imquote">
The pixel units may be converted to points (the standard resolution-independent measure used by the typesetting industry) via the following equation:
</p>
<pre class="language-ruby">size_points = (size_pixels * 72)/resolution</pre>
<p class="imquote">where resolution is in dots-per-inch (DPI). This means that at the default image resolution, there is one pixel per point.</p>
<p class="imquote">
Note that a font's point size is only a first-order approximation of the font height (ascender + descender) in points. The relationship between the
specified point size and the rendered font height is determined by the font designer.
</p>
<p class="imquote">
See
<a href="https://freetype.sourceforge.net/freetype2/docs/glyphs/index.html"> FreeType Glyph Conventions</a>
for a detailed description of font metrics related issues.
</p>
</blockquote>
<h4>Arguments</h4>
<dl>
<dt>image <em>(optional)</em></dt>
<dd>
The image on which the string will be rendered. ImageMagick uses the attributes of the image (font name, point size, etc.) to compute the metrics. If
this argument is omitted,
<code>get_type_metrics</code> substitutes a dummy image with default attributes. The <span class="arg">string</span> argument may not contain any of
the special characters shown in <a href="#spec_chars_table">this</a> table.
</dd>
<dt>string</dt>
<dd>
The string to be rendered. If <span class="arg">img</span> is specified, the string may contain special characters that refer to the image attributes.
See <a href="#spec_chars_table">this</a> table.
</dd>
</dl>
<h4>Returns</h4>
<p>
A TypeMetric struct. This structure has the following attributes. (The descriptions are taken from the
<a href="https://www.imagemagick.org/Magick++/TypeMetric.html">Magick++</a>
documentation and source code.)
</p>
<table summary="type metric attributes" class="simple_table">
<caption>
TypeMetric attributes
</caption>
<tr>
<th>Accessor</th>
<th>Description</th>
</tr>
<tr>
<td>ascent</td>
<td>Distance in pixels from the text baseline to the highest/upper grid coordinate used to place an outline point. Always a positive value.</td>
</tr>
<tr>
<td>descent</td>
<td>Distance in pixels from the baseline to the lowest grid coordinate used to place an outline point. Always a negative value.</td>
</tr>
<tr>
<td>width</td>
<td>Text width in pixels</td>
</tr>
<tr>
<td>height</td>
<td>Text height in pixels</td>
</tr>
<tr>
<td>max_advance</td>
<td>Maximum horizontal advance (advance from the beginning of a character to the beginning of the next character) in pixels.</td>
</tr>
</table>
<h4>Example</h4>
<p>
This example shows the details of a TypeMetric struct.
<a href="javascript:popup('get_type_metrics.rb.html')" title="Click to see the example script"
><img src="ex/get_type_metrics.gif" alt="get_type_metrics example"
/></a>
</p>
<p>
This example uses the <code>width</code> and <code>height</code> values returned by <code>get_multiline_type_metrics</code> to draw a border around the
text lines.
<a href="javascript:popup('get_multiline_type_metrics.rb.html')" title="Click to see the example script"
><img src="ex/get_multiline_type_metrics.gif" alt="get_multiline_type_metrics example"
/></a>
</p>
<h4>Magick API</h4>
<p>GetTypeMetrics, GetMultilineTypeMetrics</p>
</div>
<div class="sig">
<h3 id="inspect">inspect</h3>
<p><span class="arg">draw</span>.inspect -> <em>string</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
Returns the list of primitives that have been added to the
<code>draw</code> object. This is very handy for debugging.
</p>
<h4>Example</h4>
<pre class="language-ruby">
draw.inspect
#=> "stroke red
# fill transparent
# rectangle 20,20 380,180
# line 200,20 200,180
# line 20,100 380,100
# stroke transparent
# fill black"
</pre
>
</div>
<div class="sig">
<h3 id="primitive">primitive</h3>
<p><span class="arg">draw</span>.primitive(<span class="arg">primitive</span>) -> <em>self</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Add a drawing primitive to the list of primitives in the Draw object.</p>
<h4>Arguments</h4>
<dl>
<dt>primitive</dt>
<dd>String that it is a drawing primitive to add.</dd>
</dl>
<h4>Returns</h4>
<p>self</p>
</div>
<h2 class="methods">drawing primitive methods</h2>
<div class="sig">
<h3 id="affine">affine</h3>
<p><span class="arg">draw</span>.affine(<span class="arg">sx, rx, ry, sy, tx, ty</span>) -> <em>self</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>
Transforms the coordinate system by a 3x3 transformation matrix. See
<a href="https://www.w3.org/TR/SVG/coords.html#EstablishingANewUserSpace"> Coordinate system transformations</a>
in the <cite>Scalable Vector Graphics (SVG) 1.1 Specification</cite>.
</p>
<h4>Arguments</h4>
<dl>
<dt>sx, sy</dt>
<dd>The amount of scaling in the <em>x</em> and <em>y</em> directions</dd>
<dt>rx, ry</dt>
<dd>The rotation in the <em>x</em> and <em>y</em> directions, in radians</dd>
<dt>tx, ty</dt>
<dd>The translation distances in the <em>x</em> and <em>y</em> directions, in pixels</dd>
</dl>
<h4>Returns</h4>
<p>self</p>
<h4>Example</h4>
<p>
This example changes the default coordinate system to the standard Cartesian coordinate system: the x-axis points rightward and the y-axis points up.
</p>
<pre class="language-ruby">gc.affine(1, 0, 0, -1, 0, max_y)</pre>
<p>
<a href="javascript:popup('affine.rb.html')" title="Click to see the example script"><img src="ex/affine.gif" alt="affine example" /></a>
</p>
<h4>See also</h4>
<a href="#rotate">rotate</a>, <a href="#scale">scale</a>,
<a href="#translate">translate</a>
</div>
<div class="sig">
<h3 id="alpha">alpha</h3>
<p><span class="arg">draw</span>.alpha(<span class="arg">x, y, method</span>) -> <em>self</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Set alpha (make transparent) in image according to the specified colorization rule.</p>
<h4>Arguments</h4>
<dl>
<dt>x, y</dt>
<dd>The point in the <em>x</em> and <em>y</em> to start filling color</dd>
<dt>method</dt>
<dd>
A <a href="constants.html#PaintMethod">PaintMethod</a> constant. If you use the <code>FillToBorderMethod</code>, assign the border color with the
<code>Draw#border_color=</code> attribute before calling <a href="#draw">draw</a>.
</dd>
</dl>
<h4>Returns</h4>
<p>self</p>
<h4>Example</h4>
<pre class="language-ruby">draw.alpha(x, y, FillToBorderMethod)</pre>
</div>
<div class="sig">
<h3 id="arc">arc</h3>
<p><span class="arg">draw</span>.arc(<span class="arg">start_x, start_y, end_x, end_y, start_degrees, end_degrees</span>) -> <em>self</em></p>
</div>
<div class="desc">
<h4>Description</h4>
<p>Draws an arc within a rectangle.</p>
<h4>Arguments</h4>
<dl>
<dt>start_x, start_y</dt>
<dd>one corner of the bounding rectangle</dd>
<dt>end_x, end_y</dt>
<dd>the opposite corner of the bounding rectangle</dd>
<dt>start_degrees</dt>
<dd>where to start drawing the arc</dd>
<dt>end_degrees</dt>
<dd>where the arc ends</dd>
</dl>
<h4>Returns</h4>
<p>self</p>
<h4>Example</h4>
<pre class="language-ruby">gc.arc(40, 50, 250, 180, 0, 270)</pre>
<p>
<a href="javascript:popup('arc.rb.html')" title="Click to see the example script"><img src="ex/arc.gif" alt="arc example" /></a>
</p>
<h4>See also</h4>
<a href="#ellipse">ellipse</a>,
<a href="#path">the SVG elliptical arc commands (A and a)</a>
</div>
<div class="sig">
<h3 id="bezier">bezier</h3>
<p>
<span class="arg">draw</span>.bezier(<span class="arg">x1</span>, <span class="arg">y1</span>, <span class="arg">cx1</span>,
<span class="arg">cy1</span>, <span class="arg">cx2</span>, <span class="arg">cy2</span>, <span class="arg">x2</span>, <span class="arg">y2</span>...)
-> <em>self</em>
</p>
</div>