Hi,
I’m looking for the correct way to undo the painting event, the painting done, prior to GIMP_PAINT_STATE_FINISH:
So that clicking and drawing is automatically undone. This allows me to rework the stroke with knowledge of the intended stroke. Attempted to do this, so do that, but first clear the attempt.
in gimppaintbrush.c
static void
gimp_paintbrush_paint (GimpPaintCore *paint_core,
GList *drawables,
GimpPaintOptions *paint_options,
GimpSymmetry *sym,
GimpPaintState paint_state,
guint32 time)
{
GimpPaintbrush *paintbrush = GIMP_PAINTBRUSH (paint_core);
g_return_if_fail (g_list_length (drawables) == 1);
switch (paint_state)
{
case GIMP_PAINT_STATE_INIT:
{
GimpRGB color;
for (GList *iter = drawables; iter; iter = iter->next)
if (GIMP_PAINTBRUSH_GET_CLASS (paintbrush)->get_color_history_color &&
GIMP_PAINTBRUSH_GET_CLASS (paintbrush)->get_color_history_color (paintbrush,
iter->data,
paint_options,
&color))
{
GimpContext *context = GIMP_CONTEXT (paint_options);
gimp_palettes_add_color_history (context->gimp, &color);
}
}
break;
case GIMP_PAINT_STATE_MOTION:
for (GList *iter = drawables; iter; iter = iter->next)
_gimp_paintbrush_motion (paint_core, iter->data, paint_options,
sym, GIMP_OPACITY_OPAQUE);
break;
case GIMP_PAINT_STATE_FINISH:
g_clear_weak_pointer (&paintbrush->paint_buffer);
g_clear_pointer (&paintbrush->paint_pixmap, gimp_temp_buf_unref);
break;
}
}