home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume26 / psgraph / part01 / psgraph.pro < prev    next >
Encoding:
Text File  |  1992-09-06  |  4.1 KB  |  108 lines

  1. % psgraph.pro -- included prolog for PS graph files
  2. % based on lib/psplot.pro, Copyright 1984 Adobe Systems, Inc.
  3. % $Header: psgraph.pro,v 1.6 92/08/04 17:55:20 mogul Exp $
  4. save 500 dict begin /psgraph exch def
  5. /StartPSGraph
  6.    {newpath 0 0 moveto 0.6 setlinewidth 0 setgray 1 setlinecap
  7.     /imtx matrix currentmatrix def 
  8.     /fnt /Times-Roman findfont def /fontsize 10 def
  9.     72 72 scale
  10.     /ex 72 nail def /ey 720 nail def
  11.     /smtx matrix def fnt fontsize scalefont setfont}bind def
  12. /len{dup mul exch dup mul add sqrt}bind def
  13. /nail{0 dtransform len 0 idtransform len}bind def
  14. /ljust{0 fontsize -3 div rmoveto}bind def
  15. /rjust{dup stringwidth pop neg fontsize -3 div rmoveto}bind def
  16. /cjust{dup stringwidth pop -2 div fontsize -3 div rmoveto}bind def
  17. /vjust{90 rotate /cjust load exec}bind def
  18. /prnt{dup stringwidth pop 6 add /tx exch def /ty fontsize 5 add def
  19.     currentpoint /toy exch def /tox exch def 1 setgray
  20.     newpath
  21.       tox 3 sub toy 5 sub moveto 0 ty rlineto tx 0 rlineto 0 ty neg rlineto
  22.     closepath fill tox toy moveto
  23.     currentColor fc
  24.     show}bind def
  25. /m{newpath moveto}bind def
  26. /s{pts stroke ins}bind def
  27. /fl{pts fill ins}bind def
  28. /n{lineto currentpoint s moveto}bind def
  29. /nf{lineto}bind def
  30. /l{moveto lineto currentpoint s moveto}bind def
  31. /pts{smtx currentmatrix pop imtx setmatrix}bind def
  32. /ins{smtx setmatrix}bind def
  33. /t{pts load exec show ins}bind def
  34. /w{pts load exec prnt ins}bind def
  35. /e{pts ex ey moveto prnt prnt /ey ey 12 sub def ins}bind def
  36. /gs{gsave}bind def
  37. /gr{grestore}bind def
  38. /c{gs newpath 0 0 3 -1 roll 0 360 arc s gr}bind def
  39. /cf{gs newpath 0 0 3 -1 roll 0 360 arc fl gr}bind def
  40. /f{dup lineStyles exch known
  41.     {lineStyles begin load exec setdash end}
  42.     {gs C 20 string cvs (No such line style: ) e gr unC/solid f}ifelse}bind def
  43. /fc{dup dup /currentColor exch store lineColors exch known
  44.     {lineColors begin load exec aload pop setrgbcolor end}
  45.     {gs C 20 string cvs (No such psgraph color: ) e gr unC/black fc}ifelse}bind def
  46. /fw{setlinewidth} def
  47. /C{/Courier findfont 10 scalefont setfont 
  48.     /sfs fontsize def /fontsize 10 def}bind def
  49. /unC{/fontsize sfs def}bind def
  50. /EX{/exec load}bind def
  51. /EndPSGraph{clear psgraph end restore}bind def
  52. /lineStyles 10 dict def lineStyles begin
  53. /solid{{}0}bind def
  54. /dotted{[2 nail 5 nail ] 0}bind def
  55. /longdashed{[10 nail] 0}bind def
  56. /shortdashed{[6 nail] 0}bind def
  57. /dotdashed{[2 nail 6 nail 10 nail 6 nail] 0}bind def
  58. /dashed{/shortdashed load exec}bind def
  59. %/off{[0 100] 0}bind def
  60. %/none{/off load exec}bind def
  61. end
  62. /currentColor 0 def
  63. /lineColors 10 dict def lineColors begin
  64. /red {[1 0 0]}bind def
  65. /blue {[0 0 1]}bind def
  66. /magenta {[1 0 1]}bind def
  67. /green {[0 1 0]}bind def
  68. /black {[0 0 0]}bind def
  69. /cyan {[0 1 1]}bind def
  70. /yellow {[1 1 0]}bind def
  71. /gray {[.5 .5 .5]}bind def
  72. /orange {[1 .66 0]}bind def
  73. /violet {[1 0 1]}bind def
  74. /currentColor /black store
  75. end
  76.  
  77. /markers 20 dict def markers begin
  78. /none{}bind def
  79. /off{}bind def
  80. /square{0 0 m 0 1 n 1 1 n 1 -1 n -1 -1 n -1 1 n 0 1 n s}bind def
  81. /diamond{0 0 m 0 1.41 n 1.41 0 n 0 -1.41 n -1.41 0 n 0 1.41 n s}bind def
  82. /triangle{0 0 m 0 1 n 1 -0.73 n -1 -0.73 n 0 1 n s}bind def
  83. /up{triangle}bind def
  84. /down{0 0 m 0 -1 n 1 0.73 n -1 0.73 n 0 -1 n s}bind def
  85. /right{0 0 m 1 0 n -0.73 1 n -0.73 -1 n 1 0 n s}bind def
  86. /left{0 0 m -1 0 n 0.73 1 n 0.73 -1 n -1 0 n s}bind def
  87. /circle{0 1 m 0 0 n 1 c s}bind def
  88. /x{1 1 m -1 -1 n -1 1 m 1 -1 n s}bind def
  89. /plus{0 1 m 0 -1 n -1 0 m 1 0 n s}bind def
  90. /cross{plus}bind def
  91. /circle-x{1 c .707 .707 m -.707 -.707 n -.707 .707 m .707 -.707 n s}bind def
  92. /circle-plus{1 c 0 1 m 0 -1 n -1 0 m 1 0 n s}bind def
  93. /filledsquare{0 1 m 1 1 nf 1 -1 nf -1 -1 nf -1 1 nf 0 1 nf fl}bind def
  94. /filleddiamond{0 1.41 m 1.41 0 nf 0 -1.41 nf -1.41 0 nf 0 1.41 nf fl}bind def
  95. /filledtriangle{0 1 m 1 -0.73 nf -1 -0.73 nf 0 1 nf fl}bind def
  96. /filledcircle{0 0 m 1 cf}bind def
  97. /marker{}def
  98. end
  99. /ms 1.0 def
  100. /mg 0 def
  101. /sm{dup markers exch known
  102.     {markers begin load /marker exch def end}
  103.     {gs C 20 string cvs (No such marker type: )e gr unC/off sm}ifelse}bind def
  104. /mk{gs translate /solid f
  105.     mg 0.0 ne {mg setgray} if
  106.     ms .04 mul dup scale markers begin marker end gr}bind def
  107. % end fixed prolog
  108.