summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfadings.code.tex
blob: bec6487b98aafef6c42741eda52bbc173ae43972 (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
% Copyright 2006 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.

\ProvidesFileRCS{tikzlibraryfadings.code.tex}

\usepgflibrary{fadings}%

%
% Environments for creating fadings
%

\def\tikzfadingfrompicture{%
  \begingroup%
    \setbox\pgfpic=\hbox\bgroup%
      \tikzpicture%
}%
\def\endtikzfadingfrompicture{%
        \global\let\tikz@smuggle=\tikz@fig@name%
      \endtikzpicture
    \egroup%
    \pgfdeclarefading{\tikz@smuggle}{\box\pgfpic}%
  \endgroup%
}%

% This makes it easier to maintain compatibility with the external lib:
\def\starttikzfadingfrompicture{\tikzfadingfrompicture}%
\def\stopttikzfadingfrompicture{\endtikzfadingfrompicture}%

\def\tikzfading[#1]{%
  {%
    \setbox\pgfpic=\hbox{%
      \tikzset{#1}%
      \global\let\tikz@smuggle=\tikz@fig@name%
      \tikz{%
        \useasboundingbox(0,0) (100bp,100bp);
        \node at (50bp,50bp) [rotate=\tikz@shade@angle]
        {\pgfuseshading{\tikz@shading}};
      }%
    }%
    \pgfdeclarefading{\tikz@smuggle}{\box\pgfpic}%
  }%
}%