1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-06 01:12:40 +02:00

Compare commits

...

1 Commits

Author SHA1 Message Date
Alx Sa
6822e41502 paint: Use filters when cloning if applicable
The Clone Tool now has a new option to include or ignore filters
when setting a source. If disabled (and Sample Merged is not set),
the raw pixel buffer will be used as source rather than with
any active non-destructive filters applied.
2025-03-27 04:26:54 +00:00
4 changed files with 43 additions and 4 deletions

View File

@@ -559,12 +559,17 @@ gimp_source_core_real_get_source (GimpSourceCore *source_core,
GimpSourceOptions *options = GIMP_SOURCE_OPTIONS (paint_options);
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpImage *src_image = gimp_pickable_get_image (src_pickable);
GeglBuffer *src_buffer = gimp_pickable_get_buffer (src_pickable);
GeglBuffer *src_buffer = NULL;
GeglBuffer *dest_buffer;
gboolean sample_merged;
gint x, y;
gint width, height;
if (options->include_filters)
src_buffer = gimp_pickable_get_buffer_with_effects (src_pickable);
else
src_buffer = gimp_pickable_get_buffer (src_pickable);
/* As a special case, we bypass sample merged value when we request
* each drawable to be its own source.
*/

View File

@@ -44,7 +44,8 @@ enum
PROP_SRC_X,
PROP_SRC_Y,
PROP_ALIGN_MODE,
PROP_SAMPLE_MERGED
PROP_SAMPLE_MERGED,
PROP_INCLUDE_FILTERS
};
@@ -111,6 +112,14 @@ gimp_source_options_class_init (GimpSourceOptionsClass *klass)
NULL,
FALSE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_INCLUDE_FILTERS,
"include-filters",
_("Include filters"),
_("If checked, the source will include "
"any active non-destructive filters."),
FALSE,
GIMP_PARAM_STATIC_STRINGS);
}
static void
@@ -156,6 +165,9 @@ gimp_source_options_set_property (GObject *object,
case PROP_SAMPLE_MERGED:
options->sample_merged = g_value_get_boolean (value);
break;
case PROP_INCLUDE_FILTERS:
options->include_filters = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -187,6 +199,9 @@ gimp_source_options_get_property (GObject *object,
case PROP_SAMPLE_MERGED:
g_value_set_boolean (value, options->sample_merged);
break;
case PROP_INCLUDE_FILTERS:
g_value_set_boolean (value, options->include_filters);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;

View File

@@ -46,6 +46,7 @@ struct _GimpSourceOptions
GimpSourceAlignMode align_mode;
gboolean sample_merged;
gboolean include_filters;
};
struct _GimpSourceOptionsClass

View File

@@ -231,6 +231,7 @@ gimp_clone_options_gui (GimpToolOptions *tool_options)
GtkWidget *label;
GtkWidget *combo;
GtkWidget *source_vbox;
GtkWidget *sample_merged_vbox;
GtkWidget *button;
GtkWidget *hbox;
gchar *str;
@@ -251,9 +252,26 @@ gimp_clone_options_gui (GimpToolOptions *tool_options)
gtk_container_add (GTK_CONTAINER (frame), source_vbox);
gtk_widget_show (source_vbox);
frame = gimp_frame_new (_("Sample merged"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_box_reorder_child (GTK_BOX (vbox), frame, 3);
gtk_widget_set_visible (frame, TRUE);
sample_merged_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (frame), sample_merged_vbox);
gtk_widget_set_visible (sample_merged_vbox, TRUE);
button = gimp_prop_check_button_new (config, "sample-merged", NULL);
g_object_set_data (G_OBJECT (tool_options), "sample-merged-checkbox", button);
gtk_box_pack_start (GTK_BOX (source_vbox), button, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (sample_merged_vbox), button, FALSE, FALSE, 0);
button = gimp_prop_check_button_new (config, "include-filters", NULL);
gtk_box_pack_start (GTK_BOX (sample_merged_vbox), button, FALSE, FALSE, 0);
g_object_bind_property (G_OBJECT (config), "sample-merged",
G_OBJECT (button), "sensitive",
G_BINDING_SYNC_CREATE |
G_BINDING_INVERT_BOOLEAN);
g_object_bind_property_full (config, "clone-type",
button, "visible",
@@ -301,7 +319,7 @@ gimp_clone_options_gui (GimpToolOptions *tool_options)
gimp_int_combo_box_set_label (GIMP_INT_COMBO_BOX (combo), _("Alignment"));
g_object_set (combo, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
gtk_box_pack_start (GTK_BOX (vbox), combo, TRUE, TRUE, 0);
gtk_box_reorder_child (GTK_BOX (vbox), combo, 3);
gtk_box_reorder_child (GTK_BOX (vbox), combo, 4);
/* A few options which can trigger a change in the source label. */
g_signal_connect (config, "notify::src-drawables",