%!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 149 303 149 0 psDrawLine unitGC 150 153 150 149 psDrawLine unitGC 138 166 (0.00) (window) psDrawIStr unitGC 190 153 190 149 psDrawLine unitGC 178 166 (2.00) (window) psDrawIStr unitGC 230 153 230 149 psDrawLine unitGC 218 166 (4.00) (window) psDrawIStr unitGC 270 153 270 149 psDrawLine unitGC 258 166 (6.00) (window) psDrawIStr unitGC 106 153 106 149 psDrawLine unitGC 91 166 (-2.00) (window) psDrawIStr unitGC 62 153 62 149 psDrawLine unitGC 47 166 (-4.00) (window) psDrawIStr unitGC 18 153 18 149 psDrawLine unitGC 3 166 (-6.00) (window) psDrawIStr unitGC 151 107 147 107 psDrawLine unitGC 113 112 (1.00) (window) psDrawIStr unitGC 151 63 147 63 psDrawLine unitGC 113 68 (2.00) (window) psDrawIStr unitGC 151 19 147 19 psDrawLine unitGC 113 24 (3.00) (window) psDrawIStr unitGC 151 195 147 195 psDrawLine unitGC 104 200 (-1.00) (window) psDrawIStr unitGC 151 238 147 238 psDrawLine unitGC 104 243 (-2.00) (window) psDrawIStr unitGC 151 281 147 281 psDrawLine unitGC 104 286 (-3.00) (window) psDrawIStr globalGC1 260 12 3 3 0 360 261 13 psFillArc globalGC1 261 13 261 13 psDrawLine globalGC1 260 12 3 3 0 360 261 13 psFillArc globalGC1 262 36 261 13 psDrawLine globalGC1 261 35 3 3 0 360 262 36 psFillArc globalGC1 265 63 262 36 psDrawLine globalGC1 264 62 3 3 0 360 265 63 psFillArc globalGC1 270 89 265 63 psDrawLine globalGC1 269 88 3 3 0 360 270 89 psFillArc globalGC1 276 100 270 89 psDrawLine globalGC1 275 99 3 3 0 360 276 100 psFillArc globalGC1 282 105 276 100 psDrawLine globalGC1 281 104 3 3 0 360 282 105 psFillArc globalGC1 288 107 282 105 psDrawLine globalGC1 287 106 3 3 0 360 288 107 psFillArc globalGC1 190 288 3 3 0 360 191 289 psFillArc globalGC1 191 289 191 289 psDrawLine globalGC1 190 288 3 3 0 360 191 289 psFillArc globalGC1 193 266 191 289 psDrawLine globalGC1 192 265 3 3 0 360 193 266 psFillArc globalGC1 196 239 193 266 psDrawLine globalGC1 195 238 3 3 0 360 196 239 psFillArc globalGC1 201 213 196 239 psDrawLine globalGC1 200 212 3 3 0 360 201 213 psFillArc globalGC1 207 202 201 213 psDrawLine globalGC1 206 201 3 3 0 360 207 202 psFillArc globalGC1 213 197 207 202 psDrawLine globalGC1 212 196 3 3 0 360 213 197 psFillArc globalGC1 219 195 213 197 psDrawLine globalGC1 218 194 3 3 0 360 219 195 psFillArc globalGC1 224 197 219 195 psDrawLine globalGC1 223 196 3 3 0 360 224 197 psFillArc globalGC1 230 202 224 197 psDrawLine globalGC1 229 201 3 3 0 360 230 202 psFillArc globalGC1 236 213 230 202 psDrawLine globalGC1 235 212 3 3 0 360 236 213 psFillArc globalGC1 242 239 236 213 psDrawLine globalGC1 241 238 3 3 0 360 242 239 psFillArc globalGC1 244 266 242 239 psDrawLine globalGC1 243 265 3 3 0 360 244 266 psFillArc globalGC1 246 289 244 266 psDrawLine globalGC1 245 288 3 3 0 360 246 289 psFillArc globalGC1 121 12 3 3 0 360 122 13 psFillArc globalGC1 122 13 122 13 psDrawLine globalGC1 121 12 3 3 0 360 122 13 psFillArc globalGC1 124 36 122 13 psDrawLine globalGC1 123 35 3 3 0 360 124 36 psFillArc globalGC1 126 63 124 36 psDrawLine globalGC1 125 62 3 3 0 360 126 63 psFillArc globalGC1 132 89 126 63 psDrawLine globalGC1 131 88 3 3 0 360 132 89 psFillArc globalGC1 138 100 132 89 psDrawLine globalGC1 137 99 3 3 0 360 138 100 psFillArc globalGC1 144 105 138 100 psDrawLine globalGC1 143 104 3 3 0 360 144 105 psFillArc globalGC1 149 107 144 105 psDrawLine globalGC1 148 106 3 3 0 360 149 107 psFillArc globalGC1 155 105 149 107 psDrawLine globalGC1 154 104 3 3 0 360 155 105 psFillArc globalGC1 161 100 155 105 psDrawLine globalGC1 160 99 3 3 0 360 161 100 psFillArc globalGC1 167 89 161 100 psDrawLine globalGC1 166 88 3 3 0 360 167 89 psFillArc globalGC1 173 63 167 89 psDrawLine globalGC1 172 62 3 3 0 360 173 63 psFillArc globalGC1 175 36 173 63 psDrawLine globalGC1 174 35 3 3 0 360 175 36 psFillArc globalGC1 177 13 175 36 psDrawLine globalGC1 176 12 3 3 0 360 177 13 psFillArc globalGC1 52 288 3 3 0 360 53 289 psFillArc globalGC1 53 289 53 289 psDrawLine globalGC1 52 288 3 3 0 360 53 289 psFillArc globalGC1 55 266 53 289 psDrawLine globalGC1 54 265 3 3 0 360 55 266 psFillArc globalGC1 57 239 55 266 psDrawLine globalGC1 56 238 3 3 0 360 57 239 psFillArc globalGC1 63 213 57 239 psDrawLine globalGC1 62 212 3 3 0 360 63 213 psFillArc globalGC1 69 202 63 213 psDrawLine globalGC1 68 201 3 3 0 360 69 202 psFillArc globalGC1 75 197 69 202 psDrawLine globalGC1 74 196 3 3 0 360 75 197 psFillArc globalGC1 80 195 75 197 psDrawLine globalGC1 79 194 3 3 0 360 80 195 psFillArc globalGC1 86 197 80 195 psDrawLine globalGC1 85 196 3 3 0 360 86 197 psFillArc globalGC1 92 202 86 197 psDrawLine globalGC1 91 201 3 3 0 360 92 202 psFillArc globalGC1 98 213 92 202 psDrawLine globalGC1 97 212 3 3 0 360 98 213 psFillArc globalGC1 103 239 98 213 psDrawLine globalGC1 102 238 3 3 0 360 103 239 psFillArc globalGC1 106 266 103 239 psDrawLine globalGC1 105 265 3 3 0 360 106 266 psFillArc globalGC1 108 289 106 266 psDrawLine globalGC1 107 288 3 3 0 360 108 289 psFillArc globalGC1 10 106 3 3 0 360 11 107 psFillArc globalGC1 11 107 11 107 psDrawLine globalGC1 10 106 3 3 0 360 11 107 psFillArc globalGC1 17 105 11 107 psDrawLine globalGC1 16 104 3 3 0 360 17 105 psFillArc globalGC1 23 100 17 105 psDrawLine globalGC1 22 99 3 3 0 360 23 100 psFillArc globalGC1 29 89 23 100 psDrawLine globalGC1 28 88 3 3 0 360 29 89 psFillArc globalGC1 34 63 29 89 psDrawLine globalGC1 33 62 3 3 0 360 34 63 psFillArc globalGC1 37 36 34 63 psDrawLine globalGC1 36 35 3 3 0 360 37 36 psFillArc globalGC1 38 13 37 36 psDrawLine globalGC1 37 12 3 3 0 360 38 13 psFillArc grestore % restore graphics state cleartomark %% clearing operand stack end %% pops mainDict from dictionary stack showpage %-------------------------- end --------------------------%