Re: Alpha Channel from mask



I am not familiar with the Flash API. However, if you want to set alpha
values based on an AND mask where the white pixels are transparent. Here is
the algorithm that I use:

1) Use CreateDIBSection with a BITMAPV5HEADER as you can specify an alpha
channel explicitly.
2) Select the AND Mask into a device context
3) Use GetPixel in a loop and for every white pixel int the AND Mask ,set
the alpha channel to 0. For all other pixels set the alpha channel to 255.
4) You now have an image with the transparency set per your AND mask.
Premultiply the alpha channel against the R,G,B channels.

BYTE B = B' * ((float)A /255.0f);
BYTE G = G' * ((float)A /255.0f);
BYTE R = R' * ((float)A /255.0f);

"ama" <a.m.a@xxxxxxxxxxxx> wrote in message
news:Tdwmg.1116$zQ5.7167@xxxxxxxxxxxxxxxxxxxxxx
hello

Im experimenting with ShockwaveFlash control ( ocx ) version 8.xx

I wrote a container that supports windowless activation so i can
get Flash to draw itself into my memory buffer ( HDC ).

The buffers are 32 bpp because i created bitmaps with CreateDIBSection()
in the proper manner.

When Flash draws itself into my buffer, it takes the pixels in my buffer
and blends the pixels of its current animation frame and transfers the
result
back into my buffer. Just like it does in Internet Explorer for exemple.

Here's the problem :

When Flash draws itself in my buffer, it does not give the Alpha values.
Even if the Flash movie contains transparency. ( note : it did with Flash
7 !! )

Now, i tried to draw Flash twice by changing the background color of the
movie:

- set background of movie BLACK and draw in buffer SourceBuffer.
- set background of movie WHITE and draw in buffer DestinationBuffer
- using BitBlt , transfer SourceBuffer to DestinationBuffer using
SRCINVERT.

How would i calculate per-pixel Alpha values, from the resulting bitmap ?


Thanks, I know this is not a everyday question but please help me out !!





.



Relevant Pages

  • Re: Wierd problem when alpha blitting image with text in it
    ... When the shadow is faded out, ... constant alpha is applied to the whole window. ... windows can have per-pixel but cannot have any child windows. ... So this leaves me with the image pixels being however opaque they ...
    (microsoft.public.win32.programmer.gdi)
  • Re: The "Oh no not another Burpday Moot" Thread
    ... It's why flash gnus exist. ... (There are, in fairness, some DSLRs which are nearly as compact ... Y'can get a "pancake" 40mm lens for the Pentax ... Don't be fooled into thinking that "more pixels is always better", ...
    (uk.rec.sheds)
  • Re: How to deal with fully transparent ARGB pixels?
    ... GDI+ solves this by using pre-multiplied alpha images. ... resulting in final partialy red pixels. ...
    (microsoft.public.dotnet.framework.drawing)
  • RE: How to do this with fixed pipeline
    ... Try using alpha testing: set the alpha of bright pink pixels to zero, ... set up the fixed pipeline to get the texure alpha. ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Question of Transparent Textures..
    ... Set the pixels' alpha to 0 and enable alpha blending and the relevant TSS ... setup (for FFP pixel pipeline). ...
    (microsoft.public.win32.programmer.directx.graphics)