Add Boxes.circle() primitive
This commit is contained in:
parent
71bd013f3f
commit
c2ab70eefe
|
@ -877,6 +877,26 @@ class Boxes:
|
|||
self.moveTo(self.spacing / 2.0, self.spacing / 2.0)
|
||||
return dontdraw
|
||||
|
||||
@restore
|
||||
def circle(self, x, y, r):
|
||||
"""
|
||||
Draw a round disc
|
||||
|
||||
:param x: position
|
||||
:param y: postion
|
||||
:param r: radius
|
||||
|
||||
"""
|
||||
r += self.burn
|
||||
self.moveTo(x + r, y)
|
||||
a = 0
|
||||
n = 10
|
||||
da = 2 * math.pi / n
|
||||
for i in range(n):
|
||||
self.ctx.arc(-r, 0, r, a, a+da)
|
||||
a += da
|
||||
self.ctx.stroke()
|
||||
|
||||
@restore
|
||||
@holeCol
|
||||
def hole(self, x, y, r):
|
||||
|
|
Loading…
Reference in New Issue