<!--
{
  "documentType" : "article",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/cgaffinetransform",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "CGAffineTransform"
}
-->

# CGAffineTransform

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

## Discussion

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](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/Introduction/Introduction.html#//apple_ref/doc/uid/TP30001066).

You typically do not need to create an affine transform directly—[`CGContext`](/documentation/CoreGraphics/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:)`](/documentation/CoreGraphics/CGContext/scaleBy(x:y:)), [`rotate(by:)`](/documentation/CoreGraphics/CGContext/rotate(by:)), [`translateBy(x:y:)`](/documentation/CoreGraphics/CGContext/translateBy(x:y:)), or [`concatenate(_:)`](/documentation/CoreGraphics/CGContext/concatenate(_:)).

## Topics

### Creating an Affine Transformation Matrix

[`CGAffineTransformMake(_:_:_:_:_:_:)`](/documentation/CoreGraphics/CGAffineTransformMake(_:_:_:_:_:_:))

Returns an affine transformation matrix constructed from values you provide.

[`CGAffineTransformMakeRotation(_:)`](/documentation/CoreGraphics/CGAffineTransformMakeRotation(_:))

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

[`CGAffineTransformMakeScale(_:_:)`](/documentation/CoreGraphics/CGAffineTransformMakeScale(_:_:))

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

[`CGAffineTransformMakeTranslation(_:_:)`](/documentation/CoreGraphics/CGAffineTransformMakeTranslation(_:_:))

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

### Modifying Affine Transformations

[`CGAffineTransformTranslate(_:_:_:)`](/documentation/CoreGraphics/CGAffineTransformTranslate(_:_:_:))

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

[`CGAffineTransformScale(_:_:_:)`](/documentation/CoreGraphics/CGAffineTransformScale(_:_:_:))

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

[`CGAffineTransformRotate(_:_:)`](/documentation/CoreGraphics/CGAffineTransformRotate(_:_:))

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

[`CGAffineTransformInvert(_:)`](/documentation/CoreGraphics/CGAffineTransformInvert(_:))

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

[`CGAffineTransformConcat(_:_:)`](/documentation/CoreGraphics/CGAffineTransformConcat(_:_:))

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

### Applying Affine Transformations

[`CGPointApplyAffineTransform(_:_:)`](/documentation/CoreGraphics/CGPointApplyAffineTransform(_:_:))

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

[`CGSizeApplyAffineTransform(_:_:)`](/documentation/CoreGraphics/CGSizeApplyAffineTransform(_:_:))

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

[`CGRectApplyAffineTransform(_:_:)`](/documentation/CoreGraphics/CGRectApplyAffineTransform(_:_:))

Applies an affine transform to a rectangle.

### Evaluating Affine Transforms

[`CGAffineTransformIsIdentity(_:)`](/documentation/CoreGraphics/CGAffineTransformIsIdentity(_:))

Checks whether an affine transform is the identity transform.

[`CGAffineTransformEqualToTransform(_:_:)`](/documentation/CoreGraphics/CGAffineTransformEqualToTransform(_:_:))

Checks whether two affine transforms are equal.

### Data Types

  <doc://com.apple.documentation/documentation/CoreFoundation/CGAffineTransform>

### Constants

[`CGAffineTransformIdentity`](/documentation/CoreGraphics/CGAffineTransformIdentity)

The identity transform.

## See Also

  [Quartz 2D Programming Guide](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/Introduction/Introduction.html#//apple_ref/doc/uid/TP30001066)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)