app: add incremental mode to the Dodge/Burn tool

Add an "Incremental" option to the Dodge/Burn tool, which,
similarly to the Paintbrush, Pencil, and Eraser tools, applies the
effect incrementally as the pointer moves.
This commit is contained in:
Ell
2019-04-17 09:55:35 -04:00
parent 6532a7e529
commit 83184d1626
2 changed files with 11 additions and 3 deletions

View File

@ -116,6 +116,7 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
GimpContext *context = GIMP_CONTEXT (paint_options); GimpContext *context = GIMP_CONTEXT (paint_options);
GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics; GimpDynamics *dynamics = GIMP_BRUSH_CORE (paint_core)->dynamics;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable)); GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GeglBuffer *src_buffer;
GeglBuffer *paint_buffer; GeglBuffer *paint_buffer;
gint paint_buffer_x; gint paint_buffer_x;
gint paint_buffer_y; gint paint_buffer_y;
@ -140,6 +141,11 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
if (opacity == 0.0) if (opacity == 0.0)
return; return;
if (paint_options->application_mode == GIMP_PAINT_CONSTANT)
src_buffer = gimp_paint_core_get_orig_image (paint_core);
else
src_buffer = gimp_drawable_get_buffer (drawable);
gimp_brush_core_eval_transform_dynamics (GIMP_BRUSH_CORE (paint_core), gimp_brush_core_eval_transform_dynamics (GIMP_BRUSH_CORE (paint_core),
drawable, drawable,
paint_options, paint_options,
@ -165,7 +171,7 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
paint_height); paint_height);
/* DodgeBurn the region */ /* DodgeBurn the region */
gimp_gegl_dodgeburn (gimp_paint_core_get_orig_image (paint_core), gimp_gegl_dodgeburn (src_buffer,
GEGL_RECTANGLE (paint_buffer_x, GEGL_RECTANGLE (paint_buffer_x,
paint_buffer_y, paint_buffer_y,
gegl_buffer_get_width (paint_buffer), gegl_buffer_get_width (paint_buffer),
@ -192,6 +198,7 @@ gimp_dodge_burn_motion (GimpPaintCore *paint_core,
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),
force, force,
GIMP_PAINT_CONSTANT, op); paint_options->application_mode,
op);
} }
} }

View File

@ -259,7 +259,8 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
/* the "incremental" toggle */ /* the "incremental" toggle */
if (tool_type == GIMP_TYPE_PENCIL_TOOL || if (tool_type == GIMP_TYPE_PENCIL_TOOL ||
tool_type == GIMP_TYPE_PAINTBRUSH_TOOL || tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
tool_type == GIMP_TYPE_ERASER_TOOL) tool_type == GIMP_TYPE_ERASER_TOOL ||
tool_type == GIMP_TYPE_DODGE_BURN_TOOL)
{ {
GtkWidget *button; GtkWidget *button;