[gimp] app: fixes for force and hardness
- From: Alexia Death <alexiade src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: fixes for force and hardness
- Date: Mon, 17 Nov 2014 13:36:32 +0000 (UTC)
commit 32e545277b082d01612280ebd9228e072a7865f8
Author: Alexia Death <alexiadeath gmail com>
Date: Mon Nov 17 15:23:01 2014 +0200
app: fixes for force and hardness
app/paint/gimpbrushcore.c | 2 +-
app/paint/gimppaintbrush.c | 25 +++++++++++++++++++------
app/paint/gimppaintoptions.c | 10 +++++-----
app/tools/gimppaintoptions-gui.c | 6 +++---
4 files changed, 28 insertions(+), 15 deletions(-)
---
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index b52879f..f0b2645 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -1523,7 +1523,7 @@ gimp_brush_core_eval_transform_dynamics (GimpBrushCore *core,
core->angle = paint_options->brush_angle;
core->aspect_ratio = paint_options->brush_aspect_ratio;
- core->hardness = paint_options->brush_hardness;
+ core->hardness = paint_options->brush_hardness / 100.0;
if (! GIMP_IS_DYNAMICS (core->dynamics))
return;
diff --git a/app/paint/gimppaintbrush.c b/app/paint/gimppaintbrush.c
index 70063b1..4b889cb 100644
--- a/app/paint/gimppaintbrush.c
+++ b/app/paint/gimppaintbrush.c
@@ -121,6 +121,9 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
gdouble fade_point;
gdouble grad_point;
gdouble force;
+ gdouble dyn_force;
+ GimpDynamicsOutput *dyn_output = NULL;
+ gdouble option_force;
image = gimp_item_get_image (GIMP_ITEM (drawable));
@@ -197,12 +200,22 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
g_object_unref (color);
}
- force = MAX (paint_options->brush_force,
- gimp_dynamics_get_linear_value (dynamics,
- GIMP_DYNAMICS_OUTPUT_FORCE,
- coords,
- paint_options,
- fade_point));
+ dyn_output = gimp_dynamics_get_output (dynamics,
+ GIMP_DYNAMICS_OUTPUT_FORCE);
+
+ dyn_force = gimp_dynamics_get_linear_value (dynamics,
+ GIMP_DYNAMICS_OUTPUT_FORCE,
+ coords,
+ paint_options,
+ fade_point);
+ force = 0.0;
+ option_force = paint_options->brush_force / 100.0;
+
+ if ((option_force > 0.0) && gimp_dynamics_output_is_enabled (dyn_output))
+ force = option_force + (1 - option_force) * dyn_force;
+
+ else if (option_force > 0.0)
+ force = option_force;
/* finally, let the brush core paste the colored area on the canvas */
gimp_brush_core_paste_canvas (brush_core, drawable,
diff --git a/app/paint/gimppaintoptions.c b/app/paint/gimppaintoptions.c
index 91a3ed8..428f150 100644
--- a/app/paint/gimppaintoptions.c
+++ b/app/paint/gimppaintoptions.c
@@ -47,8 +47,8 @@
#define DEFAULT_BRUSH_ANGLE 0.0
#define DEFAULT_BRUSH_SPACING 10.0
-#define DEFAULT_BRUSH_HARDNESS 1.0 /*Generated brushes have their own*/
-#define DEFAULT_BRUSH_FORCE 0.0
+#define DEFAULT_BRUSH_HARDNESS 100.0 /*Generated brushes have their own*/
+#define DEFAULT_BRUSH_FORCE 50.0
#define DEFAULT_APPLICATION_MODE GIMP_PAINT_CONSTANT
#define DEFAULT_HARD FALSE
@@ -191,12 +191,12 @@ gimp_paint_options_class_init (GimpPaintOptionsClass *klass)
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BRUSH_HARDNESS,
"brush-hardness", _("Brush Hardness"),
- 0.0, 1.0, DEFAULT_BRUSH_HARDNESS,
+ 0.0, 100.0, DEFAULT_BRUSH_HARDNESS,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_BRUSH_FORCE,
"brush-force", _("Brush Force"),
- 0.0, 1.0, DEFAULT_BRUSH_FORCE,
+ 0.0, 100.0, DEFAULT_BRUSH_FORCE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_APPLICATION_MODE,
@@ -857,7 +857,7 @@ gimp_paint_options_set_default_brush_hardness (GimpPaintOptions *paint_options,
GimpBrushGenerated *generated_brush = GIMP_BRUSH_GENERATED(brush);
g_object_set (paint_options,
- "brush-hardness", (gdouble) gimp_brush_generated_get_hardness (generated_brush),
+ "brush-hardness", (gdouble) gimp_brush_generated_get_hardness (generated_brush) * 100.0,
NULL);
}
else
diff --git a/app/tools/gimppaintoptions-gui.c b/app/tools/gimppaintoptions-gui.c
index 0717b20..fcf09c4 100644
--- a/app/tools/gimppaintoptions-gui.c
+++ b/app/tools/gimppaintoptions-gui.c
@@ -185,7 +185,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
hbox = gimp_paint_options_gui_scale_with_reset_button
(config, "brush-hardness", _("Hardness"),
_("Reset hardness to default"),
- 0.01, 0.1, 0.0, 1.0, 1.0,
+ 0.1, 1.0, 0.0, 100.0, 1.0,
G_CALLBACK (gimp_paint_options_gui_reset_hardness));
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
@@ -194,7 +194,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
hbox = gimp_paint_options_gui_scale_with_reset_button
(config, "brush-force", _("Force"),
_("Reset force to default"),
- 0.01, 0.1, 0.0, 1.0, 1.0,
+ 0.1, 1.0, 0.0, 100.0, 1.0,
G_CALLBACK (gimp_paint_options_gui_reset_force));
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
@@ -461,7 +461,7 @@ gimp_paint_options_gui_reset_force (GtkWidget *button,
GimpPaintOptions *paint_options)
{
g_object_set (paint_options,
- "brush-force", 0.0,
+ "brush-force", 50.0,
NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]