Debian Codegraph @

texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypatterns.meta.code.tex

raw
1 % Copyright 2019 by Mark Wibrow
2 %
3 % This file may be distributed and/or modified
4 %
5 % 1. under the LaTeX Project Public License and/or
6 % 2. under the GNU Public License.
7 %
8 % See the file doc/generic/pgf/licenses/LICENSE for more details.
9
10 \usepgflibrary{patterns.meta}%
11
12 \tikzset{%
13 pattern color/.code=\edef\tikz@pattern@color{#1},
14 pattern/.code={%
15 \edef\tikz@temp{#1}%
16 \ifx\tikz@temp\tikz@nonetext%
17 \tikz@addmode{\tikz@mode@fillfalse}%
18 \else%
19 \ifx\tikz@temp\pgfutil@empty%
20 \else%
21 \tikz@addoption{\pgfsetfillpattern{#1}{\tikz@pattern@color}}%
22 \def\tikz@pattern{#1}%
23 \fi%
24 \tikz@addmode{\tikz@mode@filltrue}%
25 \fi%
26 }
27 }%
28
29 \def\tikz@pattern@color{black}%
30 \def\tikz@pattern{}%
31
32 \tikzset{patterns/.cd,
33 .unknown/.code={%
34 \let\tikz@pat@key=\pgfkeyscurrentname%
35 \pgfkeys{/pgf/patterns/\tikz@pat@key/.try={#1}}%
36 },
37 bottom left/.style={/pgf/patterns/bottom left={\tikz@scan@one@point\pgf@pat@process#1}},
38 top right/.style={/pgf/patterns/top right={\tikz@scan@one@point\pgf@pat@process#1}},
39 bounding box/.style args={#1(#2)#3and#4(#5)#6}{%
40 /tikz/patterns/bottom left={(#2)},
41 /tikz/patterns/top right={#4(#5)},
42 },
43 tile size/.style={/pgf/patterns/tile size={\tikz@scan@one@point\pgf@pat@process#1}},
44 tile transformation/.style={/pgf/patterns/tile transformation={%
45 \let\tikz@transform=\relax\pgfkeys{/tikz/.cd,#1}}%
46 },
47 infer tile bounding box/.code={
48 \def\pgf@pat@codeafter{%
49 \xdef\tikz@pat@installbb{%
50 \noexpand\pgfkeys{/tikz/patterns/bounding box={%
51 (\the\pgf@picminx-#1,\the\pgf@picminy-#1) and
52 (\the\pgf@picmaxx+#1,\the\pgf@picmaxy+#1)
53 },
54 /tikz/patterns/tile size={%
55 (\the\pgf@picmaxx-\the\pgf@picminx,
56 \the\pgf@picmaxy-\the\pgf@picminy)}}}%
57 }%
58 \let\pgf@pat@declarepost=\tikz@pat@installbb%
59 },
60 infer tile bounding box/.default=0pt,
61 }%
62
63 \def\tikzdeclarepattern#1{%
64 \begingroup%
65 \def\pgf@pat@codebefore{%
66 \let\tikz@transform=\relax%
67 \pgftransformreset% <- Hmm?
68 \tikz@declarepattern@install%
69 \ifnum\pgf@pat@type=0\relax%
70 \let\pgfsetstrokecolor=\pgfutil@gobble%
71 \let\pgfsetfillcolor=\pgfutil@gobble%
72 \fi%
73 \def\tikz@fig{\tikzerror{You cannot use `\string\node' inside a pattern}}%
74 \def\tikz@edge@plain{\tikzerror{You cannot use `edge' inside a pattern}}%
75 \def\tikz@to{\tikzerror{You cannot use `to' paths inside a pattern}}%
76 \tikzset{pattern/.code={\tikzerror{You cannot nest patterns}},
77 pattern color/.style={pattern}}%
78 }%
79 \pgfdeclarepattern{/tikz/patterns/.cd,#1}%
80 \endgroup%
81 }%
82
83 \def\tikz@declarepattern@install{%
84 \let\tikz@compat@color@set=\tikz@compat@color@set@insidepatttern%
85 \tikz@installcommands%
86 }%
87
88 \let\tikz@compat@color@set@orig=\tikz@compat@color@set
89 \def\tikz@compat@color@set@insidepatttern#1{%
90 \tikz@compat@color@set@orig{#1}%
91 \pgfsetfillcolor{#1}\pgfsetstrokecolor{#1}%
92 }%
93
94
95 %%% Local Variables:
96 %%% mode: latex
97 %%% TeX-master: t
98 %%% End: