diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-09 00:45:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-09 00:45:48 +0000 |
commit | 5dc602d16c5be2fd035b254ca23484a90aebd6dc (patch) | |
tree | 72efb15fba318cc2096a8cc6999ed3fa0bff317d /Master/texmf-dist/doc/metapost/mpattern | |
parent | b4fc5f639874db951177ec539299d20908adb654 (diff) |
doc 5
git-svn-id: svn://tug.org/texlive/trunk@81 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/metapost/mpattern')
-rw-r--r-- | Master/texmf-dist/doc/metapost/mpattern/README | 129 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mpattern/README.PL | 133 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mpattern/test.mp | 146 | ||||
-rw-r--r-- | Master/texmf-dist/doc/metapost/mpattern/test.tex | 22 |
4 files changed, 430 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/metapost/mpattern/README b/Master/texmf-dist/doc/metapost/mpattern/README new file mode 100644 index 00000000000..5f6441c018d --- /dev/null +++ b/Master/texmf-dist/doc/metapost/mpattern/README @@ -0,0 +1,129 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% This file is part of the MPATTERN package +% +% Author: Piotr Bolek +% wersja: 0.5 (Jun 25, 2001) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Description +=========== + +Package MPATTERN gives ability to define and use patterns in +MetaPost. It uses Pattern Color Space available in PostScript Level 2. + +Package contains: +- mpattern.mp: MetaPost macros for defining and using patterns. +- README: short description in English. +- README.PL: short description in Polish. +- test.mp, test.tex, test.ps: usage examples. + +Using package +============= + +Include the file mpattern.mp with the input command at the beginning +of the source file and process the source file with the standard mpost +program. + +User Interface +============== + +Defining pattern +---------------- + +Patterns are defined using the following construct: + +beginpattern(<name_of_pattern>); +... +endpattern; + +Parameter <name_of_pattern> is the name by which the pattern is +identified. This name can contain letters and underscore characters +"_" but not digits. This name should NOT be given in quotes. + +One or more of the following macros can be invoked in any place +inside pattern definition (between beginpattern and endpattern): +- patternbbox(<pair>,<pair>) +- patternbbox((<numeric>,<numeric>,<numeric>,<numeric>) + Explicit coordinates of bounding box of pattern cell + +- patternxstep(<numeric>) +- patternystep(<numeric>) +- patternstep(<numeric>,<numeric>) +- patternstep(<pair>) + Pattern spacing + +- patterntransform(<transform>) + Transformation of pattern shape + +- patterncolor(0<= <numeric> <= 1) + Explicit color replaced later by pattern + +Each pattern is temporarily written as picture with big number +(default is 999) but when user will use this number for his own +picture then for temporal storing of next patterns the greatest free +number less then 999 will be used. + +Using patterns +-------------- + +Already defined pattern can be used for filling objects with +two argument withpattern macro. It is used as follows: + +<path> withpattern <name_of_pattern>; + +where <path> is any valid expression defining closed path and +<name_of_pattern> is the name given in definition of the pattern. + +Example +------- + +Here is code to draw two circles filled with different checker +patterns. + +input mpattern; + +beginpattern(checker); + d:=4mm; + fill unitsquare scaled d; + fill unitsquare scaled d shifted (d,d); + patternbbox(0,0,2d,2d); +endpattern; + +beginpattern(rotated_checker); + fill unitsquare scaled 4mm rotated 45 withcolor .7white; +endpattern; + +beginfig(11); + path p; + z1=(1cm,1cm); + p=fullcircle scaled 3cm; + fill p withpattern checker; + unfill p shifted z1; + fill p shifted z1 withpattern rotated_checker; +endfig; + +Distribution of the package +=========================== + +The package MPATTERN belongs to the public domain. You can use any +actuall version of GPL Licence if you want to modify or redistribute +this package. + +Problems +======== + +06-2001: Filling text with patterns can make problems. The current + solution is unstable. + +Changes +======= + +06-2001: By the inspiration by the Piotr Strzelczyk's tutorial at the + BachoTeX'2001 conference the necesity of Perl postprocessing + is eliminated. The substitution of colors to patterns is now + performed with help of dictionaries at the PostScript level. + +Contact with author +================= + +e-mail: P.Bolek@gust.org.pl diff --git a/Master/texmf-dist/doc/metapost/mpattern/README.PL b/Master/texmf-dist/doc/metapost/mpattern/README.PL new file mode 100644 index 00000000000..1872a33c5e9 --- /dev/null +++ b/Master/texmf-dist/doc/metapost/mpattern/README.PL @@ -0,0 +1,133 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Ten plik jest częścią pakietu MPATTERN +% +% Autor: Piotr Bolek +% wersja: 0.5 (Jun 25, 2001) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Opis +==== + +Pakiet MPATTERN służy do definiowania i używania wypełnień wzorkowych +w programie MetaPost. W pakiecie wykorzystywana jest dostępna w języku +PostScript Level 2 Wzorkowa Przestrzeń Kolorów (Pattern Color Space). + +Zawartość: +- mpattern.mp: makra dla programu MetaPost służące do definiowania + i używania wzorków. +- README: krótki opis po angielsku. +- README.PL: krótki opis po polsku. +- test.mp, test.tex, test.ps: przykłady użycia. + +Sposób użycia +============= + +W pliku źródłowym należy na początku włączyć poleceniem input plik +mpattern.mp, a następnie przetworzyć plik standardowym programem +mpost. + +Interfejs użytkownika +===================== + +Definiowanie wzorku +-------------------- + +Wzorki są definiowane przy użyciu konstrukcji: + +beginpattern(<nazwa_wzorku>); +... +endpattern; + +Parametr <nazwa_wzorku> jest nazwą, która służy do identyfikacji +wzorku. Nazwa ta może zawierać litery i znaki podkreślenia ,,_'', ale +nie może zawierać cyfr. NIE należy podawać tej nazwy w cudzysłowach. + +W definicji wzorku (w dowolnym miejscu między beginpattern a +endpattern) można podać dodatkowe polecenia: +- patternbbox(<pair>,<pair>) +- patternbbox((<numeric>,<numeric>,<numeric>,<numeric>) + Jawne podanie współrzędnych prostokąta ograniczającego komórkę wzorka + +- patternxstep(<numeric>) +- patternystep(<numeric>) +- patternstep(<numeric>,<numeric>) +- patternstep(<pair>) + Odstępy między komórkami wzorka + +- patterntransform(<transform>) + Modyfikacja kształtu komórki wzorka + +- patterncolor(0<= <numeric> <= 1) + Jawne podanie koloru związanego z danym wzorkiem + +Każdy wzorek jest tymczasowo zapisywany jako rysunek o dużym numerze +(domyślnie 999), ale jeśli użytkownik wykorzysta ten numer do swojego +rysunku, to dla wzorku będzie użyty największy wolny numer mniejszy od +999. + +Używanie wzorku +--------------- + +Do wykorzystania zdefiniowanego wzorku służy makro działające jak +operator dwuargumentowy (primary) withpattern. Sposób użycie jest +następujący: + +<ścieżka> withpattern <nazwa_wzorku>; + +gdzie <ścieżka> jest dowolnym wyrażeniem określającym zamkniętą +ścieżkę, a <nazwa_wzorku> jest nazwą podaną w definicji wzorku. + +Przykład +-------- + +Oto kod służący do narysowania dwóch kółek wypełnionych różnymi +szachownicami. + +input mpattern; + +beginpattern(checker); + d:=4mm; + fill unitsquare scaled d; + fill unitsquare scaled d shifted (d,d); + patternbbox(0,0,2d,2d); +endpattern; + +beginpattern(rotated_checker); + fill unitsquare scaled 4mm rotated 45 withcolor .7white; +endpattern; + +beginfig(11); + path p; + z1=(1cm,1cm); + p=fullcircle scaled 3cm; + fill p withpattern checker; + unfill p shifted z1; + fill p shifted z1 withpattern rotated_checker; +endfig; + +Zasady rozpowszechniania +======================== + +Pakiet MPATTERN jest dobrem wspólnym (ang. ,,public domain''). W +przypadku modyfikacji lub redystrybucji pakietu można stosować dowolną +aktualną licencję GPL. + +Problemy +======== + +06-2001: Mogą być problemy z wypełnianiem wzorkami napisów. Aktualne + rozwiązanie jest prowizoryczne. + +Zmiany +====== + +06-2001: Dzięki inspiracji tutorialem Piotra Strzelczyka na + konferencji BachoTeX'2001 wyeliminowana została konieczność + postprocesingu z wykorzystaniem Perla. Podmiana kolorów na + wzorki jest obecnie realizowana z wykorzystaniem słowników na + poziomie PostScriptu. + +Kontakt z autorem +================= + +e-mail: P.Bolek@gust.org.pl diff --git a/Master/texmf-dist/doc/metapost/mpattern/test.mp b/Master/texmf-dist/doc/metapost/mpattern/test.mp new file mode 100644 index 00000000000..a6cd1a8f86e --- /dev/null +++ b/Master/texmf-dist/doc/metapost/mpattern/test.mp @@ -0,0 +1,146 @@ +input mpattern; +prologues:=1; + +beginpattern(szachy_i); + patterncolor(.8); + fill unitsquare scaled 4mm; + fill unitsquare scaled 4mm shifted (4mm,4mm); +endpattern; + +beginpattern(szachy_ii); + fill unitsquare scaled 3mm withcolor .7white; + fill unitsquare scaled 3mm shifted (3mm,3mm) withcolor .7white; +endpattern; + +beginfig(1); + fill fullcircle scaled 30mm withpattern szachy_i; + + picture q; + q:=currentpicture; clearit; + + draw q shifted (10mm*right) rotated 30 scaled .5; + + fill unitsquare scaled 20mm withpattern szachy_ii; +endfig; + +beginpattern(checker); + u:=1mm; + fill unitsquare scaled u; + fill unitsquare scaled u shifted (u,u); + patternbbox(0,0,2u,2u); + patterntransform(identity slanted .17); +endpattern; + +beginpattern(rotated_checker); + fill unitsquare scaled 4mm rotated 45 withcolor .7white; + patterntransform(identity rotated 30); +endpattern; + +beginfig(11); + path p; + z1=(1cm,1cm); + p=fullcircle scaled 3cm; + fill p withpattern checker; + unfill p shifted z1; + fill p shifted z1 withpattern rotated_checker; +endfig; + +beginpattern(tt); + fill unitsquare scaled 2mm rotated 45 withcolor .5white; + z1=llcorner currentpicture; + z2=lrcorner currentpicture; + z3=urcorner currentpicture; + z4=ulcorner currentpicture; +% draw z1--z2--z3--z4--cycle; + patterntransform(identity rotated 30 slanted .2 yscaled 3); + patternstep((1.1*xpart(urcorner currentpicture-ulcorner currentpicture), + 2/3*xpart(urcorner currentpicture-ulcorner currentpicture))); +endpattern; + +beginpattern(ttt); + fill unitsquare scaled 2mm rotated 45 withcolor .5white; + z1=llcorner currentpicture; + z2=lrcorner currentpicture; + z3=urcorner currentpicture; + z4=ulcorner currentpicture; +% draw z1--z2--z3--z4--cycle; + patterntransform(identity rotated 30 slanted .2); + patternstep((1.1*xpart(urcorner currentpicture-ulcorner currentpicture), + 2/3*xpart(urcorner currentpicture-ulcorner currentpicture))); +endpattern; + +beginpattern(tr); + u:=4mm; + z1=(0,0); + z2=(u,0); + z3=(u,2u); + z4=(0,2u); + z12=.5[z1,z2]; + z23=.5[z2,z3]; + z34=.5[z3,z4]; + z41=.5[z4,z1]; + draw z12--z23--z34--z41--cycle; + draw z23--z41; + draw z1--z2; + draw z3--z4; + patternbbox(z1,z3); + patterntransform(identity slanted .1 rotated 11); + patternstep(1.2(x2-x1),1.2(y3-y1)); +endpattern; + +beginfig(12); + path p; + z1=(1cm,1cm); + p=fullcircle scaled 3cm; + fill p withpattern tt; + draw p; + unfill p shifted z1; + fill p shifted z1 withpattern tr; + draw p shifted z1; +endfig; + +beginpattern(ll); + pickup pencircle scaled .3; + draw origin--4up; + patternbbox(left,4up+right); + patterntransform(identity rotated -45); +endpattern; + +beginpattern(lll); + pickup pencircle scaled .3; + draw origin--4up; + patternbbox(left,4up+right); + patterntransform(identity rotated 45); +endpattern; + +beginpattern(literki); + label(btex \font\q=ptmr8r at 5pt\q abcd etex,origin); + z1=ulcorner currentpicture; + z2=urcorner currentpicture; + patterntransform(identity slanted .17); +endpattern; + +beginpattern(cm_literki); + label(btex \font\q=cmr5\q xyz XYZ ZYX zyx etex,origin); + z1=ulcorner currentpicture; + z2=urcorner currentpicture; + patterntransform(identity slanted .17); +endpattern; + +beginfig(13); + label(btex \font\q=ptmr8r at 90pt\q ABCD etex, origin) withpattern ll; +endfig; + +beginfig(14); + picture a; a=btex \font\q=ptmbi8r at 90pt\q ABCD etex; + draw a withpattern literki; + undraw a shifted (20up+10right); + draw a shifted (20up+10right) withpattern checker; + undraw a shifted (40up+20right); + draw a shifted (40up+20right) withpattern lll; + draw a shifted (40up+20right) withpattern ll; + undraw a shifted (60up+30right); + draw a shifted (60up+30right) withpattern cm_literki; +endfig; + +end. diff --git a/Master/texmf-dist/doc/metapost/mpattern/test.tex b/Master/texmf-dist/doc/metapost/mpattern/test.tex new file mode 100644 index 00000000000..3f3886958af --- /dev/null +++ b/Master/texmf-dist/doc/metapost/mpattern/test.tex @@ -0,0 +1,22 @@ +\input epsf + +\epsfbox{test.1} +Simple patterns +\bigskip + +\epsfbox{test.11} +Explicit bounding box and transformations +\bigskip + +\epsfbox{test.12} +Transformations and cell spacing +\bigskip + +\epsfbox{test.13} +Filling label +\bigskip + +\epsfbox{test.14} +Filling text and with text + +\bye |