From 34c1e6b4e9462e4bc16c0d655f3fb8dcde26c062 Mon Sep 17 00:00:00 2001 From: NIBU Date: Thu, 30 Mar 2023 13:58:44 +0530 Subject: [PATCH] added a method for creating a square --- lib/p5.dart | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/p5.dart b/lib/p5.dart index 527978d..26e5269 100644 --- a/lib/p5.dart +++ b/lib/p5.dart @@ -337,6 +337,16 @@ class PPainter extends ChangeNotifier implements CustomPainter { } } + void square(double x, double y, double s) { + final rect = Offset(x, y) & Size(s, s); + if (useFill) { + paintCanvas.drawRect(rect, fillPaint); + } + if (useStroke) { + paintCanvas.drawRect(rect, strokePaint); + } + } + void quad(num x1, num y1, num x2, num y2, num x3, num y3, num x4, num y4) { beginShape(); vertex(x1, y1);