[Mono-winforms-list] [PATCH] DrawImage alpha blend broken in libgdiplus

Alex Shulgin alexander.shulgin at yessoftware.com
Tue May 12 12:10:20 EDT 2009

Sebastien Pouliot wrote:
> Thanks for your patch but *please*, like I said in my earlier email,
> attach all patches to the bug reports. I don't mind them being sent to
> any list, but not having them on the bug report means I won't see (or
> remember them) next time I have time to look at libgdiplus bugs. And
> like you've seen this is not the kind of patch to create "quite a
> discussion".

Thanks for your response!

I've attached the patches to the bug report.

> Two things about it:
> 1) caution: Historically such changes requires a lot of testing outside
> libgdiplus. Many times it caused regressions that were found after one
> (or more) release(s).
> 2) regression: even if unit tests are not enough it still better than
> nothing. However when, like this patch, it breaks some* of them then
> it's likely to break existing apps too (which often supplied, even if
> indirectly, those test cases).

I understand both points and I'm not surprised by your response.

However, I believe I did my best not to break things more than 
absolutely necessary and hoped that with your help (and the community) 
we would find the most appropriate solution.

Again, I'd be very glad to see there's a way to fix things without 
making such fundamental change.  But this needs discussion as I don't 
think I could do this alone.  The community and original libgdiplus 
developers are in much more fortunate position than I (by myself) to 
figure out how to do this.

> Sebastien
> * it may looks strange but the number of bug reports abouts icons, and
> their specific behavior, is much greater than the one about transparency

In this specific case I won't expect numerous applications to break and 
here's why: if most (all?) of the application were happy enough with 
inconsistent PixelFormat property and actual pixel data of the bitmaps, 
then they must have used only certain pixel manipulation algorithms 
which don't rely on strict ARGB format (no premultiplication).

This also means, that they didn't check the PixelFormat 
property--otherwise the inconsistency should have came up earlier.  So 
if we now fix the inconsistency these apps aren't going to notice this.

Of course, it's only speculation on my side--reality might prove 
otherwise. ;)


More information about the Mono-winforms-list mailing list