[gimp] app: make layer blend color space and compositing color space configurable
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: make layer blend color space and compositing color space configurable
- Date: Sun, 12 Feb 2017 22:53:36 +0000 (UTC)
commit 8634b5cbc31e852c63b7af1a8e69d2e31c36ad79
Author: Michael Natterer <mitch gimp org>
Date: Sun Feb 12 23:49:26 2017 +0100
app: make layer blend color space and compositing color space configurable
...they say it's going to get worse before it gets better...
app/actions/layers-actions.c | 148 +++++++++++++++---
app/actions/layers-commands.c | 144 +++++++++++++----
app/actions/layers-commands.h | 8 +-
app/config/gimpdialogconfig.c | 30 ++++
app/config/gimpdialogconfig.h | 2 +
app/config/gimprc-blurbs.h | 6 +
app/core/gimp-edit.c | 4 +
app/core/gimpchannel.c | 13 ++-
app/core/gimpdrawable-blend.c | 5 +-
app/core/gimpdrawable-bucket-fill.c | 2 +
app/core/gimpdrawable-combine.c | 15 ++-
app/core/gimpdrawable-combine.h | 4 +-
app/core/gimpdrawable-fill.c | 2 +
app/core/gimpdrawable-floating-selection.c | 4 +-
app/core/gimpdrawable-shadow.c | 2 +
app/core/gimpdrawable.c | 9 +-
app/core/gimpdrawable.h | 8 +-
app/core/gimpdrawablefilter.c | 20 ++-
app/core/gimpdrawablefilter.h | 2 +
app/core/gimpdrawableundo.h | 2 +
app/core/gimpimage-merge.c | 19 ++-
app/core/gimplayer.c | 239 +++++++++++++++++++++++-----
app/core/gimplayer.h | 40 ++++--
app/core/gimplayerpropundo.c | 38 +++--
app/core/gimplayerpropundo.h | 4 +-
app/dialogs/layer-options-dialog.c | 40 ++++-
app/dialogs/layer-options-dialog.h | 8 +-
app/gegl/gimp-gegl-nodes.c | 20 ++-
app/gegl/gimp-gegl-nodes.h | 4 +-
app/gegl/gimpapplicator.c | 29 +++-
app/gegl/gimpapplicator.h | 6 +-
app/operations/operations-enums.c | 8 +-
app/operations/operations-enums.h | 7 +-
app/paint/gimppaintcore.c | 2 +
app/pdb/layer-cmds.c | 4 +-
app/tools/gimpblendtool.c | 4 +
app/xcf/xcf-load.c | 35 ++++-
app/xcf/xcf-private.h | 4 +-
app/xcf/xcf-save.c | 42 ++++-
menus/layers-menu.xml | 42 +++--
tools/pdbgen/pdb/layer.pdb | 4 +-
41 files changed, 817 insertions(+), 212 deletions(-)
---
diff --git a/app/actions/layers-actions.c b/app/actions/layers-actions.c
index fb56b4e..0b4f9c1 100644
--- a/app/actions/layers-actions.c
+++ b/app/actions/layers-actions.c
@@ -50,8 +50,16 @@ static const GimpActionEntry layers_actions[] =
NC_("layers-action", "Layers Menu"), NULL, NULL, NULL,
GIMP_HELP_LAYER_DIALOG },
- { "layers-composite-menu", NULL,
- NC_("layers-action", "Composite"), NULL, NULL, NULL,
+ { "layers-blend-space-menu", NULL,
+ NC_("layers-action", "Blend Space"), NULL, NULL, NULL,
+ NULL },
+
+ { "layers-composite-space-menu", NULL,
+ NC_("layers-action", "Composite Space"), NULL, NULL, NULL,
+ NULL },
+
+ { "layers-composite-mode-menu", NULL,
+ NC_("layers-action", "Composite Mode"), NULL, NULL, NULL,
NULL },
{ "layers-color-tag-menu", GIMP_STOCK_CLOSE /* abused */,
@@ -319,29 +327,75 @@ static const GimpToggleActionEntry layers_toggle_actions[] =
GIMP_HELP_LAYER_LOCK_ALPHA },
};
-static const GimpRadioActionEntry layers_composite_actions[] =
+static const GimpRadioActionEntry layers_blend_space_actions[] =
+{
+ { "layers-blend-space-auto", NULL,
+ NC_("layers-action", "Auto"), NULL, NULL,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ NULL },
+
+ { "layers-blend-space-rgb-linear", NULL,
+ NC_("layers-action", "RGB (linear)"), NULL, NULL,
+ GIMP_LAYER_COLOR_SPACE_RGB_LINEAR,
+ NULL },
+
+ { "layers-blend-space-rgb-perceptual", NULL,
+ NC_("layers-action", "RGB (perceptual)"), NULL, NULL,
+ GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
+ NULL },
+
+ { "layers-blend-space-lab", NULL,
+ NC_("layers-action", "LAB"), NULL, NULL,
+ GIMP_LAYER_COLOR_SPACE_LAB,
+ NULL }
+};
+
+static const GimpRadioActionEntry layers_composite_space_actions[] =
+{
+ { "layers-composite-space-auto", NULL,
+ NC_("layers-action", "Auto"), NULL, NULL,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ NULL },
+
+ { "layers-composite-space-rgb-linear", NULL,
+ NC_("layers-action", "RGB (linear)"), NULL, NULL,
+ GIMP_LAYER_COLOR_SPACE_RGB_LINEAR,
+ NULL },
+
+ { "layers-composite-space-rgb-perceptual", NULL,
+ NC_("layers-action", "RGB (perceptual)"), NULL, NULL,
+ GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
+ NULL },
+
+ { "layers-composite-space-lab", NULL,
+ NC_("layers-action", "LAB"), NULL, NULL,
+ GIMP_LAYER_COLOR_SPACE_LAB,
+ NULL }
+};
+
+static const GimpRadioActionEntry layers_composite_mode_actions[] =
{
- { "layers-composite-auto", NULL,
+ { "layers-composite-mode-auto", NULL,
NC_("layers-action", "Auto"), NULL, NULL,
GIMP_LAYER_COMPOSITE_AUTO,
NULL },
- { "layers-composite-src-over", NULL,
+ { "layers-composite-mode-src-over", NULL,
NC_("layers-action", "Source over"), NULL, NULL,
GIMP_LAYER_COMPOSITE_SRC_OVER,
NULL },
- { "layers-composite-src-atop", NULL,
+ { "layers-composite-mode-src-atop", NULL,
NC_("layers-action", "Source atop"), NULL, NULL,
GIMP_LAYER_COMPOSITE_SRC_ATOP,
NULL },
- { "layers-composite-src-in", NULL,
+ { "layers-composite-mode-src-in", NULL,
NC_("layers-action", "Source in"), NULL, NULL,
GIMP_LAYER_COMPOSITE_SRC_IN,
NULL },
- { "layers-composite-dst-atop", NULL,
+ { "layers-composite-mode-dst-atop", NULL,
NC_("layers-action", "Destination atop"), NULL, NULL,
GIMP_LAYER_COMPOSITE_DST_ATOP,
NULL }
@@ -615,10 +669,22 @@ layers_actions_setup (GimpActionGroup *group)
G_N_ELEMENTS (layers_toggle_actions));
gimp_action_group_add_radio_actions (group, "layers-action",
- layers_composite_actions,
- G_N_ELEMENTS (layers_composite_actions),
+ layers_blend_space_actions,
+ G_N_ELEMENTS (layers_blend_space_actions),
+ NULL, 0,
+ G_CALLBACK (layers_blend_space_cmd_callback));
+
+ gimp_action_group_add_radio_actions (group, "layers-action",
+ layers_composite_space_actions,
+ G_N_ELEMENTS (layers_composite_space_actions),
+ NULL, 0,
+ G_CALLBACK (layers_composite_space_cmd_callback));
+
+ gimp_action_group_add_radio_actions (group, "layers-action",
+ layers_composite_mode_actions,
+ G_N_ELEMENTS (layers_composite_mode_actions),
NULL, 0,
- G_CALLBACK (layers_composite_cmd_callback));
+ G_CALLBACK (layers_composite_mode_cmd_callback));
gimp_action_group_add_enum_actions (group, "layers-action",
layers_color_tag_actions,
@@ -704,18 +770,46 @@ layers_actions_update (GimpActionGroup *group,
GList *layer_list;
GList *list;
- switch (gimp_layer_get_composite (layer))
+ switch (gimp_layer_get_blend_space (layer))
+ {
+ case GIMP_LAYER_COLOR_SPACE_AUTO:
+ action = "layers-blend-space-auto"; break;
+ case GIMP_LAYER_COLOR_SPACE_RGB_LINEAR:
+ action = "layers-blend-space-rgb-linear"; break;
+ case GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL:
+ action = "layers-blend-space-rgb-perceptual"; break;
+ case GIMP_LAYER_COLOR_SPACE_LAB:
+ action = "layers-blend-space-lab"; break;
+ }
+
+ gimp_action_group_set_action_active (group, action, TRUE);
+
+ switch (gimp_layer_get_composite_space (layer))
+ {
+ case GIMP_LAYER_COLOR_SPACE_AUTO:
+ action = "layers-composite-space-auto"; break;
+ case GIMP_LAYER_COLOR_SPACE_RGB_LINEAR:
+ action = "layers-composite-space-rgb-linear"; break;
+ case GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL:
+ action = "layers-composite-space-rgb-perceptual"; break;
+ case GIMP_LAYER_COLOR_SPACE_LAB:
+ action = "layers-composite-space-lab"; break;
+ }
+
+ gimp_action_group_set_action_active (group, action, TRUE);
+
+ switch (gimp_layer_get_composite_mode (layer))
{
case GIMP_LAYER_COMPOSITE_AUTO:
- action = "layers-composite-auto"; break;
+ action = "layers-composite-mode-auto"; break;
case GIMP_LAYER_COMPOSITE_SRC_OVER:
- action = "layers-composite-src-over"; break;
+ action = "layers-composite-mode-src-over"; break;
case GIMP_LAYER_COMPOSITE_SRC_ATOP:
- action = "layers-composite-src-atop"; break;
+ action = "layers-composite-mode-src-atop"; break;
case GIMP_LAYER_COMPOSITE_SRC_IN:
- action = "layers-composite-src-in"; break;
+ action = "layers-composite-mode-src-in"; break;
case GIMP_LAYER_COMPOSITE_DST_ATOP:
- action = "layers-composite-dst-atop"; break;
+ action = "layers-composite-mode-dst-atop"; break;
}
gimp_action_group_set_action_active (group, action, TRUE);
@@ -825,11 +919,21 @@ layers_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("layers-lock-alpha", can_lock_alpha);
SET_ACTIVE ("layers-lock-alpha", lock_alpha);
- SET_SENSITIVE ("layers-composite-auto", layer);
- SET_SENSITIVE ("layers-composite-src-over", layer);
- SET_SENSITIVE ("layers-composite-src-atop", layer);
- SET_SENSITIVE ("layers-composite-src-in", layer);
- SET_SENSITIVE ("layers-composite-dst-atop", layer);
+ SET_SENSITIVE ("layers-blend-space-auto", layer);
+ SET_SENSITIVE ("layers-blend-space-rgb-linear", layer);
+ SET_SENSITIVE ("layers-blend-space-rgb-perceptual", layer);
+ SET_SENSITIVE ("layers-blend-space-lab", layer);
+
+ SET_SENSITIVE ("layers-composite-space-auto", layer);
+ SET_SENSITIVE ("layers-composite-space-rgb-linear", layer);
+ SET_SENSITIVE ("layers-composite-space-rgb-perceptual", layer);
+ SET_SENSITIVE ("layers-composite-space-lab", layer);
+
+ SET_SENSITIVE ("layers-composite-mode-auto", layer);
+ SET_SENSITIVE ("layers-composite-mode-src-over", layer);
+ SET_SENSITIVE ("layers-composite-mode-src-atop", layer);
+ SET_SENSITIVE ("layers-composite-mode-src-in", layer);
+ SET_SENSITIVE ("layers-composite-mode-dst-atop", layer);
SET_SENSITIVE ("layers-mask-add", layer && !fs && !ac && !mask && !children);
SET_SENSITIVE ("layers-mask-add-button", layer && !fs && !ac && !children);
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index da4cd23..c0bd422 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -120,7 +120,9 @@ static void layers_new_callback (GtkWidget *dialog,
GimpContext *context,
const gchar *layer_name,
GimpLayerMode layer_mode,
- GimpLayerCompositeMode layer_composite,
+ GimpLayerColorSpace layer_blend_space,
+ GimpLayerColorSpace layer_composite_space,
+ GimpLayerCompositeMode layer_composite_mode,
gdouble layer_opacity,
GimpFillType layer_fill_type,
gint layer_width,
@@ -141,7 +143,9 @@ static void layers_edit_attributes_callback (GtkWidget *dialog,
GimpContext *context,
const gchar *layer_name,
GimpLayerMode layer_mode,
- GimpLayerCompositeMode layer_composite,
+ GimpLayerColorSpace layer_blend_space,
+ GimpLayerColorSpace layer_composite_space,
+ GimpLayerCompositeMode layer_composite_mode,
gdouble layer_opacity,
GimpFillType layer_fill_type,
gint layer_width,
@@ -262,7 +266,9 @@ layers_edit_attributes_cmd_callback (GtkAction *action,
GIMP_HELP_LAYER_EDIT,
gimp_object_get_name (layer),
gimp_layer_get_mode (layer),
- gimp_layer_get_composite (layer),
+ gimp_layer_get_blend_space (layer),
+ gimp_layer_get_composite_space (layer),
+ gimp_layer_get_composite_mode (layer),
gimp_layer_get_opacity (layer),
0 /* unused */,
gimp_item_get_visible (item),
@@ -329,6 +335,8 @@ layers_new_cmd_callback (GtkAction *action,
GIMP_HELP_LAYER_NEW,
config->layer_new_name,
config->layer_new_mode,
+ config->layer_new_blend_space,
+ config->layer_new_composite_space,
config->layer_new_composite_mode,
config->layer_new_opacity,
config->layer_new_fill_type,
@@ -1139,18 +1147,74 @@ layers_mode_cmd_callback (GtkAction *action,
}
void
-layers_composite_cmd_callback (GtkAction *action,
- GtkAction *current,
- gpointer data)
+layers_blend_space_cmd_callback (GtkAction *action,
+ GtkAction *current,
+ gpointer data)
+{
+ GimpImage *image;
+ GimpLayer *layer;
+ GimpLayerColorSpace blend_space;
+ return_if_no_layer (image, layer, data);
+
+ blend_space = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
+
+ if (blend_space != gimp_layer_get_blend_space (layer))
+ {
+ GimpUndo *undo;
+ gboolean push_undo = TRUE;
+
+ undo = gimp_image_undo_can_compress (image, GIMP_TYPE_LAYER_PROP_UNDO,
+ GIMP_UNDO_LAYER_MODE);
+
+ if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (layer))
+ push_undo = FALSE;
+
+ gimp_layer_set_blend_space (layer, blend_space, push_undo);
+ gimp_image_flush (image);
+ }
+}
+
+void
+layers_composite_space_cmd_callback (GtkAction *action,
+ GtkAction *current,
+ gpointer data)
+{
+ GimpImage *image;
+ GimpLayer *layer;
+ GimpLayerColorSpace composite_space;
+ return_if_no_layer (image, layer, data);
+
+ composite_space = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
+
+ if (composite_space != gimp_layer_get_composite_space (layer))
+ {
+ GimpUndo *undo;
+ gboolean push_undo = TRUE;
+
+ undo = gimp_image_undo_can_compress (image, GIMP_TYPE_LAYER_PROP_UNDO,
+ GIMP_UNDO_LAYER_MODE);
+
+ if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (layer))
+ push_undo = FALSE;
+
+ gimp_layer_set_composite_space (layer, composite_space, push_undo);
+ gimp_image_flush (image);
+ }
+}
+
+void
+layers_composite_mode_cmd_callback (GtkAction *action,
+ GtkAction *current,
+ gpointer data)
{
GimpImage *image;
GimpLayer *layer;
- GimpLayerCompositeMode composite;
+ GimpLayerCompositeMode composite_mode;
return_if_no_layer (image, layer, data);
- composite = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
+ composite_mode = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
- if (composite != gimp_layer_get_composite (layer))
+ if (composite_mode != gimp_layer_get_composite_mode (layer))
{
GimpUndo *undo;
gboolean push_undo = TRUE;
@@ -1161,7 +1225,7 @@ layers_composite_cmd_callback (GtkAction *action,
if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (layer))
push_undo = FALSE;
- gimp_layer_set_composite (layer, composite, push_undo);
+ gimp_layer_set_composite_mode (layer, composite_mode, push_undo);
gimp_image_flush (image);
}
}
@@ -1260,7 +1324,9 @@ layers_new_callback (GtkWidget *dialog,
GimpContext *context,
const gchar *layer_name,
GimpLayerMode layer_mode,
- GimpLayerCompositeMode layer_composite,
+ GimpLayerColorSpace layer_blend_space,
+ GimpLayerColorSpace layer_composite_space,
+ GimpLayerCompositeMode layer_composite_mode,
gdouble layer_opacity,
GimpFillType layer_fill_type,
gint layer_width,
@@ -1279,11 +1345,13 @@ layers_new_callback (GtkWidget *dialog,
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
g_object_set (config,
- "layer-new-name", layer_name,
- "layer-new-mode", layer_mode,
- "layer-new-composite-mode", layer_composite,
- "layer-new-opacity", layer_opacity,
- "layer-new-fill-type", layer_fill_type,
+ "layer-new-name", layer_name,
+ "layer-new-mode", layer_mode,
+ "layer-new-blend-space", layer_blend_space,
+ "layer-new-composite-space", layer_composite_space,
+ "layer-new-composite-mode", layer_composite_mode,
+ "layer-new-opacity", layer_opacity,
+ "layer-new-fill-type", layer_fill_type,
NULL);
layer = gimp_layer_new (image, layer_width, layer_height,
@@ -1305,7 +1373,9 @@ layers_new_callback (GtkWidget *dialog,
gimp_item_set_lock_position (GIMP_ITEM (layer), layer_lock_position,
FALSE);
gimp_layer_set_lock_alpha (layer, layer_lock_alpha, FALSE);
- gimp_layer_set_composite (layer, layer_composite, FALSE);
+ gimp_layer_set_blend_space (layer, layer_blend_space, FALSE);
+ gimp_layer_set_composite_space (layer, layer_composite_space, FALSE);
+ gimp_layer_set_composite_mode (layer, layer_composite_mode, FALSE);
gimp_image_add_layer (image, layer,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
@@ -1326,7 +1396,9 @@ layers_edit_attributes_callback (GtkWidget *dialog,
GimpContext *context,
const gchar *layer_name,
GimpLayerMode layer_mode,
- GimpLayerCompositeMode layer_composite,
+ GimpLayerColorSpace layer_blend_space,
+ GimpLayerColorSpace layer_composite_space,
+ GimpLayerCompositeMode layer_composite_mode,
gdouble layer_opacity,
GimpFillType unused1,
gint unused2,
@@ -1344,18 +1416,20 @@ layers_edit_attributes_callback (GtkWidget *dialog,
{
GimpItem *item = GIMP_ITEM (layer);
- if (strcmp (layer_name, gimp_object_get_name (layer)) ||
- layer_mode != gimp_layer_get_mode (layer) ||
- layer_composite != gimp_layer_get_composite (layer) ||
- layer_opacity != gimp_layer_get_opacity (layer) ||
- layer_offset_x != gimp_item_get_offset_x (item) ||
- layer_offset_y != gimp_item_get_offset_y (item) ||
- layer_visible != gimp_item_get_visible (item) ||
- layer_linked != gimp_item_get_linked (item) ||
- layer_color_tag != gimp_item_get_color_tag (item) ||
- layer_lock_pixels != gimp_item_get_lock_content (item) ||
- layer_lock_position != gimp_item_get_lock_position (item) ||
- layer_lock_alpha != gimp_layer_get_lock_alpha (layer))
+ if (strcmp (layer_name, gimp_object_get_name (layer)) ||
+ layer_mode != gimp_layer_get_mode (layer) ||
+ layer_blend_space != gimp_layer_get_blend_space (layer) ||
+ layer_composite_space != gimp_layer_get_composite_space (layer) ||
+ layer_composite_mode != gimp_layer_get_composite_mode (layer) ||
+ layer_opacity != gimp_layer_get_opacity (layer) ||
+ layer_offset_x != gimp_item_get_offset_x (item) ||
+ layer_offset_y != gimp_item_get_offset_y (item) ||
+ layer_visible != gimp_item_get_visible (item) ||
+ layer_linked != gimp_item_get_linked (item) ||
+ layer_color_tag != gimp_item_get_color_tag (item) ||
+ layer_lock_pixels != gimp_item_get_lock_content (item) ||
+ layer_lock_position != gimp_item_get_lock_position (item) ||
+ layer_lock_alpha != gimp_layer_get_lock_alpha (layer))
{
gimp_image_undo_group_start (image,
GIMP_UNDO_GROUP_ITEM_PROPERTIES,
@@ -1377,8 +1451,14 @@ layers_edit_attributes_callback (GtkWidget *dialog,
if (layer_mode != gimp_layer_get_mode (layer))
gimp_layer_set_mode (layer, layer_mode, TRUE);
- if (layer_composite != gimp_layer_get_composite (layer))
- gimp_layer_set_composite (layer, layer_composite, TRUE);
+ if (layer_blend_space != gimp_layer_get_blend_space (layer))
+ gimp_layer_set_blend_space (layer, layer_blend_space, TRUE);
+
+ if (layer_composite_space != gimp_layer_get_composite_space (layer))
+ gimp_layer_set_composite_space (layer, layer_composite_space, TRUE);
+
+ if (layer_composite_mode != gimp_layer_get_composite_mode (layer))
+ gimp_layer_set_composite_mode (layer, layer_composite_mode, TRUE);
if (layer_opacity != gimp_layer_get_opacity (layer))
gimp_layer_set_opacity (layer, layer_opacity, TRUE);
diff --git a/app/actions/layers-commands.h b/app/actions/layers-commands.h
index 27d3e72..b1f6651 100644
--- a/app/actions/layers-commands.h
+++ b/app/actions/layers-commands.h
@@ -106,7 +106,13 @@ void layers_opacity_cmd_callback (GtkAction *action,
void layers_mode_cmd_callback (GtkAction *action,
gint value,
gpointer data);
-void layers_composite_cmd_callback (GtkAction *action,
+void layers_blend_space_cmd_callback (GtkAction *action,
+ GtkAction *current,
+ gpointer data);
+void layers_composite_space_cmd_callback (GtkAction *action,
+ GtkAction *current,
+ gpointer data);
+void layers_composite_mode_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data);
diff --git a/app/config/gimpdialogconfig.c b/app/config/gimpdialogconfig.c
index 554acf5..ec1b51b 100644
--- a/app/config/gimpdialogconfig.c
+++ b/app/config/gimpdialogconfig.c
@@ -68,6 +68,8 @@ enum
PROP_LAYER_NEW_NAME,
PROP_LAYER_NEW_MODE,
+ PROP_LAYER_NEW_BLEND_SPACE,
+ PROP_LAYER_NEW_COMPOSITE_SPACE,
PROP_LAYER_NEW_COMPOSITE_MODE,
PROP_LAYER_NEW_OPACITY,
PROP_LAYER_NEW_FILL_TYPE,
@@ -303,6 +305,22 @@ gimp_dialog_config_class_init (GimpDialogConfigClass *klass)
GIMP_LAYER_MODE_NORMAL,
GIMP_PARAM_STATIC_STRINGS);
+ GIMP_CONFIG_PROP_ENUM (object_class, PROP_LAYER_NEW_BLEND_SPACE,
+ "layer-new-blend-space",
+ "Default new layer blend space",
+ LAYER_NEW_BLEND_SPACE_BLURB,
+ GIMP_TYPE_LAYER_COLOR_SPACE,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_PARAM_STATIC_STRINGS);
+
+ GIMP_CONFIG_PROP_ENUM (object_class, PROP_LAYER_NEW_COMPOSITE_SPACE,
+ "layer-new-composite-space",
+ "Default new layer composite space",
+ LAYER_NEW_COMPOSITE_SPACE_BLURB,
+ GIMP_TYPE_LAYER_COLOR_SPACE,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_PARAM_STATIC_STRINGS);
+
GIMP_CONFIG_PROP_ENUM (object_class, PROP_LAYER_NEW_COMPOSITE_MODE,
"layer-new-composite-mode",
"Default new layer composite mode",
@@ -649,6 +667,12 @@ gimp_dialog_config_set_property (GObject *object,
case PROP_LAYER_NEW_MODE:
config->layer_new_mode = g_value_get_enum (value);
break;
+ case PROP_LAYER_NEW_BLEND_SPACE:
+ config->layer_new_blend_space = g_value_get_enum (value);
+ break;
+ case PROP_LAYER_NEW_COMPOSITE_SPACE:
+ config->layer_new_composite_space = g_value_get_enum (value);
+ break;
case PROP_LAYER_NEW_COMPOSITE_MODE:
config->layer_new_composite_mode = g_value_get_enum (value);
break;
@@ -832,6 +856,12 @@ gimp_dialog_config_get_property (GObject *object,
case PROP_LAYER_NEW_MODE:
g_value_set_enum (value, config->layer_new_mode);
break;
+ case PROP_LAYER_NEW_BLEND_SPACE:
+ g_value_set_enum (value, config->layer_new_blend_space);
+ break;
+ case PROP_LAYER_NEW_COMPOSITE_SPACE:
+ g_value_set_enum (value, config->layer_new_composite_space);
+ break;
case PROP_LAYER_NEW_COMPOSITE_MODE:
g_value_set_enum (value, config->layer_new_composite_mode);
break;
diff --git a/app/config/gimpdialogconfig.h b/app/config/gimpdialogconfig.h
index 78ea299..a040ce1 100644
--- a/app/config/gimpdialogconfig.h
+++ b/app/config/gimpdialogconfig.h
@@ -66,6 +66,8 @@ struct _GimpDialogConfig
gchar *layer_new_name;
GimpLayerMode layer_new_mode;
+ GimpLayerColorSpace layer_new_blend_space;
+ GimpLayerColorSpace layer_new_composite_space;
GimpLayerCompositeMode layer_new_composite_mode;
gdouble layer_new_opacity;
GimpFillType layer_new_fill_type;
diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h
index 02c2cf8..0c2788f 100644
--- a/app/config/gimprc-blurbs.h
+++ b/app/config/gimprc-blurbs.h
@@ -482,6 +482,12 @@ _("Sets the default layer name for the 'New Layer' dialog.")
#define LAYER_NEW_MODE_BLURB \
_("Sets the default mode for the 'New Layer' dialog.")
+#define LAYER_NEW_BLEND_SPACE_BLURB \
+_("Sets the default blend space for the 'New Layer' dialog.")
+
+#define LAYER_NEW_COMPOSITE_SPACE_BLURB \
+_("Sets the default composite space for the 'New Layer' dialog.")
+
#define LAYER_NEW_COMPOSITE_MODE_BLURB \
_("Sets the default composite mode for the 'New Layer' dialog.")
diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c
index dc43e05..1e0aa7a 100644
--- a/app/core/gimp-edit.c
+++ b/app/core/gimp-edit.c
@@ -623,6 +623,8 @@ gimp_edit_fill (GimpImage *image,
TRUE, undo_desc,
gimp_context_get_opacity (GIMP_CONTEXT (options)),
gimp_context_get_paint_mode (GIMP_CONTEXT (options)),
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
GIMP_LAYER_COMPOSITE_AUTO,
NULL, x, y);
@@ -662,6 +664,8 @@ gimp_edit_fade (GimpImage *image,
gimp_object_get_name (undo),
gimp_context_get_opacity (context),
gimp_context_get_paint_mode (context),
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
GIMP_LAYER_COMPOSITE_AUTO,
NULL, undo->x, undo->y);
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 86cbef4..418079e 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -164,7 +164,9 @@ static void gimp_channel_apply_buffer (GimpDrawable *drawable,
const gchar *undo_desc,
gdouble opacity,
GimpLayerMode mode,
- GimpLayerCompositeMode composite,
+ GimpLayerColorSpace blend_space,
+ GimpLayerColorSpace composite_space,
+ GimpLayerCompositeMode composite_mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y);
@@ -1015,7 +1017,9 @@ gimp_channel_apply_buffer (GimpDrawable *drawable,
const gchar *undo_desc,
gdouble opacity,
GimpLayerMode mode,
- GimpLayerCompositeMode composite,
+ GimpLayerColorSpace blend_space,
+ GimpLayerColorSpace composite_space,
+ GimpLayerCompositeMode composite_mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y)
@@ -1025,7 +1029,10 @@ gimp_channel_apply_buffer (GimpDrawable *drawable,
GIMP_DRAWABLE_CLASS (parent_class)->apply_buffer (drawable, buffer,
buffer_region,
push_undo, undo_desc,
- opacity, mode, composite,
+ opacity, mode,
+ blend_space,
+ composite_space,
+ composite_mode,
base_buffer,
base_x, base_y);
diff --git a/app/core/gimpdrawable-blend.c b/app/core/gimpdrawable-blend.c
index 094affb..9868a5a 100644
--- a/app/core/gimpdrawable-blend.c
+++ b/app/core/gimpdrawable-blend.c
@@ -148,7 +148,10 @@ gimp_drawable_blend (GimpDrawable *drawable,
gimp_drawable_apply_buffer (drawable, buffer,
GEGL_RECTANGLE (x, y, width, height),
TRUE, C_("undo-type", "Blend"),
- opacity, paint_mode, GIMP_LAYER_COMPOSITE_AUTO,
+ opacity, paint_mode,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_LAYER_COMPOSITE_AUTO,
NULL, x, y);
gimp_drawable_update (drawable, x, y, width, height);
diff --git a/app/core/gimpdrawable-bucket-fill.c b/app/core/gimpdrawable-bucket-fill.c
index c196beb..5396c2e 100644
--- a/app/core/gimpdrawable-bucket-fill.c
+++ b/app/core/gimpdrawable-bucket-fill.c
@@ -180,6 +180,8 @@ gimp_drawable_bucket_fill (GimpDrawable *drawable,
TRUE, C_("undo-type", "Bucket Fill"),
gimp_context_get_opacity (GIMP_CONTEXT (options)),
gimp_context_get_paint_mode (GIMP_CONTEXT (options)),
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
GIMP_LAYER_COMPOSITE_AUTO,
NULL, x, y);
diff --git a/app/core/gimpdrawable-combine.c b/app/core/gimpdrawable-combine.c
index a285313..2df4143 100644
--- a/app/core/gimpdrawable-combine.c
+++ b/app/core/gimpdrawable-combine.c
@@ -47,7 +47,9 @@ gimp_drawable_real_apply_buffer (GimpDrawable *drawable,
const gchar *undo_desc,
gdouble opacity,
GimpLayerMode mode,
- GimpLayerCompositeMode composite,
+ GimpLayerColorSpace blend_space,
+ GimpLayerColorSpace composite_space,
+ GimpLayerCompositeMode composite_mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y)
@@ -103,9 +105,11 @@ gimp_drawable_real_apply_buffer (GimpDrawable *drawable,
if (undo)
{
- undo->paint_mode = mode;
- undo->composite_mode = composite;
- undo->opacity = opacity;
+ undo->paint_mode = mode;
+ undo->blend_space = blend_space;
+ undo->composite_space = composite_space;
+ undo->composite_mode = composite_mode;
+ undo->opacity = opacity;
undo->applied_buffer =
gegl_buffer_new (GEGL_RECTANGLE (0, 0, width, height),
@@ -143,7 +147,8 @@ gimp_drawable_real_apply_buffer (GimpDrawable *drawable,
base_y - buffer_region->y);
gimp_applicator_set_opacity (applicator, opacity);
- gimp_applicator_set_mode (applicator, mode, composite);
+ gimp_applicator_set_mode (applicator, mode,
+ blend_space, composite_space, composite_mode);
gimp_applicator_set_affect (applicator,
gimp_drawable_get_active_mask (drawable));
diff --git a/app/core/gimpdrawable-combine.h b/app/core/gimpdrawable-combine.h
index 09a29ad..67b5bbb 100644
--- a/app/core/gimpdrawable-combine.h
+++ b/app/core/gimpdrawable-combine.h
@@ -28,7 +28,9 @@ void gimp_drawable_real_apply_buffer (GimpDrawable *drawable,
const gchar *undo_desc,
gdouble opacity,
GimpLayerMode mode,
- GimpLayerCompositeMode composite,
+ GimpLayerColorSpace blend_space,
+ GimpLayerColorSpace composite_space,
+ GimpLayerCompositeMode composite_mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y);
diff --git a/app/core/gimpdrawable-fill.c b/app/core/gimpdrawable-fill.c
index 59937ea..0921aea 100644
--- a/app/core/gimpdrawable-fill.c
+++ b/app/core/gimpdrawable-fill.c
@@ -256,6 +256,8 @@ gimp_drawable_fill_scan_convert (GimpDrawable *drawable,
push_undo, C_("undo-type", "Render Stroke"),
gimp_context_get_opacity (context),
gimp_context_get_paint_mode (context),
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
GIMP_LAYER_COMPOSITE_AUTO,
NULL, x, y);
diff --git a/app/core/gimpdrawable-floating-selection.c b/app/core/gimpdrawable-floating-selection.c
index e3acecd..f0e10b6 100644
--- a/app/core/gimpdrawable-floating-selection.c
+++ b/app/core/gimpdrawable-floating-selection.c
@@ -305,7 +305,9 @@ gimp_drawable_sync_fs_filter (GimpDrawable *drawable)
gimp_layer_get_opacity (fs));
gimp_applicator_set_mode (private->fs_applicator,
gimp_layer_get_mode (fs),
- gimp_layer_get_composite (fs));
+ gimp_layer_get_blend_space (fs),
+ gimp_layer_get_composite_space (fs),
+ gimp_layer_get_composite_mode (fs));
gimp_applicator_set_affect (private->fs_applicator,
gimp_drawable_get_active_mask (drawable));
}
diff --git a/app/core/gimpdrawable-shadow.c b/app/core/gimpdrawable-shadow.c
index 52493fb..4b64c08 100644
--- a/app/core/gimpdrawable-shadow.c
+++ b/app/core/gimpdrawable-shadow.c
@@ -103,6 +103,8 @@ gimp_drawable_merge_shadow_buffer (GimpDrawable *drawable,
push_undo, undo_desc,
GIMP_OPACITY_OPAQUE,
GIMP_LAYER_MODE_REPLACE,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
GIMP_LAYER_COMPOSITE_AUTO,
NULL, x, y);
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 7c5d80c..131db44 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -1104,7 +1104,9 @@ gimp_drawable_apply_buffer (GimpDrawable *drawable,
const gchar *undo_desc,
gdouble opacity,
GimpLayerMode mode,
- GimpLayerCompositeMode composite,
+ GimpLayerColorSpace blend_space,
+ GimpLayerColorSpace composite_space,
+ GimpLayerCompositeMode composite_mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y)
@@ -1118,7 +1120,10 @@ gimp_drawable_apply_buffer (GimpDrawable *drawable,
GIMP_DRAWABLE_GET_CLASS (drawable)->apply_buffer (drawable, buffer,
buffer_region,
push_undo, undo_desc,
- opacity, mode, composite,
+ opacity, mode,
+ blend_space,
+ composite_space,
+ composite_mode,
base_buffer,
base_x, base_y);
}
diff --git a/app/core/gimpdrawable.h b/app/core/gimpdrawable.h
index db23c81..1be7af7 100644
--- a/app/core/gimpdrawable.h
+++ b/app/core/gimpdrawable.h
@@ -76,7 +76,9 @@ struct _GimpDrawableClass
const gchar *undo_desc,
gdouble opacity,
GimpLayerMode mode,
- GimpLayerCompositeMode composite,
+ GimpLayerColorSpace blend_space,
+ GimpLayerColorSpace composite_space,
+ GimpLayerCompositeMode composite_mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y);
@@ -157,7 +159,9 @@ void gimp_drawable_apply_buffer (GimpDrawable *drawable,
const gchar *undo_desc,
gdouble opacity,
GimpLayerMode mode,
- GimpLayerCompositeMode composite,
+ GimpLayerColorSpace blend_space,
+ GimpLayerColorSpace composite_space,
+ GimpLayerCompositeMode composite_mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y);
diff --git a/app/core/gimpdrawablefilter.c b/app/core/gimpdrawablefilter.c
index 9639f63..dc96f3e 100644
--- a/app/core/gimpdrawablefilter.c
+++ b/app/core/gimpdrawablefilter.c
@@ -68,6 +68,8 @@ struct _GimpDrawableFilter
gdouble preview_position;
gdouble opacity;
GimpLayerMode paint_mode;
+ GimpLayerColorSpace blend_space;
+ GimpLayerColorSpace composite_space;
GimpLayerCompositeMode composite_mode;
gboolean color_managed;
gboolean gamma_hack;
@@ -150,6 +152,8 @@ gimp_drawable_filter_init (GimpDrawableFilter *drawable_filter)
drawable_filter->preview_position = 1.0;
drawable_filter->opacity = GIMP_OPACITY_OPAQUE;
drawable_filter->paint_mode = GIMP_LAYER_MODE_REPLACE;
+ drawable_filter->blend_space = GIMP_LAYER_COLOR_SPACE_AUTO;
+ drawable_filter->composite_space = GIMP_LAYER_COLOR_SPACE_AUTO;
drawable_filter->composite_mode = GIMP_LAYER_COMPOSITE_AUTO;
}
@@ -333,15 +337,21 @@ gimp_drawable_filter_set_opacity (GimpDrawableFilter *filter,
void
gimp_drawable_filter_set_mode (GimpDrawableFilter *filter,
GimpLayerMode paint_mode,
+ GimpLayerColorSpace blend_space,
+ GimpLayerColorSpace composite_space,
GimpLayerCompositeMode composite_mode)
{
g_return_if_fail (GIMP_IS_DRAWABLE_FILTER (filter));
- if (paint_mode != filter->paint_mode ||
- composite_mode != filter->composite_mode)
+ if (paint_mode != filter->paint_mode ||
+ blend_space != filter->blend_space ||
+ composite_space != filter->composite_space ||
+ composite_mode != filter->composite_mode)
{
- filter->paint_mode = paint_mode;
- filter->composite_mode = composite_mode;
+ filter->paint_mode = paint_mode;
+ filter->blend_space = blend_space;
+ filter->composite_space = composite_space;
+ filter->composite_mode = composite_mode;
gimp_drawable_filter_sync_mode (filter);
@@ -589,6 +599,8 @@ gimp_drawable_filter_sync_mode (GimpDrawableFilter *filter)
{
gimp_applicator_set_mode (filter->applicator,
filter->paint_mode,
+ filter->blend_space,
+ filter->composite_space,
filter->composite_mode);
}
diff --git a/app/core/gimpdrawablefilter.h b/app/core/gimpdrawablefilter.h
index 3e364c0..653ed76 100644
--- a/app/core/gimpdrawablefilter.h
+++ b/app/core/gimpdrawablefilter.h
@@ -65,6 +65,8 @@ void gimp_drawable_filter_set_opacity (GimpDrawableFilter *filter,
gdouble opacity);
void gimp_drawable_filter_set_mode (GimpDrawableFilter *filter,
GimpLayerMode paint_mode,
+ GimpLayerColorSpace blend_space,
+ GimpLayerColorSpace composite_space,
GimpLayerCompositeMode composite_mode);
void gimp_drawable_filter_set_color_managed
diff --git a/app/core/gimpdrawableundo.h b/app/core/gimpdrawableundo.h
index d355a5a..a8e0a30 100644
--- a/app/core/gimpdrawableundo.h
+++ b/app/core/gimpdrawableundo.h
@@ -44,6 +44,8 @@ struct _GimpDrawableUndo
/* stuff for "Fade" */
GeglBuffer *applied_buffer;
GimpLayerMode paint_mode;
+ GimpLayerColorSpace blend_space;
+ GimpLayerColorSpace composite_space;
GimpLayerCompositeMode composite_mode;
gdouble opacity;
};
diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c
index 02cc17b..5db7039 100644
--- a/app/core/gimpimage-merge.c
+++ b/app/core/gimpimage-merge.c
@@ -602,7 +602,9 @@ gimp_image_merge_layers (GimpImage *image,
GeglBuffer *layer_buffer;
GimpApplicator *applicator;
GimpLayerMode mode;
- GimpLayerCompositeMode composite;
+ GimpLayerColorSpace blend_space;
+ GimpLayerColorSpace composite_space;
+ GimpLayerCompositeMode composite_mode;
layer = layers->data;
@@ -612,13 +614,17 @@ gimp_image_merge_layers (GimpImage *image,
* work on the projection with the lower layer, but only locally on
* the layers alpha channel.
*/
- mode = gimp_layer_get_mode (layer);
- composite = gimp_layer_get_composite (layer);
+ mode = gimp_layer_get_mode (layer);
+ blend_space = gimp_layer_get_blend_space (layer);
+ composite_space = gimp_layer_get_composite_space (layer);
+ composite_mode = gimp_layer_get_composite_mode (layer);
if (layer == bottom_layer && mode != GIMP_LAYER_MODE_DISSOLVE)
{
- mode = GIMP_LAYER_MODE_NORMAL;
- composite = GIMP_LAYER_COMPOSITE_AUTO;
+ mode = GIMP_LAYER_MODE_NORMAL;
+ blend_space = GIMP_LAYER_COLOR_SPACE_AUTO;
+ composite_space = GIMP_LAYER_COLOR_SPACE_AUTO;
+ composite_mode = GIMP_LAYER_COMPOSITE_AUTO;
}
merge_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (merge_layer));
@@ -648,7 +654,8 @@ gimp_image_merge_layers (GimpImage *image,
- (y1 - off_y));
gimp_applicator_set_opacity (applicator, gimp_layer_get_opacity (layer));
- gimp_applicator_set_mode (applicator, mode, composite);
+ gimp_applicator_set_mode (applicator, mode,
+ blend_space, composite_space, composite_mode);
gimp_applicator_blit (applicator,
GEGL_RECTANGLE (0, 0,
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index bc64f09..7cb9009 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -59,7 +59,9 @@ enum
{
OPACITY_CHANGED,
MODE_CHANGED,
- COMPOSITE_CHANGED,
+ BLEND_SPACE_CHANGED,
+ COMPOSITE_SPACE_CHANGED,
+ COMPOSITE_MODE_CHANGED,
LOCK_ALPHA_CHANGED,
MASK_CHANGED,
APPLY_MASK_CHANGED,
@@ -73,7 +75,9 @@ enum
PROP_0,
PROP_OPACITY,
PROP_MODE,
- PROP_COMPOSITE,
+ PROP_BLEND_SPACE,
+ PROP_COMPOSITE_SPACE,
+ PROP_COMPOSITE_MODE,
PROP_LOCK_ALPHA,
PROP_MASK,
PROP_FLOATING_SELECTION
@@ -249,11 +253,29 @@ gimp_layer_class_init (GimpLayerClass *klass)
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- layer_signals[COMPOSITE_CHANGED] =
- g_signal_new ("composite-changed",
+ layer_signals[BLEND_SPACE_CHANGED] =
+ g_signal_new ("blend-space-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GimpLayerClass, composite_changed),
+ G_STRUCT_OFFSET (GimpLayerClass, blend_space_changed),
+ NULL, NULL,
+ gimp_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ layer_signals[COMPOSITE_SPACE_CHANGED] =
+ g_signal_new ("composite-space-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpLayerClass, composite_space_changed),
+ NULL, NULL,
+ gimp_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ layer_signals[COMPOSITE_MODE_CHANGED] =
+ g_signal_new ("composite-mode-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpLayerClass, composite_mode_changed),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
@@ -359,7 +381,9 @@ gimp_layer_class_init (GimpLayerClass *klass)
klass->opacity_changed = NULL;
klass->mode_changed = NULL;
- klass->composite_changed = NULL;
+ klass->blend_space_changed = NULL;
+ klass->composite_space_changed = NULL;
+ klass->composite_mode_changed = NULL;
klass->lock_alpha_changed = NULL;
klass->mask_changed = NULL;
klass->apply_mask_changed = NULL;
@@ -379,8 +403,23 @@ gimp_layer_class_init (GimpLayerClass *klass)
GIMP_LAYER_MODE_NORMAL,
GIMP_PARAM_READABLE));
- g_object_class_install_property (object_class, PROP_COMPOSITE,
- g_param_spec_enum ("composite", NULL, NULL,
+ g_object_class_install_property (object_class, PROP_BLEND_SPACE,
+ g_param_spec_enum ("blend-space",
+ NULL, NULL,
+ GIMP_TYPE_LAYER_COLOR_SPACE,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_PARAM_READABLE));
+
+ g_object_class_install_property (object_class, PROP_COMPOSITE_SPACE,
+ g_param_spec_enum ("composite-space",
+ NULL, NULL,
+ GIMP_TYPE_LAYER_COLOR_SPACE,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_PARAM_READABLE));
+
+ g_object_class_install_property (object_class, PROP_COMPOSITE_MODE,
+ g_param_spec_enum ("composite-mode",
+ NULL, NULL,
GIMP_TYPE_LAYER_COMPOSITE_MODE,
GIMP_LAYER_COMPOSITE_AUTO,
GIMP_PARAM_READABLE));
@@ -407,10 +446,12 @@ gimp_layer_class_init (GimpLayerClass *klass)
static void
gimp_layer_init (GimpLayer *layer)
{
- layer->opacity = GIMP_OPACITY_OPAQUE;
- layer->mode = GIMP_LAYER_MODE_NORMAL;
- layer->composite = GIMP_LAYER_COMPOSITE_AUTO;
- layer->lock_alpha = FALSE;
+ layer->opacity = GIMP_OPACITY_OPAQUE;
+ layer->mode = GIMP_LAYER_MODE_NORMAL;
+ layer->blend_space = GIMP_LAYER_COLOR_SPACE_AUTO;
+ layer->composite_space = GIMP_LAYER_COLOR_SPACE_AUTO;
+ layer->composite_mode = GIMP_LAYER_COMPOSITE_AUTO;
+ layer->lock_alpha = FALSE;
layer->mask = NULL;
layer->apply_mask = TRUE;
@@ -468,8 +509,14 @@ gimp_layer_get_property (GObject *object,
case PROP_MODE:
g_value_set_enum (value, gimp_layer_get_mode (layer));
break;
- case PROP_COMPOSITE:
- g_value_set_enum (value, gimp_layer_get_composite (layer));
+ case PROP_BLEND_SPACE:
+ g_value_set_enum (value, gimp_layer_get_blend_space (layer));
+ break;
+ case PROP_COMPOSITE_SPACE:
+ g_value_set_enum (value, gimp_layer_get_composite_space (layer));
+ break;
+ case PROP_COMPOSITE_MODE:
+ g_value_set_enum (value, gimp_layer_get_composite_mode (layer));
break;
case PROP_LOCK_ALPHA:
g_value_set_boolean (value, gimp_layer_get_lock_alpha (layer));
@@ -532,31 +579,43 @@ gimp_layer_update_mode_node (GimpLayer *layer)
{
GeglNode *mode_node;
GimpLayerMode visible_mode;
- GimpLayerCompositeMode visible_composite;
+ GimpLayerColorSpace visible_blend_space;
+ GimpLayerColorSpace visible_composite_space;
+ GimpLayerCompositeMode visible_composite_mode;
mode_node = gimp_drawable_get_mode_node (GIMP_DRAWABLE (layer));
if (layer->mask && layer->show_mask)
{
- visible_mode = GIMP_LAYER_MODE_NORMAL;
- visible_composite = GIMP_LAYER_COMPOSITE_AUTO;
+ visible_mode = GIMP_LAYER_MODE_NORMAL;
+ visible_blend_space = GIMP_LAYER_COLOR_SPACE_AUTO;
+ visible_composite_space = GIMP_LAYER_COLOR_SPACE_AUTO;
+ visible_composite_mode = GIMP_LAYER_COMPOSITE_AUTO;
}
else
{
if (layer->mode != GIMP_LAYER_MODE_DISSOLVE &&
gimp_filter_get_is_last_node (GIMP_FILTER (layer)))
{
- visible_mode = GIMP_LAYER_MODE_NORMAL;
- visible_composite = GIMP_LAYER_COMPOSITE_AUTO;
+ visible_mode = GIMP_LAYER_MODE_NORMAL;
+ visible_blend_space = GIMP_LAYER_COLOR_SPACE_AUTO;
+ visible_composite_space = GIMP_LAYER_COLOR_SPACE_AUTO;
+ visible_composite_mode = GIMP_LAYER_COMPOSITE_AUTO;
}
else
{
- visible_mode = layer->mode;
- visible_composite = layer->composite;
+ visible_mode = layer->mode;
+ visible_blend_space = layer->blend_space;
+ visible_composite_space = layer->composite_space;
+ visible_composite_mode = layer->composite_mode;
}
}
- gimp_gegl_mode_node_set_mode (mode_node, visible_mode, visible_composite);
+ gimp_gegl_mode_node_set_mode (mode_node,
+ visible_mode,
+ visible_blend_space,
+ visible_composite_space,
+ visible_composite_mode);
gimp_gegl_mode_node_set_opacity (mode_node, layer->opacity);
}
@@ -773,12 +832,16 @@ gimp_layer_duplicate (GimpItem *item,
GimpLayer *layer = GIMP_LAYER (item);
GimpLayer *new_layer = GIMP_LAYER (new_item);
- gimp_layer_set_mode (new_layer,
- gimp_layer_get_mode (layer), FALSE);
- gimp_layer_set_composite (new_layer,
- gimp_layer_get_composite (layer), FALSE);
- gimp_layer_set_opacity (new_layer,
- gimp_layer_get_opacity (layer), FALSE);
+ gimp_layer_set_mode (new_layer,
+ gimp_layer_get_mode (layer), FALSE);
+ gimp_layer_set_blend_space (new_layer,
+ gimp_layer_get_blend_space (layer), FALSE);
+ gimp_layer_set_composite_space (new_layer,
+ gimp_layer_get_composite_space (layer), FALSE);
+ gimp_layer_set_composite_mode (new_layer,
+ gimp_layer_get_composite_mode (layer), FALSE);
+ gimp_layer_set_opacity (new_layer,
+ gimp_layer_get_opacity (layer), FALSE);
if (gimp_layer_can_lock_alpha (new_layer))
gimp_layer_set_lock_alpha (new_layer,
@@ -2088,15 +2151,31 @@ gimp_layer_set_mode (GimpLayer *layer,
g_signal_emit (layer, layer_signals[MODE_CHANGED], 0);
g_object_notify (G_OBJECT (layer), "mode");
- /* when changing modes, we always switch to AUTO composite in
- * order to avoid confusion
+ /* when changing modes, we always switch to AUTO blend and
+ * composite in order to avoid confusion
*/
- if (layer->composite != GIMP_LAYER_COMPOSITE_AUTO)
+ if (layer->blend_space != GIMP_LAYER_COLOR_SPACE_AUTO)
{
- layer->composite = GIMP_LAYER_COMPOSITE_AUTO;
+ layer->blend_space = GIMP_LAYER_COLOR_SPACE_AUTO;
- g_signal_emit (layer, layer_signals[COMPOSITE_CHANGED], 0);
- g_object_notify (G_OBJECT (layer), "composite");
+ g_signal_emit (layer, layer_signals[BLEND_SPACE_CHANGED], 0);
+ g_object_notify (G_OBJECT (layer), "blend-space");
+ }
+
+ if (layer->composite_space != GIMP_LAYER_COLOR_SPACE_AUTO)
+ {
+ layer->composite_space = GIMP_LAYER_COLOR_SPACE_AUTO;
+
+ g_signal_emit (layer, layer_signals[COMPOSITE_SPACE_CHANGED], 0);
+ g_object_notify (G_OBJECT (layer), "composite-space");
+ }
+
+ if (layer->composite_mode != GIMP_LAYER_COMPOSITE_AUTO)
+ {
+ layer->composite_mode = GIMP_LAYER_COMPOSITE_AUTO;
+
+ g_signal_emit (layer, layer_signals[COMPOSITE_MODE_CHANGED], 0);
+ g_object_notify (G_OBJECT (layer), "composite-mode");
}
g_object_thaw_notify (G_OBJECT (layer));
@@ -2117,13 +2196,13 @@ gimp_layer_get_mode (GimpLayer *layer)
}
void
-gimp_layer_set_composite (GimpLayer *layer,
- GimpLayerCompositeMode composite,
- gboolean push_undo)
+gimp_layer_set_blend_space (GimpLayer *layer,
+ GimpLayerColorSpace blend_space,
+ gboolean push_undo)
{
g_return_if_fail (GIMP_IS_LAYER (layer));
- if (layer->composite != composite)
+ if (layer->blend_space != blend_space)
{
if (push_undo && gimp_item_is_attached (GIMP_ITEM (layer)))
{
@@ -2132,10 +2211,82 @@ gimp_layer_set_composite (GimpLayer *layer,
gimp_image_undo_push_layer_mode (image, NULL, layer);
}
- layer->composite = composite;
+ layer->blend_space = blend_space;
- g_signal_emit (layer, layer_signals[COMPOSITE_CHANGED], 0);
- g_object_notify (G_OBJECT (layer), "composite");
+ g_signal_emit (layer, layer_signals[BLEND_SPACE_CHANGED], 0);
+ g_object_notify (G_OBJECT (layer), "blend-space");
+
+ if (gimp_filter_peek_node (GIMP_FILTER (layer)))
+ gimp_layer_update_mode_node (layer);
+
+ gimp_drawable_update (GIMP_DRAWABLE (layer), 0, 0, -1, -1);
+ }
+}
+
+GimpLayerColorSpace
+gimp_layer_get_blend_space (GimpLayer *layer)
+{
+ g_return_val_if_fail (GIMP_IS_LAYER (layer), GIMP_LAYER_COLOR_SPACE_AUTO);
+
+ return layer->blend_space;
+}
+
+void
+gimp_layer_set_composite_space (GimpLayer *layer,
+ GimpLayerColorSpace composite_space,
+ gboolean push_undo)
+{
+ g_return_if_fail (GIMP_IS_LAYER (layer));
+
+ if (layer->composite_space != composite_space)
+ {
+ if (push_undo && gimp_item_is_attached (GIMP_ITEM (layer)))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
+
+ gimp_image_undo_push_layer_mode (image, NULL, layer);
+ }
+
+ layer->composite_space = composite_space;
+
+ g_signal_emit (layer, layer_signals[COMPOSITE_SPACE_CHANGED], 0);
+ g_object_notify (G_OBJECT (layer), "composite-space");
+
+ if (gimp_filter_peek_node (GIMP_FILTER (layer)))
+ gimp_layer_update_mode_node (layer);
+
+ gimp_drawable_update (GIMP_DRAWABLE (layer), 0, 0, -1, -1);
+ }
+}
+
+GimpLayerColorSpace
+gimp_layer_get_composite_space (GimpLayer *layer)
+{
+ g_return_val_if_fail (GIMP_IS_LAYER (layer), GIMP_LAYER_COLOR_SPACE_AUTO);
+
+ return layer->composite_space;
+}
+
+void
+gimp_layer_set_composite_mode (GimpLayer *layer,
+ GimpLayerCompositeMode composite_mode,
+ gboolean push_undo)
+{
+ g_return_if_fail (GIMP_IS_LAYER (layer));
+
+ if (layer->composite_mode != composite_mode)
+ {
+ if (push_undo && gimp_item_is_attached (GIMP_ITEM (layer)))
+ {
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
+
+ gimp_image_undo_push_layer_mode (image, NULL, layer);
+ }
+
+ layer->composite_mode = composite_mode;
+
+ g_signal_emit (layer, layer_signals[COMPOSITE_MODE_CHANGED], 0);
+ g_object_notify (G_OBJECT (layer), "composite-mode");
if (gimp_filter_peek_node (GIMP_FILTER (layer)))
gimp_layer_update_mode_node (layer);
@@ -2145,11 +2296,11 @@ gimp_layer_set_composite (GimpLayer *layer,
}
GimpLayerCompositeMode
-gimp_layer_get_composite (GimpLayer *layer)
+gimp_layer_get_composite_mode (GimpLayer *layer)
{
- g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
+ g_return_val_if_fail (GIMP_IS_LAYER (layer), GIMP_LAYER_COMPOSITE_AUTO);
- return layer->composite;
+ return layer->composite_mode;
}
void
diff --git a/app/core/gimplayer.h b/app/core/gimplayer.h
index 078054f..cd225b1 100644
--- a/app/core/gimplayer.h
+++ b/app/core/gimplayer.h
@@ -38,7 +38,9 @@ struct _GimpLayer
gdouble opacity; /* layer opacity */
GimpLayerMode mode; /* layer combination mode */
- GimpLayerCompositeMode composite; /* layer composite mode */
+ GimpLayerColorSpace blend_space; /* layer blend space */
+ GimpLayerColorSpace composite_space; /* layer composite space */
+ GimpLayerCompositeMode composite_mode; /* layer composite mode */
gboolean lock_alpha; /* lock the alpha channel */
GimpLayerMask *mask; /* possible layer mask */
@@ -63,14 +65,16 @@ struct _GimpLayerClass
{
GimpDrawableClass parent_class;
- void (* opacity_changed) (GimpLayer *layer);
- void (* mode_changed) (GimpLayer *layer);
- void (* composite_changed) (GimpLayer *layer);
- void (* lock_alpha_changed) (GimpLayer *layer);
- void (* mask_changed) (GimpLayer *layer);
- void (* apply_mask_changed) (GimpLayer *layer);
- void (* edit_mask_changed) (GimpLayer *layer);
- void (* show_mask_changed) (GimpLayer *layer);
+ void (* opacity_changed) (GimpLayer *layer);
+ void (* mode_changed) (GimpLayer *layer);
+ void (* blend_space_changed) (GimpLayer *layer);
+ void (* composite_space_changed) (GimpLayer *layer);
+ void (* composite_mode_changed) (GimpLayer *layer);
+ void (* lock_alpha_changed) (GimpLayer *layer);
+ void (* mask_changed) (GimpLayer *layer);
+ void (* apply_mask_changed) (GimpLayer *layer);
+ void (* edit_mask_changed) (GimpLayer *layer);
+ void (* show_mask_changed) (GimpLayer *layer);
};
@@ -129,11 +133,23 @@ void gimp_layer_set_mode (GimpLayer *layer,
gboolean push_undo);
GimpLayerMode gimp_layer_get_mode (GimpLayer *layer);
-void gimp_layer_set_composite (GimpLayer *layer,
- GimpLayerCompositeMode composite,
+void gimp_layer_set_blend_space (GimpLayer *layer,
+ GimpLayerColorSpace blend_space,
+ gboolean push_undo);
+GimpLayerColorSpace
+ gimp_layer_get_blend_space (GimpLayer *layer);
+
+void gimp_layer_set_composite_space (GimpLayer *layer,
+ GimpLayerColorSpace composite_space,
+ gboolean push_undo);
+GimpLayerColorSpace
+ gimp_layer_get_composite_space (GimpLayer *layer);
+
+void gimp_layer_set_composite_mode (GimpLayer *layer,
+ GimpLayerCompositeMode composite_mode,
gboolean push_undo);
GimpLayerCompositeMode
- gimp_layer_get_composite (GimpLayer *layer);
+ gimp_layer_get_composite_mode (GimpLayer *layer);
void gimp_layer_set_lock_alpha (GimpLayer *layer,
gboolean lock_alpha,
diff --git a/app/core/gimplayerpropundo.c b/app/core/gimplayerpropundo.c
index 35597b5..e01facd 100644
--- a/app/core/gimplayerpropundo.c
+++ b/app/core/gimplayerpropundo.c
@@ -72,8 +72,10 @@ gimp_layer_prop_undo_constructed (GObject *object)
switch (GIMP_UNDO (object)->undo_type)
{
case GIMP_UNDO_LAYER_MODE:
- layer_prop_undo->mode = gimp_layer_get_mode (layer);
- layer_prop_undo->composite = gimp_layer_get_composite (layer);
+ layer_prop_undo->mode = gimp_layer_get_mode (layer);
+ layer_prop_undo->blend_space = gimp_layer_get_blend_space (layer);
+ layer_prop_undo->composite_space = gimp_layer_get_composite_space (layer);
+ layer_prop_undo->composite_mode = gimp_layer_get_composite_mode (layer);
break;
case GIMP_UNDO_LAYER_OPACITY:
@@ -104,16 +106,28 @@ gimp_layer_prop_undo_pop (GimpUndo *undo,
case GIMP_UNDO_LAYER_MODE:
{
GimpLayerMode mode;
- GimpLayerCompositeMode composite;
-
- mode = gimp_layer_get_mode (layer);
- composite = gimp_layer_get_composite (layer);
-
- gimp_layer_set_mode (layer, layer_prop_undo->mode, FALSE);
- gimp_layer_set_composite (layer, layer_prop_undo->composite, FALSE);
-
- layer_prop_undo->mode = mode;
- layer_prop_undo->composite = composite;
+ GimpLayerColorSpace blend_space;
+ GimpLayerColorSpace composite_space;
+ GimpLayerCompositeMode composite_mode;
+
+ mode = gimp_layer_get_mode (layer);
+ blend_space = gimp_layer_get_blend_space (layer);
+ composite_space = gimp_layer_get_composite_space (layer);
+ composite_mode = gimp_layer_get_composite_mode (layer);
+
+ gimp_layer_set_mode (layer, layer_prop_undo->mode,
+ FALSE);
+ gimp_layer_set_blend_space (layer, layer_prop_undo->blend_space,
+ FALSE);
+ gimp_layer_set_composite_space (layer, layer_prop_undo->composite_space,
+ FALSE);
+ gimp_layer_set_composite_mode (layer, layer_prop_undo->composite_mode,
+ FALSE);
+
+ layer_prop_undo->mode = mode;
+ layer_prop_undo->blend_space = blend_space;
+ layer_prop_undo->composite_space = composite_space;
+ layer_prop_undo->composite_mode = composite_mode;
}
break;
diff --git a/app/core/gimplayerpropundo.h b/app/core/gimplayerpropundo.h
index f3d61ba..4e60712 100644
--- a/app/core/gimplayerpropundo.h
+++ b/app/core/gimplayerpropundo.h
@@ -38,7 +38,9 @@ struct _GimpLayerPropUndo
GimpItemUndo parent_instance;
GimpLayerMode mode;
- GimpLayerCompositeMode composite;
+ GimpLayerColorSpace blend_space;
+ GimpLayerColorSpace composite_space;
+ GimpLayerCompositeMode composite_mode;
gdouble opacity;
gboolean lock_alpha;
};
diff --git a/app/dialogs/layer-options-dialog.c b/app/dialogs/layer-options-dialog.c
index fd4f13f..a46b633 100644
--- a/app/dialogs/layer-options-dialog.c
+++ b/app/dialogs/layer-options-dialog.c
@@ -51,7 +51,9 @@ struct _LayerOptionsDialog
{
GimpLayer *layer;
GimpLayerMode mode;
- GimpLayerCompositeMode composite;
+ GimpLayerColorSpace blend_space;
+ GimpLayerColorSpace composite_space;
+ GimpLayerCompositeMode composite_mode;
gdouble opacity;
GimpFillType fill_type;
gboolean lock_alpha;
@@ -97,7 +99,9 @@ layer_options_dialog_new (GimpImage *image,
const gchar *help_id,
const gchar *layer_name,
GimpLayerMode layer_mode,
- GimpLayerCompositeMode layer_composite,
+ GimpLayerColorSpace layer_blend_space,
+ GimpLayerColorSpace layer_composite_space,
+ GimpLayerCompositeMode layer_composite_mode,
gdouble layer_opacity,
GimpFillType layer_fill_type,
gboolean layer_visible,
@@ -131,7 +135,9 @@ layer_options_dialog_new (GimpImage *image,
private->layer = layer;
private->mode = layer_mode;
- private->composite = layer_composite;
+ private->blend_space = layer_blend_space;
+ private->composite_space = layer_composite_space;
+ private->composite_mode = layer_composite_mode;
private->opacity = layer_opacity * 100.0;
private->fill_type = layer_fill_type;
private->lock_alpha = layer_lock_alpha;
@@ -166,14 +172,32 @@ layer_options_dialog_new (GimpImage *image,
gimp_layer_mode_box_set_mode (GIMP_LAYER_MODE_BOX (private->mode_box),
private->mode);
+ combo = gimp_enum_combo_box_new (GIMP_TYPE_LAYER_COLOR_SPACE);
+ item_options_dialog_add_widget (dialog, _("Blend space:"), combo);
+ gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (combo),
+ "gimp-layer-color-space");
+ gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo),
+ private->blend_space,
+ G_CALLBACK (gimp_int_combo_box_get_active),
+ &private->blend_space);
+
+ combo = gimp_enum_combo_box_new (GIMP_TYPE_LAYER_COLOR_SPACE);
+ item_options_dialog_add_widget (dialog, _("Composite space:"), combo);
+ gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (combo),
+ "gimp-layer-color-space");
+ gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo),
+ private->composite_space,
+ G_CALLBACK (gimp_int_combo_box_get_active),
+ &private->composite_space);
+
combo = gimp_enum_combo_box_new (GIMP_TYPE_LAYER_COMPOSITE_MODE);
- item_options_dialog_add_widget (dialog, _("Composite:"), combo);
+ item_options_dialog_add_widget (dialog, _("Composite mode:"), combo);
gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (combo),
"gimp-layer-composite");
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo),
- private->composite,
+ private->composite_mode,
G_CALLBACK (gimp_int_combo_box_get_active),
- &private->composite);
+ &private->composite_mode);
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (private->opacity, 0.0, 100.0,
1.0, 10.0, 0.0));
@@ -458,7 +482,9 @@ layer_options_dialog_callback (GtkWidget *dialog,
context,
item_name,
private->mode,
- private->composite,
+ private->blend_space,
+ private->composite_space,
+ private->composite_mode,
private->opacity / 100.0,
private->fill_type,
width,
diff --git a/app/dialogs/layer-options-dialog.h b/app/dialogs/layer-options-dialog.h
index ad18b90..326efa0 100644
--- a/app/dialogs/layer-options-dialog.h
+++ b/app/dialogs/layer-options-dialog.h
@@ -25,7 +25,9 @@ typedef void (* GimpLayerOptionsCallback) (GtkWidget *dialog,
GimpContext *context,
const gchar *layer_name,
GimpLayerMode layer_mode,
- GimpLayerCompositeMode layer_composite,
+ GimpLayerColorSpace layer_blend_space,
+ GimpLayerColorSpace layer_composite_space,
+ GimpLayerCompositeMode layer_composite_mode,
gdouble layer_opacity,
GimpFillType layer_fill_type,
gint layer_width,
@@ -53,7 +55,9 @@ GtkWidget * layer_options_dialog_new (GimpImage *image,
const gchar *help_id,
const gchar *layer_name,
GimpLayerMode layer_mode,
- GimpLayerCompositeMode layer_composite,
+ GimpLayerColorSpace layer_blend_space,
+ GimpLayerColorSpace layer_composite_space,
+ GimpLayerCompositeMode layer_composite_mode,
gdouble layer_opacity,
GimpFillType layer_fill_type,
gboolean layer_visible,
diff --git a/app/gegl/gimp-gegl-nodes.c b/app/gegl/gimp-gegl-nodes.c
index 86fa66f..dbb811e 100644
--- a/app/gegl/gimp-gegl-nodes.c
+++ b/app/gegl/gimp-gegl-nodes.c
@@ -143,14 +143,22 @@ gimp_gegl_add_buffer_source (GeglNode *parent,
void
gimp_gegl_mode_node_set_mode (GeglNode *node,
GimpLayerMode mode,
- GimpLayerCompositeMode composite)
+ GimpLayerColorSpace blend_space,
+ GimpLayerColorSpace composite_space,
+ GimpLayerCompositeMode composite_mode)
{
gdouble opacity;
g_return_if_fail (GEGL_IS_NODE (node));
- if (composite == GIMP_LAYER_COMPOSITE_AUTO)
- composite = gimp_layer_mode_get_composite_mode (mode);
+ if (blend_space == GIMP_LAYER_COLOR_SPACE_AUTO)
+ blend_space = gimp_layer_mode_get_blend_space (mode);
+
+ if (composite_space == GIMP_LAYER_COLOR_SPACE_AUTO)
+ composite_space = gimp_layer_mode_get_composite_space (mode);
+
+ if (composite_mode == GIMP_LAYER_COMPOSITE_AUTO)
+ composite_mode = gimp_layer_mode_get_composite_mode (mode);
gegl_node_get (node,
"opacity", &opacity,
@@ -162,11 +170,11 @@ gimp_gegl_mode_node_set_mode (GeglNode *node,
gegl_node_set (node,
"operation", gimp_layer_mode_get_operation (mode),
"layer-mode", mode,
- "composite-mode", composite,
"opacity", opacity,
"linear", gimp_layer_mode_wants_linear_data (mode),
- "blend-space", gimp_layer_mode_get_blend_space (mode),
- "composite-space", gimp_layer_mode_get_composite_space (mode),
+ "blend-space", blend_space,
+ "composite-space", composite_space,
+ "composite-mode", composite_mode,
NULL);
}
diff --git a/app/gegl/gimp-gegl-nodes.h b/app/gegl/gimp-gegl-nodes.h
index 6d63288..0963fec 100644
--- a/app/gegl/gimp-gegl-nodes.h
+++ b/app/gegl/gimp-gegl-nodes.h
@@ -34,7 +34,9 @@ GeglNode * gimp_gegl_add_buffer_source (GeglNode *parent,
void gimp_gegl_mode_node_set_mode (GeglNode *node,
GimpLayerMode mode,
- GimpLayerCompositeMode composite);
+ GimpLayerColorSpace blend_space,
+ GimpLayerColorSpace composite_space,
+ GimpLayerCompositeMode composite_mode);
void gimp_gegl_mode_node_set_opacity (GeglNode *node,
gdouble opacity);
diff --git a/app/gegl/gimpapplicator.c b/app/gegl/gimpapplicator.c
index b4ee0e4..bc0e218 100644
--- a/app/gegl/gimpapplicator.c
+++ b/app/gegl/gimpapplicator.c
@@ -57,10 +57,12 @@ gimp_applicator_class_init (GimpApplicatorClass *klass)
static void
gimp_applicator_init (GimpApplicator *applicator)
{
- applicator->opacity = 1.0;
- applicator->paint_mode = GIMP_LAYER_MODE_NORMAL;
- applicator->composite_mode = GIMP_LAYER_COMPOSITE_AUTO;
- applicator->affect = GIMP_COMPONENT_MASK_ALL;
+ applicator->opacity = 1.0;
+ applicator->paint_mode = GIMP_LAYER_MODE_NORMAL;
+ applicator->blend_space = GIMP_LAYER_COLOR_SPACE_AUTO;
+ applicator->composite_space = GIMP_LAYER_COLOR_SPACE_AUTO;
+ applicator->composite_mode = GIMP_LAYER_COMPOSITE_AUTO;
+ applicator->affect = GIMP_COMPONENT_MASK_ALL;
}
static void
@@ -136,6 +138,8 @@ gimp_applicator_new (GeglNode *parent,
gimp_gegl_mode_node_set_mode (applicator->mode_node,
applicator->paint_mode,
+ applicator->blend_space,
+ applicator->composite_space,
applicator->composite_mode);
gimp_gegl_mode_node_set_opacity (applicator->mode_node,
applicator->opacity);
@@ -449,18 +453,25 @@ gimp_applicator_set_opacity (GimpApplicator *applicator,
void
gimp_applicator_set_mode (GimpApplicator *applicator,
GimpLayerMode paint_mode,
+ GimpLayerColorSpace blend_space,
+ GimpLayerColorSpace composite_space,
GimpLayerCompositeMode composite_mode)
{
g_return_if_fail (GIMP_IS_APPLICATOR (applicator));
- if (applicator->paint_mode != paint_mode ||
- applicator->composite_mode != composite_mode)
+ if (applicator->paint_mode != paint_mode ||
+ applicator->blend_space != blend_space ||
+ applicator->composite_space != composite_space ||
+ applicator->composite_mode != composite_mode)
{
- applicator->paint_mode = paint_mode;
- applicator->composite_mode = composite_mode;
+ applicator->paint_mode = paint_mode;
+ applicator->blend_space = blend_space;
+ applicator->composite_space = composite_space;
+ applicator->composite_mode = composite_mode;
gimp_gegl_mode_node_set_mode (applicator->mode_node,
- paint_mode, composite_mode);
+ paint_mode, blend_space,
+ composite_space, composite_mode);
}
}
diff --git a/app/gegl/gimpapplicator.h b/app/gegl/gimpapplicator.h
index 6d4ee5b..0f11aaa 100644
--- a/app/gegl/gimpapplicator.h
+++ b/app/gegl/gimpapplicator.h
@@ -57,6 +57,8 @@ struct _GimpApplicator
gdouble opacity;
GimpLayerMode paint_mode;
+ GimpLayerColorSpace blend_space;
+ GimpLayerColorSpace composite_space;
GimpLayerCompositeMode composite_mode;
GeglNode *mode_node;
@@ -112,7 +114,9 @@ void gimp_applicator_set_opacity (GimpApplicator *applicator,
gdouble opacity);
void gimp_applicator_set_mode (GimpApplicator *applicator,
GimpLayerMode paint_mode,
- GimpLayerCompositeMode composite_mode);
+ GimpLayerColorSpace blend_space,
+ GimpLayerColorSpace composite_space,
+ GimpLayerCompositeMode composite_mode);
void gimp_applicator_set_affect (GimpApplicator *applicator,
GimpComponentMask affect);
diff --git a/app/operations/operations-enums.c b/app/operations/operations-enums.c
index e8ccc4b..1000b87 100644
--- a/app/operations/operations-enums.c
+++ b/app/operations/operations-enums.c
@@ -13,6 +13,7 @@ gimp_layer_color_space_get_type (void)
{
static const GEnumValue values[] =
{
+ { GIMP_LAYER_COLOR_SPACE_AUTO, "GIMP_LAYER_COLOR_SPACE_AUTO", "auto" },
{ GIMP_LAYER_COLOR_SPACE_RGB_LINEAR, "GIMP_LAYER_COLOR_SPACE_RGB_LINEAR", "rgb-linear" },
{ GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL, "GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL", "rgb-perceptual" },
{ GIMP_LAYER_COLOR_SPACE_LAB, "GIMP_LAYER_COLOR_SPACE_LAB", "lab" },
@@ -21,9 +22,10 @@ gimp_layer_color_space_get_type (void)
static const GimpEnumDesc descs[] =
{
- { GIMP_LAYER_COLOR_SPACE_RGB_LINEAR, "GIMP_LAYER_COLOR_SPACE_RGB_LINEAR", NULL },
- { GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL, "GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL", NULL },
- { GIMP_LAYER_COLOR_SPACE_LAB, "GIMP_LAYER_COLOR_SPACE_LAB", NULL },
+ { GIMP_LAYER_COLOR_SPACE_AUTO, NC_("layer-color-space", "Auto"), NULL },
+ { GIMP_LAYER_COLOR_SPACE_RGB_LINEAR, NC_("layer-color-space", "RGB (linear)"), NULL },
+ { GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL, NC_("layer-color-space", "RGB (perceptual)"), NULL },
+ { GIMP_LAYER_COLOR_SPACE_LAB, NC_("layer-color-space", "LAB"), NULL },
{ 0, NULL, NULL }
};
diff --git a/app/operations/operations-enums.h b/app/operations/operations-enums.h
index 3ee565b..7d5eb92 100644
--- a/app/operations/operations-enums.h
+++ b/app/operations/operations-enums.h
@@ -27,9 +27,10 @@ GType gimp_layer_color_space_get_type (void) G_GNUC_CONST;
typedef enum /*< pdb-skip >*/
{
- GIMP_LAYER_COLOR_SPACE_RGB_LINEAR,
- GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
- GIMP_LAYER_COLOR_SPACE_LAB,
+ GIMP_LAYER_COLOR_SPACE_AUTO, /*< desc="Auto" >*/
+ GIMP_LAYER_COLOR_SPACE_RGB_LINEAR, /*< desc="RGB (linear)" >*/
+ GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL, /*< desc="RGB (perceptual)" >*/
+ GIMP_LAYER_COLOR_SPACE_LAB, /*< desc="LAB" >*/
} GimpLayerColorSpace;
diff --git a/app/paint/gimppaintcore.c b/app/paint/gimppaintcore.c
index ae75fcb..75a0adc 100644
--- a/app/paint/gimppaintcore.c
+++ b/app/paint/gimppaintcore.c
@@ -903,6 +903,8 @@ gimp_paint_core_paste (GimpPaintCore *core,
gimp_applicator_set_opacity (core->applicator, image_opacity);
gimp_applicator_set_mode (core->applicator, paint_mode,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
GIMP_LAYER_COMPOSITE_SRC_OVER);
/* apply the paint area to the image */
diff --git a/app/pdb/layer-cmds.c b/app/pdb/layer-cmds.c
index fde14a7..5eb7ed8 100644
--- a/app/pdb/layer-cmds.c
+++ b/app/pdb/layer-cmds.c
@@ -1167,7 +1167,7 @@ layer_get_composite_mode_invoker (GimpProcedure *procedure,
if (success)
{
- composite_mode = gimp_layer_get_composite (layer);
+ composite_mode = gimp_layer_get_composite_mode (layer);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
@@ -1196,7 +1196,7 @@ layer_set_composite_mode_invoker (GimpProcedure *procedure,
if (success)
{
- gimp_layer_set_composite (layer, composite_mode, TRUE);
+ gimp_layer_set_composite_mode (layer, composite_mode, TRUE);
}
return gimp_procedure_get_return_values (procedure, success,
diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c
index da75dcc..6eb769f 100644
--- a/app/tools/gimpblendtool.c
+++ b/app/tools/gimpblendtool.c
@@ -643,6 +643,8 @@ gimp_blend_tool_options_notify (GimpTool *tool,
{
gimp_drawable_filter_set_mode (blend_tool->filter,
gimp_context_get_paint_mode (context),
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
GIMP_LAYER_COMPOSITE_AUTO);
}
}
@@ -1206,6 +1208,8 @@ gimp_blend_tool_create_filter (GimpBlendTool *blend_tool,
gimp_context_get_opacity (context));
gimp_drawable_filter_set_mode (blend_tool->filter,
gimp_context_get_paint_mode (context),
+ GIMP_LAYER_COLOR_SPACE_AUTO,
+ GIMP_LAYER_COLOR_SPACE_AUTO,
GIMP_LAYER_COMPOSITE_AUTO);
g_signal_connect (blend_tool->filter, "flush",
diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c
index 1f95b70..27395e5 100644
--- a/app/xcf/xcf-load.c
+++ b/app/xcf/xcf-load.c
@@ -1100,14 +1100,39 @@ xcf_load_layer_props (XcfInfo *info,
}
break;
- case PROP_COMPOSITE:
+ case PROP_BLEND_SPACE:
{
- guint32 composite;
+ guint32 blend_space;
- info->cp += xcf_read_int32 (info->input, &composite, 1);
+ info->cp += xcf_read_int32 (info->input, &blend_space, 1);
- gimp_layer_set_composite (*layer,
- (GimpLayerCompositeMode) composite, FALSE);
+ gimp_layer_set_blend_space (*layer,
+ (GimpLayerColorSpace) blend_space,
+ FALSE);
+ }
+ break;
+
+ case PROP_COMPOSITE_SPACE:
+ {
+ guint32 composite_space;
+
+ info->cp += xcf_read_int32 (info->input, &composite_space, 1);
+
+ gimp_layer_set_composite_space (*layer,
+ (GimpLayerColorSpace) composite_space,
+ FALSE);
+ }
+ break;
+
+ case PROP_COMPOSITE_MODE:
+ {
+ guint32 composite_mode;
+
+ info->cp += xcf_read_int32 (info->input, &composite_mode, 1);
+
+ gimp_layer_set_composite_mode (*layer,
+ (GimpLayerCompositeMode) composite_mode,
+ FALSE);
}
break;
diff --git a/app/xcf/xcf-private.h b/app/xcf/xcf-private.h
index 99e4853..a2af8ad 100644
--- a/app/xcf/xcf-private.h
+++ b/app/xcf/xcf-private.h
@@ -59,7 +59,9 @@ typedef enum
PROP_LOCK_POSITION = 32,
PROP_FLOAT_OPACITY = 33,
PROP_COLOR_TAG = 34,
- PROP_COMPOSITE = 35,
+ PROP_COMPOSITE_MODE = 35,
+ PROP_COMPOSITE_SPACE = 36,
+ PROP_BLEND_SPACE = 37
} PropType;
typedef enum
diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c
index de445c6..46b408d 100644
--- a/app/xcf/xcf-save.c
+++ b/app/xcf/xcf-save.c
@@ -534,8 +534,12 @@ xcf_save_layer_props (XcfInfo *info,
offset_x, offset_y));
xcf_check_error (xcf_save_prop (info, image, PROP_MODE, error,
gimp_layer_get_mode (layer)));
- xcf_check_error (xcf_save_prop (info, image, PROP_COMPOSITE, error,
- gimp_layer_get_composite (layer)));
+ xcf_check_error (xcf_save_prop (info, image, PROP_BLEND_SPACE, error,
+ gimp_layer_get_blend_space (layer)));
+ xcf_check_error (xcf_save_prop (info, image, PROP_COMPOSITE_SPACE, error,
+ gimp_layer_get_composite_space (layer)));
+ xcf_check_error (xcf_save_prop (info, image, PROP_COMPOSITE_MODE, error,
+ gimp_layer_get_composite_mode (layer)));
xcf_check_error (xcf_save_prop (info, image, PROP_TATTOO, error,
gimp_item_get_tattoo (GIMP_ITEM (layer))));
@@ -737,16 +741,42 @@ xcf_save_prop (XcfInfo *info,
}
break;
- case PROP_COMPOSITE:
+ case PROP_BLEND_SPACE:
{
- gint32 composite;
+ gint32 blend_space;
- composite = va_arg (args, gint32);
+ blend_space = va_arg (args, gint32);
size = 4;
xcf_write_prop_type_check_error (info, prop_type);
xcf_write_int32_check_error (info, &size, 1);
- xcf_write_int32_check_error (info, (guint32 *) &composite, 1);
+ xcf_write_int32_check_error (info, (guint32 *) &blend_space, 1);
+ }
+ break;
+
+ case PROP_COMPOSITE_SPACE:
+ {
+ gint32 composite_space;
+
+ composite_space = va_arg (args, gint32);
+ size = 4;
+
+ xcf_write_prop_type_check_error (info, prop_type);
+ xcf_write_int32_check_error (info, &size, 1);
+ xcf_write_int32_check_error (info, (guint32 *) &composite_space, 1);
+ }
+ break;
+
+ case PROP_COMPOSITE_MODE:
+ {
+ gint32 composite_mode;
+
+ composite_mode = va_arg (args, gint32);
+ size = 4;
+
+ xcf_write_prop_type_check_error (info, prop_type);
+ xcf_write_int32_check_error (info, &size, 1);
+ xcf_write_int32_check_error (info, (guint32 *) &composite_mode, 1);
}
break;
diff --git a/menus/layers-menu.xml b/menus/layers-menu.xml
index 03d28e4..00759ab 100644
--- a/menus/layers-menu.xml
+++ b/menus/layers-menu.xml
@@ -5,23 +5,35 @@
<popup action="layers-popup">
<menuitem action="layers-text-tool" />
<menuitem action="layers-edit-attributes" />
- <menu action="layers-composite-menu" name="Composite">
- <menuitem action="layers-composite-auto" />
- <menuitem action="layers-composite-src-over" />
- <menuitem action="layers-composite-src-atop" />
- <menuitem action="layers-composite-src-in" />
- <menuitem action="layers-composite-dst-atop" />
+ <menu action="layers-blend-space-menu" name="Blend Space">
+ <menuitem action="layers-blend-space-auto" />
+ <menuitem action="layers-blend-space-rgb-linear" />
+ <menuitem action="layers-blend-space-rgb-perceptual" />
+ <menuitem action="layers-blend-space-lab" />
+ </menu>
+ <menu action="layers-composite-space-menu" name="Composite Space">
+ <menuitem action="layers-composite-space-auto" />
+ <menuitem action="layers-composite-space-rgb-linear" />
+ <menuitem action="layers-composite-space-rgb-perceptual" />
+ <menuitem action="layers-composite-space-lab" />
+ </menu>
+ <menu action="layers-composite-mode-menu" name="Composite Mode">
+ <menuitem action="layers-composite-mode-auto" />
+ <menuitem action="layers-composite-mode-src-over" />
+ <menuitem action="layers-composite-mode-src-atop" />
+ <menuitem action="layers-composite-mode-src-in" />
+ <menuitem action="layers-composite-mode-dst-atop" />
</menu>
<menu action="layers-color-tag-menu" name="Color Tags">
- <menuitem action="layers-color-tag-none" />
- <menuitem action="layers-color-tag-blue" />
- <menuitem action="layers-color-tag-green" />
- <menuitem action="layers-color-tag-yellow" />
- <menuitem action="layers-color-tag-orange" />
- <menuitem action="layers-color-tag-brown" />
- <menuitem action="layers-color-tag-red" />
- <menuitem action="layers-color-tag-violet" />
- <menuitem action="layers-color-tag-gray" />
+ <menuitem action="layers-color-tag-none" />
+ <menuitem action="layers-color-tag-blue" />
+ <menuitem action="layers-color-tag-green" />
+ <menuitem action="layers-color-tag-yellow" />
+ <menuitem action="layers-color-tag-orange" />
+ <menuitem action="layers-color-tag-brown" />
+ <menuitem action="layers-color-tag-red" />
+ <menuitem action="layers-color-tag-violet" />
+ <menuitem action="layers-color-tag-gray" />
</menu>
<separator />
<menuitem action="layers-new" />
diff --git a/tools/pdbgen/pdb/layer.pdb b/tools/pdbgen/pdb/layer.pdb
index e259605..7661968 100644
--- a/tools/pdbgen/pdb/layer.pdb
+++ b/tools/pdbgen/pdb/layer.pdb
@@ -1217,7 +1217,7 @@ sub layer_get_composite_mode {
%invoke = (
code => <<'CODE'
{
- composite_mode = gimp_layer_get_composite (layer);
+ composite_mode = gimp_layer_get_composite_mode (layer);
}
CODE
);
@@ -1239,7 +1239,7 @@ sub layer_set_composite_mode {
%invoke = (
code => <<'CODE'
{
- gimp_layer_set_composite (layer, composite_mode, TRUE);
+ gimp_layer_set_composite_mode (layer, composite_mode, TRUE);
}
CODE
);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]