Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 789a4dca4953f037223e830336ef4af3 > files > 1098

python-enthought-enable-3.2.0-2mdv2010.0.i586.rpm


from numpy import array
from enthought.kiva.backend_image import GraphicsContext

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)
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)
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.curve_to(550,300,710,200,500,10)
gc.close_path()

gc.rect(650,10,390,390)
gc.fill_path()

gc.save("sub_path2.bmp")