# CGAffineTransform

An affine transformation matrix for use in drawing 2D graphics.

## Overview

A transformation specifies how points in one coordinate system map to points in another coordinate system. An affine transformation is a special type of mapping that preserves parallel lines in a path but does not necessarily preserve lengths or angles. Scaling, rotation, and translation are the most commonly used manipulations supported by affine transforms, but skewing is also possible.

For more information on how to create, concatenate, and apply affine transformations, see Quartz 2D Programming Guide.

You typically do not need to create an affine transform directly—CGContext describes functions that modify the current affine transform. If you don’t plan to reuse an affine transform, you may want to use `scaleBy(x:y:)`, `rotate(by:)`, `translateBy(x:y:)`, or `concatenate(_:)`.

## Symbols

### Creating an Affine Transformation Matrix

`init(rotationAngle: CGFloat)`

Returns an affine transformation matrix constructed from a rotation value you provide.

`init(scaleX: CGFloat, y: CGFloat)`

Returns an affine transformation matrix constructed from scaling values you provide.

`init(translationX: CGFloat, y: CGFloat)`

Returns an affine transformation matrix constructed from translation values you provide.

### Modifying Affine Transformations

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

Returns an affine transformation matrix constructed by translating an existing affine transform.

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

Returns an affine transformation matrix constructed by scaling an existing affine transform.

`func rotated(by: CGFloat)`

Returns an affine transformation matrix constructed by rotating an existing affine transform.

`func inverted()`

Returns an affine transformation matrix constructed by inverting an existing affine transform.

`func concatenating(CGAffineTransform)`

Returns an affine transformation matrix constructed by combining two existing affine transforms.

### Applying Affine Transformations

`func applying(CGAffineTransform)`

Returns the point resulting from an affine transformation of an existing point.

`func applying(CGAffineTransform)`

Returns the height and width resulting from a transformation of an existing height and width.

`func applying(CGAffineTransform)`

Applies an affine transform to a rectangle.

### Evaluating Affine Transforms

`var isIdentity: Bool`

Checks whether an affine transform is the identity transform.

### Data Types

`CGAffineTransform`

An affine transformation matrix for use in drawing 2D graphics.