forked from uliwitness/UliKit
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handy matrix thingummy for slanting a bezier path or other drawings.
- Loading branch information
1 parent
df3f6b8
commit a7e2063
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
// | |||
// NSAffineTransform+Shearing.h | |||
// Propaganda | |||
// | |||
// Created by Uli Kusterer on 14.03.10. | |||
// Copyright 2010 The Void Software. All rights reserved. | |||
// | |||
|
|||
#import <Cocoa/Cocoa.h> | |||
|
|||
|
|||
@interface NSAffineTransform (UKShearing) | |||
|
|||
-(void) shearXBy: (CGFloat)xFraction yBy: (CGFloat)yFraction; | |||
|
|||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,28 @@ | |||
// | |||
// NSAffineTransform+Shearing.m | |||
// Propaganda | |||
// | |||
// Created by Uli Kusterer on 14.03.10. | |||
// Copyright 2010 The Void Software. All rights reserved. | |||
// | |||
|
|||
#import "NSAffineTransform+Shearing.h" | |||
|
|||
|
|||
@implementation NSAffineTransform (UKShearing) | |||
|
|||
-(void) shearXBy: (CGFloat)xFraction yBy: (CGFloat)yFraction | |||
{ | |||
NSAffineTransform* theTransform = [NSAffineTransform transform]; | |||
NSAffineTransformStruct transformStruct = { 0 }; | |||
|
|||
transformStruct.m11 = 1.0; | |||
transformStruct.m12 = yFraction; | |||
transformStruct.m21 = xFraction; | |||
transformStruct.m22 = 1.0; | |||
|
|||
[theTransform setTransformStruct: transformStruct]; | |||
[self prependTransform: theTransform]; | |||
} | |||
|
|||
@end |