some updates to the webpage
[PyX.git] / manual / pattern.tex
blob0aa397e644b5f176f8ed273687e94c9fe8b31537
1 \chapter{Module \module{pattern}}
2 \label{pattern}
4 \sectionauthor{J\"org Lehmann}{joergl@users.sourceforge.net}
6 This module contains the \class{pattern} class, whichs allows the definition of PostScript Tiling
7 patterns (cf.\ Sect.~4.9 of the PostScript Language Reference Manual)
8 which may then be used to fill paths. In addition, a number of
9 predefined hatch patterns are included.
12 \declaremodule{}{pattern}
14 \section{Class \class{pattern}}
16 The classes \class{pattern} and \class{canvas} differ only in their
17 constructor and in the absence of a \method{writeEPSfile()} method in
18 the former. The \class{pattern} constructor accepts the following
19 keyword arguments:
21 \medskip
22 \begin{tabularx}{\linewidth}{l>{\raggedright\arraybackslash}X}
23 keyword&description\\
24 \hline
25 \texttt{painttype}&\texttt{1} (default) for coloured patterns or
26 \texttt{2} for uncoloured patterns\\
27 \texttt{tilingtype}&\texttt{1} (default) for constant spacing tilings
28 (patterns are spaced constantly by a multiple of a device pixel),
29 \texttt{2} for undistorted pattern cell, whereby the spacing may vary
30 by as much as one device pixel, or \texttt{3} for constant spacing and
31 faster tiling which behaves as tiling type \texttt{1} but with
32 additional distortion allowed to permit a more efficient
33 implementation.\\
34 \texttt{xstep}&desired horizontal spacing between pattern cells, use
35 \texttt{None} (default) for automatic calculation from pattern
36 bounding box.\\
37 \texttt{ystep}&desired vertical spacing between pattern cells, use
38 \texttt{None} (default) for automatic calculation from pattern
39 bounding box.\\
40 \texttt{bbox}&bounding box of pattern. Use \texttt{None} for an
41 automatic determination of the bounding box (including an
42 enlargement by $5$ pts on each side.)\\
43 \texttt{trafo}&additional transformation applied to pattern or
44 \texttt{None} (default). This may be used to rotate the pattern or to
45 shift its phase (by a translation).
46 \end{tabularx}
47 \medskip
49 After you have created a pattern instance, you define the pattern
50 shape by drawing in it like in an ordinary canvas. To use the pattern,
51 you simply pass the pattern instance to a \method{stroke()},
52 \method{fill()}, \method{draw()} or \method{set()} method of the
53 canvas, just like you would do with a colour, etc.
57 %%% Local Variables:
58 %%% mode: latex
59 %%% TeX-master: "manual.tex"
60 %%% End: