Esempio n. 1
0
def stars():
    gc = GraphicsContext((500, 500))
    gc.translate_ctm(250, 300)
    add_star(gc)
    gc.draw_path()

    gc.translate_ctm(0, -100)
    add_star(gc)
    gc.set_fill_color((0.0, 0.0, 1.0))
    gc.draw_path(constants.EOF_FILL_STROKE)
    file_path = tempfile.mktemp(suffix='.bmp')
    gc.save(file_path)
    return file_path
Esempio n. 2
0
def stars():
    gc = GraphicsContext((500, 500))

    with gc:
        gc.set_alpha(0.3)
        gc.set_stroke_color((1.0, 0.0, 0.0))
        gc.set_fill_color((0.0, 1.0, 0.0))

        for i in range(0, 600, 5):
            with gc:
                gc.translate_ctm(i, i)
                gc.rotate_ctm(i * pi / 180.)
                add_star(gc)
                gc.draw_path()

    gc.set_fill_color((0.5, 0.5, 0.5, 0.4))
    gc.rect(150, 150, 200, 200)
    gc.fill_path()
    file_path = tempfile.mktemp(suffix='.bmp')
    gc.save(file_path)
    return file_path