summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/storebox/storebox-pgf.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-12-21 23:42:58 +0000
committerKarl Berry <karl@freefriends.org>2011-12-21 23:42:58 +0000
commit7a7ec94b4428ad90afb90bd853d2cc8861e6313a (patch)
tree83c1a3551dbd6f06c00be6098d8cd2f747accee4 /Master/texmf-dist/tex/latex/storebox/storebox-pgf.sty
parent34adb1fdc882b4cbadf33ef1f919c673c42aae30 (diff)
storebox 1.3 (20dec11)
git-svn-id: svn://tug.org/texlive/trunk@24895 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/storebox/storebox-pgf.sty')
-rw-r--r--Master/texmf-dist/tex/latex/storebox/storebox-pgf.sty282
1 files changed, 282 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/storebox/storebox-pgf.sty b/Master/texmf-dist/tex/latex/storebox/storebox-pgf.sty
new file mode 100644
index 00000000000..da0d1829a6e
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/storebox/storebox-pgf.sty
@@ -0,0 +1,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'.