mirror of https://github.com/GNOME/gimp.git
app: make all tools capable of dynamic force respect the options slider
This commit is contained in:
parent
7c27d9588a
commit
ace4234a98
|
@ -158,6 +158,8 @@ gimp_clone_motion (GimpSourceCore *source_core,
|
||||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||||
gdouble fade_point;
|
gdouble fade_point;
|
||||||
gdouble force;
|
gdouble force;
|
||||||
|
gdouble dyn_force;
|
||||||
|
GimpDynamicsOutput *dyn_output = NULL;
|
||||||
|
|
||||||
if (gimp_source_core_use_source (source_core, source_options))
|
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,
|
fade_point = gimp_paint_options_get_fade (paint_options, image,
|
||||||
paint_core->pixel_dist);
|
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,
|
GIMP_DYNAMICS_OUTPUT_FORCE,
|
||||||
coords,
|
coords,
|
||||||
paint_options,
|
paint_options,
|
||||||
fade_point);
|
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,
|
gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
|
||||||
coords,
|
coords,
|
||||||
MIN (opacity, GIMP_OPACITY_OPAQUE),
|
MIN (opacity, GIMP_OPACITY_OPAQUE),
|
||||||
|
|
|
@ -120,7 +120,9 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
|
||||||
gint paint_buffer_y;
|
gint paint_buffer_y;
|
||||||
gdouble fade_point;
|
gdouble fade_point;
|
||||||
gdouble opacity;
|
gdouble opacity;
|
||||||
gdouble hardness;
|
gdouble force;
|
||||||
|
gdouble dyn_force;
|
||||||
|
GimpDynamicsOutput *dyn_output = NULL;
|
||||||
|
|
||||||
fade_point = gimp_paint_options_get_fade (paint_options, image,
|
fade_point = gimp_paint_options_get_fade (paint_options, image,
|
||||||
paint_core->pixel_dist);
|
paint_core->pixel_dist);
|
||||||
|
@ -152,18 +154,26 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
|
||||||
options->type,
|
options->type,
|
||||||
options->mode);
|
options->mode);
|
||||||
|
|
||||||
hardness = gimp_dynamics_get_linear_value (dynamics,
|
dyn_output = gimp_dynamics_get_output (dynamics,
|
||||||
GIMP_DYNAMICS_OUTPUT_HARDNESS,
|
GIMP_DYNAMICS_OUTPUT_FORCE);
|
||||||
|
|
||||||
|
dyn_force = gimp_dynamics_get_linear_value (dynamics,
|
||||||
|
GIMP_DYNAMICS_OUTPUT_FORCE,
|
||||||
coords,
|
coords,
|
||||||
paint_options,
|
paint_options,
|
||||||
fade_point);
|
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 */
|
/* Replace the newly dodgedburned area (paint_area) to the image */
|
||||||
gimp_brush_core_replace_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
|
gimp_brush_core_replace_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
|
||||||
coords,
|
coords,
|
||||||
MIN (opacity, GIMP_OPACITY_OPAQUE),
|
MIN (opacity, GIMP_OPACITY_OPAQUE),
|
||||||
gimp_context_get_opacity (context),
|
gimp_context_get_opacity (context),
|
||||||
gimp_paint_options_get_brush_mode (paint_options),
|
gimp_paint_options_get_brush_mode (paint_options),
|
||||||
hardness,
|
force,
|
||||||
GIMP_PAINT_CONSTANT);
|
GIMP_PAINT_CONSTANT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,6 +116,8 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
|
||||||
GimpRGB background;
|
GimpRGB background;
|
||||||
GeglColor *color;
|
GeglColor *color;
|
||||||
gdouble force;
|
gdouble force;
|
||||||
|
gdouble dyn_force;
|
||||||
|
GimpDynamicsOutput *dyn_output = NULL;
|
||||||
|
|
||||||
fade_point = gimp_paint_options_get_fade (paint_options, image,
|
fade_point = gimp_paint_options_get_fade (paint_options, image,
|
||||||
paint_core->pixel_dist);
|
paint_core->pixel_dist);
|
||||||
|
@ -148,12 +150,20 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
|
||||||
else
|
else
|
||||||
paint_mode = GIMP_NORMAL_MODE;
|
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,
|
GIMP_DYNAMICS_OUTPUT_FORCE,
|
||||||
coords,
|
coords,
|
||||||
paint_options,
|
paint_options,
|
||||||
fade_point);
|
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,
|
gimp_brush_core_paste_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
|
||||||
coords,
|
coords,
|
||||||
MIN (opacity, GIMP_OPACITY_OPAQUE),
|
MIN (opacity, GIMP_OPACITY_OPAQUE),
|
||||||
|
|
|
@ -483,23 +483,33 @@ gimp_heal_motion (GimpSourceCore *source_core,
|
||||||
GeglBuffer *mask_buffer;
|
GeglBuffer *mask_buffer;
|
||||||
const GimpTempBuf *mask_buf;
|
const GimpTempBuf *mask_buf;
|
||||||
gdouble fade_point;
|
gdouble fade_point;
|
||||||
gdouble hardness;
|
gdouble force;
|
||||||
gint mask_off_x;
|
gint mask_off_x;
|
||||||
gint mask_off_y;
|
gint mask_off_y;
|
||||||
|
gdouble dyn_force;
|
||||||
|
GimpDynamicsOutput *dyn_output = NULL;
|
||||||
|
|
||||||
fade_point = gimp_paint_options_get_fade (paint_options, image,
|
fade_point = gimp_paint_options_get_fade (paint_options, image,
|
||||||
paint_core->pixel_dist);
|
paint_core->pixel_dist);
|
||||||
|
|
||||||
hardness = gimp_dynamics_get_linear_value (dynamics,
|
dyn_output = gimp_dynamics_get_output (dynamics,
|
||||||
GIMP_DYNAMICS_OUTPUT_HARDNESS,
|
GIMP_DYNAMICS_OUTPUT_FORCE);
|
||||||
|
|
||||||
|
dyn_force = gimp_dynamics_get_linear_value (dynamics,
|
||||||
|
GIMP_DYNAMICS_OUTPUT_FORCE,
|
||||||
coords,
|
coords,
|
||||||
paint_options,
|
paint_options,
|
||||||
fade_point);
|
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),
|
mask_buf = gimp_brush_core_get_brush_mask (GIMP_BRUSH_CORE (source_core),
|
||||||
coords,
|
coords,
|
||||||
GIMP_BRUSH_HARD,
|
GIMP_BRUSH_HARD,
|
||||||
hardness);
|
force);
|
||||||
|
|
||||||
/* check that all buffers are of the same size */
|
/* check that all buffers are of the same size */
|
||||||
if (src_rect->width != gegl_buffer_get_width (paint_buffer) ||
|
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),
|
MIN (opacity, GIMP_OPACITY_OPAQUE),
|
||||||
gimp_context_get_opacity (context),
|
gimp_context_get_opacity (context),
|
||||||
gimp_paint_options_get_brush_mode (paint_options),
|
gimp_paint_options_get_brush_mode (paint_options),
|
||||||
hardness,
|
force,
|
||||||
GIMP_PAINT_INCREMENTAL);
|
GIMP_PAINT_INCREMENTAL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,6 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
|
||||||
gdouble force;
|
gdouble force;
|
||||||
gdouble dyn_force;
|
gdouble dyn_force;
|
||||||
GimpDynamicsOutput *dyn_output = NULL;
|
GimpDynamicsOutput *dyn_output = NULL;
|
||||||
gdouble option_force;
|
|
||||||
|
|
||||||
image = gimp_item_get_image (GIMP_ITEM (drawable));
|
image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||||
|
|
||||||
|
@ -209,13 +208,11 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
|
||||||
coords,
|
coords,
|
||||||
paint_options,
|
paint_options,
|
||||||
fade_point);
|
fade_point);
|
||||||
force = 0.5;
|
|
||||||
option_force = paint_options->brush_force;
|
|
||||||
|
|
||||||
if (gimp_dynamics_output_is_enabled (dyn_output))
|
if (gimp_dynamics_output_is_enabled (dyn_output))
|
||||||
force = dyn_force;
|
force = dyn_force;
|
||||||
else if (option_force != 0.5)
|
else
|
||||||
force = option_force;
|
force = paint_options->brush_force;
|
||||||
|
|
||||||
/* finally, let the brush core paste the colored area on the canvas */
|
/* finally, let the brush core paste the colored area on the canvas */
|
||||||
gimp_brush_core_paste_canvas (brush_core, drawable,
|
gimp_brush_core_paste_canvas (brush_core, drawable,
|
||||||
|
|
|
@ -248,7 +248,9 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
|
||||||
gdouble rate;
|
gdouble rate;
|
||||||
gdouble dynamic_rate;
|
gdouble dynamic_rate;
|
||||||
gint x, y;
|
gint x, y;
|
||||||
gdouble hardness;
|
gdouble force;
|
||||||
|
gdouble dyn_force;
|
||||||
|
GimpDynamicsOutput *dyn_output = NULL;
|
||||||
|
|
||||||
fade_point = gimp_paint_options_get_fade (paint_options, image,
|
fade_point = gimp_paint_options_get_fade (paint_options, image,
|
||||||
paint_core->pixel_dist);
|
paint_core->pixel_dist);
|
||||||
|
@ -316,18 +318,26 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
|
||||||
paint_buffer,
|
paint_buffer,
|
||||||
GEGL_RECTANGLE (0, 0, 0, 0));
|
GEGL_RECTANGLE (0, 0, 0, 0));
|
||||||
|
|
||||||
hardness = gimp_dynamics_get_linear_value (dynamics,
|
dyn_output = gimp_dynamics_get_output (dynamics,
|
||||||
GIMP_DYNAMICS_OUTPUT_HARDNESS,
|
GIMP_DYNAMICS_OUTPUT_FORCE);
|
||||||
|
|
||||||
|
dyn_force = gimp_dynamics_get_linear_value (dynamics,
|
||||||
|
GIMP_DYNAMICS_OUTPUT_FORCE,
|
||||||
coords,
|
coords,
|
||||||
paint_options,
|
paint_options,
|
||||||
fade_point);
|
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,
|
gimp_brush_core_replace_canvas (GIMP_BRUSH_CORE (paint_core), drawable,
|
||||||
coords,
|
coords,
|
||||||
MIN (opacity, GIMP_OPACITY_OPAQUE),
|
MIN (opacity, GIMP_OPACITY_OPAQUE),
|
||||||
gimp_context_get_opacity (context),
|
gimp_context_get_opacity (context),
|
||||||
gimp_paint_options_get_brush_mode (paint_options),
|
gimp_paint_options_get_brush_mode (paint_options),
|
||||||
hardness,
|
force,
|
||||||
GIMP_PAINT_INCREMENTAL);
|
GIMP_PAINT_INCREMENTAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue