aboutsummaryrefslogtreecommitdiffstats
path: root/examples/drawing2d/ellipse.jl
blob: 931ba89ed23a32a3f561afd3ae98bf152eabb2e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Original Python:
#   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")


using PyX

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

# variant 1: use trafo as a deformer
stroke(c, 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()
stroke(sc, circ, [style_linewidth.THIck])
pyx_insert(c, sc, [trafo.scale(sx=2, sy=0.9), trafo.rotate(45), trafo.translate(5, 0)])

writeEPSfile(c, "ellipse")
writePDFfile(c, "ellipse")