comparison dstep/appkit/NSBezierPath.d @ 16:19885b43130e

Huge update, the bridge actually works now
author Jacob Carlborg <doob@me.com>
date Sun, 03 Jan 2010 22:06:11 +0100
parents
children b9de51448c6b
comparison
equal deleted inserted replaced
15:7ff919f595d5 16:19885b43130e
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Sep 24, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.appkit.NSBezierPath;
8
9 import dstep.appkit.NSAffineTransform;
10 import dstep.appkit.NSFont;
11 import dstep.applicationservices.coregraphics.CGBase;
12 import dstep.foundation.NSCoder;
13 import dstep.foundation.NSGeometry;
14 import dstep.foundation.NSObjCRuntime;
15 import dstep.foundation.NSObject;
16 import dstep.foundation.NSZone;
17 import dstep.objc.bridge.Bridge;
18 import dstep.objc.objc;
19
20 alias NSUInteger NSLineCapStyle;
21 alias NSUInteger NSLineJoinStyle;
22 alias NSUInteger NSWindingRule;
23 alias NSUInteger NSBezierPathElement;
24
25 enum
26 {
27 NSButtLineCapStyle = 0,
28 NSRoundLineCapStyle = 1,
29 NSSquareLineCapStyle = 2
30 }
31
32 enum
33 {
34 NSMiterLineJoinStyle = 0,
35 NSRoundLineJoinStyle = 1,
36 NSBevelLineJoinStyle = 2
37 }
38
39 enum
40 {
41 NSNonZeroWindingRule = 0,
42 NSEvenOddWindingRule = 1
43 }
44
45 enum
46 {
47 NSMoveToBezierPathElement,
48 NSLineToBezierPathElement,
49 NSCurveToBezierPathElement,
50 NSClosePathBezierPathElement
51 }
52
53 class NSBezierPath : NSObject, INSCopying, INSCoding
54 {
55 mixin (ObjcWrap);
56
57 this (NSCoder aDecoder)
58 {
59 super(typeof(this).alloc.initWithCoder(aDecoder).objcObject);
60 }
61
62 void encodeWithCoder (NSCoder aCoder)
63 {
64 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
65 }
66
67 typeof(this) initWithCoder (NSCoder aDecoder)
68 {
69 return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder);
70 }
71
72 typeof(this) copyWithZone (NSZone* zone)
73 {
74 return invokeObjcSelf!(typeof(this), "copyWithZone:", NSZone*)(zone);
75 }
76
77 static NSBezierPath bezierPath ()
78 {
79 return invokeObjcSelfClass!(NSBezierPath, "bezierPath");
80 }
81
82 static NSBezierPath bezierPathWithRect (NSRect rect)
83 {
84 return invokeObjcSelfClass!(NSBezierPath, "bezierPathWithRect:", NSRect)(rect);
85 }
86
87 static NSBezierPath bezierPathWithOvalInRect (NSRect rect)
88 {
89 return invokeObjcSelfClass!(NSBezierPath, "bezierPathWithOvalInRect:", NSRect)(rect);
90 }
91
92 static NSBezierPath bezierPathWithRoundedRect (NSRect rect, CGFloat xRadius, CGFloat yRadius)
93 {
94 return invokeObjcSelfClass!(NSBezierPath, "bezierPathWithRoundedRect:xRadius:yRadius:", NSRect, CGFloat, CGFloat)(rect, xRadius, yRadius);
95 }
96
97 static void fillRect (NSRect rect)
98 {
99 return invokeObjcSelfClass!(void, "fillRect:", NSRect)(rect);
100 }
101
102 static void strokeRect (NSRect rect)
103 {
104 return invokeObjcSelfClass!(void, "strokeRect:", NSRect)(rect);
105 }
106
107 static void clipRect (NSRect rect)
108 {
109 return invokeObjcSelfClass!(void, "clipRect:", NSRect)(rect);
110 }
111
112 static void strokeLineFromPoint (NSPoint point1, NSPoint point2)
113 {
114 return invokeObjcSelfClass!(void, "strokeLineFromPoint:toPoint:", NSPoint, NSPoint)(point1, point2);
115 }
116
117 static void drawPackedGlyphs (char* packedGlyphs, NSPoint point)
118 {
119 return invokeObjcSelfClass!(void, "drawPackedGlyphs:atPoint:", char*, NSPoint)(packedGlyphs, point);
120 }
121
122 static void setDefaultMiterLimit (CGFloat limit)
123 {
124 return invokeObjcSelfClass!(void, "setDefaultMiterLimit:", CGFloat)(limit);
125 }
126
127 static CGFloat defaultMiterLimit ()
128 {
129 return invokeObjcSelfClass!(CGFloat, "defaultMiterLimit");
130 }
131
132 static void setDefaultFlatness (CGFloat flatness)
133 {
134 return invokeObjcSelfClass!(void, "setDefaultFlatness:", CGFloat)(flatness);
135 }
136
137 static CGFloat defaultFlatness ()
138 {
139 return invokeObjcSelfClass!(CGFloat, "defaultFlatness");
140 }
141
142 static void setDefaultWindingRule (uint windingRule)
143 {
144 return invokeObjcSelfClass!(void, "setDefaultWindingRule:", uint)(windingRule);
145 }
146
147 static uint defaultWindingRule ()
148 {
149 return invokeObjcSelfClass!(uint, "defaultWindingRule");
150 }
151
152 static void setDefaultLineCapStyle (uint lineCapStyle)
153 {
154 return invokeObjcSelfClass!(void, "setDefaultLineCapStyle:", uint)(lineCapStyle);
155 }
156
157 static uint defaultLineCapStyle ()
158 {
159 return invokeObjcSelfClass!(uint, "defaultLineCapStyle");
160 }
161
162 static void setDefaultLineJoinStyle (uint lineJoinStyle)
163 {
164 return invokeObjcSelfClass!(void, "setDefaultLineJoinStyle:", uint)(lineJoinStyle);
165 }
166
167 static uint defaultLineJoinStyle ()
168 {
169 return invokeObjcSelfClass!(uint, "defaultLineJoinStyle");
170 }
171
172 static void setDefaultLineWidth (CGFloat lineWidth)
173 {
174 return invokeObjcSelfClass!(void, "setDefaultLineWidth:", CGFloat)(lineWidth);
175 }
176
177 static CGFloat defaultLineWidth ()
178 {
179 return invokeObjcSelfClass!(CGFloat, "defaultLineWidth");
180 }
181
182 void moveToPoint (NSPoint point)
183 {
184 return invokeObjcSelf!(void, "moveToPoint:", NSPoint)(point);
185 }
186
187 void lineToPoint (NSPoint point)
188 {
189 return invokeObjcSelf!(void, "lineToPoint:", NSPoint)(point);
190 }
191
192 void curveToPoint (NSPoint endPoint, NSPoint controlPoint1, NSPoint controlPoint2)
193 {
194 return invokeObjcSelf!(void, "curveToPoint:controlPoint1:controlPoint2:", NSPoint, NSPoint, NSPoint)(endPoint, controlPoint1, controlPoint2);
195 }
196
197 void closePath ()
198 {
199 return invokeObjcSelf!(void, "closePath");
200 }
201
202 void removeAllPoints ()
203 {
204 return invokeObjcSelf!(void, "removeAllPoints");
205 }
206
207 void relativeMoveToPoint (NSPoint point)
208 {
209 return invokeObjcSelf!(void, "relativeMoveToPoint:", NSPoint)(point);
210 }
211
212 void relativeLineToPoint (NSPoint point)
213 {
214 return invokeObjcSelf!(void, "relativeLineToPoint:", NSPoint)(point);
215 }
216
217 void relativeCurveToPoint (NSPoint endPoint, NSPoint controlPoint1, NSPoint controlPoint2)
218 {
219 return invokeObjcSelf!(void, "relativeCurveToPoint:controlPoint1:controlPoint2:", NSPoint, NSPoint, NSPoint)(endPoint, controlPoint1, controlPoint2);
220 }
221
222 CGFloat lineWidth ()
223 {
224 return invokeObjcSelf!(CGFloat, "lineWidth");
225 }
226
227 void setLineWidth (CGFloat lineWidth)
228 {
229 return invokeObjcSelf!(void, "setLineWidth:", CGFloat)(lineWidth);
230 }
231
232 uint lineCapStyle ()
233 {
234 return invokeObjcSelf!(uint, "lineCapStyle");
235 }
236
237 void setLineCapStyle (uint lineCapStyle)
238 {
239 return invokeObjcSelf!(void, "setLineCapStyle:", uint)(lineCapStyle);
240 }
241
242 uint lineJoinStyle ()
243 {
244 return invokeObjcSelf!(uint, "lineJoinStyle");
245 }
246
247 void setLineJoinStyle (uint lineJoinStyle)
248 {
249 return invokeObjcSelf!(void, "setLineJoinStyle:", uint)(lineJoinStyle);
250 }
251
252 uint windingRule ()
253 {
254 return invokeObjcSelf!(uint, "windingRule");
255 }
256
257 void setWindingRule (uint windingRule)
258 {
259 return invokeObjcSelf!(void, "setWindingRule:", uint)(windingRule);
260 }
261
262 CGFloat miterLimit ()
263 {
264 return invokeObjcSelf!(CGFloat, "miterLimit");
265 }
266
267 void setMiterLimit (CGFloat miterLimit)
268 {
269 return invokeObjcSelf!(void, "setMiterLimit:", CGFloat)(miterLimit);
270 }
271
272 CGFloat flatness ()
273 {
274 return invokeObjcSelf!(CGFloat, "flatness");
275 }
276
277 void setFlatness (CGFloat flatness)
278 {
279 return invokeObjcSelf!(void, "setFlatness:", CGFloat)(flatness);
280 }
281
282 void getLineDash (CGFloat* pattern, NSInteger* count, CGFloat* phase)
283 {
284 return invokeObjcSelf!(void, "getLineDash:count:phase:", CGFloat*, NSInteger*, CGFloat*)(pattern, count, phase);
285 }
286
287 void setLineDash (CGFloat* pattern, NSInteger count, CGFloat phase)
288 {
289 return invokeObjcSelf!(void, "setLineDash:count:phase:", CGFloat*, NSInteger, CGFloat)(pattern, count, phase);
290 }
291
292 void stroke ()
293 {
294 return invokeObjcSelf!(void, "stroke");
295 }
296
297 void fill ()
298 {
299 return invokeObjcSelf!(void, "fill");
300 }
301
302 void addClip ()
303 {
304 return invokeObjcSelf!(void, "addClip");
305 }
306
307 void setClip ()
308 {
309 return invokeObjcSelf!(void, "setClip");
310 }
311
312 NSBezierPath bezierPathByFlatteningPath ()
313 {
314 id result = invokeObjcSelf!(id, "bezierPathByFlatteningPath");
315 return result is this.objcObject ? this : (result !is null ? new NSBezierPath(result) : null);
316 }
317
318 NSBezierPath bezierPathByReversingPath ()
319 {
320 id result = invokeObjcSelf!(id, "bezierPathByReversingPath");
321 return result is this.objcObject ? this : (result !is null ? new NSBezierPath(result) : null);
322 }
323
324 void transformUsingAffineTransform (NSAffineTransform transform)
325 {
326 return invokeObjcSelf!(void, "transformUsingAffineTransform:", NSAffineTransform)(transform);
327 }
328
329 bool isEmpty ()
330 {
331 return invokeObjcSelf!(bool, "isEmpty");
332 }
333
334 NSPoint currentPoint ()
335 {
336 return invokeObjcSelf!(NSPoint, "currentPoint");
337 }
338
339 NSRect controlPointBounds ()
340 {
341 return invokeObjcSelf!(NSRect, "controlPointBounds");
342 }
343
344 NSRect bounds ()
345 {
346 return invokeObjcSelf!(NSRect, "bounds");
347 }
348
349 NSInteger elementCount ()
350 {
351 return invokeObjcSelf!(NSInteger, "elementCount");
352 }
353
354 uint elementAtIndex (NSInteger index, NSPointArray points)
355 {
356 return invokeObjcSelf!(uint, "elementAtIndex:associatedPoints:", NSInteger, NSPointArray)(index, points);
357 }
358
359 uint elementAtIndex (NSInteger index)
360 {
361 return invokeObjcSelf!(uint, "elementAtIndex:", NSInteger)(index);
362 }
363
364 void setAssociatedPoints (NSPointArray points, NSInteger index)
365 {
366 return invokeObjcSelf!(void, "setAssociatedPoints:atIndex:", NSPointArray, NSInteger)(points, index);
367 }
368
369 void appendBezierPath (NSBezierPath path)
370 {
371 return invokeObjcSelf!(void, "appendBezierPath:", NSBezierPath)(path);
372 }
373
374 void appendBezierPathWithRect (NSRect rect)
375 {
376 return invokeObjcSelf!(void, "appendBezierPathWithRect:", NSRect)(rect);
377 }
378
379 void appendBezierPathWithPoints (NSPointArray points, NSInteger count)
380 {
381 return invokeObjcSelf!(void, "appendBezierPathWithPoints:count:", NSPointArray, NSInteger)(points, count);
382 }
383
384 void appendBezierPathWithOvalInRect (NSRect rect)
385 {
386 return invokeObjcSelf!(void, "appendBezierPathWithOvalInRect:", NSRect)(rect);
387 }
388
389 void appendBezierPathWithArcWithCenter (NSPoint center, CGFloat radius, CGFloat startAngle, CGFloat endAngle, bool clockwise)
390 {
391 return invokeObjcSelf!(void, "appendBezierPathWithArcWithCenter:radius:startAngle:endAngle:clockwise:", NSPoint, CGFloat, CGFloat, CGFloat, bool)(center, radius, startAngle, endAngle, clockwise);
392 }
393
394 void appendBezierPathWithArcWithCenter (NSPoint center, CGFloat radius, CGFloat startAngle, CGFloat endAngle)
395 {
396 return invokeObjcSelf!(void, "appendBezierPathWithArcWithCenter:radius:startAngle:endAngle:", NSPoint, CGFloat, CGFloat, CGFloat)(center, radius, startAngle, endAngle);
397 }
398
399 void appendBezierPathWithArcFromPoint (NSPoint point1, NSPoint point2, CGFloat radius)
400 {
401 return invokeObjcSelf!(void, "appendBezierPathWithArcFromPoint:toPoint:radius:", NSPoint, NSPoint, CGFloat)(point1, point2, radius);
402 }
403
404 void appendBezierPathWithGlyph (uint glyph, NSFont font)
405 {
406 return invokeObjcSelf!(void, "appendBezierPathWithGlyph:inFont:", uint, NSFont)(glyph, font);
407 }
408
409 void appendBezierPathWithGlyphs (NSGlyph* glyphs, NSInteger count, NSFont font)
410 {
411 return invokeObjcSelf!(void, "appendBezierPathWithGlyphs:count:inFont:", NSGlyph*, NSInteger, NSFont)(glyphs, count, font);
412 }
413
414 void appendBezierPathWithPackedGlyphs (char* packedGlyphs)
415 {
416 return invokeObjcSelf!(void, "appendBezierPathWithPackedGlyphs:", char*)(packedGlyphs);
417 }
418
419 void appendBezierPathWithRoundedRect (NSRect rect, CGFloat xRadius, CGFloat yRadius)
420 {
421 return invokeObjcSelf!(void, "appendBezierPathWithRoundedRect:xRadius:yRadius:", NSRect, CGFloat, CGFloat)(rect, xRadius, yRadius);
422 }
423
424 bool containsPoint (NSPoint point)
425 {
426 return invokeObjcSelf!(bool, "containsPoint:", NSPoint)(point);
427 }
428
429 bool cachesBezierPath ()
430 {
431 return invokeObjcSelf!(bool, "cachesBezierPath");
432 }
433
434 void setCachesBezierPath (bool flag)
435 {
436 return invokeObjcSelf!(void, "setCachesBezierPath:", bool)(flag);
437 }
438
439 }
440