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.43">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 18.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: #0026ed}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica
; min-height: 22.0px}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica
; min-height: 17.0px}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica
}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 12.0px Helvetica
; min-height: 14.0px}
19 p
.p10
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 10.0px Monaco
; color: #ba1100}
20 p
.p11
{margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco
}
21 p
.p12
{margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco
; min-height: 14.0px}
22 p
.p13
{margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco
; color: #ba1100}
23 p
.p14
{margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco
; color: #606060}
24 p
.p15
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 10.0px Monaco
}
25 p
.p16
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 10.0px Monaco
; min-height: 14.0px}
26 p
.p17
{margin: 0.0px 0.0px 0.0px 57.0px; text-indent: -57.0px; font: 10.0px Monaco
; color: #606060}
27 p
.p18
{margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco
; color: #001fbe}
28 p
.p19
{margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica
}
29 p
.p20
{margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica
; min-height: 16.0px}
30 p
.p21
{margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco
; color: #1d700f}
31 span
.s1
{color: #001fbe}
32 span
.s2
{text-decoration: underline
; color: #0026ed}
33 span
.s3
{color: #000000}
34 span
.s4
{text-decoration: underline
}
35 span
.s5
{color: #001a36}
36 span
.s6
{color: #004793}
37 span
.s7
{font: 12.0px Helvetica
; color: #000000}
38 span
.s8
{font: 10.0px Monaco
}
39 span
.s9
{font: 12.0px Helvetica
; color: #001a36}
40 span
.s10
{font: 12.0px Helvetica
}
41 span
.s11
{color: #606060}
42 span
.s12
{color: #0066d0}
43 span
.s13
{color: #1d700f}
44 span
.s14
{font: 14.0px Helvetica
}
45 span
.s15
{color: #ba1100}
46 span
.s16
{color: #0054fa}
47 span
.s17
{color: #973300}
48 span
.s18
{color: #151608}
49 span
.s19
{color: #006fec}
50 span
.Apple-tab-span
{white-space:pre
}
54 <p class=
"p1"><b>SCImage
</b></p>
55 <p class=
"p2"><br></p>
56 <p class=
"p3">SCImage is an image component for the Mac OS X supercollider client. SCImage is currently a wrapper around different models : you can use it for bitmap operations, image embedding for custom UI and for more advanced image processing as applying filters and kernels, both provided with the CoreImage framework.
</p>
57 <p class=
"p2"><br></p>
58 <p class=
"p3">SCImage currently supports most formats including tiff, bmp, gif, jpeg, png, tga...ect.. for reading. But for for writing it supports only those in
<span class=
"s1">SCImage
</span>.formats.
</p>
59 <p class=
"p2"><br></p>
60 <p class=
"p3"><span class=
"s2"><a href=
"../../GUI-Tools/GUI.html">GUI
</a></span> Issue : since it is OS X only, be sure to call GUI.cocoa before any SCImage.call
</p>
61 <p class=
"p2"><br></p>
62 <p class=
"p4"><span class=
"s3">See also:
<a href=
"SCImageFilter.html"><span class=
"s4">SCImageFilter
</span></a> <a href=
"SCImageKernel.html"><span class=
"s4">SCImageKernel
</span></a></span></p>
63 <p class=
"p5"><br></p>
64 <p class=
"p6"><b>Class Methods
</b></p>
65 <p class=
"p7"><br></p>
66 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*new(multiple)
</b></p>
67 <p class=
"p9"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
68 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Creates a new SCImage instance. multiple stands here for multiple arguments.
</p>
69 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>multiple
</b>-
<span class=
"s5">May
</span> be a
</p>
70 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
71 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><a href=
"../../../Math/Number.html"><span class=
"s6">Number
</span></a> to create an
<b>empty
</b> image of size multiple as width and height
</p>
72 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
73 <p class=
"p10"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s3">i =
</span><span class=
"s1">SCImage
</span><span class=
"s3">.new(
400);
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// Create a
400x400 pixels SCimage.
</p>
74 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.dump;
</p>
75 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.free;
</p>
76 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
77 <p class=
"p10"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s3">i =
</span><span class=
"s1">SCImage
</span><span class=
"s3">.new(
400,
200);
<span class=
"Apple-tab-span"> </span></span>// Create a
400x200 pixels SCimage.
</p>
78 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.dump;
</p>
79 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.free;
</p>
80 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
81 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><a href=
"../../../Geometry/Point.html"><span class=
"s5">Point
</span></a> to create an
<b>empty
</b> image of size multiple.x as width and multiple.y as height
</p>
82 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
83 <p class=
"p10"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s3">i =
</span><span class=
"s1">SCImage
</span><span class=
"s3">.new(
400@
200);
<span class=
"Apple-tab-span"> </span></span>// Create a
400x200 pixels SCimage.
</p>
84 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.dump;
</p>
85 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.free;
</p>
86 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
87 <p class=
"p3"><span class=
"s8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><a href=
"../../../Collections/String.html"><span class=
"s9">String
</span></a></span> to create an image from a
<b>local file
</b>or from an
<span class=
"s5"><b>URL
</b></span> (http://, ftp://, file:///)
</p>
88 <p class=
"p2"><br></p>
89 <p class=
"p13"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>//
<span class=
"Apple-tab-span"> </span>Path string
</p>
90 <p class=
"p14"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s3">i =
</span><span class=
"s1">SCImage
</span><span class=
"s3">.new(
</span>"/Library/Desktop Pictures/Ripples Blue.jpg"<span class=
"s3">);
</span></p>
91 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>[i.width, i.height].postln;
</p>
92 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.plot;
</p>
93 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.free;
</p>
94 <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=
"Apple-tab-span"> </span>URL string - http:// or ftp:// - blocks until image is downloaded
</p>
95 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i =
</span><span class=
"s1">SCImage
</span><span class=
"s3">.new(
</span>"http://www.google.com/intl/en_ALL/images/logo.gif"<span class=
"s3">);
</span></p>
96 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.plot;
</p>
97 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.url;
</p>
98 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.free;
</p>
99 <p class=
"p12"><br></p>
100 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*color(multiple, color)
</b></p>
101 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Creates a new SCImage instance filled with the specified color.
<b>multiple
</b> stands here for multiple arguments. the last argument should be a valid
<a href=
"../../GUI-Tools/Color.html"><span class=
"s5">Color
</span></a></p>
102 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
103 <p class=
"p15"><span class=
"s10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>i =
<span class=
"s1">SCImage
</span>.color(
400,
200,
<span class=
"s1">Color
</span>.blue(
0.9,
0.1));
</p>
104 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.plot(freeOnClose:
<span class=
"s1">true
</span>);
</p>
105 <p class=
"p16"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
106 <p class=
"p8"><span class=
"s8"><span class=
"Apple-tab-span"> </span></span><b>*open(path)
</b></p>
107 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Creates a new SCImage instance from the local file at
<b>path
</b>.
</p>
108 <p class=
"p16"><br></p>
109 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
110 <p class=
"p17"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i =
</span><span class=
"s1">SCImage
</span><span class=
"s3">.open(
</span>"/Library/Desktop Pictures/Ripples Blue.jpg"<span class=
"s3">);
</span></p>
111 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.plot(freeOnClose:
<span class=
"s1">true
</span>);
</p>
112 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.url.postln;
</p>
113 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
114 <p class=
"p16"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
115 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span>*openURL(path)
</b></p>
116 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Creates a new SCImage instance from a valid image at the specified
<b> </b>URL
<b>path
</b></p>
117 <p class=
"p9"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
118 <p class=
"p17"><span class=
"s7"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></span><span class=
"s3">i =
</span><span class=
"s1">SCImage
</span><span class=
"s3">.openURL(
</span>"file:///Library/Desktop%20Pictures/Ripples%20Blue.jpg"<span class=
"s3">);
</span></p>
119 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.url;
</p>
120 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w = i.plot(freeOnClose:
<span class=
"s1">true
</span>);
</p>
121 <p class=
"p12"><br></p>
122 <p class=
"p8"><span class=
"Apple-tab-span"> </span><b>*fromImage(image)
</b></p>
123 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>Creates a new SCImage instance from another SCImage.
</p>
124 <p class=
"p9"><br></p>
125 <p class=
"p15"><span class=
"s10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>i =
<span class=
"s1">SCImage
</span>.new(
<span class=
"s1">Document
</span>.current.dir +/+
<span class=
"s11">"vduck2.jpg"</span>);
</p>
126 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>j =
<span class=
"s1">SCImage
</span>.fromImage(i);
</p>
127 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.dump;
</p>
128 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>j.dump;
</p>
129 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>[i, j].do(
<span class=
"s1">_
</span>.plot);
</p>
130 <p class=
"p15"><span class=
"s10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>[i, j].do(
<span class=
"s1">_
</span>.free);
</p>
131 <p class=
"p16"><span class=
"Apple-tab-span"> </span></p>
132 <p class=
"p8"><span class=
"s8"><span class=
"Apple-tab-span"> </span></span><b>*fromWindow(window, rect)
</b></p>
133 <p class=
"p8"><b><span class=
"Apple-tab-span"> </span></b><span class=
"s8"><span class=
"Apple-tab-span"> </span></span>Creates a new SCImage from a portion of a
<a href=
"../SCWindow.html"><span class=
"s12">SCWindow
</span></a> . this can be used to capture either a window
</p>
134 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>or a specific SCView.
</p>
135 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>window
</b> - the SCWindow object.
</p>
136 <p class=
"p8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>rect
</b> - optional. the constrained rect to capture inside the SCWindow. By default, it is the window size.
</p>
137 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
138 <p class=
"p10"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// WINDOW Example:
</p>
139 <p class=
"p10"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// First create a window and draw inside of it
</p>
140 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
141 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s1">SCWindow
</span>.new;
</p>
142 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.front;
</span>// comment this to copy offscreen window
</p>
143 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s1">Color
</span>.white);
</p>
144 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook = {
</p>
145 <p class=
"p11"><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=
"s1">SCPen
</span>.translate(
100,
100);
</p>
146 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>10.do{
</p>
147 <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 class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color
</p>
148 <p class=
"p11"><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=
"s1">SCPen
</span>.color =
<span class=
"s1">Color
</span>.blue(rrand(
0.0,
1), rrand(
0.0,
0.5));
</p>
149 <p class=
"p11"><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=
"s1">SCPen
</span>.addWedge((
100.rand)@(
100.rand), rrand(
10,
100),
2pi.rand,
2pi.rand);
</p>
150 <p class=
"p11"><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=
"s1">SCPen
</span>.perform([
<span class=
"s13">\stroke
</span>,
<span class=
"s13">\fill
</span>].choose);
</p>
151 <p class=
"p11"><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>
152 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>};
</p>
153 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
154 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
155 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
156 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// then grab the window
</p>
157 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
158 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i =
<span class=
"s1">SCImage
</span>.fromWindow(w);
</p>
159 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.close;
</p>
160 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.plot(freeOnClose:
<span class=
"s1">true
</span>);
</p>
161 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
162 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
163 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// VIEW Capture Example:
</p>
164 <p class=
"p10"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// First create a window and add some views inside of it
</p>
165 <p class=
"p15"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
166 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s1">SCWindow
</span>.new.front;
</p>
167 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>b = [
10,
80].asSpec;
</p>
168 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>c =
<span class=
"s1">SCNumberBox
</span>(w,
<span class=
"s1">Rect
</span>(
20,
20,
60,
40));
</p>
169 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a =
<span class=
"s1">SCSlider
</span>(w,
<span class=
"s1">Rect
</span>(
20,
80,
100,
40))
</p>
170 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.focusColor_(
<span class=
"s1">Color
</span>.red(alpha:
0.2))
</p>
171 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.action_({
</p>
172 <p class=
"p11"><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>c.value_(b.map(a.value).round(
0.01))
</p>
173 <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>// round the float so it will fit in the SCNumberBox
</p>
174 <p class=
"p11"><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>});
</p>
175 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
176 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
177 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// then grab the window
</p>
178 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
179 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i =
<span class=
"s1">SCImage
</span>.fromWindow(w, a.bounds);
</p>
180 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.close;
</p>
181 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.plot(freeOnClose:
<span class=
"s1">true
</span>);
</p>
182 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
183 <p class=
"p16"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
184 <p class=
"p12"><br></p>
185 <p class=
"p6"><b>Class variables and attributes
</b></p>
186 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
187 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>*formats
</b></p>
188 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>returns all the valid image formats as an
<a href=
"../../../Collections/Array.html"><span class=
"s5">Array
</span></a></p>
189 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
190 <p class=
"p11"><span class=
"s10"><span class=
"Apple-tab-span"> </span></span><span class=
"s1">SCImage
</span>.formats;
</p>
191 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
192 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>*compositingOperations
</b></p>
193 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>returns all the valid compositing operations you can use when drawing an
<span class=
"s5">SCImage
</span> as an
<a href=
"../../../Collections/Array.html"><span class=
"s5">Array
</span></a></p>
194 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
195 <p class=
"p11"><span class=
"s10"><span class=
"Apple-tab-span"> </span></span><span class=
"s1">SCImage
</span>.compositingOperations;
</p>
196 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
197 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>*interpolations
</b></p>
198 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>returns an
<a href=
"../../../Collections/Array.html"><span class=
"s5">Array
</span></a> of the different levels of interpolation you can specify when drawing an
<span class=
"s5">SCImage
</span>.
</p>
199 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
200 <p class=
"p11"><span class=
"s10"><span class=
"Apple-tab-span"> </span></span><span class=
"s1">SCImage
</span>.interpolations;
</p>
201 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
202 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>*closeAllPlotWindows
</b></p>
203 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>close all the
<span class=
"s5">SCImage
</span> plot windows currently opened.
</p>
204 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
205 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
206 <p class=
"p6"><b>Instance Methods
</b></p>
207 <p class=
"p7"><br></p>
208 <p class=
"p6"><b>commons / general attributes
</b></p>
209 <p class=
"p7"><br></p>
210 <p class=
"p3"><span class=
"s14"><b><span class=
"Apple-tab-span"> </span></b></span><b>width
</b></p>
211 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>returns the width of the receiver
</p>
212 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
213 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>width_
</b></p>
214 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>set the width of the receiver
</p>
215 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
216 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>height
</b></p>
217 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>returns the height of the receiver
</p>
218 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
219 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>height_
</b></p>
220 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>set the height of the receiver
</p>
221 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
222 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>setSize ( width, height )
</b></p>
223 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>set the size of the receiver
</p>
224 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
225 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>bounds
</b></p>
226 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>returns the bounds of the receiver.
</p>
227 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
228 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>free
</b></p>
229 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>deallocate the receiver. this method is useful if you want to manage and reclaim yourself resources.
</p>
230 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>otherwise you do not need to call this method since each object is automatically garbage collected.
</p>
231 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
232 <p class=
"p14"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s3">i =
</span><span class=
"s1">SCImage
</span><span class=
"s3">.new(
</span>"/Library/Desktop Pictures/Ripples Blue.jpg"<span class=
"s3">);
</span></p>
233 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s1">SCImage
</span>.all;
</p>
234 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.free;
</p>
235 <p class=
"p18"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>SCImage
<span class=
"s3">.all;
</span></p>
236 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
237 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
238 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>scalesWhenResized
</b></p>
239 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>flag to tell if the receiver should update its bitmap representation to scale when a resize operation if performed
</p>
240 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
241 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>scalesWhenResized_
</b></p>
242 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>set the flag to tell if the receiver should update its bitmap representation to scale when a resize operation if performed
</p>
243 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
244 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s8">(
</span></p>
245 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i =
</span><span class=
"s1">SCImage
</span><span class=
"s3">.new(
</span>"/Library/Desktop Pictures/Ripples Blue.jpg"<span class=
"s3">);
</span></p>
246 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.bounds.postln;
</span>// getting the dimensions
</p>
247 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =i.plot;
</p>
248 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
249 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
250 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// changing the size of an image
</p>
251 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
252 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.scalesWhenResized_(
<span class=
"s1">true
</span>);
</p>
253 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.setSize(
400,
400 / (i.width / i.height));
</p>
254 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a =i.plot;
</p>
255 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
256 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
257 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a.close; w.close; i.free;
</p>
258 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
259 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
260 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>url
</b></p>
261 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>returns the url of the receiver, if any where supplied at creation, otherwise returns
<span class=
"s5">nil
</span>.
</p>
262 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
263 <p class=
"p14"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s3">i =
</span><span class=
"s1">SCImage
</span><span class=
"s3">.new(
</span>"http://www.google.com/intl/en_ALL/images/logo.gif"<span class=
"s3">);
</span></p>
264 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.url;
</p>
265 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.plot;
</p>
266 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.free;
</p>
267 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
268 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>url_(anURL)
</b></p>
269 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>sets the url of the receiver.
<span class=
"s5">May
</span> be used for different purpose but try to supply a valid one since it is used for archiving the image as an object.
</p>
270 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
271 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>accelerated
</b></p>
272 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>if true, the receiver currently use the CoreImage model, possibly caching its data on GPU, if not the bitmap model.
</p>
273 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
274 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>accelerated_(aBool)
</b></p>
275 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>set whether the receiver should use a CoreImage representation or a bitmap representation.
</p>
276 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>this method should never be used directly unless you know perfectly what you are doing. Since the SCImage will switch internally and manage itself
</p>
277 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>the syncronization between representations.
</p>
278 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
279 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>interpolation
</b></p>
280 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>get the level of interpolation used when rendering the image - it has not effect when the
<span class=
"s5">SCImage
</span> is accelerated. see
<b>*interpolations
</b> for a valid range of values.
</p>
281 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
282 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>interpolation_(interpolation)
</b></p>
283 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>set the level of interpolation to use when rendering the image - it has not effect when the
<span class=
"s5">SCImage
</span> is accelerated. see
<b>*interpolations
</b> for a valid range of values.
</p>
284 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
285 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
286 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i =
<span class=
"s1">SCImage
</span>.new(
<span class=
"s1">Document
</span>.current.dir +/+
<span class=
"s11">"vduck2.jpg"</span>);
</p>
287 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w = i.plot;
</p>
288 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.interpolation;
<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>// get the image currrent interpolation mode
</p>
289 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
290 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
291 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
292 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.interpolation =
</span><span class=
"s13">'none'
</span><span class=
"s3">;
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// experiment with interpolation modes
</p>
293 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
294 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
295 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
296 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
297 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.interpolation =
<span class=
"s13">'low'
</span>;
</p>
298 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
299 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
300 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
301 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
302 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.interpolation =
1;
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s15">// same as 'low'
</span></p>
303 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
304 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
305 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
306 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
307 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.interpolation =
<span class=
"s13">'high'
</span>; w.refresh;
</p>
308 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
309 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
310 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
311 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.interpolation =
<span class=
"s13">'default'
</span>;
</p>
312 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
313 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
314 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
315 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
316 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.accelerated_(
<span class=
"s1">true
</span>);
</p>
317 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.interpolation =
</span><span class=
"s13">'none'
</span><span class=
"s3">;
</span>// does not work on coreimage accelerated image
</p>
318 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
319 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
320 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
321 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.free;
</p>
322 <p class=
"p12"><br></p>
323 <p class=
"p6"><b>saving and archiving
</b></p>
324 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
325 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>write( path, format )
</b></p>
326 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>write the SCImage to a file.
</p>
327 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>path
</b> - the location where to save it
</p>
328 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>format
</b> - (optional) format to use. see SCImage.formats for supported formats. If nil, it will
</p>
329 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>get the format depending on the path extension.
</p>
330 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
331 <p class=
"p14"><span class=
"s7"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span><span class=
"s3">i =
</span><span class=
"s1">SCImage
</span><span class=
"s3">.new(
</span>"/Library/Desktop Pictures/Ripples Blue.jpg"<span class=
"s3">);
</span></p>
332 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.dump
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
333 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.write(
</span>"~/Desktop/my_image.png"<span class=
"s3">);
</span></p>
334 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.free;
</p>
335 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
336 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>//
<span class=
"Apple-tab-span"> </span>storeOn / asCompileString
</p>
337 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i =
</span><span class=
"s1">SCImage
</span><span class=
"s3">.new(
</span>"/Library/Desktop Pictures/Ripples Blue.jpg"<span class=
"s3">);
</span></p>
338 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.url;
</p>
339 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.asCompileString;
</p>
340 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.writeArchive(
<span class=
"s11">"~/Desktop/my_image.scd"</span>.standardizePath);
</p>
341 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
342 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.free;
</p>
343 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i =
<span class=
"s1">nil
</span>;
</p>
344 <p class=
"p12"><br></p>
345 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s1">Document
</span>.open(
<span class=
"s11">"~/Desktop/my_image.scd"</span>.standardizePath);
</p>
346 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
347 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i =
<span class=
"s1">Object
</span>.readArchive(
<span class=
"s11">"~/Desktop/my_image.scd"</span>.standardizePath);
</p>
348 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.plot;
</p>
349 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.free;
</p>
350 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
351 <p class=
"p6"><b>rendering
</b></p>
352 <p class=
"p2"><br></p>
353 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>plot ( name, bounds, freeOnClose, background, showInfo )
</b></p>
354 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>plots the image in a
<a href=
"../SCWindow.html"><span class=
"s5">SCWindow
</span></a>.
</p>
355 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>name
</b> - the title of the SCWindow. may be nil.
</p>
356 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>bounds
</b> - the bounds of the SCWindow. may be nil.
</p>
357 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>freeOnClose
</b> - flag to tell if the SCWindow should free the SCImage when closed. false by default.
</p>
358 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>background
</b> - additional background to apply to the SCWindow. may be useful for artifacts due to alpha / compositing...
</p>
359 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>showInfo
</b> - shows pixel coordinates while the mouse is over the image's plot window. (default is
<b>true
</b>)
</p>
360 <p class=
"p2"><br></p>
361 <p class=
"p14"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span><span class=
"s3">i =
</span><span class=
"s1">SCImage
</span><span class=
"s3">.new(
</span>"/Library/Desktop Pictures/Ripples Blue.jpg"<span class=
"s3">);
</span></p>
362 <p class=
"p11"><span class=
"Apple-tab-span"> </span>w = i.plot;
</p>
363 <p class=
"p11"><span class=
"Apple-tab-span"> </span>w.close;
</p>
364 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
365 <p class=
"p11"><span class=
"Apple-tab-span"> </span>w = i.plot(showInfo:
<span class=
"s1">false
</span>);
</p>
366 <p class=
"p11"><span class=
"Apple-tab-span"> </span>w.close;
</p>
367 <p class=
"p11"><span class=
"Apple-tab-span"> </span>i.free;
</p>
368 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
369 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// other option - image will be automatically freed when closed
</p>
370 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span><span class=
"s1">SCImage
</span><span class=
"s3">.new(
</span>"/Library/Desktop Pictures/Ripples Blue.jpg"<span class=
"s3">).plot(
</span>"Hello"<span class=
"s3">, freeOnClose:
</span><span class=
"s1">true
</span><span class=
"s3">);
</span></p>
371 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
372 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>lockFocus
</b></p>
373 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>sets the receiver as the current graphic context.
<span class=
"s5">So
</span> you can use
<a href=
"../SCPen.html"><span class=
"s16">SCPen
</span></a> to draw inside of it.
</p>
374 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
375 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>unlockFocus
</b></p>
376 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>restore the graphic context state. the receiver is not anymore the current graphic context.
</p>
377 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
378 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
379 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b><span class=
"s8">(
</span></p>
380 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>j =
<span class=
"s1">SCImage
</span>.new(
400,
300);
</p>
381 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
382 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>j.lockFocus;
</p>
383 <p class=
"p12"><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>
384 <p class=
"p11"><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=
"s1">SCPen
</span>.translate(
100,
100);
</p>
385 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>1000.do{
</p>
386 <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 class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color
</p>
387 <p class=
"p11"><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=
"s1">SCPen
</span>.color =
<span class=
"s1">Color
</span>.green(rrand(
0.0,
1), rrand(
0.0,
0.5));
</p>
388 <p class=
"p11"><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=
"s1">SCPen
</span>.addAnnularWedge(
</p>
389 <p class=
"p11"><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=
"Apple-tab-span"> </span>(
100.rand)@(
100.rand),
</p>
390 <p class=
"p11"><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=
"Apple-tab-span"> </span>rrand(
10,
50),
</p>
391 <p class=
"p11"><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=
"Apple-tab-span"> </span>rrand(
51,
100),
<span class=
"Apple-tab-span"> </span></p>
392 <p class=
"p11"><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=
"Apple-tab-span"> </span>2pi.rand,
</p>
393 <p class=
"p11"><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=
"Apple-tab-span"> </span>2pi.rand
</p>
394 <p class=
"p11"><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>);
</p>
395 <p class=
"p11"><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=
"s1">SCPen
</span>.perform([
<span class=
"s13">\stroke
</span>,
<span class=
"s13">\fill
</span>].choose);
</p>
396 <p class=
"p11"><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>
397 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
398 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>j.unlockFocus;
</p>
399 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
400 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
401 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>j.plot;
</p>
402 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>j.write(
</span>"~/Desktop/my_drawing.png"<span class=
"s3">);
</span><span class=
"s15">// write the image
</span></p>
403 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>j.free;
</p>
404 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
405 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>draw ( aFunction )
</b></p>
406 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>shortcut for drawing inside an image. equivalent to :
</p>
407 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>receiver.lockFocus
</p>
408 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>aFunction
</p>
409 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>receiver.unlockFocus
</p>
410 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
411 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s8">(
</span></p>
412 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>j =
<span class=
"s1">SCImage
</span>.new(
400,
300);
</p>
413 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>j.draw({
<span class=
"s1">arg
</span> image;
</p>
414 <p class=
"p12"><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>
415 <p class=
"p11"><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=
"s1">SCPen
</span>.translate(
100,
100);
</p>
416 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>1000.do {
</p>
417 <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 class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// set the Color
</p>
418 <p class=
"p11"><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=
"s1">SCPen
</span>.color =
<span class=
"s1">Color
</span>.green(rrand(
0.0,
1), rrand(
0.0,
0.5));
</p>
419 <p class=
"p11"><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=
"s1">SCPen
</span>.addAnnularWedge(
</p>
420 <p class=
"p11"><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=
"Apple-tab-span"> </span>(
100.rand)@(
100.rand),
</p>
421 <p class=
"p11"><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=
"Apple-tab-span"> </span>rrand(
10,
50),
</p>
422 <p class=
"p11"><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=
"Apple-tab-span"> </span>rrand(
51,
100),
<span class=
"Apple-tab-span"> </span></p>
423 <p class=
"p11"><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=
"Apple-tab-span"> </span>2pi.rand,
</p>
424 <p class=
"p11"><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=
"Apple-tab-span"> </span>2pi.rand
</p>
425 <p class=
"p11"><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>);
</p>
426 <p class=
"p11"><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=
"s1">SCPen
</span>.perform([
<span class=
"s13">\stroke
</span>,
<span class=
"s13">\fill
</span>].choose);
</p>
427 <p class=
"p11"><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>
428 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>}).plot(freeOnClose:
<span class=
"s1">true
</span>);
</p>
429 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
430 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
431 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>//
<span class=
"Apple-tab-span"> </span>String drawing support on the image
</p>
432 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>//
<span class=
"Apple-tab-span"> </span>drawStringAtPoint(string, point, font, color);
</p>
433 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
434 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>j =
<span class=
"s1">SCImage
</span>.new(
150,
50);
</p>
435 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>j.draw({
<span class=
"s1">arg
</span> bounds;
</p>
436 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>j.drawStringAtPoint(
<span class=
"s11">"Hello, world!"</span>,
10@
10,
<span class=
"s1">Font
</span>(
<span class=
"s11">"Lucida Grande"</span>,
24),
<span class=
"s1">Color
</span>.black);
</p>
437 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>});
</p>
438 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
439 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
440 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>j.plot;
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
441 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>j.write(
</span>"~/Desktop/hello.png"<span class=
"s3">);
</span></p>
442 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>j.free;
</p>
443 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
444 <p class=
"p3"><span class=
"s8"><span class=
"Apple-tab-span"> </span></span><b>drawStringAtPoint( string, point, font, color )
</b></p>
445 <p class=
"p3"><span class=
"s8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>renders *correctly* a String inside an SCImage :)
<span class=
"s17">// to fix to have a compiant interface
</span></p>
446 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
447 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
448 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s1">var
</span> width, height, tgHeight, ratio, str, font, color, strb, targetWidth=
400, shadowColor, run =
<span class=
"s1">true
</span>;
</p>
449 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>shadowColor =
<span class=
"s1">Color
</span>.black;
</p>
450 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
451 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>color =
<span class=
"s1">Color
</span>.gray(
0.8);
</p>
452 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>str =
</span>"I Love Pixels"<span class=
"s3">;
</span></p>
453 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>font =
<span class=
"s1">Font
</span>(
<span class=
"s11">"Monaco"</span>,
10);
</p>
454 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>strb = str.bounds(font);
</p>
455 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>width = strb.width;
</p>
456 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>height = strb.height;
</p>
457 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>ratio = height / width;
</p>
458 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i =
<span class=
"s1">SCImage
</span>(width@(height));
</p>
459 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.draw({
<span class=
"s1">|bb|
</span></p>
460 <p class=
"p11"><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=
"s1">SCPen
</span>.smoothing_(
<span class=
"s1">false
</span>);
</p>
461 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.drawStringAtPoint(str,
0@
0, font, color);
</p>
462 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>});
</p>
463 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.interpolation_(
<span class=
"s13">\none
</span>);
</p>
464 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>tgHeight = targetWidth * ratio;
</p>
465 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s1">SCWindow
</span>.new(
<span class=
"s11">""</span>,
<span class=
"s1">Rect
</span>(
400,
400,
450,
150)).drawHook_({
</p>
466 <p class=
"p11"><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=
"s1">SCPen
</span>.setShadow(
2@
2,
0.4, color:
<span class=
"s1">Color
</span>.red);
</p>
467 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.drawInRect(
<span class=
"s1">Rect
</span>(
5,
5,targetWidth, tgHeight));
</p>
468 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>});
</p>
469 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
470 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s1">Color
</span>.white);
</p>
471 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.onClose_({run =
<span class=
"s1">false
</span>; i.free;});
</p>
472 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.front;
</p>
473 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
474 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
475 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>drawAtPoint( point, fromRect, operation, fraction )
</b></p>
476 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>render the image or a portion of it in the current graphic context.
</p>
477 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>point
</b> - the
<a href=
"../../../Geometry/Point.html"><span class=
"s5">Point
</span></a> where to draw it
</p>
478 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>fromRect
</b> - the portion of the
<span class=
"s5">SCImage
</span> to use
</p>
479 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>operation
</b> - the compositing operation to use. 'sourceOver' is the default.
</p>
480 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>fraction
</b> - the opacity to use, ranging from
0.0 (fully transparent) to
1.0 (fully opaque)
</p>
481 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
482 <p class=
"p11"><span class=
"s10"><span class=
"Apple-tab-span"> </span></span>(
</p>
483 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s1">var
</span> operation=
<span class=
"s13">'sourceOver'
</span>, fraction=
1.0, i, w;
</p>
484 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
485 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i =
<span class=
"s1">SCImage
</span>.new(
</p>
486 <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=
"Apple-tab-span"> </span>"http://supercollider.sourceforge.net/theme/sc01/icon.supercollider.gif"</p>
487 <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=
"Apple-tab-span"> </span>Document.current.dir +/+
"duck_alpha.png"</p>
488 <p class=
"p11"><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=
"s1">Document
</span>.current.dir +/+
<span class=
"s11">"Swamp.png"</span></p>
489 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
490 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
491 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s1">SCWindow
</span>.new(
<span class=
"s11">"SCImage"</span>,
<span class=
"s1">Rect
</span>(
120,
400,
360,
180)).front;
</p>
492 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
493 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s1">SCSlider
</span>.new(w,
<span class=
"s1">Rect
</span>(
10,
150,
150,
16))
</p>
494 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.value_(
1.0)
</p>
495 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.action_({
<span class=
"s1">arg
</span> sl;
</p>
496 <p class=
"p11"><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>fraction = sl.value;
</p>
497 <p class=
"p11"><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>w.refresh;
</p>
498 <p class=
"p11"><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>
499 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
500 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s1">SCPopUpMenu
</span>.new(w,
<span class=
"s1">Rect
</span>(
170,
150,
100,
16))
</p>
501 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.items_(
<span class=
"s1">SCImage
</span>.compositingOperations.collect({
<span class=
"s1">arg
</span> i; i.asString }) )
</p>
502 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.value_(
2)
</p>
503 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.action_({
<span class=
"s1">arg
</span> pm;
</p>
504 <p class=
"p11"><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>operation =
<span class=
"s1">SCImage
</span>.compositingOperations.at(pm.value);
</p>
505 <p class=
"p11"><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>w.refresh;
</p>
506 <p class=
"p11"><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>
507 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
508 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.onClose_({ i.free });
</span>// free the image when the window is closed
</p>
509 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
510 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook_({
</p>
511 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
512 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.drawAtPoint(
10@
10,
<span class=
"s1">nil
</span>, operation, fraction);
</p>
513 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
514 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>});
</p>
515 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
516 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
517 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>drawInRect( rect, fromRect, operation, fraction )
</b></p>
518 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>render the image or a portion of it in a specified rectangle of the current graphic context.
<span class=
"s5">This
</span> may stretch the image depending on the destination rect.
</p>
519 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>rect
</b> - the
<a href=
"../../../Geometry/Rect.html"><span class=
"s5">Rect
</span></a> where to draw it
</p>
520 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>fromRect
</b> - the portion of the
<span class=
"s5">SCImage
</span> to use
</p>
521 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>operation
</b> - the compositing operation to use. 'sourceOver' is the default.
</p>
522 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>fraction
</b> - the opacity to use, ranging from
0.0 (fully transparent) to
1.0 (fully opaque)
</p>
523 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
524 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
525 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i =
<span class=
"s1">SCImage
</span>.new(
</p>
526 <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 class=
"Apple-tab-span"> </span></span>//
"http://supercollider.sourceforge.net/theme/sc01/icon.supercollider.gif"</p>
527 <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 class=
"Apple-tab-span"> </span></span><span class=
"s1">Document
</span><span class=
"s3">.current.dir +/+
</span>"icon.supercollider.png"</p>
528 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
529 <p class=
"p12"><br></p>
530 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s1">SCWindow
</span>.new(
<span class=
"s11">"SCImage"</span>,
<span class=
"s1">Rect
</span>(
120,
400,
360,
180)).front;
</p>
531 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.onClose_({ i.free });
</span>// free the image when the window is closed
</p>
532 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook_({
</p>
533 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.drawInRect(
<span class=
"s1">Rect
</span>(
10,
10,
50,
50),
<span class=
"s1">Rect
</span>(
10,
10,
50,
50),
2,
1.0);
<span class=
"s15">// only a section
</span></p>
534 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>});
</p>
535 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
536 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
537 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>tileInRect( rect, fromRect, operation, fraction )
</b></p>
538 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>tile the image or a portion of it in a specified rectangle of the current graphic context.
<span class=
"s5">This
</span> may stretch the image depending on the destination rect.
</p>
539 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>rect
</b> - the
<a href=
"../../../Geometry/Rect.html"><span class=
"s5">Rect
</span></a> where to draw it
</p>
540 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>fromRect
</b> - the portion of the
<span class=
"s5">SCImage
</span> to use
</p>
541 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>operation
</b> - the compositing operation to use.
<span class=
"s18">'sourceOver'
</span> is the default.
</p>
542 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>*
<i>Compositing operations are currently disabled for tileInRect
</i></p>
543 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>fraction
</b> - the opacity to use, ranging from
0.0 (fully transparent) to
1.0 (fully opaque)
</p>
544 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
545 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s8">(
</span></p>
546 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i =
<span class=
"s1">SCImage
</span>.new(
</p>
547 <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 class=
"Apple-tab-span"> </span></span>//
"http://supercollider.sourceforge.net/theme/sc01/icon.supercollider.gif"</p>
548 <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 class=
"Apple-tab-span"> </span></span><span class=
"s1">Document
</span><span class=
"s3">.current.dir +/+
</span>"icon.supercollider.png"</p>
549 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
550 <p class=
"p12"><br></p>
551 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
<span class=
"s1">SCWindow
</span>.new(
<span class=
"s11">"SCImage"</span>,
<span class=
"s1">Rect
</span>(
120,
400,
360,
180)).front;
</p>
552 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.onClose_({ i.free });
</span>// free the image when the window is closed
</p>
553 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.drawHook_({
</p>
554 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.tileInRect(w.view.bounds,
<span class=
"s1">nil
</span>,
2,
1.0);
<span class=
"s15">// all image contents
</span></p>
555 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>});
</p>
556 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
557 <p class=
"p2"><br></p>
558 <p class=
"p6"><b>Instance Methods / accessing and setting pixels
</b></p>
559 <p class=
"p7"><br></p>
560 <p class=
"p3"><span class=
"s14"><span class=
"Apple-tab-span"> </span></span><b>setPixel( rgbaInteger, x, y )
</b></p>
561 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>fill a pixel located at x @ y.
</p>
562 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>rgbaInteger - an
32 bit
<span class=
"s6">Integer
</span> containing color information packed as
8bit
<span class=
"s5">RGBA
</span></p>
563 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
564 <p class=
"p11"><span class=
"s10"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>i =
<span class=
"s1">SCImage
</span>.color(
60,
60,
<span class=
"s1">Color
</span>.blue(
0.1,
0.1));
</p>
565 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w = i.plot;
</p>
566 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.setPixel([
255,
0,
0,
255].asRGBA,
0,
0);
<span class=
"s15">// setting red
</span></p>
567 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.refresh;
</p>
568 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
<span class=
"s11">"pixel at 0 @ 0:"</span>+i.getPixel(
0,
0).rgbaArray).postln;
</p>
569 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.free;
</p>
570 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
571 <p class=
"p3"><span class=
"s8"><span class=
"Apple-tab-span"> </span></span><b>getPixel( x, y )
</b></p>
572 <p class=
"p3"><span class=
"s8"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>retrieve the pixel value at x @ y as a
<span class=
"s5">RGBA
</span> integer
</p>
573 <p class=
"p2"><br></p>
574 <p class=
"p13"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span>// A simple example on how to manipulate pixels with SCImage
</p>
575 <p class=
"p18"><span class=
"s3"><span class=
"Apple-tab-span"> </span>b =
</span>Int32Array
<span class=
"s3">[Â
</span></p>
576 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s1">Integer
</span>.fromRGBA(
255,
0,
0,
255),
<span class=
"s15">// red
</span></p>
577 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s1">Integer
</span>.fromRGBA(
0,
255,
0,
255),
<span class=
"s15">// green
</span></p>
578 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s1">Integer
</span>.fromRGBA(
0,
0,
255,
255),
<span class=
"s15">// blue
</span></p>
579 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s1">Integer
</span>.fromRGBA(
255,
0,
255,
255)
<span class=
"s15">// purple
</span></p>
580 <p class=
"p11"><span class=
"Apple-tab-span"> </span>];
</p>
581 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
582 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span>b[
0].red;
</span>//
255 see Integer.red
</p>
583 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span>b[
0].green;
</span>//
0 see Integer.green
</p>
584 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span>b[
0].blue;
</span>//
0 see Integer.blue
</p>
585 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span>b[
0].alpha;
</span>//
255 see Integer.alpha
</p>
586 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
587 <p class=
"p11"><span class=
"Apple-tab-span"> </span>a =
<span class=
"s1">SCImage
</span>.new(b.size@
1).pixels_(b).interpolation_(
<span class=
"s13">\none
</span>);
</p>
588 <p class=
"p11"><span class=
"Apple-tab-span"> </span>a.plot;
</p>
589 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
590 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
591 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// Set + Get
</p>
592 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span>a.setPixel([
255,
0,
255,
128].asRGBA
</span>/* create an Integer from
0-
255 integer rgba value */
<span class=
"s3">,
0,
0).plot;
</span></p>
593 <p class=
"p11"><span class=
"Apple-tab-span"> </span>p = a.getPixel(
0,
0);
</p>
594 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
595 <p class=
"p11"><span class=
"Apple-tab-span"> </span>p.red;
<span class=
"s15">//
255</span></p>
596 <p class=
"p11"><span class=
"Apple-tab-span"> </span>p.green;
<span class=
"s15">//
0</span></p>
597 <p class=
"p11"><span class=
"Apple-tab-span"> </span>p.blue;
<span class=
"s15">//
255</span></p>
598 <p class=
"p11"><span class=
"Apple-tab-span"> </span>p.alpha;
<span class=
"s15">//
128</span></p>
599 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
600 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// now another important example
</p>
601 <p class=
"p11"><span class=
"Apple-tab-span"> </span>a.setPixel([
255,
0,
255,
0].asRGBA,
1,
0).plot;
<span class=
"s15">// clear color -
> alpha is
0</span></p>
602 <p class=
"p11"><span class=
"Apple-tab-span"> </span>p = a.getPixel(
1,
0);
</p>
603 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
604 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span>p.red;
</span>// you expect
255 but you get
0 ??? Why = because SCImage uses premultiplied color component value internally
</p>
605 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// meaning all Red, Green, and Blue component are premultiplied by the alpha
</p>
606 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// if alpha is
0 you get
0 back for all components.
</p>
607 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
608 <p class=
"p11"><span class=
"Apple-tab-span"> </span>p.green;
<span class=
"s15">//
0</span></p>
609 <p class=
"p11"><span class=
"Apple-tab-span"> </span>p.blue;
<span class=
"s15">//
0</span></p>
610 <p class=
"p11"><span class=
"Apple-tab-span"> </span>p.alpha;
<span class=
"s15">//
0</span></p>
611 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
612 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span>p = a.getColor(
1,
0);
</span>// more explicit - but same here
</p>
613 <p class=
"p2"><br></p>
614 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>setColor( color, x, y )
</b></p>
615 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>fill the pixel located at x @ y with the specified
<b>color
</b>.
</p>
616 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
617 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>getColor( x, y )
</b></p>
618 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>retrieve the pixel value at x @ y as a
<a href=
"../../GUI-Tools/Color.html"><span class=
"s5">Color
</span></a>.
</p>
619 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
620 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>pixels
</b></p>
621 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>retrieve all the pixels of the receiver.
</p>
622 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Carefull: the returned
<span class=
"s5">Array
</span> is a
<a href=
"../../../Collections/Int32Array.html"><span class=
"s5">Int32Array
</span></a> of size receiver.width * receiver.height containing all pixel values
</p>
623 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>as
32bit
<span class=
"s5">Integer
</span></p>
624 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
625 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>loadPixels(array, region, start)
</b></p>
626 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>load all the pixels of the receiver in an array. it is better and faster to call this function instead of
<b>pixels
</b> if you plan to retrieve frequently the pixel data (since it won't allocate a new array everytime !)
</p>
627 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>array
</b> - the array that will be filled. Should be an
<a href=
"../../../Collections/Int32Array.html"><span class=
"s19">Int32Array
</span></a> of size receiver.width * receiver.height.
</p>
628 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>region
</b> - the targeted rectangular region. (nil by default, meaning full size)
</p>
629 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>start
</b> - the start index of the array. (
0 by default)
</p>
630 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
631 <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>// exec one line at a time
</p>
632 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i =
<span class=
"s1">SCImage
</span>.new(
</p>
633 <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 class=
"Apple-tab-span"> </span></span>//
"http://supercollider.sourceforge.net/theme/sc01/icon.supercollider.gif"</p>
634 <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 class=
"Apple-tab-span"> </span></span><span class=
"s1">Document
</span><span class=
"s3">.current.dir +/+
</span>"icon.supercollider.png"</p>
635 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
636 <p class=
"p12"><br></p>
637 <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>// first grab the pixels
<span class=
"Apple-tab-span"> </span></p>
638 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>p = i.pixels;
</p>
639 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
640 <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>// do some mods - here invert
</p>
641 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.invert;
</p>
642 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
643 <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>// reload directly in my array - do not need to call i.pixels again
</p>
644 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.loadPixels(p);
</p>
645 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.free;
</p>
646 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>p;
</p>
647 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
648 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>pixels_(array)
</b></p>
649 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>set all the pixels of the receiver.
</p>
650 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>array - an
<a href=
"../../../Collections/Int32Array.html"><span class=
"s5">Int32Array
</span></a> of size receiver.width * receiver.height containing all pixel values
</p>
651 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>as
32bit
<span class=
"s5">Integer
</span></p>
652 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span></b></p>
653 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span>setPixels( array, rect, start )
</b></p>
654 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>set the pixels in a specific portion of the receiver.
</p>
655 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>array
</b> - an
<a href=
"../../../Collections/Int32Array.html"><span class=
"s5">Int32Array
</span></a> of size
<b>rect
</b>.width *
<b>rect
</b>.height containing all pixel values
</p>
656 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>as
32bit
<span class=
"s5">Integer
</span></p>
657 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>rect
</b> - a rectangle defining the portion to update in the receiver.
<span class=
"s5">By
</span> default
<b>rect
</b> is
<span class=
"s5">nil
</span>, meaning
</p>
658 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>full image size.
</p>
659 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>start
</b> - the array start index. (default is
0)
</p>
660 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
661 <p class=
"p11"><span class=
"s10"><b><span class=
"Apple-tab-span"> </span></b></span>(
</p>
662 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i =
<span class=
"s1">SCImage
</span>.new(
20@
20);
</p>
663 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.pixels_(
</p>
664 <p class=
"p11"><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=
"s1">Int32Array
</span>.fill(i.width * i.height, {
</p>
665 <p class=
"p11"><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=
"s1">Integer
</span>.fromRGBA(
255.rand,
127.rand,
255.rand,
255)
</p>
666 <p class=
"p11"><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>
667 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
668 <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>//i.interpolation_(\none); // uncomment to see the difference
</p>
669 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w = i.plot(freeOnClose:
<span class=
"s1">true
</span>);
</p>
670 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.pixels.postln;
</p>
671 <p class=
"p11"><span class=
"Apple-tab-span"> </span>)
</p>
672 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
673 <p class=
"p11"><span class=
"Apple-tab-span"> </span>(
</p>
674 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i =
<span class=
"s1">SCImage
</span>.color(
50@
50,
<span class=
"s1">Color
</span>.white);
</p>
675 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.setPixels(
</p>
676 <p class=
"p11"><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=
"s1">Int32Array
</span>.fill(
20*
20,{
<span class=
"s1">Integer
</span>.fromRGBA(
255.rand,
127.rand,
255.rand,
255)}),
</p>
677 <p class=
"p11"><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=
"s1">Rect
</span>(
10,
10,
20,
20)
</p>
678 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>);
</p>
679 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.interpolation_(
</span><span class=
"s13">\none
</span><span class=
"s3">);
</span>// uncomment to see the difference
</p>
680 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w = i.plot(freeOnClose:
<span class=
"s1">true
</span>);
</p>
681 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.pixels.postln;
</p>
682 <p class=
"p11"><span class=
"Apple-tab-span"> </span>)
</p>
683 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
684 <p class=
"p6"><b>Instance Methods / Views addition
</b></p>
685 <p class=
"p19"><span class=
"Apple-tab-span"> </span>you can now use a SCImage as a valid view background.
16 drawing modes are defined to behave
</p>
686 <p class=
"p19"><span class=
"Apple-tab-span"> </span>differently.
</p>
687 <p class=
"p20"><span class=
"Apple-tab-span"> </span></p>
688 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>tileMode values:
</p>
689 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>1 - fixed to left, fixed to top
</p>
690 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>2 - horizontally tile, fixed to top
</p>
691 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>3 - fixed to right, fixed to top
</p>
692 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>4 - fixed to left, vertically tile
</p>
693 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>5 - horizontally tile, vertically tile
</p>
694 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>6 - fixed to right, vertically tile
</p>
695 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>7 - fixed to left, fixed to bottom
</p>
696 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>8 - horizontally tile, fixed to bottom
</p>
697 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>9 - fixed to right, fixed to bottom
</p>
698 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>10 - fit
</p>
699 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>11 - center, center (scale)
</p>
700 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>12 - center , fixed to top
</p>
701 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>13 - center , fixed to bottom
</p>
702 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>14 - fixed to left, center
</p>
703 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>15 - fixed to right, center
</p>
704 <p class=
"p19"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>16 - center, center (no scale)
</p>
705 <p class=
"p20"><span class=
"Apple-tab-span"> </span></p>
706 <p class=
"p3"><span class=
"s8"><span class=
"Apple-tab-span"> </span></span><b>backgroundImage_( image, tileMode=
1, alpha=
1.0, fromRect )
</b></p>
707 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
708 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>image
</b> - the SCImage to use
</p>
709 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>tileMode
</b> - the mode to use. by default fixed to left, fixed to top
</p>
710 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>alpha
</b> - opacity
0 < x
< 1</p>
711 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>fromRect
</b> - the portion of the image to use. by default use the full image.
</p>
712 <p class=
"p12"><br></p>
713 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
714 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>b =
1.0;
</p>
715 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a =
<span class=
"s1">SCImage
</span>.new(
<span class=
"s1">Document
</span>.current.dir +/+
<span class=
"s11">"vduck2.jpg"</span>);
</p>
716 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>r =
<span class=
"s1">Rect
</span>(
20,
3,
40,
40);
</p>
717 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
</span><span class=
"s1">SCWindow
</span><span class=
"s3">.new(
</span>"SCImage background"<span class=
"s3"> </span><span class=
"s15">/*, textured:false*/
</span><span class=
"s3"> );
</span></p>
718 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.background_(
<span class=
"s1">Color
</span>.gray);
</p>
719 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.backgroundImage_(a,
5, b, r);
</p>
720 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.front;
</p>
721 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
722 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
723 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// monte carlo :) exec every line to test
</p>
724 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// r = nil; // uncomment for full image
</p>
725 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.backgroundImage_(a,
1, b, r);
</p>
726 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.backgroundImage_(a,
2, b, r);
</p>
727 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.backgroundImage_(a,
3, b, r);
</p>
728 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.backgroundImage_(a,
4, b, r);
</p>
729 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.backgroundImage_(a,
5, b, r);
</p>
730 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.backgroundImage_(a,
6, b, r);
</p>
731 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.backgroundImage_(a,
7, b, r);
</p>
732 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.backgroundImage_(a,
8, b, r);
</p>
733 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.backgroundImage_(a,
9, b, r);
</p>
734 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.backgroundImage_(a,
10, b, r);
</p>
735 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.backgroundImage_(a,
11, b, r);
<span class=
"s15">// find best ratio - move to see
</span></p>
736 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.backgroundImage_(a,
12, b, r);
</p>
737 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.backgroundImage_(a,
13, b, r);
</p>
738 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.backgroundImage_(a,
14, b, r);
</p>
739 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.backgroundImage_(a,
15, b, r);
</p>
740 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.view.backgroundImage_(a,
16, b, r);
</p>
741 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
742 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></span>// this is safe even if window is still open because Background object holds the SCImage
</p>
743 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a.free;
</p>
744 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
745 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.close;
</p>
746 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
747 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
748 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a =
</span><span class=
"s1">SCImage
</span><span class=
"s3">.new(
</span>"/Library/Desktop Pictures/Ripples Blue.jpg"<span class=
"s3">);
</span></p>
749 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
</span><span class=
"s1">SCWindow
</span><span class=
"s3">.new(
</span>"SCImage background"<span class=
"s3">);
</span></p>
750 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>l =
<span class=
"s1">SC2DSlider
</span>.new(w,
<span class=
"s1">Rect
</span>(
10,
10,
200,
200))
</p>
751 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.backgroundImage_( a,
5,
1,
<span class=
"s1">Rect
</span>(
0,
0,
10,
10) );
</p>
752 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.front;
</p>
753 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a.free;
<span class=
"s15">// safe
</span></p>
754 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
755 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
756 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
757 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"s1">var
</span> bounds =
<span class=
"s1">Rect
</span>(
10,
10,
150,
18);
</p>
758 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a =
</span><span class=
"s1">SCImage
</span><span class=
"s3">.new(
</span>"/Library/Desktop Pictures/Ripples Blue.jpg"<span class=
"s3">);
</span></p>
759 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w =
</span><span class=
"s1">SCWindow
</span><span class=
"s3">.new(
</span>"SCImage background"<span class=
"s3">);
</span></p>
760 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>l =
<span class=
"s1">SCSlider
</span>.new(w, bounds)
</p>
761 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>.backgroundImage_(a);
</p>
762 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>w.front;
</p>
763 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>a.free;
<span class=
"s15">// safe
</span></p>
764 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
765 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
766 <p class=
"p6"><b>Instance Methods / Attributes for SCImageFilter support
</b></p>
767 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
768 <p class=
"p19"><span class=
"s10"><span class=
"Apple-tab-span"> </span></span>see
<a href=
"SCImageFilter.html"><span class=
"s12">SCImageFilter
</span></a> for more info
</p>
769 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
770 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>applyFilters ( filters, crop, region )
</b></p>
771 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>apply an array of
<a href=
"SCImageFilter.html"><span class=
"s12">SCImageFilter
</span></a> to the image. this should be considered as an in place operation, meaning the SCImage is altered after it.
</p>
772 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>filters
</b> - a SCImageFilter or an array of
<a href=
"SCImageFilter.html"><span class=
"s12">SCImageFilter
</span></a> to be applied
</p>
773 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>crop
</b> - the crop region to finally use. This may be required for extending bounds since some SCImageFilter / CoreImageFilters require to set a wider
</p>
774 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>region (to be applied correctly) or may create a huge image. Setting crop to nil sets no crop region. In case the current maximum size of a filtered SCImage is
4096 /
4096. Any larger size will be clipped.
</p>
775 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>by default crop is constrained to the receiver bounds.
</p>
776 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>region
</b> - NOTE: supported only in Mac OS
10.5 and later. option to constrain the filter to a specific region IN the SCImage.
</p>
777 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
778 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
779 <p class=
"p13"><span class=
"s7"><span class=
"Apple-tab-span"> </span></span>// ******** Built In CoreImage Generators ********
</p>
780 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// Generators are not filters, they actually create an image but do not need an input image
</p>
781 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// you just have to create an image of a new size
</p>
782 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// ** The Simple Random Filter **
</p>
783 <p class=
"p11"><span class=
"Apple-tab-span"> </span>(
</p>
784 <p class=
"p21"><span class=
"s3"><span class=
"Apple-tab-span"> </span>f =
</span><span class=
"s1">SCImageFilter
</span><span class=
"s3">.new(
</span>\CIRandomGenerator
<span class=
"s3">);
</span></p>
785 <p class=
"p11"><span class=
"Apple-tab-span"> </span>a =
<span class=
"s1">SCImage
</span>.new(
500@
500);
</p>
786 <p class=
"p11"><span class=
"Apple-tab-span"> </span>a.applyFilters(f);
</p>
787 <p class=
"p11"><span class=
"Apple-tab-span"> </span>w = a.plot(freeOnClose:
<span class=
"s1">true
</span>, background:
<span class=
"s1">Color
</span>.black);
</p>
788 <p class=
"p11"><span class=
"Apple-tab-span"> </span>a.bounds.postln;
</p>
789 <p class=
"p11"><span class=
"Apple-tab-span"> </span>)
</p>
790 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
791 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// ** The StarShine example **
</p>
792 <p class=
"p11"><span class=
"Apple-tab-span"> </span>(
</p>
793 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"s1">var
</span> width=
500, height=
500, centerVector;
</p>
794 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
795 <p class=
"p11"><span class=
"Apple-tab-span"> </span>centerVector = [ width*
0.5, height*
0.5 ];
</p>
796 <p class=
"p11"><span class=
"Apple-tab-span"> </span>a =
<span class=
"s1">SCImage
</span>.new(
500@
500);
</p>
797 <p class=
"p21"><span class=
"s3"><span class=
"Apple-tab-span"> </span>f =
</span><span class=
"s1">SCImageFilter
</span><span class=
"s3">.new(
</span>\CIStarShineGenerator
<span class=
"s3">);
</span></p>
798 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
799 <p class=
"p11"><span class=
"Apple-tab-span"> </span>f.center_(centerVector);
</p>
800 <p class=
"p11"><span class=
"Apple-tab-span"> </span>f.radius_(width*
0.05);
</p>
801 <p class=
"p11"><span class=
"Apple-tab-span"> </span>f.color_(
<span class=
"s1">Color
</span>.blue);
</p>
802 <p class=
"p11"><span class=
"Apple-tab-span"> </span>f.crossWidth_(
2.0);
</p>
803 <p class=
"p11"><span class=
"Apple-tab-span"> </span>f.crossAngle_(
0.0);
</p>
804 <p class=
"p11"><span class=
"Apple-tab-span"> </span>f.crossOpacity_(-
4.0);
</p>
805 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
806 <p class=
"p11"><span class=
"Apple-tab-span"> </span>a.applyFilters(f);
</p>
807 <p class=
"p11"><span class=
"Apple-tab-span"> </span>w = a.plot(freeOnClose:
<span class=
"s1">true
</span>, background:
<span class=
"s1">Color
</span>.gray);
<span class=
"s15">// change background to see
</span></p>
808 <p class=
"p11"><span class=
"Apple-tab-span"> </span>)
</p>
809 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
810 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
811 <p class=
"p13"><span class=
"s3"><span class=
"Apple-tab-span"> </span></span>// ** Starshine + Pixellate + ZoomBlur **
</p>
812 <p class=
"p11"><span class=
"Apple-tab-span"> </span>(
</p>
813 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"s1">var
</span> width=
500, height=
500, centerVector;
</p>
814 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
815 <p class=
"p11"><span class=
"Apple-tab-span"> </span>centerVector = [ width*
0.5, height*
0.5 ];
</p>
816 <p class=
"p11"><span class=
"Apple-tab-span"> </span>a =
<span class=
"s1">SCImage
</span>.new(
500@
500);
</p>
817 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
818 <p class=
"p21"><span class=
"s3"><span class=
"Apple-tab-span"> </span>f =
</span><span class=
"s1">SCImageFilter
</span><span class=
"s3">.new(
</span>\CIStarShineGenerator
<span class=
"s3">);
</span></p>
819 <p class=
"p18"><span class=
"s3"><span class=
"Apple-tab-span"> </span>g =
</span>SCImageFilter
<span class=
"s3">.new(
</span><span class=
"s13">\CIPixellate
</span><span class=
"s3">);
</span></p>
820 <p class=
"p18"><span class=
"s3"><span class=
"Apple-tab-span"> </span>h =
</span>SCImageFilter
<span class=
"s3">.new(
</span><span class=
"s13">\CIZoomBlur
</span><span class=
"s3">);
</span></p>
821 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
822 <p class=
"p11"><span class=
"Apple-tab-span"> </span>f.center_(centerVector);
</p>
823 <p class=
"p11"><span class=
"Apple-tab-span"> </span>f.radius_(width*
0.05);
</p>
824 <p class=
"p11"><span class=
"Apple-tab-span"> </span>f.color_(
<span class=
"s1">Color
</span>.blue);
</p>
825 <p class=
"p11"><span class=
"Apple-tab-span"> </span>f.crossWidth_(
2.0);
</p>
826 <p class=
"p11"><span class=
"Apple-tab-span"> </span>f.crossAngle_(
0.0);
</p>
827 <p class=
"p11"><span class=
"Apple-tab-span"> </span>f.crossOpacity_(-
4.0);
</p>
828 <p class=
"p11"><span class=
"Apple-tab-span"> </span>g.center_(centerVector);
</p>
829 <p class=
"p11"><span class=
"Apple-tab-span"> </span>h.center_(centerVector);
</p>
830 <p class=
"p11"><span class=
"Apple-tab-span"> </span>h.amount_(
50);
</p>
831 <p class=
"p12"><span class=
"Apple-tab-span"> </span></p>
832 <p class=
"p11"><span class=
"Apple-tab-span"> </span>a.applyFilters([f, g, h]);
</p>
833 <p class=
"p11"><span class=
"Apple-tab-span"> </span>w = a.plot(freeOnClose:
<span class=
"s1">true
</span>, background:
<span class=
"s1">Color
</span>.black);
</p>
834 <p class=
"p11"><span class=
"Apple-tab-span"> </span>)
</p>
835 <p class=
"p2"><br></p>
836 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>filteredWith( filters, crop )
</b></p>
837 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>returns a new SCImage, copy of the receiver filtered with an array of SCImageFilter.
</p>
838 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>arguments are the same as applyFilter (except for
<b>region
</b>).
</p>
839 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>Beware: you are responsible for freeing the newly created SCImage !!!
</p>
840 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
841 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>filters
</b></p>
842 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>filters is the instance variable that holds the array of SCImageFilter attached to the receiver. This is a convenient for applying filters out place and changing
</p>
843 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>the SCImageFilter's attributes. see
<b>addFilter
</b>,
<b>removeFilter
</b></p>
844 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
845 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>see
<a href=
"SCImageFilter.html"><span class=
"s12">SCImageFilter
</span></a> for an example on how to use the
<b>filters
</b>array.
</p>
846 <p class=
"p2"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b></p>
847 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>addFilter ( filter )
</b></p>
848 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>filter
</b> - a SCImageFilter to apply before rendering of the image
</p>
849 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>you can also attach filters to the receiver for real-time changing operations. In this case the receiver will create a cache before each rendering
</p>
850 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>to maintain his previous state, and allowing you to use filters without applying them in place. The cache is managed directly by the receiver.
</p>
851 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>you can add several filters to the receiver, the first filter in the array is the first applied in the rendering chain.
</p>
852 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
853 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>see
<a href=
"SCImageFilter.html"><span class=
"s12">SCImageFilter
</span></a> for an example on how to use
<b>addFilter
</b>.
</p>
854 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
855 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>removeFilter( filter )
</b></p>
856 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>filter
</b> - the SCImageFilter to remove from the rendering chain.
</p>
857 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
858 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>see
<a href=
"SCImageFilter.html"><span class=
"s12">SCImageFilter
</span></a> for an example on how to use
<b>removeFilter
</b>.
</p>
859 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
860 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>flatten
</b></p>
861 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>if
<b>filters
</b> is not zero sized, this method will apply all those filters in place.
</p>
862 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>if the image is accelerated this method force a bitmap representation of the receiver.
</p>
863 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
864 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>invert
</b></p>
865 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>invert the receiver
</p>
866 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
867 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>(
</p>
868 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i =
</span><span class=
"s1">SCImage
</span><span class=
"s3">.new(
</span>"/Library/Desktop Pictures/Ripples Blue.jpg"<span class=
"s3">);
</span></p>
869 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.invert;
</p>
870 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.plot(freeOnClose:
<span class=
"s1">true
</span>);
</p>
871 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
872 <p class=
"p12"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
873 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>crop (aRect)
</b></p>
874 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>crop the receiver
</p>
875 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>aRect
</b> - the cropping region
</p>
876 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
877 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b><span class=
"s8">(
</span></p>
878 <p class=
"p14"><span class=
"s3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i =
</span><span class=
"s1">SCImage
</span><span class=
"s3">.new(
</span>"/Library/Desktop Pictures/Ripples Blue.jpg"<span class=
"s3">);
</span></p>
879 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.crop(
<span class=
"s1">Rect
</span>(
10,
10,
120,
100) );
</p>
880 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>i.plot(freeOnClose:
<span class=
"s1">true
</span>);
</p>
881 <p class=
"p11"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span>)
</p>
882 <p class=
"p2"><br></p>
883 <p class=
"p2"><br></p>
884 <p class=
"p6"><b>Instance Methods / Attributes for SCImageKernel support
</b></p>
885 <p class=
"p7"><br></p>
886 <p class=
"p3"><span class=
"s14"><b><span class=
"Apple-tab-span"> </span></b></span>see
<a href=
"SCImageKernel.html"><span class=
"s12">SCImageKernel
</span></a> for examples and more info.
</p>
887 <p class=
"p2"><span class=
"Apple-tab-span"> </span></p>
888 <p class=
"p3"><span class=
"Apple-tab-span"> </span><b>applyKernel( kernel )
</b></p>
889 <p class=
"p3"><b><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></b>apply a Kernel in place. the receiver is modified after this call.
</p>
890 <p class=
"p3"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span><b>kernel
</b> - a SCImageKernel
</p>
891 <p class=
"p2"><span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>