app: rename and merge the spline and segment length properties...

... in GimpBucketFillOptions for the line art algorithm.

Inside GimpLineArt, there are still 2 properties, but we don't show them
anymore in the Bucket Fill tool options. One of the main reason is
probably that it's hard to differentiate their usage. One is to close
with curved lines, the other with straight segments. Yet we don't
actually have any control on one or the other. All one knows is that you
can have "holes" in your drawing of a given size and you want them
close-like for filling. Only reason I can see to have 2 types of closure
is whether you'd want to totally disable one type of closure (then you
set it to 0). But this is a very limited reason for making the options
less understandable overall, IMO.
So for the time being, let's show up only a single option which sets
both properties in GimpLineArt. As patdavid says "it makes sense as a
first pass".

Also rename the option to shorter/simpler "Maximum gap length". Thanks
to patdavid and pippin for helping on figuring out this better label!

Finally I am bumping the default for the gaps to 100px. The original
values were ok for the basic small images used in demos, but not for
real life image where it was always too short (even 100px may still be
too short actually, but much better than the 20 and 60px from before!).
This commit is contained in:
Jehan 2018-12-24 13:21:12 +01:00
parent cbee0ed5a3
commit 503775a5a0
4 changed files with 19 additions and 40 deletions

View File

@ -308,14 +308,14 @@ gimp_line_art_class_init (GimpLineArtClass *klass)
g_param_spec_int ("spline-max-length",
_("Maximum curved closing length"),
_("Maximum curved length (in pixels) to close the line art"),
0, 1000, 60,
0, 1000, 100,
G_PARAM_CONSTRUCT | GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_SEGMENT_MAX_LEN,
g_param_spec_int ("segment-max-length",
_("Maximum straight closing length"),
_("Maximum straight length (in pixels) to close the line art"),
0, 1000, 20,
0, 1000, 100,
G_PARAM_CONSTRUCT | GIMP_PARAM_READWRITE));
}

View File

@ -55,8 +55,7 @@ enum
PROP_THRESHOLD,
PROP_LINE_ART_THRESHOLD,
PROP_LINE_ART_MAX_GROW,
PROP_LINE_ART_SPLINE_MAX_LEN,
PROP_LINE_ART_SEGMENT_MAX_LEN,
PROP_LINE_ART_MAX_GAP_LENGTH,
PROP_FILL_CRITERION
};
@ -173,18 +172,11 @@ gimp_bucket_fill_options_class_init (GimpBucketFillOptionsClass *klass)
1, 100, 3,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_INT (object_class, PROP_LINE_ART_SPLINE_MAX_LEN,
"line-art-spline-max-len",
_("Maximum curved closing length"),
_("Maximum curved length (in pixels) to close the line art"),
0, 1000, 60,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_INT (object_class, PROP_LINE_ART_SEGMENT_MAX_LEN,
"line-art-segment-max-len",
_("Maximum straight closing length"),
_("Maximum straight length (in pixels) to close the line art"),
0, 1000, 20,
GIMP_CONFIG_PROP_INT (object_class, PROP_LINE_ART_MAX_GAP_LENGTH,
"line-art-max-gap-length",
_("Maximum gap length"),
_("Maximum gap (in pixels) in line art which can be closed"),
0, 1000, 100,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_ENUM (object_class, PROP_FILL_CRITERION,
@ -248,11 +240,8 @@ gimp_bucket_fill_options_set_property (GObject *object,
case PROP_LINE_ART_MAX_GROW:
options->line_art_max_grow = g_value_get_int (value);
break;
case PROP_LINE_ART_SEGMENT_MAX_LEN:
options->line_art_segment_max_len = g_value_get_int (value);
break;
case PROP_LINE_ART_SPLINE_MAX_LEN:
options->line_art_spline_max_len = g_value_get_int (value);
case PROP_LINE_ART_MAX_GAP_LENGTH:
options->line_art_max_gap_length = g_value_get_int (value);
break;
case PROP_FILL_CRITERION:
options->fill_criterion = g_value_get_enum (value);
@ -301,11 +290,8 @@ gimp_bucket_fill_options_get_property (GObject *object,
case PROP_LINE_ART_MAX_GROW:
g_value_set_int (value, options->line_art_max_grow);
break;
case PROP_LINE_ART_SEGMENT_MAX_LEN:
g_value_set_int (value, options->line_art_segment_max_len);
break;
case PROP_LINE_ART_SPLINE_MAX_LEN:
g_value_set_int (value, options->line_art_spline_max_len);
case PROP_LINE_ART_MAX_GAP_LENGTH:
g_value_set_int (value, options->line_art_max_gap_length);
break;
case PROP_FILL_CRITERION:
g_value_set_enum (value, options->fill_criterion);
@ -478,14 +464,8 @@ gimp_bucket_fill_options_gui (GimpToolOptions *tool_options)
gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0);
gtk_widget_show (scale);
/* Line Art: segment max len */
scale = gimp_prop_spin_scale_new (config, "line-art-segment-max-len", NULL,
1, 5, 0);
gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0);
gtk_widget_show (scale);
/* Line Art: spline max len */
scale = gimp_prop_spin_scale_new (config, "line-art-spline-max-len", NULL,
/* Line Art: max gap length */
scale = gimp_prop_spin_scale_new (config, "line-art-max-gap-length", NULL,
1, 5, 0);
gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0);
gtk_widget_show (scale);

View File

@ -48,8 +48,7 @@ struct _GimpBucketFillOptions
gdouble line_art_threshold;
gint line_art_max_grow;
gint line_art_segment_max_len;
gint line_art_spline_max_len;
gint line_art_max_gap_length;
GimpSelectCriterion fill_criterion;

View File

@ -223,12 +223,12 @@ gimp_bucket_fill_tool_constructed (GObject *object)
g_object_bind_property (options, "line-art-max-grow",
line_art, "max-grow",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
g_object_bind_property (options, "line-art-spline-max-len",
g_object_bind_property (options, "line-art-max-gap-length",
line_art, "spline-max-length",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
g_object_bind_property (options, "line-art-segment-max-len",
G_BINDING_SYNC_CREATE | G_BINDING_DEFAULT);
g_object_bind_property (options, "line-art-max-gap-length",
line_art, "segment-max-length",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
G_BINDING_SYNC_CREATE | G_BINDING_DEFAULT);
GIMP_BUCKET_FILL_TOOL (tool)->priv->line_art = line_art;
g_signal_connect (options, "notify::fill-criterion",