1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
|
%!PS-Adobe-2.0 EPSF-1.2
%%BoundingBox: 53.000000 284.120003 559.000000 538.120003
%%Creator: /u/jonms/XtoPS/xwd2ps
%%CreationDate: Tue Oct 8 20:20:30 1991
%%Title: standard input
%%EndComments
% /u/jonms/XtoPS/xwd2ps -- program written by Robert C. Tatar and Craig A. McGowan.
% The command used to create this file (missing quotes on strings):
% /u/jonms/XtoPS/xwd2ps
% by pi.watson.ibm.com:jonms ()
% Information from XWD rasterfile header:
% width = 60, height = 30, depth = 8
% file_version = 7, pixmap_format = 2, byte_order = 1
% bitmap_unit = 32, bitmap_bit_order = 1, bitmap_pad = 32
% bits_per_pixel = 8, bytes_per_line = 60, visual_class = 3
% bits/rgb = 8, colormap entries = 256, ncolors = 256
% Portion of raster image in this file:
% starting line = 1
% ending line = 30
% starting column = 1
% ending column = 60
gsave
/inch {72 mul} def
/buffer 2 string def
/rgbmap 768 string def
/rgb (000) def
/pixels 768 string def
%%Title: colorimage.ps
% Written 11-4-88 by Bob Tatar
% U.S. Mail: GE-CRD, PO Box 8, KW-C214, Schenectady, NY 12301
% E-Mail: tatar@crd.ge.com
% colorimage procedure to be used on monochrome printers
% or when the colorimage procedure is not available
% NOTE: Only 1 color mode is supported: single proc. & RGB
systemdict /colorimage known not { % only create if not in systemdict
% Utility procedure for colorimage operator. This procedure takes a
% string of rgb encoded values and creates a string 1/3 as long with
% monochrome values. This procedure assumes 8 bits/color (i.e.
% 1 character/color)
% storage format for input string: (r1 g1 b1 r2 g2 b2 r3 g3 b3 ... )
% storage format for output string: (g1 g2 g3 ... )
/colortograyscale { %def % (string)
dup /rgbdata exch store % (string)
length 3 idiv % Ns/3
/npixls exch store % ; npixls => Ns/3
/indx 0 store % ; indx => 0
/pixls npixls string store % ; pixls => (....)
0 1 npixls -1 add { % counter
pixls exch % pixls counter
rgbdata indx get .3 mul % pixls counter .3*rgbdata(ind)
rgbdata indx 1 add get .59 mul add % pixls counter .3*rgbdata(ind) +
% .59*rgbdata(ind+1)
rgbdata indx 2 add get .11 mul add % pixls counter .3*rgbdata(ind) + .59
% *rgbdata(ind+1)+.11*rgbdata(ind+2)
cvi % pixls counter <grayscale value>
put %
/indx indx 3 add store % ; /ind => ind+3
} for % repeat for each rgb value
pixls % (pixls)
} bind def % ; /colortograyscale -> dictionary
% Utility procedure for colorimage operator. This procedure takes two
% procedures off the stack and merges them into a single procedure.
/mergeprocs { %def % {proc1} {proc2}
dup length % {proc1} {proc2} N2
3 -1 roll % {proc2} N2 {proc1}
dup % {proc2} N2 {proc1} {proc1}
length % {proc2} N2 {proc1} N1
dup % {proc2} N2 {proc1} N1 N1
5 1 roll % N1 {proc2} N2 {proc1} N1
3 -1 roll % N1 {proc2} {proc1} N1 N2
add % N1 {proc2} {proc1} N1+N2
array cvx % N1 {proc2} {proc1} { ... }
dup % N1 {proc2} {proc1} { ... } { ... }
3 -1 roll % N1 {proc2} { ... } { ... } {proc1}
0 exch % N1 {proc2} { ... } { ... } 0 {proc1}
putinterval % N1 {proc2} { <<{proc1}>> ... }
dup % N1 {proc2} { <<{proc1}>> ... } { <<{proc1}>> ... }
4 2 roll % { <<{proc1}>> ... } { <<{proc1}>> ... } N1 {proc2}
putinterval % { <<{proc1}>> <<{proc2}>> }
} bind def % ; /mergeprocs => dictionary
/colorimage { %def % {imageproc} multiproc ncolors
pop % {imageproc} multiproc ; assume 3 colors
pop % {imageproc} ; assume false
{colortograyscale} % {imageproc} {colortograyscale}
mergeprocs % {imageproc colortograyscale}
image % construct monochrome image
} bind def % ; /colorimage => dictionary
} if % only create if it doesn't already exist
/drawcolorimage {
60 30 8
[60 0 0 -30 0 30]
{currentfile buffer readhexstring pop pop % get run length & color info
/npixels buffer 0 get 1 add 3 mul store % number of pixels (run length)
/color buffer 1 get 3 mul store % color of pixels
% /pixels npixels string store % create string to hold colors
/rgb rgbmap color 3 getinterval store % get rgb value
0 3 npixels -1 add {
pixels exch rgb putinterval
} for
pixels 0 npixels getinterval % Return color values
}
false 3
colorimage
} bind def
%`0.750000 inch 3.960000 inch translate
matrix currentmatrix
.5 inch .16 inch scale
% get rgb color table
currentfile rgbmap readhexstring pop pop
000000
ffffff
dbdb70
2f4f4f
23238e
d3d3d3
ff0000
000000
004900
004955
0049aa
0049ff
006d00
006d55
006daa
006dff
009200
009255
0092aa
0092ff
00b600
00b655
00b6aa
00b6ff
00db00
00db55
00dbaa
00dbff
00ff00
00ff55
00ffaa
00ffff
240000
240055
2400aa
2400ff
242400
242455
2424aa
2424ff
244900
244955
2449aa
2449ff
246d00
246d55
246daa
246dff
249200
249255
2492aa
2492ff
24b600
24b655
24b6aa
24b6ff
24db00
24db55
24dbaa
24dbff
24ff00
24ff55
24ffaa
24ffff
490000
490055
4900aa
4900ff
492400
492455
4924aa
4924ff
494900
494955
4949aa
4949ff
496d00
496d55
496daa
496dff
499200
499255
4992aa
4992ff
49b600
49b655
49b6aa
49b6ff
49db00
49db55
49dbaa
49dbff
49ff00
49ff55
49ffaa
49ffff
6d0000
6d0055
6d00aa
6d00ff
6d2400
6d2455
6d24aa
6d24ff
6d4900
6d4955
6d49aa
6d49ff
6d6d00
6d6d55
6d6daa
6d6dff
6d9200
6d9255
6d92aa
6d92ff
6db600
6db655
6db6aa
6db6ff
6ddb00
6ddb55
6ddbaa
6ddbff
6dff00
6dff55
6dffaa
6dffff
920000
920055
9200aa
9200ff
922400
922455
9224aa
9224ff
924900
924955
9249aa
9249ff
926d00
926d55
926daa
926dff
929200
929255
9292aa
9292ff
92b600
92b655
92b6aa
92b6ff
92db00
92db55
92dbaa
92dbff
92ff00
92ff55
92ffaa
92ffff
b60000
b60055
b600aa
b600ff
b62400
b62455
b624aa
b624ff
b64900
b64955
b649aa
b649ff
b66d00
b66d55
b66daa
b66dff
b69200
b69255
b692aa
b692ff
b6b600
b6b655
b6b6aa
b6b6ff
b6db00
b6db55
b6dbaa
b6dbff
b6ff00
b6ff55
b6ffaa
b6ffff
db0000
db0055
db00aa
db00ff
db2400
db2455
db24aa
db24ff
db4900
db4955
db49aa
db49ff
db6d00
db6d55
db6daa
db6dff
db9200
db9255
db92aa
db92ff
dbb600
dbb655
dbb6aa
dbb6ff
dbdb00
dbdb55
dbdbaa
dbdbff
dbff00
dbff55
dbffaa
dbffff
ff0000
ff0055
ff00aa
ff00ff
ff2400
ff2455
ff24aa
ff24ff
ff4900
ff4955
ff49aa
ff49ff
ff6d00
ff6d55
ff6daa
ff6dff
ff9200
ff9255
ff92aa
ff92ff
ffb600
ffb655
ffb6aa
ffb6ff
ffdb00
ffdb55
ffdbaa
ffdbff
ffff00
ffff55
ffffaa
ffffff
drawcolorimage
3b073b073b073b070507090103070101070701010307010103070b01050705070a0102070201060702010207020102070c01040705070a0103070201040702010307020103070b01
0407050702010b0702010407020103070201070702010907050702010c0702010207020104070201070702010907050702010c070201020702010407020107070201090705070201
0d0702010007020105070201070702010907050702010d0702010007020105070201070702010907050702010e070401060702010707020109070507080108070401060702010707
02010907050709010807020107070201070702010907050709010807020107070201070702010907050702010e07040106070201070702010907050702010e070401060702010707
02010907050702010d0702010007020105070201070702010907050702010d0702010007020105070201070702010907050702010c07020102070201040702010707020109070507
02010c0702010207020104070201070702010907050702010b07020104070201030702010707020109070507090104070201040702010307020107070201090705070a0102070201
0607020102070201070702010907060709010307010107070101030701010807010109073b073b073b073b07
pop pop setmatrix
/#copies 1 def
grestore
%%Trailer
|