예제 #1
0
def draw(tipo, x, y):
    """
    Comando de dibujo

    @tipo: tipo de comando de dibujo (m, n, l, p, c)
    @x: posición en el eje x
    @y: posición en el eje y

    Ejemplo:
    draw("m", 10, 30)
    >>> 'm 10 30 '
    """
    return "{:s} {:s} {:s} ".format(tipo, round_format_str(x), round_format_str(y, 2))
예제 #2
0
def draw(tipo, x, y):
    """
    Comando de dibujo

    @tipo: tipo de comando de dibujo (m, n, l, p, c)
    @x: posición en el eje x
    @y: posición en el eje y

    Ejemplo:
    draw("m", 10, 30)
    >>> 'm 10 30 '
    """
    return '{:s} {:s} {:s} '.format(
        tipo, round_format_str(x, ), round_format_str(y, 2))
예제 #3
0
def fax(factor):
    """Distorsión de perspectiva del texto en "x"."""
    # Usually factor will be a small number,
    # not larger than 2 as that creates a very strong distortion.
    if factor > 2:
        return "\\fax2"
    else:
        return "\\fax" + round_format_str(factor)
예제 #4
0
def fad(ac1, ac2=None, ac3=None, t1=None, t2=None, t3=None, t4=None):
    """Desvanecimiento del texto."""
    if t1 is None and t2 is None and t3 is None and t4 is None:
        dur1, dur2, linedur = ac1, ac2, ac3
        if linedur is None:
            if dur2 is None:
                return "\\fad({:d},{:d})".format(dur1, dur1)
            else:
                return "\\fad({:d},{:d})".format(dur1, dur2)
        else:
            start, end = ac1, ac2
            # Desvanecimiento del texto, este usa transición de alphas.
            return "%s\\t(%d,%d,%s)\\t(%d,%d,%s)" % (a("ff"), 0, dur1, a("00"), linedur - dur2, linedur, a("ff"))
    else:
        t1, t2 = round_format_str(t1, 2), round_format_str(t2, 2)
        t3, t4 = round_format_str(t3, 2), round_format_str(t4, 2)
    return "\\fade({:s},{:s},{:s},{:s},{:s},{:s},{:s})".format(ac1, ac2, ac3, t1, t2, t3, t4)
예제 #5
0
def fax(factor):
    """Distorsión de perspectiva del texto en "x"."""
    # Usually factor will be a small number,
    # not larger than 2 as that creates a very strong distortion.
    if factor > 2:
        return '\\fax2'
    else:
        return '\\fax' + round_format_str(factor)
예제 #6
0
def blur(strength=1, dx=None, dy=None):
    """
    Crea un difuminado gaussiano al texto,
    especificando valores por separado para x y para y,
    si el borde no es cero el difuminado se aplicara al borde.


    @blr: intensidad del blur
    @dx, @dy: distancia en x, y
    """
    return "\\blur" + round_format_str(strength, 2)
예제 #7
0
def blur(strength=1, dx=None, dy=None):
    """
    Crea un difuminado gaussiano al texto,
    especificando valores por separado para x y para y,
    si el borde no es cero el difuminado se aplicara al borde.


    @blr: intensidad del blur
    @dx, @dy: distancia en x, y
    """
    return '\\blur' + round_format_str(strength, 2)
예제 #8
0
def fad(ac1, ac2=None, ac3=None, t1=None, t2=None, t3=None, t4=None):
    """Desvanecimiento del texto."""
    if (t1 is None and t2 is None
            and t3 is None and t4 is None):
        dur1, dur2, linedur = ac1, ac2, ac3
        if linedur is None:
            if dur2 is None:
                return '\\fad({:d},{:d})'.format(dur1, dur1)
            else:
                return '\\fad({:d},{:d})'.format(dur1, dur2)
        else:
            start, end = ac1, ac2
            # Desvanecimiento del texto, este usa transición de alphas.
            return '%s\\t(%d,%d,%s)\\t(%d,%d,%s)' % (
                a('ff'),
                0, dur1, a('00'),
                linedur - dur2, linedur, a('ff'))
    else:
        t1, t2 = round_format_str(t1, 2), round_format_str(t2, 2)
        t3, t4 = round_format_str(t3, 2), round_format_str(t4, 2)
    return '\\fade({:s},{:s},{:s},{:s},{:s},{:s},{:s})'.format(
        ac1, ac2, ac3, t1, t2, t3, t4)
예제 #9
0
def draw_bezier(x1, y1, x2, y2, x3, y3):
    return "b %s %s %s %s %s %s " % (
        round_format_str(x1, 2),
        round_format_str(y1, 2),
        round_format_str(x2, 2),
        round_format_str(y2, 2),
        round_format_str(x3, 2),
        round_format_str(y3, 2),
    )
예제 #10
0
def move(arg1, arg2, arg3, arg4, arg5=None, arg6=None):
    """
    Movimiento del texto.

    move(x1, y1, x2, y2)
    move(x1, y1, x2, y2, t1, t2)
    """
    if arg5 == None and arg6 == None:
        x1, y1 = round_format_str(arg1, 4), round_format_str(arg2, 4)
        x2, y2 = round_format_str(arg3, 4), round_format_str(arg4, 4)
        return "\\move({:s},{:s},{:s},{:s})".format(x1, y1, x2, y2)
    else:
        ti = arg5
        tf = arg6
        x1, y1 = round_format_str(arg1), round_format_str(arg2, 4)
        x2, y2 = round_format_str(arg3), round_format_str(arg4, 4)
        return "\\move({:s},{:s},{:s},{:s},{:d},{:d})".format(x1, y1, x2, y2, ti, tf)
예제 #11
0
def bord(xb=1, yb=None):
    """
    Especifica el grosor que tendra el borde del texto,
    Puede tener dos parametros uno para "x" y otro para "y".

    Ejemplo:
    >>> bord(1.5)
    '\\bord1.5'
    >>> bord(1.5,2)
    '\\xbord1.5\\ybord2'
    """
    if yb is None or xb == yb:
        return '\\bord' + round_format_str(xb, 2)
    else:
        return xbord(xb) + ybord(yb)
예제 #12
0
def bord(xb=1, yb=None):
    """
    Especifica el grosor que tendra el borde del texto,
    Puede tener dos parametros uno para "x" y otro para "y".

    Ejemplo:
    >>> bord(1.5)
    '\\bord1.5'
    >>> bord(1.5,2)
    '\\xbord1.5\\ybord2'
    """
    if yb is None or xb == yb:
        return "\\bord" + round_format_str(xb, 2)
    else:
        return xbord(xb) + ybord(yb)
예제 #13
0
def shad(xs=1, ys=None):
    """
    Especifica a distancia de la sombra del texto,
    Puede tener dos parametros uno para "x" y otro para "y".

    Ejemplo:
    >>> shad(1.5)
    '\\shad1.5'
    >>> shad(1.5,2)
    '\\xshad1.5\\yshad2'
    """
    if ys is None:
        # igual que shad
        return '\\shad' + round_format_str(xs, 2)
    else:
        return xshad(xs) + yshad(ys)
예제 #14
0
def shad(xs=1, ys=None):
    """
    Especifica a distancia de la sombra del texto,
    Puede tener dos parametros uno para "x" y otro para "y".

    Ejemplo:
    >>> shad(1.5)
    '\\shad1.5'
    >>> shad(1.5,2)
    '\\xshad1.5\\yshad2'
    """
    if ys is None:
        # igual que shad
        return "\\shad" + round_format_str(xs, 2)
    else:
        return xshad(xs) + yshad(ys)
예제 #15
0
def move(arg1, arg2, arg3, arg4, arg5=None, arg6=None):
    """
    Movimiento del texto.

    move(x1, y1, x2, y2)
    move(x1, y1, x2, y2, t1, t2)
    """
    if arg5 == None and arg6 == None:
        x1, y1 = round_format_str(arg1, 4), round_format_str(arg2, 4)
        x2, y2 = round_format_str(arg3, 4), round_format_str(arg4, 4)
        return '\\move({:s},{:s},{:s},{:s})'.format(x1, y1, x2, y2)
    else:
        ti = arg5
        tf = arg6
        x1, y1 = round_format_str(arg1), round_format_str(arg2, 4)
        x2, y2 = round_format_str(arg3), round_format_str(arg4, 4)
        return '\\move({:s},{:s},{:s},{:s},{:d},{:d})'.format(
            x1, y1, x2, y2, ti, tf)
예제 #16
0
def t(arg1, arg2=None, arg3=None, arg4=None):
    """
    Animación de transformación gradual.

    t(modifiers)
    t(accel, modifiers)
    t(t1, t2, style)
    t(t1, t2, accel, modifiers)

    Los tiempos son en milisegundos y son relativos al inicio de la linea

    Funciones que pueden ser animadas:
    fs(), fsp(), c(), a(), fscx(), fscy(), fsc(), frx(), fry(),
    frz(), clip()

    Funciones que pueden ser animadas a partir de VSFilter 2.39:
    fax(), fay(), fa(), be(), blur(), bord(), xbord(), ybord(),
    shad, xshad(), yshad(), iclip()

    Nota: clip() e iclip() solo pueden ser animadas
    en su versión rectangular.
    """
    if arg2 == None and arg3 == None and arg4 == None:
        modifiers = arg1
        return '\\t({:s})'.format(arg1)
    elif arg3 == None and arg4 == None:
        accel, modifiers = arg1, arg2
        return '\\t({:s},{:s})'.format(round_format_str(accel), modifiers)
    elif arg4 == None:
        t1, t2, modifiers = arg1, arg2, arg3
        return '\\t({:s},{:s},{:s})'.format(
            round_format_str(t1), round_format_str(t2), modifiers)
    else:
        t1, t2, accel, modifiers = arg1, arg2, arg3, arg4
        return '\\t({:s},{:s},{:s},{:s})'.format(
            round_format_str(t1), round_format_str(t2),
            round_format_str(accel), modifiers)
예제 #17
0
def t(arg1, arg2=None, arg3=None, arg4=None):
    """
    Animación de transformación gradual.

    t(modifiers)
    t(accel, modifiers)
    t(t1, t2, style)
    t(t1, t2, accel, modifiers)

    Los tiempos son en milisegundos y son relativos al inicio de la linea

    Funciones que pueden ser animadas:
    fs(), fsp(), c(), a(), fscx(), fscy(), fsc(), frx(), fry(),
    frz(), clip()

    Funciones que pueden ser animadas a partir de VSFilter 2.39:
    fax(), fay(), fa(), be(), blur(), bord(), xbord(), ybord(),
    shad, xshad(), yshad(), iclip()

    Nota: clip() e iclip() solo pueden ser animadas
    en su versión rectangular.
    """
    if arg2 == None and arg3 == None and arg4 == None:
        modifiers = arg1
        return "\\t({:s})".format(arg1)
    elif arg3 == None and arg4 == None:
        accel, modifiers = arg1, arg2
        return "\\t({:s},{:s})".format(round_format_str(accel), modifiers)
    elif arg4 == None:
        t1, t2, modifiers = arg1, arg2, arg3
        return "\\t({:s},{:s},{:s})".format(round_format_str(t1), round_format_str(t2), modifiers)
    else:
        t1, t2, accel, modifiers = arg1, arg2, arg3, arg4
        return "\\t({:s},{:s},{:s},{:s})".format(
            round_format_str(t1), round_format_str(t2), round_format_str(accel), modifiers
        )
예제 #18
0
def org(x, y):
    """Origen de rotación."""
    return "\\org({:s},{:s})".format(round_format_str(x, 4), round_format_str(y, 4))
예제 #19
0
def pos(x, y):
    """Aplica la posición del texto."""
    return "\\pos({:s},{:s})".format(round_format_str(x, 4), round_format_str(y, 4))
예제 #20
0
 def resize(m):
     num = (float(m.group(0)) / 30) * size
     return round_format_str(num, 2)
예제 #21
0
def fay(factor):
    """Distorsión de perspectiva del texto en "y"."""
    if factor > 2:
        return "\\fay2"
    else:
        return "\\fay" + round_format_str(factor)
예제 #22
0
def draw_bezier(x1, y1, x2, y2, x3, y3):
    return 'b %s %s %s %s %s %s ' % (
        round_format_str(x1, 2), round_format_str(y1, 2),
        round_format_str(x2, 2), round_format_str(y2, 2),
        round_format_str(x3, 2), round_format_str(y3, 2))
예제 #23
0
 def resize(m):
     num = (float(m.group(0)) / 100) * radio * 2
     return round_format_str(num, 2)
예제 #24
0
def fr(amount):
    """Gira el texto a lo largo de "z"."""
    return '\\frz' + round_format_str(amount, 8)
예제 #25
0
def yshad(depth=1):
    """Que tan alejada esta la sombra del texto en el eje de las "y"."""
    return '\\yshad' + round_format_str(depth, 2)
예제 #26
0
 def resize(m):
     num = (float(m.group(0)) / 100) * radio * 2
     return round_format_str(num, 2)
예제 #27
0
def draw_spline(*posiciones):
    bspline = "s "
    for pos in posiciones:
        bspline += "%s " % round_format_str(pos, 2)
    return bspline + " c"
예제 #28
0
 def scale(m):
     px, py = float(m.group(1)) * x, float(m.group(2)) * y
     return round_format_str(px, 2) + " " + round_format_str(py, 2)
예제 #29
0
 def move(m):
     px, py = float(m.group(1)) + x, float(m.group(2)) + y
     return round_format_str(px, 2) + " " + round_format_str(py, 2)
예제 #30
0
 def rotate(m):
     x, y = float(m.group(1)), float(m.group(2))
     x1 = x * math.cos(theta) - y * math.sin(theta)
     y1 = x * math.sin(theta) + y * math.cos(theta)
     return round_format_str(x1, 2) + " " + round_format_str(y1, 2)
예제 #31
0
def fay(factor):
    """Distorsión de perspectiva del texto en "y"."""
    if factor > 2:
        return '\\fay2'
    else:
        return '\\fay' + round_format_str(factor)
예제 #32
0
def pos(x, y):
    """Aplica la posición del texto."""
    return '\\pos({:s},{:s})'.format(
        round_format_str(x, 4), round_format_str(y, 4))
예제 #33
0
def ybord(valor=1):
    """Tamaño del Borde en "y"."""
    return '\\ybord' + round_format_str(valor, 2)
예제 #34
0
 def resize(m):
     num = (float(m.group(0)) / 30) * size
     return round_format_str(num, 2)
예제 #35
0
def fr(amount):
    """Gira el texto a lo largo de "z"."""
    return "\\frz" + round_format_str(amount, 8)
예제 #36
0
 def move(m):
     px, py = float(m.group(1)) + x, float(m.group(2)) + y
     return round_format_str(px, 2) + " " + round_format_str(py, 2)
예제 #37
0
def draw_spline(*posiciones):
    bspline = 's '
    for pos in posiciones:
        bspline += '%s ' % round_format_str(pos, 2)
    return bspline + ' c'
예제 #38
0
def ybord(valor=1):
    """Tamaño del Borde en "y"."""
    return "\\ybord" + round_format_str(valor, 2)
예제 #39
0
 def rstr(n):
     return round_format_str(n, 2)
예제 #40
0
 def rstr(n):
     return round_format_str(n, 2)
예제 #41
0
 def rotate(m):
     x, y = float(m.group(1)), float(m.group(2))
     x1 = x * math.cos(theta) - y * math.sin(theta)
     y1 = x * math.sin(theta) + y * math.cos(theta)
     return round_format_str(x1, 2) + " " + round_format_str(y1, 2)
예제 #42
0
def org(x, y):
    """Origen de rotación."""
    return '\\org({:s},{:s})'.format(
        round_format_str(x, 4), round_format_str(y, 4))
예제 #43
0
 def scale(m):
     px, py = float(m.group(1)) * x, float(m.group(2)) * y
     return round_format_str(px, 2) + " " + round_format_str(py, 2)
예제 #44
0
def yshad(depth=1):
    """Que tan alejada esta la sombra del texto en el eje de las "y"."""
    return "\\yshad" + round_format_str(depth, 2)