Structure

# AffineTransform

A graphics coordinate transformation.

## Topics

### Creating Transforms

`init()`

Creates an affine transformation matrix with identity values.

`init(rotationByDegrees: CGFloat)`

Creates an affine transformation matrix from a rotation value (angle in degrees). The matrix takes the following form:

`init(rotationByRadians: CGFloat)`

Creates an affine transformation matrix from rotation value (angle in radians). The matrix takes the following form:

`init(scale: CGFloat)`

Creates an affine transformation matrix from scaling a single value. The matrix takes the following form:

`init(scaleByX: CGFloat, byY: CGFloat)`

Creates an affine transformation matrix from scaling values. The matrix takes the following form:

`init(translationByX: CGFloat, byY: CGFloat)`

Creates an affine transformation matrix from translation values. The matrix takes the following form:

### Getting the Identity Transform

`static let identity: AffineTransform`

An identity affine transformation matrix

### Accumulating Tranformations

`func rotate(byDegrees: CGFloat)`

Mutates an affine transformation matrix from a rotation value (angle α in degrees).

`func rotate(byRadians: CGFloat)`

Mutates an affine transformation matrix from a rotation value (angle α in radians).

`func scale(CGFloat)`

Mutates an affine transformation matrix to perform the given scaling in both x and y dimensions.

`func scale(x: CGFloat, y: CGFloat)`

Mutates an affine transformation matrix to perform a scaling in each of the x and y dimensions.

`func translate(x: CGFloat, y: CGFloat)`

Mutates an affine transformation matrix to perform the given translation.

`func append(AffineTransform)`

Mutates an affine transformation by appending the specified matrix.

`func prepend(AffineTransform)`

Mutates an affine transformation by prepending the specified matrix.

`func invert()`

Inverts the transformation matrix if possible.

`func inverted() -> AffineTransform?`

Returns an inverted version of the matrix if possible, or `nil` if not.

### Transforming Data and Objects

`func transform(NSPoint) -> NSPoint`

Applies the receiver’s transform to the specified point and returns the result.

`func transform(NSSize) -> NSSize`

Applies the receiver’s transform to the specified size and returns the results.

### Accessing the Transformation Matrix

`var m11: CGFloat`

An element of the transform matrix that contributes scaling, rotation, and shear.

`var m12: CGFloat`

An element of the transform matrix that contributes scaling, rotation, and shear.

`var m21: CGFloat`

An element of the transform matrix that contributes scaling, rotation, and shear.

`var m22: CGFloat`

An element of the transform matrix that contributes scaling, rotation, and shear.

`var tX: CGFloat`

An element of the transform matrix that contributes translation.

`var tY: CGFloat`

An element of the transform matrix that contributes translation.

### Describing a Transform

`var description: String`

A textual description of the transform.

`var debugDescription: String`

A textual description of the transform suitable for debugging.

`var hashValue: Int`

The computed hash value for the transform.

### Using Reference Types

`class NSAffineTransform`

An object representing a graphics coordinate transformation that bridges to `AffineTransform`; use `NSAffineTransform` when you need reference semantics or other Foundation-specific behavior.

`typealias AffineTransform.ReferenceType`

An alias for this value type's equivalent reference type.

### Operator Functions

`static func != (AffineTransform, AffineTransform) -> Bool`

Returns a Boolean value indicating whether two values are not equal.

## Relationships

### Geometry

`struct CGFloat`

The basic type for floating-point scalar values in Core Graphics and related frameworks.

`typealias NSPoint`

A point in a Cartesian coordinate system.

`typealias NSSize`

A two-dimensional size.

`struct NSEdgeInsets`

A description of the distance between the edges of two rectangles.