Merge pull request #196 from zetashift/master

Add fillCircle and strokeCircle taking a Circle for Context
This commit is contained in:
treeform 2021-05-22 14:50:03 -07:00 committed by GitHub
commit 4b49c77349
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -374,12 +374,25 @@ proc strokeEllipse*(ctx: Context, center: Vec2, rx, ry: float32) =
path.ellipse(center, rx, ry)
ctx.stroke(path)
proc fillCircle*(ctx: Context, circle: Circle) =
## Draws a circle that is filled according to the current fillStyle
var path: Path
path.circle(circle.pos, circle.radius)
ctx.fill(path)
proc fillCircle*(ctx: Context, center: Vec2, radius: float32) =
## Draws a circle that is filled according to the current fillStyle.
var path: Path
path.ellipse(center, radius, radius)
ctx.fill(path)
proc strokeCircle*(ctx: Context, circle: Circle) =
## Draws a circle that is stroked (outlined) according to the current
## strokeStyle and other context settings.
var path: Path
path.circle(circle.pos, circle.radius)
ctx.stroke(path)
proc strokeCircle*(ctx: Context, center: Vec2, radius: float32) =
## Draws a circle that is stroked (outlined) according to the current
## strokeStyle and other context settings.