Merge pull request #10 from gunyarakun/fix-invalid-return
[cocotron.git] / AppKit / NSAffineTransform.m
blob9382cf4bc99c873a076aa73745da7d3a2fbb1f53
1 #import <AppKit/NSAffineTransform.h>
2 #import <AppKit/NSBezierPath.h>
3 #import <ApplicationServices/ApplicationServices.h>
4 #import <AppKit/NSGraphicsContext.h>
6 @implementation NSAffineTransform(AppKit)
8 -(void)concat {
9    NSAffineTransformStruct atStruct=[self transformStruct];
10    CGAffineTransform       cgMatrix;
11    
12    cgMatrix.a=atStruct.m11;
13    cgMatrix.b=atStruct.m12;
14    cgMatrix.c=atStruct.m21;
15    cgMatrix.d=atStruct.m22;
16    cgMatrix.tx=atStruct.tX;
17    cgMatrix.ty=atStruct.tY;
19    CGContextConcatCTM([[NSGraphicsContext currentContext] graphicsPort],cgMatrix);
22 -(void)set {
23    NSAffineTransformStruct atStruct=[self transformStruct];
24    CGAffineTransform       cgMatrix;
25    
26    cgMatrix.a=atStruct.m11;
27    cgMatrix.b=atStruct.m12;
28    cgMatrix.c=atStruct.m21;
29    cgMatrix.d=atStruct.m22;
30    cgMatrix.tx=atStruct.tX;
31    cgMatrix.ty=atStruct.tY;
33    CGContextSetCTM([[NSGraphicsContext currentContext] graphicsPort],cgMatrix);
36 -(NSBezierPath *)transformBezierPath:(NSBezierPath *)bezierPath {
37    NSBezierPath *result=[[bezierPath copy] autorelease];
38    
39    [result transformUsingAffineTransform:self];
40    
41    return result;
44 @end