[gimp] app: add "spacing" parameter to warp tool; change "hardness" range



commit 13e274d82e1e17524081479b12f8b783a41e1e1b
Author: Ell <ell_se yahoo com>
Date:   Tue May 16 19:30:01 2017 -0400

    app: add "spacing" parameter to warp tool; change "hardness" range
    
    The spacing parameter controls the stroke spacing of the warp op.
    It's similar, but not identical, to the brush spacing parameter of
    the paint tools.  It provides a tradeoff between speed and quality.
    
    Change the UI range of the hardness parameter from [0, 1] to [0, 100],
    to match the other parameters.

 app/tools/gimpwarpoptions.c |   26 +++++++++++++++++++++++---
 app/tools/gimpwarpoptions.h |    1 +
 app/tools/gimpwarptool.c    |    3 ++-
 3 files changed, 26 insertions(+), 4 deletions(-)
---
diff --git a/app/tools/gimpwarpoptions.c b/app/tools/gimpwarpoptions.c
index d709c09..913560d 100644
--- a/app/tools/gimpwarpoptions.c
+++ b/app/tools/gimpwarpoptions.c
@@ -43,6 +43,7 @@ enum
   PROP_EFFECT_STRENGTH,
   PROP_EFFECT_SIZE,
   PROP_EFFECT_HARDNESS,
+  PROP_STROKE_SPACING,
   PROP_N_ANIMATION_FRAMES
 };
 
@@ -97,7 +98,14 @@ gimp_warp_options_class_init (GimpWarpOptionsClass *klass)
                            "effect-hardness",
                            _("Hardness"),
                            _("Effect Hardness"),
-                           0.0, 1.0, 0.5,
+                           0.0, 100.0, 50.0,
+                           GIMP_PARAM_STATIC_STRINGS);
+
+  GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_STROKE_SPACING,
+                           "stroke-spacing",
+                           _("Spacing"),
+                           _("Stroke Spacing"),
+                           1.0, 100.0, 20.0,
                            GIMP_PARAM_STATIC_STRINGS);
 
   GIMP_CONFIG_PROP_INT (object_class, PROP_N_ANIMATION_FRAMES,
@@ -135,6 +143,9 @@ gimp_warp_options_set_property (GObject      *object,
     case PROP_EFFECT_HARDNESS:
       options->effect_hardness = g_value_get_double (value);
       break;
+    case PROP_STROKE_SPACING:
+      options->stroke_spacing = g_value_get_double (value);
+      break;
     case PROP_N_ANIMATION_FRAMES:
       options->n_animation_frames = g_value_get_int (value);
       break;
@@ -167,6 +178,9 @@ gimp_warp_options_get_property (GObject    *object,
     case PROP_EFFECT_HARDNESS:
       g_value_set_double (value, options->effect_hardness);
       break;
+    case PROP_STROKE_SPACING:
+      g_value_set_double (value, options->stroke_spacing);
+      break;
     case PROP_N_ANIMATION_FRAMES:
       g_value_set_int (value, options->n_animation_frames);
       break;
@@ -206,8 +220,14 @@ gimp_warp_options_gui (GimpToolOptions *tool_options)
   gtk_widget_show (scale);
 
   scale = gimp_prop_spin_scale_new (config, "effect-hardness", NULL,
-                                    0.01, 1.0, 2);
-  gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 0.0, 1.0);
+                                    1, 10, 1);
+  gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 0.0, 100.0);
+  gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+  gtk_widget_show (scale);
+
+  scale = gimp_prop_spin_scale_new (config, "stroke-spacing", NULL,
+                                    1, 10, 1);
+  gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 1.0, 100.0);
   gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
   gtk_widget_show (scale);
 
diff --git a/app/tools/gimpwarpoptions.h b/app/tools/gimpwarpoptions.h
index 46b1fde..231c66f 100644
--- a/app/tools/gimpwarpoptions.h
+++ b/app/tools/gimpwarpoptions.h
@@ -43,6 +43,7 @@ struct _GimpWarpOptions
   gdouble           effect_strength;
   gdouble           effect_size;
   gdouble           effect_hardness;
+  gdouble           stroke_spacing;
 
   gint              n_animation_frames;
 
diff --git a/app/tools/gimpwarptool.c b/app/tools/gimpwarptool.c
index 23af7a5..1359a71 100644
--- a/app/tools/gimpwarptool.c
+++ b/app/tools/gimpwarptool.c
@@ -247,7 +247,8 @@ gimp_warp_tool_button_press (GimpTool            *tool,
                                 "behavior",  options->behavior,
                                 "strength",  options->effect_strength,
                                 "size",      options->effect_size,
-                                "hardness",  options->effect_hardness,
+                                "hardness",  options->effect_hardness / 100.0,
+                                "spacing",   options->stroke_spacing / 100.0,
                                 "stroke",    wt->current_stroke,
                                 NULL);
 


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