lightning and grid support on surface; cleanups
[PyX/mjg.git] / examples / drawing2 / insert.txt
blobc94bea319db3dee20d652586056b9016c172c629
1 Inserting transformed canvases into canvases
3 Similar to the drawing of paths onto canvases, it is also possible to insert
4 one canvas into another. You may specify additional transformations which are
5 applied to the canvas which is inserted. ...
7 The example code shows how a canvas `cc` containing a square can be inserted
8 several times into another canvas `c`. The applied transformation first rotates
9 the square around the origin and then performs a scaling. Note that not only
10 the size of the square gets scaled, but everything that is drawn on the canvas,
11 also the linewidth of the square.
13 In geometrical operations, it is often necessary to perform calculations. This
14 is conveniently done by importing the mathematics capability of Python. In the
15 example, we calculate the scaling factor from the rotation angle such that the
16 corners of the rotated smaller square reside on the sides of the larger square.