Hi Chris.
To be complete:
the color formula is (256-a_source) / 256 * c_destination + a_source /
256*c_source
and the alpha formula is (256-a_source) /256 * a_destination + a_source
Chris Bore wrote:
Shouldn't that be (for SRC OVER DST blending):
(256-a_source) * a_destination/ 256 * destination + a_source/256*source
where a_destination is the alpha of the destination pixel?
Chris
===========================
Chris Bore
BORES Signal Processing
www.bores.com
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jérémy Morel
Sent: 21 October 2009 13:30
To: Niels Roest
Cc: [email protected]
Subject: Re: [directfb-users] Fade out effect
The formula for blending is : (256-a_source) / 256 * destination +
a_source/256*source
where:
* a_source is the alpha component of the source,
* destination is one of the color component of the destination
* source is the same color component, but for the source
Let's consider for example the red component (it works with any
component)
Our source is 01ff ff ff, ie white with a minimal alpha component, and its
red component is therefore 255 Our destination can be any colour, let's
assume its red component is 50.
each time I apply my filter, the color of the destination becomes :
(256 - 1)/256 * destination + 1/256*255
This is an sequence defined by u_{n+1} = 255/256 * u_{n} + 255/256, which
generic term is:
u_n = (255/256)^n * (50 - 255) + 255
which will tend to 255. Therefore it should work.
However, a simple verification shows that 1000 iterations will only get you
to 251, which means that the residue shape is perfectly normal.
I'm sorry for this mathematical post, but it explains the phenomena.
Thanks for the blending formula, I had no idea how it was done.
--
Jérémy
_______
--
.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/ |
"------------------------------------------"
_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users