root/trunk/pst-map3d/pstricks-add.pro

Revision 5, 4.3 kB (checked in by jms, 8 months ago)

Déplacement des fichiers de Manuel dans le répertoire pst-map3d.

Line 
1 %% $Id: pstricks-add.pro 6 2007-12-29 21:41:43Z herbert $
2 % PostScript prologue for pstricks-add.tex.
3 % Version 0.20, 2008/01/01
4 % For distribution, see pstricks.tex.
5 %
6 %       HISTORY -> see file Changes
7 %
8 /tx@addDict 410 dict def tx@addDict begin
9 %%
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11 /GTriangle {
12   gsave
13   /mtrx CM def
14   /colorA ED /colorB ED /colorC ED      % save the colors
15   /yA ED /xA ED                         % save the origin
16   xA yA translate
17   rotate                                % \psk@gangle
18   /yB ED /xB ED /yC ED /xC ED           % save other coordinates
19   /ds [                % save data in a array
20      0 0 0 colorA aload pop             % fd x y xr xg xb
21      0 xB xA sub yB yA sub colorB aload pop
22      0 xC xA sub yC yA sub colorC aload pop
23 %     1 xC xB add yB colorA aload pop   % for use with 4 points ABCD
24   ] def
25   newpath
26   <<
27   /ShadingType 4           % single Gouraud
28   /ColorSpace [ /DeviceRGB ]
29   /DataSource ds
30   >>
31   shfill
32   closepath
33   mtrx
34   setmatrix grestore} def
35 %
36 /RGBtoCMYK {    % on stack r g b
37   3 dict begin
38   /Blue ED /Green ED /Red ED
39   1 Red sub     % Cyan
40   1 Green sub   % Magenta
41   1 Blue sub    % Yellow
42   0             % Black 
43   end
44 } def
45 %
46 /CMYKtoGRAY { % c m y k on stack
47   exch 0.11 mul add
48   exch 0.59 mul add
49   exch 0.3 mul add
50   dup 1 gt { pop 1 }  if
51   neg 1 add
52 } def
53 %
54 /RGBtoGRAY {
55   0.11 mul
56   exch 0.59 mul add
57   exch 0.3 mul add
58 } def
59 %
60 /HSBtoGRAY {
61   6 dict begin
62   /b exch def
63   /s exch def 6 mul dup cvi dup
64   /i exch def sub
65   /f exch def
66   /F [[0 1 f sub 1][f 0 1][1 0 1 f sub][1 f 0][1 f sub 1 0][0 1 f][0 1 1]] def
67   F i get { s mul neg 1 add b mul} forall
68   0.11 mul
69   exch 0.59 mul add
70   exch 0.3 mul add
71   end
72 } def
73 %
74 %% convertisseur longueur d'onde ->R,G,B       Manuel Luque
75 %% lambda max=780 nanomètres
76 %% lambda min=380 nanomètres
77 %% adaptation de :
78 %% http://www.physics.sfasu.edu/astro/color.html
79 %% www.efg2.com/lab
80 %
81 /Gamma 0.8 def
82 /calculateRGB {
83   lambda 379 le {/Red 0 def /Green 0 def /Blue 0 def} if
84   lambda 781 ge {/Red 0 def /Green 0 def /Blue 0 def} if
85   lambda 380 ge {lambda 439 le {
86     /R {lambda 440 sub neg 440 380 sub div} def
87     /Red R factor mul Gamma exp def
88     /G 0 def
89     /Green G factor mul Gamma exp def
90     /B 1 def
91     /Blue B factor mul Gamma exp def} if
92   } if
93   lambda 440 ge { lambda 489 le {
94     /G {lambda 440 sub 490 440 sub div} def
95     /Green G factor mul Gamma exp def
96     /R 0 def /Red 0 def
97     /B 1 def
98     /Blue B factor mul Gamma exp def } if
99   } if
100   lambda 490 ge {lambda 509 le {
101     /B {lambda 510 sub neg 510 490 sub div} def
102     /Blue B factor mul Gamma exp def
103     /R 0 def /Red 0 def
104     /G 1 def
105     /Green G factor mul Gamma exp def } if
106   } if
107   lambda 510 ge {lambda 579 le {
108     /R {lambda 510 sub 580 510 sub div } def
109     /Red R factor mul Gamma exp def
110     /Blue 0 def
111     /G 1 def
112     /Green G factor mul Gamma exp def } if
113   } if
114   lambda 580 ge {lambda 644 le {
115     /G {lambda 645 sub neg 645 580 sub div } def
116     /Green G factor mul Gamma exp def
117     /Blue 0 def
118     /R 1 def
119     /Red R factor mul Gamma exp def } if
120   } if
121   lambda 645 ge { lambda 780 le {
122     /Red 1 factor mul Gamma exp def
123     /Blue 0 def
124     /Green 0 def } if
125   } if
126 } def
127 %
128 /factor {
129   lambda 380 ge {lambda 419 le { 0.3 0.7 lambda 380 sub mul 420 380 sub div add} if } if
130   lambda 420 ge {lambda 700 le { 1 } if } if
131   lambda 701 ge {lambda 780 le { 0.3 0.7 780 lambda sub mul 780 700 sub div add} if } if
132 } def
133 %
134 /wavelengthToRGB { % the wavelength in nm must be on top of the stack
135   cvi /lambda exch def % no floating point here
136   calculateRGB
137 } def %  now the colors are saved in Red Green Blue
138 %
139 /wavelengthToCMYK { % the wavelength in nm must be on top of the stack
140   cvi /lambda exch def % no floating point here
141   gsave
142   calculateRGB Red Green Blue RGBtoCMYK
143   /Black ED /Yellow ED /Magenta ED /Cyan ED
144   grestore
145 } def %  now the colors are saved in Cyan Magenta Yellow Black
146 %
147 /axfill {
148     8 dict begin
149     /xw exch def /nl exch def
150     /C1 exch def /y1 exch def/x1 exch def
151     /C0 exch def /y0 exch def/x0 exch def
152     <<  /ShadingType 2
153         /ColorSpace /DeviceRGB
154         /Coords [ x0 y0 x1 y1 ]
155         /EmulatorHints [ xw 2 div dup ]
156         /Function <<
157             /FunctionType 2
158             /Domain [0 1]
159             /C0 C0
160             /C1 C1
161             /N      1
162         >>
163     >> shfill
164     end
165 } bind def
166 end
167 %
168 % END pstricks-add.pro
169
170
Note: See TracBrowser for help on using the browser.