| 1 | %!PS-Adobe-2.0 EPSF-2.0 |
| 2 | %%Title: tofront.eps |
| 3 | %%Creator: XV Version 2.20 Rev: 4/24/92 - by John Bradley |
| 4 | %%BoundingBox: 254 389 270 404 |
| 5 | %%Pages: 1 |
| 6 | %%DocumentFonts: |
| 7 | %%EndComments |
| 8 | %%EndProlog |
| 9 | |
| 10 | %%Page: 1 1 |
| 11 | |
| 12 | % remember original state |
| 13 | /origstate save def |
| 14 | |
| 15 | % build a temporary dictionary |
| 16 | 20 dict begin |
| 17 | |
| 18 | % lower left corner |
| 19 | 254 389 translate |
| 20 | |
| 21 | % size of image (on paper, in 1/72inch coords) |
| 22 | 16 15 scale |
| 23 | |
| 24 | % define 'colorimage' if it isn't defined |
| 25 | % ('colortogray' and 'mergeprocs' come from xwd2ps |
| 26 | % via xgrab) |
| 27 | /colorimage where % do we know about 'colorimage'? |
| 28 | { pop } % yes: pop off the 'dict' returned |
| 29 | { % no: define one |
| 30 | /colortogray { % define an RGB->I function |
| 31 | /rgbdata exch store % call input 'rgbdata' |
| 32 | rgbdata length 3 idiv |
| 33 | /npixls exch store |
| 34 | /rgbindx 0 store |
| 35 | /grays npixls string store % str to hold the result |
| 36 | 0 1 npixls 1 sub { |
| 37 | grays exch |
| 38 | rgbdata rgbindx get 20 mul % Red |
| 39 | rgbdata rgbindx 1 add get 32 mul % Green |
| 40 | rgbdata rgbindx 2 add get 12 mul % Blue |
| 41 | add add 64 idiv % I = .5G + .31R + .18B |
| 42 | put |
| 43 | /rgbindx rgbindx 3 add store |
| 44 | } for |
| 45 | grays |
| 46 | } bind def |
| 47 | |
| 48 | % Utility procedure for colorimage operator. |
| 49 | % This procedure takes two procedures off the |
| 50 | % stack and merges them into a single procedure. |
| 51 | |
| 52 | /mergeprocs { % def |
| 53 | dup length |
| 54 | 3 -1 roll |
| 55 | dup |
| 56 | length |
| 57 | dup |
| 58 | 5 1 roll |
| 59 | 3 -1 roll |
| 60 | add |
| 61 | array cvx |
| 62 | dup |
| 63 | 3 -1 roll |
| 64 | 0 exch |
| 65 | putinterval |
| 66 | dup |
| 67 | 4 2 roll |
| 68 | putinterval |
| 69 | } bind def |
| 70 | |
| 71 | /colorimage { % def |
| 72 | pop pop % remove 'false 3' operands |
| 73 | {colortogray} mergeprocs |
| 74 | image |
| 75 | } bind def |
| 76 | } ifelse % end of 'false' case |
| 77 | |
| 78 | |
| 79 | |
| 80 | % define the colormap |
| 81 | /cmap 12 string def |
| 82 | |
| 83 | |
| 84 | % load up the colormap |
| 85 | currentfile cmap readhexstring |
| 86 | 000000 c0c0c0 808080 ffff00 |
| 87 | pop pop % lose return values from readhexstring |
| 88 | |
| 89 | |
| 90 | % rlecmapimage expects to have 'w h bits matrix' on stack |
| 91 | /rlecmapimage { |
| 92 | /buffer 1 string def |
| 93 | /rgbval 3 string def |
| 94 | /block 384 string def |
| 95 | |
| 96 | % proc to read a block from file, and return RGB data |
| 97 | { currentfile buffer readhexstring pop |
| 98 | /bcount exch 0 get store |
| 99 | bcount 128 ge |
| 100 | { % it's a non-run block |
| 101 | 0 1 bcount 128 sub |
| 102 | { currentfile buffer readhexstring pop pop |
| 103 | |
| 104 | % look up value in color map |
| 105 | /rgbval cmap buffer 0 get 3 mul 3 getinterval store |
| 106 | |
| 107 | % and put it in position i*3 in block |
| 108 | block exch 3 mul rgbval putinterval |
| 109 | } for |
| 110 | block 0 bcount 127 sub 3 mul getinterval |
| 111 | } |
| 112 | |
| 113 | { % else it's a run block |
| 114 | currentfile buffer readhexstring pop pop |
| 115 | |
| 116 | % look up value in colormap |
| 117 | /rgbval cmap buffer 0 get 3 mul 3 getinterval store |
| 118 | |
| 119 | 0 1 bcount { block exch 3 mul rgbval putinterval } for |
| 120 | |
| 121 | block 0 bcount 1 add 3 mul getinterval |
| 122 | } ifelse |
| 123 | } % end of proc |
| 124 | false 3 colorimage |
| 125 | } bind def |
| 126 | |
| 127 | |
| 128 | 16 15 8 % dimensions of data |
| 129 | [16 0 0 -15 0 15] % mapping matrix |
| 130 | rlecmapimage |
| 131 | |
| 132 | 81010005000701 |
| 133 | 8201000203028100010601 |
| 134 | 8201000281020007000201 |
| 135 | 820100028202000305038100010101 |
| 136 | 820100028202000305038100010101 |
| 137 | 820100028202000305038100010101 |
| 138 | 810100020006038100010101 |
| 139 | 030181000305030300 |
| 140 | 03018100030503810002810200 |
| 141 | 03018100030503810002810200 |
| 142 | 0301080001020000 |
| 143 | 080181000203020000 |
| 144 | 080181000203020000 |
| 145 | 08010600 |
| 146 | 0f01 |
| 147 | |
| 148 | % |
| 149 | % Compression made this file 21.25% of the uncompressed size. |
| 150 | % |
| 151 | |
| 152 | |
| 153 | showpage |
| 154 | |
| 155 | % stop using temporary dictionary |
| 156 | end |
| 157 | |
| 158 | % restore original state |
| 159 | origstate restore |
| 160 | |
| 161 | %%Trailer |