O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

NSAffineTransform — Mac OS X 10.0

Synopsis

This class is used to perform affine transform operations on NSBezierPath objects, as well as on NSSize, and NSPoint structures. An affine transform is an operation in which one coordinate system is mapped to another whereby the parallelism of lines is maintained, but not necessarily their length or angles.

NSAffineTransform has methods for performing several types of operations: rotation, scaling, and translation. These transforms are implemented in the methods scaleBy:, scaleXBy:yBy:, rotateByDegrees:, rotateByRadians:, and translateXBy:yBy:. Additionally, applications may define their own transformation matrices using the method setTransformStruct:. To apply a transform to an object we use transformBezierPath:, transformSize:, and transformPoint:.

image with no caption

@interface NSAffineTransform : NSObject <NSCoding, NSCopying>
                                  // Initializers
   - (id)initWithTransform:(NSAffineTransform *)transform;
                                  // Accessor Methods
   - (void)setTransformStruct:(NSAffineTransformStruct)transformStruct;
   - (NSAffineTransformStruct)transformStruct;
                                  // Class Methods
   + (NSAffineTransform *)transform;
                                  // Instance Methods
   - (void)invert;
   - (void)concat;
   - (void)set;
   - (void)appendTransform:(NSAffineTransform *)transform;
   - (void)prependTransform:(NSAffineTransform *)transform;
   - (void)rotateByDegrees:(float)angle;
   - (void)rotateByRadians ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required