mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-11-23 12:09:51 +00:00
47 lines
1.2 KiB
Objective-C
47 lines
1.2 KiB
Objective-C
#import <AppKit/NSAffineTransform.h>
|
|
#import <AppKit/NSBezierPath.h>
|
|
#import <AppKit/NSGraphicsContext.h>
|
|
#import <ApplicationServices/ApplicationServices.h>
|
|
|
|
@implementation NSAffineTransform (AppKit)
|
|
|
|
- (void) concat {
|
|
NSAffineTransformStruct atStruct = [self transformStruct];
|
|
CGAffineTransform cgMatrix;
|
|
|
|
cgMatrix.a = atStruct.m11;
|
|
cgMatrix.b = atStruct.m12;
|
|
cgMatrix.c = atStruct.m21;
|
|
cgMatrix.d = atStruct.m22;
|
|
cgMatrix.tx = atStruct.tX;
|
|
cgMatrix.ty = atStruct.tY;
|
|
|
|
CGContextConcatCTM([[NSGraphicsContext currentContext] graphicsPort],
|
|
cgMatrix);
|
|
}
|
|
|
|
- (void) set {
|
|
NSAffineTransformStruct atStruct = [self transformStruct];
|
|
CGAffineTransform cgMatrix;
|
|
|
|
cgMatrix.a = atStruct.m11;
|
|
cgMatrix.b = atStruct.m12;
|
|
cgMatrix.c = atStruct.m21;
|
|
cgMatrix.d = atStruct.m22;
|
|
cgMatrix.tx = atStruct.tX;
|
|
cgMatrix.ty = atStruct.tY;
|
|
|
|
CGContextSetCTM([[NSGraphicsContext currentContext] graphicsPort],
|
|
cgMatrix);
|
|
}
|
|
|
|
- (NSBezierPath *) transformBezierPath: (NSBezierPath *) bezierPath {
|
|
NSBezierPath *result = [[bezierPath copy] autorelease];
|
|
|
|
[result transformUsingAffineTransform: self];
|
|
|
|
return result;
|
|
}
|
|
|
|
@end
|