summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikz-ext/doc/tikz-ext-manual-en-library-patterns.images.tex
blob: 2c02b157a97810c28132433ded6515816245d33a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
% !TeX spellcheck = en_US
% !TeX root = tikz-ext-manual.tex
% Copyright 2022 by Qrrbrbirlbel
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Free Documentation License.
%
\clearpage
\section{Using Images as a Pattern}
\label{library:patterns.images}

\begin{tikzlibrary}{patterns.images}
  This library allows to use an image to be used as a repeating pattern for a path.
\end{tikzlibrary}

With this library arbitrary images (or indeed PDF documents) can be used as
a repeating pattern for the background of a path.

This is a two-step process:
\begin{enumerate}
\item Declaring an image as an ``image-pattern''.
\item Using the ``image-pattern''.
\end{enumerate}

\begin{command}{\pgfsetupimageaspattern\oarg{options}\marg{name}\marg{image}}
\end{command}

\begin{key}{/tikz/image as pattern=\meta{options} (default |\{\}|)}

\begin{codeexample}[preamble=\usetikzlibrary{patterns.images}]
\pgfsetupimageaspattern[width=.5cm]{grid}{example-image-1x1}
\tikz \node[star, minimum size=3cm, draw,
  image as pattern={name=grid,options={left, bottom, y=-.5cm, rotate=45}}] {};
\end{codeexample}
\end{key}

\begin{key}{/tikz/image as pattern/name=\meta{name}}
Specifies the name of the ``image-pattern'' to be used.
\end{key}

\begin{stylekey}{/tikz/image as pattern/option}
Options that's be used by the internal |\pgftext|,
only keys from |/pgf/text| should be used.
\end{stylekey}

\begin{stylekey}{/tikz/image as pattern/options=\meta{style}}
Appends style |/tikz/image as pattern/option|.
\end{stylekey}