update mkipynb to notebook version 4
[PyX.git] / manual / pathstyles.py
blob63bc595d479a40e9f0c45815eb7a8963cfbd8fbf
1 from pyx import *
3 text.set(text.LatexRunner)
4 text.preamble(r"\renewcommand{\familydefault}{\ttdefault}")
5 c = canvas.canvas()
7 # positioning is quite ugly ... but it works at the moment
8 x = 0
9 y = 0
10 dx = 6
11 dy = -0.65
12 length = 0.8
14 def drawstyle(name, showpath=0, default=0):
15 global x,y
16 p = path.path(path.moveto(x + 0.1, y+0.1 ),
17 path.rlineto(length/2.0, 0.3),
18 path.rlineto(length/2.0, -0.3))
19 c.stroke(p, [style.linewidth.THIck, eval("style."+name)])
20 if showpath:
21 c.stroke(p, [style.linewidth.Thin, color.gray.white])
22 if default:
23 name = name + r"\rm\quad (default)"
24 c.text(x + 1.5, y + 0.15, name, [text.size.footnotesize])
25 y += dy
26 if y < -16:
27 y = 0
28 x += dx
31 drawstyle("linecap.butt", showpath=1, default=1)
32 drawstyle("linecap.round", showpath=1)
33 drawstyle("linecap.square", showpath=1)
35 y += dy
37 drawstyle("linejoin.miter", showpath=1, default=1)
38 drawstyle("linejoin.round", showpath=1)
39 drawstyle("linejoin.bevel", showpath=1)
41 y += dy
43 drawstyle("linestyle.solid", default=1)
44 drawstyle("linestyle.dashed")
45 drawstyle("linestyle.dotted")
46 drawstyle("linestyle.dashdotted")
48 y += dy
50 drawstyle("linewidth.THIN")
51 drawstyle("linewidth.THIn")
52 drawstyle("linewidth.THin")
53 drawstyle("linewidth.Thin")
54 drawstyle("linewidth.thin")
55 drawstyle("linewidth.normal", default=1)
56 drawstyle("linewidth.thick")
57 drawstyle("linewidth.Thick")
58 drawstyle("linewidth.THick")
59 drawstyle("linewidth.THIck")
60 drawstyle("linewidth.THICk")
61 drawstyle("linewidth.THICK")
63 drawstyle("miterlimit.lessthan180deg", showpath=1)
64 drawstyle("miterlimit.lessthan90deg", showpath=1)
65 drawstyle("miterlimit.lessthan60deg", showpath=1)
66 drawstyle("miterlimit.lessthan45deg", showpath=1)
67 drawstyle("miterlimit.lessthan11deg", showpath=1, default=1)
69 y += dy
71 drawstyle("dash((1, 1, 2, 2, 3, 3), 0)")
72 drawstyle("dash((1, 1, 2, 2, 3, 3), 1)")
73 drawstyle("dash((1, 2, 3), 2)")
74 drawstyle("dash((1, 2, 3), 3)")
75 drawstyle("dash((1, 2, 3), 4)")
76 drawstyle("dash((1, 2, 3), rellengths=1)")
79 c.writePDFfile()