File: ellipse.py

package info (click to toggle)
pyx3 0.14.1-5
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 8,928 kB
  • ctags: 3,516
  • sloc: python: 21,171; ansic: 127; makefile: 87; sh: 8
file content (17 lines) | stat: -rw-r--r-- 490 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from pyx import *

c = canvas.canvas()
circ = path.circle(0, 0, 1)

# variant 1: use trafo as a deformer
c.stroke(circ, [style.linewidth.THIck, 
                trafo.scale(sx=2, sy=0.9), trafo.rotate(45), trafo.translate(1, 0)])

# variant 2: transform a subcanvas
sc = canvas.canvas()
sc.stroke(circ, [style.linewidth.THIck])
c.insert(sc, [trafo.scale(sx=2, sy=0.9), trafo.rotate(45), trafo.translate(5, 0)])

c.writeEPSfile("ellipse")
c.writePDFfile("ellipse")
c.writeSVGfile("ellipse")