drawPie method
Draws a pie shape defined by an ellipse specified by a Rect structure uiand two radial lines.
//Creates a new PDF document.
PdfDocument doc = PdfDocument()
..pages
.add()
.graphics
//Draw Pie
.drawPie(Rect.fromLTWH(10, 10, 100, 200), 90, 270,
pen: PdfPens.green, brush: PdfBrushes.red);
//Saves the document.
List<int> bytes = doc.save();
//Dispose the document.
doc.dispose();
Implementation
void drawPie(Rect bounds, double startAngle, double sweepAngle,
{PdfPen? pen, PdfBrush? brush}) {
if (sweepAngle != 0) {
_helper._beginMarkContent();
_helper._stateControl(pen, brush, null, null);
_constructArcPath(bounds.left, bounds.top, bounds.left + bounds.width,
bounds.top + bounds.height, startAngle, sweepAngle);
_helper.streamWriter!.appendLineSegment(
bounds.left + bounds.width / 2, bounds.top + bounds.height / 2);
_drawPath(pen, brush, PdfFillMode.winding, true);
_helper.endMarkContent();
}
}