Commit 93bf78b8 authored by Ell's avatar Ell Committed by Michael Natterer

app: Add diagonal_neighbors parameter to...

...gimp_pickable_contiguous_region_by_seed(), in preperation
for adding a similar option to the relevant tools.

When this parameter is TRUE, all eight neighbors of each pixel
are considered when calculating the resulting region, instead
of just the four orthogonal ones.

This commit also modifies all callers to pass FALSE for this
parameter, to retain the current behavior.
parent ca9ca906
......@@ -519,6 +519,7 @@ gimp_channel_select_fuzzy (GimpChannel *channel,
threshold,
select_transparent,
select_criterion,
FALSE /* no diagonal neighbors */,
x, y);
if (! sample_merged)
......
......@@ -158,6 +158,7 @@ gimp_drawable_bucket_fill_internal (GimpDrawable *drawable,
threshold,
fill_transparent,
fill_criterion,
FALSE /* no diagonal neighbors */,
(gint) x,
(gint) y);
......
......@@ -74,6 +74,7 @@ static void find_contiguous_region (GeglBuffer *src_buffer,
GimpSelectCriterion select_criterion,
gboolean antialias,
gfloat threshold,
gboolean diagonal_neighbors,
gint x,
gint y,
const gfloat *col);
......@@ -87,6 +88,7 @@ gimp_pickable_contiguous_region_by_seed (GimpPickable *pickable,
gfloat threshold,
gboolean select_transparent,
GimpSelectCriterion select_criterion,
gboolean diagonal_neighbors,
gint x,
gint y)
{
......@@ -138,7 +140,7 @@ gimp_pickable_contiguous_region_by_seed (GimpPickable *pickable,
find_contiguous_region (src_buffer, mask_buffer,
format, n_components, has_alpha,
select_transparent, select_criterion,
antialias, threshold,
antialias, threshold, diagonal_neighbors,
x, y, start_col);
GIMP_TIMER_END("foo");
......@@ -496,6 +498,7 @@ find_contiguous_region (GeglBuffer *src_buffer,
GimpSelectCriterion select_criterion,
gboolean antialias,
gfloat threshold,
gboolean diagonal_neighbors,
gint x,
gint y,
const gfloat *col)
......@@ -547,6 +550,15 @@ find_contiguous_region (GeglBuffer *src_buffer,
row))
continue;
if (diagonal_neighbors)
{
if (new_start >= 0)
new_start--;
if (new_end < gegl_buffer_get_width (src_buffer))
new_end++;
}
if (y + 1 < gegl_buffer_get_height (src_buffer))
{
g_queue_push_tail (coord_stack, GINT_TO_POINTER (y + 1));
......
......@@ -24,6 +24,7 @@ GeglBuffer * gimp_pickable_contiguous_region_by_seed (GimpPickable *p
gfloat threshold,
gboolean select_transparent,
GimpSelectCriterion select_criterion,
gboolean diagonal_neighbors,
gint x,
gint y);
......
......@@ -127,5 +127,6 @@ gimp_fuzzy_select_tool_get_mask (GimpRegionSelectTool *region_select,
options->threshold / 255.0,
options->select_transparent,
options->select_criterion,
FALSE /* no diagonal neighbors */,
x, y);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment