PyX — Examples: More drawing

In this section we demonstrate more drawing features of PyX. The goal is to present the various attributes that can be used for stroking and filling paths in a canvas. Or, they are useful when one canvas is inserted into another one. In many cases, there are several ways to achieve the same result.

Example overview for this section

ellipse.png

Applying transformations on a path or canvas: Drawing an ellipse

PyX does not directly provide a path corresponding to an ellipse. This example shows two ways how to draw an ellipse using affine transformations. more ...

insert.png

Inserting transformed canvases into canvases

Similar to the drawing of paths onto canvases, it is also possible to insert one canvas into another. You may specify additional transformations which are applied to the canvas which is inserted. more ...

smoothed.png

Smoothing paths

This example shows how to use the deformer class. A deformer takes an original path and return a modified one, which is here a smoothed variant. The deformer can be used like any other attribute when stroking or filling a path.

Here, we show the use of deformer.smoothed, which smoothes away corners in the original path. more ...

parallel.png

Paths with constant distance

This example shows how to use the deformer.parallel class. It provides the path which has always constant (signed) distance to an original path. more ...

clipping.png

Clipping a canvas

This example shows how drawing on a canvas can be clipped to a predefined region. The thick line is drawn two times, first in black onto an ordinary canvas, the second time in red onto a canvas which is clipped to the indicated circle. more ...