Instance Method

Adds an ellipse that fits inside the specified rectangle.

## Parameters

`rect`

A rectangle that defines the area for the ellipse to fit in.

`transform`

An affine transform to apply to the ellipse before adding to the path. Defaults to the identity transform if not specified.

## Discussion

The ellipse is approximated by a sequence of Bézier curves. Its center is the midpoint of the rectangle defined by the `rect` parameter. If the rectangle is square, then the ellipse is circular with a radius equal to one-half the width (or height) of the rectangle. If the `rect` parameter specifies a rectangular shape, then the major and minor axes of the ellipse are defined by the width and height of the rectangle.

The ellipse forms a complete subpath of the path—that is, the ellipse drawing starts with a move-to operation and ends with a close-subpath operation, with all moves oriented in the clockwise direction.

### Constructing a Graphics Path

`func move(to: CGPoint, transform: CGAffineTransform)`

Begins a new subpath at the specified point.

`func addLine(to: CGPoint, transform: CGAffineTransform)`

Appends a straight line segment from the current point to the specified point.

`func addLines(between: [CGPoint], transform: CGAffineTransform)`

Adds a sequence of connected straight-line segments to the path.

`func addRects([CGRect], transform: CGAffineTransform)`

Adds a set of rectangular subpaths to the path.

`func addArc(tangent1End: CGPoint, tangent2End: CGPoint, radius: CGFloat, transform: CGAffineTransform)`

Adds an arc of a circle to the path, specified with a radius and two tangent lines.

`func addCurve(to: CGPoint, control1: CGPoint, control2: CGPoint, transform: CGAffineTransform)`

Adds a cubic Bézier curve to the path, with the specified end point and control points.

`func addQuadCurve(to: CGPoint, control: CGPoint, transform: CGAffineTransform)`

Adds a quadratic Bézier curve to the path, with the specified end point and control point.

`func closeSubpath()`

Closes and completes a subpath in a mutable graphics path.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.