|
|
1.1 root 1: /* ------------ These wraps are all for bezier ---------------- */
2: /* This bezier hack was mostly written by mike dixon. -s */
3:
4: defineps PSWbezierCreate()
5:
6: 128 array /myArray exch def
7:
8: /h 0 def %starting hue
9:
10: /setnewcolor %tweak the hue
11: {
12: h 1 50 div add
13: dup 1 gt { 1.0 sub } if
14: dup /h exch def
15: 1 1 sethsbcolor
16: } def
17:
18:
19: /adj { % dx
20: rand 50000000 idiv add dup 0 le {-5}{5} ifelse add }
21: bind def % dx'
22:
23: /upd { % dx x max
24: yield exch 2 index add 2 copy le % dx max x' over?
25: { 1 index sub sub exch neg adj neg exch }
26: { exch pop dup 0 lt { neg exch adj exch } if }
27: ifelse }
28: bind def % dx' x'
29:
30: /xtr { % dxa xa dya ya dxb xb dyb yb ...
31: 14 index 13 index 12 index 11 index 10 index 9 index 8 index 7 index }
32: bind def % dxa xa dya ya dxb xb dyb yb ... xa ya xb yb ...
33:
34: /updl { % dxa xa dya ya dxb xb dyb yb ...
35: xtr 24 8 roll
36: 4 { ht upd 16 2 roll wd upd 16 2 roll } repeat
37: % xa ya xb yb ... dxa' xa' dya' ya' dxb' xb' dyb' yb' ...
38: setnewcolor xtr moveto curveto stroke
39: }
40: bind def
41:
42: /updlNoDraw {
43: xtr 24 8 roll
44: 4 { ht upd 16 2 roll wd upd 16 2 roll } repeat
45: xtr 8 { pop } repeat
46: }
47: bind def
48:
49: endps
50:
51: defineps PSWbezierInit(float width, height)
52:
53: /wd width def
54: /ht height def
55:
56: 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1
57: 14 { updlNoDraw } repeat
58: myArray astore pop
59:
60: endps
61:
62: defineps PSWbezierOneStep()
63:
64: myArray aload pop
65: 128 -8 roll 0 setgray moveto curveto stroke updl
66: myArray astore pop
67:
68: endps
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.