Re: Alpha Channel from mask
- From: "Michael Phillips, Jr." <mphillips53@xxxxxxxxxxxxxxx>
- Date: Thu, 22 Jun 2006 10:02:01 -0400
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 !!
.
- Follow-Ups:
- Re: Alpha Channel from mask
- From: ama
- Re: Alpha Channel from mask
- References:
- Alpha Channel from mask
- From: ama
- Alpha Channel from mask
- Prev by Date: Re: PropertyNotSupported returned for sample code
- Next by Date: Capturing calls
- Previous by thread: Alpha Channel from mask
- Next by thread: Re: Alpha Channel from mask
- Index(es):
Relevant Pages
|