summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransparency.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransparency.code.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransparency.code.tex91
1 files changed, 90 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransparency.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransparency.code.tex
index 3048e6077fe..47484997af7 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransparency.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransparency.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoretransparency.code.tex,v 1.2 2008/01/17 20:09:16 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoretransparency.code.tex,v 1.5 2013/09/30 18:30:15 tantau Exp $
% Sets the opacity of stroking operations.
@@ -39,6 +39,37 @@
+% Sets the current blend mode. See Section 7.2.4 of the PDF
+% Specification 1.7 for an introduction to blend modes in general.
+%
+% #1 = One of the following modes, see also section 7.2.4 of the
+% PDF Specification 1.7. (The PGF names, which are all lowercase with
+% spaces as usual, must be mapped to the PDF or SVG by the drivers.)
+%
+% normal
+% multiply
+% screen
+% overlay
+% darken
+% lighten
+% color dodge
+% color burn
+% hard light
+% soft light
+% difference
+% exclusion
+% saturation
+% color
+% hue
+% luminosity
+%
+% Example:
+%
+% \pgfsetblendmode{multiply}
+
+\def\pgfsetblendmode#1{\pgfsys@blend@mode{#1}}
+
+
% Declares a new fading based on the contents of a box.
%
% #1 = name of the fading
@@ -156,8 +187,10 @@
% Calculate scaling:
\pgf@xc=\pgf@pathmaxx%
\advance\pgf@xc by-\pgf@pathminx%
+ \ifdim\pgf@xc<0.1pt\pgf@xc=0.1pt\fi%
\pgf@yc=\pgf@pathmaxy%
\advance\pgf@yc by-\pgf@pathminy%
+ \ifdim\pgf@yc<0.1pt\pgf@yc=0.1pt\fi%
\pgf@xc=.02\pgf@xc%
\pgf@yc=.02\pgf@yc%
% Compute new transformation matrix:
@@ -171,6 +204,49 @@
+% Use a previously declared fading scaled for the current path.
+%
+% #1 - an fading
+% #2 - extra transformations
+%
+% Description:
+%
+% This command works like \pgfsetfadingforcurrentpath, only it takes
+% the current line width into account: Before the path is considered,
+% it is enlarged by half the line width in all directions.
+
+\def\pgfsetfadingforcurrentpathstroked#1#2{%
+ \ifdim\pgf@pathminx=16000pt%
+ % Path was empty -> use natural size
+ \pgfsetfading{#1}{#2}%
+ \else%
+ \pgfsetfading{#1}{%
+ % Calculate center:
+ \pgf@xb=.5\pgf@pathmaxx%
+ \advance\pgf@xb by.5\pgf@pathminx%
+ \pgf@yb=.5\pgf@pathmaxy%
+ \advance\pgf@yb by.5\pgf@pathminy%
+ % Calculate scaling:
+ \pgf@xc=\pgf@pathmaxx%
+ \advance\pgf@xc by-\pgf@pathminx%
+ \advance\pgf@xc by\pgflinewidth%
+ \ifdim\pgf@xc<0.1pt\pgf@xc=0.1pt\fi%
+ \pgf@yc=\pgf@pathmaxy%
+ \advance\pgf@yc by-\pgf@pathminy%
+ \advance\pgf@yc by\pgflinewidth%
+ \ifdim\pgf@yc<0.1pt\pgf@yc=0.1pt\fi%
+ \pgf@xc=.02\pgf@xc%
+ \pgf@yc=.02\pgf@yc%
+ % Compute new transformation matrix:
+ \pgftransformcm{1}{0}{0}{1}{\pgfqpoint{\pgf@xb}{\pgf@yb}}%
+ \pgftransformcm{\pgf@sys@tonumber{\pgf@xc}}{0}{0}{\pgf@sys@tonumber{\pgf@yc}}{\pgfpointorigin}%
+ #2%
+ }%
+ \fi%
+}
+
+
+
% Group things in a a transparency group
%
% Description:
@@ -186,9 +262,22 @@
%
\def\pgftransparencygroup{%
+ \pgfutil@ifnextchar[{\pgftransparencygroup@}{\pgftransparencygroup@[]}%
+}
+\def\pgftransparencygroup@[#1]{%
\begingroup%
+ \pgfkeys{/pgf/transparency group options/.cd,%
+ isolated=false,
+ knockout=false,
+ #1}%
\setbox\pgfutil@tempboxa=\hbox\bgroup%
}
+\pgfkeys{
+ /pgf/transparency group options/.cd,
+ isolated/.is if=pgfsys@transparency@group@isolated,
+ knockout/.is if=pgfsys@transparency@group@knockout
+}
+
\def\endpgftransparencygroup{%
\egroup%
% Now compute the correct position. This is a bit tricky...