|
From: Michael J G. <mic...@us...> - 2012-05-29 14:25:43
|
From: Michael J Gruber <gr...@ma...> Signed-off-by: Michael J Gruber <mic...@us...> --- examples/drawing2/INDEX | 1 + examples/drawing2/canvasdeco.py | 17 +++++++++++++++++ examples/drawing2/canvasdeco.txt | 11 +++++++++++ 3 files changed, 29 insertions(+) create mode 100644 examples/drawing2/canvasdeco.py create mode 100644 examples/drawing2/canvasdeco.txt diff --git a/examples/drawing2/INDEX b/examples/drawing2/INDEX index e547b1b..f17d4f8 100644 --- a/examples/drawing2/INDEX +++ b/examples/drawing2/INDEX @@ -1,5 +1,6 @@ ellipse insert +canvasdeco smoothed parallel clipping diff --git a/examples/drawing2/canvasdeco.py b/examples/drawing2/canvasdeco.py new file mode 100644 index 0000000..3cc2bb4 --- /dev/null +++ b/examples/drawing2/canvasdeco.py @@ -0,0 +1,17 @@ +from pyx import * + +c = canvas.canvas() + +cd = canvas.canvas() + +cd.stroke(path.line(0,0,1,0), [deco.earrow]) +cd.stroke(path.line(0,0,0,1), [deco.earrow]) +cd.stroke(path.path(path.moveto(0.8,0), path.arc(0,0,0.6,0,90)), + [deco.earrow, style.linestyle.dotted]) + +c.insert(cd, [trafo.translate(0,1)]) +c.stroke(path.curve(2,2, 6,0, 0,0, 4,2), + [deco.insert(cd, [trafo.scale(0.6)], relarclenpos=p, relangle=0) for p in [0, 0.3, 0.5, 0.7, 1]]) + +c.writeEPSfile() +c.writePDFfile() diff --git a/examples/drawing2/canvasdeco.txt b/examples/drawing2/canvasdeco.txt new file mode 100644 index 0000000..d2873a0 --- /dev/null +++ b/examples/drawing2/canvasdeco.txt @@ -0,0 +1,11 @@ +Inserting a canvas as a path decoration + +In this example, a decoration is constructed using an arbitrary canvas (here +`cd`). This canvas decoration is then inserted, i.e. the path is decorated by +inserting the canvas at several positions. + +The canvas is inserted with its origin lined up with the point on the path, and +possibly rotated by a fixed angle or relative to the path tangent (as in the +example). + +For convenience, additional canvas attributes can be specified on the fly. -- 1.7.11.rc0.265.g7c5e375 |