[gs-cvs] rev 7647 - trunk/gs/lib
alexcher at ghostscript.com
alexcher at ghostscript.com
Fri Jan 26 08:49:01 PST 2007
Author: alexcher
Date: 2007-01-26 08:49:00 -0800 (Fri, 26 Jan 2007)
New Revision: 7647
Modified:
trunk/gs/lib/gs_img.ps
trunk/gs/lib/gs_init.ps
trunk/gs/lib/pdf_draw.ps
Log:
Move image interpolation tweaks from gs_init.ps which runs after pdf_draw.ps
to gs_img.ps which runs before pdf_draw.ps. This way, image operator can be bound
in pdf_draw.ps subject to NOBIND/DELAYBIND flages. Bug 688890, customer 1110.
DIFFERENCES:
None
Modified: trunk/gs/lib/gs_img.ps
===================================================================
--- trunk/gs/lib/gs_img.ps 2007-01-26 16:33:54 UTC (rev 7646)
+++ trunk/gs/lib/gs_img.ps 2007-01-26 16:49:00 UTC (rev 7647)
@@ -723,4 +723,120 @@
.bind systemdict begin odef end
end % img_utils_dict
+
+% Conditionally turn image interpolation on or off.
+% INTERPOLATE is not yet set, handle all cases
+currentdict /INTERPOLATE known
+currentdict /DOTERPOLATE known or
+currentdict /NOTERPOLATE known or not {
+ currentfile 1 (%END INTERPOLATE) .subfiledecode flushfile
+} if
+
+/.interpolate {
+ dup /Interpolate .knownget not { //false } if
+ /INTERPOLATE .systemvar ne {
+ dup gcheck .currentglobal exch .setglobal
+ exch dup length dict copy
+ dup /Interpolate /INTERPOLATE .systemvar put
+ exch .setglobal
+ } if
+} .bind odef
+
+/colorimage
+ { /INTERPOLATE .systemvar
+ { .currentglobal % w h bit [] {}...{} multi ncomp glob
+ //false .setglobal
+ 9 dict begin % w h bit [] {}...{} multi ncomp glob
+ 2 .argindex { 1 index 7 add } { 8 } ifelse
+ dup .argindex pop % check # of arguments
+ copy gsave pop % preserve the arguments
+ { 0 /DeviceGray 0 /DeviceRGB /DeviceCMYK }
+ 1 index get setcolorspace % ... glob w h bit [] {}...{} multi ncomp
+ {0 1 0 1 0 1 0 1}
+ 1 index 2 mul 0 exch % ... glob w h bit [] {}...{} multi ncomp {0 1 ...} 0 2*ncomp
+ getinterval /Decode exch def % ... glob w h bit [] {}...{} multi ncomp
+ exch dup % ... glob w h bit [] {}...{} ncomp multi multi
+ /MultipleDataSources exch def % ... glob w h bit [] {}...{} ncomp multi
+ { array astore} { pop } ifelse % ... glob w h bit [] [{}...{}]
+ /DataSource exch def % ... glob w h bit []
+ /ImageMatrix exch def % ... glob w h bit
+ /BitsPerComponent exch def % ... glob w h
+ /Height exch def % ... glob w
+ /Width exch def % ... glob
+ /ImageType 1 def
+ /Interpolate //true def
+ .setglobal currentdict end % ... <<>>
+ image grestore
+ exch { 4 add } { 6 } ifelse
+ { pop } repeat % -
+ }
+ { colorimage
+ }
+ ifelse
+ } .bind odef
+
+/image
+ { dup type /dicttype eq
+ { dup /ImageType get 3 eq
+ { .currentglobal //false .setglobal exch
+ dup length dict copy begin .setglobal
+ /DataDict DataDict .interpolate def
+ /MaskDict MaskDict .interpolate def
+ currentdict end
+ }
+ { .interpolate
+ }
+ ifelse
+ image
+ }
+ { /INTERPOLATE .systemvar
+ { 4 .argindex pop % check # of args
+ .currentglobal //false .setglobal
+ 8 dict begin .setglobal
+ /ImageType 1 def
+ /DataSource 1 index def
+ /ImageMatrix 2 index def
+ /BitsPerComponent 3 index def
+ /Decode {0 1} def
+ /Height 4 index def
+ /Width 5 index def
+ /Interpolate //true def
+ currentdict end
+ gsave /DeviceGray setcolorspace image grestore
+ 5 { pop } repeat
+ }
+ { image
+ }
+ ifelse
+ }
+ ifelse
+ } .bind odef
+
+/imagemask {
+ dup type /dicttype eq {
+ .interpolate imagemask
+ } {
+ /INTERPOLATE .systemvar {
+ 4 .argindex pop % check # of args
+ .currentglobal //false .setglobal
+ 8 dict begin .setglobal
+ /ImageType 1 def
+ /DataSource 1 index def
+ /ImageMatrix 2 index def
+ /BitsPerComponent 1 def
+ 2 index { {1 0} } { {0 1} } ifelse /Decode exch def
+ /Height 4 index def
+ /Width 5 index def
+ /Interpolate //true def
+ currentdict end imagemask 5 { pop } repeat
+ } {
+ imagemask
+ } ifelse
+ } ifelse
+} .bind odef
+
+currentdict /.interpolate .undef
+
+%END INTERPOLATE
+
.setglobal % restore VM mode
Modified: trunk/gs/lib/gs_init.ps
===================================================================
--- trunk/gs/lib/gs_init.ps 2007-01-26 16:33:54 UTC (rev 7646)
+++ trunk/gs/lib/gs_init.ps 2007-01-26 16:49:00 UTC (rev 7647)
@@ -2118,116 +2118,6 @@
/GridFitTT undef
} if
-% Conditionally turn image interpolation on or off.
-currentdict /INTERPOLATE known not { (%END INTERPOLATE) .skipeof } if
-
-/.interpolate {
- dup /Interpolate .knownget not { //false } if
- /INTERPOLATE .systemvar ne {
- dup gcheck .currentglobal exch .setglobal
- exch dup length dict copy
- dup /Interpolate /INTERPOLATE .systemvar put
- exch .setglobal
- } if
-} .bind odef
-
-/colorimage
- { /INTERPOLATE .systemvar
- { .currentglobal % w h bit [] {}...{} multi ncomp glob
- //false .setglobal
- 9 dict begin % w h bit [] {}...{} multi ncomp glob
- 2 .argindex { 1 index 7 add } { 8 } ifelse
- dup .argindex pop % check # of arguments
- copy gsave pop % preserve the arguments
- { 0 /DeviceGray 0 /DeviceRGB /DeviceCMYK }
- 1 index get setcolorspace % ... glob w h bit [] {}...{} multi ncomp
- {0 1 0 1 0 1 0 1}
- 1 index 2 mul 0 exch % ... glob w h bit [] {}...{} multi ncomp {0 1 ...} 0 2*ncomp
- getinterval /Decode exch def % ... glob w h bit [] {}...{} multi ncomp
- exch dup % ... glob w h bit [] {}...{} ncomp multi multi
- /MultipleDataSources exch def % ... glob w h bit [] {}...{} ncomp multi
- { array astore} { pop } ifelse % ... glob w h bit [] [{}...{}]
- /DataSource exch def % ... glob w h bit []
- /ImageMatrix exch def % ... glob w h bit
- /BitsPerComponent exch def % ... glob w h
- /Height exch def % ... glob w
- /Width exch def % ... glob
- /ImageType 1 def
- /Interpolate //true def
- .setglobal currentdict end % ... <<>>
- image grestore
- exch { 4 add } { 6 } ifelse
- { pop } repeat % -
- }
- { colorimage
- }
- ifelse
- } .bind odef
-
-/image
- { dup type /dicttype eq
- { dup /ImageType get 3 eq
- { .currentglobal //false .setglobal exch
- dup length dict copy begin .setglobal
- /DataDict DataDict .interpolate def
- /MaskDict MaskDict .interpolate def
- currentdict end
- }
- { .interpolate
- }
- ifelse
- image
- }
- { /INTERPOLATE .systemvar
- { 4 .argindex pop % check # of args
- .currentglobal //false .setglobal
- 8 dict begin .setglobal
- /ImageType 1 def
- /DataSource 1 index def
- /ImageMatrix 2 index def
- /BitsPerComponent 3 index def
- /Decode {0 1} def
- /Height 4 index def
- /Width 5 index def
- /Interpolate //true def
- currentdict end
- gsave /DeviceGray setcolorspace image grestore
- 5 { pop } repeat
- }
- { image
- }
- ifelse
- }
- ifelse
- } .bind odef
-
-/imagemask {
- dup type /dicttype eq {
- .interpolate imagemask
- } {
- /INTERPOLATE .systemvar {
- 4 .argindex pop % check # of args
- .currentglobal //false .setglobal
- 8 dict begin .setglobal
- /ImageType 1 def
- /DataSource 1 index def
- /ImageMatrix 2 index def
- /BitsPerComponent 1 def
- 2 index { {1 0} } { {0 1} } ifelse /Decode exch def
- /Height 4 index def
- /Width 5 index def
- /Interpolate //true def
- currentdict end imagemask 5 { pop } repeat
- } {
- imagemask
- } ifelse
- } ifelse
-} .bind odef
-
-currentdict /.interpolate undef
-
-%END INTERPOLATE
-
% Establish local VM as the default.
false /setglobal where { pop setglobal } { .setglobal } ifelse
$error /.nosetlocal false put
Modified: trunk/gs/lib/pdf_draw.ps
===================================================================
--- trunk/gs/lib/pdf_draw.ps 2007-01-26 16:33:54 UTC (rev 7646)
+++ trunk/gs/lib/pdf_draw.ps 2007-01-26 16:49:00 UTC (rev 7647)
@@ -1003,8 +1003,6 @@
} if
} ifelse
% Stack: datasource imagemask
- % image and imagemask can be redefined in gs_init.ps to tweak interpolation
- % after device-specific files are run. Don't bind them here.
{ currentdict end setfillstate { imagemask } }
{ ColorSpace setgcolorspace currentdict end setfillblend { image } }
ifelse
More information about the gs-cvs
mailing list