"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "app/tools/gimpforegroundselecttool.c" between
gimp-2.10.10.tar.bz2 and gimp-2.10.12.tar.bz2

About: GIMP - The GNU Image Manipulation Program.

gimpforegroundselecttool.c  (gimp-2.10.10.tar.bz2):gimpforegroundselecttool.c  (gimp-2.10.12.tar.bz2)
skipping to change at line 139 skipping to change at line 139
static gboolean gimp_foreground_select_tool_undo (GimpTool *tool , static gboolean gimp_foreground_select_tool_undo (GimpTool *tool ,
GimpDisplay *disp lay); GimpDisplay *disp lay);
static gboolean gimp_foreground_select_tool_redo (GimpTool *tool , static gboolean gimp_foreground_select_tool_redo (GimpTool *tool ,
GimpDisplay *disp lay); GimpDisplay *disp lay);
static void gimp_foreground_select_tool_options_notify (GimpTool *tool , static void gimp_foreground_select_tool_options_notify (GimpTool *tool ,
GimpToolOptions *opti ons, GimpToolOptions *opti ons,
const GParamSpec *pspe c); const GParamSpec *pspe c);
static void gimp_foreground_select_tool_draw (GimpDrawTool *draw _tool); static void gimp_foreground_select_tool_draw (GimpDrawTool *draw _tool);
static void gimp_foreground_select_tool_select (GimpFreeSelectTool *fr static void gimp_foreground_select_tool_confirm (GimpPolygonSelectTool
ee_sel, *poly_sel,
GimpDisplay *di GimpDisplay
splay, *display);
const GimpVector2 *po
ints,
gint n_
points);
static void gimp_foreground_select_tool_halt (GimpForegroundSelectTo ol *fg_select); static void gimp_foreground_select_tool_halt (GimpForegroundSelectTo ol *fg_select);
static void gimp_foreground_select_tool_commit (GimpForegroundSelectTo ol *fg_select); static void gimp_foreground_select_tool_commit (GimpForegroundSelectTo ol *fg_select);
static void gimp_foreground_select_tool_set_trimap (GimpForegroundSelectTo ol *fg_select); static void gimp_foreground_select_tool_set_trimap (GimpForegroundSelectTo ol *fg_select);
static void gimp_foreground_select_tool_set_preview (GimpForegroundSelectTo ol *fg_select); static void gimp_foreground_select_tool_set_preview (GimpForegroundSelectTo ol *fg_select);
static void gimp_foreground_select_tool_preview (GimpForegroundSelectTo ol *fg_select); static void gimp_foreground_select_tool_preview (GimpForegroundSelectTo ol *fg_select);
static void gimp_foreground_select_tool_stroke_paint (GimpForegroundSelectTo ol *fg_select); static void gimp_foreground_select_tool_stroke_paint (GimpForegroundSelectTo ol *fg_select);
static void gimp_foreground_select_tool_cancel_paint (GimpForegroundSelectTo ol *fg_select); static void gimp_foreground_select_tool_cancel_paint (GimpForegroundSelectTo ol *fg_select);
skipping to change at line 171 skipping to change at line 169
static StrokeUndo * gimp_foreground_select_undo_new (GeglBuffer *trimap, static StrokeUndo * gimp_foreground_select_undo_new (GeglBuffer *trimap,
GArray *stroke, GArray *stroke,
GimpMattingDrawMode draw_mode, GimpMattingDrawMode draw_mode,
gint stroke_width); gint stroke_width);
static void gimp_foreground_select_undo_pop (StrokeUndo *undo, static void gimp_foreground_select_undo_pop (StrokeUndo *undo,
GeglBuffer *trimap); GeglBuffer *trimap);
static void gimp_foreground_select_undo_free (StrokeUndo *undo); static void gimp_foreground_select_undo_free (StrokeUndo *undo);
G_DEFINE_TYPE (GimpForegroundSelectTool, gimp_foreground_select_tool, G_DEFINE_TYPE (GimpForegroundSelectTool, gimp_foreground_select_tool,
GIMP_TYPE_FREE_SELECT_TOOL) GIMP_TYPE_POLYGON_SELECT_TOOL)
#define parent_class gimp_foreground_select_tool_parent_class #define parent_class gimp_foreground_select_tool_parent_class
void void
gimp_foreground_select_tool_register (GimpToolRegisterCallback callback, gimp_foreground_select_tool_register (GimpToolRegisterCallback callback,
gpointer data) gpointer data)
{ {
(* callback) (GIMP_TYPE_FOREGROUND_SELECT_TOOL, (* callback) (GIMP_TYPE_FOREGROUND_SELECT_TOOL,
GIMP_TYPE_FOREGROUND_SELECT_OPTIONS, GIMP_TYPE_FOREGROUND_SELECT_OPTIONS,
gimp_foreground_select_options_gui, gimp_foreground_select_options_gui,
skipping to change at line 196 skipping to change at line 194
_("Foreground Select Tool: Select a region containing foreground objects"), _("Foreground Select Tool: Select a region containing foreground objects"),
N_("F_oreground Select"), NULL, N_("F_oreground Select"), NULL,
NULL, GIMP_HELP_TOOL_FOREGROUND_SELECT, NULL, GIMP_HELP_TOOL_FOREGROUND_SELECT,
GIMP_ICON_TOOL_FOREGROUND_SELECT, GIMP_ICON_TOOL_FOREGROUND_SELECT,
data); data);
} }
static void static void
gimp_foreground_select_tool_class_init (GimpForegroundSelectToolClass *klass) gimp_foreground_select_tool_class_init (GimpForegroundSelectToolClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass); GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass); GimpDrawToolClass *draw_tool_class = GIMP_DRAW_TOOL_CLASS (klass);
GimpFreeSelectToolClass *free_select_tool_class; GimpPolygonSelectToolClass *polygon_select_tool_class;
free_select_tool_class = GIMP_FREE_SELECT_TOOL_CLASS (klass); polygon_select_tool_class = GIMP_POLYGON_SELECT_TOOL_CLASS (klass);
object_class->finalize = gimp_foreground_select_tool_finalize; object_class->finalize = gimp_foreground_select_tool_finalize;
tool_class->initialize = gimp_foreground_select_tool_initialize; tool_class->initialize = gimp_foreground_select_tool_initialize;
tool_class->control = gimp_foreground_select_tool_control; tool_class->control = gimp_foreground_select_tool_control;
tool_class->button_press = gimp_foreground_select_tool_button_press; tool_class->button_press = gimp_foreground_select_tool_button_press;
tool_class->button_release = gimp_foreground_select_tool_button_release; tool_class->button_release = gimp_foreground_select_tool_button_releas
tool_class->motion = gimp_foreground_select_tool_motion; e;
tool_class->key_press = gimp_foreground_select_tool_key_press; tool_class->motion = gimp_foreground_select_tool_motion;
tool_class->modifier_key = gimp_foreground_select_tool_modifier_key; tool_class->key_press = gimp_foreground_select_tool_key_press;
tool_class->active_modifier_key = gimp_foreground_select_tool_active_modifier_ tool_class->modifier_key = gimp_foreground_select_tool_modifier_key;
key; tool_class->active_modifier_key = gimp_foreground_select_tool_active_modifi
tool_class->oper_update = gimp_foreground_select_tool_oper_update; er_key;
tool_class->cursor_update = gimp_foreground_select_tool_cursor_update; tool_class->oper_update = gimp_foreground_select_tool_oper_update;
tool_class->can_undo = gimp_foreground_select_tool_can_undo; tool_class->cursor_update = gimp_foreground_select_tool_cursor_update
tool_class->can_redo = gimp_foreground_select_tool_can_redo; ;
tool_class->undo = gimp_foreground_select_tool_undo; tool_class->can_undo = gimp_foreground_select_tool_can_undo;
tool_class->redo = gimp_foreground_select_tool_redo; tool_class->can_redo = gimp_foreground_select_tool_can_redo;
tool_class->options_notify = gimp_foreground_select_tool_options_notify; tool_class->undo = gimp_foreground_select_tool_undo;
tool_class->redo = gimp_foreground_select_tool_redo;
tool_class->options_notify = gimp_foreground_select_tool_options_notif
y;
draw_tool_class->draw = gimp_foreground_select_tool_draw; draw_tool_class->draw = gimp_foreground_select_tool_draw;
free_select_tool_class->select = gimp_foreground_select_tool_select; polygon_select_tool_class->confirm = gimp_foreground_select_tool_confirm;
} }
static void static void
gimp_foreground_select_tool_init (GimpForegroundSelectTool *fg_select) gimp_foreground_select_tool_init (GimpForegroundSelectTool *fg_select)
{ {
GimpTool *tool = GIMP_TOOL (fg_select); GimpTool *tool = GIMP_TOOL (fg_select);
gimp_tool_control_set_motion_mode (tool->control, GIMP_MOTION_MODE_EXACT); gimp_tool_control_set_motion_mode (tool->control, GIMP_MOTION_MODE_EXACT);
gimp_tool_control_set_scroll_lock (tool->control, FALSE); gimp_tool_control_set_scroll_lock (tool->control, FALSE);
gimp_tool_control_set_preserve (tool->control, FALSE); gimp_tool_control_set_preserve (tool->control, FALSE);
skipping to change at line 429 skipping to change at line 427
GdkModifierType state, GdkModifierType state,
GimpButtonReleaseType release_type, GimpButtonReleaseType release_type,
GimpDisplay *display) GimpDisplay *display)
{ {
GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (tool); GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (tool);
if (fg_select->state == MATTING_STATE_FREE_SELECT) if (fg_select->state == MATTING_STATE_FREE_SELECT)
{ {
GIMP_TOOL_CLASS (parent_class)->button_release (tool, coords, time, state, GIMP_TOOL_CLASS (parent_class)->button_release (tool, coords, time, state,
release_type, display); release_type, display);
/* see comment in gimp_foreground_select_tool_select() */
if (fg_select->in_double_click)
{
gimp_foreground_select_tool_set_trimap (fg_select);
fg_select->in_double_click = FALSE;
}
} }
else else
{ {
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool)); gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
gimp_tool_control_halt (tool->control); gimp_tool_control_halt (tool->control);
if (release_type == GIMP_BUTTON_RELEASE_CANCEL) if (release_type == GIMP_BUTTON_RELEASE_CANCEL)
{ {
gimp_foreground_select_tool_cancel_paint (fg_select); gimp_foreground_select_tool_cancel_paint (fg_select);
skipping to change at line 609 skipping to change at line 599
options = GIMP_FOREGROUND_SELECT_TOOL_GET_OPTIONS (fg_select); options = GIMP_FOREGROUND_SELECT_TOOL_GET_OPTIONS (fg_select);
GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, proximity, GIMP_TOOL_CLASS (parent_class)->oper_update (tool, coords, state, proximity,
display); display);
if (fg_select->state == MATTING_STATE_FREE_SELECT) if (fg_select->state == MATTING_STATE_FREE_SELECT)
{ {
if (GIMP_SELECTION_TOOL (tool)->function == SELECTION_SELECT) if (GIMP_SELECTION_TOOL (tool)->function == SELECTION_SELECT)
{ {
if (gimp_free_select_tool_get_n_points (GIMP_FREE_SELECT_TOOL (tool)) gint n_points;
> 2)
gimp_polygon_select_tool_get_points (GIMP_POLYGON_SELECT_TOOL (tool),
NULL, &n_points);
if (n_points > 2)
{ {
status_mode = _("Roughly outline the object to extract"); status_mode = _("Roughly outline the object to extract");
status_stage = _("press Enter to refine."); status_stage = _("press Enter to refine.");
} }
else else
{ {
status_stage = _("Roughly outline the object to extract"); status_stage = _("Roughly outline the object to extract");
} }
} }
} }
skipping to change at line 897 skipping to change at line 892
if (x > FAR_OUTSIDE && y > FAR_OUTSIDE) if (x > FAR_OUTSIDE && y > FAR_OUTSIDE)
gimp_draw_tool_add_arc (draw_tool, FALSE, gimp_draw_tool_add_arc (draw_tool, FALSE,
x - radius, y - radius, x - radius, y - radius,
2 * radius, 2 * radius, 2 * radius, 2 * radius,
0.0, 2.0 * G_PI); 0.0, 2.0 * G_PI);
} }
} }
static void static void
gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel, gimp_foreground_select_tool_confirm (GimpPolygonSelectTool *poly_sel,
GimpDisplay *display, GimpDisplay *display)
const GimpVector2 *points,
gint n_points)
{ {
GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (free_sel); GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (poly_sel);
GimpImage *image = gimp_display_get_image (display); GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image); GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (drawable && fg_select->state == MATTING_STATE_FREE_SELECT) if (drawable && fg_select->state == MATTING_STATE_FREE_SELECT)
{ {
GimpScanConvert *scan_convert = gimp_scan_convert_new (); GimpScanConvert *scan_convert = gimp_scan_convert_new ();
const GimpVector2 *points;
gint n_points;
gimp_polygon_select_tool_get_points (poly_sel, &points, &n_points);
gimp_scan_convert_add_polyline (scan_convert, n_points, points, TRUE); gimp_scan_convert_add_polyline (scan_convert, n_points, points, TRUE);
fg_select->trimap = fg_select->trimap =
gegl_buffer_new (GEGL_RECTANGLE (0, 0, gegl_buffer_new (GEGL_RECTANGLE (0, 0,
gimp_image_get_width (image), gimp_image_get_width (image),
gimp_image_get_height (image)), gimp_image_get_height (image)),
gimp_image_get_mask_format (image)); gimp_image_get_mask_format (image));
gimp_scan_convert_render_value (scan_convert, fg_select->trimap, gimp_scan_convert_render_value (scan_convert, fg_select->trimap,
0, 0, 0.5); 0, 0, 0.5);
gimp_scan_convert_free (scan_convert); gimp_scan_convert_free (scan_convert);
if (! gimp_tool_control_is_active (GIMP_TOOL (fg_select)->control)) gimp_foreground_select_tool_set_trimap (fg_select);
{
gimp_foreground_select_tool_set_trimap (fg_select);
}
else
{
/* if the tool is active we got here by double click
* detected in the parent class. We can't switch to trimap
* mode in the middle of a click. Set a flag and let
* button_release() forward the release to the parent class
* so it can conclude its operation
*/
fg_select->in_double_click = TRUE;
}
} }
} }
static void static void
gimp_foreground_select_tool_halt (GimpForegroundSelectTool *fg_select) gimp_foreground_select_tool_halt (GimpForegroundSelectTool *fg_select)
{ {
GimpTool *tool = GIMP_TOOL (fg_select); GimpTool *tool = GIMP_TOOL (fg_select);
g_clear_object (&fg_select->trimap); g_clear_object (&fg_select->trimap);
g_clear_object (&fg_select->mask); g_clear_object (&fg_select->mask);
skipping to change at line 1030 skipping to change at line 1014
gimp_foreground_select_tool_set_trimap (GimpForegroundSelectTool *fg_select) gimp_foreground_select_tool_set_trimap (GimpForegroundSelectTool *fg_select)
{ {
GimpTool *tool = GIMP_TOOL (fg_select); GimpTool *tool = GIMP_TOOL (fg_select);
GimpForegroundSelectOptions *options; GimpForegroundSelectOptions *options;
GimpRGB color; GimpRGB color;
g_return_if_fail (fg_select->trimap != NULL); g_return_if_fail (fg_select->trimap != NULL);
options = GIMP_FOREGROUND_SELECT_TOOL_GET_OPTIONS (tool); options = GIMP_FOREGROUND_SELECT_TOOL_GET_OPTIONS (tool);
gimp_free_select_tool_halt (GIMP_FREE_SELECT_TOOL (fg_select)); gimp_polygon_select_tool_halt (GIMP_POLYGON_SELECT_TOOL (fg_select));
gimp_foreground_select_options_get_mask_color (options, &color); gimp_foreground_select_options_get_mask_color (options, &color);
gimp_display_shell_set_mask (gimp_display_get_shell (tool->display), gimp_display_shell_set_mask (gimp_display_get_shell (tool->display),
fg_select->trimap, 0, 0, &color, TRUE); fg_select->trimap, 0, 0, &color, TRUE);
gimp_tool_control_set_tool_cursor (tool->control, gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_PAINTBRUSH); GIMP_TOOL_CURSOR_PAINTBRUSH);
gimp_tool_control_set_toggle_tool_cursor (tool->control, gimp_tool_control_set_toggle_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_PAINTBRUSH); GIMP_TOOL_CURSOR_PAINTBRUSH);
 End of changes. 12 change blocks. 
67 lines changed or deleted 51 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)