[gimp] Extract layer mode blend functions



commit 413a516f8e77db9d9977c5a7f47a4fa9cc710554
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Tue May 21 04:02:26 2013 -0700

    Extract layer mode blend functions
    
    Extract layer mode blend functions form their operations so
    they can be used directly by paintcore.

 app/operations/Makefile.am                     |    5 +-
 app/operations/gimplayermodefunctions.c        |   97 ++++++++++++++++++++++++
 app/operations/gimplayermodefunctions.h        |   26 ++++++
 app/operations/gimpoperationadditionmode.c     |   18 ++++-
 app/operations/gimpoperationadditionmode.h     |    8 ++
 app/operations/gimpoperationantierasemode.c    |   22 ++++--
 app/operations/gimpoperationantierasemode.h    |    9 ++
 app/operations/gimpoperationbehindmode.c       |   23 ++++--
 app/operations/gimpoperationbehindmode.h       |    8 ++
 app/operations/gimpoperationburnmode.c         |   22 ++++--
 app/operations/gimpoperationburnmode.h         |    8 ++
 app/operations/gimpoperationcolorerasemode.c   |   22 ++++--
 app/operations/gimpoperationcolorerasemode.h   |    8 ++
 app/operations/gimpoperationcolormode.c        |   20 ++++-
 app/operations/gimpoperationcolormode.h        |    8 ++
 app/operations/gimpoperationdarkenonlymode.c   |   22 ++++--
 app/operations/gimpoperationdarkenonlymode.h   |    8 ++
 app/operations/gimpoperationdifferencemode.c   |   20 ++++-
 app/operations/gimpoperationdifferencemode.h   |    9 ++
 app/operations/gimpoperationdissolvemode.c     |   26 +++++--
 app/operations/gimpoperationdissolvemode.h     |    8 ++
 app/operations/gimpoperationdividemode.c       |   22 ++++--
 app/operations/gimpoperationdividemode.h       |    8 ++
 app/operations/gimpoperationdodgemode.c        |   22 ++++--
 app/operations/gimpoperationdodgemode.h        |    8 ++
 app/operations/gimpoperationerasemode.c        |   23 ++++--
 app/operations/gimpoperationerasemode.h        |    8 ++
 app/operations/gimpoperationgrainextractmode.c |   22 ++++--
 app/operations/gimpoperationgrainextractmode.h |    8 ++
 app/operations/gimpoperationgrainmergemode.c   |   22 ++++--
 app/operations/gimpoperationgrainmergemode.h   |    8 ++
 app/operations/gimpoperationhardlightmode.c    |   20 ++++-
 app/operations/gimpoperationhardlightmode.h    |    8 ++
 app/operations/gimpoperationhuemode.c          |   20 ++++-
 app/operations/gimpoperationhuemode.h          |    8 ++
 app/operations/gimpoperationlightenonlymode.c  |   22 ++++--
 app/operations/gimpoperationlightenonlymode.h  |    8 ++
 app/operations/gimpoperationmultiplymode.c     |   20 ++++-
 app/operations/gimpoperationmultiplymode.h     |    8 ++
 app/operations/gimpoperationnormalmode.c       |   23 ++++--
 app/operations/gimpoperationnormalmode.h       |   10 +++
 app/operations/gimpoperationoverlaymode.c      |   20 ++++-
 app/operations/gimpoperationoverlaymode.h      |    8 ++
 app/operations/gimpoperationreplacemode.c      |   20 ++++--
 app/operations/gimpoperationreplacemode.h      |    8 ++
 app/operations/gimpoperationsaturationmode.c   |   20 ++++-
 app/operations/gimpoperationsaturationmode.h   |    8 ++
 app/operations/gimpoperationscreenmode.c       |   20 ++++-
 app/operations/gimpoperationscreenmode.h       |    9 ++
 app/operations/gimpoperationsoftlightmode.c    |   20 ++++-
 app/operations/gimpoperationsoftlightmode.h    |    8 ++
 app/operations/gimpoperationsubtractmode.c     |   20 ++++-
 app/operations/gimpoperationsubtractmode.h     |    8 ++
 app/operations/gimpoperationvaluemode.c        |   22 ++++--
 app/operations/gimpoperationvaluemode.h        |    8 ++
 app/operations/operations-types.h              |   11 +++
 56 files changed, 755 insertions(+), 150 deletions(-)
---
diff --git a/app/operations/Makefile.am b/app/operations/Makefile.am
index 59b8b3a..86cfd8a 100644
--- a/app/operations/Makefile.am
+++ b/app/operations/Makefile.am
@@ -141,6 +141,9 @@ libappoperations_a_sources = \
        gimpoperationreplacemode.c              \
        gimpoperationreplacemode.h              \
        gimpoperationantierasemode.c            \
-       gimpoperationantierasemode.h
+       gimpoperationantierasemode.h            \
+       \
+       gimplayermodefunctions.c                \
+       gimplayermodefunctions.h
 
 libappoperations_a_SOURCES = $(libappoperations_a_sources)
diff --git a/app/operations/gimplayermodefunctions.c b/app/operations/gimplayermodefunctions.c
new file mode 100644
index 0000000..94b1256
--- /dev/null
+++ b/app/operations/gimplayermodefunctions.c
@@ -0,0 +1,97 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
+ *
+ * gimplayermodefunctions.c
+ * Copyright (C) 2013 Daniel Sabo <DanielSabo 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <gegl.h>
+#include <gegl-plugin.h>
+#include "operations-types.h"
+
+#include "gimplayermodefunctions.h"
+
+#include "gimpoperationpointlayermode.h"
+#include "gimpoperationnormalmode.h"
+#include "gimpoperationdissolvemode.h"
+#include "gimpoperationbehindmode.h"
+#include "gimpoperationmultiplymode.h"
+#include "gimpoperationscreenmode.h"
+#include "gimpoperationoverlaymode.h"
+#include "gimpoperationdifferencemode.h"
+#include "gimpoperationadditionmode.h"
+#include "gimpoperationsubtractmode.h"
+#include "gimpoperationdarkenonlymode.h"
+#include "gimpoperationlightenonlymode.h"
+#include "gimpoperationhuemode.h"
+#include "gimpoperationsaturationmode.h"
+#include "gimpoperationcolormode.h"
+#include "gimpoperationvaluemode.h"
+#include "gimpoperationdividemode.h"
+#include "gimpoperationdodgemode.h"
+#include "gimpoperationburnmode.h"
+#include "gimpoperationhardlightmode.h"
+#include "gimpoperationsoftlightmode.h"
+#include "gimpoperationgrainextractmode.h"
+#include "gimpoperationgrainmergemode.h"
+#include "gimpoperationcolorerasemode.h"
+#include "gimpoperationerasemode.h"
+#include "gimpoperationreplacemode.h"
+#include "gimpoperationantierasemode.h"
+
+GimpLayerModeFunction
+get_layer_mode_function (GimpLayerModeEffects paint_mode)
+{
+  GimpLayerModeFunction func = gimp_operation_normal_mode_process_pixels;
+
+  switch (paint_mode)
+    {
+      case GIMP_NORMAL_MODE:        func = gimp_operation_normal_mode_process_pixels; break;
+      case GIMP_DISSOLVE_MODE:      func = gimp_operation_dissolve_mode_process_pixels; break;
+      case GIMP_BEHIND_MODE:        func = gimp_operation_behind_mode_process_pixels; break;
+      case GIMP_MULTIPLY_MODE:      func = gimp_operation_multiply_mode_process_pixels; break;
+      case GIMP_SCREEN_MODE:        func = gimp_operation_screen_mode_process_pixels; break;
+      case GIMP_OVERLAY_MODE:       func = gimp_operation_overlay_mode_process_pixels; break;
+      case GIMP_DIFFERENCE_MODE:    func = gimp_operation_difference_mode_process_pixels; break;
+      case GIMP_ADDITION_MODE:      func = gimp_operation_addition_mode_process_pixels; break;
+      case GIMP_SUBTRACT_MODE:      func = gimp_operation_subtract_mode_process_pixels; break;
+      case GIMP_DARKEN_ONLY_MODE:   func = gimp_operation_darken_only_mode_process_pixels; break;
+      case GIMP_LIGHTEN_ONLY_MODE:  func = gimp_operation_lighten_only_mode_process_pixels; break;
+      case GIMP_HUE_MODE:           func = gimp_operation_hue_mode_process_pixels; break;
+      case GIMP_SATURATION_MODE:    func = gimp_operation_saturation_mode_process_pixels; break;
+      case GIMP_COLOR_MODE:         func = gimp_operation_color_mode_process_pixels; break;
+      case GIMP_VALUE_MODE:         func = gimp_operation_value_mode_process_pixels; break;
+      case GIMP_DIVIDE_MODE:        func = gimp_operation_divide_mode_process_pixels; break;
+      case GIMP_DODGE_MODE:         func = gimp_operation_dodge_mode_process_pixels; break;
+      case GIMP_BURN_MODE:          func = gimp_operation_burn_mode_process_pixels; break;
+      case GIMP_HARDLIGHT_MODE:     func = gimp_operation_hardlight_mode_process_pixels; break;
+      case GIMP_SOFTLIGHT_MODE:     func = gimp_operation_softlight_mode_process_pixels; break;
+      case GIMP_GRAIN_EXTRACT_MODE: func = gimp_operation_grain_extract_mode_process_pixels; break;
+      case GIMP_GRAIN_MERGE_MODE:   func = gimp_operation_grain_merge_mode_process_pixels; break;
+      case GIMP_COLOR_ERASE_MODE:   func = gimp_operation_color_erase_mode_process_pixels; break;
+      case GIMP_ERASE_MODE:         func = gimp_operation_erase_mode_process_pixels; break;
+      case GIMP_REPLACE_MODE:       func = gimp_operation_replace_mode_process_pixels; break;
+      case GIMP_ANTI_ERASE_MODE:    func = gimp_operation_anti_erase_mode_process_pixels; break;
+      default:
+        g_warning ("No direct function for layer mode (%d), using gimp:normal-mode", paint_mode);
+        func = gimp_operation_normal_mode_process_pixels;
+        break;
+    }
+
+  return func;
+}
diff --git a/app/operations/gimplayermodefunctions.h b/app/operations/gimplayermodefunctions.h
new file mode 100644
index 0000000..f92a61f
--- /dev/null
+++ b/app/operations/gimplayermodefunctions.h
@@ -0,0 +1,26 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
+ *
+ * gimplayermodefunctions.h
+ * Copyright (C) 2013 Daniel Sabo <DanielSabo 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_LAYER_MODE_FUNCTIONS_H__
+#define __GIMP_LAYER_MODE_FUNCTIONS_H__
+
+GimpLayerModeFunction get_layer_mode_function (GimpLayerModeEffects paint_mode);
+
+#endif /* __GIMP_LAYER_MODE_FUNCTIONS_H__ */
diff --git a/app/operations/gimpoperationadditionmode.c b/app/operations/gimpoperationadditionmode.c
index 7c24c02..ec1df76 100644
--- a/app/operations/gimpoperationadditionmode.c
+++ b/app/operations/gimpoperationadditionmode.c
@@ -76,10 +76,20 @@ gimp_operation_addition_mode_process (GeglOperation       *operation,
                                       gint                 level)
 {
   gdouble        opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat        *in       = in_buf;
-  gfloat        *layer    = aux_buf;
-  gfloat        *mask     = aux2_buf;
-  gfloat        *out      = out_buf;
+
+  return gimp_operation_addition_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+}
+
+gboolean
+gimp_operation_addition_mode_process_pixels (gfloat              *in,
+                                             gfloat              *layer,
+                                             gfloat              *mask,
+                                             gfloat              *out,
+                                             gdouble              opacity,
+                                             glong                samples,
+                                             const GeglRectangle *roi,
+                                             gint                 level)
+{
   const gboolean has_mask = mask != NULL;
 
   while (samples--)
diff --git a/app/operations/gimpoperationadditionmode.h b/app/operations/gimpoperationadditionmode.h
index c1c3208..6d0a5d7 100644
--- a/app/operations/gimpoperationadditionmode.h
+++ b/app/operations/gimpoperationadditionmode.h
@@ -50,5 +50,13 @@ struct _GimpOperationAdditionModeClass
 
 GType   gimp_operation_addition_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_addition_mode_process_pixels (gfloat              *in,
+                                                      gfloat              *layer,
+                                                      gfloat              *mask,
+                                                      gfloat              *out,
+                                                      gdouble              opacity,
+                                                      glong                samples,
+                                                      const GeglRectangle *roi,
+                                                      gint                 level);
 
 #endif /* __GIMP_OPERATION_ADDITION_MODE_H__ */
diff --git a/app/operations/gimpoperationantierasemode.c b/app/operations/gimpoperationantierasemode.c
index 5ae51ca..0fef9d1 100644
--- a/app/operations/gimpoperationantierasemode.c
+++ b/app/operations/gimpoperationantierasemode.c
@@ -88,12 +88,22 @@ gimp_operation_anti_erase_mode_process (GeglOperation       *operation,
                                         const GeglRectangle *roi,
                                         gint                 level)
 {
-  gdouble         opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat         *in       = in_buf;
-  gfloat         *layer    = aux_buf;
-  gfloat         *mask     = aux2_buf;
-  gfloat         *out      = out_buf;
-  const gboolean  has_mask = mask != NULL;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_anti_erase_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, 
samples, roi, level);
+}
+
+gboolean
+gimp_operation_anti_erase_mode_process_pixels (gfloat              *in,
+                                               gfloat              *layer,
+                                               gfloat              *mask,
+                                               gfloat              *out,
+                                               gdouble              opacity,
+                                               glong                samples,
+                                               const GeglRectangle *roi,
+                                               gint                 level)
+{
+  const gboolean has_mask = mask != NULL;
 
   while (samples--)
     {
diff --git a/app/operations/gimpoperationantierasemode.h b/app/operations/gimpoperationantierasemode.h
index fe5022c..c8cf811 100644
--- a/app/operations/gimpoperationantierasemode.h
+++ b/app/operations/gimpoperationantierasemode.h
@@ -51,4 +51,13 @@ struct _GimpOperationAntiEraseModeClass
 GType   gimp_operation_anti_erase_mode_get_type (void) G_GNUC_CONST;
 
 
+gboolean gimp_operation_anti_erase_mode_process_pixels (gfloat              *in,
+                                                        gfloat              *layer,
+                                                        gfloat              *mask,
+                                                        gfloat              *out,
+                                                        gdouble              opacity,
+                                                        glong                samples,
+                                                        const GeglRectangle *roi,
+                                                        gint                 level);
+
 #endif /* __GIMP_OPERATION_ANTI_ERASE_MODE_H__ */
diff --git a/app/operations/gimpoperationbehindmode.c b/app/operations/gimpoperationbehindmode.c
index 3825a29..68a2b24 100644
--- a/app/operations/gimpoperationbehindmode.c
+++ b/app/operations/gimpoperationbehindmode.c
@@ -75,13 +75,22 @@ gimp_operation_behind_mode_process (GeglOperation       *operation,
                                     const GeglRectangle *roi,
                                     gint                 level)
 {
-  GimpOperationPointLayerMode *point    = GIMP_OPERATION_POINT_LAYER_MODE (operation);
-  gdouble                      opacity  = point->opacity;
-  gfloat                      *in       = in_buf;
-  gfloat                      *layer    = aux_buf;
-  gfloat                      *mask     = aux2_buf;
-  gfloat                      *out      = out_buf;
-  const gboolean               has_mask = mask != NULL;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_behind_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+}
+
+gboolean
+gimp_operation_behind_mode_process_pixels (gfloat              *in,
+                                           gfloat              *layer,
+                                           gfloat              *mask,
+                                           gfloat              *out,
+                                           gdouble              opacity,
+                                           glong                samples,
+                                           const GeglRectangle *roi,
+                                           gint                 level)
+{
+  const gboolean has_mask = mask != NULL;
 
   while (samples--)
     {
diff --git a/app/operations/gimpoperationbehindmode.h b/app/operations/gimpoperationbehindmode.h
index 87dc380..f7d822f 100644
--- a/app/operations/gimpoperationbehindmode.h
+++ b/app/operations/gimpoperationbehindmode.h
@@ -50,5 +50,13 @@ struct _GimpOperationBehindModeClass
 
 GType   gimp_operation_behind_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_behind_mode_process_pixels (gfloat              *in,
+                                                    gfloat              *layer,
+                                                    gfloat              *mask,
+                                                    gfloat              *out,
+                                                    gdouble              opacity,
+                                                    glong                samples,
+                                                    const GeglRectangle *roi,
+                                                    gint                 level);
 
 #endif /* __GIMP_OPERATION_BEHIND_MODE_H__ */
diff --git a/app/operations/gimpoperationburnmode.c b/app/operations/gimpoperationburnmode.c
index 1937951..9e55414 100644
--- a/app/operations/gimpoperationburnmode.c
+++ b/app/operations/gimpoperationburnmode.c
@@ -75,11 +75,21 @@ gimp_operation_burn_mode_process (GeglOperation       *operation,
                                   const GeglRectangle *roi,
                                   gint                 level)
 {
-  gdouble        opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat        *in       = in_buf;
-  gfloat        *layer    = aux_buf;
-  gfloat        *mask     = aux2_buf;
-  gfloat        *out      = out_buf;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_burn_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, roi, 
level);
+}
+
+gboolean
+gimp_operation_burn_mode_process_pixels (gfloat              *in,
+                                         gfloat              *layer,
+                                         gfloat              *mask,
+                                         gfloat              *out,
+                                         gdouble              opacity,
+                                         glong                samples,
+                                         const GeglRectangle *roi,
+                                         gint                 level)
+{
   const gboolean has_mask = mask != NULL;
 
   while (samples--)
@@ -126,4 +136,4 @@ gimp_operation_burn_mode_process (GeglOperation       *operation,
     }
 
   return TRUE;
-}
+}
\ No newline at end of file
diff --git a/app/operations/gimpoperationburnmode.h b/app/operations/gimpoperationburnmode.h
index a4cf7fa..ccfd5f4 100644
--- a/app/operations/gimpoperationburnmode.h
+++ b/app/operations/gimpoperationburnmode.h
@@ -50,5 +50,13 @@ struct _GimpOperationBurnModeClass
 
 GType   gimp_operation_burn_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_burn_mode_process_pixels (gfloat              *in,
+                                                  gfloat              *layer,
+                                                  gfloat              *mask,
+                                                  gfloat              *out,
+                                                  gdouble              opacity,
+                                                  glong                samples,
+                                                  const GeglRectangle *roi,
+                                                  gint                 level);
 
 #endif /* __GIMP_OPERATION_BURN_MODE_H__ */
diff --git a/app/operations/gimpoperationcolorerasemode.c b/app/operations/gimpoperationcolorerasemode.c
index a832437..79d1f9c 100644
--- a/app/operations/gimpoperationcolorerasemode.c
+++ b/app/operations/gimpoperationcolorerasemode.c
@@ -79,12 +79,22 @@ gimp_operation_color_erase_mode_process (GeglOperation       *operation,
                                          const GeglRectangle *roi,
                                          gint                 level)
 {
-  gdouble         opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat         *in       = in_buf;
-  gfloat         *layer    = aux_buf;
-  gfloat         *mask     = aux2_buf;
-  gfloat         *out      = out_buf;
-  const gboolean  has_mask = mask != NULL;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_color_erase_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, 
samples, roi, level);
+}
+
+gboolean
+gimp_operation_color_erase_mode_process_pixels (gfloat              *in,
+                                                gfloat              *layer,
+                                                gfloat              *mask,
+                                                gfloat              *out,
+                                                gdouble              opacity,
+                                                glong                samples,
+                                                const GeglRectangle *roi,
+                                                gint                 level)
+{
+  const gboolean has_mask = mask != NULL;
 
   while (samples--)
     {
diff --git a/app/operations/gimpoperationcolorerasemode.h b/app/operations/gimpoperationcolorerasemode.h
index 5c16dc2..0f9605b 100644
--- a/app/operations/gimpoperationcolorerasemode.h
+++ b/app/operations/gimpoperationcolorerasemode.h
@@ -50,5 +50,13 @@ struct _GimpOperationColorEraseModeClass
 
 GType   gimp_operation_color_erase_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_color_erase_mode_process_pixels (gfloat              *in,
+                                                         gfloat              *layer,
+                                                         gfloat              *mask,
+                                                         gfloat              *out,
+                                                         gdouble              opacity,
+                                                         glong                samples,
+                                                         const GeglRectangle *roi,
+                                                         gint                 level);
 
 #endif /* __GIMP_OPERATION_COLOR_ERASE_MODE_H__ */
diff --git a/app/operations/gimpoperationcolormode.c b/app/operations/gimpoperationcolormode.c
index ad787f5..e5e9ae3 100644
--- a/app/operations/gimpoperationcolormode.c
+++ b/app/operations/gimpoperationcolormode.c
@@ -79,11 +79,21 @@ gimp_operation_color_mode_process (GeglOperation       *operation,
                                    const GeglRectangle *roi,
                                    gint                 level)
 {
-  gdouble        opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat        *in       = in_buf;
-  gfloat        *layer    = aux_buf;
-  gfloat        *mask     = aux2_buf;
-  gfloat        *out      = out_buf;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_color_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+}
+
+gboolean
+gimp_operation_color_mode_process_pixels (gfloat              *in,
+                                          gfloat              *layer,
+                                          gfloat              *mask,
+                                          gfloat              *out,
+                                          gdouble              opacity,
+                                          glong                samples,
+                                          const GeglRectangle *roi,
+                                          gint                 level)
+{
   const gboolean has_mask = mask != NULL;
 
   while (samples--)
diff --git a/app/operations/gimpoperationcolormode.h b/app/operations/gimpoperationcolormode.h
index 2ee7d8c..e45905f 100644
--- a/app/operations/gimpoperationcolormode.h
+++ b/app/operations/gimpoperationcolormode.h
@@ -50,5 +50,13 @@ struct _GimpOperationColorModeClass
 
 GType   gimp_operation_color_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_color_mode_process_pixels (gfloat              *in,
+                                                   gfloat              *layer,
+                                                   gfloat              *mask,
+                                                   gfloat              *out,
+                                                   gdouble              opacity,
+                                                   glong                samples,
+                                                   const GeglRectangle *roi,
+                                                   gint                 level);
 
 #endif /* __GIMP_OPERATION_COLOR_MODE_H__ */
diff --git a/app/operations/gimpoperationdarkenonlymode.c b/app/operations/gimpoperationdarkenonlymode.c
index 3700410..7e05816 100644
--- a/app/operations/gimpoperationdarkenonlymode.c
+++ b/app/operations/gimpoperationdarkenonlymode.c
@@ -75,11 +75,21 @@ gimp_operation_darken_only_mode_process (GeglOperation       *operation,
                                          const GeglRectangle *roi,
                                          gint                 level)
 {
-  gdouble        opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat        *in       = in_buf;
-  gfloat        *layer    = aux_buf;
-  gfloat        *mask     = aux2_buf;
-  gfloat        *out      = out_buf;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_darken_only_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, 
samples, roi, level);
+}
+
+gboolean
+gimp_operation_darken_only_mode_process_pixels (gfloat              *in,
+                                                gfloat              *layer,
+                                                gfloat              *mask,
+                                                gfloat              *out,
+                                                gdouble              opacity,
+                                                glong                samples,
+                                                const GeglRectangle *roi,
+                                                gint                 level)
+{
   const gboolean has_mask = mask != NULL;
 
   while (samples--)
@@ -125,4 +135,4 @@ gimp_operation_darken_only_mode_process (GeglOperation       *operation,
     }
 
   return TRUE;
-}
+}
\ No newline at end of file
diff --git a/app/operations/gimpoperationdarkenonlymode.h b/app/operations/gimpoperationdarkenonlymode.h
index 37c08c2..e6e7121 100644
--- a/app/operations/gimpoperationdarkenonlymode.h
+++ b/app/operations/gimpoperationdarkenonlymode.h
@@ -50,5 +50,13 @@ struct _GimpOperationDarkenOnlyModeClass
 
 GType   gimp_operation_darken_only_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_darken_only_mode_process_pixels (gfloat              *in,
+                                                         gfloat              *layer,
+                                                         gfloat              *mask,
+                                                         gfloat              *out,
+                                                         gdouble              opacity,
+                                                         glong                samples,
+                                                         const GeglRectangle *roi,
+                                                         gint                 level);
 
 #endif /* __GIMP_OPERATION_DARKEN_ONLY_MODE_H__ */
diff --git a/app/operations/gimpoperationdifferencemode.c b/app/operations/gimpoperationdifferencemode.c
index 1fa065b..35d4b0d 100644
--- a/app/operations/gimpoperationdifferencemode.c
+++ b/app/operations/gimpoperationdifferencemode.c
@@ -75,11 +75,21 @@ gimp_operation_difference_mode_process (GeglOperation       *operation,
                                         const GeglRectangle *roi,
                                         gint                 level)
 {
-  gdouble        opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat        *in       = in_buf;
-  gfloat        *layer    = aux_buf;
-  gfloat        *mask     = aux2_buf;
-  gfloat        *out      = out_buf;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_difference_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, 
samples, roi, level);
+}
+
+gboolean
+gimp_operation_difference_mode_process_pixels (gfloat              *in,
+                                               gfloat              *layer,
+                                               gfloat              *mask,
+                                               gfloat              *out,
+                                               gdouble              opacity,
+                                               glong                samples,
+                                               const GeglRectangle *roi,
+                                               gint                 level)
+{
   const gboolean has_mask = mask != NULL;
 
   while (samples--)
diff --git a/app/operations/gimpoperationdifferencemode.h b/app/operations/gimpoperationdifferencemode.h
index 9ff0f99..8919043 100644
--- a/app/operations/gimpoperationdifferencemode.h
+++ b/app/operations/gimpoperationdifferencemode.h
@@ -51,4 +51,13 @@ struct _GimpOperationDifferenceModeClass
 GType   gimp_operation_difference_mode_get_type (void) G_GNUC_CONST;
 
 
+gboolean gimp_operation_difference_mode_process_pixels (gfloat              *in,
+                                                        gfloat              *layer,
+                                                        gfloat              *mask,
+                                                        gfloat              *out,
+                                                        gdouble              opacity,
+                                                        glong                samples,
+                                                        const GeglRectangle *roi,
+                                                        gint                 level);
+
 #endif /* __GIMP_OPERATION_DIFFERENCE_MODE_H__ */
diff --git a/app/operations/gimpoperationdissolvemode.c b/app/operations/gimpoperationdissolvemode.c
index f6500a2..f143850 100644
--- a/app/operations/gimpoperationdissolvemode.c
+++ b/app/operations/gimpoperationdissolvemode.c
@@ -91,13 +91,23 @@ gimp_operation_dissolve_mode_process (GeglOperation       *operation,
                                       const GeglRectangle *result,
                                       gint                 level)
 {
-  gdouble         opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat         *in       = in_buf;
-  gfloat         *out      = out_buf;
-  gfloat         *aux      = aux_buf;
-  gfloat         *mask     = aux2_buf;
-  const gboolean  has_mask = mask != NULL;
-  gint            x, y;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_dissolve_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
result, level);
+}
+
+gboolean
+gimp_operation_dissolve_mode_process_pixels (gfloat              *in,
+                                             gfloat              *aux,
+                                             gfloat              *mask,
+                                             gfloat              *out,
+                                             gdouble              opacity,
+                                             glong                samples,
+                                             const GeglRectangle *result,
+                                             gint                 level)
+{
+  const gboolean has_mask = mask != NULL;
+  gint           x, y;
 
   for (y = result->y; y < result->y + result->height; y++)
     {
@@ -140,4 +150,4 @@ gimp_operation_dissolve_mode_process (GeglOperation       *operation,
     }
 
   return TRUE;
-}
+}
\ No newline at end of file
diff --git a/app/operations/gimpoperationdissolvemode.h b/app/operations/gimpoperationdissolvemode.h
index c14cf71..29a9c13 100644
--- a/app/operations/gimpoperationdissolvemode.h
+++ b/app/operations/gimpoperationdissolvemode.h
@@ -50,5 +50,13 @@ struct _GimpOperationDissolveMode
 
 GType   gimp_operation_dissolve_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_dissolve_mode_process_pixels (gfloat              *in,
+                                                      gfloat              *layer,
+                                                      gfloat              *mask,
+                                                      gfloat              *out,
+                                                      gdouble              opacity,
+                                                      glong                samples,
+                                                      const GeglRectangle *result,
+                                                      gint                 level);
 
 #endif /* __GIMP_OPERATION_DISSOLVE_MODE_H__ */
diff --git a/app/operations/gimpoperationdividemode.c b/app/operations/gimpoperationdividemode.c
index 87ac6da..5959114 100644
--- a/app/operations/gimpoperationdividemode.c
+++ b/app/operations/gimpoperationdividemode.c
@@ -75,11 +75,21 @@ gimp_operation_divide_mode_process (GeglOperation       *operation,
                                     const GeglRectangle *roi,
                                     gint                 level)
 {
-  gdouble        opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat        *in       = in_buf;
-  gfloat        *layer    = aux_buf;
-  gfloat        *mask     = aux2_buf;
-  gfloat        *out      = out_buf;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_divide_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+}
+
+gboolean
+gimp_operation_divide_mode_process_pixels (gfloat              *in,
+                                           gfloat              *layer,
+                                           gfloat              *mask,
+                                           gfloat              *out,
+                                           gdouble              opacity,
+                                           glong                samples,
+                                           const GeglRectangle *roi,
+                                           gint                 level)
+{
   const gboolean has_mask = mask != NULL;
 
   while (samples--)
@@ -126,4 +136,4 @@ gimp_operation_divide_mode_process (GeglOperation       *operation,
     }
 
   return TRUE;
-}
+}
\ No newline at end of file
diff --git a/app/operations/gimpoperationdividemode.h b/app/operations/gimpoperationdividemode.h
index b752c55..6ca13b2 100644
--- a/app/operations/gimpoperationdividemode.h
+++ b/app/operations/gimpoperationdividemode.h
@@ -50,5 +50,13 @@ struct _GimpOperationDivideModeClass
 
 GType   gimp_operation_divide_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_divide_mode_process_pixels (gfloat              *in,
+                                                    gfloat              *layer,
+                                                    gfloat              *mask,
+                                                    gfloat              *out,
+                                                    gdouble              opacity,
+                                                    glong                samples,
+                                                    const GeglRectangle *roi,
+                                                    gint                 level);
 
 #endif /* __GIMP_OPERATION_DIVIDE_MODE_H__ */
diff --git a/app/operations/gimpoperationdodgemode.c b/app/operations/gimpoperationdodgemode.c
index 24d9902..8833e25 100644
--- a/app/operations/gimpoperationdodgemode.c
+++ b/app/operations/gimpoperationdodgemode.c
@@ -75,11 +75,21 @@ gimp_operation_dodge_mode_process (GeglOperation       *operation,
                                    const GeglRectangle *roi,
                                    gint                 level)
 {
-  gdouble        opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat        *in       = in_buf;
-  gfloat        *layer    = aux_buf;
-  gfloat        *mask     = aux2_buf;
-  gfloat        *out      = out_buf;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_dodge_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+}
+
+gboolean
+gimp_operation_dodge_mode_process_pixels (gfloat              *in,
+                                          gfloat              *layer,
+                                          gfloat              *mask,
+                                          gfloat              *out,
+                                          gdouble              opacity,
+                                          glong                samples,
+                                          const GeglRectangle *roi,
+                                          gint                 level)
+{
   const gboolean has_mask = mask != NULL;
 
   while (samples--)
@@ -126,4 +136,4 @@ gimp_operation_dodge_mode_process (GeglOperation       *operation,
     }
 
   return TRUE;
-}
+}
\ No newline at end of file
diff --git a/app/operations/gimpoperationdodgemode.h b/app/operations/gimpoperationdodgemode.h
index 1f2802e..094440c 100644
--- a/app/operations/gimpoperationdodgemode.h
+++ b/app/operations/gimpoperationdodgemode.h
@@ -50,5 +50,13 @@ struct _GimpOperationDodgeModeClass
 
 GType   gimp_operation_dodge_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_dodge_mode_process_pixels (gfloat              *in,
+                                                   gfloat              *layer,
+                                                   gfloat              *mask,
+                                                   gfloat              *out,
+                                                   gdouble              opacity,
+                                                   glong                samples,
+                                                   const GeglRectangle *roi,
+                                                   gint                 level);
 
 #endif /* __GIMP_OPERATION_DODGE_MODE_H__ */
diff --git a/app/operations/gimpoperationerasemode.c b/app/operations/gimpoperationerasemode.c
index f20ee06..4debd08 100644
--- a/app/operations/gimpoperationerasemode.c
+++ b/app/operations/gimpoperationerasemode.c
@@ -88,13 +88,22 @@ gimp_operation_erase_mode_process (GeglOperation       *operation,
                                    const GeglRectangle *roi,
                                    gint                 level)
 {
-  GimpOperationPointLayerMode *point    = GIMP_OPERATION_POINT_LAYER_MODE (operation);
-  gdouble                      opacity  = point->opacity;
-  gfloat                      *in       = in_buf;
-  gfloat                      *layer    = aux_buf;
-  gfloat                      *mask     = aux2_buf;
-  gfloat                      *out      = out_buf;
-  const gboolean               has_mask = mask != NULL;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_erase_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+}
+
+gboolean
+gimp_operation_erase_mode_process_pixels (gfloat              *in,
+                                          gfloat              *layer,
+                                          gfloat              *mask,
+                                          gfloat              *out,
+                                          gdouble              opacity,
+                                          glong                samples,
+                                          const GeglRectangle *roi,
+                                          gint                 level)
+{
+  const gboolean has_mask = mask != NULL;
 
   while (samples--)
     {
diff --git a/app/operations/gimpoperationerasemode.h b/app/operations/gimpoperationerasemode.h
index aa0bd83..d1286cb 100644
--- a/app/operations/gimpoperationerasemode.h
+++ b/app/operations/gimpoperationerasemode.h
@@ -50,5 +50,13 @@ struct _GimpOperationEraseModeClass
 
 GType   gimp_operation_erase_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_erase_mode_process_pixels (gfloat              *in,
+                                                   gfloat              *layer,
+                                                   gfloat              *mask,
+                                                   gfloat              *out,
+                                                   gdouble              opacity,
+                                                   glong                samples,
+                                                   const GeglRectangle *roi,
+                                                   gint                 level);
 
 #endif /* __GIMP_OPERATION_ERASE_MODE_H__ */
diff --git a/app/operations/gimpoperationgrainextractmode.c b/app/operations/gimpoperationgrainextractmode.c
index 777b4f6..b378272 100644
--- a/app/operations/gimpoperationgrainextractmode.c
+++ b/app/operations/gimpoperationgrainextractmode.c
@@ -75,11 +75,21 @@ gimp_operation_grain_extract_mode_process (GeglOperation       *operation,
                                            const GeglRectangle *roi,
                                            gint                 level)
 {
-  gdouble        opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat        *in       = in_buf;
-  gfloat        *layer    = aux_buf;
-  gfloat        *mask     = aux2_buf;
-  gfloat        *out      = out_buf;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_grain_extract_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, 
samples, roi, level);
+}
+
+gboolean
+gimp_operation_grain_extract_mode_process_pixels (gfloat              *in,
+                                                  gfloat              *layer,
+                                                  gfloat              *mask,
+                                                  gfloat              *out,
+                                                  gdouble              opacity,
+                                                  glong                samples,
+                                                  const GeglRectangle *roi,
+                                                  gint                 level)
+{
   const gboolean has_mask = mask != NULL;
 
   while (samples--)
@@ -126,4 +136,4 @@ gimp_operation_grain_extract_mode_process (GeglOperation       *operation,
     }
 
   return TRUE;
-}
+}
\ No newline at end of file
diff --git a/app/operations/gimpoperationgrainextractmode.h b/app/operations/gimpoperationgrainextractmode.h
index c868e1b..d7645de 100644
--- a/app/operations/gimpoperationgrainextractmode.h
+++ b/app/operations/gimpoperationgrainextractmode.h
@@ -50,5 +50,13 @@ struct _GimpOperationGrainExtractModeClass
 
 GType   gimp_operation_grain_extract_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_grain_extract_mode_process_pixels (gfloat              *in,
+                                                           gfloat              *layer,
+                                                           gfloat              *mask,
+                                                           gfloat              *out,
+                                                           gdouble              opacity,
+                                                           glong                samples,
+                                                           const GeglRectangle *roi,
+                                                           gint                 level);
 
 #endif /* __GIMP_OPERATION_GRAIN_EXTRACT_MODE_H__ */
diff --git a/app/operations/gimpoperationgrainmergemode.c b/app/operations/gimpoperationgrainmergemode.c
index dba3e9b..a5c0bc8 100644
--- a/app/operations/gimpoperationgrainmergemode.c
+++ b/app/operations/gimpoperationgrainmergemode.c
@@ -75,12 +75,22 @@ gimp_operation_grain_merge_mode_process (GeglOperation       *operation,
                                          const GeglRectangle *roi,
                                          gint                 level)
 {
-  gdouble         opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat         *in       = in_buf;
-  gfloat         *layer    = aux_buf;
-  gfloat         *mask     = aux2_buf;
-  gfloat         *out      = out_buf;
-  const gboolean  has_mask = mask != NULL;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_grain_merge_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, 
samples, roi, level);
+}
+
+gboolean
+gimp_operation_grain_merge_mode_process_pixels (gfloat              *in,
+                                                gfloat              *layer,
+                                                gfloat              *mask,
+                                                gfloat              *out,
+                                                gdouble              opacity,
+                                                glong                samples,
+                                                const GeglRectangle *roi,
+                                                gint                 level)
+{
+  const gboolean has_mask = mask != NULL;
 
   while (samples--)
     {
diff --git a/app/operations/gimpoperationgrainmergemode.h b/app/operations/gimpoperationgrainmergemode.h
index faad727..763cde0 100644
--- a/app/operations/gimpoperationgrainmergemode.h
+++ b/app/operations/gimpoperationgrainmergemode.h
@@ -50,5 +50,13 @@ struct _GimpOperationGrainMergeModeClass
 
 GType   gimp_operation_grain_merge_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_grain_merge_mode_process_pixels (gfloat              *in,
+                                                         gfloat              *layer,
+                                                         gfloat              *mask,
+                                                         gfloat              *out,
+                                                         gdouble              opacity,
+                                                         glong                samples,
+                                                         const GeglRectangle *roi,
+                                                         gint                 level);
 
 #endif /* __GIMP_OPERATION_GRAIN_MERGE_MODE_H__ */
diff --git a/app/operations/gimpoperationhardlightmode.c b/app/operations/gimpoperationhardlightmode.c
index 30b8762..0b2b184 100644
--- a/app/operations/gimpoperationhardlightmode.c
+++ b/app/operations/gimpoperationhardlightmode.c
@@ -75,11 +75,21 @@ gimp_operation_hardlight_mode_process (GeglOperation       *operation,
                                        const GeglRectangle *roi,
                                        gint                 level)
 {
-  gdouble        opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat        *in       = in_buf;
-  gfloat        *layer    = aux_buf;
-  gfloat        *mask     = aux2_buf;
-  gfloat        *out      = out_buf;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_hardlight_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+}
+
+gboolean
+gimp_operation_hardlight_mode_process_pixels (gfloat              *in,
+                                              gfloat              *layer,
+                                              gfloat              *mask,
+                                              gfloat              *out,
+                                              gdouble              opacity,
+                                              glong                samples,
+                                              const GeglRectangle *roi,
+                                              gint                 level)
+{
   const gboolean has_mask = mask != NULL;
 
   while (samples--)
diff --git a/app/operations/gimpoperationhardlightmode.h b/app/operations/gimpoperationhardlightmode.h
index 3675784..2ef9112 100644
--- a/app/operations/gimpoperationhardlightmode.h
+++ b/app/operations/gimpoperationhardlightmode.h
@@ -50,5 +50,13 @@ struct _GimpOperationHardlightModeClass
 
 GType   gimp_operation_hardlight_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_hardlight_mode_process_pixels (gfloat              *in,
+                                                       gfloat              *layer,
+                                                       gfloat              *mask,
+                                                       gfloat              *out,
+                                                       gdouble              opacity,
+                                                       glong                samples,
+                                                       const GeglRectangle *roi,
+                                                       gint                 level);
 
 #endif /* __GIMP_OPERATION_HARDLIGHT_MODE_H__ */
diff --git a/app/operations/gimpoperationhuemode.c b/app/operations/gimpoperationhuemode.c
index 6db2f79..4609408 100644
--- a/app/operations/gimpoperationhuemode.c
+++ b/app/operations/gimpoperationhuemode.c
@@ -79,11 +79,21 @@ gimp_operation_hue_mode_process (GeglOperation       *operation,
                                  const GeglRectangle *roi,
                                  gint                 level)
 {
-  gdouble        opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat        *in       = in_buf;
-  gfloat        *layer    = aux_buf;
-  gfloat        *mask     = aux2_buf;
-  gfloat        *out      = out_buf;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_hue_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, roi, 
level);
+}
+
+gboolean
+gimp_operation_hue_mode_process_pixels (gfloat              *in,
+                                        gfloat              *layer,
+                                        gfloat              *mask,
+                                        gfloat              *out,
+                                        gdouble              opacity,
+                                        glong                samples,
+                                        const GeglRectangle *roi,
+                                        gint                 level)
+{
   const gboolean has_mask = mask != NULL;
 
   while (samples--)
diff --git a/app/operations/gimpoperationhuemode.h b/app/operations/gimpoperationhuemode.h
index 7381f88..e25a5b5 100644
--- a/app/operations/gimpoperationhuemode.h
+++ b/app/operations/gimpoperationhuemode.h
@@ -50,5 +50,13 @@ struct _GimpOperationHueModeClass
 
 GType   gimp_operation_hue_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_hue_mode_process_pixels (gfloat              *in,
+                                                 gfloat              *layer,
+                                                 gfloat              *mask,
+                                                 gfloat              *out,
+                                                 gdouble              opacity,
+                                                 glong                samples,
+                                                 const GeglRectangle *roi,
+                                                 gint                 level);
 
 #endif /* __GIMP_OPERATION_HUE_MODE_H__ */
diff --git a/app/operations/gimpoperationlightenonlymode.c b/app/operations/gimpoperationlightenonlymode.c
index 1474767..2096f8e 100644
--- a/app/operations/gimpoperationlightenonlymode.c
+++ b/app/operations/gimpoperationlightenonlymode.c
@@ -72,14 +72,24 @@ gimp_operation_lighten_only_mode_process (GeglOperation       *operation,
                                           void                *aux2_buf,
                                           void                *out_buf,
                                           glong                samples,
-                                          const GeglRectangle *result,
+                                          const GeglRectangle *roi,
                                           gint                 level)
 {
-  gdouble        opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat        *in       = in_buf;
-  gfloat        *layer    = aux_buf;
-  gfloat        *mask     = aux2_buf;
-  gfloat        *out      = out_buf;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_lighten_only_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, 
samples, roi, level);
+}
+
+gboolean
+gimp_operation_lighten_only_mode_process_pixels (gfloat              *in,
+                                                 gfloat              *layer,
+                                                 gfloat              *mask,
+                                                 gfloat              *out,
+                                                 gdouble              opacity,
+                                                 glong                samples,
+                                                 const GeglRectangle *roi,
+                                                 gint                 level)
+{
   const gboolean has_mask = mask != NULL;
 
   while (samples--)
diff --git a/app/operations/gimpoperationlightenonlymode.h b/app/operations/gimpoperationlightenonlymode.h
index 17c108c..e4ac9db 100644
--- a/app/operations/gimpoperationlightenonlymode.h
+++ b/app/operations/gimpoperationlightenonlymode.h
@@ -50,5 +50,13 @@ struct _GimpOperationLightenOnlyModeClass
 
 GType   gimp_operation_lighten_only_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_lighten_only_mode_process_pixels (gfloat              *in,
+                                                          gfloat              *layer,
+                                                          gfloat              *mask,
+                                                          gfloat              *out,
+                                                          gdouble              opacity,
+                                                          glong                samples,
+                                                          const GeglRectangle *roi,
+                                                          gint                 level);
 
 #endif /* __GIMP_OPERATION_LIGHTEN_ONLY_MODE_H__ */
diff --git a/app/operations/gimpoperationmultiplymode.c b/app/operations/gimpoperationmultiplymode.c
index 720aec0..b077eba 100644
--- a/app/operations/gimpoperationmultiplymode.c
+++ b/app/operations/gimpoperationmultiplymode.c
@@ -75,11 +75,21 @@ gimp_operation_multiply_mode_process (GeglOperation       *operation,
                                       const GeglRectangle *roi,
                                       gint                 level)
 {
-  gdouble         opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat         *in       = in_buf;
-  gfloat         *layer    = aux_buf;
-  gfloat         *mask     = aux2_buf;
-  gfloat         *out      = out_buf;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_multiply_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+}
+
+gboolean
+gimp_operation_multiply_mode_process_pixels (gfloat              *in,
+                                             gfloat              *layer,
+                                             gfloat              *mask,
+                                             gfloat              *out,
+                                             gdouble              opacity,
+                                             glong                samples,
+                                             const GeglRectangle *roi,
+                                             gint                 level)
+{
   const gboolean  has_mask = mask != NULL;
 
   while (samples--)
diff --git a/app/operations/gimpoperationmultiplymode.h b/app/operations/gimpoperationmultiplymode.h
index 478b84d..40dc73f 100644
--- a/app/operations/gimpoperationmultiplymode.h
+++ b/app/operations/gimpoperationmultiplymode.h
@@ -50,5 +50,13 @@ struct _GimpOperationMultiplyModeClass
 
 GType   gimp_operation_multiply_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_multiply_mode_process_pixels (gfloat              *in,
+                                                      gfloat              *layer,
+                                                      gfloat              *mask,
+                                                      gfloat              *out,
+                                                      gdouble              opacity,
+                                                      glong                samples,
+                                                      const GeglRectangle *roi,
+                                                      gint                 level);
 
 #endif /* __GIMP_OPERATION_MULTIPLY_MODE_H__ */
diff --git a/app/operations/gimpoperationnormalmode.c b/app/operations/gimpoperationnormalmode.c
index 9aed268..0cdb862 100644
--- a/app/operations/gimpoperationnormalmode.c
+++ b/app/operations/gimpoperationnormalmode.c
@@ -156,13 +156,22 @@ gimp_operation_normal_mode_process (GeglOperation       *operation,
                                     const GeglRectangle *roi,
                                     gint                 level)
 {
-  GimpOperationPointLayerMode *point    = GIMP_OPERATION_POINT_LAYER_MODE (operation);
-  gdouble                      opacity  = point->opacity;
-  gfloat                      *in       = in_buf;
-  gfloat                      *aux      = aux_buf;
-  gfloat                      *mask     = aux2_buf;
-  gfloat                      *out      = out_buf;
-  const gboolean               has_mask = mask != NULL;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_normal_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+}
+
+gboolean
+gimp_operation_normal_mode_process_pixels (gfloat              *in,
+                                           gfloat              *aux,
+                                           gfloat              *mask,
+                                           gfloat              *out,
+                                           gdouble              opacity,
+                                           glong                samples,
+                                           const GeglRectangle *roi,
+                                           gint                 level)
+{
+  const gboolean has_mask = mask != NULL;
 
   while (samples--)
     {
diff --git a/app/operations/gimpoperationnormalmode.h b/app/operations/gimpoperationnormalmode.h
index b508e20..0cfd26e 100644
--- a/app/operations/gimpoperationnormalmode.h
+++ b/app/operations/gimpoperationnormalmode.h
@@ -51,4 +51,14 @@ struct _GimpOperationNormalModeClass
 GType   gimp_operation_normal_mode_get_type (void) G_GNUC_CONST;
 
 
+gboolean gimp_operation_normal_mode_process_pixels (gfloat              *in,
+                                                    gfloat              *aux,
+                                                    gfloat              *mask,
+                                                    gfloat              *out,
+                                                    gdouble              opacity,
+                                                    glong                samples,
+                                                    const GeglRectangle *roi,
+                                                    gint                 level);
+
+
 #endif /* __GIMP_OPERATION_NORMAL_MODE_H__ */
diff --git a/app/operations/gimpoperationoverlaymode.c b/app/operations/gimpoperationoverlaymode.c
index 6cd3b7e..7cb3b6b 100644
--- a/app/operations/gimpoperationoverlaymode.c
+++ b/app/operations/gimpoperationoverlaymode.c
@@ -75,11 +75,21 @@ gimp_operation_overlay_mode_process (GeglOperation       *operation,
                                      const GeglRectangle *roi,
                                      gint                 level)
 {
-  gdouble        opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat        *in       = in_buf;
-  gfloat        *layer    = aux_buf;
-  gfloat        *mask     = aux2_buf;
-  gfloat        *out      = out_buf;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_overlay_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+}
+
+gboolean
+gimp_operation_overlay_mode_process_pixels (gfloat              *in,
+                                            gfloat              *layer,
+                                            gfloat              *mask,
+                                            gfloat              *out,
+                                            gdouble              opacity,
+                                            glong                samples,
+                                            const GeglRectangle *roi,
+                                            gint                 level)
+{
   const gboolean has_mask = mask != NULL;
 
   while (samples--)
diff --git a/app/operations/gimpoperationoverlaymode.h b/app/operations/gimpoperationoverlaymode.h
index ad10448..5585e50 100644
--- a/app/operations/gimpoperationoverlaymode.h
+++ b/app/operations/gimpoperationoverlaymode.h
@@ -50,5 +50,13 @@ struct _GimpOperationOverlayModeClass
 
 GType   gimp_operation_overlay_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_overlay_mode_process_pixels (gfloat              *in,
+                                                     gfloat              *layer,
+                                                     gfloat              *mask,
+                                                     gfloat              *out,
+                                                     gdouble              opacity,
+                                                     glong                samples,
+                                                     const GeglRectangle *roi,
+                                                     gint                 level);
 
 #endif /* __GIMP_OPERATION_OVERLAY_MODE_H__ */
diff --git a/app/operations/gimpoperationreplacemode.c b/app/operations/gimpoperationreplacemode.c
index 40f72c9..bfb593c 100644
--- a/app/operations/gimpoperationreplacemode.c
+++ b/app/operations/gimpoperationreplacemode.c
@@ -74,13 +74,21 @@ gimp_operation_replace_mode_process (GeglOperation       *operation,
                                      const GeglRectangle *roi,
                                      gint                 level)
 {
-  GimpOperationPointLayerMode *point   = GIMP_OPERATION_POINT_LAYER_MODE (operation);
-  gfloat                       opacity = point->opacity;
-  gfloat                      *in      = in_buf;
-  gfloat                      *layer   = aux_buf;
-  gfloat                      *mask    = aux2_buf;
-  gfloat                      *out     = out_buf;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
 
+  return gimp_operation_replace_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+}
+
+gboolean
+gimp_operation_replace_mode_process_pixels (gfloat              *in,
+                                            gfloat              *layer,
+                                            gfloat              *mask,
+                                            gfloat              *out,
+                                            gdouble              opacity,
+                                            glong                samples,
+                                            const GeglRectangle *roi,
+                                            gint                 level)
+{
   while (samples--)
     {
       gint   b;
diff --git a/app/operations/gimpoperationreplacemode.h b/app/operations/gimpoperationreplacemode.h
index 46712b4..80f339d 100644
--- a/app/operations/gimpoperationreplacemode.h
+++ b/app/operations/gimpoperationreplacemode.h
@@ -53,5 +53,13 @@ struct _GimpOperationReplaceModeClass
 
 GType   gimp_operation_replace_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_replace_mode_process_pixels (gfloat              *in,
+                                                     gfloat              *layer,
+                                                     gfloat              *mask,
+                                                     gfloat              *out,
+                                                     gdouble              opacity,
+                                                     glong                samples,
+                                                     const GeglRectangle *roi,
+                                                     gint                 level);
 
 #endif /* __GIMP_OPERATION_REPLACE_MODE_H__ */
diff --git a/app/operations/gimpoperationsaturationmode.c b/app/operations/gimpoperationsaturationmode.c
index 25287eb..d1df827 100644
--- a/app/operations/gimpoperationsaturationmode.c
+++ b/app/operations/gimpoperationsaturationmode.c
@@ -79,11 +79,21 @@ gimp_operation_saturation_mode_process (GeglOperation       *operation,
                                         const GeglRectangle *roi,
                                         gint                 level)
 {
-  gdouble        opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat        *in       = in_buf;
-  gfloat        *layer    = aux_buf;
-  gfloat        *mask     = aux2_buf;
-  gfloat        *out      = out_buf;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_saturation_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, 
samples, roi, level);
+}
+
+gboolean
+gimp_operation_saturation_mode_process_pixels (gfloat              *in,
+                                               gfloat              *layer,
+                                               gfloat              *mask,
+                                               gfloat              *out,
+                                               gdouble              opacity,
+                                               glong                samples,
+                                               const GeglRectangle *roi,
+                                               gint                 level)
+{
   const gboolean has_mask = mask != NULL;
 
   while (samples--)
diff --git a/app/operations/gimpoperationsaturationmode.h b/app/operations/gimpoperationsaturationmode.h
index acba0d0..b79434e 100644
--- a/app/operations/gimpoperationsaturationmode.h
+++ b/app/operations/gimpoperationsaturationmode.h
@@ -50,5 +50,13 @@ struct _GimpOperationSaturationModeClass
 
 GType   gimp_operation_saturation_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_saturation_mode_process_pixels (gfloat              *in,
+                                                        gfloat              *layer,
+                                                        gfloat              *mask,
+                                                        gfloat              *out,
+                                                        gdouble              opacity,
+                                                        glong                samples,
+                                                        const GeglRectangle *roi,
+                                                        gint                 level);
 
 #endif /* __GIMP_OPERATION_SATURATION_MODE_H__ */
diff --git a/app/operations/gimpoperationscreenmode.c b/app/operations/gimpoperationscreenmode.c
index fe876cf..c071101 100644
--- a/app/operations/gimpoperationscreenmode.c
+++ b/app/operations/gimpoperationscreenmode.c
@@ -75,11 +75,21 @@ gimp_operation_screen_mode_process (GeglOperation       *operation,
                                     const GeglRectangle *roi,
                                     gint                 level)
 {
-  gdouble         opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat         *in       = in_buf;
-  gfloat         *layer    = aux_buf;
-  gfloat         *mask     = aux2_buf;
-  gfloat         *out      = out_buf;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_screen_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+}
+
+gboolean
+gimp_operation_screen_mode_process_pixels (gfloat              *in,
+                                           gfloat              *layer,
+                                           gfloat              *mask,
+                                           gfloat              *out,
+                                           gdouble              opacity,
+                                           glong                samples,
+                                           const GeglRectangle *roi,
+                                           gint                 level)
+{
   const gboolean  has_mask = mask != NULL;
 
   while (samples--)
diff --git a/app/operations/gimpoperationscreenmode.h b/app/operations/gimpoperationscreenmode.h
index 7708a0c..d5e7f6f 100644
--- a/app/operations/gimpoperationscreenmode.h
+++ b/app/operations/gimpoperationscreenmode.h
@@ -50,5 +50,14 @@ struct _GimpOperationScreenModeClass
 
 GType   gimp_operation_screen_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_screen_mode_process_pixels (gfloat              *in,
+                                                    gfloat              *layer,
+                                                    gfloat              *mask,
+                                                    gfloat              *out,
+                                                    gdouble              opacity,
+                                                    glong                samples,
+                                                    const GeglRectangle *roi,
+                                                    gint                 level);
+
 
 #endif /* __GIMP_OPERATION_SCREEN_MODE_H__ */
diff --git a/app/operations/gimpoperationsoftlightmode.c b/app/operations/gimpoperationsoftlightmode.c
index 3b4818d..67285ab 100644
--- a/app/operations/gimpoperationsoftlightmode.c
+++ b/app/operations/gimpoperationsoftlightmode.c
@@ -93,11 +93,21 @@ gimp_operation_softlight_mode_process (GeglOperation       *operation,
                                        const GeglRectangle *roi,
                                        gint                 level)
 {
-  gdouble        opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat        *in       = in_buf;
-  gfloat        *layer    = aux_buf;
-  gfloat        *mask     = aux2_buf;
-  gfloat        *out      = out_buf;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_softlight_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+}
+
+gboolean
+gimp_operation_softlight_mode_process_pixels (gfloat              *in,
+                                              gfloat              *layer,
+                                              gfloat              *mask,
+                                              gfloat              *out,
+                                              gdouble              opacity,
+                                              glong                samples,
+                                              const GeglRectangle *roi,
+                                              gint                 level)
+{
   const gboolean has_mask = mask != NULL;
 
   while (samples--)
diff --git a/app/operations/gimpoperationsoftlightmode.h b/app/operations/gimpoperationsoftlightmode.h
index 2cf6f23..5ebedb0 100644
--- a/app/operations/gimpoperationsoftlightmode.h
+++ b/app/operations/gimpoperationsoftlightmode.h
@@ -50,5 +50,13 @@ struct _GimpOperationSoftlightModeClass
 
 GType   gimp_operation_softlight_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_softlight_mode_process_pixels (gfloat              *in,
+                                                       gfloat              *layer,
+                                                       gfloat              *mask,
+                                                       gfloat              *out,
+                                                       gdouble              opacity,
+                                                       glong                samples,
+                                                       const GeglRectangle *roi,
+                                                       gint                 level);
 
 #endif /* __GIMP_OPERATION_SOFTLIGHT_MODE_H__ */
diff --git a/app/operations/gimpoperationsubtractmode.c b/app/operations/gimpoperationsubtractmode.c
index 7875f79..6b7112c 100644
--- a/app/operations/gimpoperationsubtractmode.c
+++ b/app/operations/gimpoperationsubtractmode.c
@@ -75,11 +75,21 @@ gimp_operation_subtract_mode_process (GeglOperation       *operation,
                                       const GeglRectangle *roi,
                                       gint                 level)
 {
-  gdouble        opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat        *in       = in_buf;
-  gfloat        *layer    = aux_buf;
-  gfloat        *mask     = aux2_buf;
-  gfloat        *out      = out_buf;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_subtract_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+}
+
+gboolean
+gimp_operation_subtract_mode_process_pixels (gfloat              *in,
+                                             gfloat              *layer,
+                                             gfloat              *mask,
+                                             gfloat              *out,
+                                             gdouble              opacity,
+                                             glong                samples,
+                                             const GeglRectangle *roi,
+                                             gint                 level)
+{
   const gboolean has_mask = mask != NULL;
 
   while (samples--)
diff --git a/app/operations/gimpoperationsubtractmode.h b/app/operations/gimpoperationsubtractmode.h
index 25648b9..dc06455 100644
--- a/app/operations/gimpoperationsubtractmode.h
+++ b/app/operations/gimpoperationsubtractmode.h
@@ -50,5 +50,13 @@ struct _GimpOperationSubtractModeClass
 
 GType   gimp_operation_subtract_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_subtract_mode_process_pixels (gfloat              *in,
+                                                      gfloat              *layer,
+                                                      gfloat              *mask,
+                                                      gfloat              *out,
+                                                      gdouble              opacity,
+                                                      glong                samples,
+                                                      const GeglRectangle *roi,
+                                                      gint                 level);
 
 #endif /* __GIMP_OPERATION_SUBTRACT_MODE_H__ */
diff --git a/app/operations/gimpoperationvaluemode.c b/app/operations/gimpoperationvaluemode.c
index 3c3232b..d684dfa 100644
--- a/app/operations/gimpoperationvaluemode.c
+++ b/app/operations/gimpoperationvaluemode.c
@@ -79,11 +79,21 @@ gimp_operation_value_mode_process (GeglOperation       *operation,
                                    const GeglRectangle *roi,
                                    gint                 level)
 {
-  gdouble        opacity  = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
-  gfloat        *in       = in_buf;
-  gfloat        *layer    = aux_buf;
-  gfloat        *mask     = aux2_buf;
-  gfloat        *out      = out_buf;
+  gdouble opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_overlay_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+}
+
+gboolean
+gimp_operation_value_mode_process_pixels (gfloat              *in,
+                                          gfloat              *layer,
+                                          gfloat              *mask,
+                                          gfloat              *out,
+                                          gdouble              opacity,
+                                          glong                samples,
+                                          const GeglRectangle *roi,
+                                          gint                 level)
+{
   const gboolean has_mask = mask != NULL;
 
   while (samples--)
@@ -140,4 +150,4 @@ gimp_operation_value_mode_process (GeglOperation       *operation,
     }
 
   return TRUE;
-}
+}
\ No newline at end of file
diff --git a/app/operations/gimpoperationvaluemode.h b/app/operations/gimpoperationvaluemode.h
index 1fee802..24ac196 100644
--- a/app/operations/gimpoperationvaluemode.h
+++ b/app/operations/gimpoperationvaluemode.h
@@ -50,5 +50,13 @@ struct _GimpOperationValueModeClass
 
 GType   gimp_operation_value_mode_get_type (void) G_GNUC_CONST;
 
+gboolean gimp_operation_value_mode_process_pixels (gfloat              *in,
+                                                   gfloat              *layer,
+                                                   gfloat              *mask,
+                                                   gfloat              *out,
+                                                   gdouble              opacity,
+                                                   glong                samples,
+                                                   const GeglRectangle *roi,
+                                                   gint                 level);
 
 #endif /* __GIMP_OPERATION_VALUE_MODE_H__ */
diff --git a/app/operations/operations-types.h b/app/operations/operations-types.h
index 89f9045..b620ca1 100644
--- a/app/operations/operations-types.h
+++ b/app/operations/operations-types.h
@@ -21,6 +21,7 @@
 #define __OPERATIONS_TYPES_H__
 
 
+#include <gegl-types.h>
 #include "gegl/gimp-gegl-types.h"
 
 
@@ -48,5 +49,15 @@ typedef struct _GimpThresholdConfig             GimpThresholdConfig;
 
 typedef struct _GimpCagePoint                   GimpCagePoint;
 
+/*  functions  */
+
+typedef gboolean (*GimpLayerModeFunction)(gfloat              *in,
+                                          gfloat              *aux,
+                                          gfloat              *mask,
+                                          gfloat              *out,
+                                          gdouble              opacity,
+                                          glong                samples,
+                                          const GeglRectangle *roi,
+                                          gint                 level);
 
 #endif /* __OPERATIONS_TYPES_H__ */


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