drawEllipse method

void drawEllipse(
  1. Rect bounds, {
  2. PdfPen? pen,
  3. PdfBrush? brush,
})

Draws an ellipse specified by a bounding Rect structure.

//Creates a new PDF document.
PdfDocument doc = PdfDocument()
  ..pages
      .add()
      .graphics
      //Draw ellipse
      .drawEllipse(Rect.fromLTWH(10, 10, 100, 100),
          pen: PdfPens.black, brush: PdfBrushes.red);
//Saves the document.
List<int> bytes = doc.save();
//Dispose the document.
doc.dispose();

Implementation

void drawEllipse(Rect bounds, {PdfPen? pen, PdfBrush? brush}) {
  _helper._beginMarkContent();
  _helper._stateControl(pen, brush, null, null);
  _constructArcPath(
      bounds.left, bounds.top, bounds.right, bounds.bottom, 0, 360);
  _drawPath(pen, brush, PdfFillMode.winding, true);
  _helper.endMarkContent();
}