%% BEGIN pst-grad.tex
%%
%% Gradient fillstyle with PSTricks.
%% See the PSTricks User's Guide for description.
%% This uses the header file `pst-grad.pro'.
%%
%% Based on some EPS files by
[email protected] (W. R. Lee).
%%
%%
%% COPYRIGHT 1993, 1994, 1999 by Timothy Van Zandt,
[email protected].
%% 2006 Herbert Voss,
[email protected]
%%
%% 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.
%%
%% This defines a new fill style, "gradient", for use with PSTricks,
%% which has gradiated color. The following parameters are used:
%%
%% gradbegin=color : Beginning color.
%% gradend=color : Final color.
%% gradlines=int : Number of lines to use. The higher the number,
%% the slower the rendering.
%% gradmidpoint=num : Gradient color goes from gradbegin to gradend,
%% and then back to beginning. Midpoint (point
%% where "gradend" color appears, is gradmidpoint
%% from the top. (0 <= Gmidpoint <= 1).
%% gradangle=angle : Rotate image by angle.
%% GradientCircle=true : Instead of a linear a circled gradient is build.
%% (version 1.04)
%% GradientPos=(x,y) : the center of the circled gradient
%% (version 1.04)
%% GradientScale=float : scaling factor of the circled gradient
%% (version 1.04)
%% GradientHSB : Use HSB color model
%% cmyk : Use CMYK color model
%%
\csname GradientLoaded\endcsname
\let\GradientLoaded\endinput
\ifx\PSTricksLoaded\endinput\else
\def\next{\input pstricks.tex }\expandafter\next
\fi
\ifx\PSTXKeyLoaded\endinput\else\input pst-xkey \fi
\def\fileversion{1.06}
\def\filedate{2006/11/27}
\message{`pst-grad' v\fileversion, \filedate\space (tvz,dg,hv)}
\edef\TheAtCode{\the\catcode`\@}
\catcode`\@=11
\pst@addfams{pst-grad}
\pstheader{pst-grad.pro}
\define@boolkey[psset]{pst-grad}[Pst@]{cmyk}[true]{%
\ifPst@cmyk
\newcmykcolor{gradbegin}{0 .1 .95 0.1}
\newcmykcolor{gradend}{0 0.8 0.6 0.5}
\else
\newrgbcolor{gradbegin}{0 .1 .95}
\newrgbcolor{gradend}{0 1 1}
\fi%
}
\psset[pst-grad]{cmyk=false}
%
\define@key[psset]{pst-grad}{gradbegin}{\pst@getcolor{#1}\psgradbegin}
\define@key[psset]{pst-grad}{gradend}{\pst@getcolor{#1}\psgradend}
\define@key[psset]{pst-grad}{gradlines}{%
\pst@getint{#1}\psgradlines
\ifnum\psgradlines<2
\@pstrickserr{gradlines must be at least 2}\@epha
\def\psgradlines{2 }%
\fi}
\define@key[psset]{pst-grad}{gradmidpoint}{\pst@checknum{#1}\psgradmidpoint}
\define@key[psset]{pst-grad}{gradangle}{\pst@getangle{#1}\psk@gradangle}
\psset[pst-grad]{gradangle=0,gradlines=300,gradend=gradend,gradbegin=gradbegin,
gradmidpoint=0.9}
% Denis Girou - April 1998 ------- patch 2 (hv)
% To define the gradient as linear or as circle
%==================================================================
\define@boolkey[psset]{pst-grad}[Pst@]{GradientCircle}[true]{}
% Position of the center of the gradient
\define@key[psset]{pst-grad}{GradientPos}{\psset@@GradientPos#1}%
\def\psset@@GradientPos(#1){\edef\ps@GradientPos{#1}}
% Scale factor
\define@key[psset]{pst-grad}{GradientScale}{\def\ps@GradientScale{#1}}
\psset[pst-grad]{GradientCircle=false,GradientScale=1,GradientPos={(0,0)}}
%=====================================================================
%
\define@boolkey[psset]{pst-grad}[Pst@]{gradientHSB}[true]{}
\psset[pst-grad]{gradientHSB=false}
%
\def\psfs@gradient{%
\ifPst@gradientHSB
\addto@pscode{%
gsave
gsave \pst@usecolor\psgradbegin currenthsbcolor grestore
gsave \pst@usecolor\psgradend currenthsbcolor grestore
\psgradlines
\psgradmidpoint
\psk@gradangle
% hv 2004-05-05 begin fixed a spurious blank
tx@GradientDict begin GradientFillHSB end grestore%
}%
% tx@GradientHSBDict begin GradientFillHSB end grestore}
% hv 2004-05-05 end
\else%
% hv 2004-06-25 begin fixed a spurious blank
\pst@getcoor{\ps@GradientPos}{\pst@tempa}% <- "%" hv 2004-06-23
% hv end
\addto@pscode{%
gsave
\ifPst@GradientCircle\space true \else false \fi
\ps@GradientScale\space
\pst@tempa\space
gsave \pst@usecolor\psgradbegin
\ifPst@cmyk currentcmykcolor \else currentrgbcolor \fi grestore
gsave \pst@usecolor\psgradend
\ifPst@cmyk currentcmykcolor \else currentrgbcolor \fi grestore
\psgradlines
\psgradmidpoint
\psk@gradangle
\ifPst@cmyk true \else false \fi
tx@GradientDict begin GradientFill end grestore%
}%
\fi%
}
%
\catcode`\@=\TheAtCode\relax
%
\endinput
%%
%% END pst-grad.tex