Paint Select tool: apply a threshold on the image mask before triggering...

...the automatic expansion to simplify mask handling in the gegl
paint-select operation.
This commit is contained in:
Thomas Manni 2021-01-10 15:28:46 +01:00
parent 4d0ba4392b
commit 7d753c6f54
2 changed files with 8 additions and 1 deletions

View File

@ -460,10 +460,12 @@ gimp_paint_select_tool_motion (GimpTool *tool,
if (options->mode == GIMP_PAINT_SELECT_MODE_ADD)
{
gegl_node_set (ps_tool->ps_node, "mode", 0, NULL);
gegl_node_set (ps_tool->threshold_node, "value", 0.99, NULL);
}
else
{
gegl_node_set (ps_tool->ps_node, "mode", 1, NULL);
gegl_node_set (ps_tool->threshold_node, "value", 0.01, NULL);
}
gegl_node_set (ps_tool->render_node, "buffer", &result, NULL);
@ -776,6 +778,10 @@ gimp_paint_select_tool_create_graph (GimpPaintSelectTool *ps_tool)
"height", (gdouble) gegl_buffer_get_height (ps_tool->drawable),
NULL);
ps_tool->threshold_node = gegl_node_new_child (ps_tool->graph,
"operation", "gegl:threshold",
NULL);
if (ps_tool->drawable_off_x || ps_tool->drawable_off_y)
{
translate = gegl_node_new_child (ps_tool->graph,
@ -805,7 +811,7 @@ gimp_paint_select_tool_create_graph (GimpPaintSelectTool *ps_tool)
NULL);
gegl_node_link (m, crop);
gegl_node_link_many (m, ps_tool->threshold_node, crop, NULL);
if (translate)
gegl_node_link_many (crop, translate, ps_tool->ps_node, ps_tool->render_node, NULL);

View File

@ -49,6 +49,7 @@ struct _GimpPaintSelectTool
GeglNode *graph;
GeglNode *ps_node;
GeglNode *threshold_node;
GeglNode *render_node;
GimpVector2 last_pos;