%% syntaxe : solid table solidputhuecolors --> -
/solidputhuecolors {
1 dict begin
2 copy pop
solidgetinouttable /IO exch def
IO 0 get
IO 1 get
s@lidputhuec@l@rs
end
} def
/solidputinhuecolors {
2 dict begin
/table exch def
/solid exch def
solid solidgetinouttable /IO exch def
solid solidwithinfaces {
solid table
IO 2 get
IO 3 get
s@lidputhuec@l@rs
} if
end
} def
/solidputinouthuecolors {
1 dict begin
2 copy pop
solidgetinouttable /IO exch def
IO 0 get
IO 3 get IO 1 get max
s@lidputhuec@l@rs
end
} def
%% syntaxe : solid table n1 n2 s@lidputhuec@l@rs --> -
%% affecte les couleurs des faces d indice n1 a n2 du solid solid, par
%% un degrade defini par la table.
/s@lidputhuec@l@rs {
9 dict begin
/n2 exch def
/n1 exch def
/table exch def
/solid exch def
/n n2 n1 sub def
table length 2 eq {
/a0 table 0 get def
/a1 table 1 get def
a1 isstring {
/lacouleurdepart {
gsave
[a0 cvx exec] length 0 eq {
a0 cvx exec currentrgbcolor
} {
a0 cvx exec
} ifelse
grestore
} def
/lacouleurarrivee {
gsave
[a1 cvx exec] length 0 eq {
a1 cvx exec currentrgbcolor
} {
a1 cvx exec
} ifelse
grestore
} def
/table [lacouleurdepart lacouleurarrivee] def
} {
/A {a0 i a1 a0 sub mul n 1 sub div add} def
/B {1} def
/C {1} def
/D {} def
/espacedecouleurs (sethsbcolor) def
} ifelse
} if
table length 4 eq {
/a0 table 0 get def
/a1 table 1 get def
/A {a0 i a1 a0 sub mul n 1 sub div add} def
/B table 2 get def
/C table 3 get def
/D {} def
/espacedecouleurs (sethsbcolor) def
} if
table length 6 eq {
/a0 table 0 get def
/b0 table 1 get def
/c0 table 2 get def
/a1 table 3 get def
/b1 table 4 get def
/c1 table 5 get def
/A {a0 i a1 a0 sub mul n 1 sub div add} def
/B {b0 i b1 b0 sub mul n 1 sub div add} def
/C {c0 i c1 c0 sub mul n 1 sub div add} def
/D {} def
/espacedecouleurs (setrgbcolor) def
} if
table length 7 eq {
/a0 table 0 get def
/b0 table 1 get def
/c0 table 2 get def
/a1 table 3 get def
/b1 table 4 get def
/c1 table 5 get def
/A {a0 i a1 a0 sub mul n 1 sub div add} def
/B {b0 i b1 b0 sub mul n 1 sub div add} def
/C {c0 i c1 c0 sub mul n 1 sub div add} def
/D {} def
/espacedecouleurs (sethsbcolor) def
} if
table length 8 eq {
/a0 table 0 get def
/b0 table 1 get def
/c0 table 2 get def
/d0 table 3 get def
/a1 table 4 get def
/b1 table 5 get def
/c1 table 6 get def
/d1 table 7 get def
/A {a0 i a1 a0 sub mul n 1 sub div add} def
/B {b0 i b1 b0 sub mul n 1 sub div add} def
/C {c0 i c1 c0 sub mul n 1 sub div add} def
/D {d0 i d1 d0 sub mul n 1 sub div add} def
/espacedecouleurs (setcmykcolor) def
} if
n1 1 n2 {
/i exch def
solid i
[A B C D] espacedecouleurs astr2str
solidputfcolor
} for
end
} def
%% /solidputhuecolors {
%% 9 dict begin
%% /table exch def
%% /solid exch def
%% solid solidnombrefaces /n exch def
%%
%% table length 2 eq {
%% /a0 table 0 get def
%% /a1 table 1 get def
%% a1 isstring {
%% /lacouleurdepart {
%% gsave
%% [a0 cvx exec] length 0 eq {
%% a0 cvx exec currentrgbcolor
%% } {
%% a0 cvx exec
%% } ifelse
%% grestore
%% } def
%% /lacouleurarrivee {
%% gsave
%% [a1 cvx exec] length 0 eq {
%% a1 cvx exec currentrgbcolor
%% } {
%% a1 cvx exec
%% } ifelse
%% grestore
%% } def
%% /table [lacouleurdepart lacouleurarrivee] def
%% } {
%% /A {a0 i a1 a0 sub mul n 1 sub div add} def
%% /B {1} def
%% /C {1} def
%% /D {} def
%% /espacedecouleurs (sethsbcolor) def
%% } ifelse
%% } if
%%
%% table length 4 eq {
%% /a0 table 0 get def
%% /a1 table 1 get def
%% /A {a0 i a1 a0 sub mul n 1 sub div add} def
%% /B table 2 get def
%% /C table 3 get def
%% /D {} def
%% /espacedecouleurs (sethsbcolor) def
%% } if
%%
%% table length 6 eq {
%% /a0 table 0 get def
%% /b0 table 1 get def
%% /c0 table 2 get def
%% /a1 table 3 get def
%% /b1 table 4 get def
%% /c1 table 5 get def
%% /A {a0 i a1 a0 sub mul n 1 sub div add} def
%% /B {b0 i b1 b0 sub mul n 1 sub div add} def
%% /C {c0 i c1 c0 sub mul n 1 sub div add} def
%% /D {} def
%% /espacedecouleurs (setrgbcolor) def
%% } if
%%
%% table length 7 eq {
%% /a0 table 0 get def
%% /b0 table 1 get def
%% /c0 table 2 get def
%% /a1 table 3 get def
%% /b1 table 4 get def
%% /c1 table 5 get def
%% /A {a0 i a1 a0 sub mul n 1 sub div add} def
%% /B {b0 i b1 b0 sub mul n 1 sub div add} def
%% /C {c0 i c1 c0 sub mul n 1 sub div add} def
%% /D {} def
%% /espacedecouleurs (sethsbcolor) def
%% } if
%%
%% table length 8 eq {
%% /a0 table 0 get def
%% /b0 table 1 get def
%% /c0 table 2 get def
%% /d0 table 3 get def
%% /a1 table 4 get def
%% /b1 table 5 get def
%% /c1 table 6 get def
%% /d1 table 7 get def
%% /A {a0 i a1 a0 sub mul n 1 sub div add} def
%% /B {b0 i b1 b0 sub mul n 1 sub div add} def
%% /C {c0 i c1 c0 sub mul n 1 sub div add} def
%% /D {d0 i d1 d0 sub mul n 1 sub div add} def
%% /espacedecouleurs (setcmykcolor) def
%% } if
%%
%% 0 1 n 1 sub {
%% /i exch def
%% solid i
%% [A B C D] espacedecouleurs astr2str
%% solidputfcolor
%% } for
%%
%% end
%% } def
%%
%% /demisolidputhuecolors {
%% 9 dict begin
%% /table exch def
%% /solid exch def
%% solid solidnombrefaces /n exch 2 idiv def
%%
%% table length 2 eq {
%% /a0 table 0 get def
%% /a1 table 1 get def
%% a1 isstring {
%% /lacouleurdepart {
%% gsave
%% a0 cvx exec currentrgbcolor
%% grestore
%% } def
%% /lacouleurarrivee {
%% gsave
%% a1 cvx exec currentrgbcolor
%% grestore
%% } def
%% /table [lacouleurdepart lacouleurarrivee] def
%% } {
%% /A {a0 i a1 a0 sub mul n 1 sub div add} def
%% /B {1} def
%% /C {1} def
%% /D {} def
%% /espacedecouleurs (sethsbcolor) def
%% } ifelse
%% } if
%%
%% table length 4 eq {
%% /a0 table 0 get def
%% /a1 table 1 get def
%% /A {a0 i a1 a0 sub mul n 1 sub div add} def
%% /B table 2 get def
%% /C table 3 get def
%% /D {} def
%% /espacedecouleurs (sethsbcolor) def
%% } if
%%
%% table length 6 eq {
%% /a0 table 0 get def
%% /b0 table 1 get def
%% /c0 table 2 get def
%% /a1 table 3 get def
%% /b1 table 4 get def
%% /c1 table 5 get def
%% /A {a0 i a1 a0 sub mul n 1 sub div add} def
%% /B {b0 i b1 b0 sub mul n 1 sub div add} def
%% /C {c0 i c1 c0 sub mul n 1 sub div add} def
%% /D {} def
%% /espacedecouleurs (setrgbcolor) def
%% } if
%%
%% table length 7 eq {
%% /a0 table 0 get def
%% /b0 table 1 get def
%% /c0 table 2 get def
%% /a1 table 3 get def
%% /b1 table 4 get def
%% /c1 table 5 get def
%% /A {a0 i a1 a0 sub mul n 1 sub div add} def
%% /B {b0 i b1 b0 sub mul n 1 sub div add} def
%% /C {c0 i c1 c0 sub mul n 1 sub div add} def
%% /D {} def
%% /espacedecouleurs (sethsbcolor) def
%% } if
%%
%% table length 8 eq {
%% /a0 table 0 get def
%% /b0 table 1 get def
%% /c0 table 2 get def
%% /d0 table 3 get def
%% /a1 table 4 get def
%% /b1 table 5 get def
%% /c1 table 6 get def
%% /d1 table 7 get def
%% /A {a0 i a1 a0 sub mul n 1 sub div add} def
%% /B {b0 i b1 b0 sub mul n 1 sub div add} def
%% /C {c0 i c1 c0 sub mul n 1 sub div add} def
%% /D {d0 i d1 d0 sub mul n 1 sub div add} def
%% /espacedecouleurs (setcmykcolor) def
%% } if
%%
%% 0 1 n 1 sub {
%% /i exch def
%% solid i
%% [A B C D] espacedecouleurs astr2str
%% solidputfcolor
%% } for
%%
%% end
%% } def
|