Re: Alpha Channels Bitmaps

From: josh (smileyfaceswillruletheworld_at_yahoo.com.NOSPAM)
Date: 03/27/04


Date: Sat, 27 Mar 2004 10:39:21 -0800


"Tim" <Tim@NoSpam> wrote in news:#divrJ#EEHA.3568@tk2msftngp13.phx.gbl:

> GDI+ can cope with alpa stuff. Have you looked at that?
> - Tim

AlphaBlend is in the regular Win32 API (has been since Win98), and it can
deal with alpha.

> "David" <dgintz@acm.org> wrote in message
> news:5fee362f.0403261532.3ea308a5@posting.google.com...

>> Thus, the background of the image would be the actual background of
>> the dialog box. (And most importantly, changes in the user's
>> selection of Windows themes would not have an ugly impact on the
>> image. (Currently, since
>> I don't know how to incorporate an image with an alpha channel into
>> VC++ 6.0
>> created dialogs, the images currently have white backgrounds. This is
>> fine if the active Windows theme has white as the background color
>> but it looks ugly if the background color is grey.)

Pretty much everywhere you need to deal with alpha is a different API, so
I don't think you're gonna be able to do it that way.

>> I know I could probably render the image myself but since this is the
>> only piece of code that would be Windows specific, I'd rather just
>> make use
>> the resource editor to include the bitmap file with alpha channel
>> (probably as a PNG file).

Reading from a png is not supported directly by the Win32 API (and thus
MFC), so this is almost certainly not gonna work either. :(

Unless Photoshop exports functions for alpha blending to its plugins, I
would store the image as a 32-bpp bitmap resource and #ifdef away a bit
of code using AlphaBlend. (if you can store the bitmap with alpha
already premultiplied, that would be optimal)

-josh