conversion result (non-edited)
[PyX/mjg.git] / manual / pattern.rst
blobcfeb85b449c52135f1d041f6057560ca1f982ead
2 .. _pattern:
4 *********************
5 Module :mod:`pattern`
6 *********************
8 .. sectionauthor:: Jörg Lehmann <joergl@users.sourceforge.net>
11 This module contains the :class:`pattern` class, whichs allows the definition of
12 PostScript Tiling patterns (cf. Sect. 4.9 of the PostScript Language Reference
13 Manual) which may then be used to fill paths. In addition, a number of
14 predefined hatch patterns are included.
16 .. module:: pattern
20 Class :class:`pattern`
21 ======================
23 The classes :class:`pattern` and :class:`canvas` differ only in their
24 constructor and in the absence of a :meth:`writeEPSfile` method in the former.
25 The :class:`pattern` constructor accepts the following keyword arguments:
27 +-----------------+-----------------------------------------------+
28 | keyword         | description                                   |
29 +=================+===============================================+
30 | ``painttype``   | ``1`` (default) for coloured patterns or      |
31 |                 | ``2`` for uncoloured patterns                 |
32 +-----------------+-----------------------------------------------+
33 | ``tilingtype``  | ``1`` (default) for constant spacing tilings  |
34 |                 | (patterns are spaced constantly by a multiple |
35 |                 | of a device pixel), ``2`` for undistorted     |
36 |                 | pattern cell, whereby the spacing may vary by |
37 |                 | as much as one device pixel, or ``3`` for     |
38 |                 | constant spacing and faster tiling which      |
39 |                 | behaves as tiling type ``1`` but with         |
40 |                 | additional distortion allowed to permit a     |
41 |                 | more efficient implementation.                |
42 +-----------------+-----------------------------------------------+
43 | ``xstep``       | desired horizontal spacing between pattern    |
44 |                 | cells, use ``None`` (default) for automatic   |
45 |                 | calculation from pattern bounding box.        |
46 +-----------------+-----------------------------------------------+
47 | ``ystep``       | desired vertical spacing between pattern      |
48 |                 | cells, use ``None`` (default) for automatic   |
49 |                 | calculation from pattern bounding box.        |
50 +-----------------+-----------------------------------------------+
51 | ``bbox``        | bounding box of pattern. Use ``None`` for an  |
52 |                 | automatic determination of the bounding box   |
53 |                 | (including an enlargement by ``bboxenlarge``  |
54 |                 | pts on each side.)                            |
55 +-----------------+-----------------------------------------------+
56 | ``trafo``       | additional transformation applied to pattern  |
57 |                 | or ``None`` (default). This may be used to    |
58 |                 | rotate the pattern or to shift its phase (by  |
59 |                 | a translation).                               |
60 +-----------------+-----------------------------------------------+
61 | ``bboxenlarge`` | enlargement when using the automatic bounding |
62 |                 | box determination; default is 5 pts.          |
63 +-----------------+-----------------------------------------------+
65 After you have created a pattern instance, you define the pattern shape by
66 drawing in it like in an ordinary canvas. To use the pattern, you simply pass
67 the pattern instance to a :meth:`stroke`, :meth:`fill`, :meth:`draw` or
68 :meth:`set` method of the canvas, just like you would do with a colour, etc.
70 .. % %% Local Variables:
71 .. % %% mode: latex
72 .. % %% TeX-master: "manual.tex"
73 .. % %% End: