%!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 6 303 6 0 psDrawLine unitGC 62 153 62 149 psDrawLine unitGC 50 166 (0.80) (window) psDrawIStr unitGC 118 153 118 149 psDrawLine unitGC 106 166 (1.60) (window) psDrawIStr unitGC 174 153 174 149 psDrawLine unitGC 162 166 (2.40) (window) psDrawIStr unitGC 230 153 230 149 psDrawLine unitGC 218 166 (3.20) (window) psDrawIStr unitGC 286 153 286 149 psDrawLine unitGC 274 166 (4.00) (window) psDrawIStr unitGC 8 94 4 94 psDrawLine unitGC -30 99 (2.40) (window) psDrawIStr unitGC 8 37 4 37 psDrawLine unitGC -30 42 (4.80) (window) psDrawIStr unitGC 8 207 4 207 psDrawLine unitGC -39 212 (-2.40) (window) psDrawIStr unitGC 8 263 4 263 psDrawLine unitGC -39 268 (-4.80) (window) psDrawIStr globalGC1 5 290 3 3 0 360 6 291 psFillArc globalGC1 6 291 6 291 psDrawLine globalGC1 5 290 3 3 0 360 6 291 psFillArc globalGC1 12 271 6 291 psDrawLine globalGC1 11 270 3 3 0 360 12 271 psFillArc globalGC1 18 252 12 271 psDrawLine globalGC1 17 251 3 3 0 360 18 252 psFillArc globalGC1 23 235 18 252 psDrawLine globalGC1 22 234 3 3 0 360 23 235 psFillArc globalGC1 29 220 23 235 psDrawLine globalGC1 28 219 3 3 0 360 29 220 psFillArc globalGC1 35 207 29 220 psDrawLine globalGC1 34 206 3 3 0 360 35 207 psFillArc globalGC1 41 195 35 207 psDrawLine globalGC1 40 194 3 3 0 360 41 195 psFillArc globalGC1 47 184 41 195 psDrawLine globalGC1 46 183 3 3 0 360 47 184 psFillArc globalGC1 53 175 47 184 psDrawLine globalGC1 52 174 3 3 0 360 53 175 psFillArc globalGC1 59 167 53 175 psDrawLine globalGC1 58 166 3 3 0 360 59 167 psFillArc globalGC1 64 161 59 167 psDrawLine globalGC1 63 160 3 3 0 360 64 161 psFillArc globalGC1 70 155 64 161 psDrawLine globalGC1 69 154 3 3 0 360 70 155 psFillArc globalGC1 76 151 70 155 psDrawLine globalGC1 75 150 3 3 0 360 76 151 psFillArc globalGC1 82 148 76 151 psDrawLine globalGC1 81 147 3 3 0 360 82 148 psFillArc globalGC1 88 145 82 148 psDrawLine globalGC1 87 144 3 3 0 360 88 145 psFillArc globalGC1 94 143 88 145 psDrawLine globalGC1 93 142 3 3 0 360 94 143 psFillArc globalGC1 99 142 94 143 psDrawLine globalGC1 98 141 3 3 0 360 99 142 psFillArc globalGC1 105 142 99 142 psDrawLine globalGC1 104 141 3 3 0 360 105 142 psFillArc globalGC1 111 142 105 142 psDrawLine globalGC1 110 141 3 3 0 360 111 142 psFillArc globalGC1 117 143 111 142 psDrawLine globalGC1 116 142 3 3 0 360 117 143 psFillArc globalGC1 123 144 117 143 psDrawLine globalGC1 122 143 3 3 0 360 123 144 psFillArc globalGC1 129 145 123 144 psDrawLine globalGC1 128 144 3 3 0 360 129 145 psFillArc globalGC1 135 147 129 145 psDrawLine globalGC1 134 146 3 3 0 360 135 147 psFillArc globalGC1 140 149 135 147 psDrawLine globalGC1 139 148 3 3 0 360 140 149 psFillArc globalGC1 146 151 140 149 psDrawLine globalGC1 145 150 3 3 0 360 146 151 psFillArc globalGC1 152 153 146 151 psDrawLine globalGC1 151 152 3 3 0 360 152 153 psFillArc globalGC1 158 155 152 153 psDrawLine globalGC1 157 154 3 3 0 360 158 155 psFillArc globalGC1 164 156 158 155 psDrawLine globalGC1 163 155 3 3 0 360 164 156 psFillArc globalGC1 170 158 164 156 psDrawLine globalGC1 169 157 3 3 0 360 170 158 psFillArc globalGC1 176 159 170 158 psDrawLine globalGC1 175 158 3 3 0 360 176 159 psFillArc globalGC1 181 160 176 159 psDrawLine globalGC1 180 159 3 3 0 360 181 160 psFillArc globalGC1 187 160 181 160 psDrawLine globalGC1 186 159 3 3 0 360 187 160 psFillArc globalGC1 193 160 187 160 psDrawLine globalGC1 192 159 3 3 0 360 193 160 psFillArc globalGC1 199 159 193 160 psDrawLine globalGC1 198 158 3 3 0 360 199 159 psFillArc globalGC1 205 157 199 159 psDrawLine globalGC1 204 156 3 3 0 360 205 157 psFillArc globalGC1 211 154 205 157 psDrawLine globalGC1 210 153 3 3 0 360 211 154 psFillArc globalGC1 217 151 211 154 psDrawLine globalGC1 216 150 3 3 0 360 217 151 psFillArc globalGC1 222 147 217 151 psDrawLine globalGC1 221 146 3 3 0 360 222 147 psFillArc globalGC1 228 141 222 147 psDrawLine globalGC1 227 140 3 3 0 360 228 141 psFillArc globalGC1 234 135 228 141 psDrawLine globalGC1 233 134 3 3 0 360 234 135 psFillArc globalGC1 240 127 234 135 psDrawLine globalGC1 239 126 3 3 0 360 240 127 psFillArc globalGC1 246 118 240 127 psDrawLine globalGC1 245 117 3 3 0 360 246 118 psFillArc globalGC1 252 107 246 118 psDrawLine globalGC1 251 106 3 3 0 360 252 107 psFillArc globalGC1 257 95 252 107 psDrawLine globalGC1 256 94 3 3 0 360 257 95 psFillArc globalGC1 263 82 257 95 psDrawLine globalGC1 262 81 3 3 0 360 263 82 psFillArc globalGC1 269 67 263 82 psDrawLine globalGC1 268 66 3 3 0 360 269 67 psFillArc globalGC1 275 50 269 67 psDrawLine globalGC1 274 49 3 3 0 360 275 50 psFillArc globalGC1 281 31 275 50 psDrawLine globalGC1 280 30 3 3 0 360 281 31 psFillArc globalGC1 287 11 281 31 psDrawLine globalGC1 286 10 3 3 0 360 287 11 psFillArc grestore % restore graphics state cleartomark %% clearing operand stack end %% pops mainDict from dictionary stack showpage %-------------------------- end --------------------------%