Page 1 of 1

ColorKey with PNG files

PostPosted: Sep 2, 2002 @ 12:10pm
by simont

PostPosted: Sep 2, 2002 @ 12:32pm
by Johan

PostPosted: Sep 2, 2002 @ 1:02pm
by simont

PostPosted: Sep 3, 2002 @ 9:34am
by simont

PostPosted: Sep 3, 2002 @ 11:12am
by Johan

PostPosted: Sep 5, 2002 @ 11:10am
by simont

PostPosted: Sep 5, 2002 @ 11:30am
by Johan
Hi,

Ok, I know what's wrong here. This is not related to GapiDraw.

GapiDraw uses a built in library in the Pocket PC called IMGDECMP.DLL. This library is responsible for decoding GIF, JPG and PNG images.

IMGDECMP.DLL however has a severe bug where transparent parts in GIF and PNG images ALWAYS are filled with white color! So if you have a GIF or PNG image, even if the transparent parts are set to render as black the Pocket PC will always render them as white.

Why does IMGDECMP.DLL do this? Simple - it's due to a bug in Pocket Internet Explorer. :) Create an image consisting of some pure white elements. Make some parts of the image transparent and save as GIF. Create a colored web page and place your GIF there. When shown in Pocket IE ALL white elements of your picture will be transparent. Basically the process works like this:

(1) IMGDECMP.DLL: Load GIF or PNG. Replace all transparent parts with white color. Send image to Pocket IE.
(2) Render background on web page. Take image from IMGDECMP.DLL. Replace all white parts with background. So what if the picture contains white elements that should not be transparent, all web pages are white anyways in my world.

You can clearly see this error if you open the web page http://www.opentrek.com/ in Pocket Internet Explorer. Check the main logo for black dots (they should be white).

GapiDraw sets the correct flags in calling the IMGDECMP.DLL, so if IMGDECMP.DLL is corrected in a future PPC update (not very probable) GapiDraw would work ok on these future devices.

Until then: Stay away from transparent PNGs and GIFs. Always make them opaque and draw "transparent" parts with for example a pink color.

I will update the documentation on CreateSurface and SetColorKey / GetColorKey to also reflect PNG images.

/Johan