Re: UpdateLayeredWindow and alpha values
From: josh (smileyfaceswillruletheworld_at_yahoo.com.NOSPAM)
Date: 02/25/04
- Next message: Feng Yuan [MSFT]: "Re: GDI objects creation limit !!!!"
- Previous message: a.m.a: "Re: BeginPaint failures under Windows 2000"
- In reply to: a.m.a: "Re: UpdateLayeredWindow and alpha values"
- Next in thread: a.m.a: "Re: UpdateLayeredWindow and alpha values"
- Reply: a.m.a: "Re: UpdateLayeredWindow and alpha values"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 25 Feb 2004 15:07:50 -0800
"a.m.a" <amarcaurele@videotron.ca> wrote in
news:wZM_b.61704$FO1.1706154@weber.videotron.net:
> "josh" wrote :
>> out = background*(255-alpha)/255 + foreground*alpha/255
>
> then isnt that the same as :
>
> out = ( background*(255-alpha)/255) + (foreground*alpha/255)
> ...
> out = ( background * 1 ) + (foreground * 0)
> ...
> out = background + 0
Right, *IF* you are replacing foreground with your pixel values.
UpdateLayeredWindow uses your pixels to replace the entire term,
"foreground*alpha/255", not just the foreground value.
> Yet i assure you that the layered window does not display the
> pixels that this formula tels it should.
This is the complete alpha equation, UpdateLayeredWindow takes care of
the background half, the caller is respondible for the foreground half.
that's what premuliplication refers to.
That is, layered windows only do:
out = background*(255-alpha)/255 + bitmap
(at least, as far as per-pixel alpha is conserned)
>> (consider an alpha of 1, what should it do?)
> it should display a very faint pixel, wich is exactly what happens.
With a red component of 255?
> if ( RGB )
> if ( ! alpha )
> alpha = 255
If your source bitmap may or may not have an alpha channel, it would be
better to determine if the alpha channel is present for the entire image
rather than per pixel.
-josh
- Next message: Feng Yuan [MSFT]: "Re: GDI objects creation limit !!!!"
- Previous message: a.m.a: "Re: BeginPaint failures under Windows 2000"
- In reply to: a.m.a: "Re: UpdateLayeredWindow and alpha values"
- Next in thread: a.m.a: "Re: UpdateLayeredWindow and alpha values"
- Reply: a.m.a: "Re: UpdateLayeredWindow and alpha values"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|