[gimp] Bug 553855 - Bucket fill colour is always blended with filled pixel colour...
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 553855 - Bucket fill colour is always blended with filled pixel colour...
- Date: Thu, 15 Sep 2016 10:29:39 +0000 (UTC)
commit 572d55664314a0deb58a336924e08eba2d30441a
Author: Michael Natterer <mitch gimp org>
Date: Thu Sep 15 12:24:37 2016 +0200
Bug 553855 - Bucket fill colour is always blended with filled pixel colour...
...when threshold > 0
Add an "Antialias" toggle to the bucket fill options and set it on the
GimpFillOptions. In gimp_drawable_bucket_fill(), pass it to
gimp_pickable_contiguous_region_by_seed() instead of always defaulting
to TRUE.
The position of the toggle and its huge tooltip may need some
adjustment.
app/core/gimpdrawable-bucket-fill.c | 5 ++++-
app/tools/gimpbucketfilloptions.c | 28 ++++++++++++++++++++++++++++
app/tools/gimpbucketfilloptions.h | 1 +
app/tools/gimpbucketfilltool.c | 2 ++
4 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/app/core/gimpdrawable-bucket-fill.c b/app/core/gimpdrawable-bucket-fill.c
index d1058b1..50886fc 100644
--- a/app/core/gimpdrawable-bucket-fill.c
+++ b/app/core/gimpdrawable-bucket-fill.c
@@ -59,6 +59,7 @@ gimp_drawable_bucket_fill (GimpDrawable *drawable,
GimpPickable *pickable;
GeglBuffer *buffer;
GeglBuffer *mask_buffer;
+ gboolean antialias;
gint x1, y1, x2, y2;
gint mask_offset_x = 0;
gint mask_offset_y = 0;
@@ -84,11 +85,13 @@ gimp_drawable_bucket_fill (GimpDrawable *drawable,
else
pickable = GIMP_PICKABLE (drawable);
+ antialias = gimp_fill_options_get_antialias (options);
+
/* Do a seed bucket fill...To do this, calculate a new
* contiguous region.
*/
mask_buffer = gimp_pickable_contiguous_region_by_seed (pickable,
- TRUE,
+ antialias,
threshold,
fill_transparent,
fill_criterion,
diff --git a/app/tools/gimpbucketfilloptions.c b/app/tools/gimpbucketfilloptions.c
index b7189ea..9f4b87e 100644
--- a/app/tools/gimpbucketfilloptions.c
+++ b/app/tools/gimpbucketfilloptions.c
@@ -51,6 +51,7 @@ enum
PROP_FILL_TRANSPARENT,
PROP_SAMPLE_MERGED,
PROP_DIAGONAL_NEIGHBORS,
+ PROP_ANTIALIAS,
PROP_THRESHOLD,
PROP_FILL_CRITERION
};
@@ -95,12 +96,14 @@ gimp_bucket_fill_options_class_init (GimpBucketFillOptionsClass *klass)
GIMP_TYPE_BUCKET_FILL_MODE,
GIMP_BUCKET_FILL_FG,
GIMP_PARAM_STATIC_STRINGS);
+
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_FILL_SELECTION,
"fill-selection",
_("Fill selection"),
_("Which area will be filled"),
FALSE,
GIMP_PARAM_STATIC_STRINGS);
+
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_FILL_TRANSPARENT,
"fill-transparent",
_("Fill transparent areas"),
@@ -108,12 +111,14 @@ gimp_bucket_fill_options_class_init (GimpBucketFillOptionsClass *klass)
"to be filled"),
TRUE,
GIMP_PARAM_STATIC_STRINGS);
+
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_SAMPLE_MERGED,
"sample-merged",
_("Sample merged"),
_("Base filled area on all visible layers"),
FALSE,
GIMP_PARAM_STATIC_STRINGS);
+
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_DIAGONAL_NEIGHBORS,
"diagonal-neighbors",
_("Diagonal neighbors"),
@@ -121,12 +126,24 @@ gimp_bucket_fill_options_class_init (GimpBucketFillOptionsClass *klass)
"connected"),
FALSE,
GIMP_PARAM_STATIC_STRINGS);
+
+ GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_ANTIALIAS,
+ "antialias",
+ _("Antialiasing"),
+ _("Base fill opacity on color difference from "
+ "the clicked pixel (see threshold). Disable "
+ "antialiasing to fill the entire area "
+ "uniformly."),
+ TRUE,
+ GIMP_PARAM_STATIC_STRINGS);
+
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_THRESHOLD,
"threshold",
_("Threshold"),
_("Maximum color difference"),
0.0, 255.0, 15.0,
GIMP_PARAM_STATIC_STRINGS);
+
GIMP_CONFIG_PROP_ENUM (object_class, PROP_FILL_CRITERION,
"fill-criterion",
_("Fill by"),
@@ -174,6 +191,9 @@ gimp_bucket_fill_options_set_property (GObject *object,
case PROP_DIAGONAL_NEIGHBORS:
options->diagonal_neighbors = g_value_get_boolean (value);
break;
+ case PROP_ANTIALIAS:
+ options->antialias = g_value_get_boolean (value);
+ break;
case PROP_THRESHOLD:
options->threshold = g_value_get_double (value);
break;
@@ -212,6 +232,9 @@ gimp_bucket_fill_options_get_property (GObject *object,
case PROP_DIAGONAL_NEIGHBORS:
g_value_set_boolean (value, options->diagonal_neighbors);
break;
+ case PROP_ANTIALIAS:
+ g_value_set_boolean (value, options->antialias);
+ break;
case PROP_THRESHOLD:
g_value_set_double (value, options->threshold);
break;
@@ -314,6 +337,11 @@ gimp_bucket_fill_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_widget_show (button);
+ /* the antialias toggle */
+ button = gimp_prop_check_button_new (config, "antialias", NULL);
+ gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
+ gtk_widget_show (button);
+
/* the threshold scale */
scale = gimp_prop_spin_scale_new (config, "threshold", NULL,
1.0, 16.0, 1);
diff --git a/app/tools/gimpbucketfilloptions.h b/app/tools/gimpbucketfilloptions.h
index 083feef..7a0d27b 100644
--- a/app/tools/gimpbucketfilloptions.h
+++ b/app/tools/gimpbucketfilloptions.h
@@ -42,6 +42,7 @@ struct _GimpBucketFillOptions
gboolean fill_transparent;
gboolean sample_merged;
gboolean diagonal_neighbors;
+ gboolean antialias;
gdouble threshold;
GimpSelectCriterion fill_criterion;
};
diff --git a/app/tools/gimpbucketfilltool.c b/app/tools/gimpbucketfilltool.c
index b266a97..aa5d163 100644
--- a/app/tools/gimpbucketfilltool.c
+++ b/app/tools/gimpbucketfilltool.c
@@ -182,6 +182,8 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool,
options->fill_mode,
&error))
{
+ gimp_fill_options_set_antialias (fill_options, options->antialias);
+
gimp_context_set_opacity (GIMP_CONTEXT (fill_options),
gimp_context_get_opacity (context));
gimp_context_set_paint_mode (GIMP_CONTEXT (fill_options),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]