addRect(_:transform:)
Adds a rectangular subpath to the path.
Declaration
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
Constructing a Graphics Path
move(to:transform:)addLine(to:transform:)addLines(between:transform:)addRects(_:transform:)addEllipse(in:transform:)addRoundedRect(in:cornerWidth:cornerHeight:transform:)addArc(center:radius:startAngle:endAngle:clockwise:transform:)addArc(tangent1End:tangent2End:radius:transform:)addRelativeArc(center:radius:startAngle:delta:transform:)addCurve(to:control1:control2:transform:)addQuadCurve(to:control:transform:)addPath(_:transform:)closeSubpath()