blob: 23dc9135cf7611fd9a64513b897887f34dd03d64 (
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
|
%!
% -*- Mode: Postscript -*-
% pst-ghsb.pro --- PostScript header file pst-ghsb.pro
% For the PSTricks HSB mode gradient fillstyle
% Based on pst-grad.pro from Timothy van Zandt
% Syntax:
% H0 S0 B0 H1 S1 B1 MidPoint NumLines Angle GradientFillHSB
%
% Author : Denis GIROU (CNRS/IDRIS - France) <Denis.Girou@idris.fr>
% Created the : Tue May 13 11:12:36 1997
% Version : 1.0
% Last mod. by : Denis GIROU (CNRS/IDRIS - France) <Denis.Girou@idris.fr>
% Last mod. the : Wed May 14 18:48:03 1997
%
% Syntax:
% H0 S0 B0 H1 S1 B1 NumLines MidPoint Angle GradientFillHSB
/tx@GradientHSBDict 40 dict def
tx@GradientHSBDict begin
/GradientFillHSB {
rotate
/MidPoint ED
/NumLines ED
/LastBrightness ED
/LastSaturation ED
/LastHue ED
/FirstBrightness ED
/FirstSaturation ED
/FirstHue ED
% This avoids gaps due to rounding errors:
clip
pathbbox %leave llx,lly,urx,ury on stack
/y ED /x ED
2 copy translate
y sub neg /y ED
x sub neg /x ED
% This avoids gaps due to rounding errors:
LastHue FirstHue add 2 div
LastSaturation FirstSaturation add 2 div
LastBrightness FirstBrightness add 2 div
sethsbcolor
fill
/YSizePerLine y NumLines div def
/CurrentY 0 def
/MidLine NumLines 1 MidPoint sub mul abs cvi def
MidLine NumLines 2 sub gt
{ /MidLine NumLines def }
{ MidLine 2 lt { /MidLine 0 def } if }
ifelse
MidLine 0 gt
{
/Hue FirstHue def
/Saturation FirstSaturation def
/Brightness FirstBrightness def
/HueIncrement LastHue FirstHue sub MidLine 1 sub div def
/SaturationIncrement LastSaturation FirstSaturation sub MidLine 1 sub
div def
/BrightnessIncrement LastBrightness FirstBrightness sub MidLine 1 sub
div def
MidLine { GradientLoopHSB } repeat
} if
MidLine NumLines lt
{
/Hue LastHue def
/Saturation LastSaturation def
/Brightness LastBrightness def
/HueIncrement FirstHue LastHue sub NumLines MidLine sub 1 sub div def
/SaturationIncrement FirstSaturation LastSaturation sub
NumLines MidLine sub 1 sub div def
/BrightnessIncrement FirstBrightness LastBrightness sub
NumLines MidLine sub 1 sub div def
NumLines MidLine sub { GradientLoopHSB } repeat
} if
} def
/GradientLoopHSB {
0 CurrentY moveto
x 0 rlineto
0 YSizePerLine rlineto
x neg 0 rlineto
closepath
Hue Saturation Brightness sethsbcolor fill
/CurrentY CurrentY YSizePerLine add def
/Brightness Brightness BrightnessIncrement add def
/Saturation Saturation SaturationIncrement add def
/Hue Hue HueIncrement add def
} def
end
% END pst-ghsb.pro
|