app: make all tools capable of dynamic force respect the options slider

This commit is contained in:
Alexia Death 2015-01-19 10:46:31 +02:00
parent 7c27d9588a
commit ace4234a98
6 changed files with 116 additions and 69 deletions

View File

@ -158,6 +158,8 @@ gimp_clone_motion (GimpSourceCore *source_core,
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
gdouble fade_point;
gdouble force;
gdouble dyn_force;
GimpDynamicsOutput *dyn_output = NULL;
if (gimp_source_core_use_source (source_core, source_options))
{
@ -195,12 +197,20 @@ gimp_clone_motion (GimpSourceCore *source_core,
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
force = gimp_dynamics_get_linear_value (GIMP_BRUSH_CORE (paint_core)->dynamics,
dyn_output = gimp_dynamics_get_output (GIMP_BRUSH_CORE (paint_core)->dynamics,
GIMP_DYNAMICS_OUTPUT_FORCE);
dyn_force = gimp_dynamics_get_linear_value (GIMP_BRUSH_CORE (paint_core)->dynamics,
GIMP_DYNAMICS_OUTPUT_FORCE,
coords,
paint_options,
fade_point);
if (gimp_dynamics_output_is_enabled (dyn_output))
force = dyn_force;
else
force = paint_options->brush_force;
gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
coords,
MIN (opacity, GIMP_OPACITY_OPAQUE),

View File

@ -120,7 +120,9 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
gint paint_buffer_y;
gdouble fade_point;
gdouble opacity;
gdouble hardness;
gdouble force;
gdouble dyn_force;
GimpDynamicsOutput *dyn_output = NULL;
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
@ -152,18 +154,26 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
options->type,
options->mode);
hardness = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_HARDNESS,
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);
if (gimp_dynamics_output_is_enabled (dyn_output))
force = dyn_force;
else
force = paint_options->brush_force;
/* Replace the newly dodgedburned area (paint_area) to the image */
gimp_brush_core_replace_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
coords,
MIN (opacity, GIMP_OPACITY_OPAQUE),
gimp_context_get_opacity (context),
gimp_paint_options_get_brush_mode (paint_options),
hardness,
force,
GIMP_PAINT_CONSTANT);
}

View File

@ -116,6 +116,8 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
GimpRGB background;
GeglColor *color;
gdouble force;
gdouble dyn_force;
GimpDynamicsOutput *dyn_output = NULL;
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
@ -148,12 +150,20 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
else
paint_mode = GIMP_NORMAL_MODE;
force = gimp_dynamics_get_linear_value (dynamics,
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);
if (gimp_dynamics_output_is_enabled (dyn_output))
force = dyn_force;
else
force = paint_options->brush_force;
gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
coords,
MIN (opacity, GIMP_OPACITY_OPAQUE),

View File

@ -483,23 +483,33 @@ gimp_heal_motion (GimpSourceCore *source_core,
GeglBuffer *mask_buffer;
const GimpTempBuf *mask_buf;
gdouble fade_point;
gdouble hardness;
gdouble force;
gint mask_off_x;
gint mask_off_y;
gdouble dyn_force;
GimpDynamicsOutput *dyn_output = NULL;
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
hardness = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_HARDNESS,
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);
if (gimp_dynamics_output_is_enabled (dyn_output))
force = dyn_force;
else
force = paint_options->brush_force;
mask_buf = gimp_brush_core_get_brush_mask (GIMP_BRUSH_CORE (source_core),
coords,
GIMP_BRUSH_HARD,
hardness);
force);
/* check that all buffers are of the same size */
if (src_rect->width != gegl_buffer_get_width (paint_buffer) ||
@ -569,6 +579,6 @@ gimp_heal_motion (GimpSourceCore *source_core,
MIN (opacity, GIMP_OPACITY_OPAQUE),
gimp_context_get_opacity (context),
gimp_paint_options_get_brush_mode (paint_options),
hardness,
force,
GIMP_PAINT_INCREMENTAL);
}

View File

@ -124,7 +124,6 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
gdouble force;
gdouble dyn_force;
GimpDynamicsOutput *dyn_output = NULL;
gdouble option_force;
image = gimp_item_get_image (GIMP_ITEM (drawable));
@ -209,13 +208,11 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
coords,
paint_options,
fade_point);
force = 0.5;
option_force = paint_options->brush_force;
if (gimp_dynamics_output_is_enabled (dyn_output))
force = dyn_force;
else if (option_force != 0.5)
force = option_force;
else
force = paint_options->brush_force;
/* finally, let the brush core paste the colored area on the canvas */
gimp_brush_core_paste_canvas (brush_core, drawable,

View File

@ -248,7 +248,9 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
gdouble rate;
gdouble dynamic_rate;
gint x, y;
gdouble hardness;
gdouble force;
gdouble dyn_force;
GimpDynamicsOutput *dyn_output = NULL;
fade_point = gimp_paint_options_get_fade (paint_options, image,
paint_core->pixel_dist);
@ -316,18 +318,26 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
paint_buffer,
GEGL_RECTANGLE (0, 0, 0, 0));
hardness = gimp_dynamics_get_linear_value (dynamics,
GIMP_DYNAMICS_OUTPUT_HARDNESS,
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);
if (gimp_dynamics_output_is_enabled (dyn_output))
force = dyn_force;
else
force = paint_options->brush_force;
gimp_brush_core_replace_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
coords,
MIN (opacity, GIMP_OPACITY_OPAQUE),
gimp_context_get_opacity (context),
gimp_paint_options_get_brush_mode (paint_options),
hardness,
force,
GIMP_PAINT_INCREMENTAL);
}