[gimp/goat-invasion: 567/608] app: added initial gegl replace mode
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/goat-invasion: 567/608] app: added initial gegl replace mode
- Date: Fri, 27 Apr 2012 21:13:02 +0000 (UTC)
commit 014a8d083c29bf556c097f16519b62e19d6e7727
Author: Ville Sokk <ville sokk gmail com>
Date: Tue Apr 24 12:25:19 2012 +0300
app: added initial gegl replace mode
app/gegl/gimp-gegl-nodes.c | 1 -
app/gegl/gimpoperationreplacemode.c | 24 ++++++++++++++++++++----
2 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-nodes.c b/app/gegl/gimp-gegl-nodes.c
index dde78ce..a750634 100644
--- a/app/gegl/gimp-gegl-nodes.c
+++ b/app/gegl/gimp-gegl-nodes.c
@@ -256,7 +256,6 @@ gimp_gegl_node_set_layer_mode (GeglNode *node,
case GIMP_VALUE_MODE:
case GIMP_COLOR_ERASE_MODE:
case GIMP_ERASE_MODE:
- case GIMP_REPLACE_MODE:
case GIMP_ANTI_ERASE_MODE:
gegl_node_set (node,
"operation", "gimp:point-layer-mode",
diff --git a/app/gegl/gimpoperationreplacemode.c b/app/gegl/gimpoperationreplacemode.c
index e8cd21c..2143772 100644
--- a/app/gegl/gimpoperationreplacemode.c
+++ b/app/gegl/gimpoperationreplacemode.c
@@ -78,10 +78,26 @@ gimp_operation_replace_mode_process (GeglOperation *operation,
while (samples--)
{
- out[RED] = in[RED];
- out[GREEN] = in[GREEN];
- out[BLUE] = in[BLUE];
- out[ALPHA] = in[ALPHA];
+ gint b;
+ gfloat ratio = 1 / layer[ALPHA] / layer[ALPHA];
+
+ for (b = RED; b < ALPHA; b++)
+ {
+ gfloat t;
+
+ if (layer[b] > in[b])
+ {
+ t = (layer[b] - in[b]) * ratio;
+ out[b] = in[b] + t;
+ }
+ else
+ {
+ t= (in[b] - layer[b]) * ratio;
+ out[b] = in[b] - t;
+ }
+ }
+
+ out[ALPHA] = layer[ALPHA];
in += 4;
layer += 4;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]