Debian Codegraph @

texmf-dist/doc/latex/tikz-ext/tikz-ext-manual-en-library-patterns.images.tex

raw
1 % !TeX spellcheck = en_US
2 % !TeX root = tikz-ext-manual.tex
3 % Copyright 2022 by Qrrbrbirlbel
4 %
5 % This file may be distributed and/or modified
6 %
7 % 1. under the LaTeX Project Public License and/or
8 % 2. under the GNU Free Documentation License.
9 %
10 \clearpage
11 \section{Using Images as a Pattern}
12 \label{library:patterns.images}
13
14 \begin{tikzlibrary}{ext.patterns.images}
15 This library allows to use an image to be used as a repeating pattern for a path.
16
17 \inspiration{Pattern-Q}{Pattern-A}
18 \end{tikzlibrary}
19
20 With this library arbitrary images (or indeed PDF documents) can be used as
21 a repeating pattern for the background of a path.
22
23 This is a two-step process:
24 \begin{enumerate}
25 \item Declaring an image as an ``image-pattern''.
26 \item Using the ``image-pattern''.
27 \end{enumerate}
28
29 \begin{command}{\tikzextsetupimageaspattern\oarg{options}\marg{name}\marg{image}}\cmdcompat{\pgfsetupimageaspattern}
30 \end{command}
31
32 \begin{key}{/\tikzext/image as pattern=\meta{options} (default \{\})}\keycompat{tikz}
33
34 \begin{codeexample}[preamble=\usetikzlibrary{ext.patterns.images,shapes.geometric}]
35 \tikzextsetupimageaspattern[width=.5cm]{grid}{example-image-1x1}
36 \tikz \node[star, minimum size=3cm, draw,
37 ext/image as pattern={name=grid, options={left, bottom, y=-.5cm, rotate=45}}] {};
38 \end{codeexample}
39 \end{key}
40
41 \begin{key}{/\tikzext/image as pattern/name=\meta{name}}\keycompat{tikz/image as pattern}
42 Specifies the name of the ``image-pattern'' to be used.
43 \end{key}
44
45 \begin{stylekey}{/\tikzext/image as pattern/option}\keycompat{tikz/image as pattern}
46 Options that will be used by the internal |\pgftext|,\indexCommandO{\pgftext}
47 only keys from |/pgf/text| should be used.\indexKeyO[/pgf/]{text}
48 \end{stylekey}
49
50 \begin{key}{/\tikzext/image as pattern/options=\meta{style}}\keycompat{tikz/image as pattern}
51 Appends to style |/tikz/ext/image as pattern/option|.
52 \end{key}