MCPcopy Create free account
hub / github.com/PageBot/PageBot / oval

Method oval

Lib/pagebot/contexts/svgcontext/svgcontext.py:237–257  ·  view source on GitHub ↗

Draw an oval in rectangle, where (x, y) is the bottom-left and size (w, h). >>> from pagebot.toolbox.color import color, blackColor >>> path = '_export/SvgContext_oval.svg' >>> context = SvgContext() >>> context.newPage(1000, 1000) >>> context.fill(co

(self, x, y, w, h)

Source from the content-addressed store, hash-verified

235 self._drawing.add(rect)
236
237 def oval(self, x, y, w, h):
238 """Draw an oval in rectangle, where (x, y) is the bottom-left and size
239 (w, h).
240
241 >>> from pagebot.toolbox.color import color, blackColor
242 >>> path = '_export/SvgContext_oval.svg'
243 >>> context = SvgContext()
244 >>> context.newPage(1000, 1000)
245 >>> context.fill(color(r=1, g=0, b=0.5))
246 >>> context.oval(pt(0), pt(100), pt(600), pt(200))
247 >>> context.stroke(blackColor, pt(20))
248 >>> context.fill(color(r=0.4, g=0.1, b=0.9))
249 >>> context.oval(pt(300), pt(150), pt(400), pt(600))
250 >>> context.saveDrawing(path)
251 >>> #r = os.system('open %s' % path)
252 """
253 oval = self._drawing.ellipse(center=upt((self._ox+x+w/2),
254 (self._oy+y+h/2)), r=upt((w/2), (h/2)),
255 stroke_width=upt(self._strokeWidth), stroke=self._svgStroke,
256 fill=self._svgFill)
257 self._drawing.add(oval)
258
259 def circle(self, x, y, r):
260 """Circle draws a DrawBot oval with (x,y) as middle point and radius r.

Callers 9

drawRegistrationMarkFunction · 0.45
drawArrowFunction · 0.45
buildMethod · 0.45
build_indsMethod · 0.45
drawArrowMethod · 0.45
drawElementOriginMethod · 0.45
drawArrowMethod · 0.45
drawElementOriginMethod · 0.45
_drawGlyphMarkerMethod · 0.45

Calls 2

uptFunction · 0.90
addMethod · 0.80

Tested by

no test coverage detected