Debian Codegraph @

texmf-dist/doc/metapost/mpattern/README

raw
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 % This file is part of the MPATTERN package
3 %
4 % Author: Piotr Bolek
5 % wersja: 0.5 (Jun 25, 2001)
6 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7
8 Description
9 ===========
10
11 Package MPATTERN gives ability to define and use patterns in
12 MetaPost. It uses Pattern Color Space available in PostScript Level 2.
13
14 Package contains:
15 - mpattern.mp: MetaPost macros for defining and using patterns.
16 - README: short description in English.
17 - README.PL: short description in Polish.
18 - test.mp, test.tex, test.ps: usage examples.
19
20 Using package
21 =============
22
23 Include the file mpattern.mp with the input command at the beginning
24 of the source file and process the source file with the standard mpost
25 program.
26
27 User Interface
28 ==============
29
30 Defining pattern
31 ----------------
32
33 Patterns are defined using the following construct:
34
35 beginpattern(<name_of_pattern>);
36 ...
37 endpattern;
38
39 Parameter <name_of_pattern> is the name by which the pattern is
40 identified. This name can contain letters and underscore characters
41 "_" but not digits. This name should NOT be given in quotes.
42
43 One or more of the following macros can be invoked in any place
44 inside pattern definition (between beginpattern and endpattern):
45 - patternbbox(<pair>,<pair>)
46 - patternbbox((<numeric>,<numeric>,<numeric>,<numeric>)
47 Explicit coordinates of bounding box of pattern cell
48
49 - patternxstep(<numeric>)
50 - patternystep(<numeric>)
51 - patternstep(<numeric>,<numeric>)
52 - patternstep(<pair>)
53 Pattern spacing
54
55 - patterntransform(<transform>)
56 Transformation of pattern shape
57
58 - patterncolor(0<= <numeric> <= 1)
59 Explicit color replaced later by pattern
60
61 Each pattern is temporarily written as picture with big number
62 (default is 999) but when user will use this number for his own
63 picture then for temporal storing of next patterns the greatest free
64 number less then 999 will be used.
65
66 Using patterns
67 --------------
68
69 Already defined pattern can be used for filling objects with
70 two argument withpattern macro. It is used as follows:
71
72 <path> withpattern <name_of_pattern>;
73
74 where <path> is any valid expression defining closed path and
75 <name_of_pattern> is the name given in definition of the pattern.
76
77 Example
78 -------
79
80 Here is code to draw two circles filled with different checker
81 patterns.
82
83 input mpattern;
84
85 beginpattern(checker);
86 d:=4mm;
87 fill unitsquare scaled d;
88 fill unitsquare scaled d shifted (d,d);
89 patternbbox(0,0,2d,2d);
90 endpattern;
91
92 beginpattern(rotated_checker);
93 fill unitsquare scaled 4mm rotated 45 withcolor .7white;
94 endpattern;
95
96 beginfig(11);
97 path p;
98 z1=(1cm,1cm);
99 p=fullcircle scaled 3cm;
100 fill p withpattern checker;
101 unfill p shifted z1;
102 fill p shifted z1 withpattern rotated_checker;
103 endfig;
104
105 Distribution of the package
106 ===========================
107
108 The package MPATTERN belongs to the public domain. You can use any
109 actuall version of GPL Licence if you want to modify or redistribute
110 this package.
111
112 Problems
113 ========
114
115 06-2001: Filling text with patterns can make problems. The current
116 solution is unstable.
117
118 Changes
119 =======
120
121 06-2001: By the inspiration by the Piotr Strzelczyk's tutorial at the
122 BachoTeX'2001 conference the necesity of Perl postprocessing
123 is eliminated. The substitution of colors to patterns is now
124 performed with help of dictionaries at the PostScript level.
125
126 Contact with author
127 =================
128
129 e-mail: [email protected]