Skip to content

Commit

Permalink
Handy matrix thingummy for slanting a bezier path or other drawings.
Browse files Browse the repository at this point in the history
  • Loading branch information
uliwitness committed Mar 14, 2010
1 parent df3f6b8 commit a7e2063
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
16 changes: 16 additions & 0 deletions NSAffineTransform+Shearing.h
@@ -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
28 changes: 28 additions & 0 deletions NSAffineTransform+Shearing.m
@@ -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

0 comments on commit a7e2063

Please sign in to comment.