Re: Wierd problem when alpha blitting image with text in it



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.



.



Relevant Pages

  • Re: Mixing (blending?) two bitmaps
    ... #4 Draw the original image which has it's new alpha channel settings... ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... without touching the RGB channels - but I have to go meet my parents ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Objects with individual alpha
    ... However, from what I understand, you create a new backbuffer for every ... On the backbuffer *one* object is drawn and the buffer is ... GDI clears the alpha channel of any pixels it draws. ... each time you draw to it scan the alpha channel for any values of 0x0 and replace those with the object alpha. ...
    (microsoft.public.vb.winapi.graphics)
  • GIMP and alpha channel
    ... Does GIMP treat alpha channel as any other channel (i.e. you can paint on ... it, draw text on it, copy from it, paste to it, view it etc.), or does it do ...
    (comp.graphics.apps.gimp)