app: added gegl erase mode
This commit is contained in:

committed by
Michael Natterer

parent
c24ff24311
commit
c5d7aaf52e
@ -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",
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user