home *** CD-ROM | disk | FTP | other *** search
- %======================================================================%
- % Professional Draw Color Seperation Prologue file: V3.0, Apr 22, 1995 %
- %======================================================================%
- %
- % 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.
-
- % "component" is a global variable = 0 which specifies the seperation we're
- % currently doing: = 0 for B&W black, 1 for black, 2 for y, 3 for m,
- % 4 for c, 5 for mechanical (custom) colors
- /component 0 def
- /subgray true def
- /fourcol false def % used to designate 3 or 4 colour sep.
- /setrgb /setrgbcolor load def
- /sethsb /sethsbcolor load def
- /_setgray /setgray load def
- /UCR_fctr 1.0 def
- /GCR_fctr 1.0 def
-
- %
- % setgray
- %
- /setgray { % g setgray
- subgray
- {
- component 0 eq component 1 eq or not
- { pop 1.0 }
- if
- }
- if
- _setgray
- } bdef
-
- %
- % Standard PostScript operators:
- %
-
- % translate rgb into cmyk with 100% UCR/GCR
- /setrgbcolor { % red grn blu setrgbcolor
- % call system setrgbcolor so that currentrgbcolr, currenthsbcolor
- % will still give correct results:
- 3 copy setrgb
-
- 5 dict begin
-
- 1 exch sub /ye exch def
- 1 exch sub /ma exch def
- 1 exch sub /cy exch def
- /blk 0 def
-
- fourcol { % do 100% UCR/GCR
- /min ye def
- ma min lt {/min ma def} if
- cy min lt {/min cy def} if
- min UCR_fctr mul /blk exch def
-
- ye blk sub /ye exch def
- ma blk sub /ma exch def
- cy blk sub /cy exch def
- min GCR_fctr mul /blk exch def
-
- } if
-
- % get the component that we want:
- component 0 eq {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 eq {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
-
- /currentcmykcolor {
- currentgray dup dup dup
- } bdef
-
- /setcolorscreen {
- component 0 eq {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 eq
- {12 {pop} repeat}
- {9 {pop} repeat setscreen}
- ifelse
- } bdef
-
- /currentcolorscreen {
- currentscreen 3 copy 3 copy 3 copy
- } bdef
-
- /setcolortransfer {
- component 0 eq {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 eq
- { 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 0 eq component 1 eq or
- {{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 {{1 exch sub} currenttransfer concatprocs settransfer} if
- component 0 eq component 1 eq or { % 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 eq { % 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
-
-
-
-