Update with a new version that is the best known so far (maybe it's even

* app/gegl/gimpoperationadditionmode.c
(gimp_operation_addition_mode_process): Update with a new version
that is the best known so far (maybe it's even correct?).

svn path=/trunk/; revision=27269
This commit is contained in:
Martin Nordholts 2008-10-13 19:27:43 +00:00
parent b387734c3d
commit bce95343c8
2 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2008-10-13 Martin Nordholts <martinn@svn.gnome.org>
* app/gegl/gimpoperationadditionmode.c
(gimp_operation_addition_mode_process): Update with a new version
that is the best known so far (maybe it's even correct?).
2008-10-13 Sven Neumann <sven@gimp.org> 2008-10-13 Sven Neumann <sven@gimp.org>
Bug 547967 Improve app/paint-funcs/ maintainability Bug 547967 Improve app/paint-funcs/ maintainability

View File

@ -72,11 +72,21 @@ gimp_operation_addition_mode_process (GeglOperation *operation,
while (samples--) while (samples--)
{ {
#if 1 #if 1
// Best so far (maybe even correct?)
dest[RED_PIX] = src[RED_PIX] + aux[RED_PIX] * aux[ALPHA_PIX];
dest[GREEN_PIX] = src[GREEN_PIX] + aux[GREEN_PIX] * aux[ALPHA_PIX];
dest[BLUE_PIX] = src[BLUE_PIX] + aux[BLUE_PIX] * aux[ALPHA_PIX];
dest[ALPHA_PIX] = src[ALPHA_PIX];
#else
// Wrong, doesn't take layer opacity of Addition-mode layer into
// account
dest[RED_PIX] = src[RED_PIX] + aux[RED_PIX]; dest[RED_PIX] = src[RED_PIX] + aux[RED_PIX];
dest[GREEN_PIX] = src[GREEN_PIX] + aux[GREEN_PIX]; dest[GREEN_PIX] = src[GREEN_PIX] + aux[GREEN_PIX];
dest[BLUE_PIX] = src[BLUE_PIX] + aux[BLUE_PIX]; dest[BLUE_PIX] = src[BLUE_PIX] + aux[BLUE_PIX];
dest[ALPHA_PIX] = src[ALPHA_PIX]; dest[ALPHA_PIX] = src[ALPHA_PIX];
#else
// Wrong, toggling visibility of completely transparent
// Addition-mode layer changes projection
dest[RED_PIX] = src[RED_PIX] * src[ALPHA_PIX] + aux[RED_PIX] * aux[ALPHA_PIX]; dest[RED_PIX] = src[RED_PIX] * src[ALPHA_PIX] + aux[RED_PIX] * aux[ALPHA_PIX];
dest[GREEN_PIX] = src[GREEN_PIX] * src[ALPHA_PIX] + aux[GREEN_PIX] * aux[ALPHA_PIX]; dest[GREEN_PIX] = src[GREEN_PIX] * src[ALPHA_PIX] + aux[GREEN_PIX] * aux[ALPHA_PIX];
dest[BLUE_PIX] = src[BLUE_PIX] * src[ALPHA_PIX] + aux[BLUE_PIX] * aux[ALPHA_PIX]; dest[BLUE_PIX] = src[BLUE_PIX] * src[ALPHA_PIX] + aux[BLUE_PIX] * aux[ALPHA_PIX];