The layer modes have now been ported to GEGL.

As layer mode compositing with GEGL uses a different model than legacy
layer mode compositing it deserves some elaboration. If you want to try
out the new layer mode compositing you can do View -> Use GEGL in GIMP

The new model is based on the one in the SVG 1.2 draft:

The model used is

  Dca' = f(Sc, Dc) * Sa * Da  + Sca * (1 - Da) + Dca * (1 - Sa)
  Da' = Sa * Da + Sa * (1 - Da) + Da * (1 - Sa)


  Sc is the layer color (channels)
  Dc is the composite of the layers below
  Dc' is the result composite
  Xa means alpha channel
  Xca means pre-multiplied data
  f(Sc, Dc) is a blending formula

Things to note about this model:

The contribution to the end pixel that comes from the layer mode
specific blending is proportial to Sa * Da, i.e. the subpixel area that
contains both the layer and below composite in the Porter-Duff alpha
compositing model. The rest of the contribution to the end pixel comes
from the unblended (since there is nothing sensible to blend with) layer
and below composite pixels: Sca * (1 - Da) + Dca * (1 - Sa). All layers
independent of layer mode are treated as having an opacity and thus
affect the alpha of the final composite.

This new model creates a more consistent and predictable layer mode
blending experience.

Examples of differences compared to legacy layer mode compositing:

1. With a 50% opaque Addition mode layer put on top a 50% opaque Normal
mode layer, the resulting composite has an opacity of 0.5 + 0.5 - 0.5 *
0.5 = 75% with GEGL layer mode compositing, but 50% with legacy layer
mode compositing.

2. With a 100% opaque Addition mode layer put on top a completely
transparent layer, the resulting composite becomes 100% opaque
containing the unblended Addition mode layer pixels when using GEGL, but
completely transparent when using legacy compositing.

The current plan is to have add kind of compatibility rendering mode so
that old .xcfs will render the same as in old versions of GIMP also when
using GEGL.

Gimp-developer mailing list

Reply via email to