| 1 |
% Copyright 2018 by Till Tantau |
| 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 |
\ProvidesFileRCS{tikzlibraryfadings.code.tex} |
| 11 |
|
| 12 |
\usepgflibrary{fadings}% |
| 13 |
|
| 14 |
% |
| 15 |
% Environments for creating fadings |
| 16 |
% |
| 17 |
|
| 18 |
\def\tikzfadingfrompicture{% |
| 19 |
\begingroup% |
| 20 |
\setbox\pgfpic=\hbox\bgroup% |
| 21 |
\tikzpicture% |
| 22 |
}% |
| 23 |
\def\endtikzfadingfrompicture{% |
| 24 |
\global\let\tikz@smuggle=\tikz@fig@name% |
| 25 |
\endtikzpicture |
| 26 |
\egroup% |
| 27 |
\pgfdeclarefading{\tikz@smuggle}{\box\pgfpic}% |
| 28 |
\endgroup% |
| 29 |
}% |
| 30 |
|
| 31 |
% This makes it easier to maintain compatibility with the external lib: |
| 32 |
\def\starttikzfadingfrompicture{\tikzfadingfrompicture}% |
| 33 |
\def\stopttikzfadingfrompicture{\endtikzfadingfrompicture}% |
| 34 |
|
| 35 |
\def\tikzfading[#1]{% |
| 36 |
{% |
| 37 |
\setbox\pgfpic=\hbox{% |
| 38 |
\tikzset{#1}% |
| 39 |
\global\let\tikz@smuggle=\tikz@fig@name% |
| 40 |
\tikz{% |
| 41 |
\useasboundingbox(0,0) (100bp,100bp); |
| 42 |
\node at (50bp,50bp) [rotate=\tikz@shade@angle] |
| 43 |
{\pgfuseshading{\tikz@shading}}; |
| 44 |
}% |
| 45 |
}% |
| 46 |
\pgfdeclarefading{\tikz@smuggle}{\box\pgfpic}% |
| 47 |
}% |
| 48 |
}% |