[gimp] app: rename and merge the spline and segment length properties...



commit 503775a5a04160c8ebb8ef8b242c5228e69cba4c
Author: Jehan <jehan girinstud io>
Date:   Mon Dec 24 13:21:12 2018 +0100

    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!).

 app/core/gimplineart.c            |  4 ++--
 app/tools/gimpbucketfilloptions.c | 44 +++++++++++----------------------------
 app/tools/gimpbucketfilloptions.h |  3 +--
 app/tools/gimpbucketfilltool.c    |  8 +++----
 4 files changed, 19 insertions(+), 40 deletions(-)
---
diff --git a/app/core/gimplineart.c b/app/core/gimplineart.c
index a2ca6f6c7f..9bf15e438a 100644
--- a/app/core/gimplineart.c
+++ b/app/core/gimplineart.c
@@ -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));
 }
 
diff --git a/app/tools/gimpbucketfilloptions.c b/app/tools/gimpbucketfilloptions.c
index 081412c9e4..e313e626eb 100644
--- a/app/tools/gimpbucketfilloptions.c
+++ b/app/tools/gimpbucketfilloptions.c
@@ -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);
diff --git a/app/tools/gimpbucketfilloptions.h b/app/tools/gimpbucketfilloptions.h
index f924a1923c..83fdb17e50 100644
--- a/app/tools/gimpbucketfilloptions.h
+++ b/app/tools/gimpbucketfilloptions.h
@@ -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;
 
diff --git a/app/tools/gimpbucketfilltool.c b/app/tools/gimpbucketfilltool.c
index 55213f8742..041121fb0a 100644
--- a/app/tools/gimpbucketfilltool.c
+++ b/app/tools/gimpbucketfilltool.c
@@ -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",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]