home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / postscri / 5537 < prev    next >
Encoding:
Internet Message Format  |  1992-11-15  |  4.2 KB

  1. Path: sparky!uunet!mcsun!uknet!mucs!lilleyc
  2. From: lilleyc@cs.man.ac.uk (Chris Lilley)
  3. Newsgroups: comp.lang.postscript
  4. Subject: Level 2 image operator - help needed
  5. Keywords: Level 2 CIELUV image colour color
  6. Message-ID: <6741@m1.cs.man.ac.uk>
  7. Date: 13 Nov 92 02:41:35 GMT
  8. References: <1dtq81INNjem@seven-up.East.Sun.COM>
  9. Sender: news@cs.man.ac.uk
  10. Organization: Dept Computer Science, University of Manchester, U.K.
  11. Lines: 121
  12.  
  13. Hi
  14.  
  15. I am having trouble understanding the Level 2 image operator - the one
  16. operand form that takes a dictionary.
  17.  
  18. I can use ABC colour spaces OK but when it comes to the image operator
  19. things go wrong. Here is a program that shows what I am doing. It is
  20. all pretty much by the (Big Red) book. What happens is that the 'RGB'
  21. text comes out in colour but the image comes out as a jet black
  22. square.
  23.  
  24. If anyone can tell me what I am doing wrong I would be grateful.
  25.  
  26. Chris
  27.  
  28. ======== snip snip ===============================================
  29.  
  30. %!PS-Adobe-3.0
  31. %    Test out CIE colour space image.
  32.  
  33. %    Uses CIELUV colour space, prints an image with black (000) at the
  34. %    bottom left, white (100) at top left and 9 intermediate steps of L*
  35.  
  36. %    U goes from 0 to 56 (out of a range of 127) in the hope of being
  37. %    mostly within the device gamut, in 9 steps.
  38. %    V is constant at 0. So this gives a vertical slice through LUV space
  39. %    from the achromatic axis out along the positive U axis (reds)
  40.  
  41. %    I should probably used a procedure as datasource but find&replace 
  42. %    was quicker ;-) 
  43.  
  44. %    Some colours will be out of gamut - the high chroma dark ones - so
  45. %    I wanted to see what happened. Clip to device gamut?
  46.  
  47. %    Chris Lilley 13 Nov 92 01:08 GMT    lilley@v5.cgu.mcc.ac.uk
  48.  
  49. %%Pages: 1
  50. %%BeginSetup
  51.  
  52. %    Set up CIELUV colour space
  53. %    straight from Big Red Book p191
  54.  
  55. [/CIEBasedABC <<
  56.   /RangeABC [0 100 -128 127 -128 127]
  57.   /DecodeABC [{16 add 116 div} bind {500 div} bind {200 div} bind]
  58.   /MatrixABC [1 1 1 1 0 0 0 0 -1]
  59.   /DecodeLMN
  60.     [{dup 6 29 div ge {dup dup mul mul} 
  61.          {4 29 div sub 108 841 div mul} ifelse 0.9505 mul} bind
  62.      {dup 6 29 div ge {dup dup mul mul} 
  63.          {4 29 div sub 108 841 div mul} ifelse} bind
  64.      {dup 6 29 div ge {dup dup mul mul}
  65.          {4 29 div sub 108 841 div mul} ifelse 1.0890 mul} bind]
  66.   /WhitePoint [0.9505 1 1.0890]    % D65 white point
  67. >>] setcolorspace
  68.  
  69. %%EndSetup
  70. %%Page: 1 1
  71.  
  72. /inch {72 mul} def
  73.  
  74. %    Do some general colour stuff first to test the LUV space works
  75.  
  76. 2 inch 8 inch moveto
  77. /Times-Bold findfont 96 scalefont setfont
  78. 50 80 0 setcolor    % a red
  79. (R) show
  80. 50 -40 69 setcolor    % a green
  81. (G) show
  82. 50 -40 -69 setcolor    % a blue
  83. (B) show
  84. /Times-Bold findfont 30 scalefont setfont
  85. 30 0 0 setcolor        % a grey
  86. ( - not!) show
  87.  
  88. %    Now to try the image - first size and place it
  89.  
  90. 2 inch 2 inch translate
  91. 4 inch 4 inch scale
  92.  
  93. %    1 operand image, from Big Red Book p226 but:
  94. %     less data, and bottom to top ordering
  95. <<
  96.   /ImageType 1
  97.   /Width 8 /Height 11
  98.   /BitsPerComponent 8
  99.   /Decode [0 1 0 1 0 1]
  100.   /ImageMatrix [ 8 0 0 11 0 0]    % left to right, bottom to top
  101.   /DataSource currentfile /ASCIIHexDecode filter
  102. >> image
  103.  
  104. 000000 000800 001000 001800 002000 002800 003000 003800
  105. 0A0000 0A0800 0A1000 0A1800 0A2000 0A2800 0A3000 0A3800
  106. 140000 140800 141000 141800 142000 142800 143000 143800
  107. 1E0000 1E0800 1E1000 1E1800 1E2000 1E2800 1E3000 1E3800
  108. 280000 280800 281000 281800 282000 282800 283000 283800
  109. 320000 320800 321000 321800 322000 322800 323000 323800
  110. 3C0000 3C0800 3C1000 3C1800 3C2000 3C2800 3C3000 3C3800
  111. 460000 460800 461000 461800 462000 462800 463000 463800
  112. 500000 500800 501000 501800 502000 502800 503000 503800
  113. 5A0000 5A0800 5A1000 5A1800 5A2000 5A2800 5A3000 5A3800
  114. 640000 640800 641000 641800 642000 642800 643000 643800
  115. >
  116.  
  117. %    The > is an EOD (end of data) marker (BRB p128) and white space is
  118. %    ignored supposedly
  119.  
  120. showpage    % Please?
  121. %%Trailer
  122. %%EOF
  123.  
  124. ================= code ends =====================
  125.  
  126. --
  127. Chris Lilley
  128. ---------------------------------------------------------------------------
  129. Technical Author, ITTI Computer Graphics and Visualisation Training Project
  130. Computer Graphics Unit, Manchester Computing Centre, Manchester, UK
  131. Internet:   lilley@cgu.mcc.ac.uk        Janet:   lilley@uk.ac.mcc.cgu
  132. Voice:      +44 (0)61 275 6095          Fax:     +44 (0)61 275 6040
  133. ---------------------------------------------------------------------------
  134.