home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / clipart / gs22.zip / COORD.PS < prev    next >
Text File  |  1991-04-09  |  2KB  |  97 lines

  1. %! this is a PostScript program
  2. % version = 1.01 of printerarea.ps 1991 February 12
  3. % This program determines the printable area of a printer
  4. % and prints the coordinates out in readable form.
  5. % In addition, it draws a rectangle around the area,
  6. % then it makes a series of shrinking rectangles to help
  7. % visualize where the boundary is.  Finally, the corners
  8. % of all these rectangles are connected to a single
  9. % point on the image, to make it clear what is going on.
  10. %   Tom Schneider
  11. %   National Cancer Institute
  12. %   Laboratory of Mathematical Biology
  13. %   Frederick, Maryland  21702-1201
  14. %   toms@ncifcrf.gov
  15. erasepage
  16. /Times-Roman findfont 30 scalefont setfont
  17. /down {0 -50 rmoveto} def
  18. /print {gsave show 10 string cvs show grestore down} def
  19.  
  20. % obtain the imagable area of the printer using initclip
  21. gsave initclip clippath pathbbox grestore
  22. %pstack % use this if you want to see the stack
  23.         % while running the program
  24.  
  25. % capture the corners of the imagable area
  26. % (see pathbbox in the red book)
  27. /ury exch def
  28. /urx exch def
  29. /lly exch def
  30. /llx exch def
  31.  
  32. % use the following if you want to see the values
  33. % llx lly urx ury
  34. % pstack  % this stack should match the first one
  35. --MORE--(70%)% clear
  36.  
  37. 150 450 moveto
  38. (printer imageable area:) gsave show grestore down
  39.  
  40. % print the values
  41. llx ( lower left x [llx]: ) print
  42. lly ( lower left y [lly]: ) print
  43. urx (upper right x [urx]: ) print
  44. ury (upper right y [ury]: ) print
  45. urx llx sub (Delta x:) print
  46. ury lly sub (Delta y:) print
  47.  
  48. urx llx sub ury lly sub div (Delta y / Delta x:) print
  49.  
  50. /tospot { % draw a line to a special spot
  51. % to help keep track of what's happening
  52. gsave currentpoint moveto 200 500 lineto stroke grestore
  53. } def
  54.  
  55. /roundstroke{
  56. % draw a box around the area
  57. llx lly moveto
  58. --MORE--(84%)tospot
  59. urx lly lineto
  60. tospot
  61. urx ury lineto
  62. tospot
  63. llx ury lineto
  64. tospot
  65. llx lly lineto
  66. tospot
  67. stroke
  68. } def
  69.  
  70. /shift 20 def % amount to decrease the area each time
  71.  
  72. /shiftinward {
  73. % reduction of the area by the amount shift
  74. /ury ury shift sub def
  75. /urx urx shift sub def
  76. /lly lly shift add def
  77. /llx llx shift add def
  78. } def
  79.  
  80. % draw a series of decreasing boxes to help figure
  81. % things out
  82. roundstroke
  83. shiftinward
  84.  
  85. roundstroke
  86. shiftinward
  87.  
  88. roundstroke
  89. shiftinward
  90.  
  91. roundstroke
  92. shiftinward
  93.  
  94. roundstroke
  95.  
  96. showpage
  97.