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

added a method for creating a circle #14

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 @@ -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) {
Expand Down