addRect(_:transform:)
Adds a rectangular subpath to the path.
Declaration
mutating func addRect(_ rect: CGRect, transform: CGAffineTransform = .identity)Parameters
- rect:
A rectangle, specified in user space coordinates.
- transform:
An affine transform to apply to the rectangle before adding to the path. Defaults to the identity transform if not specified.
Discussion
This is a convenience function that adds a rectangle to a path, starting by moving to the bottom-left corner and then adding lines counter-clockwise to create a rectangle, closing the subpath.
See Also
Drawing a path
move(to:)addArc(center:radius:startAngle:endAngle:clockwise:transform:)addArc(tangent1End:tangent2End:radius:transform:)addCurve(to:control1:control2:)addEllipse(in:transform:)addLine(to:)addLines(_:)addPath(_:transform:)addQuadCurve(to:control:)addRects(_:transform:)addRelativeArc(center:radius:startAngle:delta:transform:)addRoundedRect(in:cornerSize:style:transform:)closeSubpath()