def path(self, pd, **kwargs): fill = kwargs.get('fill') outline = kwargs.get('outline') p = path(pd, fill=rgb(fill), stroke=rgb(outline), **drawing_params(kwargs)) self.svg.addElement(p)
def arc(self, box, start, end, **kwargs): fill = kwargs.get('fill') w = box.width / 2 h = box.height / 2 if start > end: end += 360 endpoints = ellipse_endpoints(1, w, h, start, end) pt1 = XY(box.x + w + round(endpoints[0].x, 0), box.y + h + round(endpoints[0].y, 0)) pt2 = XY(box.x + w + round(endpoints[1].x, 0), box.y + h + round(endpoints[1].y, 0)) if end - start > 180: largearc = 1 else: largearc = 0 pd = pathdata(pt1[0], pt1[1]) pd.ellarc(w, h, 0, largearc, 1, pt2[0], pt2[1]) p = path(pd, fill="none", stroke=rgb(fill), **drawing_params(kwargs)) self.svg.addElement(p)
def line(self, points, **kwargs): fill = kwargs.get("fill") thick = kwargs.get("thick") pd = pathdata(points[0].x, points[0].y) for pt in points[1:]: pd.line(pt.x, pt.y) p = path(pd, fill="none", stroke=rgb(fill), stroke_width=thick, **drawing_params(kwargs)) self.svg.addElement(p)
def line(self, points, **kwargs): fill = kwargs.get('fill') thick = kwargs.get('thick') pd = pathdata(points[0].x, points[0].y) for pt in points[1:]: pd.line(pt.x, pt.y) p = path(pd, fill="none", stroke=rgb(fill), stroke_width=thick, **drawing_params(kwargs)) self.svg.addElement(p)