rsc | 13f7391 | 2004-05-15 23:45:13 +0000 | [diff] [blame] | 1 | % |
| 2 | % Color and reverse video support for dpost. A call made to setcolor with two |
| 3 | % arguments implies reverse video printing. |
| 4 | % |
| 5 | |
| 6 | /rgb {setrgbcolor} bind def |
| 7 | /hsb {sethsbcolor} bind def |
| 8 | |
| 9 | /colordict 50 dict dup begin |
| 10 | /red { 1 0 0 } def |
| 11 | /green { 0 1 0 } def |
| 12 | /blue { 0 0 1 } def |
| 13 | /cyan { 0 1 1 } def |
| 14 | /magenta { 1 0 1 } def |
| 15 | /yellow { 1 1 0 } def |
| 16 | /white { 1 1 1 } def |
| 17 | /black { 0 0 0 } def |
| 18 | end def |
| 19 | |
| 20 | /setcolor { |
| 21 | counttomark 1 eq { |
| 22 | dup colordict exch known not {pop /black} if |
| 23 | colordict exch get exec setrgbcolor |
| 24 | } if |
| 25 | counttomark 2 eq { |
| 26 | /backcolor exch def |
| 27 | /textcolor exch def |
| 28 | colordict backcolor known not colordict textcolor known not or { |
| 29 | /backcolor colordict /black get def |
| 30 | /textcolor colordict /white get def |
| 31 | } if |
| 32 | /backcolor colordict backcolor get def |
| 33 | /textcolor colordict textcolor get def |
| 34 | /dY1 0 def |
| 35 | /dY2 0 def |
| 36 | textcolor exec setrgbcolor |
| 37 | } if |
| 38 | } bind def |
| 39 | |
| 40 | /drawrvbox { |
| 41 | /x2 exch def |
| 42 | /x1 exch def |
| 43 | |
| 44 | currentpoint dup |
| 45 | /y1 exch def |
| 46 | /y2 exch def pop |
| 47 | |
| 48 | dY1 0 eq dY2 0 eq and { |
| 49 | currentfont /FontBBox get aload pop |
| 50 | currentfont /FontMatrix get dtransform /dY2 exch def pop |
| 51 | currentfont /FontMatrix get dtransform /dY1 exch def pop |
| 52 | } if |
| 53 | |
| 54 | /y1 y1 dY1 add def |
| 55 | /y2 y2 dY2 add def |
| 56 | |
| 57 | backcolor exec setrgbcolor |
| 58 | newpath |
| 59 | x1 y1 moveto |
| 60 | x2 y1 lineto |
| 61 | x2 y2 lineto |
| 62 | x1 y2 lineto |
| 63 | closepath fill |
| 64 | textcolor exec setrgbcolor |
| 65 | } bind def |