home *** CD-ROM | disk | FTP | other *** search
/ Nebula / nebula.bin / SourceCode / MiniExamples / PaginationLab / drawRect.psw < prev    next >
Text File  |  1991-05-04  |  1KB  |  62 lines

  1. /* load postscript procedures into the current dps context */
  2. defineps loadPSProcedures()
  3.  
  4.     /inch { 72 mul } def
  5.  
  6.     /drawGrid    % x y drawGrid ...
  7.     % draws a grid on on 8x10 inch page at (x,y)
  8.     {
  9.         /yc exch def
  10.         /xc exch def
  11.         /yt yc def
  12.         /xt xc def
  13.         
  14.         .4 .4 1 setrgbcolor
  15.         2 setlinewidth
  16.  
  17.         1 1 7 { pop
  18.         /xt xt 1 inch add def
  19.         xt yc moveto 0 10 inch rlineto stroke
  20.         } for
  21.         
  22.         1 1 9 { pop
  23.         /yt yt 1 inch add def
  24.         xc yt moveto 8 inch 0 rlineto stroke
  25.         } for
  26.         
  27.     } def
  28.     
  29. endps
  30.  
  31.  
  32. defineps drawRect(float x, y; char *str; char *num; boolean darkFlag)
  33.  
  34.     % draws a page at (x,y) using the number represented by str and num
  35.  
  36.     darkFlag { .4 0 0 setrgbcolor } {0 .7 0 setrgbcolor } ifelse
  37.     x y  8 inch 10 inch  rectfill
  38.  
  39.     1 1 .6 setrgbcolor
  40.     x 36 add  y 36 add  7 inch  9 inch  rectfill
  41.  
  42.     x y drawGrid
  43.     
  44.     /Times-Bold findfont 600 scalefont setfont
  45.     
  46.     x 2 inch add  y 2.25 inch add  moveto
  47.     0 0 .2 setrgbcolor
  48.     (num) show
  49.  
  50.     /Times-Bold findfont 200 scalefont setfont
  51.     
  52.     x 2 inch add   y 3.25 inch add moveto
  53.     30 rotate
  54.     1 .4 .4 setrgbcolor
  55.     (str) show
  56.     -30 rotate
  57. endps
  58.  
  59.  
  60.  
  61.  
  62.