~ubuntu-branches/debian/sid/pyx/sid

« back to all changes in this revision

Viewing changes to examples/drawing2/insert.txt

  • Committer: Bazaar Package Importer
  • Author(s): Stuart Prescott
  • Date: 2011-05-20 00:13:52 UTC
  • mto: (9.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20110520001352-odcuqpdezuusbbw1
Tags: upstream-0.11.1
ImportĀ upstreamĀ versionĀ 0.11.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Inserting transformed canvases into canvases
 
2
 
 
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. ...
 
6
 
 
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.
 
12
 
 
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.