---
title: "addEllipse(in:transform:)"
framework: coregraphics
role: symbol
role_heading: Instance Method
path: "coregraphics/cgmutablepath/addellipse(in:transform:)"
---

# addEllipse(in:transform:)

Adds an ellipse that fits inside the specified rectangle.

## Declaration

```swift
func addEllipse(in rect: CGRect, transform: CGAffineTransform = .identity)
```

## 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

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.

## See Also

### Constructing a Graphics Path

- [move(to:transform:)](coregraphics/cgmutablepath/move(to:transform:).md)
- [addLine(to:transform:)](coregraphics/cgmutablepath/addline(to:transform:).md)
- [addLines(between:transform:)](coregraphics/cgmutablepath/addlines(between:transform:).md)
- [addRect(_:transform:)](coregraphics/cgmutablepath/addrect(_:transform:).md)
- [addRects(_:transform:)](coregraphics/cgmutablepath/addrects(_:transform:).md)
- [addRoundedRect(in:cornerWidth:cornerHeight:transform:)](coregraphics/cgmutablepath/addroundedrect(in:cornerwidth:cornerheight:transform:).md)
- [addArc(center:radius:startAngle:endAngle:clockwise:transform:)](coregraphics/cgmutablepath/addarc(center:radius:startangle:endangle:clockwise:transform:).md)
- [addArc(tangent1End:tangent2End:radius:transform:)](coregraphics/cgmutablepath/addarc(tangent1end:tangent2end:radius:transform:).md)
- [addRelativeArc(center:radius:startAngle:delta:transform:)](coregraphics/cgmutablepath/addrelativearc(center:radius:startangle:delta:transform:).md)
- [addCurve(to:control1:control2:transform:)](coregraphics/cgmutablepath/addcurve(to:control1:control2:transform:).md)
- [addQuadCurve(to:control:transform:)](coregraphics/cgmutablepath/addquadcurve(to:control:transform:).md)
- [addPath(_:transform:)](coregraphics/cgmutablepath/addpath(_:transform:).md)
- [closeSubpath()](coregraphics/cgmutablepath/closesubpath().md)
