aboutsummaryrefslogtreecommitdiffstats
path: root/examples/drawing/pathitem.jl
blob: 2835313399fcf243674bb105e43b49f21560b527 (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
37
38
39
40
41
42
43
44
45
46
    
# Original Python:
#   from pyx import *

#   c = canvas.canvas()

#   rect1 = path.path(path.moveto(0, 0), path.lineto(1, 0),
#                   path.moveto(1, 0), path.lineto(1, 1),
#                   path.moveto(1, 1), path.lineto(0, 1),
#                   path.moveto(0, 1), path.lineto(0, 0))
#   rect2 = path.path(path.moveto(2, 0), path.lineto(3, 0),
#                   path.lineto(3, 1), path.lineto(2, 1),
#                   path.lineto(2, 0))
#   rect3 = path.path(path.moveto(4, 0), path.lineto(5, 0),
#                   path.lineto(5, 1), path.lineto(4, 1),
#                   path.closepath())

#   c.stroke(rect1, [style.linewidth.THICK])
#   c.stroke(rect2, [style.linewidth.THICK])
#   c.stroke(rect3, [style.linewidth.THICK])

#   c.writeEPSfile("pathitem")
#   c.writePDFfile("pathitem")
#   c.writeSVGfile("pathitem")

using PyX

c = canvas.canvas()

rect1 = path.path(path.moveto(0, 0), path.lineto(1, 0),
                  path.moveto(1, 0), path.lineto(1, 1),
                  path.moveto(1, 1), path.lineto(0, 1),
                  path.moveto(0, 1), path.lineto(0, 0))
rect2 = path.path(path.moveto(2, 0), path.lineto(3, 0),
                  path.lineto(3, 1), path.lineto(2, 1),
                  path.lineto(2, 0))
rect3 = path.path(path.moveto(4, 0), path.lineto(5, 0),
                  path.lineto(5, 1), path.lineto(4, 1),
                  path.closepath())

stroke(c, rect1, [style_linewidth.THICK])
stroke(c, rect2, [style_linewidth.THICK])
stroke(c, rect3, [style_linewidth.THICK])

writeEPSfile(c, "pathitem")
writePDFfile(c, "pathitem")