星火微课系统客户端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

viewcmyk.ps 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. % Copyright (C) 1996, 1997, 1998 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: viewcmyk.ps 6300 2005-12-28 19:56:24Z giles $
  16. % viewcmyk.ps
  17. % Display a raw CMYK file.
  18. % Requires the colorimage operator.
  19. % If SCALE is defined, maps input pixels to output pixels with that scale;
  20. % if SCALE is undefined, scales the image to fit the page.
  21. % If BITS is defined, it is the number of bits per sample (1,2,4,8,12);
  22. % if BITS is undefined, its default value is 1.
  23. /viewcmyk { % <filename> <width> viewcmyk -
  24. 20 dict begin
  25. /w exch def
  26. /fname exch def
  27. /bpc /BITS where { pop BITS } { 1 } ifelse def
  28. /f fname (r) file def
  29. mark fname status pop pop pop /flen exch def cleartomark
  30. /h flen w bpc 4 mul mul 7 add 8 idiv idiv def
  31. (Dimensions: ) print [w h] == flush
  32. % Set up scaling.
  33. /SCALE where {
  34. pop
  35. % Map pixels SCALE-for-1. Assume orthogonal transformation.
  36. SCALE 1 0 dtransform add abs div
  37. SCALE 0 1 dtransform add abs div
  38. } {
  39. % Scale the image (uniformly) to fit the page.
  40. clippath pathbbox pop pop translate
  41. pathbbox 3 -1 roll sub h div
  42. 3 1 roll exch sub w div .min dup
  43. } ifelse scale
  44. w h bpc [1 0 0 -1 0 h] f false 4 colorimage
  45. showpage
  46. f closefile
  47. end
  48. } bind def
  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