- start of rewrite of pdfwriter
[PyX/mjg.git] / test / functional / test_canvas.py
blobce58bd877dd7750ffb37e3bee3de634462cd5cde
1 #!/usr/bin/env python
2 import sys; sys.path[:0] = ["../.."]
4 from pyx import *
6 c = canvas.canvas()
8 p = ( path.line(10*unit.u_pt, 10*unit.u_pt, 40*unit.u_pt, 40*unit.u_pt) +
9 path.line(10*unit.u_pt, 40*unit.u_pt, 40*unit.u_pt, 10*unit.u_pt) )
11 t1 = trafo.rotate(20)
12 t2 = trafo.translate(5,0)
13 t3 = trafo.mirror(10)
15 sc = canvas.canvas([t1, t2, t3])
16 c.insert(sc).stroke(p)
18 c.stroke(c.bbox().rect())
20 c.stroke(p.transformed(t1*t2*t3), [color.rgb.green, style.linestyle.dashed])
22 c.stroke(p, [color.rgb.red, style.linestyle.dotted, t3, t2, t1])
24 c.writeEPSfile("test_canvas", paperformat="a4")
26 d = document.document()
28 for nr in range(1, 10):
29 page = document.page(pagename = chr(64+nr), rotated=(nr-1)%2, fittosize=1)
30 page.text(0, 0, "page %d" % nr)
31 d.append(page)
33 d.writePSfile("test_document")