home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / educatio / vargra1.zip / GDHEAD.PS < prev    next >
Text File  |  1992-11-20  |  25KB  |  921 lines

  1. %%DocumentFonts: (atend)
  2. %%Creator: GRAF/DRIVE PLUS
  3. %%EndComments
  4.  
  5. %* GRAF/DRIVE PLUS Copyright (C) 1990-91  M.K. Fleming  All Rights Reserved
  6.  
  7. % -------------------------- VARIABLE LIST --------------------------------
  8. %
  9. % PERMANENT DEFINITIONS:
  10. % StdLine                         1-unit line width in decipoints
  11. % MonoColors                      Color definitions for 'mono' option
  12. % GrayColors                      Color definitions for 'gray' option
  13. % ColorColors                     Color definitions for 'color' option
  14. % ColorOptions                    Indexable lookup table of color choices
  15. % ColorMode                       0=mono,1=gray,2=color
  16. %
  17. %
  18. % CURRENT STATUS INFO:
  19. % CurFont                         current font
  20. % TxtDir                          text direction (0=horizontal, 1=vertical)
  21. % TxtHt                           text height
  22. % FillColor                       filling color
  23. % DrawColor                       drawing color
  24. % FillStyle                       fill pattern id
  25. % LineWidth                       line width (as multiple of StdLine)
  26. % LineStyle                       line pattern
  27. % ColorTable                      color array (set to Mono, Gray, or Color)
  28. % UserPat                         user-defined fill pattern
  29. % ptm                             pattern matrix
  30. %
  31. %
  32. % TEMPORARY, WORKING VALUES:
  33. % x1,y1,x2,y2                     rectangle coordinates
  34. % top,dep,ydep,h,w                3-D bar values
  35. % px1,py1,py2,pw,PatChar          pattern fill data
  36. % savematrix                      temporary storage
  37. %
  38. % -------------------------------------------------------------------------
  39.  
  40. /GrafDrivDict 100 dict def
  41. /ReEncodeDict 12 dict def
  42. GrafDrivDict begin
  43.  
  44. % ---------------------- PERMANENT DEFINITIONS ----------------------------
  45. /StdLine 2 def     % Normal line width, in decipoints
  46. /Thick   8 def     % Thick line width, as multiple of StdLine
  47.  
  48. /GrayColors
  49. [ 1.00 0.11 0.59 0.70 0.30 0.41 0.40 0.97 0.50 0.40 0.73 0.80 0.53 0.60 0.93
  50.   0.00  ] def
  51.  
  52. /MonoColors
  53. [ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ] def
  54.  
  55. /ColorColors
  56. [
  57.   [1 1 1]                         % white
  58.   [0 0 1]                         % blue
  59.   [0 1 0]                         % green
  60.   [0 1 1]                         % cyan
  61.   [1 0 0]                         % red
  62.   [1 0 1]                         % magenta
  63.   [0.67  0.33  0]                 % brown
  64.   [0.75 0.75 0.75]                % lightgray
  65.   [0.2 0.2 0.2]                   % darkgray
  66.   [0.33 0.33 1]                   % lightblue
  67.   [0.33  1 0.33]                  % lightgreen
  68.   [0.33 1 1]                      % lightcyan
  69.   [1 0.33  0.33]                  % lightred
  70.   [1 0.33  1]                     % lightmagenta
  71.   [1 1 0.33]                      % yellow
  72.   [0 0 0]                         % black
  73. ] def
  74.  
  75. /Color256
  76. [
  77.  [ 1    1    1    ]     % background color-- should be white=1,1,1
  78.  [ 0.07 0.07 0.07 ]
  79.  [ 0.14 0.14 0.14 ]
  80.  [ 0.21 0.21 0.21 ]
  81.  [ 0.28 0.28 0.28 ]
  82.  [ 0.35 0.35 0.35 ]
  83.  [ 0.42 0.42 0.42 ]
  84.  [ 0.50 0.50 0.50 ]
  85.  [ 0.57 0.57 0.57 ]
  86.  [ 0.64 0.64 0.64 ]
  87.  [ 0.71 0.71 0.71 ]
  88.  [ 0.78 0.78 0.78 ]
  89.  [ 0.85 0.85 0.85 ]
  90.  [ 0.93 0.93 0.93 ]
  91.  [ 1    1    1    ]
  92.  [ 0.12 0    0    ]
  93.  [ 0.25 0    0    ]
  94.  [ 0.37 0    0    ]
  95.  [ 0.50 0    0    ]
  96.  [ 0.62 0    0    ]
  97.  [ 0.75 0    0    ]
  98.  [ 0.87 0    0    ]
  99.  [ 1    0    0    ]
  100.  [ 1    0.12 0.12 ]
  101.  [ 1    0.25 0.25 ]
  102.  [ 1    0.37 0.37 ]
  103.  [ 1    0.50 0.50 ]
  104.  [ 1    0.62 0.62 ]
  105.  [ 1    0.75 0.75 ]
  106.  [ 1    0.87 0.87 ]
  107.  [ 0.12 0.04 0    ]
  108.  [ 0.25 0.08 0    ]
  109.  [ 0.37 0.12 0    ]
  110.  [ 0.50 0.16 0    ]
  111.  [ 0.62 0.20 0    ]
  112.  [ 0.75 0.24 0    ]
  113.  [ 0.87 0.29 0    ]
  114.  [ 1    0.33 0    ]
  115.  [ 1    0.41 0.12 ]
  116.  [ 1    0.49 0.25 ]
  117.  [ 1    0.58 0.37 ]
  118.  [ 1    0.66 0.50 ]
  119.  [ 1    0.75 0.62 ]
  120.  [ 1    0.83 0.75 ]
  121.  [ 1    0.91 0.87 ]
  122.  [ 0.12 0.08 0    ]
  123.  [ 0.25 0.16 0    ]
  124.  [ 0.37 0.25 0    ]
  125.  [ 0.50 0.33 0    ]
  126.  [ 0.62 0.42 0    ]
  127.  [ 0.75 0.50 0    ]
  128.  [ 0.87 0.58 0    ]
  129.  [ 1    0.67 0    ]
  130.  [ 1    0.71 0.12 ]
  131.  [ 1    0.75 0.25 ]
  132.  [ 1    0.79 0.37 ]
  133.  [ 1    0.83 0.50 ]
  134.  [ 1    0.87 0.62 ]
  135.  [ 1    0.91 0.75 ]
  136.  [ 1    0.95 0.87 ]
  137.  [ 0.12 0.12 0    ]
  138.  [ 0.25 0.25 0    ]
  139.  [ 0.37 0.37 0    ]
  140.  [ 0.50 0.50 0    ]
  141.  [ 0.62 0.62 0    ]
  142.  [ 0.75 0.75 0    ]
  143.  [ 0.87 0.87 0    ]
  144.  [ 1    1    0    ]
  145.  [ 1    1    0.12 ]
  146.  [ 1    1    0.25 ]
  147.  [ 1    1    0.37 ]
  148.  [ 1    1    0.50 ]
  149.  [ 1    1    0.62 ]
  150.  [ 1    1    0.75 ]
  151.  [ 1    1    0.87 ]
  152.  [ 0.08 0.12 0    ]
  153.  [ 0.16 0.25 0    ]
  154.  [ 0.25 0.37 0    ]
  155.  [ 0.33 0.50 0    ]
  156.  [ 0.42 0.62 0    ]
  157.  [ 0.50 0.75 0    ]
  158.  [ 0.58 0.87 0    ]
  159.  [ 0.67 1    0    ]
  160.  [ 0.71 1    0.12 ]
  161.  [ 0.75 1    0.25 ]
  162.  [ 0.79 1    0.37 ]
  163.  [ 0.83 1    0.50 ]
  164.  [ 0.87 1    0.62 ]
  165.  [ 0.91 1    0.75 ]
  166.  [ 0.95 1    0.87 ]
  167.  [ 0.04 0.12 0    ]
  168.  [ 0.08 0.25 0    ]
  169.  [ 0.12 0.37 0    ]
  170.  [ 0.16 0.50 0    ]
  171.  [ 0.20 0.62 0    ]
  172.  [ 0.24 0.75 0    ]
  173.  [ 0.29 0.87 0    ]
  174.  [ 0.33 1    0    ]
  175.  [ 0.41 1    0.12 ]
  176.  [ 0.49 1    0.25 ]
  177.  [ 0.58 1    0.37 ]
  178.  [ 0.66 1    0.50 ]
  179.  [ 0.75 1    0.62 ]
  180.  [ 0.83 1    0.75 ]
  181.  [ 0.91 1    0.87 ]
  182.  [ 0    0.12 0    ]
  183.  [ 0    0.25 0    ]
  184.  [ 0    0.37 0    ]
  185.  [ 0    0.50 0    ]
  186.  [ 0    0.62 0    ]
  187.  [ 0    0.75 0    ]
  188.  [ 0    0.87 0    ]
  189.  [ 0    1    0    ]
  190.  [ 0.12 1    0.12 ]
  191.  [ 0.25 1    0.25 ]
  192.  [ 0.37 1    0.37 ]
  193.  [ 0.50 1    0.50 ]
  194.  [ 0.62 1    0.62 ]
  195.  [ 0.75 1    0.75 ]
  196.  [ 0.87 1    0.87 ]
  197.  [ 0    0.12 0.04 ]
  198.  [ 0    0.25 0.08 ]
  199.  [ 0    0.37 0.12 ]
  200.  [ 0    0.50 0.16 ]
  201.  [ 0    0.62 0.20 ]
  202.  [ 0    0.75 0.24 ]
  203.  [ 0    0.87 0.29 ]
  204.  [ 0    1    0.33 ]
  205.  [ 0.12 1    0.41 ]
  206.  [ 0.25 1    0.49 ]
  207.  [ 0.37 1    0.58 ]
  208.  [ 0.50 1    0.66 ]
  209.  [ 0.62 1    0.75 ]
  210.  [ 0.75 1    0.83 ]
  211.  [ 0.87 1    0.91 ]
  212.  [ 0    0.12 0.08 ]
  213.  [ 0    0.25 0.16 ]
  214.  [ 0    0.37 0.25 ]
  215.  [ 0    0.50 0.33 ]
  216.  [ 0    0.62 0.42 ]
  217.  [ 0    0.75 0.50 ]
  218.  [ 0    0.87 0.58 ]
  219.  [ 0    1    0.67 ]
  220.  [ 0.12 1    0.71 ]
  221.  [ 0.25 1    0.75 ]
  222.  [ 0.37 1    0.79 ]
  223.  [ 0.50 1    0.83 ]
  224.  [ 0.62 1    0.87 ]
  225.  [ 0.75 1    0.91 ]
  226.  [ 0.87 1    0.95 ]
  227.  [ 0    0.12 0.12 ]
  228.  [ 0    0.25 0.25 ]
  229.  [ 0    0.37 0.37 ]
  230.  [ 0    0.50 0.50 ]
  231.  [ 0    0.62 0.62 ]
  232.  [ 0    0.75 0.75 ]
  233.  [ 0    0.87 0.87 ]
  234.  [ 0    1    1    ]
  235.  [ 0.12 1    1    ]
  236.  [ 0.25 1    1    ]
  237.  [ 0.37 1    1    ]
  238.  [ 0.50 1    1    ]
  239.  [ 0.62 1    1    ]
  240.  [ 0.75 1    1    ]
  241.  [ 0.87 1    1    ]
  242.  [ 0    0.08 0.12 ]
  243.  [ 0    0.16 0.25 ]
  244.  [ 0    0.25 0.37 ]
  245.  [ 0    0.33 0.50 ]
  246.  [ 0    0.42 0.62 ]
  247.  [ 0    0.50 0.75 ]
  248.  [ 0    0.58 0.87 ]
  249.  [ 0    0.67 1    ]
  250.  [ 0.12 0.71 1    ]
  251.  [ 0.25 0.75 1    ]
  252.  [ 0.37 0.79 1    ]
  253.  [ 0.50 0.83 1    ]
  254.  [ 0.62 0.87 1    ]
  255.  [ 0.75 0.91 1    ]
  256.  [ 0.87 0.95 1    ]
  257.  [ 0    0.04 0.12 ]
  258.  [ 0    0.08 0.25 ]
  259.  [ 0    0.12 0.37 ]
  260.  [ 0    0.16 0.50 ]
  261.  [ 0    0.20 0.62 ]
  262.  [ 0    0.24 0.75 ]
  263.  [ 0    0.29 0.87 ]
  264.  [ 0    0.33 1    ]
  265.  [ 0.12 0.41 1    ]
  266.  [ 0.25 0.49 1    ]
  267.  [ 0.37 0.58 1    ]
  268.  [ 0.50 0.66 1    ]
  269.  [ 0.62 0.75 1    ]
  270.  [ 0.75 0.83 1    ]
  271.  [ 0.87 0.91 1    ]
  272.  [ 0    0    0.12 ]
  273.  [ 0    0    0.25 ]
  274.  [ 0    0    0.37 ]
  275.  [ 0    0    0.50 ]
  276.  [ 0    0    0.62 ]
  277.  [ 0    0    0.75 ]
  278.  [ 0    0    0.87 ]
  279.  [ 0    0    1    ]
  280.  [ 0.12 0.12 1    ]
  281.  [ 0.25 0.25 1    ]
  282.  [ 0.37 0.37 1    ]
  283.  [ 0.50 0.50 1    ]
  284.  [ 0.62 0.62 1    ]
  285.  [ 0.75 0.75 1    ]
  286.  [ 0.87 0.87 1    ]
  287.  [ 0.06 0    0.12 ]
  288.  [ 0.12 0    0.25 ]
  289.  [ 0.18 0    0.37 ]
  290.  [ 0.25 0    0.50 ]
  291.  [ 0.31 0    0.62 ]
  292.  [ 0.37 0    0.75 ]
  293.  [ 0.44 0    0.87 ]
  294.  [ 0.50 0    1    ]
  295.  [ 0.56 0.12 1    ]
  296.  [ 0.62 0.25 1    ]
  297.  [ 0.68 0.37 1    ]
  298.  [ 0.75 0.50 1    ]
  299.  [ 0.81 0.62 1    ]
  300.  [ 0.87 0.75 1    ]
  301.  [ 0.93 0.87 1    ]
  302.  [ 0.12 0    0.12 ]
  303.  [ 0.25 0    0.25 ]
  304.  [ 0.37 0    0.37 ]
  305.  [ 0.50 0    0.50 ]
  306.  [ 0.62 0    0.62 ]
  307.  [ 0.75 0    0.75 ]
  308.  [ 0.87 0    0.87 ]
  309.  [ 1    0    1    ]
  310.  [ 1    0.12 1    ]
  311.  [ 1    0.25 1    ]
  312.  [ 1    0.37 1    ]
  313.  [ 1    0.50 1    ]
  314.  [ 1    0.62 1    ]
  315.  [ 1    0.75 1    ]
  316.  [ 1    0.87 1    ]
  317.  [ 0.12 0    0.06 ]
  318.  [ 0.25 0    0.12 ]
  319.  [ 0.37 0    0.18 ]
  320.  [ 0.50 0    0.25 ]
  321.  [ 0.62 0    0.31 ]
  322.  [ 0.75 0    0.37 ]
  323.  [ 0.87 0    0.44 ]
  324.  [ 1    0    0.50 ]
  325.  [ 1    0.12 0.56 ]
  326.  [ 1    0.25 0.62 ]
  327.  [ 1    0.37 0.68 ]
  328.  [ 1    0.50 0.75 ]
  329.  [ 1    0.62 0.81 ]
  330.  [ 1    0.75 0.87 ]
  331.  [ 1    0.87 0.93 ]
  332.  [ 0    0    0    ]     % default color--should be black=0,0,0
  333. ] def
  334.  
  335. /ColorOptions
  336. [ MonoColors GrayColors ColorColors Color256] def
  337.  
  338. /CharSet
  339. [
  340.     10#128   /Ccedilla
  341.     10#129   /udieresis
  342.     10#130   /eacute
  343.     10#131   /acircumflex
  344.     10#132   /adieresis
  345.     10#133   /agrave
  346.     10#134   /aring
  347.     10#135   /ccedilla
  348.     10#136   /ecircumflex
  349.     10#137   /edieresis
  350.     10#138   /egrave
  351.     10#139   /idieresis
  352.     10#140   /icircumflex
  353.     10#141   /igrave
  354.     10#142   /Adieresis
  355.     10#143   /Aring
  356.     10#144   /Eacute
  357.     10#145   /ae
  358.     10#146   /AE
  359.     10#147   /ocircumflex
  360.     10#148   /odieresis
  361.     10#149   /ograve
  362.     10#150   /ucircumflex
  363.     10#151   /ugrave
  364.     10#152   /ydieresis
  365.     10#153   /Odieresis
  366.     10#154   /Udieresis
  367.     10#155   /cent
  368.     10#156   /sterling
  369.     10#157   /yen
  370.     10#158   /P
  371.     10#159   /florin
  372.     10#160   /aacute
  373.     10#161   /iacute
  374.     10#162   /oacute
  375.     10#163   /uacute
  376.     10#164   /ntilde
  377.     10#165   /Ntilde
  378.     10#166   /ordfeminine
  379.     10#167   /ordmasculine
  380.     10#168   /questiondown
  381. ] def
  382.  
  383. % --------------------------------------------------------------------
  384. % OldName NewName AF      Encode font OldName to NewName
  385. % --------------------------------------------------------------------
  386. /AF
  387. {
  388. ReEncodeDict begin
  389.     /NewName exch def  /OldName exch def
  390.     FontDirectory NewName known not
  391.     {
  392.         FontDirectory OldName known not { /OldName /Courier def } if
  393.         /BaseFontDict OldName findfont def
  394.         /NewFontDict BaseFontDict maxlength dict def
  395.         BaseFontDict
  396.         {
  397.             exch dup /FID ne
  398.             {
  399.                 dup /Encoding eq
  400.                 {
  401.                     exch dup length array copy
  402.                     NewFontDict 3 1 roll put
  403.                 }
  404.                 {
  405.                     exch NewFontDict 3 1 roll put
  406.                 }
  407.                 ifelse
  408.             }
  409.             {
  410.                 pop pop
  411.             }
  412.             ifelse
  413.         } forall
  414.  
  415.         NewFontDict /FontName NewName put
  416.  
  417.         CharSet aload
  418.         length 2 idiv
  419.         {
  420.             NewFontDict /Encoding get 3 1 roll put
  421.         }
  422.         repeat
  423.  
  424.         NewName NewFontDict definefont pop
  425.     } if
  426. end
  427. } bind def
  428.  
  429.  
  430. % ---------------------------------------------------------------------------
  431. %                           PATTERN FILLS
  432. % ---------------------------------------------------------------------------
  433. /newfont 10 dict def
  434. newfont begin
  435.  
  436. /FontType 3 def
  437. /FontMatrix [ 1 0 0 1 0 0 ] def
  438. /FontBBox [ 0 0 8 8 ] def
  439. /Encoding 256 array def
  440.   0 1 255 { Encoding exch /.notdef put } for
  441.   Encoding  99 /linefill  put      % c=2
  442.   Encoding 100 /ltslash   put      % d=3
  443.   Encoding 101 /slash     put      % e=4
  444.   Encoding 102 /bkslash   put      % f=5
  445.   Encoding 103 /ltbkslash put      % g=6
  446.   Encoding 104 /hatch     put      % h=7
  447.   Encoding 105 /xhatch    put      % i=8
  448.   Encoding 106 /interleav put      % j=9
  449.   Encoding 107 /widedot   put      % k=10
  450.   Encoding 108 /closedot  put      % l=11
  451.   Encoding 122 /userfill  put      % z=12
  452.  
  453.  
  454. /CharProcs 16 dict def
  455. CharProcs begin
  456. /.notdef {} bind def
  457. /linefill  { 8 8 true [1 0 0 -1 0 8] { <ffff0000ffff0000> } imagemask } bind def
  458. /ltslash   { 8 8 true [1 0 0 -1 0 8] { <0102040810204080> } imagemask } bind def
  459. /slash     { 8 8 true [1 0 0 -1 0 8] { <e0c183070e1c3870> } imagemask } bind def
  460. /bkslash   { 8 8 true [1 0 0 -1 0 8] { <f0783c1e0f87c3e1> } imagemask } bind def
  461. /ltbkslash { 8 8 true [1 0 0 -1 0 8] { <a5d269b45a2d964b> } imagemask } bind def
  462. /hatch     { 8 8 true [1 0 0 -1 0 8] { <ff888888ff888888> } imagemask } bind def
  463. /xhatch    { 8 8 true [1 0 0 -1 0 8] { <8142241818244281> } imagemask } bind def
  464. /interleav { 8 8 true [1 0 0 -1 0 8] { <cc33cc33cc33cc33> } imagemask } bind def
  465. /widedot   { 8 8 true [1 0 0 -1 0 8] { <8000080080000800> } imagemask } bind def
  466. /closedot  { 8 8 true [1 0 0 -1 0 8] { <8800220088002200> } imagemask } bind def
  467. /userfill  { 8 8 true [1 0 0 -1 0 8] { UserPat            } imagemask } bind def
  468. end
  469.  
  470. /BuildChar       % fontdic charcode BuildChar
  471. {
  472.     exch begin
  473.         dup  122 eq
  474.         {
  475.             8 0 setcharwidth
  476.         }{
  477.             8 0   0 0 8 8  setcachedevice
  478.         } ifelse
  479.         Encoding exch get
  480.         CharProcs exch get
  481.     end
  482.     exec
  483. } bind def
  484. end % of newfont
  485. /PatFont newfont definefont pop
  486.  
  487. /UserPat <0001020400402010>  def
  488. /PatChar (a) def
  489.  
  490. /patfill
  491. {
  492.     gsave
  493.     eoclip
  494.     gsave 0 CS      fill grestore
  495.     ptm setmatrix /PatFont findfont 1 scalefont setfont
  496.     PatChar 0 FillStyle 97 add put
  497.  
  498.     pathbbox newpath
  499.     4 2 roll
  500.     cvi 3 not and /py1 exch def
  501.     cvi 3 not and /px1 exch def
  502.     /py2 exch def
  503.     px1 sub 8 div ceiling cvi /pw exch def
  504.  
  505.     py1 8 py2
  506.     {
  507.         px1 exch moveto
  508.         pw { PatChar show } repeat
  509.     } for
  510.  
  511.     grestore
  512. } bind def
  513.  
  514. % ---------------------------------------------------------------------------
  515.  
  516.  
  517.  
  518. /xround
  519. {
  520.     dup round dup 0 eq
  521.     {
  522.         2 -1 roll 0 lt { -1 } { 1 } ifelse
  523.     }if
  524.     2 -1 roll pop
  525. } bind def
  526.  
  527. /roundup
  528. {
  529.     dup 0 lt {floor} {ceiling} ifelse
  530. } bind def
  531.  
  532. /N { newpath } bind def
  533. /M { moveto } bind def
  534. /L { lineto } bind def
  535. /C { closepath } bind def
  536.  
  537.  
  538. % ----------------------------------------------------------------------
  539. % x1 y1 x2 y2       REC    draw rectangle (x1,y1)-(x2,y2)
  540. % ----------------------------------------------------------------------
  541. /REC
  542. {
  543.     transform round exch round exch itransform 4 2 roll
  544.     transform round exch round exch itransform 4 2 roll
  545.     /y2 exch def  /x2 exch def  /y1 exch def  /x1 exch def
  546.     newpath
  547.     x1 y1 moveto
  548.     x2 y1 lineto
  549.     x2 y2 lineto
  550.     x1 y2 lineto
  551.     closepath
  552. } bind def
  553.  
  554. % ----------------------------------------------------------------------
  555. %                   SK     stroke the current path
  556. % ----------------------------------------------------------------------
  557. /SK
  558. {
  559.     gsave DrawColor CS stroke grestore newpath
  560. } bind def
  561.  
  562. % ----------------------------------------------------------------------
  563. %                   FILL   fill the current path
  564. % ----------------------------------------------------------------------
  565. /FILL
  566. {
  567.     gsave
  568.     FillStyle 0 eq { 1 setgray }{ FillColor CS } ifelse
  569.     FillStyle 1 le ColorMode 1 eq or
  570.     { eoclip fill } { patfill } ifelse
  571.     grestore
  572. } bind def
  573.  
  574. % ----------------------------------------------------------------------
  575. % x1 y1 x2 y2       VEC    draw line from (x1,y1) to (x2,y2)
  576. % ----------------------------------------------------------------------
  577. /VEC
  578. {
  579.     transform round exch round exch itransform 4 2 roll
  580.     transform round exch round exch itransform 4 2 roll
  581.     newpath moveto lineto SK
  582. } bind def
  583.  
  584. % ----------------------------------------------------------------------
  585. % x1 y1             VS     start path
  586. % ----------------------------------------------------------------------
  587. /VS
  588. {
  589.     transform round exch round exch itransform
  590.     newpath moveto
  591. } bind def
  592.  
  593. % ----------------------------------------------------------------------
  594. % x  y              VR     close/continue path
  595. % ----------------------------------------------------------------------
  596. /VR
  597. {
  598.     transform round exch round exch itransform
  599.     closepath moveto
  600. } bind def
  601.  
  602. % ----------------------------------------------------------------------
  603. % x  y              VC     continue path
  604. % ----------------------------------------------------------------------
  605. /VC
  606. {
  607.     transform round exch round exch itransform
  608.     lineto
  609. } bind def
  610.  
  611. % ----------------------------------------------------------------------
  612. % x  y  c           PX     simulated putpixel
  613. % ----------------------------------------------------------------------
  614. /PX
  615. {
  616.     gsave
  617.     newpath CS 2 setlinewidth [] 0 setdash
  618.     transform round exch round exch itransform moveto
  619.     -1 0 rmoveto 1 0 rlineto stroke
  620.     grestore
  621. } bind def
  622.  
  623. % ----------------------------------------------------------------------
  624. % x1 y1 x2 y2 d t   BAR    fill and outline rectangle (x1,y1)-(x2,y2)
  625. % ----------------------------------------------------------------------
  626. /BAR
  627. {
  628.     /top exch def /dep exch def
  629.     REC FILL
  630.     newpath
  631.     x2 y1 moveto
  632.     x1 y1 lineto
  633.     x1 y2 lineto
  634.     x2 y2 lineto
  635.     x2 y1 lineto
  636.     dep 0 ne { BARDEP } if
  637.     SK
  638. } bind def
  639.  
  640. /BARDEP
  641. {
  642.     dep .6 mul /ydep exch def
  643.     y2 y1 sub /h exch def
  644.     x2 x1 sub /w exch def
  645.     dep ydep rlineto
  646.     0 h rlineto
  647.     top 0 ne { BARTOP } if
  648. } bind def
  649.  
  650. /BARTOP
  651. {
  652.     w neg 0 rlineto
  653.     dep neg ydep neg rlineto
  654.     w 0 rlineto
  655.     dep ydep rlineto
  656.     0 h neg rlineto
  657.     closepath
  658. } bind def
  659.  
  660. % ----------------------------------------------------------------------
  661. % x1 y1 x2 y2       PBR    fill rectangle (x1,y1)-(x2,y2)
  662. % ----------------------------------------------------------------------
  663. /PBR
  664. {
  665.     REC FILL
  666. } bind def
  667.  
  668. % ----------------------------------------------------------------------
  669. % xc yc th1 th2 a b EPATH  elliptical path
  670. % ----------------------------------------------------------------------
  671. /EPATH
  672. {
  673.     /savematrix matrix currentmatrix def
  674.     6 -2 roll translate scale
  675.     0 0 1 5 -2 roll arc
  676.     savematrix setmatrix
  677. } bind def
  678.  
  679. % ----------------------------------------------------------------------
  680. % xc yc th1 th2 a b ARC    draw an elliptical arc
  681. % ----------------------------------------------------------------------
  682. /ARC
  683. {
  684.     gsave
  685.     newpath EPATH [] 0 setdash SK
  686.     grestore
  687. } bind def
  688.  
  689. % ----------------------------------------------------------------------
  690. % xc yc th1 th2 a b PIE    draw and fill an elliptical pieslice
  691. % ----------------------------------------------------------------------
  692. /PIE
  693. {
  694.     gsave
  695.     newpath
  696.     6 -2 roll 2 copy moveto 6 2 roll
  697.     EPATH closepath FILL SK
  698.     grestore
  699. } bind def
  700.  
  701. % ----------------------------------------------------------------------
  702. % xc yc a b         ELI    draw and fill an ellipse
  703. % ----------------------------------------------------------------------
  704. /ELI
  705. {
  706.     4 2 roll 0 360 6 -2 roll
  707.     gsave
  708.     newpath EPATH FILL SK
  709.     grestore
  710. } bind def
  711.  
  712. % ----------------------------------------------------------------------
  713. % x y dx dy (text)  TXT    draw text at x,y
  714. % ----------------------------------------------------------------------
  715. /TXT
  716. {
  717.     gsave
  718.     DrawColor CS
  719.     5 -2 roll translate TxtDir 0 ne { 90 rotate } if
  720.     3 1 roll MoveChar mul 2 div
  721.     exch 2 index stringwidth pop mul 2 div
  722.     exch moveto show
  723.     grestore
  724. } bind def
  725.  
  726. % ----------------------------------------------------------------------
  727. % size dir font   TXS     sets text size
  728. % ----------------------------------------------------------------------
  729. /TXS
  730. {
  731.     /CurFont exch def /TxtDir exch def  /TxtHt exch def
  732.     CurFont findfont TxtHt scalefont setfont
  733.     /MoveChar TxtHt def
  734. %   newpath 0 0 moveto
  735. %   (0|h) false charpath flattenpath pathbbox newpath
  736. %   /MoveChar exch def 3 { pop } repeat
  737. } bind def
  738.  
  739. % ----------------------------------------------------------------------
  740. % array             LD      defines line style
  741. % ----------------------------------------------------------------------
  742. /LD
  743. {
  744.     dup /LineStyle exch def 0 setdash
  745. } bind def
  746.  
  747. % ----------------------------------------------------------------------
  748. % draw fill         CD      defines colors
  749. % ----------------------------------------------------------------------
  750. /CD
  751. {
  752.     /FillColor exch def  /DrawColor exch def
  753. } bind def
  754.  
  755. % ----------------------------------------------------------------------
  756. % pat#              FD      defines fill pattern
  757. % ----------------------------------------------------------------------
  758. /FD
  759. {
  760.     /FillStyle exch def
  761. } bind def
  762.  
  763. % ----------------------------------------------------------------------
  764. % patstr            FPD     defines user fill
  765. % ----------------------------------------------------------------------
  766. /FPD
  767. {
  768.     /UserPat exch def  /FillStyle 25 def
  769. } bind def
  770.  
  771. % ----------------------------------------------------------------------
  772. % color             CS      select  color
  773. % ----------------------------------------------------------------------
  774. /CS
  775. {
  776.     ColorTable exch get
  777.     dup type /arraytype ne { setgray }{ {} forall setrgbcolor } ifelse
  778. } bind def
  779.  
  780. % ----------------------------------------------------------------------
  781. % x1 y1 x2 y2       CLIP   set clipping region
  782. % ----------------------------------------------------------------------
  783. /CLIP
  784. {
  785.     transform round exch round exch itransform 4 2 roll
  786.     transform round exch round exch itransform 4 2 roll
  787.     grestore gsave   % reset to INXX state
  788.     0 setlinewidth REC eoclip newpath
  789.     % restore current graphics state
  790.     TxtHt TxtDir CurFont TXS
  791.     LineWidth setlinewidth
  792.     LineStyle 0 setdash
  793. } bind def
  794.  
  795.  
  796. % ----------------------------------------------------------------------
  797. % no                LW      set line width
  798. % ----------------------------------------------------------------------
  799. /LW
  800. {
  801.     StdLine mul dup /LineWidth exch def setlinewidth
  802. } bind def
  803.  
  804. % ----------------------------------------------------------------------
  805. % Width Height Orient Left Top Cmode      INXX    Initialize Page
  806. % Orient: 0=portrait, 1=landscape
  807. % ----------------------------------------------------------------------
  808. /INXX
  809. {
  810.     /PGstate save def
  811.     dup 3 gt { pop 0 } if /ColorMode exch def
  812.     ColorOptions ColorMode get /ColorTable exch def
  813.  
  814.     /ptm
  815.     [
  816. %       1 1 matrix defaultmatrix dtransform xround exch xround exch
  817.         0.5 0.5 matrix defaultmatrix dtransform xround exch xround exch
  818.         0 exch 0 exch 0 0
  819.     ] def
  820.     2 index 0 ne   % if landscape
  821.     {
  822.         /ptm
  823.         [
  824.             ptm aload pop 6 2 roll 4 2 roll neg exch neg exch 6 -2 roll
  825.         ] def
  826.     }
  827.     if
  828.  
  829.     0.1 0.1 scale translate
  830.  
  831.     0 eq
  832.     { neg 0 exch translate pop }                % portrait
  833.     { 90 rotate neg exch neg exch translate }   % landscape
  834.     ifelse
  835.  
  836.     /StdLine
  837.     StdLine dup dtransform roundup exch roundup exch idtransform pop
  838.     def
  839.  
  840.     /Courier /CourierGD AF
  841.     120 0 /CourierGD TXS
  842.     15 15 CD
  843.     1  FD
  844.     1  LW
  845.     [] LD
  846.     1.415 setmiterlimit
  847.     gsave
  848. } bind def
  849.  
  850. % ----------------------------------------------------------------------
  851. %                   TERM    Display Page
  852. % ----------------------------------------------------------------------
  853. /TERM
  854. {
  855. %xx PGstate restore
  856.     showpage
  857.     PGstate restore
  858. } bind def
  859.  
  860.  
  861. % ----------------------------------------------------------------------
  862. % ulx uly width height imagecols imagerows CI  hexdata      ;Color Image
  863. % ----------------------------------------------------------------------
  864. /CI
  865. {
  866.     gsave
  867.     /rows exch def /cols exch def
  868.     4 2 roll translate scale
  869.     /picstr cols string def
  870.  
  871.     cols rows 8
  872.     [ cols 0 0 rows neg 0 0 ]
  873.     { currentfile picstr readhexstring pop }
  874.     false 3 colorimage
  875.     grestore
  876. } bind def
  877.  
  878.  
  879. % ----------------------------------------------------------------------
  880. % ulx uly width height imagecols imagerows bits GI  hexdata ;GrayScale Image
  881. % ----------------------------------------------------------------------
  882. /GI
  883. {
  884.     gsave
  885.     /bits exch def /rows exch def /cols exch def
  886.     4 2 roll translate scale
  887.     /picstr cols 8 idiv bits mul string def
  888.  
  889.     cols rows bits
  890.     [ cols 0 0 rows neg 0 0 ]
  891.     { currentfile picstr readhexstring pop }
  892.     image
  893.     grestore
  894. } bind def
  895.  
  896.  
  897. % ................ INSERT ANY USER PROCS HERE ........................
  898. %  Always use gsave/grestore around user proc code
  899.  
  900. % This is an example of a User Proc to display text rotated to any
  901. % angle.  It does not work for stroked fonts, only for DEFAULT_FONT
  902. % and PostScript fonts
  903.  
  904. /ROT                      %    x y (text) angle ROT
  905. {
  906.     gsave
  907.     DrawColor CS          % select the drawing color
  908.     4 -2 roll translate   % move the origin to (x,y)
  909.     rotate                % rotate to angle
  910.                           % compute coords to center vertically
  911.     0 0 moveto (X) false charpath flattenpath pathbbox newpath
  912.     2 index add -2 div 0 exch moveto pop pop pop
  913.     show
  914.     grestore
  915. } bind def
  916.  
  917. % ....................................................................
  918.  
  919. %%EndProlog
  920.  
  921.