https://bugs.documentfoundation.org/show_bug.cgi?id=156361

--- Comment #9 from Patrick Luby <plub...@neooffice.org> ---
(In reply to Noel Grandin from comment #8)
> which simplifies to
> 
> r = 1 - s - sa*d
> 
> which is not something Skia has a SkBlendMode for, so no easy fix.

Your formula looks much closer to what I could come up with.

Also, I realized my proposal in
https://bugs.documentfoundation.org/show_bug.cgi?id=156361#c6 won't work since
a VirtualDevice is initially filled with opaque white (which renders as white)
and its AlphaMask is also filled with opaque white (which makes the
VirtualDevice transparent). So, the alpha channel in the VirtualDevice is
immediately out of sync with its AlphaMask.

So, my understanding is that the AlphaMask starts as all white (transparent)
and reflects the cumulatively drawn areas as gray or black. I haven't been able
to come up with a blending algorithm for this, but it was what I was trying to
do in https://bugs.documentfoundation.org/show_bug.cgi?id=156361#c4.

Effectively, I think I want to repeat the drawing to the VirtualDevice but draw
all white instead of the bitmap. I no longer think that all of the copying and
inverting in that comment are needed. So, below is what I am thinking of
replacing mpAlphaVDev->BlendBitmap(aTR, rAlpha) with:

mpAlphaVDev->mpGraphics->BlendAlphaMasks(aTR, /* no bitmap */, *pSalAlphaBmp,
*pSalAlphaBmp2, *this))

BlendAlphaMasks() would be basically be a copy of the code block in
BlendAlphaBitmap() at vcl/skia/gdiimpl.cxx:1326 with the following changes:

1. Fill the surface with SK_ColorBLACK before blending
2. Blend the alpha masks the same, no change there
3. Blend the blended alpha masks with SK_ColorWHITE instead of a bitmap
4. Invert the surface with kDifference to get black == opaque and white ==
transparent

Thoughts? I can try coding this in the next couple of days and see if it fixes
anything.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to