app: added gegl erase mode

This commit is contained in:
Ville Sokk
2012-04-28 19:34:10 +03:00
committed by Michael Natterer
parent c24ff24311
commit c5d7aaf52e
2 changed files with 36 additions and 12 deletions

View File

@ -324,7 +324,6 @@ gimp_gegl_node_set_layer_mode (GeglNode *node,
case GIMP_COLOR_MODE:
case GIMP_VALUE_MODE:
case GIMP_COLOR_ERASE_MODE:
case GIMP_ERASE_MODE:
case GIMP_ANTI_ERASE_MODE:
gegl_node_set (node,
"operation", "gimp:point-layer-mode",

View File

@ -3,6 +3,7 @@
*
* gimpoperationerasemode.c
* Copyright (C) 2008 Michael Natterer <mitch@gimp.org>
* 2012 Ville Sokk <ville.sokk@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -72,20 +73,44 @@ gimp_operation_erase_mode_process (GeglOperation *operation,
const GeglRectangle *roi,
gint level)
{
gfloat *in = in_buf;
gfloat *layer = aux_buf;
gfloat *out = out_buf;
GimpOperationPointLayerMode *point = GIMP_OPERATION_POINT_LAYER_MODE (operation);
gfloat *in = in_buf;
gfloat *layer = aux_buf;
gfloat *out = out_buf;
while (samples--)
if (point->premultiplied)
{
out[RED] = in[RED];
out[GREEN] = in[GREEN];
out[BLUE] = in[BLUE];
out[ALPHA] = in[ALPHA];
while (samples--)
{
gint b;
in += 4;
layer += 4;
out += 4;
out[ALPHA] = in[ALPHA] - in[ALPHA] * layer[ALPHA];
for (b = RED; b < ALPHA; b++)
{
out[b] = in[b] / in[ALPHA] * out[ALPHA];
}
in += 4;
layer += 4;
out += 4;
}
}
else
{
while (samples--)
{
gint b;
for (b = RED; b < ALPHA; b++)
{
out[b] = in[b];
}
out[ALPHA] = in[ALPHA] - in[ALPHA] * layer[ALPHA];;
in += 4;
layer += 4;
out += 4;
}
}
return TRUE;