Mercurial > projects > dstep
annotate dstep/foundation/NSAffineTransform.d @ 15:7ff919f595d5
Added the Foundation framework, again
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 03 Aug 2009 15:31:48 +0200 |
parents | 89f3c3ef1fd2 |
children | 19885b43130e |
rev | line source |
---|---|
14 | 1 /** |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Aug 3, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.foundation.NSAffineTransform; | |
8 | |
9 import dstep.applicationservices.coregraphics.CGAffineTransform; | |
10 import dstep.foundation.NSGeometry; | |
11 import dstep.foundation.NSObject; | |
12 import dstep.objc.bridge.Bridge; | |
13 import dstep.objc.objc : id; | |
14 | |
15 struct NSAffineTransformStruct | |
16 { | |
17 CGFloat m11; | |
18 CGFloat m12; | |
19 CGFloat m21; | |
20 CGFloat m22; | |
21 CGFloat tX; | |
22 CGFloat tY; | |
23 } | |
24 | |
25 class NSAffineTransform : NSObject, INSCopying, INSCoding | |
26 { | |
27 mixin ObjcWrap; | |
28 | |
29 static NSAffineTransform transform () | |
30 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
31 return invokeObjcSelfClass!(NSAffineTransform, "transform"); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
32 } |
14 | 33 |
34 Object initWithTransform (NSAffineTransform transform) | |
35 { | |
36 return invokeObjcSelf!(Object, "initWithTransform:", NSAffineTransform)(transform); | |
37 } | |
38 | |
39 this (NSAffineTransform transform) | |
40 { | |
41 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
42 id result = Bridge.invokeObjcMethod!(id, "initWithTransform:", NSAffineTransform)(objcObject, transform); | |
43 | |
44 if (result) | |
45 objcObject = ret; | |
46 | |
47 dObject = this; | |
48 } | |
49 | |
50 void translateXBy (CGFloat deltaX, CGFloat deltaY) | |
51 { | |
52 return invokeObjcSelf!(void, "translateXBy:yBy:", CGFloat, CGFloat)(deltaX, deltaY); | |
53 } | |
54 | |
55 void rotateByDegrees (CGFloat angle) | |
56 { | |
57 return invokeObjcSelf!(void, "rotateByDegrees:", CGFloat)(angle); | |
58 } | |
59 | |
60 void rotateByRadians (CGFloat angle) | |
61 { | |
62 return invokeObjcSelf!(void, "rotateByRadians:", CGFloat)(angle); | |
63 } | |
64 | |
65 void scaleBy (CGFloat scale) | |
66 { | |
67 return invokeObjcSelf!(void, "scaleBy:", CGFloat)(scale); | |
68 } | |
69 | |
70 void scaleXBy (CGFloat scaleX, CGFloat scaleY) | |
71 { | |
72 return invokeObjcSelf!(void, "scaleXBy:yBy:", CGFloat, CGFloat)(scaleX, scaleY); | |
73 } | |
74 | |
75 void invert () | |
76 { | |
77 return invokeObjcSelf!(void, "invert"); | |
78 } | |
79 | |
80 void appendTransform (NSAffineTransform transform) | |
81 { | |
82 return invokeObjcSelf!(void, "appendTransform:", NSAffineTransform)(transform); | |
83 } | |
84 | |
85 void prependTransform (NSAffineTransform transform) | |
86 { | |
87 return invokeObjcSelf!(void, "prependTransform:", NSAffineTransform)(transform); | |
88 } | |
89 | |
90 NSPoint transformPoint (NSPoint aPoint) | |
91 { | |
92 return invokeObjcSelf!(NSPoint, "transformPoint:", NSPoint)(aPoint); | |
93 } | |
94 | |
95 NSSize transformSize (NSSize aSize) | |
96 { | |
97 return invokeObjcSelf!(NSSize, "transformSize:", NSSize)(aSize); | |
98 } | |
99 | |
100 NSAffineTransformStruct transformStruct () | |
101 { | |
102 return invokeObjcSelf!(NSAffineTransformStruct, "transformStruct"); | |
103 } | |
104 | |
105 void setTransformStruct (NSAffineTransformStruct transformStruct) | |
106 { | |
107 return invokeObjcSelf!(void, "setTransformStruct:", NSAffineTransformStruct)(transformStruct); | |
108 } | |
109 | |
110 Object copyWithZone (NSZone* zone) | |
111 { | |
112 return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); | |
113 } | |
114 | |
115 void encodeWithCoder (NSCoder aCoder) | |
116 { | |
117 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); | |
118 } | |
119 | |
120 Object initWithCoder (NSCoder aDecoder) | |
121 { | |
122 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); | |
123 } | |
124 | |
125 this (NSCoder aDecoder) | |
126 { | |
127 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
128 id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); | |
129 | |
130 if (result) | |
131 objcObject = ret; | |
132 | |
133 dObject = this; | |
134 } | |
135 } | |
136 |