[gimp] app: add gimp_gegl_mode_is_linear
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add gimp_gegl_mode_is_linear
- Date: Wed, 11 Jan 2017 22:09:05 +0000 (UTC)
commit 377f4687b1d0ad513fec861c0348d5ba41862d1a
Author: Øyvind Kolås <pippin gimp org>
Date: Wed Jan 11 22:13:14 2017 +0100
app: add gimp_gegl_mode_is_linear
app/gegl/gimp-gegl-nodes.c | 127 ++++++++++++++++++++++----------------------
app/gegl/gimp-gegl-nodes.h | 1 +
2 files changed, 65 insertions(+), 63 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-nodes.c b/app/gegl/gimp-gegl-nodes.c
index 15a05e6..b23eab9 100644
--- a/app/gegl/gimp-gegl-nodes.c
+++ b/app/gegl/gimp-gegl-nodes.c
@@ -138,6 +138,68 @@ gimp_gegl_add_buffer_source (GeglNode *parent,
return buffer_source;
}
+gboolean
+gimp_gegl_mode_is_linear (GimpLayerMode mode)
+{
+ switch (mode)
+ {
+ case GIMP_LAYER_MODE_NORMAL:
+ case GIMP_LAYER_MODE_DISSOLVE:
+ case GIMP_LAYER_MODE_MULTIPLY_LINEAR:
+ return TRUE;
+ case GIMP_LAYER_MODE_BEHIND:
+ case GIMP_LAYER_MODE_MULTIPLY:
+ case GIMP_LAYER_MODE_MULTIPLY_LEGACY:
+ case GIMP_LAYER_MODE_SCREEN:
+ case GIMP_LAYER_MODE_SCREEN_LEGACY:
+ case GIMP_LAYER_MODE_ADDITION:
+ case GIMP_LAYER_MODE_SUBTRACT:
+ case GIMP_LAYER_MODE_ADDITION_LEGACY:
+ case GIMP_LAYER_MODE_SUBTRACT_LEGACY:
+ case GIMP_LAYER_MODE_DARKEN_ONLY:
+ case GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY:
+ case GIMP_LAYER_MODE_LIGHTEN_ONLY:
+ case GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY:
+ case GIMP_LAYER_MODE_NORMAL_NON_LINEAR:
+ case GIMP_LAYER_MODE_OVERLAY_LEGACY:
+ 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:
+ case GIMP_LAYER_MODE_HSV_VALUE_LEGACY:
+ case GIMP_LAYER_MODE_DIVIDE:
+ case GIMP_LAYER_MODE_DIVIDE_LEGACY:
+ case GIMP_LAYER_MODE_DODGE:
+ case GIMP_LAYER_MODE_DODGE_LEGACY:
+ case GIMP_LAYER_MODE_BURN:
+ case GIMP_LAYER_MODE_BURN_LEGACY:
+ case GIMP_LAYER_MODE_HARDLIGHT:
+ case GIMP_LAYER_MODE_HARDLIGHT_LEGACY:
+ case GIMP_LAYER_MODE_SOFTLIGHT:
+ case GIMP_LAYER_MODE_SOFTLIGHT_LEGACY:
+ case GIMP_LAYER_MODE_GRAIN_EXTRACT:
+ case GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY:
+ case GIMP_LAYER_MODE_GRAIN_MERGE:
+ case GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY:
+ case GIMP_LAYER_MODE_COLOR_ERASE:
+ case GIMP_LAYER_MODE_OVERLAY:
+ case GIMP_LAYER_MODE_ERASE:
+ case GIMP_LAYER_MODE_REPLACE:
+ case GIMP_LAYER_MODE_ANTI_ERASE:
+ 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;
+ }
+ return FALSE;
+}
+
void
gimp_gegl_mode_node_set_mode (GeglNode *node,
GimpLayerMode mode,
@@ -360,72 +422,11 @@ gimp_gegl_mode_node_set_mode (GeglNode *node,
*/
gegl_node_set (node,
"operation", operation,
- "linear", linear,
"opacity", opacity,
NULL);
- switch (mode)
- {
- case GIMP_LAYER_MODE_NORMAL:
- case GIMP_LAYER_MODE_DISSOLVE:
- case GIMP_LAYER_MODE_MULTIPLY_LINEAR:
- gegl_node_set (node,
- "linear", TRUE,
- NULL);
- break;
- case GIMP_LAYER_MODE_BEHIND:
- case GIMP_LAYER_MODE_MULTIPLY:
- case GIMP_LAYER_MODE_MULTIPLY_LEGACY:
- case GIMP_LAYER_MODE_SCREEN:
- case GIMP_LAYER_MODE_SCREEN_LEGACY:
- case GIMP_LAYER_MODE_ADDITION:
- case GIMP_LAYER_MODE_SUBTRACT:
- case GIMP_LAYER_MODE_ADDITION_LEGACY:
- case GIMP_LAYER_MODE_SUBTRACT_LEGACY:
- case GIMP_LAYER_MODE_DARKEN_ONLY:
- case GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY:
- case GIMP_LAYER_MODE_LIGHTEN_ONLY:
- case GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY:
- case GIMP_LAYER_MODE_NORMAL_NON_LINEAR:
- case GIMP_LAYER_MODE_OVERLAY_LEGACY:
- 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:
- case GIMP_LAYER_MODE_HSV_VALUE_LEGACY:
- case GIMP_LAYER_MODE_DIVIDE:
- case GIMP_LAYER_MODE_DIVIDE_LEGACY:
- case GIMP_LAYER_MODE_DODGE:
- case GIMP_LAYER_MODE_DODGE_LEGACY:
- case GIMP_LAYER_MODE_BURN:
- case GIMP_LAYER_MODE_BURN_LEGACY:
- case GIMP_LAYER_MODE_HARDLIGHT:
- case GIMP_LAYER_MODE_HARDLIGHT_LEGACY:
- case GIMP_LAYER_MODE_SOFTLIGHT:
- case GIMP_LAYER_MODE_SOFTLIGHT_LEGACY:
- case GIMP_LAYER_MODE_GRAIN_EXTRACT:
- case GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY:
- case GIMP_LAYER_MODE_GRAIN_MERGE:
- case GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY:
- case GIMP_LAYER_MODE_COLOR_ERASE:
- case GIMP_LAYER_MODE_OVERLAY:
- case GIMP_LAYER_MODE_ERASE:
- case GIMP_LAYER_MODE_REPLACE:
- case GIMP_LAYER_MODE_ANTI_ERASE:
- case GIMP_LAYER_MODE_LCH_HUE:
- case GIMP_LAYER_MODE_LCH_CHROMA:
- case GIMP_LAYER_MODE_LCH_COLOR:
- case GIMP_LAYER_MODE_LCH_LIGHTNESS:
- gegl_node_set (node,
- "linear", FALSE,
- NULL);
- break;
- }
+ gegl_node_set (node, "linear", gimp_gegl_mode_is_linear (mode)?TRUE:FALSE,
+ NULL);
}
void
diff --git a/app/gegl/gimp-gegl-nodes.h b/app/gegl/gimp-gegl-nodes.h
index 70abbb1..bfe380b 100644
--- a/app/gegl/gimp-gegl-nodes.h
+++ b/app/gegl/gimp-gegl-nodes.h
@@ -41,6 +41,7 @@ void gimp_gegl_node_set_matrix (GeglNode *node,
const GimpMatrix3 *matrix);
void gimp_gegl_node_set_color (GeglNode *node,
const GimpRGB *color);
+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]