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: directfb-users-boun...@directfb.org
[mailto:directfb-users-boun...@directfb.org] On Behalf Of Jérémy Morel
Sent: 21 October 2009 13:30
To: Niels Roest
Cc: directfb-users@directfb.org
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-users mailing list
directfb-users@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

_______________________________________________
directfb-users mailing list
directfb-users@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to