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
|
@ -151,13 +151,15 @@ gimp_clone_motion (GimpSourceCore *source_core,
|
|||
gint paint_area_width,
|
||||
gint paint_area_height)
|
||||
{
|
||||
GimpPaintCore *paint_core = GIMP_PAINT_CORE (source_core);
|
||||
GimpCloneOptions *options = GIMP_CLONE_OPTIONS (paint_options);
|
||||
GimpSourceOptions *source_options = GIMP_SOURCE_OPTIONS (paint_options);
|
||||
GimpContext *context = GIMP_CONTEXT (paint_options);
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
gdouble fade_point;
|
||||
gdouble force;
|
||||
GimpPaintCore *paint_core = GIMP_PAINT_CORE (source_core);
|
||||
GimpCloneOptions *options = GIMP_CLONE_OPTIONS (paint_options);
|
||||
GimpSourceOptions *source_options = GIMP_SOURCE_OPTIONS (paint_options);
|
||||
GimpContext *context = GIMP_CONTEXT (paint_options);
|
||||
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,11 +197,19 @@ 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,
|
||||
GIMP_DYNAMICS_OUTPUT_FORCE,
|
||||
coords,
|
||||
paint_options,
|
||||
fade_point);
|
||||
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,
|
||||
|
|
|
@ -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,11 +154,19 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
|
|||
options->type,
|
||||
options->mode);
|
||||
|
||||
hardness = gimp_dynamics_get_linear_value (dynamics,
|
||||
GIMP_DYNAMICS_OUTPUT_HARDNESS,
|
||||
coords,
|
||||
paint_options,
|
||||
fade_point);
|
||||
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,
|
||||
|
@ -164,6 +174,6 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
|
|||
MIN (opacity, GIMP_OPACITY_OPAQUE),
|
||||
gimp_context_get_opacity (context),
|
||||
gimp_paint_options_get_brush_mode (paint_options),
|
||||
hardness,
|
||||
force,
|
||||
GIMP_PAINT_CONSTANT);
|
||||
}
|
||||
|
|
|
@ -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,11 +150,19 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
|
|||
else
|
||||
paint_mode = GIMP_NORMAL_MODE;
|
||||
|
||||
force = gimp_dynamics_get_linear_value (dynamics,
|
||||
GIMP_DYNAMICS_OUTPUT_FORCE,
|
||||
coords,
|
||||
paint_options,
|
||||
fade_point);
|
||||
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,
|
||||
|
|
|
@ -475,31 +475,41 @@ gimp_heal_motion (GimpSourceCore *source_core,
|
|||
gint paint_area_width,
|
||||
gint paint_area_height)
|
||||
{
|
||||
GimpPaintCore *paint_core = GIMP_PAINT_CORE (source_core);
|
||||
GimpContext *context = GIMP_CONTEXT (paint_options);
|
||||
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
GeglBuffer *src_copy;
|
||||
GeglBuffer *mask_buffer;
|
||||
const GimpTempBuf *mask_buf;
|
||||
gdouble fade_point;
|
||||
gdouble hardness;
|
||||
gint mask_off_x;
|
||||
gint mask_off_y;
|
||||
GimpPaintCore *paint_core = GIMP_PAINT_CORE (source_core);
|
||||
GimpContext *context = GIMP_CONTEXT (paint_options);
|
||||
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
GeglBuffer *src_copy;
|
||||
GeglBuffer *mask_buffer;
|
||||
const GimpTempBuf *mask_buf;
|
||||
gdouble fade_point;
|
||||
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,
|
||||
coords,
|
||||
paint_options,
|
||||
fade_point);
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -233,22 +233,24 @@ gimp_smudge_motion (GimpPaintCore *paint_core,
|
|||
GimpPaintOptions *paint_options,
|
||||
const GimpCoords *coords)
|
||||
{
|
||||
GimpSmudge *smudge = GIMP_SMUDGE (paint_core);
|
||||
GimpSmudgeOptions *options = GIMP_SMUDGE_OPTIONS (paint_options);
|
||||
GimpContext *context = GIMP_CONTEXT (paint_options);
|
||||
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
GeglBuffer *paint_buffer;
|
||||
gint paint_buffer_x;
|
||||
gint paint_buffer_y;
|
||||
gint paint_buffer_width;
|
||||
gint paint_buffer_height;
|
||||
gdouble fade_point;
|
||||
gdouble opacity;
|
||||
gdouble rate;
|
||||
gdouble dynamic_rate;
|
||||
gint x, y;
|
||||
gdouble hardness;
|
||||
GimpSmudge *smudge = GIMP_SMUDGE (paint_core);
|
||||
GimpSmudgeOptions *options = GIMP_SMUDGE_OPTIONS (paint_options);
|
||||
GimpContext *context = GIMP_CONTEXT (paint_options);
|
||||
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
GeglBuffer *paint_buffer;
|
||||
gint paint_buffer_x;
|
||||
gint paint_buffer_y;
|
||||
gint paint_buffer_width;
|
||||
gint paint_buffer_height;
|
||||
gdouble fade_point;
|
||||
gdouble opacity;
|
||||
gdouble rate;
|
||||
gdouble dynamic_rate;
|
||||
gint x, y;
|
||||
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,
|
||||
coords,
|
||||
paint_options,
|
||||
fade_point);
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue