gimp r27382 - in trunk: . app/gegl



Author: martinn
Date: Thu Oct 23 22:14:44 2008
New Revision: 27382
URL: http://svn.gnome.org/viewvc/gimp?rev=27382&view=rev

Log:
* app/gegl/gimpoperationadditionmode.c: For alpha compositing
consistency, all layers should affect alpha in the same way
independent of layer mode. Replace the compositing algorithm with
a version without the flaws discovered so far in the previous
ones. Don't use it yet though as it requires premultiplied data.


Modified:
   trunk/ChangeLog
   trunk/app/gegl/gimpoperationadditionmode.c

Modified: trunk/app/gegl/gimpoperationadditionmode.c
==============================================================================
--- trunk/app/gegl/gimpoperationadditionmode.c	(original)
+++ trunk/app/gegl/gimpoperationadditionmode.c	Thu Oct 23 22:14:44 2008
@@ -72,12 +72,21 @@
   while (samples--)
     {
 #if 1
-      // Best so far (maybe even correct?)
+      // Wrong, for alpha compositing consistency all layers should
+      // affect alpha in the same way independent of layer mode
       out[RED]   = in[RED]   + layer[RED]   * layer[ALPHA];
       out[GREEN] = in[GREEN] + layer[GREEN] * layer[ALPHA];
       out[BLUE]  = in[BLUE]  + layer[BLUE]  * layer[ALPHA];
       out[ALPHA] = in[ALPHA];
 #else
+      // A very nice combination of correctness and speed for
+      // premultiplied data without any of the issues the previous
+      // versions had
+      out[RED]   = in[RED]   + layer[RED];
+      out[GREEN] = in[GREEN] + layer[GREEN];
+      out[BLUE]  = in[BLUE]  + layer[BLUE];
+      out[ALPHA] = in[ALPHA] + layer[ALPHA] - in[ALPHA] * layer[ALPHA];
+
       // Wrong, doesn't take layer opacity of Addition-mode layer into
       // account
       out[RED]   = in[RED]   + layer[RED];



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]