1
0

traceimg.ps 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. % Copyright (C) 1994 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: traceimg.ps,v 1.2 2000/09/19 18:29:11 lpd Exp $
  18. % traceimg.ps
  19. % Trace the data supplied to the 'image' operator.
  20. % This code currently handles only the (Level 2) dictionary form of image,
  21. % with a single data source and 8-bit pixels.
  22. /traceimage % <dict> traceimage -
  23. { currentcolorspace == (setcolorspace\n) print
  24. (<<) print
  25. dup { (\t) print exch ==only ( ) print == } forall
  26. (>>\n) print flush
  27. begin /i_left Width Height mul store /i_dict currentdict store end
  28. { i_left 0 le { exit } if
  29. i_dict /DataSource get exec
  30. dup type /filetype eq
  31. { i_buf 0 i_left 32 min getinterval readstring pop
  32. } if
  33. dup (%stdout) (w) file exch writehexstring (\n) print flush
  34. i_left exch length sub /i_left exch def
  35. } loop
  36. } bind odef
  37. /image /traceimage load def
  38. /i_left 0 def
  39. /i_dict null def
  40. /i_buf 32 string def