[poppler] Soft Masking bugs [was Supporting PDF 1.6 UserUnit]

Leonard Rosenthol leonardr at pdfsages.com
Tue Jul 12 23:32:54 EST 2005


At 08:14 AM 7/12/2005, Brad Hards wrote:
>OK, after staring at this for a while, I'm starting to believe that it really
>is possible to read a PDF file by eye.

         Of course it is - just takes practice...I actually teach a 
1/2 day class on how to do it.

         When you start writing them by hand (as I've been known to 
do), THEN I'll send you a "PDF Sages" shirt ;).


>If I'm following along, then the following snippet is the part that draws the
>section that is meant to be alpha-blended:

         Correct.  The image has a soft mask (SMask) associated with it.

         The SMask is the alpha channel of the image data.  Rather 
than changing the PDF spec for standard images to include the alpha 
data (ala PNG), they instead kept backwards compatibility and store 
the alpha out in a separate stream (referenced by /SMask).

         The SMask has to be the same size (Height & Width) as the 
Image (obviously), so that you can just start with an RGBA/ARGB 
canvas, copy the pixels from the image into the RGB part and then 
SMask data into the A's...


> From that, I think that this file uses softmasking, which poppler doesn't
>currently do - certainly I couldn't find any reference to an "SMask" lookup.

         Correct on both counts.

         It's in Gfx.cc


>So the appropriate place to do such a lookup would presumably be in
>Gfx::doImage().

         Which is where it is in 3.00.20...


>However if I'm getting enough of softmasking, then there can
>actually be at least two soft masks - an softmask in the state, and a
>softmask for in a particular image. The image one apparently takes precedence
>though.

         Forget about the softmask for the state - that's part of the 
transparency grouping stuff and you REALLY don't want to get involved 
in doing that....First, it's not 100% documented in the spec (there 
are wholes) and secondly you need a bunch of supporting framework 
throughout the rendering system that isn't there yet.


>So I've played around a bit with trying to get an image softmask to work.At
>this stage, I'm not sure how to modify the OutputDev interface (how much
>processing should we do before handing it over?).

         The 3.00.20 implementation involves a NEW method on 
OutputDev - drawSoftMaskedImage().


Leonard

---------------------------------------------------------------------------
Leonard Rosenthol                            <mailto:leonardr at pdfsages.com>
Chief Technical Officer                      <http://www.pdfsages.com>
PDF Sages, Inc.                              215-938-7080 (voice)
                                              215-938-0880 (fax)




More information about the poppler mailing list