Debian Codegraph @

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

raw
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{tikzlibraryshadows.code.tex}
11
12 \usetikzlibrary{fadings}%
13
14
15 % General options
16 \tikzset{
17 /tikz/shadow scale/.initial=1,
18 /tikz/shadow xshift/.initial=0pt,
19 /tikz/shadow yshift/.initial=0pt,
20 }%
21
22 % Basic shadow style
23 \tikzset{
24 general shadow/.style={
25 preaction={
26 #1,
27 transform canvas={
28 scale around=\pgfkeysvalueof{/tikz/shadow scale}:(current path bounding box.center),
29 shift={(\pgfkeysvalueof{/tikz/shadow xshift},\pgfkeysvalueof{/tikz/shadow yshift})}
30 },
31 }
32 },
33 every shadow/.style={}
34 }%
35
36
37
38 %
39 % Adds a simple drop shadow to a path
40 %
41
42 \tikzset{
43 /tikz/drop shadow/.style={
44 general shadow={%
45 shadow scale=1,
46 shadow xshift=.5ex,
47 shadow yshift=-.5ex,
48 opacity=.5,
49 fill=black!50,
50 every shadow,
51 #1
52 }
53 }
54 }%
55
56
57 %
58 % Adds a circular drop shadow to a path
59 %
60
61 \tikzset{
62 /tikz/circular drop shadow/.style={
63 general shadow={%
64 shadow scale=1.1,
65 shadow xshift=.3ex,
66 shadow yshift=-.3ex,
67 fill=black!50,
68 path fading={circle with fuzzy edge 15 percent},
69 every shadow,
70 #1
71 }
72 }
73 }%
74
75
76
77 %
78 % Adds a circular glow to a path
79 %
80
81 \tikzset{
82 /tikz/circular glow/.style={
83 general shadow={%
84 shadow scale=1.25,
85 shadow xshift=0pt,
86 shadow yshift=0pt,
87 fill=black!50,
88 path fading={circle with fuzzy edge 15 percent},
89 every shadow,
90 #1,
91 }
92 }
93 }%
94
95
96
97
98
99 %
100 % Adds a "copy" version of the path behind it.
101 %
102
103 \tikzset{
104 /tikz/copy shadow/.style={
105 general shadow={%
106 /utils/exec={\let\tikz@lib@shadow@fill=\tikz@fillcolor\let\tikz@lib@shadow@draw=\tikz@strokecolor},
107 shadow scale=1,
108 shadow xshift=.5ex,
109 shadow yshift=.5ex,
110 fill=\tikz@lib@shadow@fill,
111 draw=\tikz@lib@shadow@draw,
112 every shadow,
113 #1
114 }
115 }
116 }%
117
118
119 %
120 % Adds two "copies" of the path behind it.
121 %
122
123 \tikzset{
124 /tikz/double copy shadow/.style={
125 general shadow={%
126 /utils/exec={\let\tikz@lib@shadow@fill=\tikz@fillcolor\let\tikz@lib@shadow@draw=\tikz@strokecolor},
127 shadow scale=1,
128 shadow xshift=.5ex,
129 shadow yshift=.5ex,
130 fill=\tikz@lib@shadow@fill,
131 draw=\tikz@lib@shadow@draw,
132 #1,
133 shadow xshift/.expanded=2*\pgfkeysvalueof{/tikz/shadow xshift},
134 shadow yshift/.expanded=2*\pgfkeysvalueof{/tikz/shadow yshift},
135 },
136 general shadow={%
137 /utils/exec={\let\tikz@lib@shadow@fill=\tikz@fillcolor\let\tikz@lib@shadow@draw=\tikz@strokecolor},
138 shadow scale=1,
139 shadow xshift=.5ex,
140 shadow yshift=.5ex,
141 fill=\tikz@lib@shadow@fill,
142 draw=\tikz@lib@shadow@draw,
143 #1,
144 },
145 }
146 }%