Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Handy matrix thingummy for slanting a bezier path or other drawings.

  • Loading branch information...
commit a7e20635cbf8b948f5a31bcb3bbac1fe92b0f03d 1 parent df3f6b8
@uliwitness uliwitness authored
Showing with 44 additions and 0 deletions.
  1. +16 −0 NSAffineTransform+Shearing.h
  2. +28 −0 NSAffineTransform+Shearing.m
View
16 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
View
28 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
Please sign in to comment.
Something went wrong with that request. Please try again.