def draw_ellipse_bezier(self, cp): # draw 4 bezier curves to make the ellipse path = QtGui.QPainterPath() path.moveTo(cp[0][0], cp[0][1]) path.cubicTo(cp[1][0], cp[1][1], cp[2][0], cp[2][1], cp[3][0], cp[3][1]) path.cubicTo(cp[4][0], cp[4][1], cp[5][0], cp[5][1], cp[6][0], cp[6][1]) path.cubicTo(cp[7][0], cp[7][1], cp[8][0], cp[8][1], cp[9][0], cp[9][1]) path.cubicTo(cp[10][0], cp[10][1], cp[11][0], cp[11][1], cp[12][0], cp[12][1]) self.cr.drawPath(path)
def draw(self): cp = self.get_cpoints(points=self.get_bezier_pts()) cr = self.setup_cr() # draw 4 bezier curves to make the ellipse path = QtGui.QPainterPath() path.moveTo(cp[0][0], cp[0][1]) path.cubicTo(cp[1][0], cp[1][1], cp[2][0], cp[2][1], cp[3][0], cp[3][1]) path.cubicTo(cp[4][0], cp[4][1], cp[5][0], cp[5][1], cp[6][0], cp[6][1]) path.cubicTo(cp[7][0], cp[7][1], cp[8][0], cp[8][1], cp[9][0], cp[9][1]) path.cubicTo(cp[10][0], cp[10][1], cp[11][0], cp[11][1], cp[12][0], cp[12][1]) cr.drawPath(path) if self.editing: self.draw_edit(cr) elif self.showcap: cpoints = self.get_cpoints() self.draw_caps(cr, self.cap, cpoints)
def draw_bezier_curve(self, cp): path = QtGui.QPainterPath() path.moveTo(cp[0][0], cp[0][1]) path.cubicTo(cp[1][0], cp[1][1], cp[2][0], cp[2][1], cp[3][0], cp[3][1]) self.cr.drawPath(path)