Synfig definitely has a non-standard collection of blend methods. Some
of them are simply unique blend methods that aren't found in other
graphics programs.

Others, though, extend the W3C methods with two new concepts:
* HDR color calculations: The math behind Synfig's blend methods is
defined such that it is still valid for colors outside of the 0-255
range.
* The "amount" parameter: the W3C blend methods only use the alpha
channel in their calculations, while Synfig has both an alpha channel
and an amount.

To me, it seems natural to redefine Synfig's blend methods in terms of
the W3C methods, but with a correction for the "amount" parameter.

The trouble is, there are many possible corrections:
1. Multiply the alpha channel of the top by the "amount", and then
perform standard compositing.
2. Multiply the alpha channel of the top layer by "amount", multiply
the alpha channel of the bottom layer by "1-amount", and then perform
standard compositing.
3. Blend the top layer onto the bottom layer to yield an image, A.
Call the bottom layer image B. The overall result will be A*amount +
B*(1-amount)
4. Blend the top layer onto the bottom layer to yield an image, A.
Then blend the top layer, with its alpha channel set to zero
everywhere, onto the bottom layer to yield image B. The overall result
will be A*amount + B*(1-amount)
5. Blend the top layer onto the bottom layer to yield an image, A.
Then blend an empty layer (red=green=blue=alpha=0) layer onto the
bottom layer to yield image B. The overall result will be A*amount +
B*(1-amount)

Many of Synfig's blend methods can already be expressed by one of the
formulas from (1) to (5): but different ones use different formulas!
[1]

Still, expressing blending in such a way, and tweaking the formulas
where necessary, is definitely worth considering. In some cases the
mathematical change may be small enough not to cause a noticeable
difference.

~Nikita

[1] I found one blend method that almost matches one of the formulas,
but is slightly different. I believe that to be an unintentional
mistake by the author of that code.

On Mon, Nov 12, 2012 at 10:58 PM, Carlos López González
<[email protected]> wrote:
>
> I think that this material is important to read:
> http://www.w3.org/TR/compositing/
>
> I wonder if it wouldn't be good to rethink the current Synfig blending 
> methods and modify them to stick strictly to the W3C standards. It would 
> allow to use external libraries without the issues I'm having with Cairo 
> operators.
>
> Of course the old blend methods should still working inside Synfig but we 
> shouldn't continue using the non standard blending methods.
>
> Also it might be interesting to separate the blending parameters in two. 
> First in what is called in the document "The Porter Duff compositing 
> operators" (that defines how the alpha are combined) and the "Blending" that 
> is the pure color combinations. I need to read the document completely to 
> profile this properly.
>
> quote:
> Porter Duff compositing takes into account the overall shape of the graphic 
> element and its opacity, as well as the opacity and shape of the backdrop, 
> and determines where the backdrop is visible, where the graphic element is 
> visible and where one is visible through the other. The blending step 
> determines how the colors from the graphic element and the backdrop interact.
>
> Any thoughts?
>
> --
> Carlos
> http://synfig.org
>
>
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from $795 for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov
> _______________________________________________
> Synfig-devl mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/synfig-devl
>

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to