Sophie

Sophie

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

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

from numpy import array
from enthought.kiva.backend_image import GraphicsContext, CompiledPath
from enthought.kiva.constants import STROKE, FILL_STROKE

cross = CompiledPath()
cross.scale_ctm(10.0, 10.0)
lines = array([(0,1),(0,2),(1,2),(1,3),(2,3),(2,2),(3,2),(3,1),(2,1),
               (2,0),(1,0),(1,1), (0,1)])
cross.lines(lines)

gc = GraphicsContext((400,400))
gc.set_stroke_color((1,0,0,1))
gc.draw_path_at_points(array([(50,50), (200,50), (50,200), (200,200)]), cross, STROKE)
gc.save("compiled_path.png")