home *** CD-ROM | disk | FTP | other *** search
- /invalidcolortable? true def
- /level2 /languagelevel where {pop languagelevel 2 ge}{false} ifelse def
- /bd {bind def} bind def
- /ld {load def} bd
- /xd {exch def} bd
-
- %%BeginProcSet: myapp_basicimage 1.0 0
- /setup1asciiproc
- { [ currentfile mystring /readhexstring cvx /pop cvx ] cvx bind }bd
- /setup1binaryproc
- { [ currentfile mystring /readstring cvx /pop cvx ] cvx bind }bd
- level2 { save /dontloadlevel1 xd }if
- /iw 0 def
- /ih 0 def
- /im_save 0 def
- /setupimageproc 0 def
- /polarity 0 def
- /smoothflag 0 def
- /mystring 0 def
- /bpc 0 def
-
- %% level 1 version of procsets
- /beginimage
- {%def
- /im_save save def
- dup 0 eq
- { pop /setup1binaryproc
- }{ 1 eq
- { /setup1asciiproc
- }{
- (error, can't use level2 data acquisition procs for level1)print flush
- }ifelse
- }ifelse
- /setupimageproc exch ld
- /polarity xd
- /smoothflag xd
- translate
- scale
- /mystring exch string def
- /bpc xd
- /ih xd
- /iw xd
- }bd
- /endimage {im_save restore}bd
- /1bitbwcopyimage
- { 1 setgray
- 0 0 moveto 0 1 rlineto 1 0 rlineto 0 -1 rlineto closepath fill
- 0 setgray
- iw ih polarity [iw 0 0 ih 0 0] setupimageproc
- imagemask
- }bd
- /1bitcopyimage
- { setrgbcolor
- 0 0 moveto 0 1 rlineto 1 0 rlineto 0 -1 rlineto closepath fill
- setrgbcolor
- iw ih polarity [iw 0 0 ih 0 0] setupimageproc
- imagemask
- }bd
- /1bitmaskimage
- { setrgbcolor
- iw ih polarity [iw 0 0 ih 0 0] setupimageproc
- imagemask
- }bd
- level2 { dontloadlevel1 restore }if
- level2 not { save /dontloadlevel2 xd }if
- /setup2asciiproc
- { currentfile /ASCII85Decode filter /RunLengthDecode filter }bd
- /setup2binaryproc
- { currentfile /RunLengthDecode filter }bd
- /myimagedict 9 dict dup
- begin
- /ImageType 1 def
- /MultipleDataSource false def
- end
- def
-
- /im_save 0 def
- /setupimageproc 0 def
- /polarity 0 def
- /smoothflag 0 def
- /mystring 0 def
- /bpc 0 def
- /ih 0 def
- /iw 0 def
-
- /beginimage
- { /im_save save def
- dup 2 eq
- { pop /setup2binaryproc
- }{ dup 3 eq
- { pop /setup2asciiproc
- }{ 0 eq
- { /setup1binaryproc
- }{ /setup1asciiproc
- }ifelse
- }ifelse
- }ifelse
- /setupimageproc exch ld
- { [ 1 0 ]
- }{ [ 0 1 ]
- }ifelse
- /polarity xd
- /smoothflag xd
- translate
- scale
- /mystring exch string def
- /bpc xd
- /ih xd
- /iw xd
- }bd
- /endimage {im_save restore}bd
- /1bitbwcopyimage
- { 1 ssg
- 0 0 moveto 0 1 rlineto 1 0 rlineto 0 -1 rlineto closepath fill
- 0 ssg
- myimagedict dup begin
- /Width iw def
- /Height ih def
- /Decode polarity def
- /ImageMatrix [iw 0 0 ih 0 0] def
- /DataSource setupimageproc def
- /BitsPerComponent 1 def
- /Interpolate smoothflag def
- end
- imagemask
- }bd
- /1bitcopyimage
- { ssc
- 0 0 moveto 0 1 rlineto 1 0 rlineto 0 -1 rlineto closepath fill
- ssc
- myimagedict dup begin
- /Width iw def
- /Height ih def
- /Decode polarity def
- /ImageMatrix [iw 0 0 ih 0 0] def
- /DataSource setupimageproc def
- /BitsPerComponent 1 def
- /Interpolate smoothflag def
- end
- imagemask
- }bd
- /1bitmaskimage
- { ssc
- myimagedict dup begin
- /Width iw def
- /Height ih def
- /Decode polarity def
- /ImageMatrix [iw 0 0 ih 0 0] def
- /DataSource setupimageproc def
- /BitsPerComponent 1 def
- /Interpolate smoothflag def
- end
- imagemask
- }bd
- level2 not { dontloadlevel2 restore }if
- %%EndProcSet
-
- %%BeginProcSet: myapp_colorimage 1.0 0
- level2 { save /dontloadlevel1 xd }if
- /startnoload { {/noload save def} if }bd
- /endnoload { { noload restore } if }bd
- /testsystemdict
- {%def
- where
- { systemdict eq
- { true
- }{ false
- }ifelse
- }{ false
- }ifelse
- }bd
- /ncolors 1 def
- /colorimage where { pop true}{false} ifelse
- { /ncolors 0
- statusdict begin
- /processcolors where
- { pop % pop off dict
- pop % pop off 0
- processcolors
- }{
- /deviceinfo where
- { pop deviceinfo /Colors known
- { pop {deviceinfo /Colors get} } if
- }if
- }ifelse
- end %statusdict
- def
- ncolors 0 ne
- { /colorimage testsystemdict
- /setcolortransfer testsystemdict
- /currentcolortransfer testsystemdict
- /currentcmykcolor testsystemdict
- and and and not
- { /ncolors 0 def
- } if
- }if
- }if
- ncolors dup 1 ne exch dup 3 ne exch 4 ne and and {/ncolors 0 def}if
-
- ncolors 1 eq dup dup not startnoload
- {
- /expandbw
- { expandfactor mul round cvi bwclut exch get 255 div
- } bd
- /doclutimage
- {%stack:
- bwclut colorclut
- pop /bwclut xd
- bpc dup 8 eq
- { pop 255
- }{ 4 eq
- { 15
- }{ 3
- }ifelse
- }ifelse
- /expandfactor xd
- [ /expandbw load /exec load dup currenttransfer exch ] cvx bind
- settransfer
- iw ih bpc [iw 0 0 ih 0 0] setupimageproc
- image
- }bd
- }if
- not endnoload
-
- ncolors dup 3 eq exch 4 eq or
- dup dup not startnoload
- { /nullproc { {} }def
- /concatutil { /exec load 7 -1 roll /exec load }bd
- /defsubclut
- { 1 add getinterval def }bd
- /spconcattransfer
- { /Dclut exch def
- /Cclut exch def
- /Bclut exch def
- /Aclut exch def
- /ncompute exch ld
- currentcolortransfer
- [ { Aclut ncompute } concatutil ] cvx
- [ { Bclut ncompute } concatutil ] cvx
- [ { Cclut ncompute } concatutil ] cvx
- [ { Dclut ncompute } concatutil ] cvx
- setcolortransfer
- }bd
- /setuprgbcluts
- { /bit3x rgbclut length 3 sub def
- /bit1x bit3x 3 idiv def
- /rclut rgbclut def
- /gclut rclut 1 bit3x defsubclut
- /bclut rclut 2 bit3x defsubclut
- }bd
- }if
- not
- endnoload
-
- ncolors 3 eq
- dup dup not startnoload
- { /3compute
- { exch bit3x mul round cvi get 255 div } bd
- /doclutimage
- {%stack: bwclut colorclut
- /rgbclut xd
- pop
- setuprgbcluts
- /3compute rclut gclut bclut dup
- spconcattransfer
- iw ih bpc [iw 0 0 ih 0 0]
- [ setupimageproc /exec load /dup load dup ] cvx
- nullproc nullproc true 3 colorimage
- }bd
- }if
- not endnoload
-
- ncolors 4 eq
- dup dup not startnoload
- { /stuffclut
- { cmykindex 3 -1 roll put }bd
- /ftoint
- { 1 exch sub 255 mul round cvi }bd
- /4compute { exch bit4x mul round cvi get 255 div } bd
- /computecmykclut
- { setuprgbcluts
- /bit4x rgbclut length 3 idiv 4 mul 4 sub
- def
- /cmykclut bit4x 4 add string def
- /cclut cmykclut def
- /mclut cclut 1 bit4x defsubclut
- /yclut cclut 2 bit4x defsubclut
- /kclut cclut 3 bit4x defsubclut
- /cmykindex 0 def
- 0 1 bit1x
- { dup /cmykindex exch
- bit1x exch sub 4 mul def 3 mul dup
- rclut exch get 255 div exch dup
- gclut exch get 255 div exch
- bclut exch get 255 div
- setrgbcolor currentcmykcolor
- ftoint kclut stuffclut
- ftoint yclut stuffclut
- ftoint mclut stuffclut
- ftoint cclut stuffclut
- }for
- }bd
- /doclutimage
- {%stack: bwclut colorclut
- /rgbclut xd
- pop
- invalidcolortable?
- { computecmykclut }if
- /4compute cclut mclut yclut kclut spconcattransfer
- iw ih bpc [iw 0 0 ih 0 0]
- [ setupimageproc /exec load
- /dup load dup dup
- ] cvx
- nullproc nullproc nullproc
- true 4 colorimage
- }bd
- }if
- not endnoload
-
- ncolors 0 eq
- dup dup not startnoload
- { /lookupandstore
- { 3 mul 3 getinterval putinterval exch 3 add exch 3 copy }bd
- /8lookup /lookupandstore ld
- /4lookup
- { /byte 1 index def
- -4 bitshift lookupandstore
- byte 15 and lookupandstore
- }bd
- /2lookup
- { /byte 1 index def
- -6 bitshift
- lookupandstore byte -4 bitshift 3 and
- lookupandstore byte -2 bitshift 3 and
- lookupandstore byte 3 and
- lookupandstore
- }bd
- /colorexpand
- { mystringexp 0 rgbclut
- 3 copy 7 -1 roll
- /mylookup load forall
- pop pop pop pop pop
- }bd
- /createexpandstr
- { /mystringexp exch mystring length mul string def }bd
- /doclutimage
- { /rgbclut xd
- pop
- /mylookup
- bpc 8 eq
- { 3 createexpandstr
- /8lookup
- }{ bpc 4 eq
- { 6 createexpandstr
- /4lookup
- }{ 12 createexpandstr
- /2lookup
- }ifelse
- }ifelse % /mylookup procname
- ld
- iw ih bpc [iw 0 0 ih 0 0 ]
- [ setupimageproc /exec load /colorexpand load /exec load] cvx
- false 3 colorimage
- }bd
- }if
- not endnoload
-
- /colorimage where {pop true}{false}ifelse
- dup
- { /do24image
- { iw ih 8 [iw 0 0 ih 0 0]
- setupimageproc false 3
- colorimage
- }bd
- }if
- dup dup startnoload % if colorimage is known then skip this load
- not
- { /rgbtogray
- { /str xd
- /len str length def
- /smlen len 3 idiv def
- /rstr str def
- /gstr str 1 len 1 sub getinterval def
- /bstr str 2 len 2 sub getinterval def
- str dup % str str
- 0 1 smlen 1 sub
- { dup 3 mul
- rstr 1 index get .3 mul
- gstr 2 index get .59 mul add
- bstr 3 -1 roll get .11 mul add
- round cvi
- %dup 255 gt {pop 255}if
- put dup
- }for
- pop 0 smlen getinterval % graystr
- }bd
- /do24image
- { iw ih 8 [iw 0 0 ih 0 0]
- [ setupimageproc /exec load /rgbtogray load /exec load ] cvx bind
- image
- }bd
- }if % stack: /do24image proc
- endnoload
- /doimage
- { iw ih 8 [iw 0 0 ih 0 0] setupimageproc image }bd
- level2 { dontloadlevel1 restore }if
- level2 not{ save /dontloadlevel2 xd }if
- /myappcolorspace /DeviceRGB def
- /rgbclut 0 def
- /doclutimage
- { /rgbclut xd
- pop
- bpc dup 8 eq
- { pop 255
- }{ 4 eq
- { 15
- }{ 3
- }ifelse
- }ifelse
- /hival xd
- [/Indexed myappcolorspace hival rgbclut] setcolorspace % first set up the color space
- myimagedict dup begin
- /Width iw def
- /Height ih def
- /Decode [0 hival] def
- /ImageMatrix [iw 0 0 ih 0 0] def
- /DataSource setupimageproc def
- /BitsPerComponent bpc def
- /Interpolate smoothflag def
- end
- image
- }bd
- /do24image
- { myappcolorspace setcolorspace
- myimagedict dup begin
- /Width iw def
- /Height ih def
- /Decode [0 1 0 1 0 1] def
- /ImageMatrix [iw 0 0 ih 0 0] def
- /DataSource setupimageproc def
- /BitsPerComponent 8 def
- /Interpolate smoothflag def
- end
- image
- }bd
- level2 not{ dontloadlevel2 restore }if
- %%EndProcSet
- ■
-