Beispiel #1
0
def transform(ctx, 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)
Beispiel #2
0
def path(ctx, 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()