drawArc method

void drawArc(
  1. Rect bounds,
  2. double startAngle,
  3. double sweepAngle,
  4. {PdfPen? pen}
)

Draws an arc representing a portion of an ellipse specified by a Rect structure.

//Creates a new PDF document.
PdfDocument doc = PdfDocument()
  ..pages
      .add()
      .graphics
      //Draw Arc.
      .drawArc(Rect.fromLTWH(10, 10, 100, 200), 90, 270, pen: PdfPens.red);
//Saves the document.
List<int> bytes = doc.save();
//Dispose the document.
doc.dispose();

Implementation

void drawArc(Rect bounds, double startAngle, double sweepAngle,
    {PdfPen? pen}) {
  if (sweepAngle != 0) {
    _helper._beginMarkContent();
    _helper._stateControl(pen, null, null, null);
    _constructArcPath(bounds.left, bounds.top, bounds.left + bounds.width,
        bounds.top + bounds.height, startAngle, sweepAngle);
    _drawPath(pen, null, PdfFillMode.winding, false);
    _helper.endMarkContent();
  }
}