app: add layer mode flags to mark blend and compositing modes immutable

set all legacy modes to completely immutable and the LAB modes'
blend mode to immutable. Change GimpLayer setters and the UI
accordingly. Remove the LAB color spaces from the GUI, they can
only be used with the LAB blend modes anyway and not changed.
This commit is contained in:
Michael Natterer 2017-02-13 22:12:39 +01:00
parent 9b636ff798
commit cb733efe34
7 changed files with 231 additions and 82 deletions

View File

@ -24,6 +24,8 @@
#include "actions-types.h" #include "actions-types.h"
#include "operations/layer-modes/gimp-layer-modes.h"
#include "core/gimpchannel.h" #include "core/gimpchannel.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimplayer.h" #include "core/gimplayer.h"
@ -342,11 +344,6 @@ static const GimpRadioActionEntry layers_blend_space_actions[] =
{ "layers-blend-space-rgb-perceptual", NULL, { "layers-blend-space-rgb-perceptual", NULL,
NC_("layers-action", "RGB (perceptual)"), NULL, NULL, NC_("layers-action", "RGB (perceptual)"), NULL, NULL,
GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL, GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
NULL },
{ "layers-blend-space-lab", NULL,
NC_("layers-action", "LAB"), NULL, NULL,
GIMP_LAYER_COLOR_SPACE_LAB,
NULL } NULL }
}; };
@ -365,11 +362,6 @@ static const GimpRadioActionEntry layers_composite_space_actions[] =
{ "layers-composite-space-rgb-perceptual", NULL, { "layers-composite-space-rgb-perceptual", NULL,
NC_("layers-action", "RGB (perceptual)"), NULL, NULL, NC_("layers-action", "RGB (perceptual)"), NULL, NULL,
GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL, GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL,
NULL },
{ "layers-composite-space-lab", NULL,
NC_("layers-action", "LAB"), NULL, NULL,
GIMP_LAYER_COLOR_SPACE_LAB,
NULL } NULL }
}; };
@ -751,6 +743,9 @@ layers_actions_update (GimpActionGroup *group,
gboolean writable = FALSE; gboolean writable = FALSE;
gboolean movable = FALSE; gboolean movable = FALSE;
gboolean children = FALSE; gboolean children = FALSE;
gboolean bs_mutable = FALSE;
gboolean cs_mutable = FALSE;
gboolean cm_mutable = FALSE;
GList *next = NULL; GList *next = NULL;
GList *next_visible = NULL; GList *next_visible = NULL;
GList *prev = NULL; GList *prev = NULL;
@ -766,9 +761,10 @@ layers_actions_update (GimpActionGroup *group,
if (layer) if (layer)
{ {
const gchar *action = NULL; GimpLayerMode mode = gimp_layer_get_mode (layer);
GList *layer_list; const gchar *action = NULL;
GList *list; GList *layer_list;
GList *list;
switch (gimp_layer_get_blend_space (layer)) switch (gimp_layer_get_blend_space (layer))
{ {
@ -778,11 +774,12 @@ layers_actions_update (GimpActionGroup *group,
action = "layers-blend-space-rgb-linear"; break; action = "layers-blend-space-rgb-linear"; break;
case GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL: case GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL:
action = "layers-blend-space-rgb-perceptual"; break; action = "layers-blend-space-rgb-perceptual"; break;
case GIMP_LAYER_COLOR_SPACE_LAB: default:
action = "layers-blend-space-lab"; break; action = NULL; break; /* can't happen */
} }
gimp_action_group_set_action_active (group, action, TRUE); if (action)
gimp_action_group_set_action_active (group, action, TRUE);
switch (gimp_layer_get_composite_space (layer)) switch (gimp_layer_get_composite_space (layer))
{ {
@ -792,11 +789,12 @@ layers_actions_update (GimpActionGroup *group,
action = "layers-composite-space-rgb-linear"; break; action = "layers-composite-space-rgb-linear"; break;
case GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL: case GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL:
action = "layers-composite-space-rgb-perceptual"; break; action = "layers-composite-space-rgb-perceptual"; break;
case GIMP_LAYER_COLOR_SPACE_LAB: default:
action = "layers-composite-space-lab"; break; action = NULL; break; /* can't happen */
} }
gimp_action_group_set_action_active (group, action, TRUE); if (action)
gimp_action_group_set_action_active (group, action, TRUE);
switch (gimp_layer_get_composite_mode (layer)) switch (gimp_layer_get_composite_mode (layer))
{ {
@ -814,6 +812,10 @@ layers_actions_update (GimpActionGroup *group,
gimp_action_group_set_action_active (group, action, TRUE); gimp_action_group_set_action_active (group, action, TRUE);
bs_mutable = gimp_layer_mode_is_blend_space_mutable (mode);
cs_mutable = gimp_layer_mode_is_composite_space_mutable (mode);
cm_mutable = gimp_layer_mode_is_composite_mode_mutable (mode);
mask = gimp_layer_get_mask (layer); mask = gimp_layer_get_mask (layer);
lock_alpha = gimp_layer_get_lock_alpha (layer); lock_alpha = gimp_layer_get_lock_alpha (layer);
can_lock_alpha = gimp_layer_can_lock_alpha (layer); can_lock_alpha = gimp_layer_can_lock_alpha (layer);
@ -919,21 +921,19 @@ layers_actions_update (GimpActionGroup *group,
SET_SENSITIVE ("layers-lock-alpha", can_lock_alpha); SET_SENSITIVE ("layers-lock-alpha", can_lock_alpha);
SET_ACTIVE ("layers-lock-alpha", lock_alpha); SET_ACTIVE ("layers-lock-alpha", lock_alpha);
SET_SENSITIVE ("layers-blend-space-auto", layer); SET_SENSITIVE ("layers-blend-space-auto", layer && bs_mutable);
SET_SENSITIVE ("layers-blend-space-rgb-linear", layer); SET_SENSITIVE ("layers-blend-space-rgb-linear", layer && bs_mutable);
SET_SENSITIVE ("layers-blend-space-rgb-perceptual", layer); SET_SENSITIVE ("layers-blend-space-rgb-perceptual", layer && bs_mutable);
SET_SENSITIVE ("layers-blend-space-lab", layer);
SET_SENSITIVE ("layers-composite-space-auto", layer); SET_SENSITIVE ("layers-composite-space-auto", layer && cs_mutable);
SET_SENSITIVE ("layers-composite-space-rgb-linear", layer); SET_SENSITIVE ("layers-composite-space-rgb-linear", layer && cs_mutable);
SET_SENSITIVE ("layers-composite-space-rgb-perceptual", layer); SET_SENSITIVE ("layers-composite-space-rgb-perceptual", layer && cs_mutable);
SET_SENSITIVE ("layers-composite-space-lab", layer);
SET_SENSITIVE ("layers-composite-mode-auto", layer); SET_SENSITIVE ("layers-composite-mode-auto", layer && cm_mutable);
SET_SENSITIVE ("layers-composite-mode-src-over", layer); SET_SENSITIVE ("layers-composite-mode-src-over", layer && cm_mutable);
SET_SENSITIVE ("layers-composite-mode-src-atop", layer); SET_SENSITIVE ("layers-composite-mode-src-atop", layer && cm_mutable);
SET_SENSITIVE ("layers-composite-mode-src-in", layer); SET_SENSITIVE ("layers-composite-mode-src-in", layer && cm_mutable);
SET_SENSITIVE ("layers-composite-mode-dst-atop", layer); SET_SENSITIVE ("layers-composite-mode-dst-atop", layer && cm_mutable);
SET_SENSITIVE ("layers-mask-add", layer && !fs && !ac && !mask && !children); SET_SENSITIVE ("layers-mask-add", layer && !fs && !ac && !mask && !children);
SET_SENSITIVE ("layers-mask-add-button", layer && !fs && !ac && !children); SET_SENSITIVE ("layers-mask-add-button", layer && !fs && !ac && !children);

View File

@ -31,6 +31,8 @@
#include "core-types.h" #include "core-types.h"
#include "operations/layer-modes/gimp-layer-modes.h"
#include "gegl/gimp-babl.h" #include "gegl/gimp-babl.h"
#include "gegl/gimp-gegl-apply-operation.h" #include "gegl/gimp-gegl-apply-operation.h"
#include "gegl/gimp-gegl-loops.h" #include "gegl/gimp-gegl-loops.h"
@ -2202,6 +2204,9 @@ gimp_layer_set_blend_space (GimpLayer *layer,
{ {
g_return_if_fail (GIMP_IS_LAYER (layer)); g_return_if_fail (GIMP_IS_LAYER (layer));
if (! gimp_layer_mode_is_blend_space_mutable (layer->mode))
return;
if (layer->blend_space != blend_space) if (layer->blend_space != blend_space)
{ {
if (push_undo && gimp_item_is_attached (GIMP_ITEM (layer))) if (push_undo && gimp_item_is_attached (GIMP_ITEM (layer)))
@ -2238,6 +2243,9 @@ gimp_layer_set_composite_space (GimpLayer *layer,
{ {
g_return_if_fail (GIMP_IS_LAYER (layer)); g_return_if_fail (GIMP_IS_LAYER (layer));
if (! gimp_layer_mode_is_composite_space_mutable (layer->mode))
return;
if (layer->composite_space != composite_space) if (layer->composite_space != composite_space)
{ {
if (push_undo && gimp_item_is_attached (GIMP_ITEM (layer))) if (push_undo && gimp_item_is_attached (GIMP_ITEM (layer)))
@ -2274,6 +2282,9 @@ gimp_layer_set_composite_mode (GimpLayer *layer,
{ {
g_return_if_fail (GIMP_IS_LAYER (layer)); g_return_if_fail (GIMP_IS_LAYER (layer));
if (! gimp_layer_mode_is_composite_mode_mutable (layer->mode))
return;
if (layer->composite_mode != composite_mode) if (layer->composite_mode != composite_mode)
{ {
if (push_undo && gimp_item_is_attached (GIMP_ITEM (layer))) if (push_undo && gimp_item_is_attached (GIMP_ITEM (layer)))

View File

@ -26,6 +26,8 @@
#include "dialogs-types.h" #include "dialogs-types.h"
#include "operations/layer-modes/gimp-layer-modes.h"
#include "core/gimpcontext.h" #include "core/gimpcontext.h"
#include "core/gimpdrawable-filters.h" #include "core/gimpdrawable-filters.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
@ -62,6 +64,9 @@ struct _LayerOptionsDialog
gpointer user_data; gpointer user_data;
GtkWidget *mode_box; GtkWidget *mode_box;
GtkWidget *blend_space_combo;
GtkWidget *composite_space_combo;
GtkWidget *composite_mode_combo;
GtkWidget *size_se; GtkWidget *size_se;
GtkWidget *offset_se; GtkWidget *offset_se;
}; };
@ -69,20 +74,23 @@ struct _LayerOptionsDialog
/* local function prototypes */ /* local function prototypes */
static void layer_options_dialog_free (LayerOptionsDialog *private); static void layer_options_dialog_free (LayerOptionsDialog *private);
static void layer_options_dialog_callback (GtkWidget *dialog, static void layer_options_dialog_callback (GtkWidget *dialog,
GimpImage *image, GimpImage *image,
GimpItem *item, GimpItem *item,
GimpContext *context, GimpContext *context,
const gchar *item_name, const gchar *item_name,
gboolean item_visible, gboolean item_visible,
gboolean item_linked, gboolean item_linked,
GimpColorTag item_color_tag, GimpColorTag item_color_tag,
gboolean item_lock_content, gboolean item_lock_content,
gboolean item_lock_position, gboolean item_lock_position,
gpointer user_data); gpointer user_data);
static void layer_options_dialog_toggle_rename (GtkWidget *widget, static void layer_options_dialog_mode_notify (GtkWidget *widget,
LayerOptionsDialog *private); const GParamSpec *pspec,
LayerOptionsDialog *private);
static void layer_options_dialog_rename_toggled (GtkWidget *widget,
LayerOptionsDialog *private);
/* public functions */ /* public functions */
@ -116,6 +124,7 @@ layer_options_dialog_new (GimpImage *image,
LayerOptionsDialog *private; LayerOptionsDialog *private;
GtkWidget *dialog; GtkWidget *dialog;
GtkWidget *table; GtkWidget *table;
GtkListStore *space_model;
GtkWidget *combo; GtkWidget *combo;
GtkWidget *scale; GtkWidget *scale;
GtkWidget *label; GtkWidget *label;
@ -172,7 +181,17 @@ layer_options_dialog_new (GimpImage *image,
gimp_layer_mode_box_set_mode (GIMP_LAYER_MODE_BOX (private->mode_box), gimp_layer_mode_box_set_mode (GIMP_LAYER_MODE_BOX (private->mode_box),
private->mode); private->mode);
combo = gimp_enum_combo_box_new (GIMP_TYPE_LAYER_COLOR_SPACE); g_signal_connect (private->mode_box, "notify::layer-mode",
G_CALLBACK (layer_options_dialog_mode_notify),
private);
space_model =
gimp_enum_store_new_with_range (GIMP_TYPE_LAYER_COLOR_SPACE,
GIMP_LAYER_COLOR_SPACE_AUTO,
GIMP_LAYER_COLOR_SPACE_RGB_PERCEPTUAL);
private->blend_space_combo = combo =
gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (space_model));
item_options_dialog_add_widget (dialog, _("Blend space:"), combo); item_options_dialog_add_widget (dialog, _("Blend space:"), combo);
gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (combo), gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (combo),
"gimp-layer-color-space"); "gimp-layer-color-space");
@ -181,7 +200,8 @@ layer_options_dialog_new (GimpImage *image,
G_CALLBACK (gimp_int_combo_box_get_active), G_CALLBACK (gimp_int_combo_box_get_active),
&private->blend_space); &private->blend_space);
combo = gimp_enum_combo_box_new (GIMP_TYPE_LAYER_COLOR_SPACE); private->composite_space_combo = combo =
gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (space_model));
item_options_dialog_add_widget (dialog, _("Composite space:"), combo); item_options_dialog_add_widget (dialog, _("Composite space:"), combo);
gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (combo), gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (combo),
"gimp-layer-color-space"); "gimp-layer-color-space");
@ -190,7 +210,10 @@ layer_options_dialog_new (GimpImage *image,
G_CALLBACK (gimp_int_combo_box_get_active), G_CALLBACK (gimp_int_combo_box_get_active),
&private->composite_space); &private->composite_space);
combo = gimp_enum_combo_box_new (GIMP_TYPE_LAYER_COMPOSITE_MODE); g_object_unref (space_model);
private->composite_mode_combo = combo =
gimp_enum_combo_box_new (GIMP_TYPE_LAYER_COMPOSITE_MODE);
item_options_dialog_add_widget (dialog, _("Composite mode:"), combo); item_options_dialog_add_widget (dialog, _("Composite mode:"), combo);
gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (combo), gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (combo),
"gimp-layer-composite"); "gimp-layer-composite");
@ -421,7 +444,7 @@ layer_options_dialog_new (GimpImage *image,
&private->rename_text_layers); &private->rename_text_layers);
g_signal_connect (button, "toggled", g_signal_connect (button, "toggled",
G_CALLBACK (layer_options_dialog_toggle_rename), G_CALLBACK (layer_options_dialog_rename_toggled),
private); private);
} }
@ -456,9 +479,6 @@ layer_options_dialog_callback (GtkWidget *dialog,
gint offset_x; gint offset_x;
gint offset_y; gint offset_y;
private->mode =
gimp_layer_mode_box_get_mode (GIMP_LAYER_MODE_BOX (private->mode_box));
if (private->size_se) if (private->size_se)
{ {
width = width =
@ -502,8 +522,33 @@ layer_options_dialog_callback (GtkWidget *dialog,
} }
static void static void
layer_options_dialog_toggle_rename (GtkWidget *widget, layer_options_dialog_mode_notify (GtkWidget *widget,
LayerOptionsDialog *private) const GParamSpec *pspec,
LayerOptionsDialog *private)
{
gboolean mutable;
private->mode = gimp_layer_mode_box_get_mode (GIMP_LAYER_MODE_BOX (widget));
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (private->blend_space_combo),
GIMP_LAYER_COLOR_SPACE_AUTO);
mutable = gimp_layer_mode_is_blend_space_mutable (private->mode);
gtk_widget_set_sensitive (private->blend_space_combo, mutable);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (private->composite_space_combo),
GIMP_LAYER_COLOR_SPACE_AUTO);
mutable = gimp_layer_mode_is_composite_space_mutable (private->mode);
gtk_widget_set_sensitive (private->composite_space_combo, mutable);
gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (private->composite_mode_combo),
GIMP_LAYER_COMPOSITE_AUTO);
mutable = gimp_layer_mode_is_composite_mode_mutable (private->mode);
gtk_widget_set_sensitive (private->composite_mode_combo, mutable);
}
static void
layer_options_dialog_rename_toggled (GtkWidget *widget,
LayerOptionsDialog *private)
{ {
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)) && if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)) &&
gimp_item_is_text_layer (GIMP_ITEM (private->layer))) gimp_item_is_text_layer (GIMP_ITEM (private->layer)))

View File

@ -65,115 +65,172 @@ static const GimpLayerModeInfo layer_mode_infos[]=
{ GIMP_LAYER_MODE_MULTIPLY_LEGACY, { GIMP_LAYER_MODE_MULTIPLY_LEGACY,
"gimp:multiply-legacy", "gimp:multiply-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
{ GIMP_LAYER_MODE_SCREEN_LEGACY, { GIMP_LAYER_MODE_SCREEN_LEGACY,
"gimp:screen-legacy", "gimp:screen-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
{ GIMP_LAYER_MODE_OVERLAY_LEGACY, { GIMP_LAYER_MODE_OVERLAY_LEGACY,
"gimp:overlay-legacy", "gimp:overlay-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
{ GIMP_LAYER_MODE_DIFFERENCE_LEGACY, { GIMP_LAYER_MODE_DIFFERENCE_LEGACY,
"gimp:difference-legacy", "gimp:difference-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
{ GIMP_LAYER_MODE_ADDITION_LEGACY, { GIMP_LAYER_MODE_ADDITION_LEGACY,
"gimp:addition-legacy", "gimp:addition-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
{ GIMP_LAYER_MODE_SUBTRACT_LEGACY, { GIMP_LAYER_MODE_SUBTRACT_LEGACY,
"gimp:subtract-legacy", "gimp:subtract-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
{ GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY, { GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY,
"gimp:darken-only-legacy", "gimp:darken-only-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
{ GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY, { GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY,
"gimp:lighten-only-legacy", "gimp:lighten-only-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
{ GIMP_LAYER_MODE_HSV_HUE_LEGACY, { GIMP_LAYER_MODE_HSV_HUE_LEGACY,
"gimp:hsv-hue-legacy", "gimp:hsv-hue-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
{ GIMP_LAYER_MODE_HSV_SATURATION_LEGACY, { GIMP_LAYER_MODE_HSV_SATURATION_LEGACY,
"gimp:hsv-saturation-legacy", "gimp:hsv-saturation-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
{ GIMP_LAYER_MODE_HSV_COLOR_LEGACY, { GIMP_LAYER_MODE_HSV_COLOR_LEGACY,
"gimp:hsv-color-legacy", "gimp:hsv-color-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
{ GIMP_LAYER_MODE_HSV_VALUE_LEGACY, { GIMP_LAYER_MODE_HSV_VALUE_LEGACY,
"gimp:hsv-value-legacy", "gimp:hsv-value-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
{ GIMP_LAYER_MODE_DIVIDE_LEGACY, { GIMP_LAYER_MODE_DIVIDE_LEGACY,
"gimp:divide-legacy", "gimp:divide-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
{ GIMP_LAYER_MODE_DODGE_LEGACY, { GIMP_LAYER_MODE_DODGE_LEGACY,
"gimp:dodge-legacy", "gimp:dodge-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
{ GIMP_LAYER_MODE_BURN_LEGACY, { GIMP_LAYER_MODE_BURN_LEGACY,
"gimp:burn-legacy", "gimp:burn-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
{ GIMP_LAYER_MODE_HARDLIGHT_LEGACY, { GIMP_LAYER_MODE_HARDLIGHT_LEGACY,
"gimp:hardlight-legacy", "gimp:hardlight-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
{ GIMP_LAYER_MODE_SOFTLIGHT_LEGACY, { GIMP_LAYER_MODE_SOFTLIGHT_LEGACY,
"gimp:softlight-legacy", "gimp:softlight-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
{ GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY, { GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY,
"gimp:grain-extract-legacy", "gimp:grain-extract-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
{ GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY, { GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY,
"gimp:grain-merge-legacy", "gimp:grain-merge-legacy",
GIMP_LAYER_MODE_FLAG_LEGACY, GIMP_LAYER_MODE_FLAG_LEGACY |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE |
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
}, },
@ -193,7 +250,8 @@ static const GimpLayerModeInfo layer_mode_infos[]=
{ GIMP_LAYER_MODE_LCH_HUE, { GIMP_LAYER_MODE_LCH_HUE,
"gimp:layer-mode", "gimp:layer-mode",
GIMP_LAYER_MODE_FLAG_WANTS_LINEAR_DATA, GIMP_LAYER_MODE_FLAG_WANTS_LINEAR_DATA |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
GIMP_LAYER_COLOR_SPACE_RGB_LINEAR, GIMP_LAYER_COLOR_SPACE_RGB_LINEAR,
GIMP_LAYER_COLOR_SPACE_LAB GIMP_LAYER_COLOR_SPACE_LAB
@ -201,7 +259,8 @@ static const GimpLayerModeInfo layer_mode_infos[]=
{ GIMP_LAYER_MODE_LCH_CHROMA, { GIMP_LAYER_MODE_LCH_CHROMA,
"gimp:layer-mode", "gimp:layer-mode",
GIMP_LAYER_MODE_FLAG_WANTS_LINEAR_DATA, GIMP_LAYER_MODE_FLAG_WANTS_LINEAR_DATA |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
GIMP_LAYER_COLOR_SPACE_RGB_LINEAR, GIMP_LAYER_COLOR_SPACE_RGB_LINEAR,
GIMP_LAYER_COLOR_SPACE_LAB GIMP_LAYER_COLOR_SPACE_LAB
@ -209,7 +268,8 @@ static const GimpLayerModeInfo layer_mode_infos[]=
{ GIMP_LAYER_MODE_LCH_COLOR, { GIMP_LAYER_MODE_LCH_COLOR,
"gimp:layer-mode", "gimp:layer-mode",
GIMP_LAYER_MODE_FLAG_WANTS_LINEAR_DATA, GIMP_LAYER_MODE_FLAG_WANTS_LINEAR_DATA |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
GIMP_LAYER_COLOR_SPACE_RGB_LINEAR, GIMP_LAYER_COLOR_SPACE_RGB_LINEAR,
GIMP_LAYER_COLOR_SPACE_LAB GIMP_LAYER_COLOR_SPACE_LAB
@ -217,7 +277,8 @@ static const GimpLayerModeInfo layer_mode_infos[]=
{ GIMP_LAYER_MODE_LCH_LIGHTNESS, { GIMP_LAYER_MODE_LCH_LIGHTNESS,
"gimp:layer-mode", "gimp:layer-mode",
GIMP_LAYER_MODE_FLAG_WANTS_LINEAR_DATA, GIMP_LAYER_MODE_FLAG_WANTS_LINEAR_DATA |
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE,
GIMP_LAYER_COMPOSITE_SRC_ATOP, GIMP_LAYER_COMPOSITE_SRC_ATOP,
GIMP_LAYER_COLOR_SPACE_RGB_LINEAR, GIMP_LAYER_COLOR_SPACE_RGB_LINEAR,
GIMP_LAYER_COLOR_SPACE_LAB GIMP_LAYER_COLOR_SPACE_LAB
@ -1020,6 +1081,33 @@ gimp_layer_mode_wants_linear_data (GimpLayerMode mode)
return (info->flags & GIMP_LAYER_MODE_FLAG_WANTS_LINEAR_DATA) != 0; return (info->flags & GIMP_LAYER_MODE_FLAG_WANTS_LINEAR_DATA) != 0;
} }
gboolean
gimp_layer_mode_is_blend_space_mutable (GimpLayerMode mode)
{
const GimpLayerModeInfo *info = gimp_layer_mode_info (mode);
if (!info)
return FALSE;
return (info->flags & GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE) == 0;
}
gboolean
gimp_layer_mode_is_composite_space_mutable (GimpLayerMode mode)
{
const GimpLayerModeInfo *info = gimp_layer_mode_info (mode);
if (!info)
return FALSE;
return (info->flags & GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE) == 0;
}
gboolean
gimp_layer_mode_is_composite_mode_mutable (GimpLayerMode mode)
{
const GimpLayerModeInfo *info = gimp_layer_mode_info (mode);
if (!info)
return FALSE;
return (info->flags & GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE) == 0;
}
GimpLayerColorSpace GimpLayerColorSpace
gimp_layer_mode_get_blend_space (GimpLayerMode mode) gimp_layer_mode_get_blend_space (GimpLayerMode mode)
{ {

View File

@ -28,6 +28,10 @@ void gimp_layer_modes_init (void);
gboolean gimp_layer_mode_is_legacy (GimpLayerMode mode); gboolean gimp_layer_mode_is_legacy (GimpLayerMode mode);
gboolean gimp_layer_mode_wants_linear_data (GimpLayerMode mode); gboolean gimp_layer_mode_wants_linear_data (GimpLayerMode mode);
gboolean gimp_layer_mode_is_blend_space_mutable (GimpLayerMode mode);
gboolean gimp_layer_mode_is_composite_space_mutable (GimpLayerMode mode);
gboolean gimp_layer_mode_is_composite_mode_mutable (GimpLayerMode mode);
GimpLayerColorSpace gimp_layer_mode_get_blend_space (GimpLayerMode mode); GimpLayerColorSpace gimp_layer_mode_get_blend_space (GimpLayerMode mode);
GimpLayerColorSpace gimp_layer_mode_get_composite_space (GimpLayerMode mode); GimpLayerColorSpace gimp_layer_mode_get_composite_space (GimpLayerMode mode);
GimpLayerCompositeMode gimp_layer_mode_get_composite_mode (GimpLayerMode mode); GimpLayerCompositeMode gimp_layer_mode_get_composite_mode (GimpLayerMode mode);

View File

@ -170,8 +170,11 @@ typedef enum /*< pdb-skip, skip >*/
typedef enum /*< pdb-skip, skip >*/ typedef enum /*< pdb-skip, skip >*/
{ {
GIMP_LAYER_MODE_FLAG_LEGACY = 1 << 0, GIMP_LAYER_MODE_FLAG_LEGACY = 1 << 0,
GIMP_LAYER_MODE_FLAG_WANTS_LINEAR_DATA = 1 << 1 GIMP_LAYER_MODE_FLAG_WANTS_LINEAR_DATA = 1 << 1,
GIMP_LAYER_MODE_FLAG_BLEND_SPACE_IMMUTABLE = 1 << 2,
GIMP_LAYER_MODE_FLAG_COMPOSITE_SPACE_IMMUTABLE = 1 << 3,
GIMP_LAYER_MODE_FLAG_COMPOSITE_MODE_IMMUTABLE = 1 << 4,
} GimpLayerModeFlags; } GimpLayerModeFlags;

View File

@ -9,13 +9,11 @@
<menuitem action="layers-blend-space-auto" /> <menuitem action="layers-blend-space-auto" />
<menuitem action="layers-blend-space-rgb-linear" /> <menuitem action="layers-blend-space-rgb-linear" />
<menuitem action="layers-blend-space-rgb-perceptual" /> <menuitem action="layers-blend-space-rgb-perceptual" />
<menuitem action="layers-blend-space-lab" />
</menu> </menu>
<menu action="layers-composite-space-menu" name="Composite Space"> <menu action="layers-composite-space-menu" name="Composite Space">
<menuitem action="layers-composite-space-auto" /> <menuitem action="layers-composite-space-auto" />
<menuitem action="layers-composite-space-rgb-linear" /> <menuitem action="layers-composite-space-rgb-linear" />
<menuitem action="layers-composite-space-rgb-perceptual" /> <menuitem action="layers-composite-space-rgb-perceptual" />
<menuitem action="layers-composite-space-lab" />
</menu> </menu>
<menu action="layers-composite-mode-menu" name="Composite Mode"> <menu action="layers-composite-mode-menu" name="Composite Mode">
<menuitem action="layers-composite-mode-auto" /> <menuitem action="layers-composite-mode-auto" />