~ubuntu-branches/ubuntu/karmic/python-scipy/karmic

« back to all changes in this revision

Viewing changes to scipy/sandbox/xplt/src/g/pscom.ps

  • Committer: Bazaar Package Importer
  • Author(s): Ondrej Certik
  • Date: 2008-06-16 22:58:01 UTC
  • mfrom: (2.1.24 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080616225801-irdhrpcwiocfbcmt
Tags: 0.6.0-12
* The description updated to match the current SciPy (Closes: #489149).
* Standards-Version bumped to 3.8.0 (no action needed)
* Build-Depends: netcdf-dev changed to libnetcdf-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%!PS-Adobe-3.0
 
2
%%Title:
 
3
%%For:
 
4
%%CreationDate:
 
5
%%Creator: Gist
 
6
%%DocumentData: Clean7Bit
 
7
%%DocumentSuppliedResources: procset Gist-Primitives 1.0 0
 
8
%%Pages: (atend)
 
9
%%BoundingBox: (atend)
 
10
%%DocumentFonts: (atend)
 
11
%%EndComments
 
12
 
 
13
% By appending " EPSF-3.0" to the first line of this file, Gist driver
 
14
% output should be compatible with Appendix H of the 2nd edition of
 
15
% the "PostScript Language Reference Manual" (from Adobe Systems Inc),
 
16
% although the Gist driver does not attempt to produce previewing
 
17
% output.  In order for the Gist file to be a stand alone printable
 
18
% file, the showpage operator is included at the end of each page.
 
19
 
 
20
% -----------------------------------------------------------------------
 
21
 
 
22
%%BeginProlog
 
23
%
 
24
% Gist PostScript Prolog
 
25
% $Id: pscom.ps 685 2003-03-08 15:26:51Z travo $
 
26
% Copyright (c) 1994.  The Regents of the University of California.
 
27
%               All rights reserved.
 
28
%
 
29
 
 
30
%%BeginResource: procset Gist-Primitives 1.0 0
 
31
/GistPrimitives 128 dict def
 
32
GistPrimitives begin
 
33
 
 
34
% ------------- landscape, clipping, and predefined colors
 
35
 
 
36
/PG 0 def    % used to restore the initial state after each page
 
37
 
 
38
/LAND { 90 rotate 0 -12240 translate } bind def
 
39
 
 
40
/CLON {  % xmax-xmin ymax-ymin xmin ymin CLON
 
41
  gsave  % save graphics state before clipping starts
 
42
    /TxYxs TxYx def /TxYns TxYn def   % private font state info
 
43
    newpath
 
44
    moveto dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto
 
45
    closepath clip newpath
 
46
} bind def
 
47
 
 
48
/CLOF {  % turn off clipping established with CLON
 
49
  /TxYx TxYxs def /TxYn TxYns def
 
50
  grestore
 
51
} bind def
 
52
 
 
53
/BG { 1 setgray } bind def
 
54
/FG { 0 setgray } bind def
 
55
/BLK { 0 setgray } bind def
 
56
/WHT { 1 setgray } bind def
 
57
/RED { 1 0 0 setrgbcolor } bind def
 
58
/GRN { 0 1 0 setrgbcolor } bind def
 
59
/BLU { 0 0 1 setrgbcolor } bind def
 
60
/CYA { 0 1 1 setrgbcolor } bind def
 
61
/MAG { 1 0 1 setrgbcolor } bind def
 
62
/YEL { 1 1 0 setrgbcolor } bind def
 
63
/GYD { 0.392 setgray } bind def
 
64
/GYC { 0.588 setgray } bind def
 
65
/GYB { 0.745 setgray } bind def
 
66
/GYA { 0.839 setgray } bind def
 
67
% To get indexed colors (as with F, G, or I primitives):
 
68
%    CI index1 C ... other primitives ... index2 C ... more ...
 
69
 
 
70
% ------------- DrawLines and DrawDisjoint primitives
 
71
 
 
72
/DSH {  % index DSH
 
73
  [ [ ] [ 82.5 ] [ 4.5 61.5 ] [ 82.5 39.0 4.5 39.0 ]
 
74
  [ 82.5 39.0 4.5 39.0 4.5 39.0 ] ] exch get
 
75
  dup length 0 ne {
 
76
    currentlinewidth dup 16.5 lt {
 
77
      pop   % if lines thinner than 0.825 points use pattern as is
 
78
    } {     % else scale pattern
 
79
      16.5 div 1 index { 2 copy mul 4 1 roll pop } forall pop astore
 
80
    } ifelse
 
81
  } if
 
82
  0 setdash
 
83
} bind def
 
84
 
 
85
/LW /setlinewidth load def
 
86
 
 
87
/GPL { 1 setlinecap 1 setlinejoin } bind def  % polyline caps and joins
 
88
/GDJ { 2 setlinecap } bind def                % disjoint line caps
 
89
 
 
90
/GPT { % coordinate reader for L, LS, D, M, MS, F, and G commands
 
91
       % each px1 py1 pair must be a sequence of 8 hex digits
 
92
  currentfile 4 string readhexstring pop { } forall
 
93
  exch 8 bitshift or 3 1 roll exch 8 bitshift or exch
 
94
} bind def
 
95
 
 
96
/L {   % Gist DrawLines method (unsmoothed)
 
97
       %   n L px1 py1 px2 py2 ... pxn pyn
 
98
  GPL                       % set polyline caps and joins
 
99
  newpath 1 sub GPT
 
100
  { 3 2 roll dup 255 gt { 255 sub 255 } { 0 exch } ifelse
 
101
    4 2 roll moveto 0 exch 0 exch
 
102
    { GPT 4 2 roll pop pop 2 copy lineto } repeat stroke
 
103
    2 index 0 le { pop pop pop exit } if
 
104
  } loop
 
105
} bind def
 
106
 
 
107
/LS {   % Gist DrawLines method (smooth)
 
108
        %   n LS px1 py1 px2 py2 ... pxn pyn
 
109
  GPL                              % set polyline caps and joins
 
110
  newpath 1 sub 3 idiv GPT
 
111
  { 3 2 roll dup 85 gt { 85 sub 85 } { 0 exch } ifelse
 
112
    4 2 roll moveto 0 exch 0 exch
 
113
    { GPT GPT GPT 8 6 roll pop pop 2 copy 8 2 roll curveto } repeat stroke
 
114
    2 index 0 le { pop pop pop exit } if
 
115
  } loop
 
116
} bind def
 
117
 
 
118
/D {   % Gist DrawDisjoint method
 
119
       %   n D px1 py1 qx1 qy1 px2 py2 qx2 qy2 ... pxn pyn qxn qyn
 
120
  GDJ                   % set disjoint line caps
 
121
  newpath { GPT moveto GPT lineto stroke } repeat
 
122
} bind def
 
123
 
 
124
% ------------- DrawText and DrawMarkers primitives
 
125
 
 
126
% The following variables supplement the graphics state information
 
127
% maintained by the PostScript interpreter:
 
128
% PtSz   point size of currentfont (set by FONT)
 
129
% LnSp   line spacing to use with currentfont (set by FONT)
 
130
% TxYn   currentfont bounding box ymin (set by FONT)
 
131
% TxYx   currentfont bounding box ymax (set by FONT)
 
132
% XAdj   procedure for horizontal alignment (set by JUST)
 
133
% YAdj   procedure for vertical alignment (set by JUST)
 
134
% OShw   procedure to show possibly opaque text (set by OPAQ)
 
135
 
 
136
% FontRescale is a hook for encapsulating PostScript files to scale all
 
137
% text by a different amount than graphics
 
138
 
 
139
% ---------------------------WARNING-------------------------------------
 
140
% The T and TA procedures violate a PostScript "blue book" rule by using
 
141
% the stringwidth operator to determine the location of text on the page.
 
142
% This is done specifically to avoid having the application know about
 
143
% font metrics (also not a recommended practice, but easy).
 
144
% ---------------------------WARNING-------------------------------------
 
145
 
 
146
/Cour { % bi Cour    return Courier font dictionary
 
147
        % bi= 0 roman, 1 bold, 2 italic, 3 bold italic
 
148
  [ /L-Courier /L-Courier-Bold /L-Courier-Oblique /L-Courier-BoldOblique ]
 
149
  exch get FindLatin
 
150
} bind def
 
151
/Tims { % bi Tims    return Times font dictionary
 
152
        % bi= 0 roman, 1 bold, 2 italic, 3 bold italic
 
153
  [ /L-Times-Roman /L-Times-Bold /L-Times-Italic /L-Times-BoldItalic ]
 
154
  exch get FindLatin
 
155
} bind def
 
156
/Helv { % bi Helv    return Helvetica font dictionary
 
157
        % bi= 0 roman, 1 bold, 2 italic, 3 bold italic
 
158
  [ /L-Helvetica /L-Helvetica-Bold 
 
159
    /L-Helvetica-Oblique /L-Helvetica-BoldOblique ]
 
160
  exch get FindLatin
 
161
} bind def
 
162
/Symb { % bi Symb    return Symbol font dictionary
 
163
        % bi= 0 roman, 1 bold, 2 italic, 3 bold italic
 
164
  pop /Symbol findfont
 
165
} bind def
 
166
/NCen { % bi NCen    return New Century Schoolbook font dictionary
 
167
        % bi= 0 roman, 1 bold, 2 italic, 3 bold italic
 
168
  [ /L-NewCenturySchlbk-Roman /L-NewCenturySchlbk-Bold
 
169
    /L-NewCenturySchlbk-Italic /L-NewCenturySchlbk-BoldItalic ]
 
170
  exch get FindLatin
 
171
} bind def
 
172
/StdNames 16 dict begin % dictionary of fonts not yet re-encoded
 
173
  /L-Courier /Courier def /L-Courier-Bold /Courier-Bold def
 
174
  /L-Courier-Oblique /Courier-Oblique def
 
175
  /L-Courier-BoldOblique /Courier-BoldOblique def
 
176
  /L-Times-Roman /Times-Roman def /L-Times-Bold /Times-Bold def
 
177
  /L-Times-Italic /Times-Italic def /L-Times-BoldItalic /Times-BoldItalic def
 
178
  /L-Helvetica /Helvetica def /L-Helvetica-Bold /Helvetica-Bold def
 
179
  /L-Helvetica-Oblique /Helvetica-Oblique def
 
180
  /L-Helvetica-BoldOblique /Helvetica-BoldOblique def
 
181
  /L-NewCenturySchlbk-Roman /NewCenturySchlbk-Roman def
 
182
  /L-NewCenturySchlbk-Bold /NewCenturySchlbk-Bold def
 
183
  /L-NewCenturySchlbk-Italic /NewCenturySchlbk-Italic def
 
184
  /L-NewCenturySchlbk-BoldItalic /NewCenturySchlbk-BoldItalic def
 
185
currentdict end def
 
186
/FindLatin { % name FindLatin  return ISO Latin1 encoded font dictionary
 
187
  dup StdNames exch known
 
188
  { % this font has not yet been ISO Latin1 encoded
 
189
    dup StdNames exch get findfont dup length dict begin
 
190
      { 1 index /FID ne { def } { pop pop } ifelse } forall
 
191
      /Encoding ISOLatin1Encoding def
 
192
    currentdict end
 
193
    exch dup StdNames exch undef exch definefont }
 
194
  { findfont } ifelse
 
195
} bind def
 
196
 
 
197
/FNT {  % 0 Helv ptSize lnSpace FNT     (for example)
 
198
        %  -or-  fontKey findfont ptSize lnSpace FNT
 
199
  /LnSp exch FontRescale mul def
 
200
  /PtSz exch FontRescale mul def
 
201
  PtSz scalefont setfont
 
202
  currentfont /FontBBox get aload pop
 
203
  currentfont /FontMatrix get transform /TxYx exch def pop
 
204
  currentfont /FontMatrix get transform /TxYn exch def pop
 
205
} bind def
 
206
 
 
207
% work around postscript bug or misfeature
 
208
% -- search on result of search leaves interpreter in a bad state
 
209
%    therefore copy results of a search before a second search
 
210
%    or getinterval
 
211
/SS1cpy { dup length string copy } bind def
 
212
/SS3cpy { 3 { 3 1 roll SS1cpy } repeat } bind def
 
213
 
 
214
% modify stringwidth and show operators to handle
 
215
% escape sequences for symbol font
 
216
% DC4c   renders character c in symbol font
 
217
/SScleave { % string SScleave   returns substring first_char
 
218
  dup 0 get exch dup length 1 sub 1 exch getinterval exch
 
219
} bind def
 
220
/SSstring { % int SSstring --> char
 
221
  1 string dup 3 2 roll 0 exch put
 
222
} bind def
 
223
/SFwidth { % string SFwidth --> dx dy
 
224
  (\024) search {
 
225
    /wfn 0 def   % intialize width
 
226
    { stringwidth pop wfn add /wfn exch def pop SS1cpy SScleave SSstring
 
227
      currentfont exch /Symbol findfont PtSz scalefont setfont
 
228
      stringwidth pop wfn add /wfn exch def setfont
 
229
      SS1cpy (\024) search not { exit } if } loop
 
230
    stringwidth pop wfn add /wfn exch def wfn 0
 
231
  } { stringwidth } ifelse
 
232
} bind def
 
233
/SFshow {  % string SFshow
 
234
  (\024) search {
 
235
    { show pop SS1cpy SScleave SSstring
 
236
      currentfont exch /Symbol findfont PtSz scalefont setfont show setfont
 
237
      SS1cpy (\024) search not { exit } if } loop
 
238
  } if
 
239
  show
 
240
} bind def
 
241
 
 
242
% modify stringwidth and show operators to handle
 
243
% escape sequences for superscripts and subscripts
 
244
% DC1DC2superscriptDC1 
 
245
% DC1DC3subscriptDC1
 
246
/SSscale 0.75000 def  % scale factor for super or sub scripts
 
247
/SSdown -0.11111 def  % fraction of PtSz to drop subscripts
 
248
/SSup 0.36111 def     % fraction of PtSz to raise superscripts
 
249
/SSwidth { % string SSwidth --> dx dy
 
250
  % scan through string counting widths of normal and small parts of string
 
251
  (\021) search {
 
252
    /wn 0 def   % intialize normal width
 
253
    /ws 0 def   % initialize small width
 
254
    { SS3cpy SFwidth pop wn add /wn exch def
 
255
      search pop SS3cpy SScleave pop SFwidth pop ws add /ws exch def
 
256
      search not { exit } if } loop
 
257
    SFwidth pop wn add /wn exch def
 
258
    ws SSscale mul wn add 0
 
259
  } { SFwidth } ifelse
 
260
} bind def
 
261
/SSshow { % string SSshow
 
262
  % scan through string displaying normal and super or subscripts
 
263
  % achieve scaling by mere rescaling of coordinates to avoid the
 
264
  % hassle of actually rescaling the font
 
265
  (\021) search {
 
266
    { SS3cpy SFshow
 
267
      search pop SS3cpy SScleave 8#022 eq { SSup } { SSdown } ifelse
 
268
      TxYx mul dup 0 exch rmoveto exch
 
269
      matrix currentmatrix exch SSscale SSscale scale SFshow setmatrix
 
270
      neg 0 exch rmoveto
 
271
      search not { exit } if } loop
 
272
  } if
 
273
  SFshow
 
274
} bind def
 
275
 
 
276
/OShw /pop load def
 
277
/OPQ {  % 0-or-1 OPQ
 
278
  0 eq { % if non-opaque
 
279
    /OShw /SSshow load def
 
280
  } {    % else opaque
 
281
    /OShw {
 
282
      gsave
 
283
        dup SSwidth
 
284
        0 TxYn                % stack now:   wx wy 0 ymin
 
285
        rmoveto 2 copy rlineto 0 LnSp rlineto
 
286
        neg exch neg exch rlineto closepath
 
287
        1 setgray fill        % white out box text will go in
 
288
      grestore
 
289
      SSshow
 
290
    } def
 
291
  } ifelse
 
292
} bind def
 
293
 
 
294
% left, center, and right horizontal alignment
 
295
/LF { } def
 
296
/CN { dup SSwidth -0.5 mul exch -0.5 mul exch rmoveto } bind def
 
297
/RT { dup SSwidth neg exch neg exch rmoveto } bind def
 
298
 
 
299
% top, cap, half, base, bottom vertical alignment
 
300
/TP { 0 LnSp neg rmoveto } bind def
 
301
/CP { 0 TxYx TxYn add neg rmoveto } bind def
 
302
/HF { 0 TxYx TxYn add -0.5 mul rmoveto} bind def
 
303
/BA { } def
 
304
/BT { 0 TxYn neg rmoveto } bind def
 
305
 
 
306
/JUS {  % to get right-cap justification, e.g.-  /RT /CP JUS
 
307
  load /YAdj exch def
 
308
  load /XAdj exch def
 
309
} bind def
 
310
 
 
311
/XAD { /XAdj load exec } bind def
 
312
/YAD { /YAdj load exec } bind def
 
313
/OSH { /OShw load exec } bind def
 
314
 
 
315
/T {   % Gist DrawText method (single line)
 
316
       % line x y T
 
317
  newpath moveto YAD XAD OSH
 
318
} bind def
 
319
 
 
320
/TX { XAD OSH currentpoint exch pop 0 exch LnSp sub moveto } bind def
 
321
 
 
322
/TA {   % Gist DrawText method (multiple lines)
 
323
        % [ line1 line2 ... lineN ] x1 y1 TA
 
324
  gsave
 
325
    newpath translate 0 0 moveto YAD
 
326
    { TX } forall
 
327
  grestore
 
328
} bind def
 
329
 
 
330
/TR {   % rotated DrawText method (multiple lines)
 
331
        % [ line1 line2 ... lineN ] angle x1 y1 TA
 
332
  gsave
 
333
    newpath translate rotate 0 0 moveto YAD
 
334
    { TX } forall
 
335
  grestore
 
336
} bind def
 
337
 
 
338
/M {   % Gist DrawMarkers method (character)
 
339
       %   char n M px1 py1 px2 py2 ... pxn pyn
 
340
  newpath { GPT moveto HF CN dup show } repeat pop
 
341
} bind def
 
342
 
 
343
/MX { } def
 
344
/M1 { 1 0 rlineto stroke } bind def                            % dot
 
345
/M2 { PtSz 0.5 mul                                             % plus
 
346
      dup -0.5 mul dup 0 rmoveto 1 index 0 rlineto
 
347
      dup rmoveto 0 exch rlineto stroke
 
348
} bind def
 
349
/M3 { PtSz 0.5 mul                                             % asterisk
 
350
      dup -0.5 mul dup 0 exch rmoveto 0 2 index rlineto
 
351
      exch 0.866025 mul 2 copy -0.5 mul exch 0.5 mul rmoveto
 
352
      exch 2 copy rlineto
 
353
      dup 0 exch neg rmoveto
 
354
      exch neg exch rlineto stroke
 
355
} bind def
 
356
/M4 { currentpoint PtSz 0.25 mul dup 0 rmoveto
 
357
      0 360 arc stroke
 
358
} bind def                                                     % circle
 
359
/M5 { PtSz 0.5 mul                                             % cross
 
360
      dup -0.5 mul dup rmoveto dup dup rlineto
 
361
      dup neg 0 rmoveto dup neg rlineto stroke
 
362
} bind def
 
363
 
 
364
/MS {  % Gist DrawMarkers method (special marker type)
 
365
       %   type n MS px1 py1 px2 py2 ... pxn pyn
 
366
  gsave
 
367
    exch dup 0 eq { % if type==0 (dot)
 
368
      PtSz 0.1 mul setlinewidth 1 setlinecap
 
369
    } {             % else type!=0 (not dot)
 
370
      PtSz 0.05 mul setlinewidth 0 setlinecap
 
371
    } ifelse
 
372
    /MX [ /M1 /M2 /M3 /M4 /M5 ] 3 -1 roll get load def
 
373
    [ ] 0 setdash
 
374
    newpath { GPT moveto /MX load exec } repeat
 
375
  grestore
 
376
} bind def
 
377
 
 
378
% ------------- DrawFilled and DrawCells primitives
 
379
 
 
380
% Gist supports pseudo color implemented by color lookup tables; level 1
 
381
% PostScript does not fully support this, but level 2 PostScript does.
 
382
% This file attempts to be portable across either type, and to the
 
383
% intermediate situation of a color printer with level 1 PostScript
 
384
% and the CMYK color extensions (specifically the colorimage operator).
 
385
%
 
386
% The Gist PostScript driver operates in two modes:
 
387
% 1. Color tables are NOT DUMPED into the PostScript file, and
 
388
%    filled meshes and images use level 1 style grayscales.
 
389
% 2. The color table IS DUMPED at the beginning of the page, and
 
390
%    filled mesh and image colors are dumped as indices into this
 
391
%    color table.
 
392
%
 
393
% In case 2, this PostScript code adopts one of three strategies:
 
394
% A. If the PostScript interpreter is level 2 or higher, an Indexed
 
395
%    color space is used.
 
396
% B. If the colorimage operator is present (even thought the PostScript
 
397
%    is otherwise at level 1), filled meshes use setrgbcolor, while
 
398
%    images use colorimage with modfied transfer functions to mock
 
399
%    up the color table.
 
400
% C. Otherwise, filled meshes use setrgbcolor, and images use a modified
 
401
%    transfer function to mock up the grayscale.
 
402
 
 
403
% ---------------------------WARNING-------------------------------------
 
404
% The I primitive may tinker with the device transfer functions.
 
405
% I attempt to be compliant with Appendix I of the 2nd edition of
 
406
% the "PostScript Language Reference Manual" (from Adobe Systems Inc).
 
407
% ---------------------------WARNING-------------------------------------
 
408
 
 
409
% The color table mode requires the following state info:
 
410
% CTrgb    3*CTn string of rgb values normalized 0 - 255 (level 2)
 
411
%          CTn array of gray values normalized 0 - 1 (level 1 mono)
 
412
%          CTn array of 3 arrays rgb values normalized 0 - 1 (level 1 color)
 
413
% CTn      length of the color table
 
414
% CThi     CTn-1 (maximum legal color index)
 
415
% CTsn     sample size (2^BitsPerSample-1)
 
416
% When the CT command is given, it must be the first thing on a
 
417
% new page.  When present, the color values are interpreted as
 
418
% indexes into CTrgb for the F, G, and I commands.  When not present,
 
419
% the color indices for F and G are expected to run from 0 to 255,
 
420
% and for I from 0 to 2^depth-1.
 
421
 
 
422
/CTrgb 0 array def
 
423
/CTn 0 def
 
424
/CThi 0 def
 
425
/CTsn 0 def
 
426
 
 
427
/CT {  % n CT r1 g1 b1 ... rn gn bn
 
428
       % Each value should be 2 hex digits normalized so that
 
429
       % 00 means no color and ff means full intensity
 
430
  dup dup /CTn exch def 1 sub /CThi exch def
 
431
  /CTrgb exch 3 mul string def
 
432
  currentfile CTrgb readhexstring pop pop
 
433
  /CTX load exec
 
434
} bind def
 
435
 
 
436
/CT1 { % prepare level 1 mono device for color table mode
 
437
  CTrgb
 
438
    /CTrgb CTn array def
 
439
    gsave
 
440
      0 1 CThi {
 
441
        2 copy 3 mul 3 getinterval { 255.0 div } forall
 
442
        setrgbcolor currentgray   % convert rgb to gray
 
443
        CTrgb 3 1 roll put
 
444
      } for
 
445
    grestore
 
446
  pop
 
447
  /I /I1 load def      % set appropriate image command
 
448
  /C /C1 load def   % set appropriate set fill color command
 
449
  /CI { } def         % no fill color initialization
 
450
} bind def
 
451
/CT2 { % prepare level 1 color device for color table mode
 
452
  CTrgb
 
453
    /CTrgb CTn array def
 
454
    0 1 CThi {
 
455
      2 copy 3 mul 3 getinterval { 255.0 div } forall
 
456
      3 array astore CTrgb 3 1 roll put
 
457
    } for
 
458
  pop
 
459
  /I /I2 load def      % set appropriate image command
 
460
  /C /C2 load def   % set appropriate set fill color command
 
461
  /CI { } def         % no fill color initialization
 
462
} bind def
 
463
/CT3 { % prepare level 2 device for color table mode
 
464
  % proper postscript would allow use of setcolorspace CI, setcolor C3
 
465
  % with here to pop omitted
 
466
  % use of setcolorspace here is workaround for adobe illustrator 10 bugs
 
467
  CTrgb
 
468
    /CTrgx CTn array def
 
469
    0 1 CThi {
 
470
      2 copy 3 mul 3 getinterval { 255.0 div } forall
 
471
      3 array astore CTrgx 3 1 roll put
 
472
    } for
 
473
  pop
 
474
  /I /I3 load def      % set appropriate image command
 
475
  /C /C3 load def   % set appropriate set fill color command
 
476
  % /CI { [ /Indexed /DeviceRGB CThi CTrgb ] setcolorspace } def
 
477
  /CI { } def
 
478
} bind def
 
479
 
 
480
/F {   % Gist DrawFill method
 
481
       %   n F px1 py1 px2 py2 ... pxn pyn
 
482
  newpath GPT moveto   % new path starting at (px1,py1)
 
483
  1 sub { GPT lineto } repeat closepath fill
 
484
} bind def
 
485
 
 
486
/E {   % Gist DrawFill method with edges
 
487
       %   n E px1 py1 px2 py2 ... pxn pyn (reset color) 0 E
 
488
  dup 0 eq {
 
489
    pop stroke   % this must be deferred until color has been reset
 
490
  } {
 
491
    newpath GPT moveto   % new path starting at (px1,py1)
 
492
    1 sub { GPT lineto } repeat closepath gsave fill grestore
 
493
  } ifelse
 
494
} bind def
 
495
 
 
496
/GRGB { % 16#xxbbggrr {indexed_proc} GRGB -
 
497
  exch dup 255 le { exch exec } { dup 255 and 255.0 div exch dup
 
498
    -8 bitshift 255 and 255.0 div exch -16 bitshift 255 and 255.0 div
 
499
    setrgbcolor } ifelse
 
500
} bind def
 
501
/CI { } def
 
502
/C { } def  % color C
 
503
/C0 {   % (no color table)
 
504
  { 255.0 div setgray } GRGB
 
505
} bind def
 
506
/C1 {   % (color table but level 1 mono device)
 
507
  { CTrgb exch get setgray } GRGB
 
508
} bind def
 
509
/C2 {  % (color table and level 1 color device)
 
510
  { CTrgb exch get aload pop setrgbcolor } GRGB
 
511
} bind def
 
512
/C3 {  % (color table and level 2)
 
513
  % { setcolor } GRGB
 
514
  { CTrgx exch get aload pop setrgbcolor } GRGB
 
515
} bind def
 
516
 
 
517
/I { } def
 
518
/I0 {  % Gist DrawCells method (no color table)
 
519
       %   width height depth qx-px qy-py px py I ...hexstring...
 
520
  /ROW 7 index 6 index mul 7 add 8 idiv string def
 
521
  gsave                             % save CTM on stack
 
522
    translate scale                 % map unit square to (px,py),(qx,qy)
 
523
    dup 1 exch bitshift 1 sub /CTsn exch def
 
524
    [ 3 index 0 0 5 index 0 0 ]     % matrix mapping image to unit square
 
525
    { currentfile ROW readhexstring pop } image
 
526
  grestore                          % restore saved CTM
 
527
} bind def
 
528
/I1 {  % Gist DrawCells method (color table, level 1 PostScript mono)
 
529
       %   width height depth qx-px qy-py px py I ...hexstring...
 
530
  /ROW 7 index 6 index mul 7 add 8 idiv string def
 
531
  gsave                             % save CTM on stack
 
532
    translate scale                 % map unit square to (px,py),(qx,qy)
 
533
    dup 1 exch bitshift 1 sub /CTsn exch def
 
534
    [ 3 index 0 0 5 index 0 0 ]     % matrix mapping image to unit square
 
535
    [ { CTsn mul round cvi
 
536
      dup CThi gt { pop CThi } if CTrgb exch get } /exec load
 
537
      currenttransfer /exec load ] cvx settransfer
 
538
      % Note: transfer function is actually called first for all CTsn+1
 
539
      %       possible values before image reads any data, at
 
540
      %       least with the PostScript in some printers
 
541
    { currentfile ROW readhexstring pop } image
 
542
  grestore                          % restore saved CTM and transfer
 
543
} bind def
 
544
/I2 {  % Gist DrawCells method (color table, level 1 PostScript color)
 
545
       %   width height depth qx-px qy-py px py I ...hexstring...
 
546
  /ROW 7 index 6 index mul 7 add 8 idiv string def
 
547
  gsave                             % save CTM on stack
 
548
    translate scale                 % map unit square to (px,py),(qx,qy)
 
549
    dup 1 exch bitshift 1 sub /CTsn exch def
 
550
    [ 3 index 0 0 5 index 0 0 ]     % matrix mapping image to unit square
 
551
    currentcolortransfer
 
552
    [ { CTsn mul round cvi
 
553
      dup CThi gt { pop CThi } if CTrgb exch get 0 get } /exec load
 
554
      7 -1 roll /exec load ] cvx
 
555
    [ { CTsn mul round cvi
 
556
      dup CThi gt { pop CThi } if CTrgb exch get 1 get } /exec load
 
557
      7 -1 roll /exec load ] cvx
 
558
    [ { CTsn mul round cvi
 
559
      dup CThi gt { pop CThi } if CTrgb exch get 2 get } /exec load
 
560
      7 -1 roll /exec load ] cvx
 
561
    [ { CTsn mul round cvi
 
562
      dup CThi gt { pop CThi } if CTrgb exch get 0 get } /exec load
 
563
      7 -1 roll /exec load ] cvx
 
564
    setcolortransfer
 
565
    { currentfile ROW readhexstring pop } { ROW } { ROW }
 
566
    true 3 colorimage
 
567
  grestore                          % restore saved CTM and transfer
 
568
} bind def
 
569
/I3 {  % Gist DrawCells method (color table, level 2 PostScript)
 
570
       %   width height depth qx-px qy-py px py I3 ...hexstring...
 
571
  /ROW 7 index 6 index mul 7 add 8 idiv string def
 
572
  gsave                             % save CTM on stack
 
573
    translate scale                 % map unit square to (px,py),(qx,qy)
 
574
    [ /Indexed /DeviceRGB CThi CTrgb ] setcolorspace
 
575
    7 dict begin
 
576
      /ImageType 1 def
 
577
      /BitsPerComponent exch def
 
578
      /Height exch def
 
579
      /Width exch def
 
580
      /ImageMatrix [ Width 0 0 Height 0 0 ] def
 
581
      /Decode [ 0 1 BitsPerComponent bitshift 1 sub ] def
 
582
      /DataSource { currentfile ROW readhexstring pop } def
 
583
    currentdict end image
 
584
  grestore                          % restore saved CTM
 
585
} bind def
 
586
 
 
587
/J { } def
 
588
/J1 {  % Gist DrawCells method (rgb mode, level 1 PostScript)
 
589
       %   width height qx-px qy-py px py J ...hexstring...
 
590
  /ROW 6 index 3 mul string def
 
591
  4 2 roll 2 index add exch 3 index add exch
 
592
  gsave                             % save CTM on stack
 
593
    % just draw a box with an X throught it -- no colorimage
 
594
    0 setgray 20 setlinewidth 0 setlinejoin 2 setlinecap
 
595
    3 index 3 index moveto 3 index 1 index lineto 1 index 1 index lineto
 
596
    1 index 3 index lineto closepath stroke 0 setlinecap
 
597
    3 index 3 index moveto 1 index 1 index lineto stroke
 
598
    1 index 3 index moveto 3 index 1 index lineto stroke pop pop pop pop
 
599
    % still need to read hexstring and clean up stack
 
600
    exch pop { currentfile ROW readhexstring pop } repeat
 
601
  grestore                          % restore saved CTM and transfer
 
602
} bind def
 
603
/J2 {  % Gist DrawCells method (rgb mode, level 1 PostScript color)
 
604
       %   width height qx-px qy-py px py J ...hexstring...
 
605
  /ROW 6 index 3 mul string def
 
606
  gsave                             % save CTM on stack
 
607
    translate scale                 % map unit square to (px,py),(qx,qy)
 
608
    8 [ 3 index 0 0 5 index 0 0 ]   % matrix mapping image to unit square
 
609
    { currentfile ROW readhexstring pop }
 
610
    false 3 colorimage
 
611
  grestore                          % restore saved CTM and transfer
 
612
} bind def
 
613
 
 
614
/GI {  % Gist initialize page
 
615
  % Rescale graphics to units of 1/20 point to allow 1440 dpi resolution
 
616
  % using integer coordinates (assuming that the coordinate units are
 
617
  % initially 1 point, as for a start from scratch)
 
618
  % Default orientation assumed to be Portrait.  The LAND command can
 
619
  % be used at the beginning of a page to set up for Landscape mode,
 
620
  % assuming 8.5x11 paper.
 
621
  0.05 0.05 scale
 
622
  10 setlinewidth           % 1/2 point lines
 
623
 
 
624
  % Reset graphics to a known default state matching Gist defaults
 
625
  0 Cour 240 240 FNT  % Courier 12 point
 
626
  0 OPQ               % transparent (non-opaque) text
 
627
  /LF /BA JUS         % left justify baseline of text
 
628
 
 
629
  % Set default no color table mode.  The CT command can be used at the
 
630
  % beginning of each page to set up for color table mode.
 
631
  /I /I0 load def      % appropriate image command
 
632
  /C /C0 load def      % appropriate set fill color command
 
633
  /CI { } def          % no fill color initialization
 
634
} bind def
 
635
 
 
636
end   % GistPrimitives resource directory
 
637
%%EndResource
 
638
 
 
639
%%EndProlog
 
640
 
 
641
% -----------------------------------------------------------------------
 
642
 
 
643
%%BeginSetup
 
644
 
 
645
% Push GistPrimitives dictionary onto dictionary stack.  Popped just
 
646
% before trailer.
 
647
GistPrimitives begin
 
648
 
 
649
% Detect font rescaling or supply default
 
650
/FontRescale where { pop } { /FontRescale 1 def } ifelse
 
651
 
 
652
% Determine whether this is a level 1, extended level 1, or level 2
 
653
% PostScript interpreter and install appropriate color table mode
 
654
% initialization.  This file should be printable on most devices, even
 
655
% in the color table mode.
 
656
/languagelevel where { pop languagelevel } { 1 } ifelse
 
657
2 lt { % this is level 1 PostScript
 
658
  /colorimage where { % color extension is present
 
659
    % assume that if colorimage is available,
 
660
    % setcolortransfer and currentcolortransfer are too
 
661
    % (These are all listed as CMYK extensions to PostScript level 1)
 
662
    pop
 
663
    /CTX /CT2 load def
 
664
    /J /J2 load def
 
665
  } {                 % color extension not present
 
666
    /CTX /CT1 load def
 
667
    /J /J1 load def
 
668
  } ifelse
 
669
} {    % this is level 2 PostScript
 
670
  /CTX /CT3 load def
 
671
  /J /J2 load def
 
672
} ifelse
 
673
 
 
674
end
 
675
 
 
676
%%EndSetup
 
677
 
 
678
% -----------------------------------------------------------------------
 
679
 
 
680
% -----------------------------------------------------------------------
 
681
 
 
682
%%Page: 1 1
 
683
%%PageBoundingBox: (atend)
 
684
%%BeginPageSetup
 
685
GistPrimitives begin /PG save def GI
 
686
%%EndPageSetup
 
687
/languagelevel where { pop languagelevel } { 1 } ifelse
 
688
2 lt { % this is level 1 PostScript
 
689
  /colorimage where { % color extension is present
 
690
    % assume that if colorimage is available,
 
691
    % setcolortransfer and currentcolortransfer are too
 
692
    % (These are all listed as CMYK extensions to PostScript level 1)
 
693
    pop
 
694
    (PostScript is level 1 color) 1000 12000 T
 
695
  } {                 % color extension not present
 
696
    (PostScript is level 1 mono) 1000 12000 T
 
697
  } ifelse
 
698
} {    % this is level 2 PostScript
 
699
    (PostScript is level 2) 1000 12000 T
 
700
} ifelse
 
701
( \() show version show (\)) show 
 
702
/languagelevel where { pop languagelevel } { 1 } ifelse
 
703
1 gt {
 
704
  (  product: ) show product show
 
705
  ( rev: ) show revision 20 string cvs show
 
706
} if
 
707
(Available fonts:) 1000 11700 T
 
708
FontDirectory dup length array exch 0 exch
 
709
  { pop 80 string cvs 3 copy put pop 1 add } forall pop 4000 11700 TA
 
710
PG restore
 
711
showpage
 
712
end
 
713
%%PageTrailer
 
714
%%PageBoundingBox: 0 0 612 792
 
715
 
 
716
%%Trailer
 
717
%%Pages: 1
 
718
%%BoundingBox: 0 0 612 792
 
719
%%DocumentFonts: Courier