home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / graphics-0.17 / plot2ps / header.c < prev    next >
Encoding:
Text File  |  1990-10-12  |  7.7 KB  |  110 lines

  1. /* The following is a postscript prologue which defines a set of
  2.    macros and constants which are used in rendering graphics on the
  3.    page.
  4.  
  5.    This postscirpt prologue was written by John Interrante.  For more
  6.    information see the Interviews distribution on inverviews.stanford.edu. */
  7.  
  8. char *header[6] =
  9. {"\
  10. \n\
  11. %%EndComments\n\
  12. 50 dict begin /arrowHeight 8 def /arrowWidth 4 def /none null def\n\
  13. /numGraphicParameters 17 def /stringLimit 65535 def /Begin{save\n\
  14. numGraphicParameters dict begin}def /End{end restore}def /SetB{dup type\n\
  15. /nulltype eq{pop false /brushRightArrow idef false /brushLeftArrow idef true\n\
  16. /brushNone idef}{/brushDashOffset idef /brushDashArray idef 0 ne\n\
  17. /brushRightArrow idef 0 ne /brushLeftArrow idef /brushWidth idef false\n\
  18. /brushNone idef}ifelse}def /SetCFg{/fgblue idef /fggreen idef /fgred idef}def\n\
  19. /SetCBg{/bgblue idef /bggreen idef /bgred idef}def /SetF{/printSize idef\n\
  20. /printFont idef}def /SetP{dup type /nulltype eq{pop true /patternNone idef}{\n\
  21. /patternGrayLevel idef patternGrayLevel -1 eq{/patternString idef}if false\n\
  22. /patternNone idef}ifelse}def /BSpl{0 begin storexyn newpath n 1 gt{0 0 0 0 0 0\n\
  23. 1 1 true subspline n 2 gt{0 0 0 0 1 1 2 2 false subspline 1 1 n 3 sub{/i exch\n\
  24. def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline}for n 3 sub dup\n\
  25. n 2 sub dup n 1 sub dup 2 copy false subspline}if n 2 sub dup n 1 sub dup 2\n\
  26. copy 2 copy false subspline patternNone not brushLeftArrow not brushRightArrow\n\
  27. not and and{ifill}if brushNone not{istroke}if 0 0 1 1 leftarrow n 2 sub dup n\n\
  28. 1 sub dup rightarrow}if end}dup 0 4 dict put def /Circ{newpath 0 360 arc\n\
  29. patternNone not{ifill}if brushNone not{istroke}if}def /CBSpl{0 begin dup 2 gt{\n\
  30. storexyn newpath n 1 sub dup 0 0 1 1 2 2 true subspline 1 1 n 3 sub{/i exch\n\
  31. def i 1 sub dup i dup i 1 add dup i 2 add dup false subspline}for n 3 sub dup\n\
  32. n 2 sub dup n 1 sub dup 0 0 false subspline n 2 sub dup n 1 sub dup 0 0 1 1\n\
  33. false subspline patternNone not{ifill}if brushNone not{istroke}if}{Poly}\n\
  34. ifelse end}dup 0 4 dict put def /Elli{0 begin newpath 4 2 roll translate scale\n\
  35. 0 0 1 0 360 arc patternNone not{ifill}if brushNone not{istroke}if end}dup 0 1\n\
  36. dict put def /Line{0 begin 2 storexyn newpath x 0 get y 0 get moveto x 1 get y\n\
  37. 1 get lineto brushNone not{istroke}if 0 0 1 1 leftarrow 0 0 1 1 rightarrow end\n\
  38. }dup 0 4 dict put def /MLine{0 begin storexyn newpath n 1 gt{x 0 get y 0 get\n\
  39. moveto 1 1 n 1 sub{/i exch def x i get y i get lineto}for patternNone not\n\
  40. brushLeftArrow not brushRightArrow not and and{ifill}if brushNone not{istroke}\n\
  41. if 0 0 1 1 leftarrow n 2 sub dup n 1 sub dup rightarrow}if end}dup 0 4 dict\n\
  42. put def /Poly{3 1 roll newpath moveto -1 add{lineto}repeat closepath\n\
  43. patternNone not{ifill}if brushNone not{istroke}if}def /Rect{0 begin /t exch\n\
  44. def /r exch def /b exch def /l exch def newpath l b moveto l t lineto r t\n\
  45. lineto r b lineto closepath patternNone not{ifill}if brushNone not{istroke}if\n\
  46. end}dup 0 4 dict put def /Text{ishow}def /idef{dup where{pop pop pop}{exch def\n\
  47. }ifelse}def /ifill{0 begin gsave patternGrayLevel -1 ne{fgred bgred fgred sub\n\
  48. patternGrayLevel mul add fggreen bggreen fggreen sub patternGrayLevel mul add\n\
  49. fgblue bgblue fgblue sub patternGrayLevel mul add setrgbcolor eofill}{eoclip\n\
  50. originalCTM setmatrix pathbbox /t exch def /r exch def /b exch def /l exch def\n\
  51. /w r l sub ceiling cvi def /h t b sub ceiling cvi def /imageByteWidth w 8 div\n\
  52. ceiling cvi def /imageHeight h def bgred bggreen bgblue setrgbcolor eofill\n\
  53. fgred fggreen fgblue setrgbcolor w 0 gt h 0 gt and{l b translate w h scale w h\n\
  54. true[w 0 0 h neg 0 h]{patternproc}imagemask}if}ifelse grestore end}dup 0 8\n\
  55. dict put def /istroke{gsave brushDashOffset -1 eq{[]0 setdash 1 setgray}{\n\
  56. brushDashArray brushDashOffset setdash fgred fggreen fgblue setrgbcolor}\n\
  57. ifelse brushWidth setlinewidth originalCTM setmatrix stroke grestore}def\n\
  58. /ishow{0 begin gsave fgred fggreen fgblue setrgbcolor /fontDict printFont\n\
  59. findfont printSize scalefont dup setfont def /descender fontDict begin 0[\n\
  60. FontBBox]1 get FontMatrix end transform exch pop def /vertoffset 0 descender\n\
  61. sub printSize sub printFont /Courier ne printFont /Courier-Bold ne and{1 add}\n\
  62. if def{0 vertoffset moveto show /vertoffset vertoffset printSize sub def}\n\
  63. forall grestore end}dup 0 3 dict put def /patternproc{0 begin\n\
  64. /patternByteLength patternString length def /patternHeight patternByteLength 8\n\
  65. mul sqrt cvi def /patternWidth patternHeight def /patternByteWidth\n\
  66. patternWidth 8 idiv def /imageByteMaxLength imageByteWidth imageHeight mul\n\
  67. stringLimit patternByteWidth sub min def /imageMaxHeight imageByteMaxLength\n\
  68. imageByteWidth idiv patternHeight idiv patternHeight mul patternHeight max def\n\
  69. /imageHeight imageHeight imageMaxHeight sub store /imageString imageByteWidth\n\
  70. imageMaxHeight mul patternByteWidth add string def 0 1 imageMaxHeight 1 sub{\n\
  71. /y exch def /patternRow y patternByteWidth mul patternByteLength mod def\n\
  72. /patternRowString patternString patternRow patternByteWidth getinterval def\n\
  73. /imageRow y imageByteWidth mul def 0 patternByteWidth imageByteWidth 1 sub{/x\n\
  74. exch def imageString imageRow x add patternRowString putinterval}for}for\n\
  75. imageString end}dup 0 12 dict put def /min{dup 3 2 roll dup 4 3 roll lt{exch}\n\
  76. if pop}def /max{dup 3 2 roll dup 4 3 roll gt{exch}if pop}def /arrowhead{0\n\
  77. begin transform originalCTM itransform /taily exch def /tailx exch def\n\
  78. transform originalCTM itransform /tipy exch def /tipx exch def /dy tipy taily\n\
  79. sub def /dx tipx tailx sub def /angle dx 0 ne dy 0 ne or{dy dx atan}{90}\n\
  80. ifelse def gsave originalCTM setmatrix tipx tipy translate angle rotate\n\
  81. newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto arrowHeight neg\n\
  82. arrowWidth 2 div neg lineto closepath patternNone not{originalCTM setmatrix\n\
  83. /padtip arrowHeight 2 exp 0.25 arrowWidth 2 exp mul add sqrt brushWidth mul\n\
  84. arrowWidth div def /padtail brushWidth 2 div def tipx tipy translate angle\n\
  85. rotate padtip 0 translate arrowHeight padtip add padtail add arrowHeight div\n\
  86. dup scale arrowheadpath ifill}if brushNone not{originalCTM setmatrix tipx tipy\n\
  87. translate angle rotate arrowheadpath istroke}if grestore end}dup 0 9 dict put\n\
  88. def /arrowheadpath{newpath 0 0 moveto arrowHeight neg arrowWidth 2 div lineto\n\
  89. arrowHeight neg arrowWidth 2 div neg lineto closepath}def /leftarrow{0 begin y\n\
  90. exch get /taily exch def x exch get /tailx exch def y exch get /tipy exch def\n\
  91. x exch get /tipx exch def brushLeftArrow{tipx tipy tailx taily arrowhead}if\n\
  92. end}dup 0 4 dict put def /rightarrow{0 begin y exch get /tipy exch def x exch\n\
  93. get /tipx exch def y exch get /taily exch def x exch get /tailx exch def\n\
  94. brushRightArrow{tipx tipy tailx taily arrowhead}if end}dup 0 4 dict put def\n\
  95. /midpoint{0 begin /y1 exch def /x1 exch def /y0 exch def /x0 exch def x0 x1\n\
  96. add 2 div y0 y1 add 2 div end}dup 0 4 dict put def /thirdpoint{0 begin /y1\n\
  97. exch def /x1 exch def /y0 exch def /x0 exch def x0 2 mul x1 add 3 div y0 2 mul\n\
  98. y1 add 3 div end}dup 0 4 dict put def /subspline{0 begin /movetoNeeded exch\n\
  99. def y exch get /y3 exch def x exch get /x3 exch def y exch get /y2 exch def x\n\
  100. exch get /x2 exch def y exch get /y1 exch def x exch get /x1 exch def y exch\n\
  101. get /y0 exch def x exch get /x0 exch def x1 y1 x2 y2 thirdpoint /p1y exch def\n\
  102. /p1x exch def x2 y2 x1 y1 thirdpoint /p2y exch def /p2x exch def x1 y1 x0 y0\n\
  103. thirdpoint p1x p1y midpoint /p0y exch def /p0x exch def x2 y2 x3 y3 thirdpoint\n\
  104. p2x p2y midpoint /p3y exch def /p3x exch def movetoNeeded{p0x p0y moveto}if\n\
  105. p1x p1y p2x p2y p3x p3y curveto end}dup 0 17 dict put def /storexyn{/n exch\n\
  106. def /y n array def /x n array def n 1 sub -1 0{/i exch def y i 3 2 roll put x\n\
  107. i 3 2 roll put}for}def\n\
  108. %%EndProlog\n\
  109. ",""};
  110.