blob: da0d1829a6eb809504877bde794fbcaa0bef7327 (
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
%% This support package contains patches for the file 'pgfsys-pdftex.def' file from
%% the TikZ/PGF bundle. All patches code is copyright by the TikZ/PGF authors
%% and is used in this file according to the LPPL license.
%% Please see the copyright and license notices in the 'pgfsys-pdftex.def' file.
%%
%% The rest of the code of this file is under the following copyright and licence:
%%
%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer-online.de>
%% ---------------------------------------------------------------------------
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainer of this work is Martin Scharrer.
%%
%% This work consists of the files storebox.dtx and storebox.ins
%% and the derived filebase storebox.sty and storebox-pgf.sty.
%%
\ProvidesPackage{storebox-pgf}[%
2011/12/21
v1.3a
Patches for PGF to support transparency and shadings inside storeboxes]
\begingroup
\let\on@line\@gobble
\@ifl@ter{def}{pgfsys-pdftex}{2009/05/23}{%
\PackageInfo{storebox-pgf}{Newer version of 'pgfsys-pdftex.def' found.\MessageBreak No patches applied.}%
\endgroup
\endinput
}{}%
\def\storebox@patch#1#2#3#4{%
\ifx#1\@undefined
\PackageInfo{storebox-pgf}{Macro \string#1\space not defined.\MessageBreak No patch applied.}%
\else
\def\@tempa#2{#3}%
\ifx#1\@tempa
\PackageInfo{storebox-pgf}{Patching macro \string#1.}%
\gdef#1#2{#4}%
\else
\PackageInfo{storebox-pgf}{Macro \string#1\space with unknown definition.\MessageBreak No patch applied.}%
\fi
\fi
}
\storebox@patch\pgfsys@horishading{#1#2#3}{%
{%
\pgf@parsefunc{#3}%
\pgfmathparse{#2}%
\setbox\pgfutil@tempboxa=\hbox to\pgf@max{\vbox to\pgfmathresult pt{\vfil\pgfsys@invoke{/Sh sh}}\hfil}%
\pgf@process{\pgfpoint{\pgf@max}{#2}}%
\pdfxform resources {%
/Shading << /Sh << /ShadingType 2
/ColorSpace /DeviceRGB
/Domain [\pgf@pdfparseddomain]
/Coords [\pgf@doma\space0 \pgf@domb\space0]
/Function \pgf@pdfparsedfunction
/Extend [false false] >> >>}\pgfutil@tempboxa% <<
\expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}%
}%
}{%
{%
\pgf@parsefunc{#3}%
\pgfmathparse{#2}%
\setbox\pgfutil@tempboxa=\hbox to\pgf@max{\vbox to\pgfmathresult pt{\vfil\pgfsys@invoke{/Sh sh}}\hfil}%
\pgf@process{\pgfpoint{\pgf@max}{#2}}%
\immediate\pdfxform resources {%
/Shading << /Sh << /ShadingType 2
/ColorSpace /DeviceRGB
/Domain [\pgf@pdfparseddomain]
/Coords [\pgf@doma\space0 \pgf@domb\space0]
/Function \pgf@pdfparsedfunction
/Extend [false false] >> >>}\pgfutil@tempboxa% <<
\expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}%
}%
}
\storebox@patch\pgfsys@vertshading{#1#2#3}{%
{%
\pgf@parsefunc{#3}%
\pgfmathparse{#2}%
\setbox\pgfutil@tempboxa=\hbox to\pgfmathresult pt{\vbox to\pgf@max{\vfil\pgfsys@invoke{/Sh sh}}\hfil}%
\pgf@process{\pgfpoint{#2}{\pgf@max}}%
\pdfxform resources {%
/Shading << /Sh << /ShadingType 2
/ColorSpace /DeviceRGB
/Domain [\pgf@pdfparseddomain]
/Coords [0 \pgf@doma\space0 \pgf@domb]
/Function \pgf@pdfparsedfunction
/Extend [false false] >> >>}\pgfutil@tempboxa% <<
\expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}%
}%
}{%
{%
\pgf@parsefunc{#3}%
\pgfmathparse{#2}%
\setbox\pgfutil@tempboxa=\hbox to\pgfmathresult pt{\vbox to\pgf@max{\vfil\pgfsys@invoke{/Sh sh}}\hfil}%
\pgf@process{\pgfpoint{#2}{\pgf@max}}%
\immediate\pdfxform resources {%
/Shading << /Sh << /ShadingType 2
/ColorSpace /DeviceRGB
/Domain [\pgf@pdfparseddomain]
/Coords [0 \pgf@doma\space0 \pgf@domb]
/Function \pgf@pdfparsedfunction
/Extend [false false] >> >>}\pgfutil@tempboxa% <<
\expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}%
}%
}
\storebox@patch\pgfsys@radialshading{#1#2#3}{%
{%
\pgf@parsefunc{#3}%
\setbox\pgfutil@tempboxa=\hbox to2\pgf@max{\vbox to2\pgf@max{\vfil\pgfsys@invoke{/Sh sh}}\hfil}%
\pgf@process{#2}%
\pgf@xa=\pgf@x%
\pgf@ya=\pgf@y%
\pgf@process{\pgfpoint{\pgf@max}{\pgf@max}}%
\advance\pgf@xa by \pgf@x%
\advance\pgf@ya by \pgf@y%
\pgf@sys@bp@correct{\pgf@x}%
\pgf@sys@bp@correct{\pgf@y}%
\pgf@sys@bp@correct{\pgf@xa}%
\pgf@sys@bp@correct{\pgf@ya}%
\pdfxform resources {%
/Shading << /Sh << /ShadingType 3
/ColorSpace /DeviceRGB
/Domain [\pgf@pdfparseddomain]
/Coords [\pgf@sys@tonumber{\pgf@xa} \pgf@sys@tonumber{\pgf@ya} \pgf@doma\space \pgf@sys@tonumber{\pgf@x} \pgf@sys@tonumber{\pgf@y} \pgf@domb]
/Function \pgf@pdfparsedfunction
/Extend [true false] >> >>}\pgfutil@tempboxa% <<
\expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}%
}%
}{%
{%
\pgf@parsefunc{#3}%
\setbox\pgfutil@tempboxa=\hbox to2\pgf@max{\vbox to2\pgf@max{\vfil\pgfsys@invoke{/Sh sh}}\hfil}%
\pgf@process{#2}%
\pgf@xa=\pgf@x%
\pgf@ya=\pgf@y%
\pgf@process{\pgfpoint{\pgf@max}{\pgf@max}}%
\advance\pgf@xa by \pgf@x%
\advance\pgf@ya by \pgf@y%
\pgf@sys@bp@correct{\pgf@x}%
\pgf@sys@bp@correct{\pgf@y}%
\pgf@sys@bp@correct{\pgf@xa}%
\pgf@sys@bp@correct{\pgf@ya}%
\immediate\pdfxform resources {%
/Shading << /Sh << /ShadingType 3
/ColorSpace /DeviceRGB
/Domain [\pgf@pdfparseddomain]
/Coords [\pgf@sys@tonumber{\pgf@xa} \pgf@sys@tonumber{\pgf@ya} \pgf@doma\space \pgf@sys@tonumber{\pgf@x} \pgf@sys@tonumber{\pgf@y} \pgf@domb]
/Function \pgf@pdfparsedfunction
/Extend [true false] >> >>}\pgfutil@tempboxa% <<
\expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}%
}%
}%
\storebox@patch\pgfsys@functionalshading{#1#2#3#4}{%
{%
\pgf@process{#2}%
\pgf@xa=\pgf@x%
\pgf@ya=\pgf@y%
\pgf@process{#3}%
\pgf@xb=\pgf@x%
\pgf@yb=\pgf@y%
\advance\pgf@x by-\pgf@xa%
\advance\pgf@y by-\pgf@ya%
\setbox\pgfutil@tempboxa=\hbox to\pgf@x{\vbox to\pgf@y{\vfil\pgfsys@invoke{/Sh sh}}\hfil}%
\pgf@sys@bp@correct{\pgf@xa}%
\pgf@sys@bp@correct{\pgf@ya}%
\pgf@sys@bp@correct{\pgf@xb}%
\pgf@sys@bp@correct{\pgf@yb}%
\pgf@xc=-\pgf@xa%
\pgf@yc=-\pgf@ya%
% Now build the function
\pdfobj
stream
attr
{
/FunctionType 4
/Domain [\pgf@sys@tonumber{\pgf@xa}\space\pgf@sys@tonumber{\pgf@xb}\space\pgf@sys@tonumber{\pgf@ya}\space\pgf@sys@tonumber{\pgf@yb}]
/Range [0 1 0 1 0 1]
}
{{#4}}%
\edef\pgf@temp@num{\the\pdflastobj}%
\pdfxform resources {%
/Shading << /Sh << /ShadingType 1
/ColorSpace /DeviceRGB
/Matrix [1 0 0 1 \pgf@sys@tonumber{\pgf@xc}\space\pgf@sys@tonumber{\pgf@yc}]
/Domain [\pgf@sys@tonumber{\pgf@xa}\space\pgf@sys@tonumber{\pgf@xb}\space\pgf@sys@tonumber{\pgf@ya}\space\pgf@sys@tonumber{\pgf@yb}]
/Function \pgf@temp@num\space 0 R
>> >>}\pgfutil@tempboxa% <<
\expandafter\xdef\csname @pgfshading#1!\endcsname{%
\leavevmode%
\noexpand\pdfrefxform\the\pdflastxform%
\noexpand\pdfrefobj\pgf@temp@num%
}%
}%
}{%
{%
\pgf@process{#2}%
\pgf@xa=\pgf@x%
\pgf@ya=\pgf@y%
\pgf@process{#3}%
\pgf@xb=\pgf@x%
\pgf@yb=\pgf@y%
\advance\pgf@x by-\pgf@xa%
\advance\pgf@y by-\pgf@ya%
\setbox\pgfutil@tempboxa=\hbox to\pgf@x{\vbox to\pgf@y{\vfil\pgfsys@invoke{/Sh sh}}\hfil}%
\pgf@sys@bp@correct{\pgf@xa}%
\pgf@sys@bp@correct{\pgf@ya}%
\pgf@sys@bp@correct{\pgf@xb}%
\pgf@sys@bp@correct{\pgf@yb}%
\pgf@xc=-\pgf@xa%
\pgf@yc=-\pgf@ya%
% Now build the function
\pdfobj
stream
attr
{
/FunctionType 4
/Domain [\pgf@sys@tonumber{\pgf@xa}\space\pgf@sys@tonumber{\pgf@xb}\space\pgf@sys@tonumber{\pgf@ya}\space\pgf@sys@tonumber{\pgf@yb}]
/Range [0 1 0 1 0 1]
}
{{#4}}%
\edef\pgf@temp@num{\the\pdflastobj}%
\immediate\pdfxform resources {%
/Shading << /Sh << /ShadingType 1
/ColorSpace /DeviceRGB
/Matrix [1 0 0 1 \pgf@sys@tonumber{\pgf@xc}\space\pgf@sys@tonumber{\pgf@yc}]
/Domain [\pgf@sys@tonumber{\pgf@xa}\space\pgf@sys@tonumber{\pgf@xb}\space\pgf@sys@tonumber{\pgf@ya}\space\pgf@sys@tonumber{\pgf@yb}]
/Function \pgf@temp@num\space 0 R
>> >>}\pgfutil@tempboxa% <<
\expandafter\xdef\csname @pgfshading#1!\endcsname{%
\leavevmode%
\noexpand\pdfrefxform\the\pdflastxform%
\noexpand\pdfrefobj\pgf@temp@num%
}%
}%
}
\storebox@patch\pgfsys@fadingfrombox{#1#2}{%
{%
\pgf@sys@pdf@check@resources%
\pgf@x=-.5\wd#2%
\pgf@y=-.5\ht#2%
\advance\pgf@y by.5\dp#2%
\expandafter\xdef\csname pgfsmasktrans@#1\endcsname{%
\noexpand\pgftransformcm{1}{0}{0}{1}{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}%
\pdfxform resources { \pgf@sys@pdf@possible@resources } #2%
\expandafter\xdef\csname pgfsmaskxform@#1\endcsname{\the\pdflastxform}%
}%
}{%
{%
\pgf@sys@pdf@check@resources%
\pgf@x=-.5\wd#2%
\pgf@y=-.5\ht#2%
\advance\pgf@y by.5\dp#2%
\expandafter\xdef\csname pgfsmasktrans@#1\endcsname{%
\noexpand\pgftransformcm{1}{0}{0}{1}{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}%
\immediate\pdfxform resources { \pgf@sys@pdf@possible@resources } #2%
\expandafter\xdef\csname pgfsmaskxform@#1\endcsname{\the\pdflastxform}%
}%
}
\storebox@patch\pgfsys@transparencygroupfrombox{#1}{%
\pgf@sys@pdf@check@resources%
\pdfxform
attr { /Group << /S /Transparency >> } %<<
resources { \pgf@sys@pdf@possible@resources }
#1%
\setbox#1=\hbox{\pdfrefxform\pdflastxform}%
}{%
\pgf@sys@pdf@check@resources%
\immediate\pdfxform
attr { /Group << /S /Transparency >> } %<<
resources { \pgf@sys@pdf@possible@resources }
#1%
\setbox#1=\hbox{\pdfrefxform\pdflastxform}%
}
\endgroup
\endinput
%%
%% End of file `storebox-pgf.sty'.
|