summaryrefslogtreecommitdiff
path: root/info/examples/lgc2/dogray.awk
blob: d7f3a303eee0a8ceda20e1e72f220227d4aad4e9 (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
BEGIN{header=0}
/^%/ && header == 0 {print $0; next}

header == 0 {
print "    /setcmykcolor { exch 0.11 mul add"
print "                    exch 0.59 mul add"
print "                    exch 0.3 mul add"
print "                    dup 1 gt { pop 1 }  if neg 1 add setgray } def"
print "    /setrgbcolor { 0.11 mul"
print "                   exch 0.59 mul add"
print "                   exch 0.3 mul add setgray } def"
print "    /sethsbcolor { /b exch def /s exch def 6 mul dup cvi dup /i exch def"
print "sub /f exch def"
print "                   /F [[0 1 f sub 1][f 0 1][1 0 1 f sub][1 f 0][1 f sub"
print "1 0][0 1 f][0 1 1]] def"
print "                   F i get { s mul neg 1 add b mul} forall"
print "                   0.11 mul"
print "                   exch 0.59 mul add"
print "                   exch 0.3 mul add setgray } def"
header = 1
}

{ print $0 }