[gimp] app: duplicate hsv layer modes, and fix alpha handling



commit 71030f49e9ba564762bcdfde36fc07cf8e2629b4
Author: Øyvind Kolås <pippin gimp org>
Date:   Tue Jan 10 19:37:51 2017 +0100

    app: duplicate hsv layer modes, and fix alpha handling

 app/core/core-enums.c                              |   16 +++-
 app/core/core-enums.h                              |   12 ++-
 app/gegl/gimp-gegl-nodes.c                         |   28 ++++++-
 app/operations/Makefile.am                         |    8 --
 app/operations/gimp-operations.c                   |   24 ++++--
 app/operations/gimplayermodefunctions.c            |   36 +++++++--
 app/operations/gimpoperationcolormode.h            |   61 ----------------
 app/operations/gimpoperationhuemode.h              |   61 ----------------
 app/operations/gimpoperationsaturationmode.h       |   61 ----------------
 app/operations/gimpoperationvaluemode.h            |   61 ----------------
 app/operations/layer-modes-legacy/Makefile.am      |   12 +++-
 .../gimpoperationhsvcolorlegacy.c}                 |   64 ++++++++--------
 .../gimpoperationhsvcolorlegacy.h                  |   61 ++++++++++++++++
 .../gimpoperationhsvhuelegacy.c}                   |   64 ++++++++--------
 .../layer-modes-legacy/gimpoperationhsvhuelegacy.h |   61 ++++++++++++++++
 .../gimpoperationhsvsaturationlegacy.c}            |   64 ++++++++--------
 .../gimpoperationhsvsaturationlegacy.h             |   61 ++++++++++++++++
 .../gimpoperationhsvvaluelegacy.c}                 |   64 ++++++++--------
 .../gimpoperationhsvvaluelegacy.h                  |   61 ++++++++++++++++
 app/operations/layer-modes/Makefile.am             |   10 +++-
 .../gimpoperationhsvcolor.c}                       |   76 ++++++++++----------
 app/operations/layer-modes/gimpoperationhsvcolor.h |   62 ++++++++++++++++
 .../gimpoperationhsvhue.c}                         |   76 ++++++++++----------
 app/operations/layer-modes/gimpoperationhsvhue.h   |   62 ++++++++++++++++
 .../gimpoperationhsvsaturation.c}                  |   62 ++++++++--------
 .../layer-modes/gimpoperationhsvsaturation.h       |   62 ++++++++++++++++
 .../gimpoperationhsvvalue.c}                       |   65 +++++++++--------
 app/operations/layer-modes/gimpoperationhsvvalue.h |   62 ++++++++++++++++
 app/widgets/gimpwidgets-constructors.c             |    6 ++-
 libgimp/gimpenums.h                                |    6 ++-
 tools/pdbgen/enums.pl                              |   12 +++-
 31 files changed, 884 insertions(+), 557 deletions(-)
---
diff --git a/app/core/core-enums.c b/app/core/core-enums.c
index db36e48..997dffd 100644
--- a/app/core/core-enums.c
+++ b/app/core/core-enums.c
@@ -327,6 +327,10 @@ gimp_layer_mode_get_type (void)
     { 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_HSV_HUE, "GIMP_LAYER_MODE_HSV_HUE", "hsv-hue" },
+    { GIMP_LAYER_MODE_HSV_SATURATION, "GIMP_LAYER_MODE_HSV_SATURATION", "hsv-saturation" },
+    { GIMP_LAYER_MODE_HSV_COLOR, "GIMP_LAYER_MODE_HSV_COLOR", "hsv-color" },
+    { GIMP_LAYER_MODE_HSV_VALUE, "GIMP_LAYER_MODE_HSV_VALUE", "hsv-value" },
     { 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" },
@@ -346,10 +350,10 @@ gimp_layer_mode_get_type (void)
     { GIMP_LAYER_MODE_SUBTRACT_LEGACY, NC_("layer-mode", "Subtract (legacy)"), 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 },
-    { GIMP_LAYER_MODE_HSV_VALUE_LEGACY, NC_("layer-mode", "Value (HSV)"), NULL },
+    { GIMP_LAYER_MODE_HSV_HUE_LEGACY, NC_("layer-mode", "Hue (HSV) (legacy)"), NULL },
+    { GIMP_LAYER_MODE_HSV_SATURATION_LEGACY, NC_("layer-mode", "Saturation (HSV) (legacy)"), NULL },
+    { GIMP_LAYER_MODE_HSV_COLOR_LEGACY, NC_("layer-mode", "Color (HSV) (legacy)"), NULL },
+    { GIMP_LAYER_MODE_HSV_VALUE_LEGACY, NC_("layer-mode", "Value (HSV) (legacy)"), NULL },
     { GIMP_LAYER_MODE_DIVIDE_LEGACY, NC_("layer-mode", "Divide"), NULL },
     { GIMP_LAYER_MODE_DODGE_LEGACY, NC_("layer-mode", "Dodge (legacy)"), NULL },
     { GIMP_LAYER_MODE_BURN_LEGACY, NC_("layer-mode", "Burn"), NULL },
@@ -373,6 +377,10 @@ gimp_layer_mode_get_type (void)
     { 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_HSV_HUE, NC_("layer-mode", "Hue (HSV)"), NULL },
+    { GIMP_LAYER_MODE_HSV_SATURATION, NC_("layer-mode", "Saturation (HSV)"), NULL },
+    { GIMP_LAYER_MODE_HSV_COLOR, NC_("layer-mode", "Color (HSV)"), NULL },
+    { GIMP_LAYER_MODE_HSV_VALUE, NC_("layer-mode", "Value (HSV)"), 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 cfafe76..ded1d2d 100644
--- a/app/core/core-enums.h
+++ b/app/core/core-enums.h
@@ -165,10 +165,10 @@ typedef enum
   GIMP_LAYER_MODE_SUBTRACT_LEGACY,        /*< desc="Subtract (legacy)"    >*/
   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)"          >*/
-  GIMP_LAYER_MODE_HSV_VALUE_LEGACY,       /*< desc="Value (HSV)"          >*/
+  GIMP_LAYER_MODE_HSV_HUE_LEGACY,         /*< desc="Hue (HSV) (legacy)"   >*/
+  GIMP_LAYER_MODE_HSV_SATURATION_LEGACY,  /*< desc="Saturation (HSV) (legacy)">*/
+  GIMP_LAYER_MODE_HSV_COLOR_LEGACY,       /*< desc="Color (HSV) (legacy)" >*/
+  GIMP_LAYER_MODE_HSV_VALUE_LEGACY,       /*< desc="Value (HSV) (legacy)" >*/
   GIMP_LAYER_MODE_DIVIDE_LEGACY,          /*< desc="Divide"               >*/
   GIMP_LAYER_MODE_DODGE_LEGACY,           /*< desc="Dodge (legacy)"       >*/
   GIMP_LAYER_MODE_BURN_LEGACY,            /*< desc="Burn"                 >*/
@@ -192,6 +192,10 @@ typedef enum
   GIMP_LAYER_MODE_SUBTRACT,               /*< desc="Subtract"             >*/
   GIMP_LAYER_MODE_DARKEN_ONLY,            /*< desc="Darken only"          >*/
   GIMP_LAYER_MODE_LIGHTEN_ONLY,           /*< desc="Lighten only"         >*/
+  GIMP_LAYER_MODE_HSV_HUE,                /*< desc="Hue (HSV)"            >*/
+  GIMP_LAYER_MODE_HSV_SATURATION,         /*< desc="Saturation (HSV)"     >*/
+  GIMP_LAYER_MODE_HSV_COLOR,              /*< desc="Color (HSV)"          >*/
+  GIMP_LAYER_MODE_HSV_VALUE,              /*< desc="Value (HSV)"          >*/
 
   /* 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 6ebf01f..56c1a6e 100644
--- a/app/gegl/gimp-gegl-nodes.c
+++ b/app/gegl/gimp-gegl-nodes.c
@@ -223,20 +223,36 @@ gimp_gegl_mode_node_set_mode (GeglNode      *node,
       operation = "gimp:lighten-only-legacy";
       break;
 
+    case GIMP_LAYER_MODE_HSV_HUE:
+      operation = "gimp:hue";
+      break;
+
+    case GIMP_LAYER_MODE_HSV_SATURATION:
+      operation = "gimp:saturation";
+      break;
+
+    case GIMP_LAYER_MODE_HSV_COLOR:
+      operation = "gimp:color";
+      break;
+
+    case GIMP_LAYER_MODE_HSV_VALUE:
+      operation = "gimp:value";
+      break;
+
     case GIMP_LAYER_MODE_HSV_HUE_LEGACY:
-      operation = "gimp:hue-mode";
+      operation = "gimp:hue-legacy";
       break;
 
     case GIMP_LAYER_MODE_HSV_SATURATION_LEGACY:
-      operation = "gimp:saturation-mode";
+      operation = "gimp:saturation-legacy";
       break;
 
     case GIMP_LAYER_MODE_HSV_COLOR_LEGACY:
-      operation = "gimp:color-mode";
+      operation = "gimp:color-legacy";
       break;
 
     case GIMP_LAYER_MODE_HSV_VALUE_LEGACY:
-      operation = "gimp:value-mode";
+      operation = "gimp:value-legacy";
       break;
 
     case GIMP_LAYER_MODE_DIVIDE_LEGACY:
@@ -350,6 +366,10 @@ gimp_gegl_mode_node_set_mode (GeglNode      *node,
     case GIMP_LAYER_MODE_OVERLAY_LEGACY:
     case GIMP_LAYER_MODE_DIFFERENCE_LEGACY:
     case GIMP_LAYER_MODE_DIFFERENCE:
+    case GIMP_LAYER_MODE_HSV_HUE:
+    case GIMP_LAYER_MODE_HSV_SATURATION:
+    case GIMP_LAYER_MODE_HSV_COLOR:
+    case GIMP_LAYER_MODE_HSV_VALUE:
     case GIMP_LAYER_MODE_HSV_HUE_LEGACY:
     case GIMP_LAYER_MODE_HSV_SATURATION_LEGACY:
     case GIMP_LAYER_MODE_HSV_COLOR_LEGACY:
diff --git a/app/operations/Makefile.am b/app/operations/Makefile.am
index 48fd9c2..fe36a51 100644
--- a/app/operations/Makefile.am
+++ b/app/operations/Makefile.am
@@ -99,14 +99,6 @@ libappoperations_a_SOURCES = \
        gimpoperationpointlayermode.h           \
        gimpoperationbehindmode.c               \
        gimpoperationbehindmode.h               \
-       gimpoperationhuemode.c                  \
-       gimpoperationhuemode.h                  \
-       gimpoperationsaturationmode.c           \
-       gimpoperationsaturationmode.h           \
-       gimpoperationcolormode.c                \
-       gimpoperationcolormode.h                \
-       gimpoperationvaluemode.c                \
-       gimpoperationvaluemode.h                \
        gimpoperationdividemode.c               \
        gimpoperationdividemode.h               \
        gimpoperationburnmode.c                 \
diff --git a/app/operations/gimp-operations.c b/app/operations/gimp-operations.c
index ada9998..be5207d 100644
--- a/app/operations/gimp-operations.c
+++ b/app/operations/gimp-operations.c
@@ -84,10 +84,14 @@
 #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"
-#include "gimpoperationvaluemode.h"
+#include "layer-modes/gimpoperationhsvhue.h"
+#include "layer-modes/gimpoperationhsvsaturation.h"
+#include "layer-modes/gimpoperationhsvcolor.h"
+#include "layer-modes/gimpoperationhsvvalue.h"
+#include "layer-modes-legacy/gimpoperationhsvhuelegacy.h"
+#include "layer-modes-legacy/gimpoperationhsvsaturationlegacy.h"
+#include "layer-modes-legacy/gimpoperationhsvcolorlegacy.h"
+#include "layer-modes-legacy/gimpoperationhsvvaluelegacy.h"
 #include "gimpoperationdividemode.h"
 #include "layer-modes/gimpoperationdodge.h"
 #include "layer-modes-legacy/gimpoperationdodgelegacy.h"
@@ -156,10 +160,14 @@ gimp_operations_init (void)
   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);
-  g_type_class_ref (GIMP_TYPE_OPERATION_VALUE_MODE);
+  g_type_class_ref (GIMP_TYPE_OPERATION_HSV_HUE);
+  g_type_class_ref (GIMP_TYPE_OPERATION_HSV_SATURATION);
+  g_type_class_ref (GIMP_TYPE_OPERATION_HSV_COLOR);
+  g_type_class_ref (GIMP_TYPE_OPERATION_HSV_VALUE);
+  g_type_class_ref (GIMP_TYPE_OPERATION_HSV_HUE_LEGACY);
+  g_type_class_ref (GIMP_TYPE_OPERATION_HSV_SATURATION_LEGACY);
+  g_type_class_ref (GIMP_TYPE_OPERATION_HSV_COLOR_LEGACY);
+  g_type_class_ref (GIMP_TYPE_OPERATION_HSV_VALUE_LEGACY);
   g_type_class_ref (GIMP_TYPE_OPERATION_DIVIDE_MODE);
   g_type_class_ref (GIMP_TYPE_OPERATION_DODGE);
   g_type_class_ref (GIMP_TYPE_OPERATION_DODGE_LEGACY);
diff --git a/app/operations/gimplayermodefunctions.c b/app/operations/gimplayermodefunctions.c
index f69b2c8..4a9f2a2 100644
--- a/app/operations/gimplayermodefunctions.c
+++ b/app/operations/gimplayermodefunctions.c
@@ -44,10 +44,14 @@
 #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"
-#include "gimpoperationvaluemode.h"
+#include "layer-modes/gimpoperationhsvhue.h"
+#include "layer-modes-legacy/gimpoperationhsvhuelegacy.h"
+#include "layer-modes/gimpoperationhsvsaturation.h"
+#include "layer-modes-legacy/gimpoperationhsvsaturationlegacy.h"
+#include "layer-modes/gimpoperationhsvcolor.h"
+#include "layer-modes-legacy/gimpoperationhsvcolorlegacy.h"
+#include "layer-modes/gimpoperationhsvvalue.h"
+#include "layer-modes-legacy/gimpoperationhsvvaluelegacy.h"
 #include "gimpoperationdividemode.h"
 #include "layer-modes/gimpoperationdodge.h"
 #include "layer-modes-legacy/gimpoperationdodgelegacy.h"
@@ -146,20 +150,36 @@ get_layer_mode_function (GimpLayerMode  paint_mode,
       func = gimp_operation_lighten_only_legacy_process_pixels;
       break;
 
+    case GIMP_LAYER_MODE_HSV_HUE:
+      func = gimp_operation_hsv_hue_process_pixels;
+      break;
+
     case GIMP_LAYER_MODE_HSV_HUE_LEGACY:
-      func = gimp_operation_hue_mode_process_pixels;
+      func = gimp_operation_hsv_hue_legacy_process_pixels;
+      break;
+
+    case GIMP_LAYER_MODE_HSV_SATURATION:
+      func = gimp_operation_hsv_saturation_process_pixels;
       break;
 
     case GIMP_LAYER_MODE_HSV_SATURATION_LEGACY:
-      func = gimp_operation_saturation_mode_process_pixels;
+      func = gimp_operation_hsv_saturation_legacy_process_pixels;
+      break;
+
+    case GIMP_LAYER_MODE_HSV_COLOR:
+      func = gimp_operation_hsv_color_process_pixels;
       break;
 
     case GIMP_LAYER_MODE_HSV_COLOR_LEGACY:
-      func = gimp_operation_color_mode_process_pixels;
+      func = gimp_operation_hsv_color_legacy_process_pixels;
+      break;
+
+    case GIMP_LAYER_MODE_HSV_VALUE:
+      func = gimp_operation_hsv_value_process_pixels;
       break;
 
     case GIMP_LAYER_MODE_HSV_VALUE_LEGACY:
-      func = gimp_operation_value_mode_process_pixels;
+      func = gimp_operation_hsv_value_legacy_process_pixels;
       break;
 
     case GIMP_LAYER_MODE_DIVIDE_LEGACY:
diff --git a/app/operations/layer-modes-legacy/Makefile.am b/app/operations/layer-modes-legacy/Makefile.am
index 59003df..7841850 100644
--- a/app/operations/layer-modes-legacy/Makefile.am
+++ b/app/operations/layer-modes-legacy/Makefile.am
@@ -29,5 +29,13 @@ libapplayermodeslegacy_a_SOURCES = \
        gimpoperationsubtractlegacy.h   \
        gimpoperationdarkenonlylegacy.c \
        gimpoperationdarkenonlylegacy.h \
-       gimpoperationlightenonlylegacy.c \
-       gimpoperationlightenonlylegacy.h
+       gimpoperationlightenonlylegacy.c\
+       gimpoperationlightenonlylegacy.h\
+       gimpoperationhsvhuelegacy.c     \
+       gimpoperationhsvhuelegacy.h     \
+       gimpoperationhsvsaturationlegacy.c \
+       gimpoperationhsvsaturationlegacy.h \
+       gimpoperationhsvcolorlegacy.c   \
+       gimpoperationhsvcolorlegacy.h   \
+       gimpoperationhsvvaluelegacy.c   \
+       gimpoperationhsvvaluelegacy.h
diff --git a/app/operations/gimpoperationcolormode.c 
b/app/operations/layer-modes-legacy/gimpoperationhsvcolorlegacy.c
similarity index 54%
copy from app/operations/gimpoperationcolormode.c
copy to app/operations/layer-modes-legacy/gimpoperationhsvcolorlegacy.c
index 5f5a7ef..43e2ec4 100644
--- a/app/operations/gimpoperationcolormode.c
+++ b/app/operations/layer-modes-legacy/gimpoperationhsvcolorlegacy.c
@@ -27,27 +27,27 @@
 
 #include "libgimpcolor/gimpcolor.h"
 
-#include "operations-types.h"
+#include "../operations-types.h"
 
-#include "gimpoperationcolormode.h"
+#include "gimpoperationhsvcolorlegacy.h"
 
 
-static gboolean gimp_operation_color_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_hsv_color_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 (GimpOperationColorMode, gimp_operation_color_mode,
+G_DEFINE_TYPE (GimpOperationHsvColorLegacy, gimp_operation_hsv_color_legacy,
                GIMP_TYPE_OPERATION_POINT_LAYER_MODE)
 
 
 static void
-gimp_operation_color_mode_class_init (GimpOperationColorModeClass *klass)
+gimp_operation_hsv_color_legacy_class_init (GimpOperationHsvColorLegacyClass *klass)
 {
   GeglOperationClass               *operation_class;
   GeglOperationPointComposer3Class *point_class;
@@ -56,42 +56,42 @@ gimp_operation_color_mode_class_init (GimpOperationColorModeClass *klass)
   point_class     = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass);
 
   gegl_operation_class_set_keys (operation_class,
-                                 "name",        "gimp:color-mode",
+                                 "name",        "gimp:hsv-color-legacy",
                                  "description", "GIMP color mode operation",
                                  NULL);
 
-  point_class->process = gimp_operation_color_mode_process;
+  point_class->process = gimp_operation_hsv_color_legacy_process;
 }
 
 static void
-gimp_operation_color_mode_init (GimpOperationColorMode *self)
+gimp_operation_hsv_color_legacy_init (GimpOperationHsvColorLegacy *self)
 {
 }
 
 static gboolean
-gimp_operation_color_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_hsv_color_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_color_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+  return gimp_operation_hsv_color_legacy_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,
-                                          gfloat               opacity,
-                                          glong                samples,
-                                          const GeglRectangle *roi,
-                                          gint                 level)
+gimp_operation_hsv_color_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;
 
diff --git a/app/operations/layer-modes-legacy/gimpoperationhsvcolorlegacy.h 
b/app/operations/layer-modes-legacy/gimpoperationhsvcolorlegacy.h
new file mode 100644
index 0000000..49a19b2
--- /dev/null
+++ b/app/operations/layer-modes-legacy/gimpoperationhsvcolorlegacy.h
@@ -0,0 +1,61 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpoperationcolormode.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_HSV_COLOR_LEGACY_H__
+#define __GIMP_OPERATION_HSV_COLOR_LEGACY_H__
+
+
+#include "../gimpoperationpointlayermode.h"
+
+
+#define GIMP_TYPE_OPERATION_HSV_COLOR_LEGACY            (gimp_operation_hsv_color_legacy_get_type ())
+#define GIMP_OPERATION_HSV_COLOR_LEGACY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GIMP_TYPE_OPERATION_HSV_COLOR_LEGACY, GimpOperationHsvColorLegacy))
+#define GIMP_OPERATION_HSV_COLOR_LEGACY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  
GIMP_TYPE_OPERATION_HSV_COLOR_LEGACY, GimpOperationHsvColorLegacyClass))
+#define GIMP_IS_OPERATION_HSV_COLOR_LEGACY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GIMP_TYPE_OPERATION_HSV_COLOR_LEGACY))
+#define GIMP_IS_OPERATION_HSV_COLOR_LEGACY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  
GIMP_TYPE_OPERATION_HSV_COLOR_LEGACY))
+#define GIMP_OPERATION_HSV_COLOR_LEGACY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  
GIMP_TYPE_OPERATION_HSV_COLOR_LEGACY, GimpOperationHsvColorLegacyClass))
+
+
+typedef struct _GimpOperationHsvColorLegacy      GimpOperationHsvColorLegacy;
+typedef struct _GimpOperationHsvColorLegacyClass GimpOperationHsvColorLegacyClass;
+
+struct _GimpOperationHsvColorLegacy
+{
+  GimpOperationPointLayerMode  parent_instance;
+};
+
+struct _GimpOperationHsvColorLegacyClass
+{
+  GimpOperationPointLayerModeClass  parent_class;
+};
+
+
+GType   gimp_operation_hsv_color_legacy_get_type (void) G_GNUC_CONST;
+
+gboolean gimp_operation_hsv_color_legacy_process_pixels (gfloat              *in,
+                                                         gfloat              *layer,
+                                                         gfloat              *mask,
+                                                         gfloat              *out,
+                                                         gfloat               opacity,
+                                                         glong                samples,
+                                                         const GeglRectangle *roi,
+                                                         gint                 level);
+
+#endif /* __GIMP_OPERATION_HSV_COLOR_LEGACY_H__ */
diff --git a/app/operations/gimpoperationhuemode.c 
b/app/operations/layer-modes-legacy/gimpoperationhsvhuelegacy.c
similarity index 56%
copy from app/operations/gimpoperationhuemode.c
copy to app/operations/layer-modes-legacy/gimpoperationhsvhuelegacy.c
index a43e519..b7c2897 100644
--- a/app/operations/gimpoperationhuemode.c
+++ b/app/operations/layer-modes-legacy/gimpoperationhsvhuelegacy.c
@@ -27,27 +27,27 @@
 
 #include "libgimpcolor/gimpcolor.h"
 
-#include "operations-types.h"
+#include "../operations-types.h"
 
-#include "gimpoperationhuemode.h"
+#include "gimpoperationhsvhuelegacy.h"
 
 
-static gboolean gimp_operation_hue_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_hsv_hue_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 (GimpOperationHueMode, gimp_operation_hue_mode,
+G_DEFINE_TYPE (GimpOperationHsvHueLegacy, gimp_operation_hsv_hue_legacy,
                GIMP_TYPE_OPERATION_POINT_LAYER_MODE)
 
 
 static void
-gimp_operation_hue_mode_class_init (GimpOperationHueModeClass *klass)
+gimp_operation_hsv_hue_legacy_class_init (GimpOperationHsvHueLegacyClass *klass)
 {
   GeglOperationClass               *operation_class;
   GeglOperationPointComposer3Class *point_class;
@@ -56,42 +56,42 @@ gimp_operation_hue_mode_class_init (GimpOperationHueModeClass *klass)
   point_class     = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass);
 
   gegl_operation_class_set_keys (operation_class,
-                                 "name",        "gimp:hue-mode",
+                                 "name",        "gimp:hsv-hue-legacy",
                                  "description", "GIMP hue mode operation",
                                  NULL);
 
-  point_class->process = gimp_operation_hue_mode_process;
+  point_class->process = gimp_operation_hsv_hue_legacy_process;
 }
 
 static void
-gimp_operation_hue_mode_init (GimpOperationHueMode *self)
+gimp_operation_hsv_hue_legacy_init (GimpOperationHsvHueLegacy *self)
 {
 }
 
 static gboolean
-gimp_operation_hue_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_hsv_hue_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_hue_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, roi, 
level);
+  return gimp_operation_hsv_hue_legacy_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,
-                                        gfloat               opacity,
-                                        glong                samples,
-                                        const GeglRectangle *roi,
-                                        gint                 level)
+gimp_operation_hsv_hue_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;
 
diff --git a/app/operations/layer-modes-legacy/gimpoperationhsvhuelegacy.h 
b/app/operations/layer-modes-legacy/gimpoperationhsvhuelegacy.h
new file mode 100644
index 0000000..cc79393
--- /dev/null
+++ b/app/operations/layer-modes-legacy/gimpoperationhsvhuelegacy.h
@@ -0,0 +1,61 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpoperationhuemode.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_HSV_HUE_LEGACY_H__
+#define __GIMP_OPERATION_HSV_HUE_LEGACY_H__
+
+
+#include "../gimpoperationpointlayermode.h"
+
+
+#define GIMP_TYPE_OPERATION_HSV_HUE_LEGACY            (gimp_operation_hsv_hue_legacy_get_type ())
+#define GIMP_OPERATION_HSV_HUE_LEGACY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GIMP_TYPE_OPERATION_HSV_HUE_LEGACY, GimpOperationHsvHueLegacy))
+#define GIMP_OPERATION_HSV_HUE_LEGACY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  
GIMP_TYPE_OPERATION_HSV_HUE_LEGACY, GimpOperationHsvHueLegacyClass))
+#define GIMP_IS_OPERATION_HSV_HUE_LEGACY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GIMP_TYPE_OPERATION_HSV_HUE_LEGACY))
+#define GIMP_IS_OPERATION_HSV_HUE_LEGACY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  
GIMP_TYPE_OPERATION_HSV_HUE_LEGACY))
+#define GIMP_OPERATION_HSV_HUE_LEGACY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  
GIMP_TYPE_OPERATION_HSV_HUE_LEGACY, GimpOperationHsvHueLegacyClass))
+
+
+typedef struct _GimpOperationHsvHueLegacy      GimpOperationHsvHueLegacy;
+typedef struct _GimpOperationHsvHueLegacyClass GimpOperationHsvHueLegacyClass;
+
+struct _GimpOperationHsvHueLegacy
+{
+  GimpOperationPointLayerMode  parent_instance;
+};
+
+struct _GimpOperationHsvHueLegacyClass
+{
+  GimpOperationPointLayerModeClass  parent_class;
+};
+
+
+GType   gimp_operation_hsv_hue_legacy_get_type (void) G_GNUC_CONST;
+
+gboolean gimp_operation_hsv_hue_legacy_process_pixels (gfloat              *in,
+                                                       gfloat              *layer,
+                                                       gfloat              *mask,
+                                                       gfloat              *out,
+                                                       gfloat               opacity,
+                                                       glong                samples,
+                                                       const GeglRectangle *roi,
+                                                       gint                 level);
+
+#endif /* __GIMP_OPERATION_HSV_HUE_LEGACY_H__ */
diff --git a/app/operations/gimpoperationsaturationmode.c 
b/app/operations/layer-modes-legacy/gimpoperationhsvsaturationlegacy.c
similarity index 52%
copy from app/operations/gimpoperationsaturationmode.c
copy to app/operations/layer-modes-legacy/gimpoperationhsvsaturationlegacy.c
index 9297df2..5be8b2a 100644
--- a/app/operations/gimpoperationsaturationmode.c
+++ b/app/operations/layer-modes-legacy/gimpoperationhsvsaturationlegacy.c
@@ -27,27 +27,27 @@
 
 #include "libgimpcolor/gimpcolor.h"
 
-#include "operations-types.h"
+#include "../operations-types.h"
 
-#include "gimpoperationsaturationmode.h"
+#include "gimpoperationhsvsaturationlegacy.h"
 
 
-static gboolean gimp_operation_saturation_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_hsv_saturation_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 (GimpOperationSaturationMode, gimp_operation_saturation_mode,
+G_DEFINE_TYPE (GimpOperationHsvSaturationLegacy, gimp_operation_hsv_saturation_legacy,
                GIMP_TYPE_OPERATION_POINT_LAYER_MODE)
 
 
 static void
-gimp_operation_saturation_mode_class_init (GimpOperationSaturationModeClass *klass)
+gimp_operation_hsv_saturation_legacy_class_init (GimpOperationHsvSaturationLegacyClass *klass)
 {
   GeglOperationClass               *operation_class;
   GeglOperationPointComposer3Class *point_class;
@@ -56,42 +56,42 @@ gimp_operation_saturation_mode_class_init (GimpOperationSaturationModeClass *kla
   point_class     = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass);
 
   gegl_operation_class_set_keys (operation_class,
-                                 "name",        "gimp:saturation-mode",
+                                 "name",        "gimp:hsv-saturation-legacy",
                                  "description", "GIMP saturation mode operation",
                                  NULL);
 
-  point_class->process = gimp_operation_saturation_mode_process;
+  point_class->process = gimp_operation_hsv_saturation_legacy_process;
 }
 
 static void
-gimp_operation_saturation_mode_init (GimpOperationSaturationMode *self)
+gimp_operation_hsv_saturation_legacy_init (GimpOperationHsvSaturationLegacy *self)
 {
 }
 
 static gboolean
-gimp_operation_saturation_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_hsv_saturation_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_saturation_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, 
samples, roi, level);
+  return gimp_operation_hsv_saturation_legacy_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,
-                                               gfloat               opacity,
-                                               glong                samples,
-                                               const GeglRectangle *roi,
-                                               gint                 level)
+gimp_operation_hsv_saturation_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;
 
diff --git a/app/operations/layer-modes-legacy/gimpoperationhsvsaturationlegacy.h 
b/app/operations/layer-modes-legacy/gimpoperationhsvsaturationlegacy.h
new file mode 100644
index 0000000..f39bc6f
--- /dev/null
+++ b/app/operations/layer-modes-legacy/gimpoperationhsvsaturationlegacy.h
@@ -0,0 +1,61 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpoperationsaturationmode.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_HSV_SATURATION_LEGACY_H__
+#define __GIMP_OPERATION_HSV_SATURATION_LEGACY_H__
+
+
+#include "../gimpoperationpointlayermode.h"
+
+
+#define GIMP_TYPE_OPERATION_HSV_SATURATION_LEGACY            (gimp_operation_hsv_saturation_legacy_get_type 
())
+#define GIMP_OPERATION_HSV_SATURATION_LEGACY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GIMP_TYPE_OPERATION_HSV_SATURATION_LEGACY, GimpOperationHsvSaturationLegacy))
+#define GIMP_OPERATION_HSV_SATURATION_LEGACY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  
GIMP_TYPE_OPERATION_HSV_SATURATION_LEGACY, GimpOperationHsvSaturationLegacyClass))
+#define GIMP_IS_OPERATION_HSV_SATURATION_LEGACY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GIMP_TYPE_OPERATION_HSV_SATURATION_LEGACY))
+#define GIMP_IS_OPERATION_HSV_SATURATION_LEGACY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  
GIMP_TYPE_OPERATION_HSV_SATURATION_LEGACY))
+#define GIMP_OPERATION_HSV_SATURATION_LEGACY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  
GIMP_TYPE_OPERATION_HSV_SATURATION_LEGACY, GimpOperationHsvSaturationLegacyClass))
+
+
+typedef struct _GimpOperationHsvSaturationLegacy      GimpOperationHsvSaturationLegacy;
+typedef struct _GimpOperationHsvSaturationLegacyClass GimpOperationHsvSaturationLegacyClass;
+
+struct _GimpOperationHsvSaturationLegacy
+{
+  GimpOperationPointLayerMode  parent_instance;
+};
+
+struct _GimpOperationHsvSaturationLegacyClass
+{
+  GimpOperationPointLayerModeClass  parent_class;
+};
+
+
+GType   gimp_operation_hsv_saturation_legacy_get_type (void) G_GNUC_CONST;
+
+gboolean gimp_operation_hsv_saturation_legacy_process_pixels (gfloat              *in,
+                                                              gfloat              *layer,
+                                                              gfloat              *mask,
+                                                              gfloat              *out,
+                                                              gfloat               opacity,
+                                                              glong                samples,
+                                                              const GeglRectangle *roi,
+                                                              gint                 level);
+
+#endif /* __GIMP_OPERATION_HSV_SATURATION_LEGACY_H__ */
diff --git a/app/operations/gimpoperationvaluemode.c 
b/app/operations/layer-modes-legacy/gimpoperationhsvvaluelegacy.c
similarity index 54%
copy from app/operations/gimpoperationvaluemode.c
copy to app/operations/layer-modes-legacy/gimpoperationhsvvaluelegacy.c
index 21cca08..c75681d 100644
--- a/app/operations/gimpoperationvaluemode.c
+++ b/app/operations/layer-modes-legacy/gimpoperationhsvvaluelegacy.c
@@ -27,27 +27,27 @@
 
 #include "libgimpcolor/gimpcolor.h"
 
-#include "operations-types.h"
+#include "../operations-types.h"
 
-#include "gimpoperationvaluemode.h"
+#include "gimpoperationhsvvaluelegacy.h"
 
 
-static gboolean gimp_operation_value_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_hsv_value_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 (GimpOperationValueMode, gimp_operation_value_mode,
+G_DEFINE_TYPE (GimpOperationHsvValueLegacy, gimp_operation_hsv_value_legacy,
                GIMP_TYPE_OPERATION_POINT_LAYER_MODE)
 
 
 static void
-gimp_operation_value_mode_class_init (GimpOperationValueModeClass *klass)
+gimp_operation_hsv_value_legacy_class_init (GimpOperationHsvValueLegacyClass *klass)
 {
   GeglOperationClass               *operation_class;
   GeglOperationPointComposer3Class *point_class;
@@ -56,42 +56,42 @@ gimp_operation_value_mode_class_init (GimpOperationValueModeClass *klass)
   point_class     = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass);
 
   gegl_operation_class_set_keys (operation_class,
-                                 "name",        "gimp:value-mode",
+                                 "name",        "gimp:hsv-value-legacy",
                                  "description", "GIMP value mode operation",
                                  NULL);
 
-  point_class->process = gimp_operation_value_mode_process;
+  point_class->process = gimp_operation_hsv_value_legacy_process;
 }
 
 static void
-gimp_operation_value_mode_init (GimpOperationValueMode *self)
+gimp_operation_hsv_value_legacy_init (GimpOperationHsvValueLegacy *self)
 {
 }
 
 static gboolean
-gimp_operation_value_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_hsv_value_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_value_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+  return gimp_operation_hsv_value_legacy_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,
-                                          gfloat               opacity,
-                                          glong                samples,
-                                          const GeglRectangle *roi,
-                                          gint                 level)
+gimp_operation_hsv_value_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;
 
diff --git a/app/operations/layer-modes-legacy/gimpoperationhsvvaluelegacy.h 
b/app/operations/layer-modes-legacy/gimpoperationhsvvaluelegacy.h
new file mode 100644
index 0000000..db825a9
--- /dev/null
+++ b/app/operations/layer-modes-legacy/gimpoperationhsvvaluelegacy.h
@@ -0,0 +1,61 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpoperationvaluemode.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_HSV_VALUE_LEGACY_H__
+#define __GIMP_OPERATION_HSV_VALUE_LEGACY_H__
+
+
+#include "../gimpoperationpointlayermode.h"
+
+
+#define GIMP_TYPE_OPERATION_HSV_VALUE_LEGACY            (gimp_operation_hsv_value_legacy_get_type ())
+#define GIMP_OPERATION_HSV_VALUE_LEGACY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GIMP_TYPE_OPERATION_HSV_VALUE_LEGACY, GimpOperationHsvValueLegacy))
+#define GIMP_OPERATION_HSV_VALUE_LEGACY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  
GIMP_TYPE_OPERATION_HSV_VALUE_LEGACY, GimpOperationHsvValueLegacyClass))
+#define GIMP_IS_OPERATION_HSV_VALUE_LEGACY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GIMP_TYPE_OPERATION_HSV_VALUE_LEGACY))
+#define GIMP_IS_OPERATION_HSV_VALUE_LEGACY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  
GIMP_TYPE_OPERATION_HSV_VALUE_LEGACY))
+#define GIMP_OPERATION_HSV_VALUE_LEGACY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  
GIMP_TYPE_OPERATION_HSV_VALUE_LEGACY, GimpOperationHsvValueLegacyClass))
+
+
+typedef struct _GimpOperationHsvValueLegacy      GimpOperationHsvValueLegacy;
+typedef struct _GimpOperationHsvValueLegacyClass GimpOperationHsvValueLegacyClass;
+
+struct _GimpOperationHsvValueLegacy
+{
+  GimpOperationPointLayerMode  parent_instance;
+};
+
+struct _GimpOperationHsvValueLegacyClass
+{
+  GimpOperationPointLayerModeClass  parent_class;
+};
+
+
+GType   gimp_operation_hsv_value_legacy_get_type (void) G_GNUC_CONST;
+
+gboolean gimp_operation_hsv_value_legacy_process_pixels (gfloat              *in,
+                                                         gfloat              *layer,
+                                                         gfloat              *mask,
+                                                         gfloat              *out,
+                                                         gfloat               opacity,
+                                                         glong                samples,
+                                                         const GeglRectangle *roi,
+                                                         gint                 level);
+
+#endif /* __GIMP_OPERATION_HSV_VALUE_LEGACY_H__ */
diff --git a/app/operations/layer-modes/Makefile.am b/app/operations/layer-modes/Makefile.am
index 97cf688..4acc7ee 100644
--- a/app/operations/layer-modes/Makefile.am
+++ b/app/operations/layer-modes/Makefile.am
@@ -47,7 +47,15 @@ libapplayermodes_generic_a_sources = \
        gimpoperationdarkenonly.c       \
        gimpoperationdarkenonly.h       \
        gimpoperationlightenonly.c      \
-       gimpoperationlightenonly.h
+       gimpoperationlightenonly.h      \
+       gimpoperationhsvhue.c           \
+       gimpoperationhsvhue.h           \
+       gimpoperationhsvsaturation.c    \
+       gimpoperationhsvsaturation.h    \
+       gimpoperationhsvcolor.c         \
+       gimpoperationhsvcolor.h         \
+       gimpoperationhsvvalue.c         \
+       gimpoperationhsvvalue.h
 
 libapplayermodes_sse2_a_sources = \
        gimpoperationnormal-sse2.c
diff --git a/app/operations/gimpoperationcolormode.c b/app/operations/layer-modes/gimpoperationhsvcolor.c
similarity index 51%
rename from app/operations/gimpoperationcolormode.c
rename to app/operations/layer-modes/gimpoperationhsvcolor.c
index 5f5a7ef..756bcb9 100644
--- a/app/operations/gimpoperationcolormode.c
+++ b/app/operations/layer-modes/gimpoperationhsvcolor.c
@@ -4,6 +4,7 @@
  * gimpoperationcolormode.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
@@ -27,27 +28,27 @@
 
 #include "libgimpcolor/gimpcolor.h"
 
-#include "operations-types.h"
+#include "../operations-types.h"
 
-#include "gimpoperationcolormode.h"
+#include "gimpoperationhsvcolor.h"
 
 
-static gboolean gimp_operation_color_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_hsv_color_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 (GimpOperationColorMode, gimp_operation_color_mode,
+G_DEFINE_TYPE (GimpOperationHsvColor, gimp_operation_hsv_color,
                GIMP_TYPE_OPERATION_POINT_LAYER_MODE)
 
 
 static void
-gimp_operation_color_mode_class_init (GimpOperationColorModeClass *klass)
+gimp_operation_hsv_color_class_init (GimpOperationHsvColorClass *klass)
 {
   GeglOperationClass               *operation_class;
   GeglOperationPointComposer3Class *point_class;
@@ -56,42 +57,42 @@ gimp_operation_color_mode_class_init (GimpOperationColorModeClass *klass)
   point_class     = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass);
 
   gegl_operation_class_set_keys (operation_class,
-                                 "name",        "gimp:color-mode",
+                                 "name",        "gimp:hsv-color",
                                  "description", "GIMP color mode operation",
                                  NULL);
 
-  point_class->process = gimp_operation_color_mode_process;
+  point_class->process = gimp_operation_hsv_color_process;
 }
 
 static void
-gimp_operation_color_mode_init (GimpOperationColorMode *self)
+gimp_operation_hsv_color_init (GimpOperationHsvColor *self)
 {
 }
 
 static gboolean
-gimp_operation_color_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_hsv_color_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_color_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+  return gimp_operation_hsv_color_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,
-                                          gfloat               opacity,
-                                          glong                samples,
-                                          const GeglRectangle *roi,
-                                          gint                 level)
+gimp_operation_hsv_color_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;
 
@@ -100,19 +101,16 @@ gimp_operation_color_mode_process_pixels (gfloat              *in,
       GimpHSL layer_hsl, out_hsl;
       GimpRGB layer_rgb = {layer[0], layer[1], layer[2]};
       GimpRGB out_rgb   = {in[0], in[1], in[2]};
-      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)
         {
           gint   b;
           gfloat out_tmp[3];
-          gfloat ratio = comp_alpha / new_alpha;
 
           gimp_rgb_to_hsl (&layer_rgb, &layer_hsl);
           gimp_rgb_to_hsl (&out_rgb, &out_hsl);
@@ -127,7 +125,7 @@ gimp_operation_color_mode_process_pixels (gfloat              *in,
 
           for (b = RED; b < ALPHA; b++)
             {
-              out[b] = out_tmp[b] * ratio + in[b] * (1.0 - ratio);
+              out[b] = out_tmp[b] * comp_alpha + in[b] * (1.0 - comp_alpha);
             }
         }
       else
diff --git a/app/operations/layer-modes/gimpoperationhsvcolor.h 
b/app/operations/layer-modes/gimpoperationhsvcolor.h
new file mode 100644
index 0000000..7f730bb
--- /dev/null
+++ b/app/operations/layer-modes/gimpoperationhsvcolor.h
@@ -0,0 +1,62 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpoperationcolormode.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_HSV_COLOR_H__
+#define __GIMP_OPERATION_HSV_COLOR_H__
+
+
+#include "../gimpoperationpointlayermode.h"
+
+
+#define GIMP_TYPE_OPERATION_HSV_COLOR            (gimp_operation_hsv_color_get_type ())
+#define GIMP_OPERATION_HSV_COLOR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GIMP_TYPE_OPERATION_COLOR, GimpOperationHsvColor))
+#define GIMP_OPERATION_HSV_COLOR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  
GIMP_TYPE_OPERATION_COLOR, GimpOperationHsvColorClass))
+#define GIMP_IS_OPERATION_HSV_COLOR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GIMP_TYPE_OPERATION_COLOR))
+#define GIMP_IS_OPERATION_HSV_COLOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  
GIMP_TYPE_OPERATION_COLOR))
+#define GIMP_OPERATION_HSV_COLOR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  
GIMP_TYPE_OPERATION_COLOR, GimpOperationHsvColorClass))
+
+
+typedef struct _GimpOperationHsvColor      GimpOperationHsvColor;
+typedef struct _GimpOperationHsvColorClass GimpOperationHsvColorClass;
+
+struct _GimpOperationHsvColor
+{
+  GimpOperationPointLayerMode  parent_instance;
+};
+
+struct _GimpOperationHsvColorClass
+{
+  GimpOperationPointLayerModeClass  parent_class;
+};
+
+
+GType   gimp_operation_hsv_color_get_type (void) G_GNUC_CONST;
+
+gboolean gimp_operation_hsv_color_process_pixels (gfloat              *in,
+                                                  gfloat              *layer,
+                                                  gfloat              *mask,
+                                                  gfloat              *out,
+                                                  gfloat               opacity,
+                                                  glong                samples,
+                                                  const GeglRectangle *roi,
+                                                  gint                 level);
+
+#endif /* __GIMP_OPERATION_HSV_COLOR_H__ */
diff --git a/app/operations/gimpoperationhuemode.c b/app/operations/layer-modes/gimpoperationhsvhue.c
similarity index 53%
rename from app/operations/gimpoperationhuemode.c
rename to app/operations/layer-modes/gimpoperationhsvhue.c
index a43e519..e5b2595 100644
--- a/app/operations/gimpoperationhuemode.c
+++ b/app/operations/layer-modes/gimpoperationhsvhue.c
@@ -4,6 +4,7 @@
  * gimpoperationhuemode.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
@@ -27,27 +28,27 @@
 
 #include "libgimpcolor/gimpcolor.h"
 
-#include "operations-types.h"
+#include "../operations-types.h"
 
-#include "gimpoperationhuemode.h"
+#include "gimpoperationhsvhue.h"
 
 
-static gboolean gimp_operation_hue_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_hsv_hue_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 (GimpOperationHueMode, gimp_operation_hue_mode,
+G_DEFINE_TYPE (GimpOperationHsvHue, gimp_operation_hsv_hue,
                GIMP_TYPE_OPERATION_POINT_LAYER_MODE)
 
 
 static void
-gimp_operation_hue_mode_class_init (GimpOperationHueModeClass *klass)
+gimp_operation_hsv_hue_class_init (GimpOperationHsvHueClass *klass)
 {
   GeglOperationClass               *operation_class;
   GeglOperationPointComposer3Class *point_class;
@@ -56,42 +57,42 @@ gimp_operation_hue_mode_class_init (GimpOperationHueModeClass *klass)
   point_class     = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass);
 
   gegl_operation_class_set_keys (operation_class,
-                                 "name",        "gimp:hue-mode",
+                                 "name",        "gimp:hsv-hue",
                                  "description", "GIMP hue mode operation",
                                  NULL);
 
-  point_class->process = gimp_operation_hue_mode_process;
+  point_class->process = gimp_operation_hsv_hue_process;
 }
 
 static void
-gimp_operation_hue_mode_init (GimpOperationHueMode *self)
+gimp_operation_hsv_hue_init (GimpOperationHsvHue *self)
 {
 }
 
 static gboolean
-gimp_operation_hue_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_hsv_hue_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_hue_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, roi, 
level);
+  return gimp_operation_hsv_hue_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,
-                                        gfloat               opacity,
-                                        glong                samples,
-                                        const GeglRectangle *roi,
-                                        gint                 level)
+gimp_operation_hsv_hue_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;
 
@@ -100,19 +101,16 @@ gimp_operation_hue_mode_process_pixels (gfloat              *in,
       GimpHSV layer_hsv, out_hsv;
       GimpRGB layer_rgb = {layer[0], layer[1], layer[2]};
       GimpRGB out_rgb   = {in[0], in[1], in[2]};
-      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.0f)
         {
           gint   b;
           gfloat out_tmp[3];
-          gfloat ratio = comp_alpha / new_alpha;
 
           gimp_rgb_to_hsv (&layer_rgb, &layer_hsv);
           gimp_rgb_to_hsv (&out_rgb, &out_hsv);
@@ -132,7 +130,7 @@ gimp_operation_hue_mode_process_pixels (gfloat              *in,
 
           for (b = RED; b < ALPHA; b++)
             {
-              out[b] = out_tmp[b] * ratio + in[b] * (1.0 - ratio);
+              out[b] = out_tmp[b] * comp_alpha + in[b] * (1.0 - comp_alpha);
             }
         }
       else
diff --git a/app/operations/layer-modes/gimpoperationhsvhue.h 
b/app/operations/layer-modes/gimpoperationhsvhue.h
new file mode 100644
index 0000000..45c799a
--- /dev/null
+++ b/app/operations/layer-modes/gimpoperationhsvhue.h
@@ -0,0 +1,62 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpoperationhuemode.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_HUE_H__
+#define __GIMP_OPERATION_HUE_H__
+
+
+#include "../gimpoperationpointlayermode.h"
+
+
+#define GIMP_TYPE_OPERATION_HSV_HUE        (gimp_operation_hsv_hue_get_type ())
+#define GIMP_OPERATION_HUE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GIMP_TYPE_OPERATION_HSV_HUE_MODE, GimpOperationHsvHue))
+#define GIMP_OPERATION_HUE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  
GIMP_TYPE_OPERATION_HSV_HUE_MODE, GimpOperationHsvHueClass))
+#define GIMP_IS_OPERATION_HUE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GIMP_TYPE_OPERATION_HSV_HUE_MODE))
+#define GIMP_IS_OPERATION_HUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  
GIMP_TYPE_OPERATION_HSV_HUE_MODE))
+#define GIMP_OPERATION_HUE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  
GIMP_TYPE_OPERATION_HSV_HUE_MODE, GimpOperationHsvHueClass))
+
+
+typedef struct _GimpOperationHsvHue      GimpOperationHsvHue;
+typedef struct _GimpOperationHsvHueClass GimpOperationHsvHueClass;
+
+struct _GimpOperationHsvHue
+{
+  GimpOperationPointLayerMode  parent_instance;
+};
+
+struct _GimpOperationHsvHueClass
+{
+  GimpOperationPointLayerModeClass  parent_class;
+};
+
+
+GType   gimp_operation_hsv_hue_get_type (void) G_GNUC_CONST;
+
+gboolean gimp_operation_hsv_hue_process_pixels (gfloat              *in,
+                                                gfloat              *layer,
+                                                gfloat              *mask,
+                                                gfloat              *out,
+                                                gfloat               opacity,
+                                                glong                samples,
+                                                const GeglRectangle *roi,
+                                                gint                 level);
+
+#endif /* __GIMP_OPERATION_HUE_H__ */
diff --git a/app/operations/gimpoperationsaturationmode.c 
b/app/operations/layer-modes/gimpoperationhsvsaturation.c
similarity index 60%
rename from app/operations/gimpoperationsaturationmode.c
rename to app/operations/layer-modes/gimpoperationhsvsaturation.c
index 9297df2..88e6ddb 100644
--- a/app/operations/gimpoperationsaturationmode.c
+++ b/app/operations/layer-modes/gimpoperationhsvsaturation.c
@@ -4,6 +4,7 @@
  * gimpoperationsaturationmode.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
@@ -27,12 +28,12 @@
 
 #include "libgimpcolor/gimpcolor.h"
 
-#include "operations-types.h"
+#include "../operations-types.h"
 
-#include "gimpoperationsaturationmode.h"
+#include "gimpoperationhsvsaturation.h"
 
 
-static gboolean gimp_operation_saturation_mode_process (GeglOperation       *operation,
+static gboolean gimp_operation_hsv_saturation_process (GeglOperation       *operation,
                                                         void                *in_buf,
                                                         void                *aux_buf,
                                                         void                *aux2_buf,
@@ -42,12 +43,12 @@ static gboolean gimp_operation_saturation_mode_process (GeglOperation       *ope
                                                         gint                 level);
 
 
-G_DEFINE_TYPE (GimpOperationSaturationMode, gimp_operation_saturation_mode,
+G_DEFINE_TYPE (GimpOperationHsvSaturation, gimp_operation_hsv_saturation,
                GIMP_TYPE_OPERATION_POINT_LAYER_MODE)
 
 
 static void
-gimp_operation_saturation_mode_class_init (GimpOperationSaturationModeClass *klass)
+gimp_operation_hsv_saturation_class_init (GimpOperationHsvSaturationClass *klass)
 {
   GeglOperationClass               *operation_class;
   GeglOperationPointComposer3Class *point_class;
@@ -56,42 +57,42 @@ gimp_operation_saturation_mode_class_init (GimpOperationSaturationModeClass *kla
   point_class     = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass);
 
   gegl_operation_class_set_keys (operation_class,
-                                 "name",        "gimp:saturation-mode",
+                                 "name",        "gimp:hsv-saturation",
                                  "description", "GIMP saturation mode operation",
                                  NULL);
 
-  point_class->process = gimp_operation_saturation_mode_process;
+  point_class->process = gimp_operation_hsv_saturation_process;
 }
 
 static void
-gimp_operation_saturation_mode_init (GimpOperationSaturationMode *self)
+gimp_operation_hsv_saturation_init (GimpOperationHsvSaturation *self)
 {
 }
 
 static gboolean
-gimp_operation_saturation_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_hsv_saturation_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_saturation_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, 
samples, roi, level);
+  return gimp_operation_hsv_saturation_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,
-                                               gfloat               opacity,
-                                               glong                samples,
-                                               const GeglRectangle *roi,
-                                               gint                 level)
+gimp_operation_hsv_saturation_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;
 
@@ -100,19 +101,16 @@ gimp_operation_saturation_mode_process_pixels (gfloat              *in,
       GimpHSV layer_hsv, out_hsv;
       GimpRGB layer_rgb = {layer[0], layer[1], layer[2]};
       GimpRGB out_rgb   = {in[0], in[1], in[2]};
-      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.0f)
         {
           gint   b;
           gfloat out_tmp[3];
-          gfloat ratio = comp_alpha / new_alpha;
 
           gimp_rgb_to_hsv (&layer_rgb, &layer_hsv);
           gimp_rgb_to_hsv (&out_rgb, &out_hsv);
@@ -126,7 +124,7 @@ gimp_operation_saturation_mode_process_pixels (gfloat              *in,
 
           for (b = RED; b < ALPHA; b++)
             {
-              out[b] = out_tmp[b] * ratio + in[b] * (1.0 - ratio);
+              out[b] = out_tmp[b] * comp_alpha + in[b] * (1.0 - comp_alpha);
             }
         }
       else
diff --git a/app/operations/layer-modes/gimpoperationhsvsaturation.h 
b/app/operations/layer-modes/gimpoperationhsvsaturation.h
new file mode 100644
index 0000000..6c1acf6
--- /dev/null
+++ b/app/operations/layer-modes/gimpoperationhsvsaturation.h
@@ -0,0 +1,62 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpoperationsaturationmode.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_HSV_SATURATION_H__
+#define __GIMP_OPERATION_HSV_SATURATION_H__
+
+
+#include "../gimpoperationpointlayermode.h"
+
+
+#define GIMP_TYPE_OPERATION_HSV_SATURATION            (gimp_operation_hsv_saturation_get_type ())
+#define GIMP_OPERATION_HSV_SATURATION(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GIMP_TYPE_OPERATION_HSV_SATURATION, GimpOperationHsvSaturation))
+#define GIMP_OPERATION_HSV_SATURATION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  
GIMP_TYPE_OPERATION_HSV_SATURATION, GimpOperationHsvSaturationClass))
+#define GIMP_IS_OPERATION_HSV_SATURATION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GIMP_TYPE_OPERATION_HSV_SATURATION))
+#define GIMP_IS_OPERATION_HSV_SATURATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  
GIMP_TYPE_OPERATION_HSV_SATURATION))
+#define GIMP_OPERATION_HSV_SATURATION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  
GIMP_TYPE_OPERATION_HSV_SATURATION, GimpOperationHsvSaturationClass))
+
+
+typedef struct _GimpOperationHsvSaturation      GimpOperationHsvSaturation;
+typedef struct _GimpOperationHsvSaturationClass GimpOperationHsvSaturationClass;
+
+struct _GimpOperationHsvSaturation
+{
+  GimpOperationPointLayerMode  parent_instance;
+};
+
+struct _GimpOperationHsvSaturationClass
+{
+  GimpOperationPointLayerModeClass  parent_class;
+};
+
+
+GType   gimp_operation_hsv_saturation_get_type (void) G_GNUC_CONST;
+
+gboolean gimp_operation_hsv_saturation_process_pixels (gfloat              *in,
+                                                       gfloat              *layer,
+                                                       gfloat              *mask,
+                                                       gfloat              *out,
+                                                       gfloat               opacity,
+                                                       glong                samples,
+                                                       const GeglRectangle *roi,
+                                                       gint                 level);
+
+#endif /* __GIMP_OPERATION_HSV_SATURATION_H__ */
diff --git a/app/operations/gimpoperationvaluemode.c b/app/operations/layer-modes/gimpoperationhsvvalue.c
similarity index 56%
rename from app/operations/gimpoperationvaluemode.c
rename to app/operations/layer-modes/gimpoperationhsvvalue.c
index 21cca08..be4a35d 100644
--- a/app/operations/gimpoperationvaluemode.c
+++ b/app/operations/layer-modes/gimpoperationhsvvalue.c
@@ -4,6 +4,7 @@
  * gimpoperationvaluemode.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
@@ -27,27 +28,27 @@
 
 #include "libgimpcolor/gimpcolor.h"
 
-#include "operations-types.h"
+#include "../operations-types.h"
 
-#include "gimpoperationvaluemode.h"
+#include "gimpoperationhsvvalue.h"
 
 
-static gboolean gimp_operation_value_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_hsv_value_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 (GimpOperationValueMode, gimp_operation_value_mode,
+G_DEFINE_TYPE (GimpOperationHsvValue, gimp_operation_hsv_value,
                GIMP_TYPE_OPERATION_POINT_LAYER_MODE)
 
 
 static void
-gimp_operation_value_mode_class_init (GimpOperationValueModeClass *klass)
+gimp_operation_hsv_value_class_init (GimpOperationHsvValueClass *klass)
 {
   GeglOperationClass               *operation_class;
   GeglOperationPointComposer3Class *point_class;
@@ -56,42 +57,42 @@ gimp_operation_value_mode_class_init (GimpOperationValueModeClass *klass)
   point_class     = GEGL_OPERATION_POINT_COMPOSER3_CLASS (klass);
 
   gegl_operation_class_set_keys (operation_class,
-                                 "name",        "gimp:value-mode",
+                                 "name",        "gimp:hsv-value",
                                  "description", "GIMP value mode operation",
                                  NULL);
 
-  point_class->process = gimp_operation_value_mode_process;
+  point_class->process = gimp_operation_hsv_value_process;
 }
 
 static void
-gimp_operation_value_mode_init (GimpOperationValueMode *self)
+gimp_operation_hsv_value_init (GimpOperationHsvValue *self)
 {
 }
 
 static gboolean
-gimp_operation_value_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_hsv_value_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_value_mode_process_pixels (in_buf, aux_buf, aux2_buf, out_buf, opacity, samples, 
roi, level);
+  return gimp_operation_hsv_value_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,
-                                          gfloat               opacity,
-                                          glong                samples,
-                                          const GeglRectangle *roi,
-                                          gint                 level)
+gimp_operation_hsv_value_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;
 
diff --git a/app/operations/layer-modes/gimpoperationhsvvalue.h 
b/app/operations/layer-modes/gimpoperationhsvvalue.h
new file mode 100644
index 0000000..5dadb7e
--- /dev/null
+++ b/app/operations/layer-modes/gimpoperationhsvvalue.h
@@ -0,0 +1,62 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpoperationvaluemode.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_HSV_VALUE_H__
+#define __GIMP_OPERATION_HSV_VALUE_H__
+
+
+#include "../gimpoperationpointlayermode.h"
+
+
+#define GIMP_TYPE_OPERATION_HSV_VALUE            (gimp_operation_hsv_value_get_type ())
+#define GIMP_OPERATION_HSV_VALUE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GIMP_TYPE_OPERATION_VALUE, GimpOperationHsvValue))
+#define GIMP_OPERATION_HSV_VALUE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  
GIMP_TYPE_OPERATION_VALUE, GimpOperationHsvValueClass))
+#define GIMP_IS_OPERATION_HSV_VALUE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GIMP_TYPE_OPERATION_VALUE))
+#define GIMP_IS_OPERATION_HSV_VALUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  
GIMP_TYPE_OPERATION_VALUE))
+#define GIMP_OPERATION_HSV_VALUE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  
GIMP_TYPE_OPERATION_VALUE, GimpOperationHsvValueClass))
+
+
+typedef struct _GimpOperationHsvValue      GimpOperationHsvValue;
+typedef struct _GimpOperationHsvValueClass GimpOperationHsvValueClass;
+
+struct _GimpOperationHsvValue
+{
+  GimpOperationPointLayerMode  parent_instance;
+};
+
+struct _GimpOperationHsvValueClass
+{
+  GimpOperationPointLayerModeClass  parent_class;
+};
+
+
+GType   gimp_operation_hsv_value_get_type (void) G_GNUC_CONST;
+
+gboolean gimp_operation_hsv_value_process_pixels (gfloat              *in,
+                                                  gfloat              *layer,
+                                                  gfloat              *mask,
+                                                  gfloat              *out,
+                                                  gfloat               opacity,
+                                                  glong                samples,
+                                                  const GeglRectangle *roi,
+                                                  gint                 level);
+
+#endif /* __GIMP_OPERATION_HSV_VALUE_H__ */
diff --git a/app/widgets/gimpwidgets-constructors.c b/app/widgets/gimpwidgets-constructors.c
index b134b08..07d46f8 100644
--- a/app/widgets/gimpwidgets-constructors.c
+++ b/app/widgets/gimpwidgets-constructors.c
@@ -104,7 +104,7 @@ gimp_paint_mode_menu_new (gboolean with_behind_mode,
   GtkWidget    *combo;
 
   store = gimp_enum_store_new_with_values (GIMP_TYPE_LAYER_MODE,
-                                           35,
+                                           39,
                                            GIMP_LAYER_MODE_NORMAL,
                                            GIMP_LAYER_MODE_NORMAL_NON_LINEAR,
                                            GIMP_LAYER_MODE_DISSOLVE,
@@ -132,6 +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,
+                                           GIMP_LAYER_MODE_HSV_SATURATION,
+                                           GIMP_LAYER_MODE_HSV_COLOR,
+                                           GIMP_LAYER_MODE_HSV_VALUE,
                                            GIMP_LAYER_MODE_HSV_HUE_LEGACY,
                                            GIMP_LAYER_MODE_HSV_SATURATION_LEGACY,
                                            GIMP_LAYER_MODE_HSV_COLOR_LEGACY,
diff --git a/libgimp/gimpenums.h b/libgimp/gimpenums.h
index ec9f025..80d8ee0 100644
--- a/libgimp/gimpenums.h
+++ b/libgimp/gimpenums.h
@@ -106,7 +106,11 @@ typedef enum
   GIMP_LAYER_MODE_ADDITION,
   GIMP_LAYER_MODE_SUBTRACT,
   GIMP_LAYER_MODE_DARKEN_ONLY,
-  GIMP_LAYER_MODE_LIGHTEN_ONLY
+  GIMP_LAYER_MODE_LIGHTEN_ONLY,
+  GIMP_LAYER_MODE_HSV_HUE,
+  GIMP_LAYER_MODE_HSV_SATURATION,
+  GIMP_LAYER_MODE_HSV_COLOR,
+  GIMP_LAYER_MODE_HSV_VALUE
 } GimpLayerMode;
 
 
diff --git a/tools/pdbgen/enums.pl b/tools/pdbgen/enums.pl
index fc78806..d73306e 100644
--- a/tools/pdbgen/enums.pl
+++ b/tools/pdbgen/enums.pl
@@ -727,7 +727,11 @@ package Gimp::CodeGen::enums;
                          GIMP_LAYER_MODE_DIFFERENCE
                          GIMP_LAYER_MODE_ADDITION GIMP_LAYER_MODE_SUBTRACT
                          GIMP_LAYER_MODE_DARKEN_ONLY
-                         GIMP_LAYER_MODE_LIGHTEN_ONLY) ],
+                         GIMP_LAYER_MODE_LIGHTEN_ONLY
+                         GIMP_LAYER_MODE_HSV_HUE
+                         GIMP_LAYER_MODE_HSV_SATURATION
+                         GIMP_LAYER_MODE_HSV_COLOR
+                         GIMP_LAYER_MODE_HSV_VALUE) ],
          mapping => { GIMP_LAYER_MODE_NORMAL_NON_LINEAR => '0',
                       GIMP_LAYER_MODE_DISSOLVE => '1',
                       GIMP_LAYER_MODE_BEHIND => '2',
@@ -765,7 +769,11 @@ package Gimp::CodeGen::enums;
                       GIMP_LAYER_MODE_ADDITION => '34',
                       GIMP_LAYER_MODE_SUBTRACT => '35',
                       GIMP_LAYER_MODE_DARKEN_ONLY => '36',
-                      GIMP_LAYER_MODE_LIGHTEN_ONLY => '37' }
+                      GIMP_LAYER_MODE_LIGHTEN_ONLY => '37',
+                      GIMP_LAYER_MODE_HSV_HUE => '38',
+                      GIMP_LAYER_MODE_HSV_SATURATION => '39',
+                      GIMP_LAYER_MODE_HSV_COLOR => '40',
+                      GIMP_LAYER_MODE_HSV_VALUE => '41' }
        },
     GimpBrushApplicationMode =>
        { contig => 1,



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