markpath.ps 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. % Copyright (C) 1993 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: markpath.ps,v 1.2 2000/09/19 18:29:11 lpd Exp $
  18. % markpath.ps
  19. % Mark the corners of a path, drawing it slowly if desired.
  20. /Delay where { pop } { /Delay 0 def } ifelse
  21. /setxy0
  22. { currentpoint /y0 exch def /x0 exch def
  23. } def
  24. /bip
  25. { epsx epsy idtransform /ey exch def /ex exch def
  26. currentpoint ex 2 div ey 2 div rlineto currentpoint 0 ey neg rlineto
  27. ex neg 0 rlineto 0 ey rlineto lineto lineto
  28. stroke
  29. } def
  30. /dally
  31. { Delay { } repeat
  32. Delay 0 ne { flushpage } if
  33. } def
  34. /movebip
  35. { /xs 2 index def /ys 1 index def
  36. gsave newpath mpmx transform moveto setxy0 bip grestore
  37. } def
  38. /linebip
  39. { gsave newpath x0 y0 moveto mpmx transform lineto setxy0 bip dally grestore
  40. } def
  41. /curvebip
  42. { gsave newpath x0 y0 moveto 5 index 5 index mpmx transform lineto bip
  43. 2 copy mpmx transform moveto 3 index 3 index mpmx transform lineto bip
  44. x0 y0 moveto
  45. 3 { mpmx transform 6 2 roll } repeat
  46. curveto setxy0 bip dally grestore
  47. } def
  48. /closebip
  49. { xs ys linebip
  50. } def
  51. /markpath % <matrix> markpath -
  52. { /mpmx exch def
  53. gsave initgraphics 9 dup dtransform grestore
  54. /epsy exch def /epsx exch def
  55. gsave 0 setlinewidth
  56. { movebip } { linebip } { curvebip } { closebip } pathforall
  57. grestore
  58. } def