1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"949.54">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #001fe8}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; min-height: 12.0px}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 56.0px; text-indent: -56.0px; font: 12.0px Helvetica
}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #000000}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #ad1d13}
19 p
.p10
{margin: 0.0px 0.0px 0.0px 56.0px; text-indent: -56.0px; font: 12.0px Helvetica
; min-height: 14.0px}
20 p
.p11
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #ad1d13}
21 p
.p12
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #ad1d13; min-height: 14.0px}
22 p
.p13
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000}
23 p
.p14
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #606060}
24 p
.p15
{margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco
; color: #ad1d13}
25 p
.p16
{margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco
; color: #ad1d13; min-height: 14.0px}
26 p
.p17
{margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco
; min-height: 14.0px}
27 span
.s1
{font: 18.0px Helvetica
}
28 span
.s2
{color: #0019ba}
29 span
.s3
{color: #000000}
30 span
.s4
{text-decoration: underline
}
31 span
.s5
{color: #ad1d13}
32 span
.s6
{font: 9.0px Monaco
}
33 span
.s7
{color: #0000bf}
34 span
.s8
{color: #606060}
35 span
.s9
{color: #2b6f11}
36 span
.s10
{font: 12.0px Helvetica
; color: #000000}
37 span
.s11
{color: #bf0000}
38 span
.s12
{font: 10.0px Monaco
}
39 span
.s13
{font: 8.0px Monaco
}
40 span
.Apple-tab-span
{white-space:pre
}
44 <p class=
"p1"><span class=
"s1"><b>SCPen
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><b>draw on a SCWindow
</b></p>
45 <p class=
"p2"><br></p>
46 <p class=
"p3"><b>Inherits from:
</b><a href=
"../../Core/Object.html"><span class=
"s2"><b>Object
</b></span></a></p>
47 <p class=
"p2"><br></p>
48 <p class=
"p3">A class which allows you to draw on a
<a href=
"SCWindow.html"><span class=
"s2">SCWindow
</span></a>. It has no instance methods.
</p>
49 <p class=
"p2"><br></p>
50 <p class=
"p3">The following methods must be called within an SCWindow-drawHook or a SCUserView-drawFunc function, and will only be visible once the window or the view is refreshed. Each call to SCWindow-refresh SCUserView-refresh will 'overwrite' all previous drawing by executing the currently defined function.
</p>
51 <p class=
"p2"><br></p>
52 <p class=
"p3">SCPen is returned by
<a href=
"../Main-GUI/Pen.html"><span class=
"s2">Pen
</span></a> when CocoaGUI is in use. The examples below use the
<a href=
"../GUI-Tools/ViewRedirect.html"><span class=
"s2">ViewRedirect
</span></a> subclass,
<a href=
"../Main-GUI/Pen.html"><span class=
"s2">Pen
</span></a>.
</p>
53 <p class=
"p2"><br></p>
54 <p class=
"p4"><span class=
"s3"><b>See also:
</b> <a href=
"SCWindow.html"><span class=
"s4">SCWindow
</span></a>,
<a href=
"SCUserView.html"><span class=
"s4">SCUserView
</span></a>,
<a href=
"../GUI-Tools/Color.html"><span class=
"s4">Color
</span></a>, and
<a href=
"../../Collections/String.html"><span class=
"s4">String
</span></a></span></p>
55 <p class=
"p2"><br></p>
56 <p class=
"p1"><b>Drawing Methods
</b></p>
57 <p class=
"p2"><br></p>
58 <p class=
"p3">The following methods define paths. You will need to call
<b>*stroke
</b> or
<b>*fill
</b> to actually draw them.
</p>
59 <p class=
"p2"><br></p>
60 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*moveTo (point)
</b></p>
61 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Move the Pen to
<b>point
</b>.
<b>point
</b> is an instance of
<a href=
"../../Geometry/Point.html"><span class=
"s2">Point
</span></a>.
</p>
62 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
63 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*lineTo (point)
</b></p>
64 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Draw a line (define a path) from the current position to
<b>point
</b>.
<b>point
</b> is an instance of
<a href=
"../../Geometry/Point.html"><span class=
"s2">Point
</span></a>.
</p>
66 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*line (p1, p2)
</b></p>
67 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Draw a line (define a path) from p1 to p2. Current position will be p2.
<b>p1
</b> and
<b>p2
</b> are instances of
<a href=
"../../Geometry/Point.html"><span class=
"s2">Point
</span></a>.
</p>
68 <p class=
"p5"><br></p>
69 <p class=
"p3"><span class=
"s5"><b><span class=
"Apple-tab-span"> </span></b></span><b>*curveTo(point, cpoint1, cpoint2)
</b></p>
70 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>draws a cubic bezier curve from the current position to
<b>point
</b>.
</p>
71 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>cpoint1, cpoint2
</b>are control points determining the curve's curvature.
</p>
72 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>point, cpoint1
</b>and
<b> cpoint2
</b>are instances of
<a href=
"../../Geometry/Point.html"><span class=
"s2">Point
</span></a>.
</p>
73 <p class=
"p2"><br></p>
74 <p class=
"p3"><span class=
"s5"><b><span class=
"Apple-tab-span"> </span></b></span><b>*quadCurveTo(point, cpoint1)
</b></p>
75 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>draws a quad bezier curve from the current position to
<b>point
</b>.
</p>
76 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>cpoint1
</b>is a control point determining the curve's curvature.
</p>
77 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>point, cpoint1
</b>are instances of
<a href=
"../../Geometry/Point.html"><span class=
"s2">Point
</span></a>.
</p>
78 <p class=
"p5"><br></p>
79 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*arcTo(point1, point2, radius)
</b></p>
80 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>draws an arc of a circle using a radius and tangent points.
</p>
81 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>point1
</b> is the end point of the first tangent line. Its start point is the current position.
</p>
82 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>point2
</b> is the end point of the second tangent line. Its start point is
<b>point1
</b>.
</p>
83 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>radius
</b> is the radius of the arc.
</p>
84 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>point1, point2
</b>are instances of
<a href=
"../../Geometry/Point.html"><span class=
"s2">Point
</span></a>.
</p>
85 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
86 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s6">(
</span></p>
87 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">var
</span> w =
<span class=
"s7">Window
</span>(
<span class=
"s8">"arcTo"</span>,
<span class=
"s7">Rect
</span>(
100,
200,
300,
300)).front;
</p>
88 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">var
</span> r=
15;
</p>
89 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
<span class=
"s7">|v|
</span><span class=
"Apple-tab-span"> </span></p>
90 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Pen
</span>.fillColor =
<span class=
"s7">Color
</span>.blue;
</p>
91 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Pen
</span>.strokeColor =
<span class=
"s7">Color
</span>.red;
</p>
92 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Pen
</span>.moveTo(
150@
150);
</p>
93 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Pen
</span>.arcTo(
200@
150,
200@
225, r);
</p>
94 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Pen
</span>.arcTo(
200@
225,
100@
225, r);
</p>
95 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Pen
</span>.arcTo(
100@
225,
100@
150, r);
</p>
96 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Pen
</span>.arcTo(
100@
150,
150@
150, r);
</p>
97 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Pen
</span>.lineTo(
150@
150);
</p>
98 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Pen
</span>.fillStroke;
</p>
99 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
100 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">)
</span></p>
101 <p class=
"p5"><br></p>
102 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*addArc(center, radius, startAngle, arcAngle)
</b></p>
103 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Draw an arc around the
<b>[Point]
</b> <b>center
</b>, at
<b>radius
</b> number of pixels.
<b>startAngle
</b> and
<b>arcAngle
</b> refer to the starting angle and the extent of the arc, and are in radians [
0.
.2pi].
</p>
104 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s6">(
</span></p>
105 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
106 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.white);
</p>
107 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
108 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
100,
100);
</p>
109 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>10.do{
</p>
110 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color
</p>
111 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.color =
<span class=
"s2">Color
</span>.red(rrand(
0.0,
1), rrand(
0.0,
0.5));
</p>
112 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.addArc((
100.rand)@(
100.rand), rrand(
10,
100),
2pi.rand, pi);
</p>
113 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.perform([
<span class=
"s9">\stroke
</span>,
<span class=
"s9">\fill
</span>].choose);
</p>
114 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>}
</p>
115 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
116 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
117 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
118 <p class=
"p2"><br></p>
119 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*addWedge(center, radius, startAngle, arcAngle)
</b></p>
120 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Draw a wedge around the
<b>[Point]
</b> <b>center
</b>, at
<b>radius
</b> number of pixels.
<b>startAngle
</b> and
<b>arcAngle
</b> refer to the starting angle and the extent of the arc, and are in radians [
0.
.2pi].
</p>
121 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
122 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
123 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
124 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.white);
</p>
125 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
126 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
100,
100);
</p>
127 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>10.do{
</p>
128 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color
</p>
129 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.color =
<span class=
"s2">Color
</span>.blue(rrand(
0.0,
1), rrand(
0.0,
0.5));
</p>
130 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.addWedge((
100.rand)@(
100.rand), rrand(
10,
100),
2pi.rand,
2pi.rand);
</p>
131 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.perform([
<span class=
"s9">\stroke
</span>,
<span class=
"s9">\fill
</span>].choose);
</p>
132 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>}
</p>
133 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
134 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
135 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
136 <p class=
"p2"><br></p>
137 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*addAnnularWedge (center, innerRadius, outerRadius, startAngle, arcAngle)
</b></p>
138 <p class=
"p6"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Draw an annular wedge around the
<b>[Point]
</b> <b>center
</b>, from
<b>innerRadius
</b> to
<b>outerRadius
</b> in pixels.
<b>startAngle
</b> and
<b>arcAngle
</b> refer to the starting angle and the extent of the arc, and are in radians [
0.
.2pi].
</p>
139 <p class=
"p10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
140 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
141 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
142 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.white);
</p>
143 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
144 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
100,
100);
</p>
145 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>1000.do{
</p>
146 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color
</p>
147 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.color =
<span class=
"s2">Color
</span>.green(rrand(
0.0,
1), rrand(
0.0,
0.5));
</p>
148 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.addAnnularWedge(
</p>
149 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
100.rand)@(
100.rand),
</p>
150 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>rrand(
10,
50),
</p>
151 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>rrand(
51,
100),
<span class=
"Apple-tab-span"> </span></p>
152 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>2pi.rand,
</p>
153 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>2pi.rand
</p>
154 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
155 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.perform([
<span class=
"s9">\stroke
</span>,
<span class=
"s9">\fill
</span>].choose);
</p>
156 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>}
</p>
157 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
158 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
159 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
160 <p class=
"p2"><br></p>
161 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*addRect(rect)
</b></p>
162 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>adds a rectangle to the drawing;
</p>
163 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
164 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s6">(
</span></p>
165 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
166 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.dump;
</p>
167 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.white);
</p>
168 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
169 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>80.do{
</p>
170 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color
</p>
171 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.color =
<span class=
"s2">Color
</span>.green(rrand(
0.0,
1), rrand(
0.0,
0.5));
</p>
172 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.addRect(
</p>
173 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Rect
</span>(
20,
20, (w.bounds.width-
40).rand, (w.bounds.height-
40).rand)
</p>
174 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
175 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.perform([
<span class=
"s9">\stroke
</span>,
<span class=
"s9">\fill
</span>].choose);
</p>
176 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>}
</p>
177 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
178 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
179 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
180 <p class=
"p5"><br></p>
181 <p class=
"p3"><span class=
"s6"><span class=
"Apple-tab-span"> </span></span><b>*stroke
</b></p>
182 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>outline the previous defined path.
</p>
183 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
184 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
185 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
186 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.white);
</p>
187 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
188 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color
</p>
189 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeColor =
<span class=
"s2">Color
</span>.red;
</p>
190 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
200@
100);
</p>
191 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
192 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
250@
200);
</p>
193 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
300@
200);
</p>
194 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
200@
250);
</p>
195 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
100@
200);
</p>
196 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
150@
200);
</p>
197 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
200@
100);
</p>
198 <p class=
"p5"><br></p>
199 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.stroke
</p>
200 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
201 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
202 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
203 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
204 <p class=
"p3"><span class=
"s6"><span class=
"Apple-tab-span"> </span></span><b>*fill
</b></p>
205 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>fill the previous defined path.
</p>
206 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
207 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
208 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
209 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.white);
</p>
210 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
211 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color
</p>
212 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillColor =
<span class=
"s2">Color
</span>.red;
</p>
213 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
200@
100);
</p>
214 <p class=
"p5"><br></p>
215 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
250@
200);
</p>
216 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
300@
200);
</p>
217 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
200@
250);
</p>
218 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
100@
200);
</p>
219 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
150@
200);
</p>
220 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
200@
100);
</p>
221 <p class=
"p5"><br></p>
222 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fill
</p>
223 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
224 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
225 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
226 <p class=
"p3"><span class=
"s6"><span class=
"Apple-tab-span"> </span></span><b>*draw(option)
</b></p>
227 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>draw the previous defined path using any of the following options:
</p>
228 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0 = fill
</p>
229 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>1 = fill using even-odd rule
</p>
230 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>2 = stroke
</p>
231 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>3 = fill and stroke the current path
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> </p>
232 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>4 = fill and stroke using even-odd rule
</p>
233 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
234 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
235 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
236 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.white);
</p>
237 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
238 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color
</p>
239 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillColor =
<span class=
"s2">Color
</span>.red;
</p>
240 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
200@
100);
</p>
241 <p class=
"p5"><br></p>
242 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
250@
200);
</p>
243 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
300@
200);
</p>
244 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
200@
250);
</p>
245 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
100@
200);
</p>
246 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
150@
200);
</p>
247 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
200@
100);
</p>
248 <p class=
"p5"><br></p>
249 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">Pen
</span><span class=
"s3">.draw(
4);
</span>// fill and then stroke
</p>
250 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
251 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
252 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
253 <p class=
"p3"><span class=
"s6"><span class=
"Apple-tab-span"> </span></span><b>*fillStroke
</b></p>
254 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span></b><span class=
"s6"><span class=
"Apple-tab-span"> </span></span>fill and stroke the current path
<span class=
"Apple-tab-span"> </span>(shortcut to the
<b>draw(
3)
</b> method)
</p>
255 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s6">(
</span></p>
256 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
257 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.white);
</p>
258 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
259 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color
</p>
260 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillColor =
<span class=
"s2">Color
</span>.red;
</p>
261 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
200@
100);
</p>
262 <p class=
"p5"><br></p>
263 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
250@
200);
</p>
264 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
300@
200);
</p>
265 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
200@
250);
</p>
266 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
100@
200);
</p>
267 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
150@
200);
</p>
268 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
200@
100);
</p>
269 <p class=
"p5"><br></p>
270 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillStroke;
</p>
271 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
272 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
273 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
274 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
275 <p class=
"p3">These methods do require separate calls to
<b>*stroke
</b> or
<b>*fill
</b>.
</p>
276 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
277 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*strokeRect(rect)
</b></p>
278 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Strokes a rectangle into the window.
<b>rect
</b> is an instance of
<a href=
"../../Geometry/Rect.html"><span class=
"s2">Rect
</span></a>.
</p>
279 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s6">(
</span></p>
280 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>(
<span class=
"s8">"strokeRect"</span>,
<span class=
"s2">Rect
</span>(
128,
64,
360,
360));
</p>
281 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
282 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> r;
</p>
283 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>r =
<span class=
"s2">Rect
</span>(
100,
100,
160,
80);
</p>
284 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeColor =
<span class=
"s2">Color
</span>.black.alpha_(
0.8);
</p>
285 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeRect(r);
</p>
286 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
287 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.front;
</p>
288 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
289 <p class=
"p2"><br></p>
290 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*fillRect(rect)
</b></p>
291 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Draws a filled rectangle into the window.
<b>rect
</b> is an instance of
<a href=
"../../Geometry/Rect.html"><span class=
"s2">Rect
</span></a>.
</p>
292 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
293 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>*addOval(rect)
</b></p>
294 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Adds an Oval shape to the current path.
<b>rect
</b> is an instance of
<a href=
"../../Geometry/Rect.html"><span class=
"s2">Rect
</span></a>.
</p>
295 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b><span class=
"Apple-tab-span"> </span></p>
296 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*strokeOval(rect)
</b></p>
297 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Strokes an oval into the window.
<b>rect
</b> is an instance of
<a href=
"../../Geometry/Rect.html"><span class=
"s2">Rect
</span></a>.
</p>
298 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s6">(
</span></p>
299 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>(
<span class=
"s8">"strokeOval"</span>,
<span class=
"s2">Rect
</span>(
128,
64,
360,
360));
</p>
300 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
301 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> r;
</p>
302 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>r =
<span class=
"s2">Rect
</span>(
100,
100,
160,
80);
</p>
303 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeColor =
<span class=
"s2">Color
</span>.black.alpha_(
0.8);
</p>
304 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeOval(r);
</p>
305 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
306 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.front;
</p>
307 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
308 <p class=
"p2"><br></p>
309 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*fillOval(rect)
</b></p>
310 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Draws a filled oval into the window.
<b>rect
</b> is an instance of
<a href=
"../../Geometry/Rect.html"><span class=
"s2">Rect
</span></a>.
</p>
311 <p class=
"p5"><span class=
"Apple-tab-span"> </span></p>
312 <p class=
"p3"><span class=
"s6"><span class=
"Apple-tab-span"> </span></span><b>*fillAxialGradient(startPoint, endPoint, startColor, endColor)
</b></p>
313 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Draws an Axial gradient.
</p>
314 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s6">(
</span></p>
315 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
316 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
317 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// fill the gradient
</p>
318 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.addRect(w.view.bounds.insetBy(
30));
</p>
319 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillAxialGradient(w.view.bounds.leftTop, w.view.bounds.rightBottom,
<span class=
"s2">Color
</span>.rand,
<span class=
"s2">Color
</span>.rand);
</p>
320 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
321 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
322 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
323 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
324 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>*fillRadialGradient(innerCircleCenter, outerCircleCenter, startRadius, endRadius, startColor, endColor)
</b></p>
325 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Draws a Radial gradient.
</p>
326 <p class=
"p5"><span class=
"Apple-tab-span"> </span></p>
327 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
328 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
329 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
330 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// fill the gradient
</p>
331 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.addOval(w.view.bounds.insetBy(
30));
</p>
332 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillRadialGradient(w.view.bounds.center,
</p>
333 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.bounds.center,
0, w.bounds.width,
<span class=
"s2">Color
</span>.rand,
<span class=
"s2">Color
</span>.rand);
</p>
334 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
335 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
336 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
337 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
338 <p class=
"p11"><b>//
<span class=
"Apple-tab-span"> </span>*drawAquaButton(rect, type=
0, down=false, on=false)
</b></p>
339 <p class=
"p5"><br></p>
340 <p class=
"p1"><b>Graphics State Methods
</b></p>
341 <p class=
"p5"><br></p>
342 <p class=
"p3">The following commands transform the graphics state, i.e. they effect all subsequent drawing commands. These transformations are cumulative, i.e. each command applies to the previous graphics state,
<i>not
</i> the original one.
</p>
343 <p class=
"p2"><br></p>
344 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*translate(x=
0, y=
0)
</b></p>
345 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>translate the coordinate system to have its origin moved by
<b>x
</b>,
<b>y
</b></p>
346 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
347 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
348 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.white);
</p>
349 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
350 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color
</p>
351 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeColor =
<span class=
"s2">Color
</span>.blue;
</p>
352 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
200,
100);
</p>
353 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
354 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>//
0@
0 is now
200@
100</p>
355 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
0@
0);
</p>
356 <p class=
"p5"><br></p>
357 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
50@
100);
</p>
358 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
100@
100);
</p>
359 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
0@
150);
</p>
360 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(-
100@
100);
</p>
361 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(-
50@
100);
</p>
362 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
0@
0);
</p>
363 <p class=
"p5"><br></p>
364 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.stroke
</p>
365 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
366 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
367 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
368 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
369 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// cumulative translations
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
370 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
371 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
372 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.clear);
</p>
373 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
374 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color
</p>
375 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeColor =
<span class=
"s2">Color
</span>.black;
</p>
376 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// draw
35 lines
</p>
377 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>35.do {
</p>
378 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
0@
0);
</p>
379 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
50@
350);
</p>
380 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// shift
10 to the right every time
</p>
381 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
10,
0);
</p>
382 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.stroke
</p>
383 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>}
</p>
384 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
385 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
386 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
387 <p class=
"p5"><br></p>
388 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*scale (x=
0, y=
0)
</b></p>
389 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Scales subsequent drawing.
<b>x
</b> and
<b>y
</b> are scaling factors (i.e.
1 is normal,
2 is double size, etc.).
</p>
390 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
391 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
392 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.white);
</p>
393 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
394 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color
</p>
395 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeColor =
<span class=
"s2">Color
</span>.green;
</p>
396 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
200,
100);
</p>
397 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.scale(
0.5,
2);
</p>
398 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// you have to set a starting point...
</p>
399 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
0@
0);
</p>
400 <p class=
"p5"><br></p>
401 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
50@
100);
</p>
402 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
100@
100);
</p>
403 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
0@
150);
</p>
404 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(-
100@
100);
</p>
405 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(-
50@
100);
</p>
406 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
0@
0);
</p>
407 <p class=
"p5"><br></p>
408 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.stroke
</p>
409 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
410 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
411 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
412 <p class=
"p2"><br></p>
413 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*skew (x=
0, y=
0)
</b></p>
414 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Skews subsequent drawing.
<b>x
</b> and
<b>y
</b> are skewing factors (i.e.
1 is normal).
</p>
415 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
416 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
417 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.white);
</p>
418 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
419 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color
</p>
420 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillColor =
<span class=
"s2">Color
</span>.green(
0.5,
0.8);
</p>
421 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
200,
100);
</p>
422 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.skew(
0.5,
0.2);
</p>
423 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// you have to set a starting point...
</p>
424 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
0@
0);
</p>
425 <p class=
"p5"><br></p>
426 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
50@
100);
</p>
427 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
100@
100);
</p>
428 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
0@
150);
</p>
429 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(-
100@
100);
</p>
430 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(-
50@
100);
</p>
431 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
0@
0);
</p>
432 <p class=
"p5"><br></p>
433 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fill
</p>
434 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
435 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
436 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
437 <p class=
"p2"><br></p>
438 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*rotate (angle=
0, x=
0, y=
0)
</b></p>
439 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Rotates subsequent drawing around the
<b>Point
</b> x@y by the amount
<b>angle
</b>in radians [
0.
.2pi].
</p>
440 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
441 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
442 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.white);
</p>
443 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>c =
0;
</p>
444 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
445 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
220,
200);
</p>
446 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
447 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>10.do({
</p>
448 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
0,
10);
</p>
449 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color for all
"real" drawing
</p>
450 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillColor =
<span class=
"s2">Color
</span>.hsv(c.fold(
0,
1),
1,
1,
0.5);
</p>
451 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
452 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// you have to set a starting point...
</p>
453 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
0@
0);
</p>
454 <p class=
"p5"><span class=
"Apple-tab-span"> </span></p>
455 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
50@
100);
</p>
456 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
100@
100);
</p>
457 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
0@
150);
</p>
458 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(-
100@
100);
</p>
459 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(-
50@
100);
</p>
460 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
0@
0);
</p>
461 <p class=
"p5"><span class=
"Apple-tab-span"> </span></p>
462 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fill;
</p>
463 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.rotate(
0.2pi);
</p>
464 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
465 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>c = c +
0.1;
</p>
466 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>});
</p>
467 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
468 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
469 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
470 <p class=
"p5"><br></p>
471 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*matrix_ (array)
</b></p>
472 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>transforms coordinate system.
</p>
473 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>array = [a, b, c, d, x, y]
</p>
474 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a
<span class=
"Apple-tab-span"> </span>zoomX
</p>
475 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>b
<span class=
"Apple-tab-span"> </span>shearingY
</p>
476 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>c
<span class=
"Apple-tab-span"> </span>shearingX
</p>
477 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>d
<span class=
"Apple-tab-span"> </span>zoomY
</p>
478 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>x
<span class=
"Apple-tab-span"> </span>translateX
</p>
479 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>y
<span class=
"Apple-tab-span"> </span>translateY
</p>
480 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
481 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> controlWindow, w;
</p>
482 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> r, a, b, c, d, matrix = [
1,
0,
0,
1,
10,
10];
</p>
483 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> sliders, spex, name;
</p>
484 <p class=
"p5"><span class=
"Apple-tab-span"> </span></p>
485 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
486 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.white);
</p>
487 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
488 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// create a controller-window
</p>
489 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>controlWindow =
<span class=
"s2">Window
</span>(
<span class=
"s8">"matrix controls"</span>,
<span class=
"s2">Rect
</span>(
400,
200,
350,
120));
</p>
490 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>controlWindow.front;
</p>
491 <p class=
"p5"><span class=
"Apple-tab-span"> </span></p>
492 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// determine the rectangle to be drawn
</p>
493 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>r =
<span class=
"s2">Rect
</span>.fromPoints(a =
0 @
0, c =
180 @
180);
</p>
494 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>b = r.leftBottom;
</p>
495 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>d = r.rightTop;
</p>
496 <p class=
"p5"><span class=
"Apple-tab-span"> </span></p>
497 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// the drawHook
</p>
498 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
499 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeColor =
<span class=
"s2">Color
</span>.red;
</p>
500 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.matrix = matrix;
</p>
501 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.width =
5;
</p>
502 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeRect(r);
</p>
503 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeOval(r);
</p>
504 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.color =
<span class=
"s2">Color
</span>.blue;
</p>
505 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.width =
0.1;
</p>
506 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.line(a, c);
</p>
507 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.line(b, d);
</p>
508 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.stroke;
</p>
509 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> </p>
510 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"s2">Pen
</span>.font =
<span class=
"s2">Font
</span>(
<span class=
"s8">"Helvetica-Bold"</span>,
12 );
</p>
511 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"s2">Pen
</span>.stringAtPoint(
<span class=
"s8">"A"</span>, a -
6 );
</p>
512 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"s2">Pen
</span>.stringAtPoint(
<span class=
"s8">"B"</span>, b -
6 );
</p>
513 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"s2">Pen
</span>.stringAtPoint(
<span class=
"s8">"C"</span>, c - (
0@
6) );
</p>
514 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"s2">Pen
</span>.stringAtPoint(
<span class=
"s8">"D"</span>, d - (
0@
6) );
</p>
515 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> </p>
516 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"s2">Pen
</span>.font =
<span class=
"s2">Font
</span>(
<span class=
"s8">"Helvetica"</span>,
10 );
</p>
517 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"s2">Pen
</span>.stringInRect(
<span class=
"s8">"a matrix test"</span>, r.moveBy(
50,
50 ));
</p>
518 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
519 <p class=
"p5"><span class=
"Apple-tab-span"> </span></p>
520 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>controlWindow.view.decorator = sliders =
<span class=
"s2">FlowLayout
</span>(controlWindow.view.bounds);
</p>
521 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>spex = [
</p>
522 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>[
0,
2.0].asSpec,
</p>
523 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>[
0,
2.0].asSpec,
</p>
524 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>[
0,
2.0].asSpec,
</p>
525 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>[
0,
2.0].asSpec,
</p>
526 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>[
0,
200.0].asSpec,
</p>
527 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>[
0,
200.0].asSpec
</p>
528 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>];
</p>
529 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>name = #[zoomX, shearingY, shearingX, zoomY, translateX, translateY];
</p>
530 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>6.do {
<span class=
"s2">|i|
</span></p>
531 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"s2">EZSlider
</span>(controlWindow,
300 @
14, name[i], spex[i], {
<span class=
"s2">|ez|
</span> <span class=
"s2">var
</span> val;
</p>
532 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> val = ez.value;
</p>
533 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> [i, val.round(
10e-4)].postln;
</p>
534 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> matrix.put(i, val);
</p>
535 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> </span>w.refresh; // reevaluate drawHook function
</p>
536 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"Apple-tab-span"> </span>}, matrix[i]);
</p>
537 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span> <span class=
"Apple-tab-span"> </span>sliders.nextLine;
</p>
538 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
539 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
540 <p class=
"p8"><span class=
"Apple-tab-span"> </span>)
</p>
541 <p class=
"p2"><br></p>
542 <p class=
"p2"><br></p>
543 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*width_(width=
1)
</b></p>
544 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>sets the width of the Pen for the whole stroke
</p>
545 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
546 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
547 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.white);
</p>
548 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
549 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color
</p>
550 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeColor =
<span class=
"s2">Color
</span>.blue(
0.5,
0.5);
</p>
551 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
200,
100);
</p>
552 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.width =
10;
</p>
553 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// you have to set a starting point...
</p>
554 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
0@
0);
</p>
555 <p class=
"p5"><br></p>
556 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
50@
100);
</p>
557 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
100@
100);
</p>
558 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
0@
150);
</p>
559 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(-
100@
100);
</p>
560 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(-
50@
100);
</p>
561 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
0@
0);
</p>
562 <p class=
"p5"><br></p>
563 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.stroke
</p>
564 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
565 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
566 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
567 <p class=
"p5"><br></p>
568 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*use (function)
</b></p>
569 <p class=
"p6"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Draw
<b>function
</b>, and then revert to the previous graphics state. This allows you to make complex transformations of the graphics state without having to explicitly revert to get back to 'normal'.
</p>
570 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
571 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// modified by an example of Stefan Wittwer
</p>
572 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
573 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.white);
</p>
574 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
575 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>//paint origin
</p>
576 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillColor =
<span class=
"s2">Color
</span>.gray(
0,
0.5);
</p>
577 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.addArc(
0@
0,
20,
0,
2pi);
</p>
578 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fill;
</p>
579 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.width =
10;
</p>
580 <p class=
"p5"><br></p>
581 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s2">Pen
</span><span class=
"s3">.use {
</span>// draw something complex...
</p>
582 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.width =
0.5;
</p>
583 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
100,
100);
</p>
584 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillColor =
<span class=
"s2">Color
</span>.blue;
</p>
585 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.addArc(
0@
0,
10,
0,
2pi);
</p>
586 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fill;
</p>
587 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>20.do{
</p>
588 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
0@
0);
</p>
589 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
100@
0);
</p>
590 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeColor =
<span class=
"s2">Color
</span>.red(
0.8, rrand(
0.7,
1));
</p>
591 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.stroke;
</p>
592 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.skew(
0,
0.1);
</p>
593 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
594 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
595 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
596 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// now go on with all params as before
</p>
597 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// translation, skewing, width, and color modifications do not apply
</p>
598 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.line(
10@
120,
300@
120);
</p>
599 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.stroke;
</p>
600 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
601 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh
</p>
602 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
603 <p class=
"p5"><br></p>
604 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*path(function)
</b></p>
605 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>make a path, consisting of the drawing made in
<b>function.
</b></p>
606 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>Unfortunately not working for now...
</b></p>
607 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(there's no Meta_SCPen-endPath which currently is used in this method)
</p>
608 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
609 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*beginPath
</b></p>
610 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Discard any previous path.
</p>
611 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
612 <p class=
"p9"><span class=
"s10"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span>// incomplete arrow
</p>
613 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
614 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
615 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.white);
</p>
616 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
617 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color
</p>
618 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeColor =
<span class=
"s2">Color
</span>.blue;
</p>
619 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
200,
100);
</p>
620 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
0@
0);
</p>
621 <p class=
"p5"><br></p>
622 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
50@
100);
</p>
623 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
100@
100);
</p>
624 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
625 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// forget what we just drew
</p>
626 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.beginPath;
</p>
627 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
100@
100);
</p>
628 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
0@
150);
</p>
629 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(-
100@
100);
</p>
630 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(-
50@
100);
</p>
631 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
0@
0);
</p>
632 <p class=
"p5"><br></p>
633 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.stroke
</p>
634 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
635 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
636 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
637 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
638 <p class=
"p3"><span class=
"s5"><span class=
"Apple-tab-span"> </span></span><b>*beginTransparencyLayer
</b></p>
639 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Begins a new transparency layer. Transparency layers are useful when you want to apply an effect to a group of objects or create a composite graphic.
</p>
640 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
641 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s6">(
</span></p>
642 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new(
<span class=
"s8">"Transparency Layer test"</span>,
<span class=
"s2">Rect
</span>(
400,
400,
430,
450)).front;
</p>
643 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
644 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
645 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Color
</span>.blue.setStroke;
</p>
646 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
647 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.use {
</p>
648 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.setShadow(
2@
2,
10,
<span class=
"s2">Color
</span>.black);
</p>
649 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.beginTransparencyLayer;
</p>
650 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
651 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Color
</span>.red.setFill;
</p>
652 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.addOval(
<span class=
"s2">Rect
</span>(
20,
40,
100,
100));
</p>
653 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fill;
</p>
654 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
655 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Color
</span>.green.setFill;
</p>
656 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.addOval(
<span class=
"s2">Rect
</span>(
30,
70,
100,
100));
</p>
657 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fill;
</p>
658 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
659 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Color
</span>.blue.setFill;
</p>
660 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.addOval(
<span class=
"s2">Rect
</span>(
60,
40,
100,
100));
</p>
661 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fill;
</p>
662 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
663 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s8">"With Transparency Layer"</span>.drawCenteredIn(
<span class=
"s2">Rect
</span>(
30,
40,
100,
100),
<span class=
"s2">Font
</span>.default,
<span class=
"s2">Color
</span>.white);
</p>
664 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.endTransparencyLayer;
</p>
665 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
666 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
667 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.use {
</p>
668 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
200,
0);
</p>
669 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.setShadow(
2@
2,
10,
<span class=
"s2">Color
</span>.black);
</p>
670 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
671 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
672 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Color
</span>.red.setFill;
</p>
673 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.addOval(
<span class=
"s2">Rect
</span>(
20,
40,
100,
100));
</p>
674 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fill;
</p>
675 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
676 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Color
</span>.green.setFill;
</p>
677 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.addOval(
<span class=
"s2">Rect
</span>(
30,
70,
100,
100));
</p>
678 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fill;
</p>
679 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
680 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Color
</span>.blue.setFill;
</p>
681 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.addOval(
<span class=
"s2">Rect
</span>(
60,
40,
100,
100));
</p>
682 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fill;
</p>
683 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
684 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s8">"Without Transparency Layer"</span>.drawCenteredIn(
<span class=
"s2">Rect
</span>(
30,
40,
100,
100),
<span class=
"s2">Font
</span>.default,
<span class=
"s2">Color
</span>.white);
</p>
685 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
686 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
687 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.use {
</p>
688 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
0,
200);
</p>
689 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.setShadow(
2@
2,
10,
<span class=
"s2">Color
</span>.black);
</p>
690 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.beginTransparencyLayer;
</p>
691 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
692 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.push;
</p>
693 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.addOval(
<span class=
"s2">Rect
</span>(
20,
40,
170,
170));
</p>
694 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillAxialGradient(w.view.bounds.leftTop, w.view.bounds.rightBottom,
<span class=
"s2">Color
</span>.rand,
<span class=
"s2">Color
</span>.rand);
</p>
695 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.pop;
</p>
696 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
697 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s8">"With Transparency Layer"</span>.drawCenteredIn(
<span class=
"s2">Rect
</span>(
20,
40,
170,
170),
<span class=
"s2">Font
</span>.default,
<span class=
"s2">Color
</span>.white);
</p>
698 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
699 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.endTransparencyLayer;
</p>
700 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
701 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
702 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.use {
</p>
703 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
200,
200);
</p>
704 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.setShadow(
2@
2,
10,
<span class=
"s2">Color
</span>.black);
</p>
705 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.addOval(
<span class=
"s2">Rect
</span>(
20,
40,
170,
170));
</p>
706 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillAxialGradient(w.view.bounds.leftTop, w.view.bounds.rightBottom,
<span class=
"s2">Color
</span>.rand,
<span class=
"s2">Color
</span>.rand);
</p>
707 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
708 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s8">"Without Transparency Layer"</span>.drawCenteredIn(
<span class=
"s2">Rect
</span>(
20,
40,
170,
170),
<span class=
"s2">Font
</span>.default,
<span class=
"s2">Color
</span>.white);
</p>
709 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
710 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
711 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
712 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
713 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
714 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
715 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>*endTransparencyLayer
</b></p>
716 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Ends the current transparency layer.
</p>
717 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
718 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*clip
</b></p>
719 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Use the previously defined path as a clipping path.
</p>
720 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
721 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
722 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.white);
</p>
723 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
724 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span> <span class=
"Apple-tab-span"> </span></span>// outline the clipping path
</p>
725 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
110@
110);
</p>
726 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
290@
110);
</p>
727 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
290@
240);
</p>
728 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
110@
240);
</p>
729 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
110@
110);
</p>
730 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// now clip
</p>
731 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.clip;
</p>
732 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
733 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// everything else we draw is now clipped
</p>
734 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillColor =
<span class=
"s2">Color
</span>.yellow;
</p>
735 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillRect(
<span class=
"s2">Rect
</span>(
0,
0,
400,
400));
</p>
736 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillColor =
<span class=
"s2">Color
</span>.red;
</p>
737 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
200@
100);
</p>
738 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
739 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
250@
200);
</p>
740 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
300@
200);
</p>
741 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
200@
250);
</p>
742 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
100@
200);
</p>
743 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
150@
200);
</p>
744 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
745 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fill;
</p>
746 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
747 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
748 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
749 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
750 <p class=
"p3"><span class=
"s6"><span class=
"Apple-tab-span"> </span></span><b>*smoothing_(flag)
</b></p>
751 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>turns on/off anti-aliasing.
</p>
752 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
753 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s6">(
</span></p>
754 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">var
</span> w =
<span class=
"s7">Window
</span>(
<span class=
"s8">"smoothing"</span>,
<span class=
"s7">Rect
</span>(
100,
200,
500,
300)).front;
</p>
755 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s7">Color
</span>.white);
</p>
756 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
<span class=
"s7">|v|
</span></p>
757 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Pen
</span>.strokeColor =
<span class=
"s7">Color
</span>.grey(
0.25);
</p>
758 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Pen
</span>.smoothing_(
<span class=
"s7">false
</span>);
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s11">//no anti-aliasing
</span></p>
759 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>50.do{
<span class=
"s7">|i|
</span></p>
760 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Pen
</span>.moveTo(
50@
50.rrand(
250));
</p>
761 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Pen
</span>.lineTo(
250@
50.rrand(
250));
</p>
762 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
763 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Pen
</span>.stroke;
</p>
764 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s7">Pen
</span><span class=
"s3">.smoothing_(
</span><span class=
"s7">true
</span><span class=
"s3">);
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>//anti-aliasing (default)
</p>
765 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>50.do{
<span class=
"s7">|i|
</span></p>
766 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Pen
</span>.moveTo(
250@
50.rrand(
250));
</p>
767 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Pen
</span>.lineTo(
450@
50.rrand(
250));
</p>
768 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
769 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s7">Pen
</span>.stroke;
</p>
770 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
771 <p class=
"p7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s3">)
</span></p>
772 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
773 <p class=
"p3"><span class=
"s6"><span class=
"Apple-tab-span"> </span></span><b>*setShadow(offsetPoint, blur, color)
</b></p>
774 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>will fill the current path with a shadow.
</p>
775 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>you should use this option between Pen.push / Pen.pop (or Pen.use)
</p>
776 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
777 <p class=
"p3"><span class=
"s5"><span class=
"Apple-tab-span"> </span></span><b>*joinStyle_(option)
</b></p>
778 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>set the lines joining style according to the defined options:
</p>
779 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0 = miter
</p>
780 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>1 = round
</p>
781 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>2 = bevel
</p>
782 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
783 <p class=
"p3"><span class=
"s5"><span class=
"Apple-tab-span"> </span></span><b>*capStyle_(option)
</b></p>
784 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>set the lines joining style according to the defined options:
</p>
785 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0 = butt
</p>
786 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>1 = round
</p>
787 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>2 = square
</p>
788 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
789 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
790 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
791 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s2">Color
</span>.white);
</p>
792 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">SCStaticText
</span>(w,
<span class=
"s2">Rect
</span>(
0,
0,
180,
20))
</p>
793 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.string_(
</span>" Change Line Cap & Join Styles: "<span class=
"s3">);
</span></p>
794 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>y =
<span class=
"s2">SCPopUpMenu
</span>(w,
<span class=
"s2">Rect
</span>(
180,
0,
130,
20))
</p>
795 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.items_([
</span>"Butt - Miter"<span class=
"s3">,
</span>"Round - Round"<span class=
"s3">,
</span>"Square - Bevel"<span class=
"s3">])
</span></p>
796 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.action_({w.refresh});
</p>
797 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
798 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color
</p>
799 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeColor =
<span class=
"s2">Color
</span>.red;
</p>
800 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.width_(
8.0);
</p>
801 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.capStyle_(y.value);
</p>
802 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.joinStyle_(y.value);
</p>
803 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
804 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
805 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
200@
100);
</p>
806 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
807 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
250@
200);
</p>
808 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
300@
200);
</p>
809 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
200@
250);
</p>
810 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
100@
200);
</p>
811 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
150@
200);
</p>
812 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
200@
100);
</p>
813 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
814 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
815 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.stroke;
</p>
816 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
817 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
818 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
819 <p class=
"p2"><br></p>
820 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>*alpha_(alphaValue)
</b></p>
821 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>set the opacity level.
</p>
822 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
823 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>*blendMode_(mode)
</b></p>
824 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>set the blending mode to use.
</p>
825 <p class=
"p15"><span class=
"s10"><span class=
"Apple-tab-span"> </span></span>/*
</p>
826 <p class=
"p15"><span class=
"Apple-tab-span"> </span>different blend modes:
</p>
827 <p class=
"p15"><span class=
"Apple-tab-span"> </span>OS X
10.4 and
> Only
</p>
828 <p class=
"p15"><span class=
"Apple-tab-span"> </span>--------------------
</p>
829 <p class=
"p15"><span class=
"Apple-tab-span"> </span>0 - Normal
</p>
830 <p class=
"p15"><span class=
"Apple-tab-span"> </span>1 - Multiply
</p>
831 <p class=
"p15"><span class=
"Apple-tab-span"> </span>2 - Screen
</p>
832 <p class=
"p15"><span class=
"Apple-tab-span"> </span>3 - Overlay
</p>
833 <p class=
"p15"><span class=
"Apple-tab-span"> </span>4 - Darken
</p>
834 <p class=
"p15"><span class=
"Apple-tab-span"> </span>5 - Lighten
</p>
835 <p class=
"p15"><span class=
"Apple-tab-span"> </span>6 - ColorDodge
</p>
836 <p class=
"p15"><span class=
"Apple-tab-span"> </span>7 - ColorBurn
</p>
837 <p class=
"p15"><span class=
"Apple-tab-span"> </span>8 - SoftLight
</p>
838 <p class=
"p15"><span class=
"Apple-tab-span"> </span>9 - HardLight
</p>
839 <p class=
"p15"><span class=
"Apple-tab-span"> </span>10 - Difference
</p>
840 <p class=
"p15"><span class=
"Apple-tab-span"> </span>11 - Exclusion
</p>
841 <p class=
"p15"><span class=
"Apple-tab-span"> </span>12 - Hue
</p>
842 <p class=
"p15"><span class=
"Apple-tab-span"> </span>13 - Saturation
</p>
843 <p class=
"p15"><span class=
"Apple-tab-span"> </span>14 - Color
</p>
844 <p class=
"p15"><span class=
"Apple-tab-span"> </span>15 - Luminosity
</p>
845 <p class=
"p16"><span class=
"Apple-tab-span"> </span></p>
846 <p class=
"p15"><span class=
"Apple-tab-span"> </span>OS
10.5 and
> Only
</p>
847 <p class=
"p15"><span class=
"Apple-tab-span"> </span>--------------------
</p>
848 <p class=
"p15"><span class=
"Apple-tab-span"> </span>16 - Clear
</p>
849 <p class=
"p15"><span class=
"Apple-tab-span"> </span>17 - Copy
</p>
850 <p class=
"p15"><span class=
"Apple-tab-span"> </span>18 - SourceIn
</p>
851 <p class=
"p15"><span class=
"Apple-tab-span"> </span>19 - SourceOut
</p>
852 <p class=
"p15"><span class=
"Apple-tab-span"> </span>20 - SourceATop
</p>
853 <p class=
"p15"><span class=
"Apple-tab-span"> </span>21 - DestinationOver
</p>
854 <p class=
"p15"><span class=
"Apple-tab-span"> </span>22 - DestinationIn
</p>
855 <p class=
"p15"><span class=
"Apple-tab-span"> </span>23 - DestinationATop
</p>
856 <p class=
"p15"><span class=
"Apple-tab-span"> </span>24 - XOR
</p>
857 <p class=
"p15"><span class=
"Apple-tab-span"> </span>25 - PlusDarker
</p>
858 <p class=
"p15"><span class=
"Apple-tab-span"> </span>26 - PlusLighter
</p>
859 <p class=
"p15"><span class=
"Apple-tab-span"> </span>*/
</p>
860 <p class=
"p17"><span class=
"Apple-tab-span"> </span></p>
861 <p class=
"p8"><span class=
"s12"><span class=
"Apple-tab-span"> </span></span>(
</p>
862 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> blendMode=
0, blendString=
<span class=
"s8">"Normal"</span>;
</p>
863 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>.new.front;
</p>
864 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>m =
<span class=
"s2">SCPopUpMenu
</span>(w,
<span class=
"s2">Rect
</span>(
10, w.view.bounds.height -
30,
150,
20));
</p>
865 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>m.items = [
</p>
866 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s13">"</span>0 - Normal"<span class=
"s3">,
</span></p>
867 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>"1 - Multiply"<span class=
"s3">,
</span></p>
868 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>"2 - Screen"<span class=
"s3">,
</span></p>
869 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>"3 - Overlay"<span class=
"s3">,
</span></p>
870 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>"4 - Darken"<span class=
"s3">,
</span></p>
871 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>"5 - Lighten"<span class=
"s3">,
</span></p>
872 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>"6 - ColorDodge"<span class=
"s3">,
</span></p>
873 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>"7 - ColorBurn"<span class=
"s3">,
</span></p>
874 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>"8 - SoftLight"<span class=
"s3">,
</span></p>
875 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>"9 - HardLight"<span class=
"s3">,
</span></p>
876 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>"10 - Difference"<span class=
"s3">,
</span></p>
877 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>"11 - Exclusion"<span class=
"s3">,
</span></p>
878 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>"12 - Hue"<span class=
"s3">,
</span></p>
879 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>"13 - Saturation"<span class=
"s3">,
</span></p>
880 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>"14 - Color"<span class=
"s3">,
</span></p>
881 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>"15 - Luminosity"</p>
882 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>];
</p>
883 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
884 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>m.action_({
<span class=
"s2">|view|
</span></p>
885 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>blendMode = view.value;
</p>
886 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>blendString = view.items.at(blendMode);
</p>
887 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
888 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>});
</p>
889 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
890 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>80.do{
<span class=
"s2">|i|
</span></p>
891 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.use {
</p>
892 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.blendMode_(blendMode);
</p>
893 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.color =
<span class=
"s2">Color
</span>.green(
0.6,
0.10);
</p>
894 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.addRect(
</p>
895 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Rect
</span>(
20,
20,
20 + (i*
4),
20 + (i*
4));
</p>
896 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
897 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fill;
</p>
898 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
899 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>}
</p>
900 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
901 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
902 <p class=
"p8"><span class=
"Apple-tab-span"> </span>)
</p>
903 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
904 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
905 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>*lineDash_(pattern)
</b></p>
906 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>set the line dash pattern.
</p>
907 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>pattern should be a
<span class=
"s2">FloatArray
</span> of values that specify the lengths of the
</p>
908 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>painted segments and not painted segments.
</p>
909 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s6">(
</span></p>
910 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> w;
</p>
911 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
</span><span class=
"s2">Window
</span><span class=
"s3">.new(
</span>"Radial Gradient + line dash + cubic bezier curve example"<span class=
"s3">,
</span><span class=
"s2">Rect
</span><span class=
"s3">(
640,
630,
300,
300)).front;
</span></p>
912 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>u =
<span class=
"s2">SCUserView
</span>.new(w, w.view.bounds).resize_(
5);
</p>
913 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
914 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>u.drawFunc = {
</p>
915 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
916 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillRadialGradient(
</p>
917 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>u.bounds.center,
</p>
918 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>u.bounds.center,
</p>
919 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>0, u.bounds.width.max(u.bounds.height),
</p>
920 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Color
</span>.new255(
105,
130,
150,
255),
</p>
921 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Color
</span>.new255(
57,
73,
88,
255)
</p>
922 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
923 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Color
</span>.white.alpha_(
0.2).setFill;
</p>
924 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Color
</span>.white.setStroke;
</p>
925 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineDash_(
<span class=
"s2">FloatArray
</span>[
3,
3]);
</p>
926 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(u.bounds.left@(u.bounds.top + (u.bounds.height*
0.5)));
</p>
927 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.curveTo(
</p>
928 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>u.bounds.right@(u.bounds.top + (u.bounds.height*
0.5)),
</p>
929 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(u.bounds.left +
40)@(u.bounds.top),
</p>
930 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(u.bounds.right -
40)@(u.bounds.bottom)
</p>
931 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
932 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillStroke;
</p>
933 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
934 <p class=
"p5"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
935 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
936 <p class=
"p2"><br></p>
937 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
938 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
939 <p class=
"p1"><b>Examples
</b></p>
940 <p class=
"p12"><br></p>
942 <p class=
"p9">// simple rotating and scaling
</p>
943 <p class=
"p8"><span class=
"Apple-tab-span"> </span>w =
<span class=
"s2">Window
</span>(
<span class=
"s8">"Pen Rotation and Scaling"</span>,
<span class=
"s2">Rect
</span>(
128,
64,
360,
360));
</p>
944 <p class=
"p8"><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
945 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.use {
</p>
946 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// use the same rect for everything, just scale and rotate
</p>
947 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> r =
<span class=
"s2">Rect
</span>(
0,
0,
200,
80);
</p>
948 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillColor =
<span class=
"s2">Color
</span>.black;
</p>
949 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// offset all subsequent co-ordinates
</p>
950 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
80,
20);
</p>
951 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillRect(r);
</p>
952 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillColor =
<span class=
"s2">Color
</span>.red;
</p>
953 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// scale all subsequent co-ordinates
</p>
954 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.scale(
0.8,
0.8);
</p>
955 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
8,
10);
</p>
956 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// rotate all subsequent co-ordinates
</p>
957 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.rotate(
0.1pi);
</p>
958 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillRect(r);
</p>
959 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeColor =
<span class=
"s2">Color
</span>.blue;
</p>
960 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// lather, rinse, repeat
</p>
961 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.scale(
0.8,
0.8);
</p>
962 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.rotate(
0.1pi);
</p>
963 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.width =
3;
</p>
964 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeRect(r);
</p>
965 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillColor =
<span class=
"s2">Color
</span>.yellow(
1,
0.5);
</p>
966 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.scale(
0.8,
0.8);
</p>
967 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.rotate(
0.1pi);
</p>
968 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
20,-
20);
</p>
969 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.fillOval(r);
</p>
970 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>}
</p>
971 <p class=
"p8"><span class=
"Apple-tab-span"> </span>};
</p>
972 <p class=
"p5"><br></p>
973 <p class=
"p8"><span class=
"Apple-tab-span"> </span>w.front;
</p>
975 <p class=
"p5"><br></p>
976 <p class=
"p9">// redraw at random interval
</p>
977 <p class=
"p9">// different every time
</p>
979 <p class=
"p8"><span class=
"s2">var
</span> w, run =
<span class=
"s2">true
</span>;
</p>
980 <p class=
"p8">w =
<span class=
"s2">Window
</span>(
<span class=
"s8">"my name is... panel"</span>,
<span class=
"s2">Rect
</span>(
128,
64,
800,
800));
</p>
981 <p class=
"p8">w.view.background =
<span class=
"s2">Color
</span>.white;
</p>
982 <p class=
"p8">w.onClose = { run =
<span class=
"s2">false
</span>; };
</p>
983 <p class=
"p8">w.front;
</p>
984 <p class=
"p8">w.drawHook = {
</p>
985 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.use {
</p>
986 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.width =
0.2;
</p>
987 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>400.do {
</p>
988 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.beginPath;
</p>
989 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
<span class=
"s2">Point
</span>(
10.rand *
80 +
40,
10.rand *
80 +
40));
</p>
990 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
<span class=
"s2">Point
</span>(
10.rand *
80 +
40,
10.rand *
80 +
40));
</p>
991 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.stroke;
</p>
992 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
993 <p class=
"p8"><span class=
"Apple-tab-span"> </span>};
</p>
995 <p class=
"p5"><br></p>
996 <p class=
"p8">{ while { run } { w.refresh;
1.0.rand.wait } }.fork(
<span class=
"s2">AppClock
</span>)
</p>
997 <p class=
"p5"><br></p>
999 <p class=
"p5"><br></p>
1001 <p class=
"p8"><span class=
"s2">var
</span> w, run =
<span class=
"s2">true
</span>;
</p>
1002 <p class=
"p8">w =
<span class=
"s2">Window
</span>(
<span class=
"s8">"my name is... panel"</span>,
<span class=
"s2">Rect
</span>(
128,
64,
800,
500));
</p>
1003 <p class=
"p8">w.view.background =
<span class=
"s2">Color
</span>.white;
</p>
1004 <p class=
"p8">w.onClose = { run =
<span class=
"s2">false
</span>; };
</p>
1005 <p class=
"p8">w.front;
</p>
1006 <p class=
"p8">w.drawHook = {
</p>
1007 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.use {
</p>
1008 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.width =
2;
</p>
1009 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>80.do {
</p>
1010 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.width = rrand(
0,
4) +
0.5;
</p>
1011 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.beginPath;
</p>
1012 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
<span class=
"s2">Point
</span>(
800.rand,
500.rand));
</p>
1013 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
<span class=
"s2">Point
</span>(
800.rand,
500.rand));
</p>
1014 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.stroke;
</p>
1015 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
1016 <p class=
"p8"><span class=
"Apple-tab-span"> </span>};
</p>
1017 <p class=
"p8">};
</p>
1018 <p class=
"p5"><br></p>
1019 <p class=
"p8">{ while { run } { w.refresh;
1.0.rand.wait } }.fork(
<span class=
"s2">AppClock
</span>)
</p>
1020 <p class=
"p5"><br></p>
1022 <p class=
"p5"><br></p>
1023 <p class=
"p9">// Animation
</p>
1024 <p class=
"p5"><br></p>
1025 <p class=
"p9">// Uses random seed to 'store' data
</p>
1026 <p class=
"p9">// By reseting the seed each time the same random values and shapes are generated for each 'frame'
</p>
1027 <p class=
"p9">// These can then be subjected to cumulative rotation, etc., by simply incrementing the phase var.
</p>
1029 <p class=
"p9">// By James McCartney
</p>
1030 <p class=
"p8"><span class=
"s2">var
</span> w, h =
700, v =
700, seed, run =
<span class=
"s2">true
</span>, phase =
0;
</p>
1031 <p class=
"p8">w =
<span class=
"s2">Window
</span>(
<span class=
"s8">"wedge"</span>,
<span class=
"s2">Rect
</span>(
40,
40, h, v),
<span class=
"s2">false
</span>);
</p>
1032 <p class=
"p8">w.view.background =
<span class=
"s2">Color
</span>.rand(
0,
0.3);
</p>
1033 <p class=
"p9"><span class=
"s3">w.onClose = { run =
</span><span class=
"s2">false
</span><span class=
"s3"> };
</span>// stop the thread on close
</p>
1034 <p class=
"p8">w.front;
</p>
1035 <p class=
"p9">// store an initial seed value for the random generator
</p>
1036 <p class=
"p8">seed =
<span class=
"s2">Date
</span>.seed;
</p>
1037 <p class=
"p8">w.drawHook = {
</p>
1038 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.width =
2;
</p>
1039 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.use {
</p>
1040 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// reset this thread's seed for a moment
</p>
1041 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">thisThread
</span>.randSeed =
<span class=
"s2">Date
</span>.seed;
</p>
1042 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// now a slight chance of a new seed or background color
</p>
1043 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>if (
0.006.coin) { seed =
<span class=
"s2">Date
</span>.seed; };
</p>
1044 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>if (
0.02.coin) { w.view.background =
<span class=
"s2">Color
</span>.rand(
0,
0.3); };
</p>
1045 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// either revert to the stored seed or set the new one
</p>
1046 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">thisThread
</span>.randSeed = seed;
</p>
1047 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// the random values below will be the same each time if the seed has not changed
</p>
1048 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// only the phase value has advanced
</p>
1049 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(h/
2, v/
2);
</p>
1050 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// rotate the whole image
</p>
1051 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// negative random values rotate one direction, positive the other
</p>
1052 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.rotate(phase *
1.0.rand2);
</p>
1053 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// scale the rotated y axis in a sine pattern
</p>
1054 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.scale(
1,
0.3 * sin(phase *
1.0.rand2 +
2pi.rand) +
0.5 );
</p>
1055 <p class=
"p9"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// create a random number of annular wedges
</p>
1056 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>rrand(
6,
24).do {
</p>
1057 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.color =
<span class=
"s2">Color
</span>.rand(
0.0,
1.0).alpha_(rrand(
0.1,
0.7));
</p>
1058 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.beginPath;
</p>
1059 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.addAnnularWedge(
<span class=
"s2">Point
</span>(
0,
0), a = rrand(
60,
300), a +
50.rand2,
2pi.rand
</p>
1060 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>+ (phase *
2.0.rand2),
2pi.rand);
</p>
1061 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>if (
0.5.coin) {
<span class=
"s2">Pen
</span>.stroke}{
<span class=
"s2">Pen
</span>.fill};
</p>
1062 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
1063 <p class=
"p8"><span class=
"Apple-tab-span"> </span>};
</p>
1064 <p class=
"p8">};
</p>
1065 <p class=
"p5"><br></p>
1066 <p class=
"p9">// fork a thread to update
20 times a second, and advance the phase each time
</p>
1067 <p class=
"p8">{ while { run } { w.refresh;
0.05.wait; phase = phase +
0.01pi;} }.fork(
<span class=
"s2">AppClock
</span>)
</p>
1068 <p class=
"p5"><br></p>
1070 <p class=
"p5"><br></p>
1072 <p class=
"p8"><span class=
"s2">var
</span> w, phase =
0, seed =
<span class=
"s2">Date
</span>.seed, run =
<span class=
"s2">true
</span>;
</p>
1073 <p class=
"p8">w =
<span class=
"s2">Window
</span>(
<span class=
"s8">"my name is... panel"</span>,
<span class=
"s2">Rect
</span>(
128,
64,
800,
800));
</p>
1074 <p class=
"p8">w.view.background =
<span class=
"s2">Color
</span>.blue(
0.4);
</p>
1075 <p class=
"p8">w.onClose = { run =
<span class=
"s2">false
</span>; };
</p>
1076 <p class=
"p8">w.front;
</p>
1077 <p class=
"p8">w.drawHook = {
</p>
1078 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.use {
</p>
1079 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>if (
0.02.coin) { seed =
<span class=
"s2">Date
</span>.seed; };
</p>
1080 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">thisThread
</span>.randSeed = seed;
</p>
1081 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeColor =
<span class=
"s2">Color
</span>.white;
</p>
1082 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>200.do {
</p>
1083 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> a =
4.rand;
</p>
1084 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> b =
24.rand;
</p>
1085 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> r1 =
230 + (
50 * a);
</p>
1086 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> a1 =
2pi /
24 * b + phase;
</p>
1087 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> r2 =
230 + (
50 * (a +
1.rand2).fold(
0,
3));
</p>
1088 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> a2 =
2pi /
24 * (b + (
3.rand2)).wrap(
0,
23) + phase;
</p>
1089 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.width =
0.2 +
1.0.linrand;
</p>
1090 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.beginPath;
</p>
1091 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
<span class=
"s2">Polar
</span>(r1, a1).asPoint +
<span class=
"s2">Point
</span>(
400,
400));
</p>
1092 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
<span class=
"s2">Polar
</span>(r2, a2).asPoint +
<span class=
"s2">Point
</span>(
400,
400));
</p>
1093 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.stroke;
</p>
1094 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
1095 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">thisThread
</span>.randSeed =
<span class=
"s2">Date
</span>.seed;
</p>
1096 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>40.do {
</p>
1097 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> a =
4.rand;
</p>
1098 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> b =
24.rand;
</p>
1099 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> r1 =
230 + (
50 * a);
</p>
1100 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> a1 =
2pi /
24 * b + phase;
</p>
1101 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> r2 =
230 + (
50 * (a +
1.rand2).fold(
0,
3));
</p>
1102 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> a2 =
2pi /
24 * (b + (
3.rand2)).wrap(
0,
23) + phase;
</p>
1103 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.width =
0.2 +
1.5.linrand;
</p>
1104 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.beginPath;
</p>
1105 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(
<span class=
"s2">Polar
</span>(r1, a1).asPoint +
<span class=
"s2">Point
</span>(
400,
400));
</p>
1106 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(
<span class=
"s2">Polar
</span>(r2, a2).asPoint +
<span class=
"s2">Point
</span>(
400,
400));
</p>
1107 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.stroke;
</p>
1108 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
1109 <p class=
"p8"><span class=
"Apple-tab-span"> </span>};
</p>
1110 <p class=
"p8">};
</p>
1111 <p class=
"p5"><br></p>
1112 <p class=
"p8">{ while { run } { w.refresh;
0.1.wait; phase = phase + (
2pi/(
20*
24)) } }.fork(
<span class=
"s2">AppClock
</span>)
</p>
1113 <p class=
"p5"><br></p>
1115 <p class=
"p5"><br></p>
1116 <p class=
"p5"><br></p>
1118 <p class=
"p8"><span class=
"s2">var
</span> w, h =
800, v =
600, seed =
<span class=
"s2">Date
</span>.seed, phase =
0, zoom =
0.7, zoomf =
1, run =
<span class=
"s2">true
</span>;
</p>
1119 <p class=
"p8">w =
<span class=
"s2">Window
</span>(
<span class=
"s8">"affines"</span>,
<span class=
"s2">Rect
</span>(
40,
40, h, v));
</p>
1120 <p class=
"p8">w.view.background =
<span class=
"s2">Color
</span>.blue(
0.4);
</p>
1121 <p class=
"p8">w.onClose = { run =
<span class=
"s2">false
</span> };
</p>
1122 <p class=
"p8">w.front;
</p>
1123 <p class=
"p8">w.drawHook = {
</p>
1124 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"s2">thisThread
</span>.randSeed =
<span class=
"s2">Date
</span>.seed;
</p>
1125 <p class=
"p8"><span class=
"Apple-tab-span"> </span>if (
0.0125.coin) { seed =
<span class=
"s2">Date
</span>.seed; phase =
0; zoom =
0.7; zoomf = exprand(
1/
1.01,
1.01); }
</p>
1126 <p class=
"p8"><span class=
"Apple-tab-span"> </span>{ phase = phase + (
2pi/
80); zoom = zoom * zoomf; };
</p>
1127 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"s2">thisThread
</span>.randSeed = seed;
</p>
1128 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.use {
</p>
1129 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> p1 =
<span class=
"s2">Point
</span>(
20.rand2 + (h/
2),
20.rand2 + (v/
2));
</p>
1130 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> p2 =
<span class=
"s2">Point
</span>(
20.rand2 + (h/
2),
20.rand2 + (v/
2));
</p>
1131 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> xscales = { exprand(
2** -
0.1,
2**
0.1) } !
2;
</p>
1132 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> yscales = { exprand(
2** -
0.1,
2**
0.1) } !
2;
</p>
1133 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> xlates = {
8.rand2 } !
2;
</p>
1134 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> ylates = {
8.rand2 } !
2;
</p>
1135 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> rots = {
2pi.rand + phase } !
2;
</p>
1136 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> xform;
</p>
1137 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>xscales = (xscales ++ (
1/xscales)) *
1;
</p>
1138 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>yscales = (yscales ++ (
1/yscales)) *
1;
</p>
1139 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>xlates = xlates ++ xlates.neg;
</p>
1140 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>ylates = ylates ++ xlates.neg;
</p>
1141 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>rots = rots ++ rots.neg;
</p>
1142 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>xform = {
<span class=
"s2">|i|
</span> [xlates[i], ylates[i], rots[i], xscales[i], yscales[i]] } !
4;
</p>
1143 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.strokeColor =
<span class=
"s2">Color
</span>.grey(
1,
0.5);
</p>
1144 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.width =
8.linrand +
1;
</p>
1145 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(
400,
400);
</p>
1146 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.scale(zoom, zoom);
</p>
1147 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(-
400, -
400);
</p>
1148 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>1200.do {
</p>
1149 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">var
</span> p, rot, xlate, ylate, xscale, yscale;
</p>
1150 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.width =
8.linrand +
1;
</p>
1151 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.beginPath;
</p>
1152 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>#rot, xlate, ylate, xscale, yscale = xform.choose;
</p>
1153 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.translate(xlate, ylate);
</p>
1154 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.rotate(rot, h/
2, v/
2);
</p>
1155 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.scale(xscale, yscale);
</p>
1156 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.moveTo(p1);
</p>
1157 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.lineTo(p2);
</p>
1158 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s2">Pen
</span>.stroke;
</p>
1159 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
1160 <p class=
"p8"><span class=
"Apple-tab-span"> </span>};
</p>
1161 <p class=
"p8">};
</p>
1162 <p class=
"p5"><br></p>
1163 <p class=
"p8">{ while { run } { w.refresh;
0.05.wait; } }.fork(
<span class=
"s2">AppClock
</span>)
</p>
1164 <p class=
"p5"><br></p>
1166 <p class=
"p2"><br></p>