[gimp] app: replace some layer mode logic with data driven functions



commit 3f91ad7f3ca340fc6361266d86c4dd3009515202
Author: Øyvind Kolås <pippin gimp org>
Date:   Sat Feb 4 20:04:17 2017 +0100

    app: replace some layer mode logic with data driven functions

 app/core/gimp-layer-modes.c |  475 ++-----------------------------------------
 1 files changed, 14 insertions(+), 461 deletions(-)
---
diff --git a/app/core/gimp-layer-modes.c b/app/core/gimp-layer-modes.c
index 013e321..5b489a3 100644
--- a/app/core/gimp-layer-modes.c
+++ b/app/core/gimp-layer-modes.c
@@ -27,6 +27,8 @@
 
 #include "gimp-layer-modes.h"
 
+#include "operations/layer-modes/gimpoperationlayermode.h"
+
 
 /*  static variables  */
 
@@ -413,492 +415,43 @@ static const GimpLayerMode layer_mode_groups[][4] =
 gboolean
 gimp_layer_mode_is_legacy (GimpLayerMode  mode)
 {
-  switch (mode)
-    {
-    case GIMP_LAYER_MODE_MULTIPLY_LEGACY:
-    case GIMP_LAYER_MODE_SCREEN_LEGACY:
-    case GIMP_LAYER_MODE_OVERLAY_LEGACY:
-    case GIMP_LAYER_MODE_DIFFERENCE_LEGACY:
-    case GIMP_LAYER_MODE_ADDITION_LEGACY:
-    case GIMP_LAYER_MODE_SUBTRACT_LEGACY:
-    case GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY:
-    case GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY:
-    case GIMP_LAYER_MODE_HSV_HUE_LEGACY:
-    case GIMP_LAYER_MODE_HSV_SATURATION_LEGACY:
-    case GIMP_LAYER_MODE_HSV_COLOR_LEGACY:
-    case GIMP_LAYER_MODE_HSV_VALUE_LEGACY:
-    case GIMP_LAYER_MODE_DIVIDE_LEGACY:
-    case GIMP_LAYER_MODE_DODGE_LEGACY:
-    case GIMP_LAYER_MODE_BURN_LEGACY:
-    case GIMP_LAYER_MODE_HARDLIGHT_LEGACY:
-    case GIMP_LAYER_MODE_SOFTLIGHT_LEGACY:
-    case GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY:
-    case GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY:
-      return TRUE;
-
-    default:
-      break;
-    }
-
-  return FALSE;
+  const GimpLayerModeInfo *info = gimp_layer_mode_info (mode);
+  return info?info->flags & GIMP_LAYER_MODE_FLAG_LEGACY:FALSE;
 }
 
 gboolean
 gimp_layer_mode_wants_linear_data (GimpLayerMode  mode)
 {
-  switch (mode)
-    {
-    case GIMP_LAYER_MODE_NORMAL:
-      return FALSE;
-
-    case GIMP_LAYER_MODE_DISSOLVE:
-      return TRUE;
-
-    case GIMP_LAYER_MODE_BEHIND:
-      return FALSE;
-
-    case GIMP_LAYER_MODE_MULTIPLY_LEGACY:
-    case GIMP_LAYER_MODE_SCREEN_LEGACY:
-    case GIMP_LAYER_MODE_OVERLAY_LEGACY:
-    case GIMP_LAYER_MODE_DIFFERENCE_LEGACY:
-    case GIMP_LAYER_MODE_ADDITION_LEGACY:
-    case GIMP_LAYER_MODE_SUBTRACT_LEGACY:
-    case GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY:
-    case GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY:
-    case GIMP_LAYER_MODE_HSV_HUE_LEGACY:
-    case GIMP_LAYER_MODE_HSV_SATURATION_LEGACY:
-    case GIMP_LAYER_MODE_HSV_COLOR_LEGACY:
-    case GIMP_LAYER_MODE_HSV_VALUE_LEGACY:
-    case GIMP_LAYER_MODE_DIVIDE_LEGACY:
-    case GIMP_LAYER_MODE_DODGE_LEGACY:
-    case GIMP_LAYER_MODE_BURN_LEGACY:
-    case GIMP_LAYER_MODE_HARDLIGHT_LEGACY:
-    case GIMP_LAYER_MODE_SOFTLIGHT_LEGACY:
-    case GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY:
-    case GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY:
-      return FALSE;
-
-    case GIMP_LAYER_MODE_COLOR_ERASE:
-      return FALSE;
-
-    case GIMP_LAYER_MODE_OVERLAY:
-      return TRUE;
-
-    case GIMP_LAYER_MODE_LCH_HUE:
-    case GIMP_LAYER_MODE_LCH_CHROMA:
-    case GIMP_LAYER_MODE_LCH_COLOR:
-    case GIMP_LAYER_MODE_LCH_LIGHTNESS:
-      return TRUE;
-
-    case GIMP_LAYER_MODE_NORMAL_LINEAR:
-      return TRUE;
-
-    case GIMP_LAYER_MODE_MULTIPLY:
-    case GIMP_LAYER_MODE_SCREEN:
-    case GIMP_LAYER_MODE_DIFFERENCE:
-    case GIMP_LAYER_MODE_ADDITION:
-    case GIMP_LAYER_MODE_SUBTRACT:
-    case GIMP_LAYER_MODE_DARKEN_ONLY:
-    case GIMP_LAYER_MODE_LIGHTEN_ONLY:
-    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_DIVIDE:
-    case GIMP_LAYER_MODE_DODGE:
-    case GIMP_LAYER_MODE_BURN:
-    case GIMP_LAYER_MODE_HARDLIGHT:
-    case GIMP_LAYER_MODE_SOFTLIGHT:
-    case GIMP_LAYER_MODE_GRAIN_EXTRACT:
-    case GIMP_LAYER_MODE_GRAIN_MERGE:
-    case GIMP_LAYER_MODE_VIVID_LIGHT:
-    case GIMP_LAYER_MODE_PIN_LIGHT:
-    case GIMP_LAYER_MODE_LINEAR_LIGHT:
-    case GIMP_LAYER_MODE_EXCLUSION:
-    case GIMP_LAYER_MODE_LINEAR_BURN:
-    case GIMP_LAYER_MODE_LUMA_DARKEN_ONLY:
-    case GIMP_LAYER_MODE_LUMA_LIGHTEN_ONLY:
-      return TRUE;
-
-    case GIMP_LAYER_MODE_BEHIND_LINEAR:
-    case GIMP_LAYER_MODE_MULTIPLY_LINEAR:
-    case GIMP_LAYER_MODE_SCREEN_LINEAR:
-    case GIMP_LAYER_MODE_OVERLAY_LINEAR:
-    case GIMP_LAYER_MODE_DIFFERENCE_LINEAR:
-    case GIMP_LAYER_MODE_ADDITION_LINEAR:
-    case GIMP_LAYER_MODE_SUBTRACT_LINEAR:
-    case GIMP_LAYER_MODE_DIVIDE_LINEAR:
-    case GIMP_LAYER_MODE_DODGE_LINEAR:
-    case GIMP_LAYER_MODE_BURN_LINEAR:
-    case GIMP_LAYER_MODE_HARDLIGHT_LINEAR:
-    case GIMP_LAYER_MODE_SOFTLIGHT_LINEAR:
-    case GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR:
-    case GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR:
-    case GIMP_LAYER_MODE_VIVID_LIGHT_LINEAR:
-    case GIMP_LAYER_MODE_PIN_LIGHT_LINEAR:
-    case GIMP_LAYER_MODE_LINEAR_LIGHT_LINEAR:
-    case GIMP_LAYER_MODE_EXCLUSION_LINEAR:
-    case GIMP_LAYER_MODE_LINEAR_BURN_LINEAR:
-    case GIMP_LAYER_MODE_LUMINANCE_DARKEN_ONLY:
-    case GIMP_LAYER_MODE_LUMINANCE_LIGHTEN_ONLY:
-      return TRUE;
-
-    case GIMP_LAYER_MODE_ERASE:
-    case GIMP_LAYER_MODE_REPLACE:
-    case GIMP_LAYER_MODE_ANTI_ERASE:
-      return TRUE;
-    }
-
-  return TRUE;
+  const GimpLayerModeInfo *info = gimp_layer_mode_info (mode);
+  return info?info->flags & GIMP_LAYER_MODE_FLAG_WANTS_LINEAR_DATA:FALSE;
 }
 
 GimpLayerColorSpace
 gimp_layer_mode_get_blend_space (GimpLayerMode  mode)
 {
-  switch (mode)
-    {
-    case GIMP_LAYER_MODE_NORMAL:
-      return GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL;
-
-    case GIMP_LAYER_MODE_DISSOLVE:
-      return GIMP_LAYER_COLOR_SPACE_RGB_LINEAR;
-
-    case GIMP_LAYER_MODE_BEHIND:
-      return GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL;
-
-    case GIMP_LAYER_MODE_MULTIPLY_LEGACY:
-    case GIMP_LAYER_MODE_SCREEN_LEGACY:
-    case GIMP_LAYER_MODE_OVERLAY_LEGACY:
-    case GIMP_LAYER_MODE_DIFFERENCE_LEGACY:
-    case GIMP_LAYER_MODE_ADDITION_LEGACY:
-    case GIMP_LAYER_MODE_SUBTRACT_LEGACY:
-    case GIMP_LAYER_MODE_HSV_HUE_LEGACY:
-    case GIMP_LAYER_MODE_HSV_SATURATION_LEGACY:
-    case GIMP_LAYER_MODE_HSV_COLOR_LEGACY:
-    case GIMP_LAYER_MODE_HSV_VALUE_LEGACY:
-    case GIMP_LAYER_MODE_DIVIDE_LEGACY:
-    case GIMP_LAYER_MODE_DODGE_LEGACY:
-    case GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY:
-    case GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY:
-    case GIMP_LAYER_MODE_BURN_LEGACY:
-    case GIMP_LAYER_MODE_HARDLIGHT_LEGACY:
-    case GIMP_LAYER_MODE_SOFTLIGHT_LEGACY:
-    case GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY:
-    case GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY:
-      return GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL;
-
-    case GIMP_LAYER_MODE_COLOR_ERASE:
-    case GIMP_LAYER_MODE_OVERLAY:
-      return GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL;
-
-    case GIMP_LAYER_MODE_LCH_HUE:
-    case GIMP_LAYER_MODE_LCH_CHROMA:
-    case GIMP_LAYER_MODE_LCH_COLOR:
-    case GIMP_LAYER_MODE_LCH_LIGHTNESS:
-      return GIMP_LAYER_COLOR_SPACE_LAB;
-
-    case GIMP_LAYER_MODE_NORMAL_LINEAR:
-      return GIMP_LAYER_COLOR_SPACE_RGB_LINEAR;
-
-    case GIMP_LAYER_MODE_MULTIPLY:
-    case GIMP_LAYER_MODE_SCREEN:
-    case GIMP_LAYER_MODE_DIFFERENCE:
-    case GIMP_LAYER_MODE_ADDITION:
-    case GIMP_LAYER_MODE_SUBTRACT:
-    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_DIVIDE:
-    case GIMP_LAYER_MODE_DODGE:
-    case GIMP_LAYER_MODE_BURN:
-    case GIMP_LAYER_MODE_HARDLIGHT:
-    case GIMP_LAYER_MODE_SOFTLIGHT:
-    case GIMP_LAYER_MODE_GRAIN_EXTRACT:
-    case GIMP_LAYER_MODE_GRAIN_MERGE:
-    case GIMP_LAYER_MODE_VIVID_LIGHT:
-    case GIMP_LAYER_MODE_PIN_LIGHT:
-    case GIMP_LAYER_MODE_LINEAR_LIGHT:
-    case GIMP_LAYER_MODE_EXCLUSION:
-    case GIMP_LAYER_MODE_LINEAR_BURN:
-    case GIMP_LAYER_MODE_LUMA_DARKEN_ONLY:
-    case GIMP_LAYER_MODE_LUMA_LIGHTEN_ONLY:
-      return GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL;
-
-    case GIMP_LAYER_MODE_BEHIND_LINEAR:
-    case GIMP_LAYER_MODE_MULTIPLY_LINEAR:
-    case GIMP_LAYER_MODE_SCREEN_LINEAR:
-    case GIMP_LAYER_MODE_OVERLAY_LINEAR:
-    case GIMP_LAYER_MODE_DIFFERENCE_LINEAR:
-    case GIMP_LAYER_MODE_ADDITION_LINEAR:
-    case GIMP_LAYER_MODE_SUBTRACT_LINEAR:
-    case GIMP_LAYER_MODE_DARKEN_ONLY:
-    case GIMP_LAYER_MODE_LIGHTEN_ONLY:
-    case GIMP_LAYER_MODE_DIVIDE_LINEAR:
-    case GIMP_LAYER_MODE_DODGE_LINEAR:
-    case GIMP_LAYER_MODE_BURN_LINEAR:
-    case GIMP_LAYER_MODE_HARDLIGHT_LINEAR:
-    case GIMP_LAYER_MODE_SOFTLIGHT_LINEAR:
-    case GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR:
-    case GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR:
-    case GIMP_LAYER_MODE_VIVID_LIGHT_LINEAR:
-    case GIMP_LAYER_MODE_PIN_LIGHT_LINEAR:
-    case GIMP_LAYER_MODE_LINEAR_LIGHT_LINEAR:
-    case GIMP_LAYER_MODE_EXCLUSION_LINEAR:
-    case GIMP_LAYER_MODE_LINEAR_BURN_LINEAR:
-    case GIMP_LAYER_MODE_LUMINANCE_DARKEN_ONLY:
-    case GIMP_LAYER_MODE_LUMINANCE_LIGHTEN_ONLY:
-      return GIMP_LAYER_COLOR_SPACE_RGB_LINEAR;
-
-    case GIMP_LAYER_MODE_ERASE:
-    case GIMP_LAYER_MODE_REPLACE:
-    case GIMP_LAYER_MODE_ANTI_ERASE:
-      return GIMP_LAYER_COLOR_SPACE_RGB_LINEAR;
-    }
-
-  return GIMP_LAYER_COLOR_SPACE_RGB_LINEAR;
+  const GimpLayerModeInfo *info = gimp_layer_mode_info (mode);
+  return info?info->blend_space:GIMP_LAYER_COLOR_SPACE_RGB_LINEAR;
 }
 
 GimpLayerColorSpace
 gimp_layer_mode_get_composite_space (GimpLayerMode  mode)
 {
-  return GIMP_LAYER_COLOR_SPACE_RGB_LINEAR;
+  const GimpLayerModeInfo *info = gimp_layer_mode_info (mode);
+  return info?info->composite_space:GIMP_LAYER_COLOR_SPACE_RGB_LINEAR;
 }
 
 GimpLayerCompositeMode
 gimp_layer_mode_get_composite_mode (GimpLayerMode  mode)
 {
-  switch (mode)
-    {
-    case GIMP_LAYER_MODE_NORMAL:
-    case GIMP_LAYER_MODE_NORMAL_LINEAR:
-    case GIMP_LAYER_MODE_DISSOLVE:
-    case GIMP_LAYER_MODE_BEHIND:
-    case GIMP_LAYER_MODE_BEHIND_LINEAR:
-      return GIMP_LAYER_COMPOSITE_SRC_OVER;
-
-    case GIMP_LAYER_MODE_MULTIPLY_LEGACY:
-    case GIMP_LAYER_MODE_SCREEN_LEGACY:
-    case GIMP_LAYER_MODE_OVERLAY_LEGACY:
-    case GIMP_LAYER_MODE_DIFFERENCE_LEGACY:
-    case GIMP_LAYER_MODE_ADDITION_LEGACY:
-    case GIMP_LAYER_MODE_SUBTRACT_LEGACY:
-    case GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY:
-    case GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY:
-    case GIMP_LAYER_MODE_HSV_HUE_LEGACY:
-    case GIMP_LAYER_MODE_HSV_SATURATION_LEGACY:
-    case GIMP_LAYER_MODE_HSV_COLOR_LEGACY:
-    case GIMP_LAYER_MODE_HSV_VALUE_LEGACY:
-    case GIMP_LAYER_MODE_DIVIDE_LEGACY:
-    case GIMP_LAYER_MODE_DODGE_LEGACY:
-    case GIMP_LAYER_MODE_BURN_LEGACY:
-    case GIMP_LAYER_MODE_HARDLIGHT_LEGACY:
-    case GIMP_LAYER_MODE_SOFTLIGHT_LEGACY:
-    case GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY:
-    case GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY:
-    case GIMP_LAYER_MODE_COLOR_ERASE:
-    case GIMP_LAYER_MODE_OVERLAY:
-    case GIMP_LAYER_MODE_LCH_HUE:
-    case GIMP_LAYER_MODE_LCH_CHROMA:
-    case GIMP_LAYER_MODE_LCH_COLOR:
-    case GIMP_LAYER_MODE_LCH_LIGHTNESS:
-    case GIMP_LAYER_MODE_MULTIPLY:
-    case GIMP_LAYER_MODE_MULTIPLY_LINEAR:
-    case GIMP_LAYER_MODE_SCREEN:
-    case GIMP_LAYER_MODE_SCREEN_LINEAR:
-    case GIMP_LAYER_MODE_OVERLAY_LINEAR:
-    case GIMP_LAYER_MODE_DIFFERENCE:
-    case GIMP_LAYER_MODE_DIFFERENCE_LINEAR:
-    case GIMP_LAYER_MODE_ADDITION:
-    case GIMP_LAYER_MODE_ADDITION_LINEAR:
-    case GIMP_LAYER_MODE_SUBTRACT:
-    case GIMP_LAYER_MODE_SUBTRACT_LINEAR:
-    case GIMP_LAYER_MODE_DARKEN_ONLY:
-    case GIMP_LAYER_MODE_LIGHTEN_ONLY:
-    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_DIVIDE:
-    case GIMP_LAYER_MODE_DIVIDE_LINEAR:
-    case GIMP_LAYER_MODE_DODGE:
-    case GIMP_LAYER_MODE_DODGE_LINEAR:
-    case GIMP_LAYER_MODE_BURN:
-    case GIMP_LAYER_MODE_BURN_LINEAR:
-    case GIMP_LAYER_MODE_HARDLIGHT:
-    case GIMP_LAYER_MODE_HARDLIGHT_LINEAR:
-    case GIMP_LAYER_MODE_SOFTLIGHT:
-    case GIMP_LAYER_MODE_SOFTLIGHT_LINEAR:
-    case GIMP_LAYER_MODE_GRAIN_EXTRACT:
-    case GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR:
-    case GIMP_LAYER_MODE_GRAIN_MERGE:
-    case GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR:
-    case GIMP_LAYER_MODE_VIVID_LIGHT:
-    case GIMP_LAYER_MODE_VIVID_LIGHT_LINEAR:
-    case GIMP_LAYER_MODE_PIN_LIGHT:
-    case GIMP_LAYER_MODE_PIN_LIGHT_LINEAR:
-    case GIMP_LAYER_MODE_LINEAR_LIGHT:
-    case GIMP_LAYER_MODE_LINEAR_LIGHT_LINEAR:
-    case GIMP_LAYER_MODE_EXCLUSION:
-    case GIMP_LAYER_MODE_EXCLUSION_LINEAR:
-    case GIMP_LAYER_MODE_LINEAR_BURN:
-    case GIMP_LAYER_MODE_LINEAR_BURN_LINEAR:
-    case GIMP_LAYER_MODE_LUMA_DARKEN_ONLY:
-    case GIMP_LAYER_MODE_LUMINANCE_DARKEN_ONLY:
-    case GIMP_LAYER_MODE_LUMA_LIGHTEN_ONLY:
-    case GIMP_LAYER_MODE_LUMINANCE_LIGHTEN_ONLY:
-       return GIMP_LAYER_COMPOSITE_SRC_ATOP;
-
-    case GIMP_LAYER_MODE_ERASE:
-      return GIMP_LAYER_COMPOSITE_SRC_ATOP;
-
-    case GIMP_LAYER_MODE_REPLACE:
-    case GIMP_LAYER_MODE_ANTI_ERASE:
-      return GIMP_LAYER_COMPOSITE_SRC_OVER;
-    }
-
-  return GIMP_LAYER_COMPOSITE_SRC_OVER;
+  const GimpLayerModeInfo *info = gimp_layer_mode_info (mode);
+  return info?info->composite_mode:GIMP_LAYER_COMPOSITE_SRC_ATOP;
 }
 
 const gchar *
 gimp_layer_mode_get_operation (GimpLayerMode  mode)
 {
-  switch (mode)
-    {
-    case GIMP_LAYER_MODE_NORMAL:
-    case GIMP_LAYER_MODE_NORMAL_LINEAR:
-      return "gimp:normal";
-
-    case GIMP_LAYER_MODE_DISSOLVE:
-      return "gimp:dissolve";
-
-    case GIMP_LAYER_MODE_BEHIND:
-    case GIMP_LAYER_MODE_BEHIND_LINEAR:
-      return "gimp:behind";
-
-    case GIMP_LAYER_MODE_OVERLAY:
-    case GIMP_LAYER_MODE_OVERLAY_LINEAR:
-    case GIMP_LAYER_MODE_LCH_HUE:
-    case GIMP_LAYER_MODE_LCH_CHROMA:
-    case GIMP_LAYER_MODE_LCH_COLOR:
-    case GIMP_LAYER_MODE_LCH_LIGHTNESS:
-    case GIMP_LAYER_MODE_MULTIPLY:
-    case GIMP_LAYER_MODE_MULTIPLY_LINEAR:
-    case GIMP_LAYER_MODE_SCREEN:
-    case GIMP_LAYER_MODE_SCREEN_LINEAR:
-    case GIMP_LAYER_MODE_DIFFERENCE:
-    case GIMP_LAYER_MODE_DIFFERENCE_LINEAR:
-    case GIMP_LAYER_MODE_ADDITION:
-    case GIMP_LAYER_MODE_ADDITION_LINEAR:
-    case GIMP_LAYER_MODE_SUBTRACT:
-    case GIMP_LAYER_MODE_SUBTRACT_LINEAR:
-    case GIMP_LAYER_MODE_DARKEN_ONLY:
-    case GIMP_LAYER_MODE_LIGHTEN_ONLY:
-    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_DIVIDE:
-    case GIMP_LAYER_MODE_DIVIDE_LINEAR:
-    case GIMP_LAYER_MODE_DODGE:
-    case GIMP_LAYER_MODE_DODGE_LINEAR:
-    case GIMP_LAYER_MODE_BURN:
-    case GIMP_LAYER_MODE_BURN_LINEAR:
-    case GIMP_LAYER_MODE_HARDLIGHT:
-    case GIMP_LAYER_MODE_HARDLIGHT_LINEAR:
-    case GIMP_LAYER_MODE_SOFTLIGHT:
-    case GIMP_LAYER_MODE_SOFTLIGHT_LINEAR:
-    case GIMP_LAYER_MODE_GRAIN_EXTRACT:
-    case GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR:
-    case GIMP_LAYER_MODE_GRAIN_MERGE:
-    case GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR:
-    case GIMP_LAYER_MODE_VIVID_LIGHT:
-    case GIMP_LAYER_MODE_VIVID_LIGHT_LINEAR:
-    case GIMP_LAYER_MODE_PIN_LIGHT:
-    case GIMP_LAYER_MODE_PIN_LIGHT_LINEAR:
-    case GIMP_LAYER_MODE_LINEAR_LIGHT:
-    case GIMP_LAYER_MODE_LINEAR_LIGHT_LINEAR:
-    case GIMP_LAYER_MODE_EXCLUSION:
-    case GIMP_LAYER_MODE_EXCLUSION_LINEAR:
-    case GIMP_LAYER_MODE_LINEAR_BURN:
-    case GIMP_LAYER_MODE_LINEAR_BURN_LINEAR:
-    case GIMP_LAYER_MODE_LUMA_DARKEN_ONLY:
-    case GIMP_LAYER_MODE_LUMINANCE_DARKEN_ONLY:
-    case GIMP_LAYER_MODE_LUMA_LIGHTEN_ONLY:
-    case GIMP_LAYER_MODE_LUMINANCE_LIGHTEN_ONLY:
-      return "gimp:layer-mode";
-
-    case GIMP_LAYER_MODE_MULTIPLY_LEGACY:
-      return "gimp:multiply-legacy";
-
-    case GIMP_LAYER_MODE_SCREEN_LEGACY:
-      return "gimp:screen-legacy";
-
-    case GIMP_LAYER_MODE_OVERLAY_LEGACY:
-      return "gimp:softlight-legacy";
-
-    case GIMP_LAYER_MODE_DIFFERENCE_LEGACY:
-      return "gimp:difference-legacy";
-
-    case GIMP_LAYER_MODE_ADDITION_LEGACY:
-      return "gimp:addition-legacy";
-
-    case GIMP_LAYER_MODE_SUBTRACT_LEGACY:
-      return "gimp:subtract-legacy";
-
-    case GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY:
-      return "gimp:darken-only-legacy";
-
-    case GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY:
-      return "gimp:lighten-only-legacy";
-
-    case GIMP_LAYER_MODE_HSV_HUE_LEGACY:
-      return "gimp:hsv-hue-legacy";
-
-    case GIMP_LAYER_MODE_HSV_SATURATION_LEGACY:
-      return "gimp:hsv-saturation-legacy";
-
-    case GIMP_LAYER_MODE_HSV_COLOR_LEGACY:
-      return "gimp:hsv-color-legacy";
-
-    case GIMP_LAYER_MODE_HSV_VALUE_LEGACY:
-      return "gimp:hsv-value-legacy";
-
-    case GIMP_LAYER_MODE_DIVIDE_LEGACY:
-      return "gimp:divide-legacy";
-
-    case GIMP_LAYER_MODE_DODGE_LEGACY:
-      return "gimp:dodge-legacy";
-
-    case GIMP_LAYER_MODE_BURN_LEGACY:
-      return "gimp:burn-legacy";
-
-    case GIMP_LAYER_MODE_HARDLIGHT_LEGACY:
-      return "gimp:hardlight-legacy";
-
-    case GIMP_LAYER_MODE_SOFTLIGHT_LEGACY:
-      return "gimp:softlight-legacy";
-
-    case GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY:
-      return "gimp:grain-extract-legacy";
-
-    case GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY:
-      return "gimp:grain-merge-legacy";
-
-    case GIMP_LAYER_MODE_COLOR_ERASE:
-      return "gimp:color-erase";
-
-    case GIMP_LAYER_MODE_ERASE:
-      return "gimp:erase";
-
-    case GIMP_LAYER_MODE_REPLACE:
-      return "gimp:replace";
-
-    case GIMP_LAYER_MODE_ANTI_ERASE:
-      return "gimp:anti-erase";
-    }
-
-  return "gimp:layer-mode";
+  const GimpLayerModeInfo *info = gimp_layer_mode_info (mode);
+  return info?info->op_name:"gimp:layer-mode";
 }
 
 static gboolean


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