markpath.ps 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. % Copyright (C) 1993 Aladdin Enterprises. All rights reserved.
  2. %
  3. % This software is provided AS-IS with no warranty, either express or
  4. % implied.
  5. %
  6. % This software is distributed under license and may not be copied,
  7. % modified or distributed except as expressly authorized under the terms
  8. % of the license contained in the file LICENSE in this distribution.
  9. %
  10. % For more information about licensing, please refer to
  11. % http://www.ghostscript.com/licensing/. For information on
  12. % commercial licensing, go to http://www.artifex.com/licensing/ or
  13. % contact Artifex Software, Inc., 101 Lucas Valley Road #110,
  14. % San Rafael, CA 94903, U.S.A., +1(415)492-9861.
  15. % $Id: markpath.ps,v 1.4 2002/02/21 21:49:28 giles Exp $
  16. % markpath.ps
  17. % Mark the corners of a path, drawing it slowly if desired.
  18. /Delay where { pop } { /Delay 0 def } ifelse
  19. /setxy0
  20. { currentpoint /y0 exch def /x0 exch def
  21. } def
  22. /bip
  23. { epsx epsy idtransform /ey exch def /ex exch def
  24. currentpoint ex 2 div ey 2 div rlineto currentpoint 0 ey neg rlineto
  25. ex neg 0 rlineto 0 ey rlineto lineto lineto
  26. stroke
  27. } def
  28. /dally
  29. { Delay { } repeat
  30. Delay 0 ne { flushpage } if
  31. } def
  32. /movebip
  33. { /xs 2 index def /ys 1 index def
  34. gsave newpath mpmx transform moveto setxy0 bip grestore
  35. } def
  36. /linebip
  37. { gsave newpath x0 y0 moveto mpmx transform lineto setxy0 bip dally grestore
  38. } def
  39. /curvebip
  40. { gsave newpath x0 y0 moveto 5 index 5 index mpmx transform lineto bip
  41. 2 copy mpmx transform moveto 3 index 3 index mpmx transform lineto bip
  42. x0 y0 moveto
  43. 3 { mpmx transform 6 2 roll } repeat
  44. curveto setxy0 bip dally grestore
  45. } def
  46. /closebip
  47. { xs ys linebip
  48. } def
  49. /markpath % <matrix> markpath -
  50. { /mpmx exch def
  51. gsave initgraphics 9 dup dtransform grestore
  52. /epsy exch def /epsx exch def
  53. gsave 0 setlinewidth
  54. { movebip } { linebip } { curvebip } { closebip } pathforall
  55. grestore
  56. } def