From 48afd0f3c0c26b4882051edb39f9adf8c1bdff86 Mon Sep 17 00:00:00 2001 From: NIBU Date: Thu, 30 Mar 2023 10:49:33 +0530 Subject: [PATCH] added a method for creating a circle --- lib/p5.dart | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/p5.dart b/lib/p5.dart index 527978d..4f37f12 100644 --- a/lib/p5.dart +++ b/lib/p5.dart @@ -314,6 +314,16 @@ class PPainter extends ChangeNotifier implements CustomPainter { useFill = false; } + void circle(double x, double y, double radius) { + final rect = Offset(x - radius / 2, y - radius / 2) & Size(radius, radius); + if (useFill) { + paintCanvas.drawOval(rect, fillPaint); + } + if (useStroke) { + paintCanvas.drawOval(rect, strokePaint); + } + } + void ellipse(double x, double y, double w, double h) { final rect = new Offset(x - w / 2, y - h / 2) & new Size(w, h); if (useFill) {