addRoundedRect(in:cornerSize:style:transform:)
Adds a rounded rectangle to the path.
Declaration
mutating func addRoundedRect(in rect: CGRect, cornerSize: CGSize, style: RoundedCornerStyle = .continuous, transform: CGAffineTransform = .identity)Parameters
- rect:
A rectangle, specified in user space coordinates.
- cornerSize:
The size of the corners, specified in user space coordinates.
- style:
The corner style. Defaults to the
continousstyle if not specified. - 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 rounded rectangle to a path, starting by moving to the center of the right edge and then adding lines and curves counter-clockwise to create a rounded 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:)addRect(_:transform:)addRects(_:transform:)addRelativeArc(center:radius:startAngle:delta:transform:)closeSubpath()