[gs-cvs] gs/lib

Ray Johnston ray at casper.ghostscript.com
Tue Jul 30 21:43:47 PDT 2002


Update of /cvs/ghostscript/gs/lib
In directory casper:/tmp/cvs-serv8741/lib

Modified Files:
	gs_lev2.ps gs_ll3.ps 
Log Message:
Fix: The addition of the function sampling logic for DeviceN tint
transforms (fix 474544) tripped over a bogus assumption in Adobe Procset
for DuoTones generated by (at least) Photoshop. The assumption was that if
the alternate color space of a DeviceN space was being used, that the
procedure would run when 'setcolor' was executed and that the stack would
be accessible during that procedure. This fixes several bug reports with
'/stackunderflow in pop' errors including SF #549307, 576577 and 582385
for Artifex customers. Thanks to Dan Coby for the analysis and fix.


Index: gs_lev2.ps
===================================================================
RCS file: /cvs/ghostscript/gs/lib/gs_lev2.ps,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- gs_lev2.ps	27 Jun 2002 16:35:31 -0000	1.19
+++ gs_lev2.ps	31 Jul 2002 04:43:44 -0000	1.20
@@ -714,6 +714,13 @@
   } ifelse
 } bind def
 
+% Define the setcolor procedure:
+%   <param1> ... <paramN> setcolor -
+% This definition is overridden in PS level 3.
+/setcolor {
+  .setcolor
+} odef
+
 % Define the setcolorspace procedures:
 %	<colorspace> proc <colorspace'|null>
 % We have to define the dictionary first, so it can be bound into the

Index: gs_ll3.ps
===================================================================
RCS file: /cvs/ghostscript/gs/lib/gs_ll3.ps,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- gs_ll3.ps	2 Jun 2002 12:03:28 -0000	1.14
+++ gs_ll3.ps	31 Jul 2002 04:43:45 -0000	1.15
@@ -161,6 +161,29 @@
   16 /.sethalftone16 load def
 end
 
+% Redefine the setcolor procedure:
+%   <param1> ... <paramN> setcolor -
+%
+% The setcolor operator is being redefined due to an ugly violation
+% of the PLRM by Adobe Photoshop 5+.  Duotone code generated by Adobe
+% Photoshop 5+ expects that setcolor:
+% (1) calls tint transform function (ttf). PLRM doesn't require this
+% (2) permits ttf to change op stack as side effect. PLRM forbids this
+% (3) assumes op stack for ttf is the same when the call to setcolor was made.
+% Thus we may need to call the ttf.  The Adobe Photoshop Duotone code
+% also has the nasty side effect of creating a ttf which pops more
+% operands than required, thus destroying the stack, if its expectations
+% are not met.
+/setcolor {
+  .setcolor			% Do normal setcolor operation
+  .checkdevicenaltused {	% Check if DeviceN and using alt color space
+    currentcolor		% Get current color (just set)
+    currentcolorspace 3 get	% get tint transform function
+    exec			% Execute tint transform function
+    .discardaltcolor		% delete the resulting color
+  } if
+} odef
+
 % Redefine the halftone-setting operators to honor HalftoneMode.
 /setcolorscreen {
   /HalftoneMode getuserparam 0 eq {




More information about the gs-cvs mailing list