星火微课系统客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

colorseparationdict.inc 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. %%BeginResource: ProcSet sep_ops 1.03 0
  2. %%ProcSetTitle: (Separation Procs)
  3. %%ProcSetVersion: 1.03
  4. userdict /sep_ops 50 dict dup begin put
  5. /bdef {bind def} bind def
  6. /xdef {exch def} bdef
  7. /colorimagebuffer
  8. { 0 1 2 index length 1 sub
  9. { dup 2 index exch get 255 exch sub 2 index 3 1 roll put }for
  10. }bdef
  11. /addprocs
  12. { [ 3 1 roll /exec load
  13. dup 3 1 roll ] cvx
  14. } bdef
  15. /L1? {
  16. /languagelevel where {pop languagelevel 2 lt}{ true } ifelse
  17. } bdef
  18. /colorexists { % tests to see if printing on color device
  19. statusdict /processcolors known {
  20. statusdict /processcolors get exec
  21. }{ % processcolors not present
  22. /deviceinfo where { % check for dps environment
  23. pop deviceinfo /Colors known {
  24. deviceinfo /Colors get % get color value from DPS
  25. statusdict /processcolors {% add processcolors entry
  26. deviceinfo /Colors known {
  27. deviceinfo /Colors get
  28. }{
  29. 1
  30. } ifelse
  31. } put
  32. }{
  33. 1
  34. } ifelse
  35. }{ % not in dps environment, assume monochrome
  36. 1
  37. } ifelse
  38. } ifelse
  39. 1 gt % return true for color devices, false for B&W
  40. } bdef
  41. /MakeReadOnlyArray { % size => [array]
  42. /packedarray where {
  43. pop packedarray
  44. }{
  45. array astore readonly
  46. } ifelse
  47. } bdef
  48. /findcmykcustomcolor where {
  49. pop
  50. }{
  51. /findcmykcustomcolor {% c m y k name findcmykcustomcolor array
  52. 5 MakeReadOnlyArray
  53. } bdef
  54. } ifelse
  55. /setoverprint where {
  56. pop
  57. }{
  58. /setoverprint {% boolean setoverprint -
  59. pop
  60. } bdef
  61. } ifelse
  62. /setcustomcolor where {
  63. pop
  64. }{
  65. L1? {
  66. /setcustomcolor { % array tint setcustomcolor -
  67. exch
  68. aload pop pop
  69. 4 { 4 index mul 4 1 roll } repeat
  70. 5 -1 roll pop
  71. setcmykcolor
  72. } bdef
  73. }{
  74. /setcustomcolor { % customcolorarray tint
  75. exch
  76. [ exch /Separation exch dup 4 get exch /DeviceCMYK exch
  77. 0 4 getinterval
  78. [ exch /dup load exch cvx {mul exch dup}
  79. /forall load /pop load dup] cvx
  80. ] setcolorspace setcolor
  81. } bdef
  82. } ifelse
  83. } ifelse
  84. /ik 0 def /iy 0 def /im 0 def /ic 0 def
  85. /imagetint {% converts cmyk to grayscale equiv w/red book formula
  86. % called by setcmykcolor and customcolorimage procs.
  87. ic .3 mul
  88. im .59 mul
  89. iy .11 mul
  90. ik add add add dup
  91. 1 gt{pop 1}if
  92. } bdef
  93. /setcmykcolor where {
  94. pop
  95. }{
  96. % setcmykcolor not supported, call setgray instead
  97. /setcmykcolor { % c m y k setcmykcolor --
  98. /ik xdef /iy xdef /im xdef /ic xdef
  99. imagetint
  100. 1 exch sub setgray
  101. } bdef
  102. } ifelse
  103. /customcolorimage where {
  104. pop
  105. }{
  106. L1? {
  107. /customcolorimage{ % w h bps matrix proc array
  108. gsave
  109. colorexists {
  110. aload pop pop
  111. /ik xdef /iy xdef /im xdef /ic xdef
  112. currentcolortransfer
  113. {ik mul ik sub 1 add} addprocs
  114. 4 1 roll {iy mul iy sub 1 add} addprocs
  115. 4 1 roll{im mul im sub 1 add} addprocs
  116. 4 1 roll{ic mul ic sub 1 add} addprocs
  117. 4 1 roll setcolortransfer
  118. /magentabuf 0 string def
  119. /yellowbuf 0 string def
  120. /blackbuf 0 string def
  121. {
  122. colorimagebuffer dup length magentabuf length ne{
  123. dup length dup dup
  124. /magentabuf exch string def
  125. /yellowbuf exch string def
  126. /blackbuf exch string def
  127. }if
  128. dup magentabuf copy yellowbuf copy
  129. blackbuf copy pop
  130. } addprocs
  131. {magentabuf}{yellowbuf}{blackbuf} true 4 colorimage
  132. }{ % non-color device
  133. aload pop pop /ik xdef /iy xdef /im xdef /ic xdef
  134. /tint imagetint def
  135. currenttransfer
  136. {tint mul 1 tint sub add} addprocs settransfer image
  137. }ifelse
  138. grestore
  139. } bdef
  140. }{ % Level 2 environment
  141. /customcolorimage { % w h bps matrix proc array
  142. gsave
  143. [ exch /Separation exch dup 4 get exch /DeviceCMYK exch
  144. 0 4 getinterval
  145. [ exch /dup load exch cvx {mul exch dup}
  146. /forall load /pop load dup] cvx
  147. ] setcolorspace
  148. 10 dict begin
  149. /ImageType 1 def
  150. /DataSource exch def
  151. /ImageMatrix exch def
  152. /BitsPerComponent exch def
  153. /Height exch def
  154. /Width exch def
  155. /Decode [1 0] def
  156. currentdict end
  157. image
  158. grestore
  159. } bdef
  160. } ifelse
  161. } ifelse
  162. /setseparationgray where {
  163. pop
  164. }{
  165. L1? {
  166. /setseparationgray {
  167. 1 exch sub dup dup dup setcmykcolor
  168. } bdef
  169. }{
  170. /setseparationgray {
  171. [/Separation /All /DeviceCMYK
  172. {dup dup dup}] setcolorspace 1 exch sub setcolor
  173. } bdef
  174. } ifelse
  175. } ifelse
  176. /separationimage where {
  177. pop
  178. }{
  179. /separationimage {
  180. gsave
  181. 1 1 1 1 (All)
  182. findcmykcustomcolor customcolorimage
  183. grestore
  184. } bdef
  185. } ifelse
  186. currentdict readonly pop end
  187. %%EndResource
  188. %%BeginSetup
  189. sep_ops begin
  190. 50 dict begin % temp dict for variable definitions
  191. %%EndSetup