[gimp/soc-2009-dynamics] Fix color dynamic
- From: Alexia Death <alexiade src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp/soc-2009-dynamics] Fix color dynamic
- Date: Sat, 3 Oct 2009 13:53:37 +0000 (UTC)
commit 65818936161e4e17ae915b72c1a74c399816c79b
Author: Alexia Death <alexiadeath gmail com>
Date: Sat Oct 3 16:54:10 2009 +0300
Fix color dynamic
app/core/gimpdynamics.c | 13 +++++++++----
app/core/gimpdynamics.h | 2 ++
app/paint/gimpbrushcore.c | 12 +++++-------
app/paint/gimppaintoptions.c | 17 ++++++-----------
4 files changed, 22 insertions(+), 22 deletions(-)
---
diff --git a/app/core/gimpdynamics.c b/app/core/gimpdynamics.c
index b350fb3..1e16ed8 100644
--- a/app/core/gimpdynamics.c
+++ b/app/core/gimpdynamics.c
@@ -1007,8 +1007,7 @@ gimp_dynamics_get_angular_output_val (GimpDynamicsOutput *output, GimpCoords coo
if (factors > 0)
result = total / factors;
- //printf("Dynamics queried(linear). Result: %f, factors: %f, total: %f \n", result, factors, total);
- return result;
+ return result + 0.5;
}
@@ -1075,7 +1074,7 @@ gimp_dynamics_get_aspect_output_val (GimpDynamicsOutput *output, GimpCoords coor
if (factors > 0)
result = total / factors;
- //printf("Dynamics queried(linear). Result: %f, factors: %f, total: %f \n", result, factors, total);
+ /* printf("Dynamics queried(aspect). Result: %f, factors: %f, total: %f \n", result, factors, total);*/
return result;
}
@@ -1133,7 +1132,13 @@ gimp_dynamics_get_scale_output_val (GimpDynamicsOutput *output, GimpCoords coord
else
scale = sqrt (scale);
- //printf("Dynamics queried(linear). Result: %f, factors: %f, total: %f \n", result, factors, total);
+ /* printf("Dynamics queried(scale). Result: %f, factors: %f, total: %f \n", result, factors, total);*/
return scale;
}
+gboolean
+gimp_dynamics_output_get_enabled(GimpDynamicsOutput *output)
+{
+ return (output->pressure || output->velocity || output->direction ||
+ output->tilt || output->random || output->fade);
+}
\ No newline at end of file
diff --git a/app/core/gimpdynamics.h b/app/core/gimpdynamics.h
index 528a7b5..e181f51 100644
--- a/app/core/gimpdynamics.h
+++ b/app/core/gimpdynamics.h
@@ -101,4 +101,6 @@ gdouble gimp_dynamics_get_aspect_output_val (GimpDynamicsOutput *outp
gdouble gimp_dynamics_get_scale_output_val (GimpDynamicsOutput *output, GimpCoords coords);
+gboolean gimp_dynamics_output_get_enabled (GimpDynamicsOutput *output);
+
#endif /* __GIMP_DYNAMICS_OPTIONS_H__ */
diff --git a/app/paint/gimpbrushcore.c b/app/paint/gimpbrushcore.c
index 0574093..0d5d5fe 100644
--- a/app/paint/gimpbrushcore.c
+++ b/app/paint/gimpbrushcore.c
@@ -376,10 +376,8 @@ gimp_brush_core_start (GimpPaintCore *paint_core,
{
GimpBrushCore *core = GIMP_BRUSH_CORE (paint_core);
GimpBrush *brush;
- core->dynamics = gimp_context_get_dynamics (GIMP_CONTEXT (paint_options));
-
- printf("PC: %d\n", GIMP_CONTEXT (paint_options));
+ core->dynamics = gimp_context_get_dynamics (GIMP_CONTEXT (paint_options));
brush = gimp_context_get_brush (GIMP_CONTEXT (paint_options));
@@ -405,9 +403,9 @@ gimp_brush_core_start (GimpPaintCore *paint_core,
{
core->scale *= gimp_dynamics_get_linear_output_val(core->dynamics->size_dynamics, *coords);
- core->angle += gimp_dynamics_get_linear_output_val(core->dynamics->angle_dynamics, *coords);
+ core->angle += gimp_dynamics_get_angular_output_val(core->dynamics->angle_dynamics, *coords);
- core->aspect_ratio *= gimp_dynamics_get_linear_output_val(core->dynamics->aspect_ratio_dynamics, *coords);
+ core->aspect_ratio *= gimp_dynamics_get_aspect_output_val(core->dynamics->aspect_ratio_dynamics, *coords);
}
}
@@ -758,9 +756,9 @@ gimp_brush_core_get_paint_area (GimpPaintCore *paint_core,
{
core->scale *= gimp_dynamics_get_linear_output_val(core->dynamics->size_dynamics, *coords);
- core->angle += gimp_dynamics_get_linear_output_val(core->dynamics->angle_dynamics, *coords);
+ core->angle += gimp_dynamics_get_angular_output_val(core->dynamics->angle_dynamics, *coords);
- core->aspect_ratio *= gimp_dynamics_get_linear_output_val(core->dynamics->aspect_ratio_dynamics, *coords);
+ core->aspect_ratio *= gimp_dynamics_get_aspect_output_val(core->dynamics->aspect_ratio_dynamics, *coords);
}
}
diff --git a/app/paint/gimppaintoptions.c b/app/paint/gimppaintoptions.c
index 1b02acc..42e84da 100644
--- a/app/paint/gimppaintoptions.c
+++ b/app/paint/gimppaintoptions.c
@@ -599,6 +599,7 @@ gimp_paint_options_get_gradient_color (GimpPaintOptions *paint_options,
{
GimpGradientOptions *gradient_options;
GimpGradient *gradient;
+ GimpDynamics *dynamics;
g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options), FALSE);
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
@@ -607,13 +608,10 @@ gimp_paint_options_get_gradient_color (GimpPaintOptions *paint_options,
gradient_options = paint_options->gradient_options;
gradient = gimp_context_get_gradient (GIMP_CONTEXT (paint_options));
-/*
- if (paint_options->pressure_options->color ||
- paint_options->velocity_options->color ||
- paint_options->direction_options->color ||
- paint_options->tilt_options->color ||
- paint_options->random_options->color ||
- paint_options->fading_options->color)
+
+ dynamics = gimp_context_get_dynamics (GIMP_CONTEXT (paint_options));
+
+ if (gimp_dynamics_output_get_enabled(dynamics->color_dynamics))
{
gimp_gradient_get_color_at (gradient, GIMP_CONTEXT (paint_options),
NULL, grad_point,
@@ -622,10 +620,7 @@ gimp_paint_options_get_gradient_color (GimpPaintOptions *paint_options,
return TRUE;
}
-
-
- else*/
- if (gradient_options->use_gradient)
+ else if (gradient_options->use_gradient)
{
gdouble gradient_length = 0.0;
gdouble unit_factor;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]