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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
|
\documentclass[english]{article}
%
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\listfiles
\usepackage[scaled]{luximono}
\usepackage{lmodern}
\usepackage{xspace,setspace,caption}
\usepackage[bottom]{footmisc}
\usepackage{tabularx,amsmath,eurosym}
\usepackage{longtable}
\usepackage[NewCommands,NewParameters]{ragged2e}
\usepackage[dvipsnames]{pstricks}
\usepackage{pst-text,pst-grad}
\let\GRADfileversion\fileversion
\let\GRADfiledate\filedate
\usepackage{graphicx,multido,framed}
\definecolor{hellgelb}{rgb}{1,1,0.8}
\makeatletter
\newcount\pst@cntm%
\newcount\pst@cntn%
\newcount\pst@cnto%
\newcount\pst@cntp%
\def\modulo#1#2#3{%
\begingroup%
\pst@cntm=#1\pst@cntn=#2\relax%
\pst@cnto=\pst@cntm%
\divide\pst@cntm by \pst@cntn%
\multiply\pst@cntn by \pst@cntm%
\advance\pst@cnto by -\pst@cntn%
\edef\value{\endgroup\def\noexpand#3{\number\pst@cnto}}\value%
}
\makeatother
%
\def\PST{{\texttt{PSTricks}}\xspace}
\def\PDF{{\texttt{PDF}}\xspace}
\def\pst{{\texttt{pstricks}}\xspace}
\def\PS{PostScript\xspace}
\newcommand*\CMD[1]{{\UrlFont\texttt{\textbackslash #1}}}
%
\def\tIndex#1{\index{#1@{\UrlFont\texttt{#1}}}}
\def\cIndex#1{\index{#1@\CMD{#1}}}
\def\pIndex#1{\index{Parameter@\textbf{Parameter}!{\UrlFont\texttt{#1}}}}
\def\ppIndex#1{\index{Parameter@\textbf{Parameter}!{#1}}}
\def\sIndex#1{\index{Syntax@\textbf{Syntax}!\CMD{#1}}}
\def\csIndex#1{\sIndex{#1}\cIndex{#1}}
\def\PIndex#1{\index{Paket@\textbf{Paket}!\texttt{#1}}}
\def\mIndex#1{\texttt{#1}\tIndex{#1}\pIndex{#1}}
%
\pretolerance=500
\tolerance=1000
\hbadness=3000
\vbadness=3000
\hyphenpenalty=400
\usepackage{showexpl}% not a real PSTricks package
\usepackage{babel}
\usepackage{makeidx}
\makeindex
\usepackage[dvips,colorlinks,linktocpage]{hyperref} % PDF-support
%
\renewcommand{\ttdefault}{ul9}% Luxi Mono
\lstset{keywordstyle=\small\ttfamily\bfseries,preset=\raggedright}
\lstset{language=PSTricks,moredelim=**[is][\bf\color{blue}]{§}{§}}%
%
\begin{document}
%
\title{\texttt{pst-grad}:Gradients \\[10pt]\footnotesize v. \GRADfileversion\ -- \GRADfiledate}
\author{Herbert Voß\thanks{Thanks to Lars Kotthoff and Angelo Rossi for translating this documentation!}
}
\maketitle
\begin{abstract}
\PIndex{pst-grad}\tIndex{pst-grad}\verb+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 \PST, too, the use of
\verb+pst-grad+ offers advantages though, since one does not need to take care
of the calculation of the intermediate colour values.
This version of \verb+pst-grad+ integrates the function of the
\verb+pst-ghsb+ package, which supports the HSB color model.
\end{abstract}
\tableofcontents
\clearpage
\section{Introduction}
All parameters are only available when \textbf{gradient} is used as
fill style.
There are further packages which support such fill styles, especially for
circular gradients (\verb+pst-slpe+\PIndex{pst-slpe}).
% ---------------------------------------------------------------------------------------
\section{Parameters}\label{sec:pstgrad:parameter}
% ---------------------------------------------------------------------------------------
Table~\ref{tab:pst-grad:parameter} shows a compilation of the special parameters
valid for \verb+pst-grad+.
\begin{longtable}{>{\ttfamily}l>{\ttfamily}l>{\ttfamily}l}
\caption{Summary of all parameters for \texttt{pst-grad} and
\texttt{pst-ghsb}}\label{tab:pst-grad:parameter}\\[-5pt]
\textrm{name} & \textrm{values} & \textrm{default}\\\hline
\endfirsthead
\textrm{name} & \textrm{values} & \textrm{default}\\\hline
\endhead
gradbegin & <colour> & gradbegin\\
gradend & <colour> & gradend\\
gradlines & <value> & 500\\
gradmidpoint & <value> & 0.9\\
gradangle & <angle> & 0\\
gradientHSB & false|true & false\\
GradientCircle& false|true & false\\
GradientScale & <value> & 1.0\\
GradientPos & <(x,y)> & (0,0)\\
\end{longtable}
\tIndex{gradbegin}\tIndex{gradend}\tIndex{gradlines}\tIndex{gradmidpoint}\tIndex{gradangle}
\pIndex{gradbegin}\pIndex{gradend}\pIndex{gradlines}\pIndex{gradmidpoint}\pIndex{gradangle}
\tIndex{gradientHSB}\pIndex{gradientHSB}%
\tIndex{GradientCircle}\pIndex{GradientCircle}%
\tIndex{GradientPos}\pIndex{GradientPos}%
\tIndex{GradientScale}\pIndex{GradientScale}
% ---------------------------------------------------------------------------------------
\subsection{\texttt{gradbegin}}\label{subsec:pstgrad:gradbegin}
% ---------------------------------------------------------------------------------------
\tIndex{gradbegin}\verb+gradbegin+ denotes the parameter as well as the starting
colour, which is a little bit confusing here.
\begin{verbatim}
\newrgbcolor{gradbegin}{0 .1 .95} % default
\end{verbatim}
Consequently this starting colour can be changed by redefining the colour or by
an assignment through the parameter.
\begin{verbatim}
\newrgbcolor{gradbegin}{0 0 1}
\definecolor{rgb}{gradbegin}{0 0 1} % requires color/xcolor package
\psset{gradbegin=blue}
\end{verbatim}
\medskip\noindent
\begin{LTXexample}[width=5cm]
\begin{pspicture}(5,3.5)
\psframe[fillstyle=gradient,gradbegin=white](5,1.5)
\newrgbcolor{gradbegin}{0 1 1}
\psframe[fillstyle=gradient](0,2)(5,3.5)
\end{pspicture}
\end{LTXexample}
\medskip
%\begin{shaded}
\begin{itemize}
\item \verb+gradbegin+ should be defined as \verb+RGB+ colour\tIndex{RGB},
since a faultless function for \verb+CMYK+ or gray scales is not
warranted in every case.
\item Con\TeX{}t users change the colour with\\
\verb+\definecolor{rgb}{gradbegin}{r=0,g=0,b=1}+
\end{itemize}
%\end{shaded}
% ---------------------------------------------------------------------------------------
\subsection{\texttt{gradend}}\label{subsec:pstgrad:gradend}
% ---------------------------------------------------------------------------------------
\tIndex{gradend}\verb+gradend+ is \textbf{not} the counterpart to
\verb+gradbegin+, for it is the colour which is reached at the relative point
\verb+gridmidpoint+. In every case it is ambiguous as \verb+gradbegin+ again.
\begin{verbatim}
\newrgbcolor{gradend}{0 1 1} % default
\end{verbatim}
Changes can be made differently again.
\begin{verbatim}
\newrgbcolor{gradend}{1 0 0}
\definecolor{rgb}{gradend}{1 0 0} % requires color/xcolor package
\psset{gradend=red}
\end{verbatim}
\medskip\noindent
\begin{LTXexample}[width=5cm]
\begin{pspicture}(5,3.5)
\psframe[fillstyle=gradient,gradend=white](5,1.5)
\newrgbcolor{gradend}{1 0 0}
\psframe[fillstyle=gradient](0,2)(5,3.5)
\end{pspicture}
\end{LTXexample}
\medskip
%\begin{shaded}
\begin{itemize}
\item \verb+gradend+ should be defined as \verb+RGB+ colour\tIndex{RGB},
since a faultless function for \verb+CMYK+ or gray scales is not
warranted in every case.
\item Con\TeX{}t users change the colour with\\
\verb+\definecolor{rgb}{gradend}{r=1,g=1,b=0}+
\end{itemize}
%\end{shaded}
% ---------------------------------------------------------------------------------------
\subsection{\texttt{gradlines}}\label{subsec:pstgrad:gradlines}
% ---------------------------------------------------------------------------------------
\tIndex{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, \verb+pst-grad+ allows any
number of lines, which can be changed through \verb+gradlines+.
\medskip\noindent
\begin{LTXexample}[width=5cm]
\begin{pspicture}(5,4)
\psset{fillstyle=gradient,linestyle=none}
\psframe[gradlines=5](5,1)
\psframe(0,1.5)(5,2.5)
\psframe[gradlines=1000](0,3)(5,4)
\end{pspicture}
\end{LTXexample}
% ---------------------------------------------------------------------------------------
\subsection{\texttt{gradmidpoint}}\label{subsec:pstgrad:gradmidpoint}
% ---------------------------------------------------------------------------------------
\tIndex{gradmidpoint}Denotes the relative point where the colour \verb+gradend+
is reached. Then it is proceeded in reverse order.
\medskip\noindent
\begin{LTXexample}[width=5cm]
\begin{pspicture}(5,4)
\psset{fillstyle=gradient,linestyle=none}
\psframe[gradmidpoint=0](5,1)
\psframe[gradmidpoint=0.5](0,1.5)(5,2.5)
\psframe[gradmidpoint=1](0,3)(5,4)
\end{pspicture}
\end{LTXexample}
% ---------------------------------------------------------------------------------------
\subsection{\texttt{gradangle}}\label{subsec:pstgrad:gradangle}
% ---------------------------------------------------------------------------------------
\tIndex{gradangle}\verb+gradangle+ determines the gradient angle of the straight
line.
\medskip\noindent
\begin{LTXexample}[width=5cm]
\begin{pspicture}(5,4)
\psset{fillstyle=gradient,linestyle=none,gradmidpoint=0.5}
\psframe[gradangle=0](5,1)
\psframe[gradangle=45](0,1.5)(5,2.5)
\psframe[gradangle=90](0,3)(5,4)
\end{pspicture}
\end{LTXexample}
% ---------------------------------------------------------------------------------------
\subsection{\texttt{GradientCircle}, \texttt{GradientScale} and \texttt{GradientPos} }\label{subsec:pstgrad:GradientCircle}
% ---------------------------------------------------------------------------------------
\tIndex{GradientCircle}\tIndex{GradientScale}\tIndex{GradientPos}With the option
\verb+GradientCircle+ circular gradients can be created. The radius can be
influenced through \verb+GradientScale+ and the centre with \verb+GradientPos+.
The specification of the coordinates refers to the based coordinate system,
which is given by the \verb+pspicture+ environment as a rule.
\medskip\noindent
\begin{LTXexample}[width=5cm]
\begin{pspicture}(5,4)
\psset{fillstyle=gradient,linestyle=none}
\psframe[GradientCircle=true](5,1)%
\psframe[GradientCircle=true,GradientScale=3](0,1.5)(5,2.5)%
\psframe[GradientCircle=true,GradientScale=2,%
GradientPos={(4,3.5)}](0,3)(5,4)%
\end{pspicture}
\end{LTXexample}
\vspace{1cm}
\begin{center}
\bgroup
\DeclareFixedFont{\RM}{T1}{ptm}{b}{n}{3cm}
\DeclareFixedFont{\Rm}{T1}{ptm}{m}{n}{2mm}
\psset{fillstyle=gradient,gradbegin=red,gradend=white}
\begin{pspicture}(\linewidth,3cm)
\resizebox{\linewidth}{!}{\pscharpath[gradangle=90]{\RM PostScript}}
\end{pspicture}\\
\begin{pspicture}(\linewidth,3cm)
\resizebox{\linewidth}{!}{\pscharpath[gradangle=0]{\RM PostScript}}
\end{pspicture}\\
\begin{pspicture}(\linewidth,3cm)
\resizebox{\linewidth}{!}{\pscharpath[gradmidpoint=0,gradangle=90]{\RM PostScript}}
\end{pspicture}
\egroup
\captionof{figure}{Shadow games\ldots}
\end{center}
\clearpage
\subsection{\texttt{GradientHSB}}\label{subsec:pstgrad:gradientHSB}
\medskip\noindent
\begin{LTXexample}[width=5.5cm]
\newcommand{\Fig}[1][]{%
\begin{pspicture}(5.5,5.5)
\psframe[#1](5,5)
\end{pspicture}}
\newhsbcolor{ColorA}{0 0 0.7}
\newhsbcolor{ColorB}{0 1 0.7}
\newhsbcolor{ColorC}{.5 0.8 0}
\newhsbcolor{ColorD}{.5 0.8 1}
\psset{fillstyle=gradient,gradientHSB=true}
\Fig[gradmidpoint=1,gradbegin=ColorA,gradend=ColorB]
\Fig[gradmidpoint=0.5,gradbegin=ColorC,gradend=ColorD]
\end{LTXexample}
\newcommand{\Fig}[1][]{%
\begin{pspicture}(5.5,5.5)
\psframe[#1](5,5)
\end{pspicture}}
\definecolor{ColorA}{hsb}{0.7, 0.1, 0.8}
\definecolor{ColorB}{hsb}{0.7, 0.9, 0.8}
\definecolor{ColorC}{hsb}{0, 0, 0}
\definecolor{ColorD}{hsb}{0, 0, 1}
\definecolor{ColorE}{hsb}{0, 0, 0.5}
\definecolor{ColorF}{hsb}{0, 1, 0.5}
\definecolor{ColorG}{hsb}{0, 0, 0.5}
\definecolor{ColorH}{hsb}{0.99999, 0, 0.5} % As it's cycliç 1=0 !
\definecolor{ColorI}{hsb}{1, 1, 1}
\definecolor{ColorJ}{hsb}{1, 0, 0}
\definecolor{ColorK}{hsb}{0.99999, 1, 1} % As it's cyclic 1=0 !
\definecolor{ColorL}{hsb}{0, 1, 0}
\definecolor{ColorM}{hsb}{0.99999, 1, 1} % As it's cyclic 1=0 !
\definecolor{ColorN}{hsb}{0, 0, 1}
\definecolor{ColorO}{hsb}{0, 0.6, 0.7}
\definecolor{ColorP}{hsb}{0.99999, 0.7, 0.7} % As it's cyclic 1=0 !
\definecolor{ColorQ}{hsb}{0.3, 0, 0.8}
\definecolor{ColorR}{hsb}{0.3, 1, 0.8}
\definecolor{ColorS}{hsb}{0.6, 0.3, 0}
\definecolor{ColorT}{hsb}{0.6, 0.3, 1}
\psset{fillstyle=gradient,gradmidpoint=1}
\Fig[gradbegin=yellow,gradend=green]
\Fig[gradientHSB=true,gradbegin=ColorA,gradend=ColorB]
\Fig[gradbegin=green,gradend=yellow]
\psset{gradientHSB=true}
\Fig[gradbegin=ColorC,gradend=ColorD]
\Fig[gradbegin=ColorE,gradend=ColorF]
\Fig[gradbegin=ColorG,gradend=ColorH]
\Fig[gradbegin=ColorI,gradend=ColorJ]
\Fig[gradbegin=ColorK,gradend=ColorL]
\Fig[gradbegin=ColorM,gradend=ColorN]
\Fig[gradbegin=ColorO,gradend=ColorP]
\Fig[gradbegin=ColorQ,gradend=ColorR]
\Fig[gradbegin=ColorS,gradend=ColorT]
\begin{lstlisting}
\definecolor{ColorA}{hsb}{0.7, 0.1, 0.8}
\definecolor{ColorB}{hsb}{0.7, 0.9, 0.8}
\definecolor{ColorC}{hsb}{0, 0, 0}
\definecolor{ColorD}{hsb}{0, 0, 1}
\definecolor{ColorE}{hsb}{0, 0, 0.5}
\definecolor{ColorF}{hsb}{0, 1, 0.5}
\definecolor{ColorG}{hsb}{0, 0, 0.5}
\definecolor{ColorH}{hsb}{0.99999, 0, 0.5} % As it's cycliç 1=0 !
\definecolor{ColorI}{hsb}{1, 1, 1}
\definecolor{ColorJ}{hsb}{1, 0, 0}
\definecolor{ColorK}{hsb}{0.99999, 1, 1} % As it's cyclic 1=0 !
\definecolor{ColorL}{hsb}{0, 1, 0}
\definecolor{ColorM}{hsb}{0.99999, 1, 1} % As it's cyclic 1=0 !
\definecolor{ColorN}{hsb}{0, 0, 1}
\definecolor{ColorO}{hsb}{0, 0.6, 0.7}
\definecolor{ColorP}{hsb}{0.99999, 0.7, 0.7} % As it's cyclic 1=0 !
\definecolor{ColorQ}{hsb}{0.3, 0, 0.8}
\definecolor{ColorR}{hsb}{0.3, 1, 0.8}
\definecolor{ColorS}{hsb}{0.6, 0.3, 0}
\definecolor{ColorT}{hsb}{0.6, 0.3, 1}
\psset{fillstyle=gradient,gradmidpoint=1}
\Fig[gradbegin=yellow,gradend=green]
\Fig[gradientHSB=true,gradbegin=ColorA,gradend=ColorB]
\Fig[gradbegin=green,gradend=yellow]
\psset{gradientHSB=true}
\Fig[gradbegin=ColorC,gradend=ColorD]
\Fig[gradbegin=ColorE,gradend=ColorF]
\Fig[gradbegin=ColorG,gradend=ColorH]
\Fig[gradbegin=ColorI,gradend=ColorJ]
\Fig[gradbegin=ColorK,gradend=ColorL]
\Fig[gradbegin=ColorM,gradend=ColorN]
\Fig[gradbegin=ColorO,gradend=ColorP]
\Fig[gradbegin=ColorQ,gradend=ColorR]
\Fig[gradbegin=ColorS,gradend=ColorT]
\end{lstlisting}
\nocite{*}
\bgroup
\raggedright
\bibliographystyle{plain}
\bibliography{\jobname}
\egroup
\printindex
\end{document}
|