Skip to content
This repository was archived by the owner on Jun 24, 2024. It is now read-only.

added a method for creating a square #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/p5.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down