File: test_pattern.py

package info (click to toggle)
pyx3 0.17-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,328 kB
  • sloc: python: 27,656; makefile: 225; ansic: 130; sh: 17
file content (23 lines) | stat: -rwxr-xr-x 760 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python
import sys; sys.path[:0] = ["../.."]

from pyx import *

c = canvas.canvas()

pa1= pattern.pattern(attrs=[style.linewidth.thin])
pa1.stroke(path.line(0, 0, 0.25, 0.25))
pa1.stroke(path.line(0, 0.25, 0.25, 0))

#c.draw(path.circle(3, 3, 3), [deco.filled([pa1])])
c.draw(path.circle(3, 3, 3), [deco.filled([pa1]), deco.stroked])
c.draw(path.circle(5, 1, 1), [deco.filled([pa1]), deco.stroked])

pa2 = pattern.pattern()
pa2.text(0.125, 0.125, r"\PyX")

c.draw(path.rect(-1, -1, 1, 1), [deco.filled([pa2]), deco.stroked])

c.writeEPSfile("test_pattern", page_paperformat=document.paperformat.A4)
c.writePDFfile("test_pattern", page_paperformat=document.paperformat.A4)
c.writeSVGfile("test_pattern", page_paperformat=document.paperformat.A4)