home *** CD-ROM | disk | FTP | other *** search
/ jppd.dyndns.org / jppd.dyndns.org.tar / jppd.dyndns.org / QUERYPRO / Impressora_PDF / converter.exe / GPLGS / viewcmyk.ps < prev    next >
Text File  |  2002-06-03  |  2KB  |  64 lines

  1. %    Copyright (C) 1996, 1997, 1998 Aladdin Enterprises.  All rights reserved.
  2. % This software is provided AS-IS with no warranty, either express or
  3. % implied.
  4. % This software is distributed under license and may not be copied,
  5. % modified or distributed except as expressly authorized under the terms
  6. % of the license contained in the file LICENSE in this distribution.
  7. % For more information about licensing, please refer to
  8. % http://www.ghostscript.com/licensing/. For information on
  9. % commercial licensing, go to http://www.artifex.com/licensing/ or
  10. % contact Artifex Software, Inc., 101 Lucas Valley Road #110,
  11. % San Rafael, CA  94903, U.S.A., +1(415)492-9861.
  12.  
  13. % $Id: viewcmyk.ps,v 1.5 2002/06/02 12:03:28 mpsuzuki Exp $
  14. % viewcmyk.ps
  15. % Display a raw CMYK file.
  16. % Requires the colorimage operator.
  17. % If SCALE is defined, maps input pixels to output pixels with that scale;
  18. % if SCALE is undefined, scales the image to fit the page.
  19. % If BITS is defined, it is the number of bits per sample (1,2,4,8,12);
  20. % if BITS is undefined, its default value is 1.
  21.  
  22. /viewcmyk {            % <filename> <width> viewcmyk -
  23.   20 dict begin
  24.   /w exch def
  25.   /fname exch def
  26.   /bpc /BITS where { pop BITS } { 1 } ifelse def
  27.   /f fname (r) file def
  28.   mark fname status pop pop pop /flen exch def cleartomark
  29.   /h flen w bpc 4 mul mul 7 add 8 idiv idiv def
  30.   (Dimensions: ) print [w h] == flush
  31.         % Set up scaling.
  32.   /SCALE where {
  33.     pop
  34.     % Map pixels SCALE-for-1.  Assume orthogonal transformation.
  35.     SCALE 1 0 dtransform add abs div
  36.     SCALE 0 1 dtransform add abs div
  37.   } {
  38.     % Scale the image (uniformly) to fit the page.
  39.     clippath pathbbox pop pop translate
  40.     pathbbox 3 -1 roll sub h div
  41.     3 1 roll exch sub w div .min dup
  42.   } ifelse scale
  43.   w h bpc [1 0 0 -1 0 h] f false 4 colorimage
  44.   showpage
  45.   f closefile
  46.   end
  47. } bind def
  48.  
  49. % If the program was invoked from the command line, run it now.
  50. [ shellarguments {
  51.   counttomark 2 eq {
  52.     cvi viewcmyk
  53.   } {
  54.     cleartomark
  55.     (Usage: gs -- viewcmyk.ps filename.cmyk width\n) print
  56.     ( e.g.: gs -- viewcmyk.ps my.cmyk 2550\n) print flush
  57.   } ifelse
  58. } {
  59.   pop
  60. } ifelse
  61.