%!PS-Adobe-2.0 %%DocumentFonts: Times-Roman %%Creator: Axiom %%CreationDate: today %%Pages: 1 %%processing (hard) limit: 250 pts or 500 values for the operand stack. %%EndComments %------------------------------- prologue -------------------------------% %-------------------------- support procedures --------------------------% %--------- first create user dictionary with 100 entries max ------------% % (number can be changed to accomodate definitions) % 100 dict begin %% using 100 entries in top level dictionary /FontHeight 12 def /inch { 72 mul } def % yVal and hVal are necessary because the Xwindow display origin % is at the upper left corner, while the postscript display % origin is at the lower left hand corner. /yVal %% get Y value -- make upper left corner origin { maxY sub abs } %% maxY is viewWindow height def /hVal %% get H value -- used for displaying title text { maxH sub abs } %% maxH is viewWindow height+titleWindow height def % loads in the font /loadFont { /Times-Roman findfont FontHeight scalefont setfont } def % draws a rectangle with input operand: % height % width % notice that this function does not "draw" or ink the rectangle. /drawRect { 1 index 1 add 0 rlineto %% draw first side 0 exch 1 add neg rlineto %% draw second side 1 add neg 0 rlineto %% draw third side closepath } %% draw fourth side def % create a rectangle with input operand in the view window: % y % x % height % width % notice that this function does not "draw" or ink the rectangle. /rectangle { yVal moveto %% set currentpoint for line drawRect } %% draws the rectangle def % These are global variables that every draw procedure uses % THe operand should be as follows: % viewWindow width % viewWindow height % title height /setDim { /maxX exch def %% width of display /maxY exch def %% height of display /titleH exch def %% height of title /maxH maxY titleH add def %% height of display + title } def %-------------------------- major procedures --------------------------% /title %% draws a rectangle around the title of picture { gsave newpath moveto %% lower left of title titleH 1 add 0 exch rlineto %% draw first side 1 add 0 rlineto %% draw second side 1 add neg 0 exch rlineto begin installGC stroke end %% draw third side grestore } def /drawFrame %% draw display frame { gsave newpath maxX maxY 0 0 rectangle begin installGC stroke end grestore } def % updates the foreground color of existing graphics-context dictionary: % foreground color % dictionary name /setForeground { /FGcolor exch put } def % updates the background color of existing graphics-context dictionary: % background color % dictionary name /setBackground { /BGcolor exch put } def % updates the line width, line style, cap style, join style of % existing graphics-context dictionary: % dictionary name % join style % cap style % line width /setLineAttributes { begin /JoinStyle exch def /CapStyle exch def /LineWidth exch def end } def % creates a graphics context dictionary with the following information: % /dictionary name % foreground color % background color % line width % cap style % join style % this creates different graphical contexts for different drawing functions. /makeDict { 5 dict 2 copy def begin pop %% with dict name on top of stack /FGcolor exch def %% define drawing attributes /BGcolor exch def %% not heavily used /LineWidth exch def /CapStyle exch def /JoinStyle exch def end } def % makes the current dictionary attributes effective % this function takes the values in the current dictionary to set the context % these are the values currently being used: foreground, cap, join, and width /installGC { FGcolor currentgray ne {FGcolor setgray} if %% foreground color CapStyle currentlinecap ne {CapStyle setlinecap} if %% cap style JoinStyle currentlinejoin ne {JoinStyle setlinejoin} if %% join style LineWidth currentlinewidth ne {LineWidth setlinewidth} if } %% line width def % operand stack configuration in order to use psDrawLine: % psDrawLine % y0 % x0 % y1 % x1 % graphics-context dictionary % this draws a line from (x0, y0) to (x1, y1). /psDrawLine { gsave newpath yVal moveto yVal lineto begin installGC stroke end grestore } def % operand stack configuration in order to use psDrawIStr: % psDrawIStr % window type: title or window % string % y % x % graphics-context dictionary % it draws a text string in foreground color on top of bounding box of % string, which is in background color. /psDrawIStr { gsave newpath %% for rectangle loadFont /window exch def %% get window type %% draw bounding box with background color /str exch def %% get text string str stringwidth pop 1 sub %% width FontHeight 1 sub %% height currentfont begin %% get font height FontBBox end /ypos exch def pop %% define ypos neg ypos add /offset exch def pop /offset ypos offset div FontHeight mul def %% define offset /h exch def /w exch def %% define h /y0 exch def %% define y0 /x0 exch def %% define x0 w h x0 y0 offset sub window (title) eq {hVal moveto drawRect} %% draws in title window {rectangle} ifelse %% draws in view window begin BGcolor setgray fill %% set background box color x0 y0 window (title) eq {hVal} %% print title text {yVal} ifelse %% print window text moveto str FGcolor setgray show %% set text color end grestore } def % operand stack configuration in order to use psFillArc: % psFillArc % y center of rectangle % x center of rectangle % angle2 % angle1 % width % height % y % x % graphics-context dictionary % this draws and fills an arc whose origin is at x, y, and whose width % and height specifies the rectangle which encases the arc. % Origin is at upper left corner of rectangle. % This function uses "scale" to make cricles and ellipses. /psFillArc { gsave newpath yVal moveto /sfactor 4 index 4 index div def 1 sfactor scale 6 5 roll %% x on top of stack 3 index 2 div add %% define x origin 6 5 roll %% y on top of stack 6 5 roll %% h on top of stack 2 div add yVal sfactor div %% define y origin 5 4 roll %% w on top of stack 2 div %% define radius 5 3 roll %% a1 a2 now on top 1 index add arcn %% draw clockwise arc begin installGC fill end %% fills with foreground color grestore } def %-------------------------- script --------------------------% % 1 inch 1 inch translate mark %% mark bottom of our stack 0 0 1 1072693248 0 /globalGC1 makeDict 0 0 1 1072693248 0 /globalGC2 makeDict 0 0 1 1072693248 0 /trashGC makeDict 0 0 1 1072693248 0 /globGC makeDict 0 0 1 1072693248 0 /anotherGC makeDict 0 0 1 1072693248 0 /graphGC makeDict 0 0 1 1072693248 0 /unitGC makeDict gsave % save graphics state for clipping path 1.000000 1.000000 scale 24 303 300 setDim maxX maxY 0 0 rectangle clip % set clip path globalGC1 300 151 0 151 psDrawLine globalGC1 150 303 150 0 psDrawLine unitGC 150 153 150 149 psDrawLine unitGC 138 166 (0.00) (window) psDrawIStr unitGC 207 153 207 149 psDrawLine unitGC 195 166 (0.40) (window) psDrawIStr unitGC 264 153 264 149 psDrawLine unitGC 252 166 (0.80) (window) psDrawIStr unitGC 92 153 92 149 psDrawLine unitGC 77 166 (-0.40) (window) psDrawIStr unitGC 34 153 34 149 psDrawLine unitGC 19 166 (-0.80) (window) psDrawIStr unitGC 152 93 148 93 psDrawLine unitGC 114 98 (0.40) (window) psDrawIStr unitGC 152 35 148 35 psDrawLine unitGC 114 40 (0.80) (window) psDrawIStr unitGC 152 209 148 209 psDrawLine unitGC 105 214 (-0.40) (window) psDrawIStr unitGC 152 266 148 266 psDrawLine unitGC 105 271 (-0.80) (window) psDrawIStr globalGC1 293 150 3 3 0 360 294 151 psFillArc globalGC1 294 151 294 151 psDrawLine globalGC1 293 150 3 3 0 360 294 151 psFillArc globalGC1 293 132 294 151 psDrawLine globalGC1 292 131 3 3 0 360 293 132 psFillArc globalGC1 289 114 293 132 psDrawLine globalGC1 288 113 3 3 0 360 289 114 psFillArc globalGC1 283 96 289 114 psDrawLine globalGC1 282 95 3 3 0 360 283 96 psFillArc globalGC1 275 79 283 96 psDrawLine globalGC1 274 78 3 3 0 360 275 79 psFillArc globalGC1 264 63 275 79 psDrawLine globalGC1 263 62 3 3 0 360 264 63 psFillArc globalGC1 252 49 264 63 psDrawLine globalGC1 251 48 3 3 0 360 252 49 psFillArc globalGC1 238 36 252 49 psDrawLine globalGC1 237 35 3 3 0 360 238 36 psFillArc globalGC1 222 26 238 36 psDrawLine globalGC1 221 25 3 3 0 360 222 26 psFillArc globalGC1 205 17 222 26 psDrawLine globalGC1 204 16 3 3 0 360 205 17 psFillArc globalGC1 187 11 205 17 psDrawLine globalGC1 186 10 3 3 0 360 187 11 psFillArc globalGC1 168 8 187 11 psDrawLine globalGC1 167 7 3 3 0 360 168 8 psFillArc globalGC1 149 6 168 8 psDrawLine globalGC1 148 5 3 3 0 360 149 6 psFillArc globalGC1 131 8 149 6 psDrawLine globalGC1 130 7 3 3 0 360 131 8 psFillArc globalGC1 112 11 131 8 psDrawLine globalGC1 111 10 3 3 0 360 112 11 psFillArc globalGC1 94 17 112 11 psDrawLine globalGC1 93 16 3 3 0 360 94 17 psFillArc globalGC1 77 26 94 17 psDrawLine globalGC1 76 25 3 3 0 360 77 26 psFillArc globalGC1 61 36 77 26 psDrawLine globalGC1 60 35 3 3 0 360 61 36 psFillArc globalGC1 47 49 61 36 psDrawLine globalGC1 46 48 3 3 0 360 47 49 psFillArc globalGC1 35 63 47 49 psDrawLine globalGC1 34 62 3 3 0 360 35 63 psFillArc globalGC1 24 79 35 63 psDrawLine globalGC1 23 78 3 3 0 360 24 79 psFillArc globalGC1 16 96 24 79 psDrawLine globalGC1 15 95 3 3 0 360 16 96 psFillArc globalGC1 10 114 16 96 psDrawLine globalGC1 9 113 3 3 0 360 10 114 psFillArc globalGC1 6 132 10 114 psDrawLine globalGC1 5 131 3 3 0 360 6 132 psFillArc globalGC1 5 151 6 132 psDrawLine globalGC1 4 150 3 3 0 360 5 151 psFillArc globalGC1 6 170 5 151 psDrawLine globalGC1 5 169 3 3 0 360 6 170 psFillArc globalGC1 10 188 6 170 psDrawLine globalGC1 9 187 3 3 0 360 10 188 psFillArc globalGC1 16 206 10 188 psDrawLine globalGC1 15 205 3 3 0 360 16 206 psFillArc globalGC1 24 223 16 206 psDrawLine globalGC1 23 222 3 3 0 360 24 223 psFillArc globalGC1 35 239 24 223 psDrawLine globalGC1 34 238 3 3 0 360 35 239 psFillArc globalGC1 47 253 35 239 psDrawLine globalGC1 46 252 3 3 0 360 47 253 psFillArc globalGC1 61 266 47 253 psDrawLine globalGC1 60 265 3 3 0 360 61 266 psFillArc globalGC1 77 276 61 266 psDrawLine globalGC1 76 275 3 3 0 360 77 276 psFillArc globalGC1 94 285 77 276 psDrawLine globalGC1 93 284 3 3 0 360 94 285 psFillArc globalGC1 112 291 94 285 psDrawLine globalGC1 111 290 3 3 0 360 112 291 psFillArc globalGC1 131 294 112 291 psDrawLine globalGC1 130 293 3 3 0 360 131 294 psFillArc globalGC1 149 296 131 294 psDrawLine globalGC1 148 295 3 3 0 360 149 296 psFillArc globalGC1 168 294 149 296 psDrawLine globalGC1 167 293 3 3 0 360 168 294 psFillArc globalGC1 187 291 168 294 psDrawLine globalGC1 186 290 3 3 0 360 187 291 psFillArc globalGC1 205 285 187 291 psDrawLine globalGC1 204 284 3 3 0 360 205 285 psFillArc globalGC1 222 276 205 285 psDrawLine globalGC1 221 275 3 3 0 360 222 276 psFillArc globalGC1 238 266 222 276 psDrawLine globalGC1 237 265 3 3 0 360 238 266 psFillArc globalGC1 252 253 238 266 psDrawLine globalGC1 251 252 3 3 0 360 252 253 psFillArc globalGC1 264 239 252 253 psDrawLine globalGC1 263 238 3 3 0 360 264 239 psFillArc globalGC1 275 223 264 239 psDrawLine globalGC1 274 222 3 3 0 360 275 223 psFillArc globalGC1 283 206 275 223 psDrawLine globalGC1 282 205 3 3 0 360 283 206 psFillArc globalGC1 289 188 283 206 psDrawLine globalGC1 288 187 3 3 0 360 289 188 psFillArc globalGC1 293 170 289 188 psDrawLine globalGC1 292 169 3 3 0 360 293 170 psFillArc globalGC1 294 151 293 170 psDrawLine globalGC1 293 150 3 3 0 360 294 151 psFillArc grestore % restore graphics state cleartomark %% clearing operand stack end %% pops mainDict from dictionary stack showpage %-------------------------- end --------------------------%