mirror of https://github.com/GNOME/gimp.git
app: make "Alpha to Selection" multi-layer aware.
Allows to select several layers and have their alpha channel to replace the selection, or substract from it, etc.
This commit is contained in:
parent
2dcd38c586
commit
645d80123a
|
@ -1094,10 +1094,10 @@ layers_actions_update (GimpActionGroup *group,
|
|||
SET_SENSITIVE ("layers-mask-selection-subtract", layer && !fs && !ac && mask);
|
||||
SET_SENSITIVE ("layers-mask-selection-intersect", layer && !fs && !ac && mask);
|
||||
|
||||
SET_SENSITIVE ("layers-alpha-selection-replace", layer && !fs && !ac);
|
||||
SET_SENSITIVE ("layers-alpha-selection-add", layer && !fs && !ac);
|
||||
SET_SENSITIVE ("layers-alpha-selection-subtract", layer && !fs && !ac);
|
||||
SET_SENSITIVE ("layers-alpha-selection-intersect", layer && !fs && !ac);
|
||||
SET_SENSITIVE ("layers-alpha-selection-replace", n_layers > 0 && !fs && !ac);
|
||||
SET_SENSITIVE ("layers-alpha-selection-add", n_layers > 0 && !fs && !ac);
|
||||
SET_SENSITIVE ("layers-alpha-selection-subtract", n_layers > 0 && !fs && !ac);
|
||||
SET_SENSITIVE ("layers-alpha-selection-intersect", n_layers > 0 && !fs && !ac);
|
||||
|
||||
#undef SET_VISIBLE
|
||||
#undef SET_SENSITIVE
|
||||
|
|
|
@ -1555,14 +1555,23 @@ layers_alpha_to_selection_cmd_callback (GimpAction *action,
|
|||
gpointer data)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpLayer *layer;
|
||||
GList *layers;
|
||||
GList *iter;
|
||||
GimpChannelOps operation;
|
||||
return_if_no_layer (image, layer, data);
|
||||
return_if_no_layers (image, layers, data);
|
||||
|
||||
operation = (GimpChannelOps) g_variant_get_int32 (value);
|
||||
|
||||
gimp_item_to_selection (GIMP_ITEM (layer), operation,
|
||||
TRUE, FALSE, 0.0, 0.0);
|
||||
for (iter = layers; iter; iter = iter->next)
|
||||
{
|
||||
if (operation != GIMP_CHANNEL_OP_REPLACE || iter == layers)
|
||||
gimp_item_to_selection (GIMP_ITEM (iter->data), operation,
|
||||
TRUE, FALSE, 0.0, 0.0);
|
||||
else
|
||||
gimp_item_to_selection (GIMP_ITEM (iter->data),
|
||||
GIMP_CHANNEL_OP_ADD,
|
||||
TRUE, FALSE, 0.0, 0.0);
|
||||
}
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue