GDIPLusX: GetHBitmap Bug, blue background

Topics: Attention VFPX Admins
Developer
Nov 19, 2007 at 3:28 PM
I moved this here, from http://www.codeplex.com/VFPX/WorkItem/View.aspx?WorkItemId=7148 where I originally incorrectly posted.

CesarChalom wrote Today at 9:53 AM
Carlos,

This is a GdiPlusX problem, and is fairly known. Fortunately, there are known ways to solve this.
FYI: Michael Philips is one of the main gurus, and one of the most respected persons when the subject is images.

calloatti wrote Oct 19 at 5:08 PM
Sorry I posted this here, can't find a way to delete it. Codeplex is not really user friendly, and it takes ages to load each page. This should go as a new item, but I give up on trying to understand this site.

calloatti wrote Oct 19 at 2:31 PM
GetHBitmap has a bug, it will not convert correctly the transparent areas of a bitmap, the transparent areas are always converted to blue.

I have code to reproduce the problem, and also reports of this bug in .NET can be found by searching for GetHBitmap+blue

For example, here:

http://www.c-sharpcorner.com/Forums/ShowMessages.aspx?ThreadID=33421
http://www.ureader.com/message/33276570.aspx
http://www.thescripts.com/forum/thread276373.html
These 2 guys end up fighting:
http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.windowsforms/topic21736.aspx

Maybe this can be fixed in GDIPLUSX.

Carlos Alloatti
Nov 19, 2007 at 3:54 PM
Hi Carlos,

Sorry, I wrote wrongly, when I said :

This is a GdiPlusX problem, and is fairly known. Fortunately, there are known ways to solve this.


The correct was to say :
"This is NOT a GdiPlusX issue"
. It's by design from GdiPlus.dll. On the other hand, it's a known issue, and as Michael Philips said in one of the links you provided, MS knows that, and provides ways to make it work. I agree that this is totally contra producent, bad design, but that's how it is. Fixing it would be possible, but IMO would require to make some assumptions, and image checkings that might slow down the process. But this happens only sometimes.

If you pass correctly the color to become transparent to GethBitmap, it will transform the background color to the one you've asked it to do.