mirror of https://github.com/GNOME/gimp.git
Adding random as part of the calculations, renaming calc method to linear for type
This commit is contained in:
parent
5eedaeb97a
commit
da2920b0eb
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue