[gs-bugs] [Bug 691157] Problem with image masking

bugzilla-daemon at ghostscript.com bugzilla-daemon at ghostscript.com
Thu Jul 15 00:33:22 UTC 2010


http://bugs.ghostscript.com/show_bug.cgi?id=691157

--- Comment #4 from Michael Vrhel <michael.vrhel at artifex.com> 2010-07-15 00:33:21 UTC ---
Verified that pdfwrite also fails and that the problems are caused by the
following:

The contents for a simplified file (to be attached) is given by

stream
q 0 0 595 842 re W n q /GS0 gs /Perceptual ri 138.009903 16.561203 -12.4208984
103.5074005 271.7055054 234.8406982 cm 
/Im0 Do Q Q q 0 0 595 842 re W n q /Perceptual ri 139.9956055 16.7994843
12.1826019 -101.521698 258.4109039 337.2360992 cm /Im1 Do Q Q 
endstream

where the setting of /GS0 gs defines a softmask given by 

27 0 obj
<<
  /SMask 26 0 R
  /Type /ExtGState
>>
endobj

which is 

26 0 obj
<<
  /G 17 0 R
  /S /Luminosity
  /Type /Mask
>>
endobj

where the group is 

17 0 obj
<<
  /BBox [ 258.411 235.714 410.589 354.036 ]
  /Type /XObject
  /FormType 1
  /Group <<
    /CS /DeviceGray
    /I true
    /K false
    /S /Transparency
  >>
  /Length 178
  /Matrix [ 1 0 0 1 0 0 ]
  /Resources 25 0 R
  /Subtype /Form
>>
stream
q Q q 258.4109 337.2361 m 398.4065 354.0356 l 410.5891 252.5139 l 270.5935
235.7144 l h W n /Perceptual ri q 
139.9956 16.79948 12.1826 -101.5217 258.4109 337.2361 cm 
/Im28 Do Q Qendstream
endobj

The bounding box for the group is given as [ 258.411 235.714 410.589 354.036 ].
 Note that there has not been a cm command at the time that the  /GS0 gs
command occurred but that there is one ( 139.9956 16.79948 12.1826 -101.5217
258.4109 337.2361 cm ) within the stream for 17 0.  The problem is that the
begintransparencymaskgroup does not occur until the /Im28 Do occurs within the
stream of 17 0 (verified using -dPDFDEBUG).  At this point, the ctm for the
imager state has been concatenated with 139.9956 16.79948 12.1826 -101.5217
258.4109 337.2361.  This matrix is applied to the bounding box when we reach
pdf14_begin_transparency_mask using compute_group_device_int_rect(pdev, &rect,
pbbox, pis);.  This is not correct, since the matrix in the stream should not
affect the bounding box.  This puts us way outside the bounding box for the
main buffer and the mask is not used.  

One approach to fixing this is to add a member variable to the image state that
stores the ctm related to the current form xobject.  This ctm would then be
used as needed to be applied to any bounding boxes for the xobject.  The
application of the ctm has be be delayed since otherwise this would cause
problems for high level devices.

Looking for some feedback on this issue from Ken, Ray and anyone else who wants
to jump in.

-- 
Configure bugmail: http://bugs.ghostscript.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the gs-bugs mailing list