Per Pixel Alpha

Dec 21, 2008 at 1:48 AM
After a few hours trying to figure out why, even though AlphaBlend says it supports per pixel alpha blending it kept returning an error code I think I've got it.

"The AlphaBlend function has the ability to do either constant alpha blending over the entire source image or pixel level blending for bitmaps with an alpha channel.  Unfortunately, the NETCF bitmap loader creates a bitmap with the same pixel format as the display when loading a bitmap file or resource and loses the alpha channel information (if present).  This means that the AlphaBlend function can only be used for constant value alpha blending of images.


If we instantiate an IImagingFactory and use it to load our image from a file or resource, the alpha channel will be preserved (don't, however, confuse the IImage COM interface we get back with a System.Drawing.Image managed object).  Then we can ask the Imaging object to draw itself and it will use the alpha channel information in the image during the render.

Now to replace a bunch of BMP's with PNG's!