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

Alex Shulgin alexander.shulgin at yessoftware.com
Wed Apr 8 11:59:55 EDT 2009


Alex Shulgin wrote:
> Hi,
> 
> I believe that alpha blending is broken in libgdiplus.

I've located the problem.  It is due to the inconsistent handling of 
PixelFormat32bppPArgb (premultiplied alpha) in libgdiplus.

In the attached patch I've added the check on PArgb to DrawImageRect in 
analogy with texturebrush.c and fixed pngcodec.c to set pixel format to 
PArgb if premultiplication was done.

This fixes my demo program and there's no visible regressions in a 
fairly complex application which originally revealed the problem.

If the feeling is such that this is appropriate patch, I'd add the same 
handling for places like this (there's few).

--
Regards,
Alex

-------------- next part --------------
A non-text attachment was scrubbed...
Name: libgdiplus-pargb.patch
Type: text/x-patch
Size: 2578 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-winforms-list/attachments/20090408/ae7274ec/attachment.bin 


More information about the Mono-winforms-list mailing list