Structures
The following structures are available globally.
-
An affine transformation matrix is used to rotate, scale, translate, or skew the objects you draw in a graphics context. The
AffineTransform
type provides functions for creating, concatenating, and applying affine transformations.Affine transforms are represented by a 3 by 3 matrix:
/ a b 0 \ | c d 0 | \ tx ty 1 /
Because the third column is always
(0,0,1)
, theAffineTransform
structure contains values for only the first two columns.Conceptually, an affine transform multiplies a row vector representing each point
(x,y)
in your drawing by this matrix, producing a vector that represents the corresponding point(x’,y’)
:/ a b 0 \ (x’ y’ 1) = (x y 1) × | c d 0 | \ tx ty 1 /
Given the 3 by 3 matrix, the following equations are used to transform a point
(x, y)
in one coordinate system into a resultant point(x’,y’)
in another coordinate system.x’ = a * x + c * y + tx y’ = b * x + d * y + ty
The matrix thereby “links” two coordinate systems — it specifies how points in one coordinate system map to points in another.
Note that you do not typically need to create affine transforms directly. If you want only to draw an object that is scaled or rotated, for example, it is not necessary to construct an affine transform to do so. The most direct way to manipulate your drawing — whether by movement, scaling, or rotation — is to call the functions
See moretranslateBy(x:y:)
,scaleBy(x:y:)
, orrotate(by:)
, respectively.Declaration
Swift
public struct AffineTransform : Hashable
-
This structure represents a color. Property values must be between 0 and 1.
Supported color spaces:
See moreDeclaration
Swift
public struct Color : Hashable
-
Dash pattern for lines in a page.
See moreDeclaration
Swift
public struct DashStyle : Hashable
-
A structure that contains width and height values.
See moreDeclaration
Swift
public struct Size : Hashable
-
A structure that contains a point in a two-dimensional coordinate system.
See moreDeclaration
Swift
public struct Point : Hashable
-
A structure that contains a two-dimensional vector.
See moreDeclaration
Swift
public struct Vector : Hashable
-
A structure that contains the location and dimensions of a rectangle.
See moreDeclaration
Swift
public struct Rectangle : Hashable
-
A type for graphics paths: mathematical descriptions of shapes or lines to be drawn in a
See moreDrawingContext
.Declaration
Swift
public struct Path : Hashable
-
Represents a grid that can be drawn on a PDF page.
See moreDeclaration
Swift
public struct Grid : Equatable