summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/generic
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-09-22 17:55:12 +0000
committerKarl Berry <karl@freefriends.org>2008-09-22 17:55:12 +0000
commited80c4f7098edf2e77cf9733453b78815de48b16 (patch)
tree7efb0f789c9d8348b55f7c7565beadca4b936532 /Master/texmf-dist/source/generic
parent9da98529e177e6454863e2131dfdb16dc2c37e85 (diff)
pst-slpe 1.3 (21sep08)
git-svn-id: svn://tug.org/texlive/trunk@10689 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/generic')
-rw-r--r--Master/texmf-dist/source/generic/pst-slpe/pst-slpe.dtx139
1 files changed, 130 insertions, 9 deletions
diff --git a/Master/texmf-dist/source/generic/pst-slpe/pst-slpe.dtx b/Master/texmf-dist/source/generic/pst-slpe/pst-slpe.dtx
index 50082497da5..a0717360da9 100644
--- a/Master/texmf-dist/source/generic/pst-slpe/pst-slpe.dtx
+++ b/Master/texmf-dist/source/generic/pst-slpe/pst-slpe.dtx
@@ -2,13 +2,14 @@
%\iffalse
%
% Copyright 1998-2008 Martin Giese, mgiese@risc.uni-linz.ac.at
-% Herbert Voss (using xkeyval, \psBall)
+% Herbert Voss (using xkeyval,\psBall,fading)
%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN archives
%% in directory macros/latex/base/lppl.txt.
%%
%\fi
+% \changes{v1.3}{2008/09/20}{ fading option (hv)}
% \changes{v1.2}{2008/06/19}{ \textbackslash psBall (hv)}
% \changes{v1.1}{2006/06/19}{%
% using the extended pst-xkey instead of the old pst-key package;
@@ -64,14 +65,14 @@
%
%\iffalse
%<*!prolog>
-\def\pstslpefileversion{1.2}
-\def\pstslpefiledate{2008/06/19}
+\def\pstslpefileversion{1.3}
+\def\pstslpefiledate{2008/09/20}
%</!prolog>
%\fi
%
% \title{\textsf{pst-slpe} package \\ version \pstslpefileversion}
-% \author{Martin Giese\footnote{email:\texttt{giese@ira.uka.de} Version 1.2 prepared
-% by Herbert Vo\ss\ \texttt{voss@pstricks.de}}}
+% \author{Martin Giese\footnote{\texttt{giese@ira.uka.de}} and
+% Herbert Vo\ss\footnote{\texttt{voss@pstricks.de}}}
% \date{\pstslpefiledate}
% \maketitle
%
@@ -199,7 +200,9 @@
% the general $\ldots$|slopes|-styles.\footnote{By the way, I use slope
% as a synonym for gradient. It sounds less pretentious and avoids
% name clashes.} The |cc|$\ldots$ styles paint concentric patterns,
-% and the |rad|$\ldots$ styles do radial ones. Here is a little
+% and the |rad|$\ldots$ styles do radial ones.
+%
+% Here is a little
% overview of what they look like:
% \newcommand{\st}{$\vcenter to30pt{}$}
% \begin{quote}\LARGE
@@ -358,6 +361,52 @@
% The default value for |sloperadius| is 0, which invokes the default
% behaviour of automatically calculating the radius.
%
+% \DescribeMacro{fading}
+% \DescribeMacro{startfading}
+% \DescribeMacro{endfading}
+% The optional boolean keyword |fading| allows a transparency effect of
+% the filled area, starting with the opacity value |startfading| and
+% ending with the value of |endfading|. Both values must be of the
+% intervall [0\ldots1], with 0 for total opacity and 1 for no
+% opacity. The values are preset by 0 and 1.
+%
+% Here is a little
+% overview of what they look like:
+% \begin{quote}\LARGE\color{white}
+% \begin{tabular}{cc}
+% \psframe*(-0.3,-0.25)(3,20pt)\psframebox[fading,fillstyle=slope]{\st| slope |} &\qquad
+% \psframe*(-0.3,-0.25)(3,20pt)\psframebox[fading,fillstyle=slopes]{\st| slopes |} \\[2ex]
+% \psframe*(-0.3,-0.25)(3,20pt)\psframebox[fading,fillstyle=ccslope]{\st|ccslope |} &\qquad
+% \psframe*(-0.3,-0.25)(3,20pt)\psframebox[fading,fillstyle=ccslopes]{\st|ccslopes|} \\[2ex]
+% \psframe*(-0.3,-0.25)(3,20pt)\psframebox[fading,fillstyle=radslope]{\st|radslope|} &\qquad
+% \psframe*(-0.3,-0.25)(3,20pt)\psframebox[fading,fillstyle=radslopes]{\st|radslopes|} \\[2ex]
+% \end{tabular}
+% \end{quote}
+% \color{black}
+%
+% These examples were produced by saying simply
+% \begin{verbatim}
+% \psframebox[fading,fillstyle=...]{...}
+% \end{verbatim}
+%
+% \begin{quote}\LARGE\color{white}
+% \psset{fading,startfading=0.3,endfading=0.8}
+% \begin{tabular}{cc}
+% \psframe*(-0.3,-0.25)(3,20pt)\psframebox[fillstyle=slope]{\st| slope |} &\qquad
+% \psframe*(-0.3,-0.25)(3,20pt)\psframebox[fillstyle=slopes]{\st| slopes |} \\[2ex]
+% \psframe*(-0.3,-0.25)(3,20pt)\psframebox[fillstyle=ccslope]{\st|ccslope |} &\qquad
+% \psframe*(-0.3,-0.25)(3,20pt)\psframebox[fillstyle=ccslopes]{\st|ccslopes|} \\[2ex]
+% \psframe*(-0.3,-0.25)(3,20pt)\psframebox[fillstyle=radslope]{\st|radslope|} &\qquad
+% \psframe*(-0.3,-0.25)(3,20pt)\psframebox[fillstyle=radslopes]{\st|radslopes|} \\[2ex]
+% \end{tabular}
+% \end{quote}
+% \color{black}
+%
+% These examples were produced by saying simply
+% \begin{verbatim}
+% \psframebox[fading,startfading=0.3,endfading=0.8,fillstyle=...]{...}
+% \end{verbatim}
+%
% \StopEventually{}
%
%\section{The Code}
@@ -396,7 +445,7 @@
\input{pst-slpe.tex}
\ProvidesFile{pst-slpe.tex}
[\pstslpefiledate\space v\pstslpefileversion\space
- `pst-slpe' (Martin Giese)]
+ `pst-slpe' (mg,hv)]
\IfFileExists{pst-slpe.pro}{%
\ProvidesFile{pst-slpe.pro}
[2008/06/19 v. 0.01, PostScript prologue file (hv)]
@@ -483,6 +532,28 @@
\psset[pst-slpe]{sloperadius=0}% --> hv
% \end{macrocode}
% \end{macro}
+% \begin{macro}{fading}
+% The default value for |fading| is false, which is no transparency effect at all.
+% With |fading=true| the package takes the values |startfading| and |endfading|
+% into account for the opacity effect of the filled area.
+% \end{macro}
+% \begin{macrocode}
+\define@boolkey[psset]{pst-slpe}[PST@]{fading}[true]{}% --> hv
+\psset[pst-slpe]{fading=false}% --> hv
+% \end{macrocode}
+% \begin{macro}{startfading}
+% The relativ number for the starting value (0\ldots1), preset by 0.
+% \end{macro}
+% \begin{macrocode}
+\define@key[psset]{pst-slpe}{startfading}{\pst@checknum{#1}\psk@startfading }% --> hv
+% \end{macrocode}
+% \begin{macro}{endfading}
+% The relativ number for the end value (0\ldots1), preset by 1.
+% \end{macro}
+% \begin{macrocode}
+\define@key[psset]{pst-slpe}{endfading}{\pst@checknum{#1}\psk@endfading }% --> hv
+\psset[pst-slpe]{startfading=0,endfading=1}% --> hv
+% \end{macrocode}
%
% \subsubsection{Fill style macros}
%
@@ -506,6 +577,7 @@
\psx@slopecolors\space
\psslopesteps
\psx@slopeangle
+ \ifPST@fading \psk@startfading \psk@endfading true \else false \fi
tx@PstSlopeDict begin SlopesFill end}}
% \end{macrocode}
% \end{macro}
@@ -527,7 +599,9 @@
1 \pst@usecolor\psslopeend currentrgbcolor
2
grestore
- \psslopesteps \psx@slopeangle tx@PstSlopeDict begin SlopesFill end}}
+ \psslopesteps \psx@slopeangle
+ \ifPST@fading \psk@startfading \psk@endfading true \else false \fi
+ tx@PstSlopeDict begin SlopesFill end}}
% \end{macrocode}
% \end{macro}
%
@@ -542,6 +616,7 @@
\addto@pscode{%
\psx@slopecolors\space
\psslopesteps \psx@slopecenter\space \psx@sloperadius\space
+ \ifPST@fading \psk@startfading \psk@endfading true \else false \fi
tx@PstSlopeDict begin CcSlopesFill end}}
\def\psfs@ccslope{%
\addto@pscode{%
@@ -549,11 +624,13 @@
1 \pst@usecolor\psslopeend currentrgbcolor
2 grestore
\psslopesteps \psx@slopecenter\space \psx@sloperadius\space
+ \ifPST@fading \psk@startfading \psk@endfading true \else false \fi
tx@PstSlopeDict begin CcSlopesFill end}}
\def\psfs@radslopes{%
\addto@pscode{%
\psx@slopecolors\space
\psslopesteps\psx@slopecenter\space\psx@sloperadius\space\psx@slopeangle
+ \ifPST@fading \psk@startfading \psk@endfading true \else false \fi
tx@PstSlopeDict begin RadSlopesFill end}}
% \end{macrocode}
% \end{macro}
@@ -573,6 +650,7 @@
4 \pst@usecolor\psslopebegin currentrgbcolor
5 grestore
\psslopesteps\psx@slopecenter\space\psx@sloperadius\space\psx@slopeangle
+ \ifPST@fading \psk@startfading \psk@endfading true \else false \fi
tx@PstSlopeDict begin RadSlopesFill end}}
% \end{macrocode}
% \end{macro}
@@ -613,6 +691,13 @@
/tx@PstSlopeDict 60 dict def tx@PstSlopeDict begin
% \end{macrocode}
%
+% \begin{macro}{Opacity++}
+% This macro increments the Opacity index
+% \begin{macrocode}
+/Opacity 1 def % preset, no transparency
+/Opacity++ { Opacity dOpacity add /Opacity ED } def
+% \end{macrocode}
+% \end{macro}
% \begin{macro}{max}
% $x1 \quad x2 \quad \mathtt{max}\quad max$\\
% |max| is a utility function that calculates the maximum
@@ -656,7 +741,10 @@
% \end{macrocode}
% To avoid gaps, we fill the whole path in that first colour.
% \begin{macrocode}
- gsave fill grestore
+ Opacity .setopacityalpha
+ gsave
+ fill
+ grestore
% \end{macrocode}
% The body of the following outer loop is executed
% once for each segment.
@@ -790,9 +878,16 @@
% translate the user system by |XInc|.
% \begin{macrocode}
/SlopesFill {
+ /Fading ED % do we have fading?
+ Fading {
+ /FadingEnd ED % the last opacity value
+ dup /FadingStart ED % the first opacity value
+ /Opacity ED % the opacity start value
+ } if
gsave
180 add rotate
/NumSteps ED
+ Fading { /dOpacity FadingEnd FadingStart sub NumSteps div def } if
clip
pathbbox
/h ED /w ED
@@ -801,6 +896,10 @@
w sub neg /w ED
/XInc w NumSteps div def
/DrawStep {
+ Fading { % do we have a fading?
+ Opacity .setopacityalpha % set opacity value
+ Opacity++ % increase opacity
+ } if
0 0 XInc h rectfill
XInc 0 translate
} bind def
@@ -834,11 +933,18 @@
% non-overlapping, `donut-shapes' would be slower.
% \begin{macrocode}
/CcSlopesFill {
+ /Fading ED % do we have fading?
+ Fading {
+ /FadingEnd ED % the last opacity value
+ dup /FadingStart ED % the first opacity value
+ /Opacity ED % the opacity start value
+ } if
gsave
/Radius ED
/CenterY ED
/CenterX ED
/NumSteps ED
+ Fading { /dOpacity FadingEnd FadingStart sub NumSteps div def } if
clip
pathbbox
/h ED /w ED
@@ -850,6 +956,10 @@
/RadPerStep Radius NumSteps div neg def
/Rad Radius def
/DrawStep {
+ Fading { % do we have a fading?
+ Opacity .setopacityalpha % set opacity value
+ Opacity++ % increase opacity
+ } if
0 0 Rad 0 360 arc
closepath fill
/Rad Rad RadPerStep add def
@@ -876,12 +986,19 @@
% as $|dY|:=|Radius|\times\tan(|AngleIncrement|)$.
% \begin{macrocode}
/RadSlopesFill {
+ /Fading ED % do we have fading?
+ Fading {
+ /FadingEnd ED % the last opacity value
+ dup /FadingStart ED % the first opacity value
+ /Opacity ED % the opacity start value
+ } if
gsave
rotate
/Radius ED
/CenterY ED
/CenterX ED
/NumSteps ED
+ Fading { /dOpacity FadingEnd FadingStart sub NumSteps div def } if
clip
pathbbox
/h ED /w ED
@@ -893,6 +1010,10 @@
/AngleIncrement 360 NumSteps div neg def
/dY AngleIncrement sin AngleIncrement cos div Radius mul def
/DrawStep {
+ Fading { % do we have a fading?
+ Opacity .setopacityalpha % set opacity value
+ Opacity++ % increase opacity
+ } if
0 0 moveto
Radius 0 rlineto
0 dY rlineto