summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pstricks/pst-grad.tex
blob: 279b11c26ed98e5bf7dda84934ca52efd24af237 (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
%% 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 leeweyr!bill@nuchat.sccsi.com (W. R. Lee).
%%
\def\fileversion{1.04}
\def\filedate{2004/06/24}
%%
%% COPYRIGHT 1993, 1994, 1999 by Timothy Van Zandt, tvz@nwu.edu.
%%
%% 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.
%%
%% version 1.04 prepared by Herbert Voss <voss _at_ pstricks.de>
%%
%% 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)
%%
\message{ v\fileversion, \filedate}

\csname GradientLoaded\endcsname
\let\GradientLoaded\endinput

\ifx\PSTricksLoaded\endinput\else
  \def\next{\input pstricks.tex }\expandafter\next
\fi

\edef\TheAtCode{\the\catcode`\@}
\catcode`\@=11

\pstheader{pst-grad.pro}

\newrgbcolor{gradbegin}{0 .1 .95}
\def\psset@gradbegin#1{\pst@getcolor{#1}\psgradbegin}
\psset@gradbegin{gradbegin}

\newrgbcolor{gradend}{0 1 1}
\def\psset@gradend#1{\pst@getcolor{#1}\psgradend}
\psset@gradend{gradend}

\def\psset@gradlines#1{%
  \pst@getint{#1}\psgradlines
  \ifnum\psgradlines<2
    \@pstrickserr{gradlines must be at least 2}\@epha
    \def\psgradlines{2 }%
  \fi}
\psset@gradlines{300}

\def\psset@gradmidpoint#1{\pst@checknum{#1}\psgradmidpoint}
\psset@gradmidpoint{.9}

\def\psset@gradangle#1{\pst@getangle{#1}\psk@gradangle}
\psset@gradangle{0}

% Denis Girou - April 1998  ------- patch 2 (hv)
% To define the gradient as linear or as circle
\newif\ifGradientCircle
\def\psset@GradientCircle#1{\@nameuse{GradientCircle#1}}
\psset@GradientCircle{false}

% Position of the center of the gradient
\def\psset@GradientPos#1{\psset@@GradientPos#1}
\def\psset@@GradientPos(#1){\edef\ps@GradientPos{#1}}
\psset@GradientPos{(0,0)}

% Scale factor
\def\psset@GradientScale#1{\edef\ps@GradientScale{#1}}
\psset@GradientScale{1}

\def\psfs@gradient{%
% D.G. modification begin - Apr.  9, 1998
  %\addto@pscode{gsave
  \pst@getcoor{\ps@GradientPos}{\pst@tempa}% <- "%"  hv 2004-06-23 
  \addto@pscode{gsave
    \ifGradientCircle true \else false \fi
    \ps@GradientScale\space
    \pst@tempa
% D.G. modification end
    gsave \pst@usecolor\psgradbegin currentrgbcolor grestore
    gsave \pst@usecolor\psgradend currentrgbcolor grestore
    \psgradlines
    \psgradmidpoint
    \psk@gradangle
    tx@GradientDict begin GradientFill end grestore
  }%
}

\catcode`\@=\TheAtCode\relax

\endinput
%%
%% END pst-grad.tex