Re: Wierd problem when alpha blitting image with text in it
- From: "Dean Roddey" <droddey@xxxxxxxxxxxxxxxx>
- Date: Sat, 29 Jul 2006 18:25:09 -0700
That's not really possible. I have to initialize it to fully transparent,
because this is a secondary bitmap that is being drawn into and which will
then be composited over the other (fully opaque) bitmap. So clearly
everything not explicitly drawn into must have a zero alpha channel because
you don't want it to show up when you composite the secondary drawn content
over the base image.
If all the drawning APIs effectively set the alpha to zero, then it would be
impossible to composite two such images, and I'm starting to think that this
is the case (and the reason why LayeredWindows don't support both constant
opacity and alpha channel at the same time, becaues Window's just has too
limited support for alpha channel.)
The reason we want to draw into the secondary image and then composite it is
so that we can apply a constant opacity to the subsequent layers, i.e. draw
the second images into an intially zeroed alpha channel to create a
correctly alpha channelled secondary image, and then do an alpha blit from
the secondary image over the primary image, possibly applying constant
opacity as we go.
But if all the drawing APIs zero the alpha channel, then it would require
that all compositing be done by drawing into a single memory image, which
prevents the application of constant opacity. Oh well, I guess I'll just
have to give up on that and just draw into the single memory image. At least
I can get correct alpha channel support that way.
Here's a better example of the kind of thing it's being used for:
http://www.charmedquark.com/Web2/Downloads/MiscImages/V17Previews/PopupExp8.jpg
I'm poppinp up a CD selection 'popup'. We'd really like those types of
popups to be slighly to quite translucent overall by applying teh constant
opacity to it. In a case like this one, the alpha channel in the background
image of the popup is sufficient to provide the required effect. But for an
'on screen display' type of popup, it really needs to be able to draw text
and composite over the background with constant opacity.
-------------------------------------
Dean Roddey
Chairman/CTO, Charmed Quark Systems
www.charmedquark.com
"Nobody" <nobody@xxxxxxx> wrote in message
news:jBOyg.132$0F5.74@xxxxxxxxxxxxx
"Dean Roddey" <droddey@xxxxxxxxxxxxxxxx> wrote in message
news:epclHYusGHA.1216@xxxxxxxxxxxxxxxxxxxxxxx
All the Windows APIs that draw to bitmaps (text, line, etc) leave you with
an alpha channel of 0x00 (except those APIs which specifically manipulate
the alpha channel). An alpha of 0x00 is fully transparent. You need to
initialize your memory DC to have alphas of 0xff and then layer it up from
there.
.
- Follow-Ups:
- References:
- Wierd problem when alpha blitting image with text in it
- From: Dean Roddey
- Re: Wierd problem when alpha blitting image with text in it
- From: Dean Roddey
- Re: Wierd problem when alpha blitting image with text in it
- From: Nobody
- Wierd problem when alpha blitting image with text in it
- Prev by Date: Re: Wierd problem when alpha blitting image with text in it
- Next by Date: Re: Wierd problem when alpha blitting image with text in it
- Previous by thread: Re: Wierd problem when alpha blitting image with text in it
- Next by thread: Re: Wierd problem when alpha blitting image with text in it
- Index(es):
Relevant Pages
|