Exemplo n.º 1
0
gc.rect(30,30,850,300)
gc.set_fill_color(fill_color)
gc.fill_path()

gc.set_fill_color((0.,0.,0.,.4))
gc.translate_ctm(50,50)
gc.move_to(10,10)
gc.line_to(400,400)

gc.move_to(410,10)
gc.line_to(410,400)
gc.line_to(710,400)
gc.line_to(550,300)
gc.line_to(710,200)
gc.line_to(500,10)
gc.close_path()

gc.rect(750,10,390,390)
gc.draw_path()

gc.save("sub_path1.bmp")

line_color = (0.0,0.0,0.0)
fill_color = array((200.,184.,106.))/255.
gc = GraphicsContext((900, 900))
gc.rect(30,30,850,300)
gc.set_fill_color(fill_color)
gc.fill_path()

gc.set_fill_color((0.,0.,0.,.4))
gc.translate_ctm(50,50)
Exemplo n.º 2
0
fill_color = array((200.0, 184.0, 106.0)) / 255
point_color = array((0.3, 0.3, 0.3))
line_color = point_color

for i in range(len(star_points) + 1):
    gc = GraphicsContext((800, 800))
    gc.scale_ctm(8.0, 8.0)
    gc.translate_ctm(50, 50)

    # draw star
    gc.set_alpha(0.5)
    x, y = star_points[0]
    gc.move_to(x, y)
    for x, y in star_points[1:]:
        gc.line_to(x, y)
    gc.close_path()
    gc.set_fill_color(fill_color)
    gc.get_fill_color()
    gc.fill_path()

    gc.set_alpha(0.4)
    gc.set_stroke_color(line_color)
    gc.set_fill_color(line_color)
    gc.set_line_width(12)

    if i > 0:
        with gc:
            x, y = star_points[0]
            gc.translate_ctm(x, y)
            draw_circle(gc)