home *** CD-ROM | disk | FTP | other *** search
- %=====================================================================%
- % Professional Page Color Seperation Prologue file: V3.0, Mar 6, 1992 %
- %=====================================================================%
- %
- % Handles function re-mapping for Color seperation of documents with EPSF files
- % with PostScript color commands: 'setrgbcolor, sethsbcolor' as well as
- % ColorPostScript commands: `setcmykcolor, currentcmykcolor, colorimage,
- % setcolorscreen, currentcolorscreen' + transfer and UCR/GCR commands.
-
- /subgray true def
- /setrgb /setrgbcolor load def
- /sethsb /sethsbcolor load def
- /_setgray /setgray load def
- /UCR_fctr 0.75 def
- /GCR_fctr 1.0 def
-
- %
- % setgray
- %
- /setgray { % g setgray
- subgray
- {
- component 1 gt
- { pop 1.0 }
- if
- }
- if
- _setgray
- } bdef
-
- %
- % Standard PostScript operators:
- %
-
- % translate rgb into cmyk with UCR/GCR
- /setrgbcolor { % red grn blu setrgbcolor
- % call system setrgbcolor so that currentrgbcolr, currenthsbcolor
- % will still give correct results:
- 3 copy setrgb
-
- 6 dict begin
-
- 1 exch sub /ye exch def
- 1 exch sub /ma exch def
- 1 exch sub /cy exch def
- ye ma cy add add 3 div /grey exch def
- /blk 0 def
-
- fourcol { % do UCR/GCR
- /min ye def
- ma min lt {/min ma def} if
- cy min lt {/min cy def} if
- min UCR_fctr sub /blk exch def
- blk 0 lt {/blk 0 def} if
-
- ye blk sub /ye exch def
- ma blk sub /ma exch def
- cy blk sub /cy exch def
- blk GCR_fctr mul 1.25 mul /blk exch def
- blk 1 gt {/blk 1 def} if
- } if
-
- % get the component that we want:
- component 0 le {grey} if
- component 1 eq {blk} if
- component 2 eq {ye} if
- component 3 eq {ma} if
- component 4 eq {cy} if
- component 5 ge {0} if
- 1 exch sub _setgray
-
- end
- } bdef
-
- /sethsbcolor {
- sethsb currentrgbcolor setrgbcolor
- } bdef
-
- %
- % Color PostScript operators:
- %
-
- %/setcmykcolor { % cy ma ye blk setcmykcolor
- % 1 sub 4 1 roll
- % 3 { 3 index add neg dup 0 lt { pop 0 } if 3 1 roll } repeat
- % setrgbcolor pop
- %} bdef
-
- /setcmykcolor { % cy ma ye blk setcmykcolor
- 5 dict begin
-
- /blk exch def
- /ye exch def
- /ma exch def
- /cy exch def
-
- fourcol
- { }
- {
- ye blk add dup 1 gt { pop 1 } if /ye exch def
- ma blk add dup 1 gt { pop 1 } if /ma exch def
- cy blk add dup 1 gt { pop 1 } if /cy exch def
- /blk 0 def
- }
- ifelse
-
- % get the component that we want:
- component 0 le {blk 3 mul ma add ye add cy add 3 div} if
- component 1 eq {blk} if
- component 2 eq {ye} if
- component 3 eq {ma} if
- component 4 eq {cy} if
- component 5 ge {0} if
- 1 exch sub _setgray
-
-
- end
- } bdef
-
- /currentcmykcolor {
- currentgray dup dup dup
- } bdef
-
- /setcolorscreen {
- component 0 le {12 3 roll} if
- component 1 eq {12 3 roll} if
- component 2 eq {12 -6 roll} if
- component 3 eq {12 -3 roll} if
- % component 4 eq {} if
- component 5 ge
- {12 {pop} repeat}
- {9 {pop} repeat setscreen}
- ifelse
- } bdef
-
- /currentcolorscreen {
- currentscreen 3 copy 3 copy 3 copy
- } bdef
-
- /setcolortransfer {
- component 0 le {4 1 roll} if
- component 1 eq {4 1 roll} if
- component 2 eq {4 -2 roll} if
- component 3 eq {4 -1 roll} if
- % component 4 eq {} if
- component 5 ge
- { pop pop pop pop}
- {pop pop pop settransfer}
- ifelse
- } bdef
-
- /currentcolortransfer {
- currenttransfer dup dup dup
- } bdef
-
- /setblackgeneration {
- pop
- } bdef
- /currentblackgeneration {
- {}
- } bdef
-
- /setundercolorremoval {
- pop
- } bdef
-
- /currentundercolorremoval {
- {}
- } bdef
-
- /colorimage { % width height bps matrix proc0 [...procn-1] multi ncol colorimage
- 10 dict begin
- /ncol exch def
- /multi exch def
- ncol 4 eq multi and {
- /proc3 exch def
- } if
- ncol 3 ge multi and {
- /proc2 exch def
- /proc1 exch def
- } if
- /proc0 exch def
- /mat exch def
- /bps exch def
- /height exch def
-
- height bps mat
-
- ncol 1 eq
- { % just B&W data
- component 1 le
- {{proc0} image}
- {height {proc0 pop} repeat 4 {pop} repeat}
- ifelse
- }
- {
- multi
- {
- /trsave currenttransfer def
- % CMYK (4 color) is dark-high, `image' wants light-high
- % so invert image:
- ncol 4 eq {{.999 exch sub trsave} bind settransfer} if
- component 1 le { % B&W or Black component
- ncol 3 eq
- {height {proc0 pop proc1 pop proc2 pop} repeat 4 {pop} repeat}
- {{proc0 pop proc1 pop proc2 pop proc3} image}
- ifelse
- } if
- component 2 eq { % Yellow component
- ncol 3 eq
- {{proc0 pop proc1 pop proc2} image}
- {{proc0 pop proc1 pop proc2 proc3 pop} image}
- ifelse
- } if
- component 3 eq { % Magenta component
- ncol 3 eq
- {{proc0 pop proc1 proc2 pop} image}
- {{proc0 pop proc1 proc2 pop proc3 pop} image}
- ifelse
- } if
- component 4 eq { % Cyan component
- ncol 3 eq
- {{proc0 proc1 pop proc2 pop} image}
- {{proc0 proc1 pop proc2 pop proc3 pop} image}
- ifelse
- } if
- component 5 ge { % Mechanical color
- ncol 3 eq
- {height {proc0 pop proc1 pop proc2 pop} repeat 4 {pop} repeat}
- {height {proc0 pop proc1 pop proc2 pop proc3 pop} repeat 4 {pop} repeat }
- ifelse
- } if
- /trsave load settransfer
- }
- { % not multiproc - can't do anything
- height {proc0 pop} repeat 4 {pop} repeat
- }
- ifelse
- }
- ifelse
- end
- } bdef
-
-
-
-