home *** CD-ROM | disk | FTP | other *** search
/ OneVision 3.03 / OneVision3.03.iso / Apps / OneVision.app / TMSPrintingPackage.1Vsys / TMSLevel2Separation.ps < prev    next >
Encoding:
Text File  |  1996-11-12  |  8.8 KB  |  336 lines

  1. %!
  2. %%Title: (TMSLevel2Separation)
  3. %%Version: 1.0 
  4. %%Copyright: ((C) OneVision GmbH, Regensburg All Rights Reserved)
  5.  
  6. 100 dict begin
  7.  
  8. currentpacking true setpacking
  9.  
  10. %% there is a bug in the windowserver. It does not return the
  11. %% current pattern when the underlying colorspace is separation or indexed
  12. systemdict /nextimage known
  13. {    /_CurPatGstate 3 dict def
  14.     _CurPatGstate begin
  15.     /gsavelevel 0 def
  16.     /stack 10 array def
  17.     end
  18.     /currentcolor
  19.     {    currentcolor
  20.         currentcolorspace 0 get /Pattern eq
  21.         {    dup type /dicttype ne
  22.             {_CurPatGstate /stack get _CurPatGstate /gsavelevel get get}
  23.             if
  24.         } if
  25.     } hardbind def
  26.     /setcolor
  27.     {    currentcolorspace 0 get /Pattern eq
  28.         {dup _CurPatGstate /stack get _CurPatGstate /gsavelevel get 3 -1 roll put}
  29.         if
  30.         setcolor
  31.     } hardbind def
  32.     /setpattern
  33.     {    currentcolorspace 0 get /Pattern ne {[/Pattern currentcolorspace] setcolorspace} if
  34.         setcolor
  35.     } hardbind def
  36.     /gsave
  37.     {    gsave
  38.         _CurPatGstate /stack get _CurPatGstate /gsavelevel get get
  39.         _CurPatGstate /gsavelevel _CurPatGstate /gsavelevel get 1 add put
  40.         _CurPatGstate /stack get length _CurPatGstate /gsavelevel get le
  41.         {    _CurPatGstate /stack get dup length 10 add array
  42.             _CurPatGstate /stack 2 index put copy pop
  43.             _CurPatGstate /stack get dup length 10 sub
  44.             10 {2 copy null put 1 add} repeat pop pop
  45.         } if
  46.         _CurPatGstate /stack get _CurPatGstate /gsavelevel get 3 -1 roll put
  47.     } hardbind def
  48.     /grestore
  49.     {    _CurPatGstate /gsavelevel _CurPatGstate /gsavelevel get 1 sub put
  50.         grestore
  51.     } hardbind def
  52.     /nulldevice
  53.     {    0 0 0 0 Nonretained window dup windowdeviceround termwindow
  54.     } hardbind def
  55. } if
  56.  
  57. /_ProcessColorNames 4 dict def
  58. _ProcessColorNames begin
  59. /Cyan 0 def
  60. /Magenta 1 def
  61. /Yellow 2 def
  62. /Black 3 def
  63. end
  64.  
  65. /CurrentSeparation /None def
  66. /currentseparation {CurrentSeparation} def
  67. /setseparation
  68. {    dup type /nametype ne {cvn} if
  69.     TMSLevel2Separation /CurrentSeparation 3 -1 roll put
  70. } bind def
  71. /isprocessseparation
  72. {    _ProcessColorNames currentseparation known
  73.     currentseparation /_CMY eq or
  74. } bind def
  75. /isprocessblack {currentseparation /Black eq} bind def
  76.  
  77. /currentcolorspaceNoPattern
  78. {    currentcolorspace dup 0 get /Pattern eq {1 get} if
  79. } hardbind def
  80. /_MayPaint
  81. {    currentcolorspaceNoPattern dup type /arraytype eq {0 get} if /Separation eq
  82.     currentoverprint
  83.     {    {currentcolorspaceNoPattern 1 get dup /All eq {pop true} {currentseparation eq} ifelse}
  84.         {isprocessseparation}
  85.         ifelse
  86.     }
  87.     {{currentcolorspaceNoPattern 1 get /None ne} {true} ifelse}
  88.     ifelse
  89. } hardbind def
  90. /_sepdict 8 dict def
  91. _sepdict begin
  92. /DeviceGray
  93. {    isprocessblack not {{pop 1} settransfer} if
  94. } bind def
  95. /DeviceRGB
  96. {    isprocessseparation
  97.     {currentcolor NXCalibratedRGBColorSpace setcolorspace setcolor}
  98.     {{pop 1} settransfer} ifelse
  99. } bind def
  100. /DeviceCMYK
  101. {    isprocessseparation
  102.     {    currentcolor
  103.         currentseparation /_CMY eq
  104.         {pop 0}
  105.         {    4 _ProcessColorNames currentseparation get neg roll
  106.             3 {pop} repeat 3 {0} repeat
  107.             4 _ProcessColorNames currentseparation get roll
  108.         }
  109.         ifelse
  110.         setcolor
  111.     }
  112.     {{pop 1} settransfer} ifelse
  113. } bind def
  114. /CIEBasedABC
  115. {    isprocessseparation not
  116.     {{pop 1} settransfer} if
  117. } bind def
  118. /CIEBasedA
  119. {    isprocessseparation not
  120.     {{pop 1} settransfer} if
  121. } bind def
  122. /Pattern
  123. {    mark currentcolor
  124.     dup /PaintType get 2 eq
  125.     {    count 1 roll
  126.         currentcolorspace 1 get setcolorspace setcolor separate
  127.         currentcolor count -1 roll setpattern
  128.     }
  129.     {pop}
  130.     ifelse
  131.     cleartomark
  132. } hardbind def
  133. /_indexedActionDict 5 dict def
  134. _indexedActionDict begin
  135. /DeviceGray
  136. {    isprocessblack not {{pop 1} settransfer} if
  137. } bind def
  138. /DeviceRGB
  139. {    isprocessseparation
  140.     {    currentcolor
  141.         [currentcolorspace aload pop 3 -1 roll pop NXCalibratedRGBColorSpace 3 1 roll]
  142.         setcolorspace setcolor
  143.     }
  144.     {{pop 1} settransfer} ifelse
  145. } bind def
  146. /DeviceCMYK
  147. {    isprocessseparation
  148.     {    currentcolor
  149.         [currentcolorspace aload pop
  150.          [exch dup xcheck
  151.           {/exec cvx} {{exch 4 mul 4 getinterval {255 div} forall} /exec cvx} ifelse
  152.           currentseparation /_CMY eq
  153.           {/pop cvx 0}
  154.           {4 _ProcessColorNames currentseparation get neg /roll cvx
  155.            3 {pop} /repeat cvx 3 {0} /repeat cvx
  156.            4 _ProcessColorNames currentseparation get /roll cvx
  157.           }
  158.           ifelse
  159.          ] cvx bind
  160.         ]
  161.         setcolorspace setcolor
  162.     }
  163.     {{pop 1} settransfer} ifelse
  164. } bind def
  165. /CIEBasedABC
  166. {    isprocessseparation not
  167.     {{pop 1} settransfer} if
  168. } bind def
  169. /CIEBasedA
  170. {    isprocessseparation not
  171.     {{pop 1} settransfer} if
  172. } bind def
  173. end
  174. /Indexed
  175. {    _indexedActionDict currentcolorspace 1 get dup type /arraytype eq {0 get} if get exec
  176. } hardbind def
  177. /_separationProcDict 1 dict def
  178. _separationProcDict begin
  179. /Cyan {{0 0 0}} bind def
  180. /Magenta {{0 0 0 4 1 roll}} bind def
  181. /Yellow {{0 0 0 4 2 roll}} bind def
  182. /Black {{0 0 0 4 3 roll}} bind def
  183. /All {currentseparation /_CMY eq {{dup dup 0}} {{0 0 0 4 3 roll}} ifelse} bind def
  184. end
  185. /Separation
  186. {    currentcolorspace 1 get /All ne
  187.     {    currentseparation /_CMY eq
  188.         {_ProcessColorNames currentcolorspace 1 get known currentcolorspace 1 get /Black ne and not}
  189.         {currentseparation currentcolorspace 1 get ne}
  190.         ifelse
  191.         {{pop 1} settransfer} if
  192.     } if
  193.     currentcolor
  194.     [    currentcolorspace aload pop pop pop
  195.         /DeviceCMYK _separationProcDict 2 index known
  196.         {_separationProcDict 2 index get exec}
  197.         {{0 0 0 4 3 roll}}
  198.         ifelse
  199.     ]
  200.     setcolorspace setcolor
  201. } hardbind def
  202. end
  203. /separate {_sepdict currentcolorspace 0 get get exec} hardbind def
  204. /PaintExecute
  205. {    gsave mark {{} settransfer} stopped
  206.     {cleartomark true} {cleartomark false} ifelse grestore
  207.     {exec}
  208.     {    gsave
  209.         _MayPaint not {nulldevice} if separate exec
  210.         {currentpoint} stopped
  211.         grestore {newpath} {moveto} ifelse
  212.     }
  213.     ifelse
  214. } hardbind def
  215.  
  216. /defIfKnown {1 index where {pop hardbind def} {pop pop} ifelse} hardbind def
  217.  
  218. /fill {{fill} PaintExecute} hardbind def
  219. /eofill {{eofill} PaintExecute} hardbind def
  220. /stroke {{stroke} PaintExecute} hardbind def
  221. /ufill {{ufill} PaintExecute} defIfKnown
  222. /ueofill {{ueofill} PaintExecute} defIfKnown
  223. /ustroke {{ustroke} PaintExecute} defIfKnown
  224. /rectfill {{rectfill} PaintExecute} defIfKnown
  225. /rectstroke {{rectstroke} PaintExecute} defIfKnown
  226.  
  227. /show {{show} PaintExecute} hardbind def
  228. /ashow {{ashow} PaintExecute} hardbind def
  229. /widthshow {{widthshow} PaintExecute} hardbind def
  230. /awidthshow {{awidthshow} PaintExecute} hardbind def
  231. /kshow {{kshow} PaintExecute} hardbind def
  232. /glyphshow {{glyphshow} PaintExecute} defIfKnown
  233. /xshow {{xshow} PaintExecute} defIfKnown
  234. /yshow {{yshow} PaintExecute} defIfKnown
  235. /xyshow {{xyshow} PaintExecute} defIfKnown
  236.  
  237. /colorimageDict 8 dict def
  238. colorimageDict begin
  239. /DeviceGray /image load def
  240. /DeviceRGB /image load def
  241. /DeviceCMYK
  242. {    isprocessseparation
  243.     {    1 dict copy begin
  244.         [    /Decode load aload pop
  245.             currentseparation /_CMY eq
  246.             {pop pop 0 0}
  247.             {    8 _ProcessColorNames currentseparation get 2 mul neg roll
  248.                 6 {pop} repeat 6 {0} repeat
  249.                 8 _ProcessColorNames currentseparation get 2 mul roll
  250.             }
  251.             ifelse
  252.         ] /Decode exch def
  253.         currentdict end
  254.     } if
  255.     image
  256. } hardbind def
  257. /CIEBasedABC /image load def
  258. /CIEBasedA /image load def
  259. /Pattern /image load def
  260. /Indexed /image load def
  261. /Separation /image load def
  262. end
  263. /image
  264. {    gsave
  265.     dup type /dicttype ne {/DeviceGray setcolorspace} if
  266.     colorimageDict currentcolorspace 0 get get PaintExecute
  267.     grestore
  268. } hardbind def
  269. /colorimage
  270. {    gsave {/DeviceGray null /DeviceRGB /DeviceCMYK} 1 index 1 sub get setcolorspace
  271.     exch {array astore dup length true} {false} ifelse exch [exch {0 1} repeat]
  272.     8 dict begin 1
  273.     {/ImageType /Decode /MultipleDataSources /DataSource /ImageMatrix /BitsPerComponent
  274.      /Height /Width} {exch def} forall
  275.     currentdict end image
  276.     grestore
  277. } hardbind def
  278. /imagemask {{imagemask} PaintExecute} hardbind def
  279. /nextimage {{nextimage} PaintExecute} hardbind def
  280.  
  281.  
  282. /nxsetgray {setgray} def
  283. /_NXSetCMYKOrRGB {pop pop pop setcmykcolor} hardbind def
  284. /_NXCalibratedImageDict 8 dict def
  285. /_NXCalibratedImage
  286. {    exch {array astore dup length true} {false} ifelse
  287.     8 -1 roll {NXCalibratedRGBColorSpace setcolorspace} if
  288.     exch currentcolorspace 0 get /Indexed eq
  289.     {pop [0 currentcolorspace 2 get]} {[exch {0 1} repeat]} ifelse
  290.     _NXCalibratedImageDict begin 1
  291.     {/ImageType /Decode /MultipleDataSources /DataSource /ImageMatrix /BitsPerComponent
  292.      /Height /Width} {exch def} forall
  293.     currentdict end image
  294. } hardbind def
  295.  
  296. /setcolorrendering
  297. {    dup /RenderTable known
  298.     {    dup /RenderTable get 4 get 4 eq
  299.         {    isprocessseparation
  300.             {    1 dict copy begin
  301.                 [    /RenderTable load aload pop
  302.                     currentseparation /_CMY eq
  303.                     {pop {pop 0}}
  304.                     {    4 _ProcessColorNames currentseparation get neg roll
  305.                         3 {pop} repeat {pop 0} dup dup
  306.                         4 _ProcessColorNames currentseparation get roll
  307.                     }
  308.                     ifelse
  309.                 ] /RenderTable exch def
  310.                 currentdict end
  311.             } if
  312.             setcolorrendering
  313.         }
  314.         {pop} ifelse
  315.     }
  316.     {pop} ifelse
  317. } hardbind def
  318.  
  319. /windowdeviceround
  320. {    windowdeviceround
  321.     false setcmykadjust
  322.     {} dup dup dup setcolortransfer
  323.     /OVDefaultRendering load setcolorrendering
  324. } hardbind def
  325.  
  326. /setgstate
  327. {    setgstate
  328.     false setcmykadjust
  329.     {} dup dup dup setcolortransfer
  330.     /OVDefaultRendering load setcolorrendering
  331. } hardbind def
  332.  
  333. setpacking
  334.  
  335. currentdict end /TMSLevel2Separation exch def
  336.