[gimp] app: move functions on enum GimpLayerMode to new files gimp-layer-modes.[ch]
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: move functions on enum GimpLayerMode to new files gimp-layer-modes.[ch]
- Date: Sun, 15 Jan 2017 14:25:22 +0000 (UTC)
commit a24e232522b11cb68248fce36740c6fe6fc0b7c1
Author: Michael Natterer <mitch gimp org>
Date: Sun Jan 15 15:23:57 2017 +0100
app: move functions on enum GimpLayerMode to new files gimp-layer-modes.[ch]
app/Makefile.am | 3 +-
app/core/Makefile.am | 2 +
app/core/gimp-layer-modes.c | 324 ++++++++++++++++++++++++++++++++++++++++
app/core/gimp-layer-modes.h | 32 ++++
app/gegl/gimp-gegl-nodes.c | 347 +------------------------------------------
app/gegl/gimp-gegl-nodes.h | 3 -
6 files changed, 365 insertions(+), 346 deletions(-)
---
diff --git a/app/Makefile.am b/app/Makefile.am
index d5e3734..0e94129 100644
--- a/app/Makefile.am
+++ b/app/Makefile.am
@@ -133,7 +133,8 @@ AM_LDFLAGS = \
-Wl,-u,$(SYMPREFIX)xcf_init \
-Wl,-u,$(SYMPREFIX)internal_procs_init \
-Wl,-u,$(SYMPREFIX)gimp_plug_in_manager_restore \
- -Wl,-u,$(SYMPREFIX)gimp_pdb_compat_param_spec
+ -Wl,-u,$(SYMPREFIX)gimp_pdb_compat_param_spec \
+ -Wl,-u,$(SYMPREFIX)gimp_layer_mode_is_linear
gimpconsoleldadd = \
xcf/libappxcf.a \
diff --git a/app/core/Makefile.am b/app/core/Makefile.am
index 20f439f..3a28eb4 100644
--- a/app/core/Makefile.am
+++ b/app/core/Makefile.am
@@ -44,6 +44,8 @@ libappcore_a_sources = \
gimp-gradients.h \
gimp-gui.c \
gimp-gui.h \
+ gimp-layer-modes.c \
+ gimp-layer-modes.h \
gimp-memsize.c \
gimp-memsize.h \
gimp-modules.c \
diff --git a/app/core/gimp-layer-modes.c b/app/core/gimp-layer-modes.c
new file mode 100644
index 0000000..5e58a7d
--- /dev/null
+++ b/app/core/gimp-layer-modes.c
@@ -0,0 +1,324 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimp-layer-modes.c
+ * Copyright (C) 2017 Michael Natterer <mitch gimp org>
+ * Øyvind Kolås <pippin gimp org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <glib-object.h>
+
+#include "core-types.h"
+
+#include "gimp-layer-modes.h"
+
+
+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;
+}
+
+gboolean
+gimp_layer_mode_is_linear (GimpLayerMode mode)
+{
+ switch (mode)
+ {
+ case GIMP_LAYER_MODE_NORMAL_NON_LINEAR:
+ 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:
+ 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:
+ return FALSE;
+
+ case GIMP_LAYER_MODE_NORMAL:
+ 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:
+ return FALSE;
+
+ case GIMP_LAYER_MODE_BEHIND_LINEAR:
+ case GIMP_LAYER_MODE_MULTIPLY_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_LINEAR:
+ case GIMP_LAYER_MODE_LIGHTEN_ONLY_LINEAR:
+ case GIMP_LAYER_MODE_DIVIDE_LINEAR:
+ case GIMP_LAYER_MODE_DODGE_LINEAR:
+ case GIMP_LAYER_MODE_BURN_LINEAR:
+ case GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR:
+ case GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR:
+ return TRUE;
+
+ case GIMP_LAYER_MODE_ERASE:
+ return TRUE;
+
+ case GIMP_LAYER_MODE_REPLACE:
+ return FALSE;
+
+ case GIMP_LAYER_MODE_ANTI_ERASE:
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+const gchar *
+gimp_layer_mode_get_operation (GimpLayerMode mode)
+{
+ switch (mode)
+ {
+ case GIMP_LAYER_MODE_NORMAL_NON_LINEAR:
+ case GIMP_LAYER_MODE_NORMAL:
+ 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_MULTIPLY_LEGACY:
+ return "gimp:multiply-legacy";
+
+ case GIMP_LAYER_MODE_MULTIPLY:
+ case GIMP_LAYER_MODE_MULTIPLY_LINEAR:
+ return "gimp:multiply";
+
+ case GIMP_LAYER_MODE_SCREEN_LEGACY:
+ return "gimp:screen-legacy";
+
+ case GIMP_LAYER_MODE_SCREEN:
+ return "gimp:screen";
+
+ case GIMP_LAYER_MODE_OVERLAY_LEGACY:
+ return "gimp:softlight-legacy";
+
+ case GIMP_LAYER_MODE_DIFFERENCE_LEGACY:
+ return "gimp:difference-legacy";
+
+ case GIMP_LAYER_MODE_DIFFERENCE:
+ case GIMP_LAYER_MODE_DIFFERENCE_LINEAR:
+ return "gimp:difference";
+
+ case GIMP_LAYER_MODE_ADDITION_LEGACY:
+ return "gimp:addition-legacy";
+
+ case GIMP_LAYER_MODE_ADDITION:
+ case GIMP_LAYER_MODE_ADDITION_LINEAR:
+ return "gimp:addition";
+
+ case GIMP_LAYER_MODE_SUBTRACT_LEGACY:
+ return "gimp:subtract-legacy";
+
+ case GIMP_LAYER_MODE_SUBTRACT:
+ case GIMP_LAYER_MODE_SUBTRACT_LINEAR:
+ return "gimp:subtract";
+
+ case GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY:
+ return "gimp:darken-only-legacy";
+
+ case GIMP_LAYER_MODE_DARKEN_ONLY:
+ case GIMP_LAYER_MODE_DARKEN_ONLY_LINEAR:
+ return "gimp:darken-only";
+
+ case GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY:
+ return "gimp:lighten-only-legacy";
+
+ case GIMP_LAYER_MODE_LIGHTEN_ONLY:
+ case GIMP_LAYER_MODE_LIGHTEN_ONLY_LINEAR:
+ return "gimp:lighten-only";
+
+ case GIMP_LAYER_MODE_HSV_HUE_LEGACY:
+ return "gimp:hsv-hue-legacy";
+
+ case GIMP_LAYER_MODE_HSV_HUE:
+ return "gimp:hsv-hue";
+
+ case GIMP_LAYER_MODE_HSV_SATURATION_LEGACY:
+ return "gimp:hsv-saturation-legacy";
+
+ case GIMP_LAYER_MODE_HSV_SATURATION:
+ return "gimp:hsv-saturation";
+
+ case GIMP_LAYER_MODE_HSV_COLOR_LEGACY:
+ return "gimp:hsv-color-legacy";
+
+ case GIMP_LAYER_MODE_HSV_COLOR:
+ return "gimp:hsv-color";
+
+ case GIMP_LAYER_MODE_HSV_VALUE_LEGACY:
+ return "gimp:hsv-value-legacy";
+
+ case GIMP_LAYER_MODE_HSV_VALUE:
+ return "gimp:hsv-value";
+
+ case GIMP_LAYER_MODE_DIVIDE_LEGACY:
+ return "gimp:divide-legacy";
+
+ case GIMP_LAYER_MODE_DIVIDE:
+ case GIMP_LAYER_MODE_DIVIDE_LINEAR:
+ return "gimp:divide";
+
+ case GIMP_LAYER_MODE_DODGE_LEGACY:
+ return "gimp:dodge-legacy";
+
+ case GIMP_LAYER_MODE_DODGE:
+ case GIMP_LAYER_MODE_DODGE_LINEAR:
+ return "gimp:dodge";
+
+ case GIMP_LAYER_MODE_BURN_LEGACY:
+ return "gimp:burn-legacy";
+
+ case GIMP_LAYER_MODE_BURN:
+ case GIMP_LAYER_MODE_BURN_LINEAR:
+ return "gimp:burn";
+
+ case GIMP_LAYER_MODE_HARDLIGHT_LEGACY:
+ return "gimp:hardlight-legacy";
+
+ case GIMP_LAYER_MODE_HARDLIGHT:
+ return "gimp:hardlight";
+
+ case GIMP_LAYER_MODE_SOFTLIGHT_LEGACY:
+ return "gimp:softlight-legacy";
+
+ case GIMP_LAYER_MODE_SOFTLIGHT:
+ return "gimp:softlight";
+
+ case GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY:
+ return "gimp:grain-extract-legacy";
+
+ case GIMP_LAYER_MODE_GRAIN_EXTRACT:
+ case GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR:
+ return "gimp:grain-extract";
+
+ case GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY:
+ return "gimp:grain-merge-legacy";
+
+ case GIMP_LAYER_MODE_GRAIN_MERGE:
+ case GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR:
+ return "gimp:grain-merge";
+
+ case GIMP_LAYER_MODE_COLOR_ERASE:
+ return "gimp:color-erase";
+
+ case GIMP_LAYER_MODE_OVERLAY:
+ return "gimp:overlay";
+
+ case GIMP_LAYER_MODE_LCH_HUE:
+ return "gimp:lch-hue";
+
+ case GIMP_LAYER_MODE_LCH_CHROMA:
+ return "gimp:lch-chroma";
+
+ case GIMP_LAYER_MODE_LCH_COLOR:
+ return "gimp:lch-color";
+
+ case GIMP_LAYER_MODE_LCH_LIGHTNESS:
+ return "gimp:lch-lightness";
+
+ 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 NULL;
+}
diff --git a/app/core/gimp-layer-modes.h b/app/core/gimp-layer-modes.h
new file mode 100644
index 0000000..9c09628
--- /dev/null
+++ b/app/core/gimp-layer-modes.h
@@ -0,0 +1,32 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimp-layer-modes.h
+ * Copyright (C) 2017 Michael Natterer <mitch gimp org>
+ * Ø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_LAYER_MODES_H__
+#define __GIMP_LAYER_MODES_H__
+
+
+gboolean gimp_layer_mode_is_legacy (GimpLayerMode mode);
+gboolean gimp_layer_mode_is_linear (GimpLayerMode mode);
+
+const gchar * gimp_layer_mode_get_operation (GimpLayerMode mode);
+
+
+#endif /* __GIMP_LAYER_MODES_H__ */
diff --git a/app/gegl/gimp-gegl-nodes.c b/app/gegl/gimp-gegl-nodes.c
index 8afa19e..87fc1ba 100644
--- a/app/gegl/gimp-gegl-nodes.c
+++ b/app/gegl/gimp-gegl-nodes.c
@@ -24,6 +24,8 @@
#include "gimp-gegl-types.h"
+#include "core/gimp-layer-modes.h"
+
#include "gimp-gegl-nodes.h"
#include "gimp-gegl-utils.h"
@@ -138,354 +140,15 @@ gimp_gegl_add_buffer_source (GeglNode *parent,
return buffer_source;
}
-gboolean
-gimp_gegl_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;
-}
-
-gboolean
-gimp_gegl_mode_is_linear (GimpLayerMode mode)
-{
- switch (mode)
- {
- case GIMP_LAYER_MODE_NORMAL_NON_LINEAR:
- 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:
- 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:
- return FALSE;
-
- case GIMP_LAYER_MODE_NORMAL:
- 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:
- return FALSE;
-
- case GIMP_LAYER_MODE_BEHIND_LINEAR:
- case GIMP_LAYER_MODE_MULTIPLY_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_LINEAR:
- case GIMP_LAYER_MODE_LIGHTEN_ONLY_LINEAR:
- case GIMP_LAYER_MODE_DIVIDE_LINEAR:
- case GIMP_LAYER_MODE_DODGE_LINEAR:
- case GIMP_LAYER_MODE_BURN_LINEAR:
- case GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR:
- case GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR:
- return TRUE;
-
- case GIMP_LAYER_MODE_ERASE:
- return TRUE;
-
- case GIMP_LAYER_MODE_REPLACE:
- return FALSE;
-
- case GIMP_LAYER_MODE_ANTI_ERASE:
- return TRUE;
- }
-
- return FALSE;
-}
-
void
gimp_gegl_mode_node_set_mode (GeglNode *node,
GimpLayerMode mode,
gboolean linear)
{
- const gchar *operation;
- gdouble opacity;
+ gdouble opacity;
g_return_if_fail (GEGL_IS_NODE (node));
- switch (mode)
- {
- case GIMP_LAYER_MODE_NORMAL_NON_LINEAR:
- case GIMP_LAYER_MODE_NORMAL:
- operation = "gimp:normal";
- break;
-
- case GIMP_LAYER_MODE_DISSOLVE:
- operation = "gimp:dissolve";
- break;
-
- case GIMP_LAYER_MODE_BEHIND:
- case GIMP_LAYER_MODE_BEHIND_LINEAR:
- operation = "gimp:behind";
- break;
-
- case GIMP_LAYER_MODE_MULTIPLY_LEGACY:
- operation = "gimp:multiply-legacy";
- break;
-
- case GIMP_LAYER_MODE_MULTIPLY:
- case GIMP_LAYER_MODE_MULTIPLY_LINEAR:
- operation = "gimp:multiply";
- break;
-
- case GIMP_LAYER_MODE_SCREEN_LEGACY:
- operation = "gimp:screen-legacy";
- break;
-
- case GIMP_LAYER_MODE_SCREEN:
- operation = "gimp:screen";
- break;
-
- case GIMP_LAYER_MODE_OVERLAY_LEGACY:
- operation = "gimp:softlight-legacy";
- break;
-
- case GIMP_LAYER_MODE_DIFFERENCE_LEGACY:
- operation = "gimp:difference-legacy";
- break;
-
- case GIMP_LAYER_MODE_DIFFERENCE:
- case GIMP_LAYER_MODE_DIFFERENCE_LINEAR:
- operation = "gimp:difference";
- break;
-
- case GIMP_LAYER_MODE_ADDITION_LEGACY:
- operation = "gimp:addition-legacy";
- break;
-
- case GIMP_LAYER_MODE_ADDITION:
- case GIMP_LAYER_MODE_ADDITION_LINEAR:
- operation = "gimp:addition";
- break;
-
- case GIMP_LAYER_MODE_SUBTRACT_LEGACY:
- operation = "gimp:subtract-legacy";
- break;
-
- case GIMP_LAYER_MODE_SUBTRACT:
- case GIMP_LAYER_MODE_SUBTRACT_LINEAR:
- operation = "gimp:subtract";
- break;
-
- case GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY:
- operation = "gimp:darken-only-legacy";
- break;
-
- case GIMP_LAYER_MODE_DARKEN_ONLY:
- case GIMP_LAYER_MODE_DARKEN_ONLY_LINEAR:
- operation = "gimp:darken-only";
- break;
-
- case GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY:
- operation = "gimp:lighten-only-legacy";
- break;
-
- case GIMP_LAYER_MODE_LIGHTEN_ONLY:
- case GIMP_LAYER_MODE_LIGHTEN_ONLY_LINEAR:
- operation = "gimp:lighten-only";
- break;
-
- case GIMP_LAYER_MODE_HSV_HUE_LEGACY:
- operation = "gimp:hsv-hue-legacy";
- break;
-
- case GIMP_LAYER_MODE_HSV_HUE:
- operation = "gimp:hsv-hue";
- break;
-
- case GIMP_LAYER_MODE_HSV_SATURATION_LEGACY:
- operation = "gimp:hsv-saturation-legacy";
- break;
-
- case GIMP_LAYER_MODE_HSV_SATURATION:
- operation = "gimp:hsv-saturation";
- break;
-
- case GIMP_LAYER_MODE_HSV_COLOR_LEGACY:
- operation = "gimp:hsv-color-legacy";
- break;
-
- case GIMP_LAYER_MODE_HSV_COLOR:
- operation = "gimp:hsv-color";
- break;
-
- case GIMP_LAYER_MODE_HSV_VALUE_LEGACY:
- operation = "gimp:hsv-value-legacy";
- break;
-
- case GIMP_LAYER_MODE_HSV_VALUE:
- operation = "gimp:hsv-value";
- break;
-
- case GIMP_LAYER_MODE_DIVIDE_LEGACY:
- operation = "gimp:divide-legacy";
- break;
-
- case GIMP_LAYER_MODE_DIVIDE:
- case GIMP_LAYER_MODE_DIVIDE_LINEAR:
- operation = "gimp:divide";
- break;
-
- case GIMP_LAYER_MODE_DODGE_LEGACY:
- operation = "gimp:dodge-legacy";
- break;
-
- case GIMP_LAYER_MODE_DODGE:
- case GIMP_LAYER_MODE_DODGE_LINEAR:
- operation = "gimp:dodge";
- break;
-
- case GIMP_LAYER_MODE_BURN_LEGACY:
- operation = "gimp:burn-legacy";
- break;
-
- case GIMP_LAYER_MODE_BURN:
- case GIMP_LAYER_MODE_BURN_LINEAR:
- operation = "gimp:burn";
- break;
-
- case GIMP_LAYER_MODE_HARDLIGHT_LEGACY:
- operation = "gimp:hardlight-legacy";
- break;
-
- case GIMP_LAYER_MODE_HARDLIGHT:
- operation = "gimp:hardlight";
- break;
-
- case GIMP_LAYER_MODE_SOFTLIGHT_LEGACY:
- operation = "gimp:softlight-legacy";
- break;
-
- case GIMP_LAYER_MODE_SOFTLIGHT:
- operation = "gimp:softlight";
- break;
-
- case GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY:
- operation = "gimp:grain-extract-legacy";
- break;
-
- case GIMP_LAYER_MODE_GRAIN_EXTRACT:
- case GIMP_LAYER_MODE_GRAIN_EXTRACT_LINEAR:
- operation = "gimp:grain-extract";
- break;
-
- case GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY:
- operation = "gimp:grain-merge-legacy";
- break;
-
- case GIMP_LAYER_MODE_GRAIN_MERGE:
- case GIMP_LAYER_MODE_GRAIN_MERGE_LINEAR:
- operation = "gimp:grain-merge";
- break;
-
- case GIMP_LAYER_MODE_COLOR_ERASE:
- operation = "gimp:color-erase";
- break;
-
- case GIMP_LAYER_MODE_OVERLAY:
- operation = "gimp:overlay";
- break;
-
- case GIMP_LAYER_MODE_LCH_HUE:
- operation = "gimp:lch-hue";
- break;
-
- case GIMP_LAYER_MODE_LCH_CHROMA:
- operation = "gimp:lch-chroma";
- break;
-
- case GIMP_LAYER_MODE_LCH_COLOR:
- operation = "gimp:lch-color";
- break;
-
- case GIMP_LAYER_MODE_LCH_LIGHTNESS:
- operation = "gimp:lch-lightness";
- break;
-
- case GIMP_LAYER_MODE_ERASE:
- operation = "gimp:erase";
- break;
-
- case GIMP_LAYER_MODE_REPLACE:
- operation = "gimp:replace";
- break;
-
- case GIMP_LAYER_MODE_ANTI_ERASE:
- operation = "gimp:anti-erase";
- break;
- }
-
gegl_node_get (node,
"opacity", &opacity,
NULL);
@@ -494,9 +157,9 @@ gimp_gegl_mode_node_set_mode (GeglNode *node,
* all its properties
*/
gegl_node_set (node,
- "operation", operation,
+ "operation", gimp_layer_mode_get_operation (mode),
"opacity", opacity,
- "linear", gimp_gegl_mode_is_linear (mode),
+ "linear", gimp_layer_mode_is_linear (mode),
NULL);
}
diff --git a/app/gegl/gimp-gegl-nodes.h b/app/gegl/gimp-gegl-nodes.h
index c9701b8..70abbb1 100644
--- a/app/gegl/gimp-gegl-nodes.h
+++ b/app/gegl/gimp-gegl-nodes.h
@@ -42,8 +42,5 @@ void gimp_gegl_node_set_matrix (GeglNode *node,
void gimp_gegl_node_set_color (GeglNode *node,
const GimpRGB *color);
-gboolean gimp_gegl_mode_is_legacy (GimpLayerMode mode);
-gboolean gimp_gegl_mode_is_linear (GimpLayerMode mode);
-
#endif /* __GIMP_GEGL_NODES_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]