PST Grad
PST Grad
v. 1.06 – 2006/11/27
Herbert Voß∗
July 11, 2007
Abstract
pst-grad is also one of the older and smaller packages. It provides
only one fill style. A gradient could be created with the macros known
from PSTricks, too, the use of pst-grad offers advantages though, since
one does not need to take care of the calculation of the intermediate colour
values.
This version of pst-grad integrates the function of the pst-ghsb
package, which supports the HSB color model.
Contents
1 Introduction 2
2 Parameters 2
2.1 gradbegin . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . 2
2.2 gradend . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . 3
2.3 gradlines . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . 3
2.4 gradmidpoint . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . 4
2.5 gradangle . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . 4
2.6 GradientCircle, GradientScale and GradientPos . . . . . . . 4
2.7 GradientHSB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
∗ Thanks to Lars Kotthoff and Angelo Rossi for translating this documentation!
1
1 Introduction
All parameters are only available when gradient is used as fill style. There are
further packages which support such fill styles, especially for circular gradients
(pst-slpe).
2 Parameters
Table 1 shows a compilation of the special parameters valid for pst-grad.
2.1 gradbegin
gradbegin denotes the parameter as well as the starting colour, which is a little
bit confusing here.
\newrgbcolor{gradbegin}{0 .1 .95} % default
1 \begin{pspicture}(5,3.5)
2 \psframe[fillstyle=gradient,gradbegin=white
](5,1.5)
3 \newrgbcolor{gradbegin}{0 1 1}
4 \psframe[fillstyle=gradient](0,2)(5,3.5)
5 \end{pspicture}
2
• gradbegin should be defined as RGB colour, since a faultless function for
CMYK or gray scales is not warranted in every case.
2.2 gradend
gradend is not the counterpart to gradbegin, for it is the colour which is
reached at the relative point gridmidpoint. In every case it is ambiguous as
gradbegin again.
\newrgbcolor{gradend}{0 1 1} % default
1 \begin{pspicture}(5,3.5)
2 \psframe[fillstyle=gradient,gradend=white
](5,1.5)
3 \newrgbcolor{gradend}{1 0 0}
4 \psframe[fillstyle=gradient](0,2)(5,3.5)
5 \end{pspicture}
2.3 gradlines
A gradient is nothing but a string of coloured lines. The width of those depends
only on the resolution of the monitor resp. the printer in the end. But since
this is very user-specific, pst-grad allows any number of lines, which can be
changed through gradlines.
3
1 \begin{pspicture}(5,4)
2 \psset{fillstyle=gradient,linestyle=none}
3 \psframe[gradlines=5](5,1)
4 \psframe(0,1.5)(5,2.5)
5 \psframe[gradlines=1000](0,3)(5,4)
6 \end{pspicture}
2.4 gradmidpoint
Denotes the relative point where the colour gradend is reached. Then it is
proceeded in reverse order.
1 \begin{pspicture}(5,4)
2 \psset{fillstyle=gradient,linestyle=none}
3 \psframe[gradmidpoint=0](5,1)
4 \psframe[gradmidpoint=0.5](0,1.5)(5,2.5)
5 \psframe[gradmidpoint=1](0,3)(5,4)
6 \end{pspicture}
2.5 gradangle
gradangle determines the gradient angle of the straight line.
1 \begin{pspicture}(5,4)
2 \psset{fillstyle=gradient,linestyle=none,
gradmidpoint=0.5}
3 \psframe[gradangle=0](5,1)
4 \psframe[gradangle=45](0,1.5)(5,2.5)
5 \psframe[gradangle=90](0,3)(5,4)
6 \end{pspicture}
4
1 \begin{pspicture}(5,4)
2 \psset{fillstyle=gradient,linestyle=none}
3 \psframe[GradientCircle=true](5,1)%
4 \psframe[GradientCircle=true,GradientScale
=3](0,1.5)(5,2.5)%
5 \psframe[GradientCircle=true,GradientScale
=2,%
6 GradientPos={(4,3.5)}](0,3)(5,4)%
7 \end{pspicture}
5
2.7 GradientHSB
1 \newcommand{\Fig}[1][]{%
2 \begin{pspicture}(5.5,5.5)
3 \psframe[#1](5,5)
4 \end{pspicture}}
5 \newhsbcolor{ColorA}{0 0 0.7}
6 \newhsbcolor{ColorB}{0 1 0.7}
7 \newhsbcolor{ColorC}{.5 0.8 0}
8 \newhsbcolor{ColorD}{.5 0.8 1}
9 \psset{fillstyle=gradient,gradientHSB=
true}
10 \Fig[gradmidpoint=1,gradbegin=ColorA,
gradend=ColorB]
11 \Fig[gradmidpoint=0.5,gradbegin=ColorC,
gradend=ColorD]
6
7
1 \definecolor{ColorA}{hsb}{0.7, 0.1, 0.8}
2 \definecolor{ColorB}{hsb}{0.7, 0.9, 0.8}
3 \definecolor{ColorC}{hsb}{0, 0, 0}
4 \definecolor{ColorD}{hsb}{0, 0, 1}
5 \definecolor{ColorE}{hsb}{0, 0, 0.5}
6 \definecolor{ColorF}{hsb}{0, 1, 0.5}
7 \definecolor{ColorG}{hsb}{0, 0, 0.5}
8 \definecolor{ColorH}{hsb}{0.99999, 0, 0.5} % As it’s cycliç 1=0 !
9 \definecolor{ColorI}{hsb}{1, 1, 1}
10 \definecolor{ColorJ}{hsb}{1, 0, 0}
11 \definecolor{ColorK}{hsb}{0.99999, 1, 1} % As it’s cyclic 1=0 !
12 \definecolor{ColorL}{hsb}{0, 1, 0}
13 \definecolor{ColorM}{hsb}{0.99999, 1, 1} % As it’s cyclic 1=0 !
14 \definecolor{ColorN}{hsb}{0, 0, 1}
15 \definecolor{ColorO}{hsb}{0, 0.6, 0.7}
16 \definecolor{ColorP}{hsb}{0.99999, 0.7, 0.7} % As it’s cyclic 1=0 !
17 \definecolor{ColorQ}{hsb}{0.3, 0, 0.8}
18 \definecolor{ColorR}{hsb}{0.3, 1, 0.8}
19 \definecolor{ColorS}{hsb}{0.6, 0.3, 0}
20 \definecolor{ColorT}{hsb}{0.6, 0.3, 1}
21 \psset{fillstyle=gradient,gradmidpoint=1}
22 \Fig[gradbegin=yellow,gradend=green]
23 \Fig[gradientHSB=true,gradbegin=ColorA,gradend=ColorB]
24
8
25 \Fig[gradbegin=green,gradend=yellow]
26 \psset{gradientHSB=true}
27 \Fig[gradbegin=ColorC,gradend=ColorD]
28
29 \Fig[gradbegin=ColorE,gradend=ColorF]
30 \Fig[gradbegin=ColorG,gradend=ColorH]
31
32 \Fig[gradbegin=ColorI,gradend=ColorJ]
33 \Fig[gradbegin=ColorK,gradend=ColorL]
34
35 \Fig[gradbegin=ColorM,gradend=ColorN]
36 \Fig[gradbegin=ColorO,gradend=ColorP]
37
38 \Fig[gradbegin=ColorQ,gradend=ColorR]
39 \Fig[gradbegin=ColorS,gradend=ColorT]
References
[1] Hendri Adriaens. The xkeyval - package.
CTAN:/macros/latex/contrib/xkeyval/ , 2006.
9
[11] Herbert Voß. Three dimensional plots with pst-3dplot. TUGboat, 22-
4:319, December 2001.
[12] Herbert Voß. PSTricks – Grafik für TEX und LATEX. DANTE –
Lehmanns, Heidelberg/Hamburg, forth edition, 2007.
[13] Herbert Voß. The pstricks-add - package.
CTAN:/graphics/pstricks/contrib/pstricks-add/ , 2007.
[14] Herbert Voß and Jana Voß. The plot functions of pst-plot. TUGboat,
22-4:314–318, December 2001.
[15] Michael Wiedmann. References for TEX and Friends.
http://www.miwie.org/tex-refs/ , 2004.
[17] Timothy van Zandt. multido.tex - a loop macro, that supports fixed-
point addition. CTAN:/graphics/pstricks/generic/multido.tex , 2004.
[18] Timothy Van Zandt. The pst-plot - package.
CTAN:/graphics/pstricks/generic/ , 2004.
[19] Timothy van Zandt. PSTricks - PostScript macros for generic TEX.
http://www.tug.org/application/PSTricks , 2006.
[20] Timothy van Zandt and Denis Girou. Inside PSTricks. TUGboat, 15:239–
246, September 1994.
10
Index
gradangle, 2, 4
gradbegin, 2
gradend, 2, 3
GradientCircle, 2, 4
gradientHSB, 2
GradientPos, 2, 4
GradientScale, 2, 4
gradlines, 2, 3
gradmidpoint, 2, 4
Paket
pst-grad, 1
pst-slpe, 2
Parameter
GradientCircle, 2
GradientPos, 2
GradientScale, 2
gradangle, 2
gradbegin, 2
gradend, 2
gradientHSB, 2
gradlines, 2
gradmidpoint, 2
pst-grad, 1
RGB, 3
11