def transform(path, m, n1, n2, n3, points=100, range=TWOPI): first = True for i in _range(points): pt = path.point(float(i)/points) phi = i * range / points dx, dy = supercalc(m, n1, n2, n3, phi) if first: _ctx.beginpath(pt.x+dx, pt.y+dy) first = False else: _ctx.lineto(pt.x+dx, pt.y+dy) return _ctx.endpath(draw=False)
def transform(path, m, n1, n2, n3, points=100, range=TWOPI): first = True for i in _range(points): pt = path.getPoints#(float(i)/points) phi = i * range / points dx, dy = supercalc(m, n1, n2, n3, phi) if first: p = Path() p.moveto(pt.x+dx, pt.y+dy) first = False else: _ctx.lineto(pt.x+dx, pt.y+dy) p.lineto(pt.x+dx, pt.y+dy) return p
def path(x, y, w, h, m, n1, n2, n3, points=1000, percentage=1.0, range=TWOPI): first = True for i in _range(points): if i > points*percentage: continue phi = i * range / points dx, dy = supercalc(m, n1, n2, n3, phi) dx = (dx * w) + x dy = (dy * h) + y if first: _ctx.beginpath(dx, dy) first = False else: _ctx.lineto(dx, dy) return _ctx.endpath(draw=False)
def path(x, y, w, h, m, n1, n2, n3, points=1000, percentage=1.0, range=TWOPI): first = True for i in _range(points): if i > points*percentage: continue phi = i * range / points dx, dy = supercalc(m, n1, n2, n3, phi) dx = (dx * w) + x dy = (dy * h) + y if first: path = graphics.Path() path.moveto(dx, dy) first = False else: path.lineto(dx, dy) return path