mirror of https://github.com/GNOME/gimp.git
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.
This commit is contained in:
parent
ea6946edf0
commit
572d556643
|
@ -59,6 +59,7 @@ gimp_drawable_bucket_fill (GimpDrawable *drawable,
|
||||||
GimpPickable *pickable;
|
GimpPickable *pickable;
|
||||||
GeglBuffer *buffer;
|
GeglBuffer *buffer;
|
||||||
GeglBuffer *mask_buffer;
|
GeglBuffer *mask_buffer;
|
||||||
|
gboolean antialias;
|
||||||
gint x1, y1, x2, y2;
|
gint x1, y1, x2, y2;
|
||||||
gint mask_offset_x = 0;
|
gint mask_offset_x = 0;
|
||||||
gint mask_offset_y = 0;
|
gint mask_offset_y = 0;
|
||||||
|
@ -84,11 +85,13 @@ gimp_drawable_bucket_fill (GimpDrawable *drawable,
|
||||||
else
|
else
|
||||||
pickable = GIMP_PICKABLE (drawable);
|
pickable = GIMP_PICKABLE (drawable);
|
||||||
|
|
||||||
|
antialias = gimp_fill_options_get_antialias (options);
|
||||||
|
|
||||||
/* Do a seed bucket fill...To do this, calculate a new
|
/* Do a seed bucket fill...To do this, calculate a new
|
||||||
* contiguous region.
|
* contiguous region.
|
||||||
*/
|
*/
|
||||||
mask_buffer = gimp_pickable_contiguous_region_by_seed (pickable,
|
mask_buffer = gimp_pickable_contiguous_region_by_seed (pickable,
|
||||||
TRUE,
|
antialias,
|
||||||
threshold,
|
threshold,
|
||||||
fill_transparent,
|
fill_transparent,
|
||||||
fill_criterion,
|
fill_criterion,
|
||||||
|
|
|
@ -51,6 +51,7 @@ enum
|
||||||
PROP_FILL_TRANSPARENT,
|
PROP_FILL_TRANSPARENT,
|
||||||
PROP_SAMPLE_MERGED,
|
PROP_SAMPLE_MERGED,
|
||||||
PROP_DIAGONAL_NEIGHBORS,
|
PROP_DIAGONAL_NEIGHBORS,
|
||||||
|
PROP_ANTIALIAS,
|
||||||
PROP_THRESHOLD,
|
PROP_THRESHOLD,
|
||||||
PROP_FILL_CRITERION
|
PROP_FILL_CRITERION
|
||||||
};
|
};
|
||||||
|
@ -95,12 +96,14 @@ gimp_bucket_fill_options_class_init (GimpBucketFillOptionsClass *klass)
|
||||||
GIMP_TYPE_BUCKET_FILL_MODE,
|
GIMP_TYPE_BUCKET_FILL_MODE,
|
||||||
GIMP_BUCKET_FILL_FG,
|
GIMP_BUCKET_FILL_FG,
|
||||||
GIMP_PARAM_STATIC_STRINGS);
|
GIMP_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_FILL_SELECTION,
|
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_FILL_SELECTION,
|
||||||
"fill-selection",
|
"fill-selection",
|
||||||
_("Fill selection"),
|
_("Fill selection"),
|
||||||
_("Which area will be filled"),
|
_("Which area will be filled"),
|
||||||
FALSE,
|
FALSE,
|
||||||
GIMP_PARAM_STATIC_STRINGS);
|
GIMP_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_FILL_TRANSPARENT,
|
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_FILL_TRANSPARENT,
|
||||||
"fill-transparent",
|
"fill-transparent",
|
||||||
_("Fill transparent areas"),
|
_("Fill transparent areas"),
|
||||||
|
@ -108,12 +111,14 @@ gimp_bucket_fill_options_class_init (GimpBucketFillOptionsClass *klass)
|
||||||
"to be filled"),
|
"to be filled"),
|
||||||
TRUE,
|
TRUE,
|
||||||
GIMP_PARAM_STATIC_STRINGS);
|
GIMP_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_SAMPLE_MERGED,
|
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_SAMPLE_MERGED,
|
||||||
"sample-merged",
|
"sample-merged",
|
||||||
_("Sample merged"),
|
_("Sample merged"),
|
||||||
_("Base filled area on all visible layers"),
|
_("Base filled area on all visible layers"),
|
||||||
FALSE,
|
FALSE,
|
||||||
GIMP_PARAM_STATIC_STRINGS);
|
GIMP_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_DIAGONAL_NEIGHBORS,
|
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_DIAGONAL_NEIGHBORS,
|
||||||
"diagonal-neighbors",
|
"diagonal-neighbors",
|
||||||
_("Diagonal neighbors"),
|
_("Diagonal neighbors"),
|
||||||
|
@ -121,12 +126,24 @@ gimp_bucket_fill_options_class_init (GimpBucketFillOptionsClass *klass)
|
||||||
"connected"),
|
"connected"),
|
||||||
FALSE,
|
FALSE,
|
||||||
GIMP_PARAM_STATIC_STRINGS);
|
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,
|
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_THRESHOLD,
|
||||||
"threshold",
|
"threshold",
|
||||||
_("Threshold"),
|
_("Threshold"),
|
||||||
_("Maximum color difference"),
|
_("Maximum color difference"),
|
||||||
0.0, 255.0, 15.0,
|
0.0, 255.0, 15.0,
|
||||||
GIMP_PARAM_STATIC_STRINGS);
|
GIMP_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
GIMP_CONFIG_PROP_ENUM (object_class, PROP_FILL_CRITERION,
|
GIMP_CONFIG_PROP_ENUM (object_class, PROP_FILL_CRITERION,
|
||||||
"fill-criterion",
|
"fill-criterion",
|
||||||
_("Fill by"),
|
_("Fill by"),
|
||||||
|
@ -174,6 +191,9 @@ gimp_bucket_fill_options_set_property (GObject *object,
|
||||||
case PROP_DIAGONAL_NEIGHBORS:
|
case PROP_DIAGONAL_NEIGHBORS:
|
||||||
options->diagonal_neighbors = g_value_get_boolean (value);
|
options->diagonal_neighbors = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_ANTIALIAS:
|
||||||
|
options->antialias = g_value_get_boolean (value);
|
||||||
|
break;
|
||||||
case PROP_THRESHOLD:
|
case PROP_THRESHOLD:
|
||||||
options->threshold = g_value_get_double (value);
|
options->threshold = g_value_get_double (value);
|
||||||
break;
|
break;
|
||||||
|
@ -212,6 +232,9 @@ gimp_bucket_fill_options_get_property (GObject *object,
|
||||||
case PROP_DIAGONAL_NEIGHBORS:
|
case PROP_DIAGONAL_NEIGHBORS:
|
||||||
g_value_set_boolean (value, options->diagonal_neighbors);
|
g_value_set_boolean (value, options->diagonal_neighbors);
|
||||||
break;
|
break;
|
||||||
|
case PROP_ANTIALIAS:
|
||||||
|
g_value_set_boolean (value, options->antialias);
|
||||||
|
break;
|
||||||
case PROP_THRESHOLD:
|
case PROP_THRESHOLD:
|
||||||
g_value_set_double (value, options->threshold);
|
g_value_set_double (value, options->threshold);
|
||||||
break;
|
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_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (button);
|
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 */
|
/* the threshold scale */
|
||||||
scale = gimp_prop_spin_scale_new (config, "threshold", NULL,
|
scale = gimp_prop_spin_scale_new (config, "threshold", NULL,
|
||||||
1.0, 16.0, 1);
|
1.0, 16.0, 1);
|
||||||
|
|
|
@ -42,6 +42,7 @@ struct _GimpBucketFillOptions
|
||||||
gboolean fill_transparent;
|
gboolean fill_transparent;
|
||||||
gboolean sample_merged;
|
gboolean sample_merged;
|
||||||
gboolean diagonal_neighbors;
|
gboolean diagonal_neighbors;
|
||||||
|
gboolean antialias;
|
||||||
gdouble threshold;
|
gdouble threshold;
|
||||||
GimpSelectCriterion fill_criterion;
|
GimpSelectCriterion fill_criterion;
|
||||||
};
|
};
|
||||||
|
|
|
@ -182,6 +182,8 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool,
|
||||||
options->fill_mode,
|
options->fill_mode,
|
||||||
&error))
|
&error))
|
||||||
{
|
{
|
||||||
|
gimp_fill_options_set_antialias (fill_options, options->antialias);
|
||||||
|
|
||||||
gimp_context_set_opacity (GIMP_CONTEXT (fill_options),
|
gimp_context_set_opacity (GIMP_CONTEXT (fill_options),
|
||||||
gimp_context_get_opacity (context));
|
gimp_context_get_opacity (context));
|
||||||
gimp_context_set_paint_mode (GIMP_CONTEXT (fill_options),
|
gimp_context_set_paint_mode (GIMP_CONTEXT (fill_options),
|
||||||
|
|
Loading…
Reference in New Issue