drawBezier method
void
drawBezier(})
Draws a Bezier spline defined by four Offset structures.
//Creates a new PDF document.
PdfDocument doc = PdfDocument()
..pages
.add()
.graphics
//Draw Bezier
.drawBezier(
Offset(10, 10), Offset(10, 50), Offset(50, 80), Offset(80, 10),
pen: PdfPens.brown);
//Saves the document.
List<int> bytes = doc.save();
//Dispose the document.
doc.dispose();
Implementation
void drawBezier(Offset startPoint, Offset firstControlPoint,
Offset secondControlPoint, Offset endPoint,
{PdfPen? pen}) {
_helper._beginMarkContent();
_helper._stateControl(pen, null, null, null);
final PdfStreamWriter sw = _helper.streamWriter!;
sw.beginPath(startPoint.dx, startPoint.dy);
sw.appendBezierSegment(firstControlPoint.dx, firstControlPoint.dy,
secondControlPoint.dx, secondControlPoint.dy, endPoint.dx, endPoint.dy);
sw.strokePath();
_helper.endMarkContent();
}