Commit 0349b897 authored by Michael Natterer's avatar Michael Natterer 😴

app: rename gimpimage-contiguous-region.[ch] to gimppickable-....[ch]

The functions don't need to know about sample_merged, in fact they
used the boolean only to either use the passed image or drawable and
otherwise ran the same code. The sample_merged logic belongs into
their callers (and sometimes not even there).
parent 5db796e1
......@@ -203,8 +203,6 @@ libappcore_a_sources = \
gimpimage-arrange.h \
gimpimage-colormap.c \
gimpimage-colormap.h \
gimpimage-contiguous-region.c \
gimpimage-contiguous-region.h \
gimpimage-convert-fsdither.h \
gimpimage-convert-data.h \
gimpimage-convert-precision.c \
......@@ -327,6 +325,8 @@ libappcore_a_sources = \
gimppickable.h \
gimppickable-auto-shrink.c \
gimppickable-auto-shrink.h \
gimppickable-contiguous-region.c \
gimppickable-contiguous-region.h \
gimpprogress.c \
gimpprogress.h \
gimpprojectable.c \
......
......@@ -34,7 +34,8 @@
#include "gimpchannel.h"
#include "gimpchannel-select.h"
#include "gimpchannel-combine.h"
#include "gimpimage-contiguous-region.h"
#include "gimppickable.h"
#include "gimppickable-contiguous-region.h"
#include "gimpscanconvert.h"
#include "vectors/gimpstroke.h"
......@@ -498,25 +499,26 @@ gimp_channel_select_fuzzy (GimpChannel *channel,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
GimpItem *item;
GeglBuffer *add_on;
gint add_on_x = 0;
gint add_on_y = 0;
GimpPickable *pickable;
GeglBuffer *add_on;
gint add_on_x = 0;
gint add_on_y = 0;
g_return_if_fail (GIMP_IS_CHANNEL (channel));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)));
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
item = GIMP_ITEM (channel);
if (sample_merged)
pickable = GIMP_PICKABLE (gimp_item_get_image (GIMP_ITEM (drawable)));
else
pickable = GIMP_PICKABLE (drawable);
add_on = gimp_image_contiguous_region_by_seed (gimp_item_get_image (item),
drawable,
sample_merged,
antialias,
threshold,
select_transparent,
select_criterion,
x, y);
add_on = gimp_pickable_contiguous_region_by_seed (pickable,
antialias,
threshold,
select_transparent,
select_criterion,
x, y);
if (! sample_merged)
gimp_item_get_offset (GIMP_ITEM (drawable), &add_on_x, &add_on_y);
......@@ -544,26 +546,27 @@ gimp_channel_select_by_color (GimpChannel *channel,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
GimpItem *item;
GeglBuffer *add_on;
gint add_on_x = 0;
gint add_on_y = 0;
GimpPickable *pickable;
GeglBuffer *add_on;
gint add_on_x = 0;
gint add_on_y = 0;
g_return_if_fail (GIMP_IS_CHANNEL (channel));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (channel)));
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (color != NULL);
item = GIMP_ITEM (channel);
add_on = gimp_image_contiguous_region_by_color (gimp_item_get_image (item),
drawable,
sample_merged,
antialias,
threshold,
select_transparent,
select_criterion,
color);
if (sample_merged)
pickable = GIMP_PICKABLE (gimp_item_get_image (GIMP_ITEM (drawable)));
else
pickable = GIMP_PICKABLE (drawable);
add_on = gimp_pickable_contiguous_region_by_color (pickable,
antialias,
threshold,
select_transparent,
select_criterion,
color);
if (! sample_merged)
gimp_item_get_offset (GIMP_ITEM (drawable), &add_on_x, &add_on_y);
......
......@@ -39,8 +39,9 @@
#include "gimpdrawable-bucket-fill.h"
#include "gimperror.h"
#include "gimpimage.h"
#include "gimpimage-contiguous-region.h"
#include "gimppattern.h"
#include "gimppickable.h"
#include "gimppickable-contiguous-region.h"
#include "gimp-intl.h"
......@@ -136,13 +137,14 @@ gimp_drawable_bucket_fill_internal (GimpDrawable *drawable,
const GimpRGB *color,
GimpPattern *pattern)
{
GimpImage *image;
GeglBuffer *buffer;
GeglBuffer *mask_buffer;
gint x1, y1, x2, y2;
gint mask_offset_x = 0;
gint mask_offset_y = 0;
gboolean selection;
GimpImage *image;
GimpPickable *pickable;
GeglBuffer *buffer;
GeglBuffer *mask_buffer;
gint x1, y1, x2, y2;
gint mask_offset_x = 0;
gint mask_offset_y = 0;
gboolean selection;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
......@@ -160,18 +162,22 @@ gimp_drawable_bucket_fill_internal (GimpDrawable *drawable,
gimp_set_busy (image->gimp);
if (sample_merged)
pickable = GIMP_PICKABLE (image);
else
pickable = GIMP_PICKABLE (drawable);
/* Do a seed bucket fill...To do this, calculate a new
* contiguous region. If there is a selection, calculate the
* intersection of this region with the existing selection.
*/
mask_buffer = gimp_image_contiguous_region_by_seed (image, drawable,
sample_merged,
TRUE,
threshold,
fill_transparent,
fill_criterion,
(gint) x,
(gint) y);
mask_buffer = gimp_pickable_contiguous_region_by_seed (pickable,
TRUE,
threshold,
fill_transparent,
fill_criterion,
(gint) x,
(gint) y);
if (selection)
{
......
......@@ -30,10 +30,8 @@
#include "gegl/gimp-babl.h"
#include "gimpdrawable.h"
#include "gimpimage.h"
#include "gimpimage-contiguous-region.h"
#include "gimppickable.h"
#include "gimppickable-contiguous-region.h"
/* local function prototypes */
......@@ -82,31 +80,22 @@ static void find_contiguous_region_helper (GeglBuffer *src_buffer,
/* public functions */
GeglBuffer *
gimp_image_contiguous_region_by_seed (GimpImage *image,
GimpDrawable *drawable,
gboolean sample_merged,
gboolean antialias,
gfloat threshold,
gboolean select_transparent,
GimpSelectCriterion select_criterion,
gint x,
gint y)
gimp_pickable_contiguous_region_by_seed (GimpPickable *pickable,
gboolean antialias,
gfloat threshold,
gboolean select_transparent,
GimpSelectCriterion select_criterion,
gint x,
gint y)
{
GimpPickable *pickable;
GeglBuffer *src_buffer;
GeglBuffer *mask_buffer;
const Babl *format;
gint n_components;
gboolean has_alpha;
gfloat start_col[MAX_CHANNELS];
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
if (sample_merged)
pickable = GIMP_PICKABLE (image);
else
pickable = GIMP_PICKABLE (drawable);
GeglBuffer *src_buffer;
GeglBuffer *mask_buffer;
const Babl *format;
gint n_components;
gboolean has_alpha;
gfloat start_col[MAX_CHANNELS];
g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), NULL);
gimp_pickable_flush (pickable);
......@@ -147,23 +136,20 @@ gimp_image_contiguous_region_by_seed (GimpImage *image,
}
GeglBuffer *
gimp_image_contiguous_region_by_color (GimpImage *image,
GimpDrawable *drawable,
gboolean sample_merged,
gboolean antialias,
gfloat threshold,
gboolean select_transparent,
GimpSelectCriterion select_criterion,
const GimpRGB *color)
gimp_pickable_contiguous_region_by_color (GimpPickable *pickable,
gboolean antialias,
gfloat threshold,
gboolean select_transparent,
GimpSelectCriterion select_criterion,
const GimpRGB *color)
{
/* Scan over the image's active layer, finding pixels within the
/* Scan over the pickable's active layer, finding pixels within the
* specified threshold from the given R, G, & B values. If
* antialiasing is on, use the same antialiasing scheme as in
* fuzzy_select. Modify the image's mask to reflect the
* fuzzy_select. Modify the pickable's mask to reflect the
* additional selection
*/
GeglBufferIterator *iter;
GimpPickable *pickable;
GeglBuffer *src_buffer;
GeglBuffer *mask_buffer;
const Babl *format;
......@@ -171,15 +157,9 @@ gimp_image_contiguous_region_by_color (GimpImage *image,
gboolean has_alpha;
gfloat start_col[MAX_CHANNELS];
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), NULL);
g_return_val_if_fail (color != NULL, NULL);
if (sample_merged)
pickable = GIMP_PICKABLE (image);
else
pickable = GIMP_PICKABLE (drawable);
gimp_pickable_flush (pickable);
src_buffer = gimp_pickable_get_buffer (pickable);
......
......@@ -15,28 +15,24 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GIMP_IMAGE_CONTIGUOUS_REGION_H__
#define __GIMP_IMAGE_CONTIGUOUS_REGION_H__
#ifndef __GIMP_PICKABLE_CONTIGUOUS_REGION_H__
#define __GIMP_PICKABLE_CONTIGUOUS_REGION_H__
GeglBuffer * gimp_image_contiguous_region_by_seed (GimpImage *image,
GimpDrawable *drawable,
gboolean sample_merged,
gboolean antialias,
gfloat threshold,
gboolean select_transparent,
GimpSelectCriterion select_criterion,
gint x,
gint y);
GeglBuffer * gimp_pickable_contiguous_region_by_seed (GimpPickable *pickable,
gboolean antialias,
gfloat threshold,
gboolean select_transparent,
GimpSelectCriterion select_criterion,
gint x,
gint y);
GeglBuffer * gimp_image_contiguous_region_by_color (GimpImage *image,
GimpDrawable *drawable,
gboolean sample_merged,
gboolean antialias,
gfloat threshold,
gboolean select_transparent,
GimpSelectCriterion select_criterion,
const GimpRGB *color);
GeglBuffer * gimp_pickable_contiguous_region_by_color (GimpPickable *pickable,
gboolean antialias,
gfloat threshold,
gboolean select_transparent,
GimpSelectCriterion select_criterion,
const GimpRGB *color);
#endif /* __GIMP_IMAGE_CONTIGUOUS_REGION_H__ */
#endif /* __GIMP_PICKABLE_CONTIGUOUS_REGION_H__ */
......@@ -30,9 +30,9 @@
#include "tools-types.h"
#include "core/gimpimage.h"
#include "core/gimpimage-contiguous-region.h"
#include "core/gimpitem.h"
#include "core/gimppickable.h"
#include "core/gimppickable-contiguous-region.h"
#include "widgets/gimphelp-ids.h"
......@@ -126,13 +126,12 @@ gimp_by_color_select_tool_get_mask (GimpRegionSelectTool *region_select,
gimp_pickable_flush (pickable);
if (gimp_pickable_get_color_at (pickable, x, y, &color))
return gimp_image_contiguous_region_by_color (image, drawable,
options->sample_merged,
sel_options->antialias,
options->threshold / 255.0,
options->select_transparent,
options->select_criterion,
&color);
return gimp_pickable_contiguous_region_by_color (pickable,
sel_options->antialias,
options->threshold / 255.0,
options->select_transparent,
options->select_criterion,
&color);
return NULL;
}
......@@ -29,8 +29,9 @@
#include "tools-types.h"
#include "core/gimpimage.h"
#include "core/gimpimage-contiguous-region.h"
#include "core/gimpitem.h"
#include "core/gimppickable.h"
#include "core/gimppickable-contiguous-region.h"
#include "widgets/gimphelp-ids.h"
......@@ -99,6 +100,7 @@ gimp_fuzzy_select_tool_get_mask (GimpRegionSelectTool *region_select,
GimpRegionSelectOptions *options = GIMP_REGION_SELECT_TOOL_GET_OPTIONS (tool);
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
GimpPickable *pickable;
gint x, y;
x = region_select->x;
......@@ -112,13 +114,18 @@ gimp_fuzzy_select_tool_get_mask (GimpRegionSelectTool *region_select,
x -= off_x;
y -= off_y;
pickable = GIMP_PICKABLE (drawable);
}
else
{
pickable = GIMP_PICKABLE (image);
}
return gimp_image_contiguous_region_by_seed (image, drawable,
options->sample_merged,
sel_options->antialias,
options->threshold / 255.0,
options->select_transparent,
options->select_criterion,
x, y);
return gimp_pickable_contiguous_region_by_seed (pickable,
sel_options->antialias,
options->threshold / 255.0,
options->select_transparent,
options->select_criterion,
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