home *** CD-ROM | disk | FTP | other *** search
/ Kids Cube / 1_Art.iso / evp / _ps.pro < prev    next >
Text File  |  1994-06-01  |  20KB  |  671 lines

  1. %%DocumentFonts: (atend)
  2. %%Creator:  EnVision Publisher
  3. %%EndComments
  4.  
  5. %* GRAF/DRIVE PLUS Copyright (C) 1990-91  M.K. Fleming  All Rights Reserved
  6.  
  7. % Portions Copyright (c) 1992-94 Software Vision Corporation.
  8.  
  9. % -------------------------- VARIABLE LIST --------------------------------
  10. %
  11. % PERMANENT DEFINITIONS:
  12. % StdLine                         1-unit line width in decipoints
  13. %
  14. % CURRENT STATUS INFO:
  15. % CurFont                         current font
  16. % TxtDir                          text direction (0=horizontal, 1=vertical)
  17. % TxtHt                           text height
  18. % FillColor                       filling color
  19. % DrawColor                       drawing color
  20. % AuxColor                        fill interior color
  21. % FillStyle                       fill pattern id
  22. % LineWidth                       line width (as multiple of StdLine)
  23. % LineStyle                       line pattern
  24. % UserPat                         user-defined fill pattern
  25. % ptm                             pattern matrix
  26. %
  27. %
  28. % TEMPORARY, WORKING VALUES:
  29. % x1,y1,x2,y2                     rectangle coordinates
  30. % top,dep,ydep,h,w                3-D bar values
  31. % px1,py1,py2,pw,PatChar          pattern fill data
  32. % savematrix                      temporary storage
  33. %
  34. % -------------------------------------------------------------------------
  35.  
  36. /GrafDrivDict 100 dict def
  37. /ReEncodeDict 12 dict def
  38. GrafDrivDict begin
  39.  
  40. % ---------------------- PERMANENT DEFINITIONS ----------------------------
  41. /StdLine 2 def     % Normal line width, in decipoints
  42. /Thick   8 def     % Thick line width, as multiple of StdLine
  43.  
  44. /CharSet
  45. [
  46.     10#128   /Ccedilla
  47.     10#129   /udieresis
  48.     10#130   /eacute
  49.     10#131   /acircumflex
  50.     10#132   /adieresis
  51.     10#133   /agrave
  52.     10#134   /aring
  53.     10#135   /ccedilla
  54.     10#136   /ecircumflex
  55.     10#137   /edieresis
  56.     10#138   /egrave
  57.     10#139   /idieresis
  58.     10#140   /icircumflex
  59.     10#141   /igrave
  60.     10#142   /Adieresis
  61.     10#143   /Aring
  62.     10#144   /Eacute
  63.     10#145   /ae
  64.     10#146   /AE
  65.     10#147   /ocircumflex
  66.     10#148   /odieresis
  67.     10#149   /ograve
  68.     10#150   /ucircumflex
  69.     10#151   /ugrave
  70.     10#152   /ydieresis
  71.     10#153   /Odieresis
  72.     10#154   /Udieresis
  73.     10#155   /cent
  74.     10#156   /sterling
  75.     10#157   /yen
  76.     10#158   /P
  77.     10#159   /florin
  78.     10#160   /aacute
  79.     10#161   /iacute
  80.     10#162   /oacute
  81.     10#163   /uacute
  82.     10#164   /ntilde
  83.     10#165   /Ntilde
  84.     10#166   /ordfeminine
  85.     10#167   /ordmasculine
  86.     10#168   /questiondown
  87. ] def
  88.  
  89. % --------------------------------------------------------------------
  90. % OldName NewName AF      Encode font OldName to NewName
  91. % --------------------------------------------------------------------
  92. /AF
  93. {
  94. ReEncodeDict begin
  95.     /NewName exch def  /OldName exch def
  96.     FontDirectory NewName known not
  97.     {
  98.         FontDirectory OldName known not { /OldName /Courier def } if
  99.         /BaseFontDict OldName findfont def
  100.         /NewFontDict BaseFontDict maxlength dict def
  101.         BaseFontDict
  102.         {
  103.             exch dup /FID ne
  104.             {
  105.                 dup /Encoding eq
  106.                 {
  107.                     exch dup length array copy
  108.                     NewFontDict 3 1 roll put
  109.                 }
  110.                 {
  111.                     exch NewFontDict 3 1 roll put
  112.                 }
  113.                 ifelse
  114.             }
  115.             {
  116.                 pop pop
  117.             }
  118.             ifelse
  119.         } forall
  120.  
  121.         NewFontDict /FontName NewName put
  122.  
  123.         CharSet aload
  124.         length 2 idiv
  125.         {
  126.             NewFontDict /Encoding get 3 1 roll put
  127.         }
  128.         repeat
  129.  
  130.         NewName NewFontDict definefont pop
  131.     } if
  132. end
  133. } bind def
  134.  
  135.  
  136. % ---------------------------------------------------------------------------
  137. %                           PATTERN FILLS
  138. % ---------------------------------------------------------------------------
  139. /newfont 10 dict def
  140. newfont begin
  141.  
  142. /FontType 3 def
  143. /FontMatrix [ 1 0 0 1 0 0 ] def
  144. /FontBBox [ 0 0 8 8 ] def
  145. /Encoding 256 array def
  146.   0 1 255 { Encoding exch /.notdef put } for
  147.   Encoding  99 /linefill  put      % c=2
  148.   Encoding 100 /ltslash   put      % d=3
  149.   Encoding 101 /slash     put      % e=4
  150.   Encoding 102 /bkslash   put      % f=5
  151.   Encoding 103 /ltbkslash put      % g=6
  152.   Encoding 104 /hatch     put      % h=7
  153.   Encoding 105 /xhatch    put      % i=8
  154.   Encoding 106 /interleav put      % j=9
  155.   Encoding 107 /widedot   put      % k=10
  156.   Encoding 108 /closedot  put      % l=11
  157.   Encoding 122 /userfill  put      % z=12
  158.  
  159.  
  160. /CharProcs 16 dict def
  161. CharProcs begin
  162. /.notdef {} bind def
  163. /linefill  { 8 8 true [1 0 0 -1 0 8] { <ffff0000ffff0000> } imagemask } bind def
  164. /ltslash   { 8 8 true [1 0 0 -1 0 8] { <0102040810204080> } imagemask } bind def
  165. /slash     { 8 8 true [1 0 0 -1 0 8] { <e0c183070e1c3870> } imagemask } bind def
  166. /bkslash   { 8 8 true [1 0 0 -1 0 8] { <f0783c1e0f87c3e1> } imagemask } bind def
  167. /ltbkslash { 8 8 true [1 0 0 -1 0 8] { <a5d269b45a2d964b> } imagemask } bind def
  168. /hatch     { 8 8 true [1 0 0 -1 0 8] { <ff888888ff888888> } imagemask } bind def
  169. /xhatch    { 8 8 true [1 0 0 -1 0 8] { <8142241818244281> } imagemask } bind def
  170. /interleav { 8 8 true [1 0 0 -1 0 8] { <cc33cc33cc33cc33> } imagemask } bind def
  171. /widedot   { 8 8 true [1 0 0 -1 0 8] { <8000080080000800> } imagemask } bind def
  172. /closedot  { 8 8 true [1 0 0 -1 0 8] { <8800220088002200> } imagemask } bind def
  173. /userfill  { 8 8 true [1 0 0 -1 0 8] { UserPat            } imagemask } bind def
  174. end
  175.  
  176. /BuildChar       % fontdic charcode BuildChar
  177. {
  178.     exch begin
  179.         dup  122 eq
  180.         {
  181.             8 0 setcharwidth
  182.         }{
  183.             8 0   0 0 8 8  setcachedevice
  184.         } ifelse
  185.         Encoding exch get
  186.         CharProcs exch get
  187.     end
  188.     exec
  189. } bind def
  190. end % of newfont
  191. /PatFont newfont definefont pop
  192.  
  193. /UserPat <0001020400402010>  def
  194. /PatChar (a) def
  195.  
  196. /patfill
  197. {
  198.     gsave
  199.     eoclip
  200.     gsave AuxColor CS fill grestore
  201.     ptm setmatrix /PatFont findfont 1 scalefont setfont
  202.     PatChar 0 FillStyle 97 add put
  203.  
  204.     pathbbox newpath
  205.     4 2 roll
  206.     cvi 3 not and /py1 exch def
  207.     cvi 3 not and /px1 exch def
  208.     /py2 exch def
  209.     px1 sub 8 div ceiling cvi /pw exch def
  210.  
  211.     py1 8 py2
  212.     {
  213.         px1 exch moveto
  214.         pw { PatChar show } repeat
  215.     } for
  216.  
  217.     grestore
  218. } bind def
  219.  
  220. % ---------------------------------------------------------------------------
  221.  
  222.  
  223.  
  224. /xround
  225. {
  226.     dup round dup 0 eq
  227.     {
  228.         2 -1 roll 0 lt { -1 } { 1 } ifelse
  229.     }if
  230.     2 -1 roll pop
  231. } bind def
  232.  
  233. /roundup
  234. {
  235.     dup 0 lt {floor} {ceiling} ifelse
  236. } bind def
  237.  
  238. /N { newpath } bind def
  239. /M { moveto } bind def
  240. /L { lineto } bind def
  241. /C { closepath } bind def
  242.  
  243.  
  244. % ----------------------------------------------------------------------
  245. % x1 y1 x2 y2       REC    draw rectangle (x1,y1)-(x2,y2)
  246. % ----------------------------------------------------------------------
  247. /REC
  248. {
  249.     transform round exch round exch itransform 4 2 roll
  250.     transform round exch round exch itransform 4 2 roll
  251.     /y2 exch def  /x2 exch def  /y1 exch def  /x1 exch def
  252.     newpath
  253.     x1 y1 moveto
  254.     x2 y1 lineto
  255.     x2 y2 lineto
  256.     x1 y2 lineto
  257.     closepath
  258. } bind def
  259.  
  260. % ----------------------------------------------------------------------
  261. %                   SK     stroke the current path
  262. % ----------------------------------------------------------------------
  263. /SK
  264. {
  265.     gsave DrawColor CS stroke grestore newpath
  266. } bind def
  267.  
  268. % ----------------------------------------------------------------------
  269. %                   FILL   fill the current path
  270. % ----------------------------------------------------------------------
  271. /FILL
  272. {
  273.     gsave
  274.     FillStyle 0 eq { AuxColor CS } { FillColor CS } ifelse
  275.     FillStyle 1 le { eoclip fill } { patfill } ifelse
  276.     grestore
  277. } bind def
  278.  
  279. % ----------------------------------------------------------------------
  280. % x1 y1 x2 y2       VEC    draw line from (x1,y1) to (x2,y2)
  281. % ----------------------------------------------------------------------
  282. /VEC
  283. {
  284.     transform round exch round exch itransform 4 2 roll
  285.     transform round exch round exch itransform 4 2 roll
  286.     newpath moveto lineto SK
  287. } bind def
  288.  
  289. % ----------------------------------------------------------------------
  290. % x1 y1             VS     start path
  291. % ----------------------------------------------------------------------
  292. /VS
  293. {
  294.     transform round exch round exch itransform
  295.     newpath moveto
  296. } bind def
  297.  
  298. % ----------------------------------------------------------------------
  299. % x  y              VR     close/continue path
  300. % ----------------------------------------------------------------------
  301. /VR
  302. {
  303.     transform round exch round exch itransform
  304.     closepath moveto
  305. } bind def
  306.  
  307. % ----------------------------------------------------------------------
  308. % x  y              VC     continue path
  309. % ----------------------------------------------------------------------
  310. /VC
  311. {
  312.     transform round exch round exch itransform
  313.     lineto
  314. } bind def
  315.  
  316. % ----------------------------------------------------------------------
  317. % x  y  c           PX     simulated putpixel
  318. % ----------------------------------------------------------------------
  319. /PX
  320. {
  321.     gsave
  322.     newpath CS 2 setlinewidth [] 0 setdash
  323.     transform round exch round exch itransform moveto
  324.     -1 0 rmoveto 1 0 rlineto stroke
  325.     grestore
  326. } bind def
  327.  
  328. % ----------------------------------------------------------------------
  329. % x1 y1 x2 y2 d t   BAR    fill and outline rectangle (x1,y1)-(x2,y2)
  330. % ----------------------------------------------------------------------
  331. /BAR
  332. {
  333.     /top exch def /dep exch def
  334.     REC FILL
  335.     newpath
  336.     x2 y1 moveto
  337.     x1 y1 lineto
  338.     x1 y2 lineto
  339.     x2 y2 lineto
  340.     x2 y1 lineto
  341.     dep 0 ne { BARDEP } if
  342.     SK
  343. } bind def
  344.  
  345. /BARDEP
  346. {
  347.     dep .6 mul /ydep exch def
  348.     y2 y1 sub /h exch def
  349.     x2 x1 sub /w exch def
  350.     dep ydep rlineto
  351.     0 h rlineto
  352.     top 0 ne { BARTOP } if
  353. } bind def
  354.  
  355. /BARTOP
  356. {
  357.     w neg 0 rlineto
  358.     dep neg ydep neg rlineto
  359.     w 0 rlineto
  360.     dep ydep rlineto
  361.     0 h neg rlineto
  362.     closepath
  363. } bind def
  364.  
  365. % ----------------------------------------------------------------------
  366. % x1 y1 x2 y2       PBR    fill rectangle (x1,y1)-(x2,y2)
  367. % ----------------------------------------------------------------------
  368. /PBR
  369. {
  370.     REC FILL
  371. } bind def
  372.  
  373. % ----------------------------------------------------------------------
  374. % xc yc th1 th2 a b EPATH  elliptical path
  375. % ----------------------------------------------------------------------
  376. /EPATH
  377. {
  378.     /savematrix matrix currentmatrix def
  379.     6 -2 roll translate scale
  380.     0 0 1 5 -2 roll arc
  381.     savematrix setmatrix
  382. } bind def
  383.  
  384. % ----------------------------------------------------------------------
  385. % xc yc th1 th2 a b ARC    draw an elliptical arc
  386. % ----------------------------------------------------------------------
  387. /ARC
  388. {
  389.     gsave
  390.     newpath EPATH [] 0 setdash SK
  391.     grestore
  392. } bind def
  393.  
  394. % ----------------------------------------------------------------------
  395. % xc yc th1 th2 a b PIE    draw and fill an elliptical pieslice
  396. % ----------------------------------------------------------------------
  397. /PIE
  398. {
  399.     gsave
  400.     newpath
  401.     6 -2 roll 2 copy moveto 6 2 roll
  402.     EPATH closepath FILL SK
  403.     grestore
  404. } bind def
  405.  
  406. % ----------------------------------------------------------------------
  407. % xc yc a b         ELI    draw and fill an ellipse
  408. % ----------------------------------------------------------------------
  409. /ELI
  410. {
  411.     4 2 roll 0 360 6 -2 roll
  412.     gsave
  413.     newpath EPATH FILL SK
  414.     grestore
  415. } bind def
  416.  
  417. % ----------------------------------------------------------------------
  418. % x y dx dy (text)  TXT    draw text at x,y
  419. % ----------------------------------------------------------------------
  420. /TXT
  421. {
  422.     gsave
  423.     DrawColor CS
  424.     5 -2 roll translate TxtDir 0 ne { 90 rotate } if
  425.     3 1 roll MoveChar mul 2 div
  426.     exch 2 index stringwidth pop mul 2 div
  427.     exch moveto show
  428.     grestore
  429. } bind def
  430.  
  431. % ----------------------------------------------------------------------
  432. % size dir font   TXS     sets text size
  433. % ----------------------------------------------------------------------
  434. /TXS
  435. {
  436.     /CurFont exch def /TxtDir exch def  /TxtHt exch def
  437.     CurFont findfont TxtHt scalefont setfont
  438.     /MoveChar TxtHt def
  439. %   newpath 0 0 moveto
  440. %   (0|h) false charpath flattenpath pathbbox newpath
  441. %   /MoveChar exch def 3 { pop } repeat
  442. } bind def
  443.  
  444. % ----------------------------------------------------------------------
  445. % array             LD      defines line style
  446. % ----------------------------------------------------------------------
  447. /LD
  448. {
  449.     dup /LineStyle exch def 0 setdash
  450. } bind def
  451.  
  452.  
  453. % ----------------------------------------------------------------------
  454. % draw              DC      defines draw color
  455. % fill              FC      defines fill color
  456. % aux               AC      defines auxiliary color
  457. % ----------------------------------------------------------------------
  458. /DC { /DrawColor exch def } bind def
  459. /FC { /FillColor exch def } bind def
  460. /AC { /AuxColor  exch def } bind def
  461.  
  462. % ----------------------------------------------------------------------
  463. % pat#              FD      defines fill pattern
  464. % ----------------------------------------------------------------------
  465. /FD
  466. {
  467.     /FillStyle exch def
  468. } bind def
  469.  
  470. % ----------------------------------------------------------------------
  471. % patstr            FPD     defines user fill
  472. % ----------------------------------------------------------------------
  473. /FPD
  474. {
  475.     /UserPat exch def  /FillStyle 25 def
  476. } bind def
  477.  
  478. % ----------------------------------------------------------------------
  479. % color             CS      select  color
  480. % ----------------------------------------------------------------------
  481. /CS
  482. {
  483.     dup type /arraytype ne { setgray }{ {} forall setrgbcolor } ifelse
  484. } bind def
  485.  
  486. % ----------------------------------------------------------------------
  487. % x1 y1 x2 y2       CLIP   set clipping region
  488. % ----------------------------------------------------------------------
  489. /CLIP
  490. {
  491.     transform round exch round exch itransform 4 2 roll
  492.     transform round exch round exch itransform 4 2 roll
  493.     grestore gsave   % reset to INXX state
  494.     0 setlinewidth REC eoclip newpath
  495.     % restore current graphics state
  496.     TxtHt TxtDir CurFont TXS
  497.     LineWidth setlinewidth
  498.     LineStyle 0 setdash
  499. } bind def
  500.  
  501.  
  502. % ----------------------------------------------------------------------
  503. % no                LW      set line width
  504. % ----------------------------------------------------------------------
  505. /LW
  506. {
  507.     StdLine mul dup /LineWidth exch def setlinewidth
  508. } bind def
  509.  
  510. % ----------------------------------------------------------------------
  511. % Width Height Orient Left Top     INXX    Initialize Page
  512. % Orient: 0=portrait, 1=landscape
  513. % ----------------------------------------------------------------------
  514. /INXX
  515. {
  516.     /PGstate save def
  517.     /ptm
  518.     [
  519.         0.5 0.5 matrix defaultmatrix dtransform xround exch xround exch
  520.         0 exch 0 exch 0 0
  521.     ] def
  522.     2 index 0 ne   % if landscape
  523.     {
  524.         /ptm
  525.         [
  526.             ptm aload pop 6 2 roll 4 2 roll neg exch neg exch 6 -2 roll
  527.         ] def
  528.     }
  529.     if
  530.  
  531.     0.1 0.1 scale translate
  532.  
  533.     0 eq
  534.     { neg 0 exch translate pop }                % portrait
  535.     { 90 rotate neg exch neg exch translate }   % landscape
  536.     ifelse
  537.  
  538.     /StdLine
  539.     StdLine dup dtransform roundup exch roundup exch idtransform pop
  540.     def
  541.  
  542.     /Courier /CourierGD AF
  543.     120 0 /CourierGD TXS
  544.     0 FC 0 DC 1 AC 1 FD 1 LW [] LD 1.415 setmiterlimit
  545.     gsave
  546. } bind def
  547.  
  548. % ----------------------------------------------------------------------
  549. %                   TERM    Display Page
  550. % ----------------------------------------------------------------------
  551. /TERM
  552. {
  553.     showpage
  554.     PGstate restore
  555. } bind def
  556.  
  557.  
  558. % ----------------------------------------------------------------------
  559. % ulx uly width height imagecols imagerows CI  hexdata      ;Color Image
  560. % ----------------------------------------------------------------------
  561. /CI
  562. {
  563.     gsave
  564.     /rows exch def /cols exch def
  565.     4 2 roll translate scale
  566.     /picstr cols string def
  567.  
  568.     cols rows 8
  569.     [ cols 0 0 rows neg 0 0 ]
  570.     { currentfile picstr readhexstring pop }
  571.     false 3 colorimage
  572.     grestore
  573. } bind def
  574.  
  575.  
  576. % ----------------------------------------------------------------------
  577. % ulx uly width height imagecols imagerows bits GI  hexdata ;GrayScale Image
  578. % ----------------------------------------------------------------------
  579. /GI
  580. {
  581.     gsave
  582.     /bits exch def /rows exch def /cols exch def
  583.     4 2 roll translate scale
  584.     /picstr cols bits mul 7 add 8 idiv string def
  585.  
  586.     cols rows bits
  587.     [ cols 0 0 rows neg 0 0 ]
  588.     { currentfile picstr readhexstring pop }
  589.     image
  590.     grestore
  591. } bind def
  592.  
  593.  
  594. % ................ INSERT ANY USER PROCS HERE ........................
  595. %  Always use gsave/grestore around user proc code
  596.  
  597. % ----------------------------------------------------------------------
  598. % display text rotated to any angle.
  599. % ----------------------------------------------------------------------
  600. /ROT                      %    x y (text) angle ROT
  601. {
  602.     gsave
  603.     DrawColor CS          % select the drawing color
  604.     4 -2 roll translate   % move the origin to (x,y)
  605.     rotate                % rotate to angle
  606.                           % compute coords to center vertically
  607.     0 0 moveto (X) false charpath flattenpath pathbbox newpath
  608.     2 index add -2 div 0 exch moveto pop pop pop
  609.     show
  610.     grestore
  611. } bind def
  612.  
  613.  
  614. % ----------------------------------------------------------------------
  615. % x y dx dy (text)  TXT90    draw text at x,y rotated 90 degrees clockwise
  616. %   Note: we are setting PostScript rotation to 270 (counterclockwise) to
  617. %         get our internal 90 (clockwise)
  618. % ----------------------------------------------------------------------
  619. /TXT90
  620. {
  621.     gsave
  622.     DrawColor CS
  623.     5 -2 roll translate TxtDir 0 ne { 33 rotate } if
  624.     3 1 roll MoveChar mul 2 div
  625.     exch 2 index stringwidth pop mul 2 div
  626.     270 rotate
  627.     exch moveto show
  628.     grestore
  629. } bind def
  630.  
  631.  
  632. % ----------------------------------------------------------------------
  633. % x y dx dy (text)  TXT180    draw text at x,y rotated 180 degrees clockwise
  634. % ----------------------------------------------------------------------
  635. /TXT180
  636. {
  637.     gsave
  638.     DrawColor CS
  639.     5 -2 roll translate TxtDir 0 ne { 33 rotate } if
  640.     3 1 roll MoveChar mul 2 div
  641.     exch 2 index stringwidth pop mul 2 div
  642.     180 rotate
  643.     exch moveto show
  644.     grestore
  645. } bind def
  646.  
  647.  
  648. % ----------------------------------------------------------------------
  649. % x y dx dy (text)  TXT270    draw text at x,y rotated 270 degrees clockwise
  650. %   Note: we are setting PostScript rotation to 90 (counterclockwise) to
  651. %         get our internal 270 (clockwise)
  652. % ----------------------------------------------------------------------
  653. /TXT270
  654. {
  655.     gsave
  656.     DrawColor CS
  657.     5 -2 roll translate TxtDir 0 ne { 33 rotate } if
  658.     3 1 roll MoveChar mul 2 div
  659.     exch 2 index stringwidth pop mul 2 div
  660.     90 rotate
  661.     exch moveto show
  662.     grestore
  663. } bind def
  664.  
  665. % ....................................................................
  666.  
  667.  
  668.  
  669. %%EndProlog
  670.  
  671.