ppath.ps 2.1 KB

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