CGAffineTransform

extension CGAffineTransform
  • Returns a transform which scales by (sx, sy). Equivalent to CGAffineTransformMakeScale(sx, sy).

    Declaration

    Swift

    public static func scale(_ sx: CGFloat, _ sy: CGFloat) -> CGAffineTransform

    Parameters

    sx

    The x scale.

    sy

    The y scale.

    Return Value

    A transform scaled by (sx, sy).

  • Returns a transform which translates by (tx, ty). Equivalent to CGAffineTransformMakeTranslation(tx, ty).

    Declaration

    Swift

    public static func translate(_ tx: CGFloat, _ ty: CGFloat) -> CGAffineTransform

    Parameters

    tx

    The x translation.

    ty

    The y translation.

    Return Value

    A transform translated by (tx, ty).

  • Returns a transform which rotates by angle radians. Equivalent to CGAffineTransformMakeRotation(angle).

    Declaration

    Swift

    public static func rotate(_ angle: CGFloat) -> CGAffineTransform

    Parameters

    angle

    The rotation angle in radians.

    Return Value

    A transform rotated by angle radians.

  • Returns a transform which inverts another transform. Equivalent to CGAffineTransformInvert(transform).

    Declaration

    Swift

    public static func invert(_ transform: CGAffineTransform) -> CGAffineTransform

    Parameters

    transform

    The transform to invert.

    Return Value

    An inverted transform.

  • Returns the concatenation of an array of transforms.

    Declaration

    Swift

    public static func concat(_ transforms: CGAffineTransform...) -> CGAffineTransform

    Parameters

    transforms

    The array of transforms to concatenate.

    Return Value

    A concatenation of the array of transforms.

  • Concatenates two CGAffineTransforms and returns the result. Equivalent to CGAffineTransformConcat(lhs, rhs).

    Declaration

    Swift

    public static func * (lhs: CGAffineTransform, rhs: CGAffineTransform) -> CGAffineTransform

    Parameters

    lhs

    The first transform.

    rhs

    The second transform.

    Return Value

    The concatentation of the two transforms.