def AddEllipticalArc(self, x, y, width, height, theta, dtheta, clockwise=False): """ Draws an arc of an ellipse within bounding rect (x,y,w,h) from startArc to endArc (in degrees, relative to the horizontal line of the eclipse) """ import wx # compute the cubic bezier and add that to the path by calling # AddCurveToPoint sub_paths = svg_extras.bezier_arc(x, y, x + width, y + height, theta, dtheta) for sub_path in sub_paths: x1, y1, cx1, cy1, cx2, cy2, x2, y2 = sub_path path = wx.GraphicsRenderer_GetDefaultRenderer().CreatePath() path.MoveToPoint(x1, y1) path.AddCurveToPoint(cx1, cy1, cx2, cy2, x2, y2) self.AddPath(path) self.MoveToPoint(path.GetCurrentPoint()) self.CloseSubpath()
def AddEllipse(self, cx, cy, rx, ry): for i, (x1, y1, x2, y2, x3, y3, x4, y4) in enumerate( svg_extras.bezier_arc(cx - rx, cy - ry, cx + rx, cy + ry, 0, 360) ): if i == 0: self.move_to(x1, y1) self.curve_to(x2, y2, x3, y3, x4, y4)
def AddEllipse(self, cx, cy, rx, ry): for i, (x1, y1, x2, y2, x3, y3, x4, y4) in enumerate( svg_extras.bezier_arc(cx - rx, cy - ry, cx + rx, cy + ry, 0, 360)): if i == 0: self.move_to(x1, y1) self.curve_to(x2, y2, x3, y3, x4, y4)
def AddEllipticalArc(self, x, y, width, height, theta, dtheta, clockwise=False): """ Draws an arc of an ellipse within bounding rect (x,y,w,h) from startArc to endArc (in degrees, relative to the horizontal line of the eclipse)""" # compute the cubic bezier and add that to the path by calling AddCurveToPoint sub_paths = svg_extras.bezier_arc(x, y, x+width, y+height, theta, dtheta) for sub_path in sub_paths: x1,y1, cx1, cy1, cx2, cy2, x2,y2 = sub_path path = wx.GraphicsRenderer_GetDefaultRenderer().CreatePath() path.MoveToPoint(x1, y1) path.AddCurveToPoint(cx1, cy1, cx2, cy2, x2, y2) self.AddPath(path) self.MoveToPoint(path.GetCurrentPoint()) self.CloseSubpath()
def AddEllipticalArcTo(self, x, y, w, h, theta0, dtheta, phi=0): for i, (x1, y1, x2, y2, x3, y3, x4, y4) in enumerate(svg_extras.bezier_arc(x, y, x + w, y + h, theta0, dtheta)): self.curve_to(x2, y2, x3, y3, x4, y4)
def AddEllipticalArcTo(self, x, y, w, h, theta0, dtheta, phi=0): arc = svg_extras.bezier_arc(x, y, x + w, y + h, theta0, dtheta) for i, (x1, y1, x2, y2, x3, y3, x4, y4) in enumerate(arc): self.curve_to(x2, y2, x3, y3, x4, y4)