[gimp] app: split legacy lighten only and darken only ops



commit c3e5e30450a0ade6ef6d890e6439675179d9a002
Author: Øyvind Kolås <pippin gimp org>
Date:   Tue Jan 10 03:07:36 2017 +0100

    app: split legacy lighten only and darken only ops

 app/core/core-enums.c                              |    8 +-
 app/core/core-enums.h                              |    6 +-
 app/gegl/gimp-gegl-nodes.c                         |   14 ++-
 app/operations/Makefile.am                         |    4 -
 app/operations/gimp-operations.c                   |   12 +-
 app/operations/gimplayermodefunctions.c            |   18 ++-
 app/operations/gimpoperationdarkenonlymode.h       |   61 ---------
 app/operations/gimpoperationlightenonlymode.h      |   61 ---------
 app/operations/layer-modes-legacy/Makefile.am      |    6 +-
 .../gimpoperationdarkenonlylegacy.c}               |   50 ++++----
 .../gimpoperationdarkenonlylegacy.h                |   61 +++++++++
 .../gimpoperationlightenonlylegacy.c               |  137 ++++++++++++++++++++
 .../gimpoperationlightenonlylegacy.h               |   61 +++++++++
 app/operations/layer-modes/Makefile.am             |    6 +-
 .../layer-modes/gimpoperationdarkenonly.c          |  135 +++++++++++++++++++
 .../layer-modes/gimpoperationdarkenonly.h          |   62 +++++++++
 .../gimpoperationlightenonly.c}                    |   62 +++++-----
 .../layer-modes/gimpoperationlightenonly.h         |   62 +++++++++
 app/widgets/gimpwidgets-constructors.c             |   10 +-
 libgimp/gimpenums.h                                |    4 +-
 tools/pdbgen/enums.pl                              |    8 +-
 21 files changed, 639 insertions(+), 209 deletions(-)
---
diff --git a/app/core/core-enums.c b/app/core/core-enums.c
index 7076335..db36e48 100644
--- a/app/core/core-enums.c
+++ b/app/core/core-enums.c
@@ -325,6 +325,8 @@ gimp_layer_mode_get_type (void)
     { GIMP_LAYER_MODE_DIFFERENCE, "GIMP_LAYER_MODE_DIFFERENCE", "difference" },
     { GIMP_LAYER_MODE_ADDITION, "GIMP_LAYER_MODE_ADDITION", "addition" },
     { GIMP_LAYER_MODE_SUBTRACT, "GIMP_LAYER_MODE_SUBTRACT", "subtract" },
+    { GIMP_LAYER_MODE_DARKEN_ONLY, "GIMP_LAYER_MODE_DARKEN_ONLY", "darken-only" },
+    { GIMP_LAYER_MODE_LIGHTEN_ONLY, "GIMP_LAYER_MODE_LIGHTEN_ONLY", "lighten-only" },
     { GIMP_LAYER_MODE_ERASE, "GIMP_LAYER_MODE_ERASE", "erase" },
     { GIMP_LAYER_MODE_REPLACE, "GIMP_LAYER_MODE_REPLACE", "replace" },
     { GIMP_LAYER_MODE_ANTI_ERASE, "GIMP_LAYER_MODE_ANTI_ERASE", "anti-erase" },
@@ -342,8 +344,8 @@ gimp_layer_mode_get_type (void)
     { GIMP_LAYER_MODE_DIFFERENCE_LEGACY, NC_("layer-mode", "Difference (legacy)"), NULL },
     { GIMP_LAYER_MODE_ADDITION_LEGACY, NC_("layer-mode", "Addition (legacy)"), NULL },
     { GIMP_LAYER_MODE_SUBTRACT_LEGACY, NC_("layer-mode", "Subtract (legacy)"), NULL },
-    { GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY, NC_("layer-mode", "Darken only"), NULL },
-    { GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY, NC_("layer-mode", "Lighten only"), NULL },
+    { GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY, NC_("layer-mode", "Darken only (legacy)"), NULL },
+    { GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY, NC_("layer-mode", "Lighten only (legacy)"), NULL },
     { GIMP_LAYER_MODE_HSV_HUE_LEGACY, NC_("layer-mode", "Hue (HSV)"), NULL },
     { GIMP_LAYER_MODE_HSV_SATURATION_LEGACY, NC_("layer-mode", "Saturation (HSV)"), NULL },
     { GIMP_LAYER_MODE_HSV_COLOR_LEGACY, NC_("layer-mode", "Color (HSV)"), NULL },
@@ -369,6 +371,8 @@ gimp_layer_mode_get_type (void)
     { GIMP_LAYER_MODE_DIFFERENCE, NC_("layer-mode", "Difference"), NULL },
     { GIMP_LAYER_MODE_ADDITION, NC_("layer-mode", "Addition"), NULL },
     { GIMP_LAYER_MODE_SUBTRACT, NC_("layer-mode", "Subtract"), NULL },
+    { GIMP_LAYER_MODE_DARKEN_ONLY, NC_("layer-mode", "Darken only"), NULL },
+    { GIMP_LAYER_MODE_LIGHTEN_ONLY, NC_("layer-mode", "Lighten only"), NULL },
     { GIMP_LAYER_MODE_ERASE, NC_("layer-mode", "Erase"), NULL },
     { GIMP_LAYER_MODE_REPLACE, NC_("layer-mode", "Replace"), NULL },
     { GIMP_LAYER_MODE_ANTI_ERASE, NC_("layer-mode", "Anti erase"), NULL },
diff --git a/app/core/core-enums.h b/app/core/core-enums.h
index 26555b6..cfafe76 100644
--- a/app/core/core-enums.h
+++ b/app/core/core-enums.h
@@ -163,8 +163,8 @@ typedef enum
   GIMP_LAYER_MODE_DIFFERENCE_LEGACY,      /*< desc="Difference (legacy)"  >*/
   GIMP_LAYER_MODE_ADDITION_LEGACY,        /*< desc="Addition (legacy)"    >*/
   GIMP_LAYER_MODE_SUBTRACT_LEGACY,        /*< desc="Subtract (legacy)"    >*/
-  GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY,     /*< desc="Darken only"          >*/
-  GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY,    /*< desc="Lighten only"         >*/
+  GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY,     /*< desc="Darken only (legacy)" >*/
+  GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY,    /*< desc="Lighten only (legacy)">*/
   GIMP_LAYER_MODE_HSV_HUE_LEGACY,         /*< desc="Hue (HSV)"            >*/
   GIMP_LAYER_MODE_HSV_SATURATION_LEGACY,  /*< desc="Saturation (HSV)"     >*/
   GIMP_LAYER_MODE_HSV_COLOR_LEGACY,       /*< desc="Color (HSV)"          >*/
@@ -190,6 +190,8 @@ typedef enum
   GIMP_LAYER_MODE_DIFFERENCE,             /*< desc="Difference"           >*/
   GIMP_LAYER_MODE_ADDITION,               /*< desc="Addition"             >*/
   GIMP_LAYER_MODE_SUBTRACT,               /*< desc="Subtract"             >*/
+  GIMP_LAYER_MODE_DARKEN_ONLY,            /*< desc="Darken only"          >*/
+  GIMP_LAYER_MODE_LIGHTEN_ONLY,           /*< desc="Lighten only"         >*/
 
   /* internal modes, not available to the PDB */
   GIMP_LAYER_MODE_ERASE      = 1000, /*< pdb-skip, desc="Erase"      >*/
diff --git a/app/gegl/gimp-gegl-nodes.c b/app/gegl/gimp-gegl-nodes.c
index 3f2ece6..6ebf01f 100644
--- a/app/gegl/gimp-gegl-nodes.c
+++ b/app/gegl/gimp-gegl-nodes.c
@@ -207,12 +207,20 @@ gimp_gegl_mode_node_set_mode (GeglNode      *node,
       operation = "gimp:subtract-legacy";
       break;
 
+    case GIMP_LAYER_MODE_DARKEN_ONLY:
+      operation = "gimp:darken-only";
+      break;
+
     case GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY:
-      operation = "gimp:darken-only-mode";
+      operation = "gimp:darken-only-legacy";
+      break;
+
+    case GIMP_LAYER_MODE_LIGHTEN_ONLY:
+      operation = "gimp:lighten-only";
       break;
 
     case GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY:
-      operation = "gimp:lighten-only-mode";
+      operation = "gimp:lighten-only-legacy";
       break;
 
     case GIMP_LAYER_MODE_HSV_HUE_LEGACY:
@@ -334,7 +342,9 @@ gimp_gegl_mode_node_set_mode (GeglNode      *node,
     case GIMP_LAYER_MODE_SUBTRACT:
     case GIMP_LAYER_MODE_ADDITION_LEGACY:
     case GIMP_LAYER_MODE_SUBTRACT_LEGACY:
+    case GIMP_LAYER_MODE_DARKEN_ONLY:
     case GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY:
+    case GIMP_LAYER_MODE_LIGHTEN_ONLY:
     case GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY:
     case GIMP_LAYER_MODE_NORMAL_NON_LINEAR:
     case GIMP_LAYER_MODE_OVERLAY_LEGACY:
diff --git a/app/operations/Makefile.am b/app/operations/Makefile.am
index 3d2d158..48fd9c2 100644
--- a/app/operations/Makefile.am
+++ b/app/operations/Makefile.am
@@ -99,10 +99,6 @@ libappoperations_a_SOURCES = \
        gimpoperationpointlayermode.h           \
        gimpoperationbehindmode.c               \
        gimpoperationbehindmode.h               \
-       gimpoperationdarkenonlymode.c           \
-       gimpoperationdarkenonlymode.h           \
-       gimpoperationlightenonlymode.c          \
-       gimpoperationlightenonlymode.h          \
        gimpoperationhuemode.c                  \
        gimpoperationhuemode.h                  \
        gimpoperationsaturationmode.c           \
diff --git a/app/operations/gimp-operations.c b/app/operations/gimp-operations.c
index b958bac..ada9998 100644
--- a/app/operations/gimp-operations.c
+++ b/app/operations/gimp-operations.c
@@ -80,8 +80,10 @@
 #include "layer-modes-legacy/gimpoperationadditionlegacy.h"
 #include "layer-modes/gimpoperationsubtract.h"
 #include "layer-modes-legacy/gimpoperationsubtractlegacy.h"
-#include "gimpoperationdarkenonlymode.h"
-#include "gimpoperationlightenonlymode.h"
+#include "layer-modes/gimpoperationdarkenonly.h"
+#include "layer-modes-legacy/gimpoperationdarkenonlylegacy.h"
+#include "layer-modes/gimpoperationlightenonly.h"
+#include "layer-modes-legacy/gimpoperationlightenonlylegacy.h"
 #include "gimpoperationhuemode.h"
 #include "gimpoperationsaturationmode.h"
 #include "gimpoperationcolormode.h"
@@ -150,8 +152,10 @@ gimp_operations_init (void)
   g_type_class_ref (GIMP_TYPE_OPERATION_ADDITION_LEGACY);
   g_type_class_ref (GIMP_TYPE_OPERATION_SUBTRACT);
   g_type_class_ref (GIMP_TYPE_OPERATION_SUBTRACT_LEGACY);
-  g_type_class_ref (GIMP_TYPE_OPERATION_DARKEN_ONLY_MODE);
-  g_type_class_ref (GIMP_TYPE_OPERATION_LIGHTEN_ONLY_MODE);
+  g_type_class_ref (GIMP_TYPE_OPERATION_DARKEN_ONLY);
+  g_type_class_ref (GIMP_TYPE_OPERATION_DARKEN_ONLY_LEGACY);
+  g_type_class_ref (GIMP_TYPE_OPERATION_LIGHTEN_ONLY);
+  g_type_class_ref (GIMP_TYPE_OPERATION_LIGHTEN_ONLY_LEGACY);
   g_type_class_ref (GIMP_TYPE_OPERATION_HUE_MODE);
   g_type_class_ref (GIMP_TYPE_OPERATION_SATURATION_MODE);
   g_type_class_ref (GIMP_TYPE_OPERATION_COLOR_MODE);
diff --git a/app/operations/gimplayermodefunctions.c b/app/operations/gimplayermodefunctions.c
index e5db294..f69b2c8 100644
--- a/app/operations/gimplayermodefunctions.c
+++ b/app/operations/gimplayermodefunctions.c
@@ -40,8 +40,10 @@
 #include "layer-modes/gimpoperationsubtract.h"
 #include "layer-modes-legacy/gimpoperationadditionlegacy.h"
 #include "layer-modes-legacy/gimpoperationsubtractlegacy.h"
-#include "gimpoperationdarkenonlymode.h"
-#include "gimpoperationlightenonlymode.h"
+#include "layer-modes/gimpoperationdarkenonly.h"
+#include "layer-modes-legacy/gimpoperationdarkenonlylegacy.h"
+#include "layer-modes/gimpoperationlightenonly.h"
+#include "layer-modes-legacy/gimpoperationlightenonlylegacy.h"
 #include "gimpoperationhuemode.h"
 #include "gimpoperationsaturationmode.h"
 #include "gimpoperationcolormode.h"
@@ -128,12 +130,20 @@ get_layer_mode_function (GimpLayerMode  paint_mode,
       func = gimp_operation_subtract_legacy_process_pixels;
       break;
 
+    case GIMP_LAYER_MODE_DARKEN_ONLY:
+      func = gimp_operation_darken_only_process_pixels;
+      break;
+
     case GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY:
-      func = gimp_operation_darken_only_mode_process_pixels;
+      func = gimp_operation_darken_only_legacy_process_pixels;
+      break;
+
+    case GIMP_LAYER_MODE_LIGHTEN_ONLY:
+      func = gimp_operation_lighten_only_process_pixels;
       break;
 
     case GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY:
-      func = gimp_operation_lighten_only_mode_process_pixels;
+      func = gimp_operation_lighten_only_legacy_process_pixels;
       break;
 
     case GIMP_LAYER_MODE_HSV_HUE_LEGACY:
diff --git a/app/operations/layer-modes-legacy/Makefile.am b/app/operations/layer-modes-legacy/Makefile.am
index df2350c..59003df 100644
--- a/app/operations/layer-modes-legacy/Makefile.am
+++ b/app/operations/layer-modes-legacy/Makefile.am
@@ -26,4 +26,8 @@ libapplayermodeslegacy_a_SOURCES = \
        gimpoperationadditionlegacy.c   \
        gimpoperationadditionlegacy.h   \
        gimpoperationsubtractlegacy.c   \
-       gimpoperationsubtractlegacy.h
+       gimpoperationsubtractlegacy.h   \
+       gimpoperationdarkenonlylegacy.c \
+       gimpoperationdarkenonlylegacy.h \
+       gimpoperationlightenonlylegacy.c \
+       gimpoperationlightenonlylegacy.h
diff --git a/app/operations/gimpoperationdarkenonlymode.c 
b/app/operations/layer-modes-legacy/gimpoperationdarkenonlylegacy.c
similarity index 61%
rename from app/operations/gimpoperationdarkenonlymode.c
rename to app/operations/layer-modes-legacy/gimpoperationdarkenonlylegacy.c
index 8a265ef..bd56644 100644
--- a/app/operations/gimpoperationdarkenonlymode.c
+++ b/app/operations/layer-modes-legacy/gimpoperationdarkenonlylegacy.c
@@ -23,27 +23,27 @@
 
 #include <gegl-plugin.h>
 
-#include "operations-types.h"
+#include "../operations-types.h"
 
-#include "gimpoperationdarkenonlymode.h"
+#include "gimpoperationdarkenonlylegacy.h"
 
 
-static gboolean gimp_operation_darken_only_mode_process (GeglOperation       *operation,
-                                                         void                *in_buf,
-                                                         void                *aux_buf,
-                                                         void                *aux2_buf,
-                                                         void                *out_buf,
-                                                         glong                samples,
-                                                         const GeglRectangle *roi,
-                                                         gint                 level);
+static gboolean gimp_operation_darken_only_legacy_process (GeglOperation       *operation,
+                                                           void                *in_buf,
+                                                           void                *aux_buf,
+                                                           void                *aux2_buf,
+                                                           void                *out_buf,
+                                                           glong                samples,
+                                                           const GeglRectangle *roi,
+                                                           gint                 level);
 
 
-G_DEFINE_TYPE (GimpOperationDarkenOnlyMode, gimp_operation_darken_only_mode,
+G_DEFINE_TYPE (GimpOperationDarkenOnlyLegacy, gimp_operation_darken_only_legacy,
                GIMP_TYPE_OPERATION_POINT_LAYER_MODE)
 
 
 static void
-gimp_operation_darken_only_mode_class_init (GimpOperationDarkenOnlyModeClass *klass)
+gimp_operation_darken_only_legacy_class_init (GimpOperationDarkenOnlyLegacyClass *klass)
 {
   GeglOperationClass               *operation_class;
   GeglOperationPointComposer3Class *point_class;
@@ -52,35 +52,35 @@ gimp_operation_darken_only_mode_class_init (GimpOperationDarkenOnlyModeClass *kl
   point_class     = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass);
 
   gegl_operation_class_set_keys (operation_class,
-                                 "name",        "gimp:darken-only-mode",
+                                 "name",        "gimp:darken-only-legacy",
                                  "description", "GIMP darken only mode operation",
                                  NULL);
 
-  point_class->process = gimp_operation_darken_only_mode_process;
+  point_class->process = gimp_operation_darken_only_legacy_process;
 }
 
 static void
-gimp_operation_darken_only_mode_init (GimpOperationDarkenOnlyMode *self)
+gimp_operation_darken_only_legacy_init (GimpOperationDarkenOnlyLegacy *self)
 {
 }
 
 static gboolean
-gimp_operation_darken_only_mode_process (GeglOperation       *operation,
-                                         void                *in_buf,
-                                         void                *aux_buf,
-                                         void                *aux2_buf,
-                                         void                *out_buf,
-                                         glong                samples,
-                                         const GeglRectangle *roi,
-                                         gint                 level)
+gimp_operation_darken_only_legacy_process (GeglOperation       *operation,
+                                           void                *in_buf,
+                                           void                *aux_buf,
+                                           void                *aux2_buf,
+                                           void                *out_buf,
+                                           glong                samples,
+                                           const GeglRectangle *roi,
+                                           gint                 level)
 {
   gfloat 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);
+  return gimp_operation_darken_only_legacy_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, 
samples, roi, level);
 }
 
 gboolean
-gimp_operation_darken_only_mode_process_pixels (gfloat              *in,
+gimp_operation_darken_only_legacy_process_pixels (gfloat              *in,
                                                 gfloat              *layer,
                                                 gfloat              *mask,
                                                 gfloat              *out,
diff --git a/app/operations/layer-modes-legacy/gimpoperationdarkenonlylegacy.h 
b/app/operations/layer-modes-legacy/gimpoperationdarkenonlylegacy.h
new file mode 100644
index 0000000..ef285f3
--- /dev/null
+++ b/app/operations/layer-modes-legacy/gimpoperationdarkenonlylegacy.h
@@ -0,0 +1,61 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpoperationdarken_onlymode.h
+ * Copyright (C) 2008 Michael Natterer <mitch gimp org>
+ *
+ * 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_OPERATION_DARKEN_ONLY_LEGACY_H__
+#define __GIMP_OPERATION_DARKEN_ONLY_LEGACY_H__
+
+
+#include "../gimpoperationpointlayermode.h"
+
+
+#define GIMP_TYPE_OPERATION_DARKEN_ONLY_LEGACY            (gimp_operation_darken_only_legacy_get_type ())
+#define GIMP_OPERATION_DARKEN_ONLY_LEGACY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GIMP_TYPE_OPERATION_DARKEN_ONLY_MODE, GimpOperationDarkenOnlyLegacy))
+#define GIMP_OPERATION_DARKEN_ONLY_LEGACY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  
GIMP_TYPE_OPERATION_DARKEN_ONLY_MODE, GimpOperationDarkenOnlyLegacyClass))
+#define GIMP_IS_OPERATION_DARKEN_ONLY_LEGACY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GIMP_TYPE_OPERATION_DARKEN_ONLY_MODE))
+#define GIMP_IS_OPERATION_DARKEN_ONLY_LEGACY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  
GIMP_TYPE_OPERATION_DARKEN_ONLY_MODE))
+#define GIMP_OPERATION_DARKEN_ONLY_LEGACY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  
GIMP_TYPE_OPERATION_DARKEN_ONLY_MODE, GimpOperationDarkenOnlyLegacyClass))
+
+
+typedef struct _GimpOperationDarkenOnlyLegacy      GimpOperationDarkenOnlyLegacy;
+typedef struct _GimpOperationDarkenOnlyLegacyClass GimpOperationDarkenOnlyLegacyClass;
+
+struct _GimpOperationDarkenOnlyLegacy
+{
+  GimpOperationPointLayerMode  parent_instance;
+};
+
+struct _GimpOperationDarkenOnlyLegacyClass
+{
+  GimpOperationPointLayerModeClass  parent_class;
+};
+
+
+GType   gimp_operation_darken_only_legacy_get_type (void) G_GNUC_CONST;
+
+gboolean gimp_operation_darken_only_legacy_process_pixels (gfloat              *in,
+                                                           gfloat              *layer,
+                                                           gfloat              *mask,
+                                                           gfloat              *out,
+                                                           gfloat               opacity,
+                                                           glong                samples,
+                                                           const GeglRectangle *roi,
+                                                           gint                 level);
+
+#endif /* __GIMP_OPERATION_DARKEN_ONLY_LEGACY_H__ */
diff --git a/app/operations/layer-modes-legacy/gimpoperationlightenonlylegacy.c 
b/app/operations/layer-modes-legacy/gimpoperationlightenonlylegacy.c
new file mode 100644
index 0000000..b84814c
--- /dev/null
+++ b/app/operations/layer-modes-legacy/gimpoperationlightenonlylegacy.c
@@ -0,0 +1,137 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpoperationlightenonlylegacy.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
+ * 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-plugin.h>
+
+#include "../operations-types.h"
+
+#include "gimpoperationlightenonlylegacy.h"
+
+
+static gboolean gimp_operation_lighten_only_legacy_process (GeglOperation       *operation,
+                                                            void                *in_buf,
+                                                            void                *aux_buf,
+                                                            void                *aux2_buf,
+                                                            void                *out_buf,
+                                                            glong                samples,
+                                                            const GeglRectangle *roi,
+                                                            gint                 level);
+
+
+G_DEFINE_TYPE (GimpOperationLightenOnlyLegacy, gimp_operation_lighten_only_legacy,
+               GIMP_TYPE_OPERATION_POINT_LAYER_MODE)
+
+
+static void
+gimp_operation_lighten_only_legacy_class_init (GimpOperationLightenOnlyLegacyClass *klass)
+{
+  GeglOperationClass               *operation_class;
+  GeglOperationPointComposer3Class *point_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  point_class     = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass);
+
+  gegl_operation_class_set_keys (operation_class,
+                                 "name",        "gimp:lighten-only-legacy",
+                                 "description", "GIMP lighten only legacy operation",
+                                 NULL);
+
+  point_class->process = gimp_operation_lighten_only_legacy_process;
+}
+
+static void
+gimp_operation_lighten_only_legacy_init (GimpOperationLightenOnlyLegacy *self)
+{
+}
+
+static gboolean
+gimp_operation_lighten_only_legacy_process (GeglOperation       *operation,
+                                            void                *in_buf,
+                                            void                *aux_buf,
+                                            void                *aux2_buf,
+                                            void                *out_buf,
+                                            glong                samples,
+                                            const GeglRectangle *roi,
+                                            gint                 level)
+{
+  gfloat opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_lighten_only_legacy_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, 
samples, roi, level);
+}
+
+gboolean
+gimp_operation_lighten_only_legacy_process_pixels (gfloat              *in,
+                                                   gfloat              *layer,
+                                                   gfloat              *mask,
+                                                   gfloat              *out,
+                                                   gfloat               opacity,
+                                                   glong                samples,
+                                                   const GeglRectangle *roi,
+                                                   gint                 level)
+{
+  const gboolean has_mask = mask != NULL;
+
+  while (samples--)
+    {
+      gfloat comp_alpha, new_alpha;
+
+      comp_alpha = MIN (in[ALPHA], layer[ALPHA]) * opacity;
+      if (has_mask)
+        comp_alpha *= *mask;
+
+      new_alpha = in[ALPHA] + (1.0 - in[ALPHA]) * comp_alpha;
+
+      if (comp_alpha && new_alpha)
+        {
+          gint   b;
+          gfloat ratio = comp_alpha / new_alpha;
+
+          for (b = RED; b < ALPHA; b++)
+            {
+              gfloat comp = MAX (layer[b], in[b]);
+
+              out[b] = comp * ratio + in[b] * (1.0 - ratio);
+            }
+        }
+      else
+        {
+          gint b;
+
+          for (b = RED; b < ALPHA; b++)
+            {
+              out[b] = in[b];
+            }
+        }
+
+      out[ALPHA] = in[ALPHA];
+
+      in    += 4;
+      layer += 4;
+      out   += 4;
+
+      if (has_mask)
+        mask++;
+    }
+
+  return TRUE;
+}
diff --git a/app/operations/layer-modes-legacy/gimpoperationlightenonlylegacy.h 
b/app/operations/layer-modes-legacy/gimpoperationlightenonlylegacy.h
new file mode 100644
index 0000000..fadfcef
--- /dev/null
+++ b/app/operations/layer-modes-legacy/gimpoperationlightenonlylegacy.h
@@ -0,0 +1,61 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpoperationlighten_onlymode.h
+ * Copyright (C) 2008 Michael Natterer <mitch gimp org>
+ *
+ * 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_OPERATION_LIGHTEN_ONLY_LEGACY_H__
+#define __GIMP_OPERATION_LIGHTEN_ONLY_LEGACY_H__
+
+
+#include "../gimpoperationpointlayermode.h"
+
+
+#define GIMP_TYPE_OPERATION_LIGHTEN_ONLY_LEGACY            (gimp_operation_lighten_only_legacy_get_type ())
+#define GIMP_OPERATION_LIGHTEN_ONLY_LEGACY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GIMP_TYPE_OPERATION_LIGHTEN_ONLY_LEGACY, GimpOperationLightenOnlyLegacy))
+#define GIMP_OPERATION_LIGHTEN_ONLY_LEGACY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  
GIMP_TYPE_OPERATION_LIGHTEN_ONLY_LEGACY, GimpOperationLightenOnlyLegacyClass))
+#define GIMP_IS_OPERATION_LIGHTEN_ONLY_LEGACY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GIMP_TYPE_OPERATION_LIGHTEN_ONLY_LEGACY))
+#define GIMP_IS_OPERATION_LIGHTEN_ONLY_LEGACY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  
GIMP_TYPE_OPERATION_LIGHTEN_ONLY_LEGACY))
+#define GIMP_OPERATION_LIGHTEN_ONLY_LEGACY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  
GIMP_TYPE_OPERATION_LIGHTEN_ONLY_LEGACY, GimpOperationLightenOnlyLegacyClass))
+
+
+typedef struct _GimpOperationLightenOnlyLegacy      GimpOperationLightenOnlyLegacy;
+typedef struct _GimpOperationLightenOnlyLegacyClass GimpOperationLightenOnlyLegacyClass;
+
+struct _GimpOperationLightenOnlyLegacy
+{
+  GimpOperationPointLayerMode  parent_instance;
+};
+
+struct _GimpOperationLightenOnlyLegacyClass
+{
+  GimpOperationPointLayerModeClass  parent_class;
+};
+
+
+GType   gimp_operation_lighten_only_legacy_get_type (void) G_GNUC_CONST;
+
+gboolean gimp_operation_lighten_only_legacy_process_pixels (gfloat              *in,
+                                                            gfloat              *layer,
+                                                            gfloat              *mask,
+                                                            gfloat              *out,
+                                                            gfloat               opacity,
+                                                            glong                samples,
+                                                            const GeglRectangle *roi,
+                                                            gint                 level);
+
+#endif /* __GIMP_OPERATION_LIGHTEN_ONLY_LEGACY_H__ */
diff --git a/app/operations/layer-modes/Makefile.am b/app/operations/layer-modes/Makefile.am
index dbf3312..97cf688 100644
--- a/app/operations/layer-modes/Makefile.am
+++ b/app/operations/layer-modes/Makefile.am
@@ -43,7 +43,11 @@ libapplayermodes_generic_a_sources = \
        gimpoperationaddition.c         \
        gimpoperationaddition.h         \
        gimpoperationsubtract.c         \
-       gimpoperationsubtract.h
+       gimpoperationsubtract.h         \
+       gimpoperationdarkenonly.c       \
+       gimpoperationdarkenonly.h       \
+       gimpoperationlightenonly.c      \
+       gimpoperationlightenonly.h
 
 libapplayermodes_sse2_a_sources = \
        gimpoperationnormal-sse2.c
diff --git a/app/operations/layer-modes/gimpoperationdarkenonly.c 
b/app/operations/layer-modes/gimpoperationdarkenonly.c
new file mode 100644
index 0000000..5ce6dca
--- /dev/null
+++ b/app/operations/layer-modes/gimpoperationdarkenonly.c
@@ -0,0 +1,135 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpoperationdarkenonlymode.c
+ * Copyright (C) 2008 Michael Natterer <mitch gimp org>
+ *               2012 Ville Sokk <ville sokk gmail com>
+ *               2017 Øyvind Kolås <pippin gimp org>
+ *
+ * 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-plugin.h>
+
+#include "../operations-types.h"
+
+#include "gimpoperationdarkenonly.h"
+
+
+static gboolean gimp_operation_darken_only_process (GeglOperation       *operation,
+                                                    void                *in_buf,
+                                                    void                *aux_buf,
+                                                    void                *aux2_buf,
+                                                    void                *out_buf,
+                                                    glong                samples,
+                                                    const GeglRectangle *roi,
+                                                    gint                 level);
+
+
+G_DEFINE_TYPE (GimpOperationDarkenOnly, gimp_operation_darken_only,
+               GIMP_TYPE_OPERATION_POINT_LAYER_MODE)
+
+
+static void
+gimp_operation_darken_only_class_init (GimpOperationDarkenOnlyClass *klass)
+{
+  GeglOperationClass               *operation_class;
+  GeglOperationPointComposer3Class *point_class;
+
+  operation_class = GEGL_OPERATION_CLASS (klass);
+  point_class     = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass);
+
+  gegl_operation_class_set_keys (operation_class,
+                                 "name",        "gimp:darken-only",
+                                 "description", "GIMP darken only mode operation",
+                                 NULL);
+
+  point_class->process = gimp_operation_darken_only_process;
+}
+
+static void
+gimp_operation_darken_only_init (GimpOperationDarkenOnly *self)
+{
+}
+
+static gboolean
+gimp_operation_darken_only_process (GeglOperation       *operation,
+                                    void                *in_buf,
+                                    void                *aux_buf,
+                                    void                *aux2_buf,
+                                    void                *out_buf,
+                                    glong                samples,
+                                    const GeglRectangle *roi,
+                                    gint                 level)
+{
+  gfloat opacity = GIMP_OPERATION_POINT_LAYER_MODE (operation)->opacity;
+
+  return gimp_operation_darken_only_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+}
+
+gboolean
+gimp_operation_darken_only_process_pixels (gfloat              *in,
+                                           gfloat              *layer,
+                                           gfloat              *mask,
+                                           gfloat              *out,
+                                           gfloat               opacity,
+                                           glong                samples,
+                                           const GeglRectangle *roi,
+                                           gint                 level)
+{
+  const gboolean has_mask = mask != NULL;
+
+  while (samples--)
+    {
+      gfloat comp_alpha;
+
+      comp_alpha = layer[ALPHA] * opacity;
+      if (has_mask)
+        comp_alpha *= *mask;
+
+      if (comp_alpha != 0.0)
+        {
+          gint   b;
+
+          for (b = RED; b < ALPHA; b++)
+            {
+              gfloat comp = MIN (in[b], layer[b]);
+
+              out[b] = comp * comp_alpha + in[b] * (1.0 - comp_alpha);
+            }
+        }
+      else
+        {
+          gint b;
+
+          for (b = RED; b < ALPHA; b++)
+            {
+              out[b] = in[b];
+            }
+        }
+
+      out[ALPHA] = in[ALPHA];
+
+      in    += 4;
+      layer += 4;
+      out   += 4;
+
+      if (has_mask)
+        mask++;
+    }
+
+  return TRUE;
+}
diff --git a/app/operations/layer-modes/gimpoperationdarkenonly.h 
b/app/operations/layer-modes/gimpoperationdarkenonly.h
new file mode 100644
index 0000000..d7e363a
--- /dev/null
+++ b/app/operations/layer-modes/gimpoperationdarkenonly.h
@@ -0,0 +1,62 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpoperationdarken_onlymode.h
+ * Copyright (C) 2008 Michael Natterer <mitch gimp org>
+ *               2017 Øyvind Kolås <pippin gimp org>
+ *
+ * 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_OPERATION_DARKEN_ONLY_H__
+#define __GIMP_OPERATION_DARKEN_ONLY_H__
+
+
+#include "../gimpoperationpointlayermode.h"
+
+
+#define GIMP_TYPE_OPERATION_DARKEN_ONLY            (gimp_operation_darken_only_get_type ())
+#define GIMP_OPERATION_DARKEN_ONLY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GIMP_TYPE_OPERATION_DARKEN_ONLY_MODE, GimpOperationDarkenOnly))
+#define GIMP_OPERATION_DARKEN_ONLY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  
GIMP_TYPE_OPERATION_DARKEN_ONLY_MODE, GimpOperationDarkenOnlyClass))
+#define GIMP_IS_OPERATION_DARKEN_ONLY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GIMP_TYPE_OPERATION_DARKEN_ONLY_MODE))
+#define GIMP_IS_OPERATION_DARKEN_ONLY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  
GIMP_TYPE_OPERATION_DARKEN_ONLY_MODE))
+#define GIMP_OPERATION_DARKEN_ONLY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  
GIMP_TYPE_OPERATION_DARKEN_ONLY_MODE, GimpOperationDarkenOnlyClass))
+
+
+typedef struct _GimpOperationDarkenOnly      GimpOperationDarkenOnly;
+typedef struct _GimpOperationDarkenOnlyClass GimpOperationDarkenOnlyClass;
+
+struct _GimpOperationDarkenOnly
+{
+  GimpOperationPointLayerMode  parent_instance;
+};
+
+struct _GimpOperationDarkenOnlyClass
+{
+  GimpOperationPointLayerModeClass  parent_class;
+};
+
+
+GType   gimp_operation_darken_only_get_type (void) G_GNUC_CONST;
+
+gboolean gimp_operation_darken_only_process_pixels (gfloat              *in,
+                                                    gfloat              *layer,
+                                                    gfloat              *mask,
+                                                    gfloat              *out,
+                                                    gfloat               opacity,
+                                                    glong                samples,
+                                                    const GeglRectangle *roi,
+                                                    gint                 level);
+
+#endif /* __GIMP_OPERATION_DARKEN_ONLY_H__ */
diff --git a/app/operations/gimpoperationlightenonlymode.c 
b/app/operations/layer-modes/gimpoperationlightenonly.c
similarity index 57%
rename from app/operations/gimpoperationlightenonlymode.c
rename to app/operations/layer-modes/gimpoperationlightenonly.c
index f7686e6..a0fff11 100644
--- a/app/operations/gimpoperationlightenonlymode.c
+++ b/app/operations/layer-modes/gimpoperationlightenonly.c
@@ -4,6 +4,7 @@
  * gimpoperationlightenonlymode.c
  * Copyright (C) 2008 Michael Natterer <mitch gimp org>
  *               2012 Ville Sokk <ville sokk gmail com>
+ *               2017 Øyvind Kolås <pippin gimp org>
  *
  * 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
@@ -23,12 +24,12 @@
 
 #include <gegl-plugin.h>
 
-#include "operations-types.h"
+#include "../operations-types.h"
 
-#include "gimpoperationlightenonlymode.h"
+#include "gimpoperationlightenonly.h"
 
 
-static gboolean gimp_operation_lighten_only_mode_process (GeglOperation       *operation,
+static gboolean gimp_operation_lighten_only_process (GeglOperation       *operation,
                                                           void                *in_buf,
                                                           void                *aux_buf,
                                                           void                *aux2_buf,
@@ -38,12 +39,12 @@ static gboolean gimp_operation_lighten_only_mode_process (GeglOperation       *o
                                                           gint                 level);
 
 
-G_DEFINE_TYPE (GimpOperationLightenOnlyMode, gimp_operation_lighten_only_mode,
+G_DEFINE_TYPE (GimpOperationLightenOnly, gimp_operation_lighten_only,
                GIMP_TYPE_OPERATION_POINT_LAYER_MODE)
 
 
 static void
-gimp_operation_lighten_only_mode_class_init (GimpOperationLightenOnlyModeClass *klass)
+gimp_operation_lighten_only_class_init (GimpOperationLightenOnlyClass *klass)
 {
   GeglOperationClass               *operation_class;
   GeglOperationPointComposer3Class *point_class;
@@ -52,65 +53,62 @@ gimp_operation_lighten_only_mode_class_init (GimpOperationLightenOnlyModeClass *
   point_class     = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass);
 
   gegl_operation_class_set_keys (operation_class,
-                                 "name",        "gimp:lighten-only-mode",
+                                 "name",        "gimp:lighten-only",
                                  "description", "GIMP lighten only mode operation",
                                  NULL);
 
-  point_class->process = gimp_operation_lighten_only_mode_process;
+  point_class->process = gimp_operation_lighten_only_process;
 }
 
 static void
-gimp_operation_lighten_only_mode_init (GimpOperationLightenOnlyMode *self)
+gimp_operation_lighten_only_init (GimpOperationLightenOnly *self)
 {
 }
 
 static gboolean
-gimp_operation_lighten_only_mode_process (GeglOperation       *operation,
-                                          void                *in_buf,
-                                          void                *aux_buf,
-                                          void                *aux2_buf,
-                                          void                *out_buf,
-                                          glong                samples,
-                                          const GeglRectangle *roi,
-                                          gint                 level)
+gimp_operation_lighten_only_process (GeglOperation       *operation,
+                                     void                *in_buf,
+                                     void                *aux_buf,
+                                     void                *aux2_buf,
+                                     void                *out_buf,
+                                     glong                samples,
+                                     const GeglRectangle *roi,
+                                     gint                 level)
 {
   gfloat 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);
+  return gimp_operation_lighten_only_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,
-                                                 gfloat               opacity,
-                                                 glong                samples,
-                                                 const GeglRectangle *roi,
-                                                 gint                 level)
+gimp_operation_lighten_only_process_pixels (gfloat              *in,
+                                            gfloat              *layer,
+                                            gfloat              *mask,
+                                            gfloat              *out,
+                                            gfloat               opacity,
+                                            glong                samples,
+                                            const GeglRectangle *roi,
+                                            gint                 level)
 {
   const gboolean has_mask = mask != NULL;
 
   while (samples--)
     {
-      gfloat comp_alpha, new_alpha;
+      gfloat comp_alpha;
 
-      comp_alpha = MIN (in[ALPHA], layer[ALPHA]) * opacity;
+      comp_alpha = layer[ALPHA] * opacity;
       if (has_mask)
         comp_alpha *= *mask;
 
-      new_alpha = in[ALPHA] + (1.0 - in[ALPHA]) * comp_alpha;
-
-      if (comp_alpha && new_alpha)
+      if (comp_alpha != 0.0)
         {
           gint   b;
-          gfloat ratio = comp_alpha / new_alpha;
 
           for (b = RED; b < ALPHA; b++)
             {
               gfloat comp = MAX (layer[b], in[b]);
 
-              out[b] = comp * ratio + in[b] * (1.0 - ratio);
+              out[b] = comp * comp_alpha + in[b] * (1.0 - comp_alpha);
             }
         }
       else
diff --git a/app/operations/layer-modes/gimpoperationlightenonly.h 
b/app/operations/layer-modes/gimpoperationlightenonly.h
new file mode 100644
index 0000000..7113e5f
--- /dev/null
+++ b/app/operations/layer-modes/gimpoperationlightenonly.h
@@ -0,0 +1,62 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpoperationlighten_onlymode.h
+ * Copyright (C) 2008 Michael Natterer <mitch gimp org>
+ *               2017 Øyvind Kolås <pippin gimp org>
+ *
+ * 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_OPERATION_LIGHTEN_ONLY_H__
+#define __GIMP_OPERATION_LIGHTEN_ONLY_H__
+
+
+#include "../gimpoperationpointlayermode.h"
+
+
+#define GIMP_TYPE_OPERATION_LIGHTEN_ONLY            (gimp_operation_lighten_only_get_type ())
+#define GIMP_OPERATION_LIGHTEN_ONLY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GIMP_TYPE_OPERATION_LIGHTEN_ONLY, GimpOperationLightenOnly))
+#define GIMP_OPERATION_LIGHTEN_ONLY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  
GIMP_TYPE_OPERATION_LIGHTEN_ONLY, GimpOperationLightenOnlyClass))
+#define GIMP_IS_OPERATION_LIGHTEN_ONLY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GIMP_TYPE_OPERATION_LIGHTEN_ONLY))
+#define GIMP_IS_OPERATION_LIGHTEN_ONLY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  
GIMP_TYPE_OPERATION_LIGHTEN_ONLY))
+#define GIMP_OPERATION_LIGHTEN_ONLY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  
GIMP_TYPE_OPERATION_LIGHTEN_ONLY, GimpOperationLightenOnlyClass))
+
+
+typedef struct _GimpOperationLightenOnly      GimpOperationLightenOnly;
+typedef struct _GimpOperationLightenOnlyClass GimpOperationLightenOnlyClass;
+
+struct _GimpOperationLightenOnly
+{
+  GimpOperationPointLayerMode  parent_instance;
+};
+
+struct _GimpOperationLightenOnlyClass
+{
+  GimpOperationPointLayerModeClass  parent_class;
+};
+
+
+GType   gimp_operation_lighten_only_get_type (void) G_GNUC_CONST;
+
+gboolean gimp_operation_lighten_only_process_pixels (gfloat              *in,
+                                                     gfloat              *layer,
+                                                     gfloat              *mask,
+                                                     gfloat              *out,
+                                                     gfloat               opacity,
+                                                     glong                samples,
+                                                     const GeglRectangle *roi,
+                                                     gint                 level);
+
+#endif /* __GIMP_OPERATION_LIGHTEN_ONLY_H__ */
diff --git a/app/widgets/gimpwidgets-constructors.c b/app/widgets/gimpwidgets-constructors.c
index c89a833..b134b08 100644
--- a/app/widgets/gimpwidgets-constructors.c
+++ b/app/widgets/gimpwidgets-constructors.c
@@ -104,11 +104,11 @@ gimp_paint_mode_menu_new (gboolean with_behind_mode,
   GtkWidget    *combo;
 
   store = gimp_enum_store_new_with_values (GIMP_TYPE_LAYER_MODE,
-                                           33,
+                                           35,
                                            GIMP_LAYER_MODE_NORMAL,
                                            GIMP_LAYER_MODE_NORMAL_NON_LINEAR,
                                            GIMP_LAYER_MODE_DISSOLVE,
-
+                                           GIMP_LAYER_MODE_LIGHTEN_ONLY,
                                            GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY,
                                            GIMP_LAYER_MODE_SCREEN,
                                            GIMP_LAYER_MODE_SCREEN_LEGACY,
@@ -116,17 +116,15 @@ gimp_paint_mode_menu_new (gboolean with_behind_mode,
                                            GIMP_LAYER_MODE_DODGE_LEGACY,
                                            GIMP_LAYER_MODE_ADDITION,
                                            GIMP_LAYER_MODE_ADDITION_LEGACY,
-
+                                           GIMP_LAYER_MODE_DARKEN_ONLY,
                                            GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY,
                                            GIMP_LAYER_MODE_MULTIPLY,
                                            GIMP_LAYER_MODE_MULTIPLY_LINEAR,
                                            GIMP_LAYER_MODE_MULTIPLY_LEGACY,
                                            GIMP_LAYER_MODE_BURN_LEGACY,
-
                                            GIMP_LAYER_MODE_OVERLAY,
                                            GIMP_LAYER_MODE_SOFTLIGHT_LEGACY,
                                            GIMP_LAYER_MODE_HARDLIGHT_LEGACY,
-
                                            GIMP_LAYER_MODE_DIFFERENCE,
                                            GIMP_LAYER_MODE_DIFFERENCE_LEGACY,
                                            GIMP_LAYER_MODE_SUBTRACT,
@@ -134,12 +132,10 @@ gimp_paint_mode_menu_new (gboolean with_behind_mode,
                                            GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY,
                                            GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY,
                                            GIMP_LAYER_MODE_DIVIDE_LEGACY,
-
                                            GIMP_LAYER_MODE_HSV_HUE_LEGACY,
                                            GIMP_LAYER_MODE_HSV_SATURATION_LEGACY,
                                            GIMP_LAYER_MODE_HSV_COLOR_LEGACY,
                                            GIMP_LAYER_MODE_HSV_VALUE_LEGACY,
-
                                            GIMP_LAYER_MODE_LCH_HUE,
                                            GIMP_LAYER_MODE_LCH_CHROMA,
                                            GIMP_LAYER_MODE_LCH_COLOR,
diff --git a/libgimp/gimpenums.h b/libgimp/gimpenums.h
index 7efc409..ec9f025 100644
--- a/libgimp/gimpenums.h
+++ b/libgimp/gimpenums.h
@@ -104,7 +104,9 @@ typedef enum
   GIMP_LAYER_MODE_SCREEN,
   GIMP_LAYER_MODE_DIFFERENCE,
   GIMP_LAYER_MODE_ADDITION,
-  GIMP_LAYER_MODE_SUBTRACT
+  GIMP_LAYER_MODE_SUBTRACT,
+  GIMP_LAYER_MODE_DARKEN_ONLY,
+  GIMP_LAYER_MODE_LIGHTEN_ONLY
 } GimpLayerMode;
 
 
diff --git a/tools/pdbgen/enums.pl b/tools/pdbgen/enums.pl
index d065bf0..fc78806 100644
--- a/tools/pdbgen/enums.pl
+++ b/tools/pdbgen/enums.pl
@@ -725,7 +725,9 @@ package Gimp::CodeGen::enums;
                          GIMP_LAYER_MODE_MULTIPLY_LINEAR
                          GIMP_LAYER_MODE_DODGE GIMP_LAYER_MODE_SCREEN
                          GIMP_LAYER_MODE_DIFFERENCE
-                         GIMP_LAYER_MODE_ADDITION GIMP_LAYER_MODE_SUBTRACT) ],
+                         GIMP_LAYER_MODE_ADDITION GIMP_LAYER_MODE_SUBTRACT
+                         GIMP_LAYER_MODE_DARKEN_ONLY
+                         GIMP_LAYER_MODE_LIGHTEN_ONLY) ],
          mapping => { GIMP_LAYER_MODE_NORMAL_NON_LINEAR => '0',
                       GIMP_LAYER_MODE_DISSOLVE => '1',
                       GIMP_LAYER_MODE_BEHIND => '2',
@@ -761,7 +763,9 @@ package Gimp::CodeGen::enums;
                       GIMP_LAYER_MODE_SCREEN => '32',
                       GIMP_LAYER_MODE_DIFFERENCE => '33',
                       GIMP_LAYER_MODE_ADDITION => '34',
-                      GIMP_LAYER_MODE_SUBTRACT => '35' }
+                      GIMP_LAYER_MODE_SUBTRACT => '35',
+                      GIMP_LAYER_MODE_DARKEN_ONLY => '36',
+                      GIMP_LAYER_MODE_LIGHTEN_ONLY => '37' }
        },
     GimpBrushApplicationMode =>
        { contig => 1,


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