Instance Method

applying(_:)

Applies an affine transform to a rectangle.

Declaration

func applying(_ t: CGAffineTransform) -> CGRect

Parameters

t

The affine transform to apply to the rect parameter.

Return Value

The transformed rectangle.

Discussion

Because affine transforms do not preserve rectangles in general, this function returns the smallest rectangle that contains the transformed corner points of the rect parameter. If the affine transform t consists solely of scaling and translation operations, then the returned rectangle coincides with the rectangle constructed from the four transformed corners.

See Also

Creating Derived Rectangles

var standardized: CGRect

Returns a rectangle with a positive width and height.

var integral: CGRect

Returns the smallest rectangle that results from converting the source rectangle values to integers.

func insetBy(dx: CGFloat, dy: CGFloat) -> CGRect

Returns a rectangle that is smaller or larger than the source rectangle, with the same center point.

func offsetBy(dx: CGFloat, dy: CGFloat) -> CGRect

Returns a rectangle with an origin that is offset from that of the source rectangle.

func union(CGRect) -> CGRect

Returns the smallest rectangle that contains the two source rectangles.

func intersection(CGRect) -> CGRect

Returns the intersection of two rectangles.

enum CGRectEdge

Coordinates that establish the edges of a rectangle.