home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 10 / AU_CD10.iso / Updates / GhostScript / !GhostScr / 6_01 / lib / ppath.ps < prev    next >
Text File  |  2000-03-09  |  2KB  |  57 lines

  1. %    Copyright (C) 1989, 1995, 1997 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of Aladdin Ghostscript.
  3. % Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  4. % or distributor accepts any responsibility for the consequences of using it,
  5. % or for whether it serves any particular purpose or works at all, unless he
  6. % or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  7. % License (the "License") for full details.
  8. % Every copy of Aladdin Ghostscript must include a copy of the License,
  9. % normally in a plain ASCII text file named PUBLIC.  The License grants you
  10. % the right to copy, modify and redistribute Aladdin Ghostscript, but only
  11. % under certain conditions described in the License.  Among other things, the
  12. % License requires that the copyright notice and this notice be preserved on
  13. % all copies.
  14.  
  15. % $Id: ppath.ps,v 1.1 2000/03/09 08:40:40 lpd Exp $
  16. % Redefine pathforall for tracing.
  17. % Can't be used recursively.
  18.  
  19. /# {( )print} def
  20.  
  21. /-mat matrix def
  22. /-imat matrix def
  23. /-smat { //-mat currentmatrix pop //-imat setmatrix } bind def
  24. /-rmat { //-mat setmatrix } bind def
  25. /-pathforall /pathforall load def
  26. /-p2 { ( ) print exch =only ( ) print =only } bind def
  27. /-dp2 { 2 copy -p2 2 { exch 4096 mul dup cvi dup ( ) print =only sub dup 0 eq { pop } { (+) print =only } ifelse } repeat } bind def
  28. /-tp2 { //-mat itransform -p2 } bind def
  29. /-dict 5 dict def
  30.  
  31. /pathforall
  32.  { -dict begin
  33.    /-close exch def  /-curve exch def  /-line exch def  /-move exch def
  34.    end -smat -mat ==only ( setmatrix) =
  35.    {2 copy -tp2 ( moveto\t%)print
  36.     2 copy -dp2 (\n)print
  37.     flush -dict /-move get -rmat exec -smat}
  38.    {2 copy -tp2 ( lineto\t%)print
  39.     2 copy -dp2 (\n)print
  40.     flush -dict /-line get -rmat exec -smat}
  41.    {5 index 5 index -tp2 3 index 3 index -tp2 2 copy -tp2 ( curveto\t%)print
  42.     5 index 5 index -dp2 3 index 3 index -dp2 2 copy -dp2 (\n)print
  43.     flush -dict /-curve get -rmat exec -smat}
  44.    {(closepath\n)print flush   -dict /-close get -rmat exec -smat}
  45.    -pathforall -rmat
  46.  }
  47. def
  48.  
  49. % Just print the current path
  50.  
  51. /printpath {
  52.   {pop pop} {pop pop} {pop pop pop pop pop pop} {} pathforall
  53. } def
  54.