deprecate SCViewHolder-layRight
[supercollider.git] / SCClassLibrary / Common / GUI / osx / scide_scapp / Base / SCPen.sc
blob1218d415795f172dc5d0f7f6e7c3723f36d9b34f
1 SCPen {
3         classvar font, fillColor, strokeColor;
5         *font_ { arg argFont;
6                 font = argFont;
7         }
9         *string { arg str;
10                 str.drawAtPoint( Point( 0, 0 ), font ? SCFont.default, fillColor ? Color.black );
11         }
13         *stringAtPoint { arg str, point;
14                 str.drawAtPoint( point, font ? SCFont.default, fillColor ? Color.black );
15         }
17         *stringInRect { arg str, rect;
18                 str.drawInRect( rect, font ? SCFont.default, fillColor ? Color.black );
19         }
21         *stringCenteredIn { arg str, inRect;
22                 str.drawCenteredIn( inRect, font ? SCFont.default, fillColor ? Color.black );
23         }
25         *stringLeftJustIn { arg str, inRect;
26                 str.drawLeftJustIn( inRect, font ? SCFont.default, fillColor ? Color.black );
27         }
29         *stringRightJustIn { arg str, inRect;
30                 str.drawRightJustIn( inRect, font ? SCFont.default, fillColor ? Color.black );
31         }
33         *image { arg img;
34                 img.drawAtPoint( Point( 0, 0 ), img.bounds );
35         }
37         *imageAtPoint { arg img, point;
38                 img.drawAtPoint( point, img.bounds );
39         }
41         *strokeColor_ { arg color;
42                 strokeColor = color;
43                 color.setStroke;
44         }
46         *fillColor_ { arg color;
47                 fillColor = color;
48                 color.setFill;
49         }
51         *color_ { arg color;
52                 color = color ? Color.black;
53                 fillColor = color;
54                 strokeColor = color;
55                 color.set;
56         }
58         *use { arg function;
59                 var res;
60                 this.push;
61 //              this.prReset;
62                 res = function.value;
63                 this.pop;
64                 ^res
65         }
67         *prReset{
68                 this.color_(nil)
69         }
71         *translate { arg x=0, y=0;
72                 _Pen_Translate
73                 ^this.primitiveFailed
74         }
76         *scale { arg x=0, y=0;
77                 _Pen_Scale
78                 ^this.primitiveFailed
79         }
81         *skew { arg x=0, y=0;
82                 _Pen_Skew
83                 ^this.primitiveFailed
84         }
86         *rotate { arg angle=0, x=0, y=0;
87                 _Pen_Rotate
88                 ^this.primitiveFailed
89         }
91         *width_ { arg width = 1;
92                 _Pen_SetWidth
93                 ^this.primitiveFailed
94         }
96         // Paths:
97         *path { arg function;
98                 var res;
99                 this.beginPath;
100                 res = function.value;
101                 this.endPath;
102                 ^res
103         }
105         *beginPath {
106                 _Pen_BeginPath
107                 ^this.primitiveFailed
108         }
110         *moveTo { arg point;
111                 _Pen_MoveTo
112                 ^this.primitiveFailed
113         }
115         *lineTo { arg point;
116                 _Pen_LineTo
117                 ^this.primitiveFailed
118         }
120         *line { arg p1, p2;
121                 ^this.moveTo(p1).lineTo(p2);
122         }
124         *addArc { arg center, radius, startAngle, arcAngle;
125                 _Pen_AddArc
126                 ^this.primitiveFailed
127         }
129         *addWedge { arg center, radius, startAngle, arcAngle;
130                 _Pen_AddWedge
131                 ^this.primitiveFailed
132         }
134         *addAnnularWedge { arg center, innerRadius, outerRadius, startAngle, arcAngle;
135                 _Pen_AddAnnularWedge
136                 ^this.primitiveFailed
137         }
139         *addRect { arg rect;
140                 _Pen_AddRect
141                 ^this.primitiveFailed
142         }
144         *stroke {
145                 _Pen_StrokePath
146                 ^this.primitiveFailed
147         }
149         *fill {
150                 _Pen_FillPath
151                 ^this.primitiveFailed
152         }
154         *clip {
155                 _Pen_ClipPath
156                 ^this.primitiveFailed
157         }
158         *matrix_ { arg array;
159                 _Pen_SetMatrix
160                 ^this.primitiveFailed
161         }
163         *strokeRect { arg rect;
164                 _Pen_StrokeRect
165                 ^this.primitiveFailed
166         }
168         *fillRect { arg rect;
169                 _Pen_FillRect
170                 ^this.primitiveFailed
171         }
173         *strokeOval { arg rect;
174                 _Pen_StrokeOval
175                 ^this.primitiveFailed
176         }
178         *fillOval { arg rect;
179                 _Pen_FillOval
180                 ^this.primitiveFailed
181         }
183         *drawAquaButton { arg rect, type=0, down = false, on = false;
184                 _Pen_DrawAquaButton
185                 ^this.primitiveFailed
186         }
188         *setSmoothing { arg flag = true;
189                 this.deprecated(thisMethod, Meta_SCPen.findRespondingMethodFor(\smoothing_));
190                 this.smoothing = flag;
191         }
193         *smoothing_ { arg flag = true;
194                 _Pen_SetSmoothing
195                 ^this.primitiveFailed
196         }
198         //ADDITIONS:
200         *fillStroke {
201                 this.draw(3);
202         }
204         *clearRect {arg aRect=nil;
205                 _Pen_ClearRect
206                 ^this.primitiveFailed
207         }
209         *arcTo { arg point1, point2, radius;
210                 _Pen_AddArcToPoint
211                 ^this.primitiveFailed
212         }
214         *curveTo { arg point, cpoint1, cpoint2;
215                 _Pen_AddCubicCurve
216                 ^this.primitiveFailed
217         }
219         *quadCurveTo { arg point, cpoint1;
220                 _Pen_AddQuadCurve
221                 ^this.primitiveFailed
222         }
224         *alpha_ {arg opacity;
225                 _Pen_SetAlpha
226                 ^this.primitiveFailed
227         }
229         /*
230         different blend modes:
231         OS X 10.4 and > Only
232         --------------------
233         0 - Normal
234         1 - Multiply
235         2 - Screen
236         3 - Overlay
237         4 - Darken
238         5 - Lighten
239         6 - ColorDodge
240         7 - ColorBurn
241         8 - SoftLight
242         9 - HardLight
243         10 - Difference
244         11 - Exclusion
245         12 - Hue
246         13 - Saturation
247         14 - Color
248         15 - Luminosity
250         OS 10.5 and > Only
251         --------------------
252         16 - Clear
253         17 - Copy
254         18 - SourceIn
255         19 - SourceOut
256         20 - SourceATop
257         21 - DestinationOver
258         22 - DestinationIn
259         23 - DestinationATop
260         24 - XOR
261         25 - PlusDarker
262         26 - PlusLighter
263         */
265         *blendMode_{ arg mode;
266                 _Pen_SetBlendMode
267                 ^this.primitiveFailed
268         }
270         *setShadow { arg offsetPoint=Point(2,2), blur=0.5, color=Color.black;
271                 this.prSetShadow(offsetPoint, blur, color);
272         }
274         *prSetShadow { arg offsetPoint, blur, color;
275                 _Pen_SetShadow
276                 ^this.primitiveFailed
277         }
279         *beginTransparencyLayer {
280                 _Pen_BeginTLayer
281                 ^this.primitiveFailed
282         }
284         *endTransparencyLayer { // will work only for Mac Os X >= 10.3 - does nothing for others
285                 _Pen_EndTLayer
286                 ^this.primitiveFailed
287         }
289         *draw { arg option = 0;// 0 = fill, 1 = eofill, 2 = stroke, 3 = fillstroke, 4 = eofillstroke
290                 _Pen_DrawPath
291                 ^this.primitiveFailed
292         }
294         *joinStyle_ { arg style = 0; // 0 = miter, 1 = round, 2 = bevel
295                 _Pen_LineJoin
296                 ^this.primitiveFailed
297         }
299         *capStyle_ { arg style = 0; // 0 = butt, 1 = round, 2 = square
300                 _Pen_LineCap
301                 ^this.primitiveFailed
302         }
304         *lineDash_ { arg pattern; // should be a FloatArray
305                 _Pen_LineDash
306                 ^this.primitiveFailed
307         }
309         *addOval { arg rect;
310                 _Pen_AddOval
311                 ^this.primitiveFailed
312         }
314         *fillAxialGradient { arg startPoint, endPoint, color0, color1;
315                 this.prFillAxialGradient(startPoint, endPoint, color0, color1);
316         }
318         *fillRadialGradient { arg innerCircleCenter, outerCircleCenter, startRadius,
319                         endRadius, color0, color1;
320                 this.prFillRadialGradient(innerCircleCenter, outerCircleCenter, startRadius,
321                         endRadius, color0, color1)
322         }
324         *prFillAxialGradient { arg startPoint, endPoint, color0, color1;
325                 _Pen_DrawAxialGradient
326                 ^this.primitiveFailed
327         }
329         *prFillRadialGradient { arg innerCircleCenter, outerCircleCenter, startRadius,
330                         endRadius, color0, color1;
331                 _Pen_DrawRadialGradient
332                 ^this.primitiveFailed
333         }
335         // PRIVATE:
336         *push {
337                 _Pen_Push
338                 ^this.primitiveFailed
339         }
341         *pop {
342                 _Pen_Pop
343                 ^this.primitiveFailed
344         }