[gimp/soc-2009-dynamics] Adding random as part of the calculations, renaming calc method to linear for type
- From: Alexia Death <alexiade src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp/soc-2009-dynamics] Adding random as part of the calculations, renaming calc method to linear for type
- Date: Sat, 3 Oct 2009 11:12:05 +0000 (UTC)
commit da2920b0ebbcdcc6ea429eb4a7057a2c49c2c3a7
Author: Alexia Death <alexiadeath gmail com>
Date: Sat Oct 3 14:08:05 2009 +0300
Adding random as part of the calculations, renaming calc method to linear for type
app/core/gimpcontext.c | 3 ---
app/core/gimpdynamics.c | 12 +++++++++---
app/core/gimpdynamics.h | 2 +-
app/paint/gimpbrushcore.c | 12 ++++++------
app/paint/gimppaintbrush.c | 6 +++---
5 files changed, 19 insertions(+), 16 deletions(-)
---
diff --git a/app/core/gimpcontext.c b/app/core/gimpcontext.c
index 06b24c0..5b2318a 100644
--- a/app/core/gimpcontext.c
+++ b/app/core/gimpcontext.c
@@ -2491,7 +2491,6 @@ GimpDynamics *
gimp_context_get_dynamics (GimpContext *context)
{
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
- g_return_val_if_fail (GIMP_IS_DYNAMICS (context->dynamics), NULL);
return context->dynamics;
}
@@ -2504,7 +2503,6 @@ gimp_context_set_dynamics (GimpContext *context,
g_return_if_fail (! dynamics || GIMP_IS_DYNAMICS (dynamics));
context_find_defined (context, GIMP_CONTEXT_PROP_DYNAMICS);
- printf("setting&OK\n");
gimp_context_real_set_dynamics (context, dynamics);
}
@@ -2565,7 +2563,6 @@ static void
gimp_context_real_set_dynamics (GimpContext *context,
GimpDynamics *dynamics)
{
- g_return_val_if_fail (GIMP_IS_DYNAMICS (dynamics), NULL);
if (! standard_dynamics)
{
diff --git a/app/core/gimpdynamics.c b/app/core/gimpdynamics.c
index c2637f3..8d922e4 100644
--- a/app/core/gimpdynamics.c
+++ b/app/core/gimpdynamics.c
@@ -844,7 +844,6 @@ gimp_dynamics_notify (GObject *object,
GimpDynamics *options = GIMP_DYNAMICS (object);
-
}
GimpData *
@@ -880,7 +879,7 @@ gimp_dynamics_get_standard (void)
}
gdouble
-gimp_dynamics_get_output_val (GimpDynamicsOutput *output, GimpCoords coords)
+gimp_dynamics_get_linear_output_val (GimpDynamicsOutput *output, GimpCoords coords)
{
gdouble total = 0.0;
gdouble factors = 0.0;
@@ -898,10 +897,17 @@ gimp_dynamics_get_output_val (GimpDynamicsOutput *output, GimpCoords coords)
total += (1.0 - coords.velocity);
factors++;
}
+
+ if (output->random)
+ {
+ total += g_random_double_range (0.0, 1.0);
+ factors++;
+ }
+
if (factors > 0)
result = total / factors;
- //printf("Dynamics queried. Result: %f, vel %f, f: %f, t: %f \n", result, coords.velocity, factors, total);
+ printf("Dynamics queried. Result: %f, factors: %f, total: %f \n", result, factors, total);
return result;
}
diff --git a/app/core/gimpdynamics.h b/app/core/gimpdynamics.h
index 3b49011..523bfa3 100644
--- a/app/core/gimpdynamics.h
+++ b/app/core/gimpdynamics.h
@@ -90,6 +90,6 @@ GimpData * gimp_dynamics_new (const gchar *name);
GimpData * gimp_dynamics_get_standard (void);
-gdouble gimp_dynamics_get_output_val (GimpDynamicsOutput *output, GimpCoords coords);
+gdouble gimp_dynamics_get_linear_output_val (GimpDynamicsOutput *output, GimpCoords coords);
#endif /* __GIMP_DYNAMICS_OPTIONS_H__ */
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index 5856396..0574093 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -403,11 +403,11 @@ gimp_brush_core_start (GimpPaintCore *paint_core,
if (core->dynamics)
{
- core->scale *= gimp_dynamics_get_output_val(core->dynamics->size_dynamics, *coords);
+ core->scale *= gimp_dynamics_get_linear_output_val(core->dynamics->size_dynamics, *coords);
- core->angle += gimp_dynamics_get_output_val(core->dynamics->angle_dynamics, *coords);
+ core->angle += gimp_dynamics_get_linear_output_val(core->dynamics->angle_dynamics, *coords);
- core->aspect_ratio *= gimp_dynamics_get_output_val(core->dynamics->aspect_ratio_dynamics, *coords);
+ core->aspect_ratio *= gimp_dynamics_get_linear_output_val(core->dynamics->aspect_ratio_dynamics, *coords);
}
}
@@ -756,11 +756,11 @@ gimp_brush_core_get_paint_area (GimpPaintCore *paint_core,
if (core->dynamics)
{
- core->scale *= gimp_dynamics_get_output_val(core->dynamics->size_dynamics, *coords);
+ core->scale *= gimp_dynamics_get_linear_output_val(core->dynamics->size_dynamics, *coords);
- core->angle += gimp_dynamics_get_output_val(core->dynamics->angle_dynamics, *coords);
+ core->angle += gimp_dynamics_get_linear_output_val(core->dynamics->angle_dynamics, *coords);
- core->aspect_ratio *= gimp_dynamics_get_output_val(core->dynamics->aspect_ratio_dynamics, *coords);
+ core->aspect_ratio *= gimp_dynamics_get_linear_output_val(core->dynamics->aspect_ratio_dynamics, *coords);
}
}
diff --git a/app/paint/gimppaintbrush.c b/app/paint/gimppaintbrush.c
index c23a6f7..6c85253 100644
--- a/app/paint/gimppaintbrush.c
+++ b/app/paint/gimppaintbrush.c
@@ -131,7 +131,7 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
paint_appl_mode = paint_options->application_mode;
- grad_point = gimp_dynamics_get_output_val(brush_core->dynamics->color_dynamics, *coords);
+ grad_point = gimp_dynamics_get_linear_output_val(brush_core->dynamics->color_dynamics, *coords);
/* optionally take the color from the current gradient */
if (gimp_paint_options_get_gradient_color (paint_options, image,
@@ -176,9 +176,9 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
area->bytes);
}
- opacity *= gimp_dynamics_get_output_val(brush_core->dynamics->opacity_dynamics, *coords);
+ opacity *= gimp_dynamics_get_linear_output_val(brush_core->dynamics->opacity_dynamics, *coords);
- hardness = gimp_dynamics_get_output_val(brush_core->dynamics->hardness_dynamics, *coords);
+ hardness = gimp_dynamics_get_linear_output_val(brush_core->dynamics->hardness_dynamics, *coords);
/* finally, let the brush core paste the colored area on the canvas */
gimp_brush_core_paste_canvas (brush_core, drawable,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]