Commit 2a96d598 authored by Michael Natterer's avatar Michael Natterer 😴

app: add internal and PDB API and UI to control a layer's composite mode

Largely based on a patch by Ell, with the enum type renamed and
various small changes. Adds another axis of configurability to the
existing layer mode madness, and is WIP too.
parent a18dcb94
......@@ -50,6 +50,10 @@ 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,
NULL },
{ "layers-color-tag-menu", GIMP_STOCK_CLOSE /* abused */,
NC_("layers-action", "Color Tag"), NULL, NULL, NULL,
GIMP_HELP_LAYER_COLOR_TAG },
......@@ -315,6 +319,34 @@ static const GimpToggleActionEntry layers_toggle_actions[] =
GIMP_HELP_LAYER_LOCK_ALPHA },
};
static const GimpRadioActionEntry layers_composite_actions[] =
{
{ "layers-composite-auto", NULL,
NC_("layers-action", "Auto"), NULL, NULL,
GIMP_LAYER_COMPOSITE_AUTO,
NULL },
{ "layers-composite-src-over", NULL,
NC_("layers-action", "Source over"), NULL, NULL,
GIMP_LAYER_COMPOSITE_SRC_OVER,
NULL },
{ "layers-composite-src-atop", NULL,
NC_("layers-action", "Source atop"), NULL, NULL,
GIMP_LAYER_COMPOSITE_SRC_ATOP,
NULL },
{ "layers-composite-src-in", NULL,
NC_("layers-action", "Source in"), NULL, NULL,
GIMP_LAYER_COMPOSITE_SRC_IN,
NULL },
{ "layers-composite-dst-atop", NULL,
NC_("layers-action", "Destination atop"), NULL, NULL,
GIMP_LAYER_COMPOSITE_DST_ATOP,
NULL }
};
static const GimpEnumActionEntry layers_color_tag_actions[] =
{
{ "layers-color-tag-none", GIMP_STOCK_CLOSE /* abused */,
......@@ -582,6 +614,12 @@ layers_actions_setup (GimpActionGroup *group)
layers_toggle_actions,
G_N_ELEMENTS (layers_toggle_actions));
gimp_action_group_add_radio_actions (group, "layers-action",
layers_composite_actions,
G_N_ELEMENTS (layers_composite_actions),
NULL, 0,
G_CALLBACK (layers_composite_cmd_callback));
gimp_action_group_add_enum_actions (group, "layers-action",
layers_color_tag_actions,
G_N_ELEMENTS (layers_color_tag_actions),
......@@ -662,8 +700,25 @@ layers_actions_update (GimpActionGroup *group,
if (layer)
{
GList *layer_list;
GList *list;
const gchar *action = NULL;
GList *layer_list;
GList *list;
switch (gimp_layer_get_composite (layer))
{
case GIMP_LAYER_COMPOSITE_AUTO:
action = "layers-composite-auto"; break;
case GIMP_LAYER_COMPOSITE_SRC_OVER:
action = "layers-composite-src-over"; break;
case GIMP_LAYER_COMPOSITE_SRC_ATOP:
action = "layers-composite-src-atop"; break;
case GIMP_LAYER_COMPOSITE_SRC_IN:
action = "layers-composite-src-in"; break;
case GIMP_LAYER_COMPOSITE_DST_ATOP:
action = "layers-composite-dst-atop"; break;
}
gimp_action_group_set_action_active (group, action, TRUE);
mask = gimp_layer_get_mask (layer);
lock_alpha = gimp_layer_get_lock_alpha (layer);
......@@ -770,6 +825,12 @@ 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-mask-add", layer && !fs && !ac && !mask && !children);
SET_SENSITIVE ("layers-mask-add-button", layer && !fs && !ac && !children);
SET_SENSITIVE ("layers-mask-add-last-values", layer && !fs && !ac && !mask && !children);
......
......@@ -42,6 +42,7 @@
#include "core/gimpimage-undo.h"
#include "core/gimpimage-undo-push.h"
#include "core/gimpitemundo.h"
#include "core/gimplayerpropundo.h"
#include "core/gimplayer-floating-selection.h"
#include "core/gimplayer-new.h"
#include "core/gimppickable.h"
......@@ -119,6 +120,7 @@ static void layers_new_callback (GtkWidget *dialog,
GimpContext *context,
const gchar *layer_name,
GimpLayerMode layer_mode,
GimpLayerCompositeMode layer_composite,
gdouble layer_opacity,
GimpFillType layer_fill_type,
gint layer_width,
......@@ -139,6 +141,7 @@ static void layers_edit_attributes_callback (GtkWidget *dialog,
GimpContext *context,
const gchar *layer_name,
GimpLayerMode layer_mode,
GimpLayerCompositeMode layer_composite,
gdouble layer_opacity,
GimpFillType layer_fill_type,
gint layer_width,
......@@ -259,6 +262,7 @@ 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_opacity (layer),
0 /* unused */,
gimp_item_get_visible (item),
......@@ -325,6 +329,7 @@ layers_new_cmd_callback (GtkAction *action,
GIMP_HELP_LAYER_NEW,
config->layer_new_name,
config->layer_new_mode,
config->layer_new_composite_mode,
config->layer_new_opacity,
config->layer_new_fill_type,
TRUE,
......@@ -1133,6 +1138,34 @@ layers_mode_cmd_callback (GtkAction *action,
gimp_image_flush (image);
}
void
layers_composite_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data)
{
GimpImage *image;
GimpLayer *layer;
GimpLayerCompositeMode composite;
return_if_no_layer (image, layer, data);
composite = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
if (composite != gimp_layer_get_composite (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 (layer, composite, push_undo);
gimp_image_flush (image);
}
}
void
layers_visible_cmd_callback (GtkAction *action,
gpointer data)
......@@ -1221,34 +1254,36 @@ layers_color_tag_cmd_callback (GtkAction *action,
/* private functions */
static void
layers_new_callback (GtkWidget *dialog,
GimpImage *image,
GimpLayer *layer,
GimpContext *context,
const gchar *layer_name,
GimpLayerMode layer_mode,
gdouble layer_opacity,
GimpFillType layer_fill_type,
gint layer_width,
gint layer_height,
gint layer_offset_x,
gint layer_offset_y,
gboolean layer_visible,
gboolean layer_linked,
GimpColorTag layer_color_tag,
gboolean layer_lock_pixels,
gboolean layer_lock_position,
gboolean layer_lock_alpha,
gboolean rename_text_layer, /* unused */
gpointer user_data)
layers_new_callback (GtkWidget *dialog,
GimpImage *image,
GimpLayer *layer,
GimpContext *context,
const gchar *layer_name,
GimpLayerMode layer_mode,
GimpLayerCompositeMode layer_composite,
gdouble layer_opacity,
GimpFillType layer_fill_type,
gint layer_width,
gint layer_height,
gint layer_offset_x,
gint layer_offset_y,
gboolean layer_visible,
gboolean layer_linked,
GimpColorTag layer_color_tag,
gboolean layer_lock_pixels,
gboolean layer_lock_position,
gboolean layer_lock_alpha,
gboolean rename_text_layer, /* unused */
gpointer user_data)
{
GimpDialogConfig *config = GIMP_DIALOG_CONFIG (image->gimp->config);
g_object_set (config,
"layer-new-name", layer_name,
"layer-new-mode", layer_mode,
"layer-new-opacity", layer_opacity,
"layer-new-fill-type", layer_fill_type,
"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,
NULL);
layer = gimp_layer_new (image, layer_width, layer_height,
......@@ -1270,6 +1305,7 @@ 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_image_add_layer (image, layer,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
......@@ -1284,31 +1320,33 @@ layers_new_callback (GtkWidget *dialog,
}
static void
layers_edit_attributes_callback (GtkWidget *dialog,
GimpImage *image,
GimpLayer *layer,
GimpContext *context,
const gchar *layer_name,
GimpLayerMode layer_mode,
gdouble layer_opacity,
GimpFillType unused1,
gint unused2,
gint unused3,
gint layer_offset_x,
gint layer_offset_y,
gboolean layer_visible,
gboolean layer_linked,
GimpColorTag layer_color_tag,
gboolean layer_lock_pixels,
gboolean layer_lock_position,
gboolean layer_lock_alpha,
gboolean rename_text_layer,
gpointer user_data)
layers_edit_attributes_callback (GtkWidget *dialog,
GimpImage *image,
GimpLayer *layer,
GimpContext *context,
const gchar *layer_name,
GimpLayerMode layer_mode,
GimpLayerCompositeMode layer_composite,
gdouble layer_opacity,
GimpFillType unused1,
gint unused2,
gint unused3,
gint layer_offset_x,
gint layer_offset_y,
gboolean layer_visible,
gboolean layer_linked,
GimpColorTag layer_color_tag,
gboolean layer_lock_pixels,
gboolean layer_lock_position,
gboolean layer_lock_alpha,
gboolean rename_text_layer,
gpointer user_data)
{
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) ||
......@@ -1339,6 +1377,9 @@ 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_opacity != gimp_layer_get_opacity (layer))
gimp_layer_set_opacity (layer, layer_opacity, TRUE);
......
......@@ -106,6 +106,9 @@ 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,
GtkAction *current,
gpointer data);
void layers_visible_cmd_callback (GtkAction *action,
gpointer data);
......
......@@ -21,6 +21,7 @@
#ifndef __GIMP_CORE_CONFIG_H__
#define __GIMP_CORE_CONFIG_H__
#include "operations/operations-enums.h"
#include "core/core-enums.h"
#include "config/gimpgeglconfig.h"
......
......@@ -68,6 +68,7 @@ enum
PROP_LAYER_NEW_NAME,
PROP_LAYER_NEW_MODE,
PROP_LAYER_NEW_COMPOSITE_MODE,
PROP_LAYER_NEW_OPACITY,
PROP_LAYER_NEW_FILL_TYPE,
......@@ -302,6 +303,14 @@ gimp_dialog_config_class_init (GimpDialogConfigClass *klass)
GIMP_LAYER_MODE_NORMAL,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_ENUM (object_class, PROP_LAYER_NEW_COMPOSITE_MODE,
"layer-new-composite-mode",
"Default new layer composite mode",
LAYER_NEW_COMPOSITE_MODE_BLURB,
GIMP_TYPE_LAYER_COMPOSITE_MODE,
GIMP_LAYER_COMPOSITE_AUTO,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_LAYER_NEW_OPACITY,
"layer-new-opacity",
"Default new layer opacity",
......@@ -640,6 +649,9 @@ 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_COMPOSITE_MODE:
config->layer_new_composite_mode = g_value_get_enum (value);
break;
case PROP_LAYER_NEW_OPACITY:
config->layer_new_opacity = g_value_get_double (value);
break;
......@@ -820,6 +832,9 @@ 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_COMPOSITE_MODE:
g_value_set_enum (value, config->layer_new_composite_mode);
break;
case PROP_LAYER_NEW_OPACITY:
g_value_set_double (value, config->layer_new_opacity);
break;
......
......@@ -66,6 +66,7 @@ struct _GimpDialogConfig
gchar *layer_new_name;
GimpLayerMode layer_new_mode;
GimpLayerCompositeMode layer_new_composite_mode;
gdouble layer_new_opacity;
GimpFillType layer_new_fill_type;
......
......@@ -482,6 +482,9 @@ _("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_COMPOSITE_MODE_BLURB \
_("Sets the default composite mode for the 'New Layer' dialog.")
#define LAYER_NEW_OPACITY_BLURB \
_("Sets the default opacity for the 'New Layer' dialog.")
......
......@@ -623,6 +623,7 @@ 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_COMPOSITE_AUTO,
NULL, x, y);
g_object_unref (buffer);
......@@ -661,6 +662,7 @@ gimp_edit_fade (GimpImage *image,
gimp_object_get_name (undo),
gimp_context_get_opacity (context),
gimp_context_get_paint_mode (context),
GIMP_LAYER_COMPOSITE_AUTO,
NULL, undo->x, undo->y);
g_object_unref (buffer);
......
......@@ -164,6 +164,7 @@ static void gimp_channel_apply_buffer (GimpDrawable *drawable,
const gchar *undo_desc,
gdouble opacity,
GimpLayerMode mode,
GimpLayerCompositeMode composite,
GeglBuffer *base_buffer,
gint base_x,
gint base_y);
......@@ -1007,23 +1008,24 @@ gimp_channel_get_active_mask (GimpDrawable *drawable)
}
static void
gimp_channel_apply_buffer (GimpDrawable *drawable,
GeglBuffer *buffer,
const GeglRectangle *buffer_region,
gboolean push_undo,
const gchar *undo_desc,
gdouble opacity,
GimpLayerMode mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y)
gimp_channel_apply_buffer (GimpDrawable *drawable,
GeglBuffer *buffer,
const GeglRectangle *buffer_region,
gboolean push_undo,
const gchar *undo_desc,
gdouble opacity,
GimpLayerMode mode,
GimpLayerCompositeMode composite,
GeglBuffer *base_buffer,
gint base_x,
gint base_y)
{
gimp_drawable_invalidate_boundary (drawable);
GIMP_DRAWABLE_CLASS (parent_class)->apply_buffer (drawable, buffer,
buffer_region,
push_undo, undo_desc,
opacity, mode,
opacity, mode, composite,
base_buffer,
base_x, base_y);
......
......@@ -148,7 +148,7 @@ 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,
opacity, paint_mode, GIMP_LAYER_COMPOSITE_AUTO,
NULL, x, y);
gimp_drawable_update (drawable, x, y, width, height);
......
......@@ -180,6 +180,7 @@ 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_COMPOSITE_AUTO,
NULL, x, y);
g_object_unref (buffer);
......
......@@ -40,16 +40,17 @@
void
gimp_drawable_real_apply_buffer (GimpDrawable *drawable,
GeglBuffer *buffer,
const GeglRectangle *buffer_region,
gboolean push_undo,
const gchar *undo_desc,
gdouble opacity,
GimpLayerMode mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y)
gimp_drawable_real_apply_buffer (GimpDrawable *drawable,
GeglBuffer *buffer,
const GeglRectangle *buffer_region,
gboolean push_undo,
const gchar *undo_desc,
gdouble opacity,
GimpLayerMode mode,
GimpLayerCompositeMode composite,
GeglBuffer *base_buffer,
gint base_x,
gint base_y)
{
GimpItem *item = GIMP_ITEM (drawable);
GimpImage *image = gimp_item_get_image (item);
......@@ -102,8 +103,9 @@ gimp_drawable_real_apply_buffer (GimpDrawable *drawable,
if (undo)
{
undo->paint_mode = mode;
undo->opacity = opacity;
undo->paint_mode = mode;
undo->composite_mode = composite;
undo->opacity = opacity;
undo->applied_buffer =
gegl_buffer_new (GEGL_RECTANGLE (0, 0, width, height),
......@@ -141,7 +143,7 @@ gimp_drawable_real_apply_buffer (GimpDrawable *drawable,
base_y - buffer_region->y);
gimp_applicator_set_opacity (applicator, opacity);
gimp_applicator_set_mode (applicator, mode);
gimp_applicator_set_mode (applicator, mode, composite);
gimp_applicator_set_affect (applicator,
gimp_drawable_get_active_mask (drawable));
......
......@@ -21,26 +21,27 @@
/* virtual functions of GimpDrawable, don't call directly */
void gimp_drawable_real_apply_buffer (GimpDrawable *drawable,
GeglBuffer *buffer,
const GeglRectangle *buffer_region,
gboolean push_undo,
const gchar *undo_desc,
gdouble opacity,
GimpLayerMode mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y);
void gimp_drawable_real_replace_buffer (GimpDrawable *drawable,
GeglBuffer *buffer,
const GeglRectangle *buffer_region,
gboolean push_undo,
const gchar *undo_desc,
gdouble opacity,
GeglBuffer *mask,
const GeglRectangle *mask_region,
gint x,
gint y);
void gimp_drawable_real_apply_buffer (GimpDrawable *drawable,
GeglBuffer *buffer,
const GeglRectangle *buffer_region,
gboolean push_undo,
const gchar *undo_desc,
gdouble opacity,
GimpLayerMode mode,
GimpLayerCompositeMode composite,
GeglBuffer *base_buffer,
gint base_x,
gint base_y);
void gimp_drawable_real_replace_buffer (GimpDrawable *drawable,
GeglBuffer *buffer,
const GeglRectangle *buffer_region,
gboolean push_undo,
const gchar *undo_desc,
gdouble opacity,
GeglBuffer *mask,
const GeglRectangle *mask_region,
gint x,
gint y);
#endif /* __GIMP_DRAWABLE_COMBINE_H__ */
......@@ -256,6 +256,7 @@ 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_COMPOSITE_AUTO,
NULL, x, y);
g_object_unref (buffer);
......
......@@ -304,7 +304,8 @@ gimp_drawable_sync_fs_filter (GimpDrawable *drawable)
gimp_applicator_set_opacity (private->fs_applicator,
gimp_layer_get_opacity (fs));
gimp_applicator_set_mode (private->fs_applicator,
gimp_layer_get_mode (fs));
gimp_layer_get_mode (fs),
gimp_layer_get_composite (fs));
gimp_applicator_set_affect (private->fs_applicator,
gimp_drawable_get_active_mask (drawable));
}
......
......@@ -103,6 +103,7 @@ gimp_drawable_merge_shadow_buffer (GimpDrawable *drawable,
push_undo, undo_desc,
GIMP_OPACITY_OPAQUE,
GIMP_LAYER_MODE_REPLACE,
GIMP_LAYER_COMPOSITE_AUTO,
NULL, x, y);
g_object_unref (buffer);
......
......@@ -1097,16 +1097,17 @@ gimp_drawable_convert_type (GimpDrawable *drawable,
}
void
gimp_drawable_apply_buffer (GimpDrawable *drawable,
GeglBuffer *buffer,
const GeglRectangle *buffer_region,
gboolean push_undo,
const gchar *undo_desc,
gdouble opacity,
GimpLayerMode mode,
GeglBuffer *base_buffer,
gint base_x,
gint base_y)
gimp_drawable_apply_buffer (GimpDrawable *drawable,
GeglBuffer *buffer,
const GeglRectangle *buffer_region,
gboolean push_undo,
const gchar *undo_desc,
gdouble opacity,
GimpLayerMode mode,
GimpLayerCompositeMode composite,
GeglBuffer *base_buffer,
gint base_x,
gint base_y)
{
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
......@@ -1117,7 +1118,7 @@ gimp_drawable_apply_buffer (GimpDrawable *drawable,
GIMP_DRAWABLE_GET_CLASS (drawable)->apply_buffer (drawable, buffer,
buffer_region,
push_undo, undo_desc,
opacity, mode,
opacity, mode, composite,
base_buffer,
base_x, base_y);
}
......
......@@ -76,6 +76,7 @@ struct _GimpDrawableClass
const gchar *undo_desc,
gdouble opacity,
GimpLayerMode mode,
GimpLayerCompositeMode composite,
GeglBuffer *base_buffer,
gint base_x,
gint base_y);
......@@ -156,6 +157,7 @@ void gimp_drawable_apply_buffer (GimpDrawable *drawable,
const gchar *undo_desc,
gdouble opacity,
GimpLayerMode mode,
GimpLayerCompositeMode composite,
GeglBuffer *base_buffer,
gint base_x,
gint base_y);
......
......@@ -57,29 +57,30 @@ enum
struct _GimpDrawableFilter
{
GimpFilter parent_instance;
GimpDrawable *drawable;
GeglNode *operation;
GimpFilterRegion region;
gboolean preview_enabled;
GimpAlignmentType preview_alignment;
gdouble preview_position;
gdouble opacity;
GimpLayerMode paint_mode;
gboolean color_managed;
gboolean gamma_hack;
GeglRectangle filter_area;
GeglNode *translate;
GeglNode *crop;
GeglNode *cast_before;
GeglNode *transform_before;
GeglNode *transform_after;
GeglNode *cast_after;
GimpApplicator *applicator;
GimpFilter parent_instance;
GimpDrawable *drawable;
GeglNode *operation;
GimpFilterRegion region;
gboolean preview_enabled;
GimpAlignmentType preview_alignment;
gdouble preview_position;
gdouble opacity;
GimpLayerMode paint_mode;
GimpLayerCompositeMode composite_mode;
gboolean color_managed;
gboolean gamma_hack;
GeglRectangle filter_area;
GeglNode *translate;
GeglNode *crop;
GeglNode *cast_before;
GeglNode *transform_before;
GeglNode *transform_after;
GeglNode *cast_after;
GimpApplicator *applicator;
};
......@@ -149,6 +150,7 @@ 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->composite_mode = GIMP_LAYER_COMPOSITE_AUTO;
}
static void
......@@ -329,14 +331,17 @@ gimp_drawable_filter_set_opacity (GimpDrawableFilter *filter,
}
void
gimp_drawable_filter_set_mode (GimpDrawableFilter *filter,
GimpLayerMode paint_mode)
gimp_drawable_filter_set_mode (GimpDrawableFilter *filter,
GimpLayerMode paint_mode,
GimpLayerCompositeMode composite_mode)
{
g_return_if_fail (GIMP_IS_DRAWABLE_FILTER (filter));
if (paint_mode != filter->paint_mode)
if (paint_mode != filter->paint_mode ||