Structureswift 6.0.1Foundation
AffineTransform
AffineTransform represents an affine transformation matrix of the following form:
struct AffineTransform
[ m11 m12 0 ]
[ m21 m22 0 ]
[ tX tY 1 ]
Citizens in Foundation
Conformances
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol Equatable
A type that can be compared for value equality.
protocol Escapable
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol ReferenceConvertible
Decorates types which are backed by a Foundation reference type.
protocol Sendable
Typealiases
Type members
init(
) Creates an affine transformation matrix with identity values.
init(from: any Decoder
) throws init(m11: CGFloat, m12: CGFloat, m21: CGFloat, m22: CGFloat, tX: CGFloat, tY: CGFloat
) Creates an affine transformation.
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:
static let identity: AffineTransform
An identity affine transformation matrix
Instance members
var debugDescription: String
A textual description of the transform suitable for debugging.
var description: String
A textual description of the transform.
var m11: CGFloat
var m12: CGFloat
var m21: CGFloat
var m22: CGFloat
var tX: CGFloat
var tY: CGFloat
func append(AffineTransform
) Mutates an affine transformation by appending the specified matrix.
func encode(to: any Encoder
) throws func invert(
) Inverts the transformation matrix if possible. Matrices with a determinant that is less than the smallest valid representation of a double value greater than zero are considered to be invalid for representing as an inverse. If the input AffineTransform can potentially fall into this case then the inverted() method is suggested to be used instead since that will return an optional value that will be nil in the case that the matrix cannot be inverted.
func inverted(
) -> AffineTransform? Returns an inverted version of the matrix if possible, or nil if not.
func prepend(AffineTransform
) Mutates an affine transformation by prepending the specified matrix.
func rotate(byDegrees: CGFloat
) Mutates an affine transformation matrix from a rotation value (angle α in degrees). The matrix takes the following form:
func rotate(byRadians: CGFloat
) Mutates an affine transformation matrix from a rotation value (angle α in radians). The matrix takes the following form:
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 transform(CGSize
) -> CGSize Applies the transform to the specified size and returns the result.
func transform(CGPoint
) -> CGPoint Applies the transform to the specified point and returns the result.
func translate(x: CGFloat, y: CGFloat
)
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.