Commit d64bf356 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

added GimpPickable::get_opacity_at()

2005-07-11  Michael Natterer  <mitch@gimp.org>

	* app/core/gimppickable.[ch]: added GimpPickable::get_opacity_at()

	* app/core/gimpchannel.[ch]: removed gimp_channel_value() and
	implement ::get_opacity_at() instead.

	* app/core/gimplayer.[ch]: removed gimp_layer_pick_correlate()
	and implement ::get_opacity_at() instead.

	* app/core/gimpselection.c: GimpChannel::value() doesn't exist
	any more.

	* app/core/gimpprojection.c: implement ::get_opacity_at(), always
	returns OPAQUE.

	* app/core/gimpimage.c
	* app/tools/gimpbucketfilltool.c
	* app/tools/gimpclonetool.c
	* app/tools/gimpfliptool.c
	* app/tools/gimpiscissorstool.c
	* app/tools/gimpnewrectselecttool.c
	* app/tools/gimprectangletool.c
	* app/tools/gimpselectiontool.c
	* app/tools/gimptransformtool.c
	* tools/pdbgen/pdb/selection.pdb: changed accordingly.

	* app/pdb/selection_cmds.c: regenerated.
parent d420a5bf
2005-07-11 Michael Natterer <mitch@gimp.org>
* app/core/gimppickable.[ch]: added GimpPickable::get_opacity_at()
* app/core/gimpchannel.[ch]: removed gimp_channel_value() and
implement ::get_opacity_at() instead.
* app/core/gimplayer.[ch]: removed gimp_layer_pick_correlate()
and implement ::get_opacity_at() instead.
* app/core/gimpselection.c: GimpChannel::value() doesn't exist
any more.
* app/core/gimpprojection.c: implement ::get_opacity_at(), always
returns OPAQUE.
* app/core/gimpimage.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpclonetool.c
* app/tools/gimpfliptool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimpnewrectselecttool.c
* app/tools/gimprectangletool.c
* app/tools/gimpselectiontool.c
* app/tools/gimptransformtool.c
* tools/pdbgen/pdb/selection.pdb: changed accordingly.
* app/pdb/selection_cmds.c: regenerated.
2005-07-11 Michael Natterer <mitch@gimp.org>
* app/tools/gimpclonetool.c (gimp_clone_tool_cursor_update):
......
......@@ -52,6 +52,7 @@
#include "gimpdrawable-stroke.h"
#include "gimpmarshal.h"
#include "gimppaintinfo.h"
#include "gimppickable.h"
#include "gimpprojection.h"
#include "gimpstrokedesc.h"
......@@ -67,6 +68,7 @@ enum
static void gimp_channel_class_init (GimpChannelClass *klass);
static void gimp_channel_init (GimpChannel *channel);
static void gimp_channel_pickable_iface_init (GimpPickableInterface *pickable_iface);
static void gimp_channel_finalize (GObject *object);
......@@ -160,6 +162,10 @@ static void gimp_channel_swap_pixels (GimpDrawable *drawable,
gint width,
gint height);
static gint gimp_channel_get_opacity_at (GimpPickable *pickable,
gint x,
gint y);
static gboolean gimp_channel_real_boundary (GimpChannel *channel,
const BoundSeg **segs_in,
const BoundSeg **segs_out,
......@@ -175,9 +181,6 @@ static gboolean gimp_channel_real_bounds (GimpChannel *channel,
gint *x2,
gint *y2);
static gboolean gimp_channel_real_is_empty (GimpChannel *channel);
static gint gimp_channel_real_value (GimpChannel *channel,
gint x,
gint y);
static void gimp_channel_real_feather (GimpChannel *channel,
gdouble radius_x,
gdouble radius_y,
......@@ -236,9 +239,19 @@ gimp_channel_get_type (void)
(GInstanceInitFunc) gimp_channel_init,
};
static const GInterfaceInfo pickable_iface_info =
{
(GInterfaceInitFunc) gimp_channel_pickable_iface_init,
NULL, /* iface_finalize */
NULL /* iface_data */
};
channel_type = g_type_register_static (GIMP_TYPE_DRAWABLE,
"GimpChannel",
&channel_info, 0);
g_type_add_interface_static (channel_type, GIMP_TYPE_PICKABLE,
&pickable_iface_info);
}
return channel_type;
......@@ -301,7 +314,6 @@ gimp_channel_class_init (GimpChannelClass *klass)
klass->boundary = gimp_channel_real_boundary;
klass->bounds = gimp_channel_real_bounds;
klass->is_empty = gimp_channel_real_is_empty;
klass->value = gimp_channel_real_value;
klass->feather = gimp_channel_real_feather;
klass->sharpen = gimp_channel_real_sharpen;
klass->clear = gimp_channel_real_clear;
......@@ -342,6 +354,12 @@ gimp_channel_init (GimpChannel *channel)
channel->y2 = 0;
}
static void
gimp_channel_pickable_iface_init (GimpPickableInterface *pickable_iface)
{
pickable_iface->get_opacity_at = gimp_channel_get_opacity_at;
}
static void
gimp_channel_finalize (GObject *object)
{
......@@ -843,6 +861,39 @@ gimp_channel_swap_pixels (GimpDrawable *drawable,
GIMP_CHANNEL (drawable)->bounds_known = FALSE;
}
static gint
gimp_channel_get_opacity_at (GimpPickable *pickable,
gint x,
gint y)
{
GimpChannel *channel = GIMP_CHANNEL (pickable);
Tile *tile;
gint val;
/* Some checks to cut back on unnecessary work */
if (channel->bounds_known)
{
if (channel->empty)
return 0;
else if (x < channel->x1 || x >= channel->x2 ||
y < channel->y1 || y >= channel->y2)
return 0;
}
else
{
if (x < 0 || x >= GIMP_ITEM (channel)->width ||
y < 0 || y >= GIMP_ITEM (channel)->height)
return 0;
}
tile = tile_manager_get_tile (GIMP_DRAWABLE (channel)->tiles, x, y,
TRUE, FALSE);
val = *(guchar *) (tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT));
tile_release (tile, FALSE);
return val;
}
static gboolean
gimp_channel_real_boundary (GimpChannel *channel,
const BoundSeg **segs_in,
......@@ -1096,38 +1147,6 @@ gimp_channel_real_is_empty (GimpChannel *channel)
return TRUE;
}
static gint
gimp_channel_real_value (GimpChannel *channel,
gint x,
gint y)
{
Tile *tile;
gint val;
/* Some checks to cut back on unnecessary work */
if (channel->bounds_known)
{
if (channel->empty)
return 0;
else if (x < channel->x1 || x >= channel->x2 ||
y < channel->y1 || y >= channel->y2)
return 0;
}
else
{
if (x < 0 || x >= GIMP_ITEM (channel)->width ||
y < 0 || y >= GIMP_ITEM (channel)->height)
return 0;
}
tile = tile_manager_get_tile (GIMP_DRAWABLE (channel)->tiles, x, y,
TRUE, FALSE);
val = *(guchar *) (tile_data_pointer (tile, x % TILE_WIDTH, y % TILE_HEIGHT));
tile_release (tile, FALSE);
return val;
}
static void
gimp_channel_real_feather (GimpChannel *channel,
gdouble radius_x,
......@@ -1781,16 +1800,6 @@ gimp_channel_is_empty (GimpChannel *channel)
return GIMP_CHANNEL_GET_CLASS (channel)->is_empty (channel);
}
gint
gimp_channel_value (GimpChannel *channel,
gint x,
gint y)
{
g_return_val_if_fail (GIMP_IS_CHANNEL (channel), 0);
return GIMP_CHANNEL_GET_CLASS (channel)->value (channel, x, y);
}
void
gimp_channel_feather (GimpChannel *channel,
gdouble radius_x,
......
......@@ -79,9 +79,6 @@ struct _GimpChannelClass
gint *x2,
gint *y2);
gboolean (* is_empty) (GimpChannel *channel);
gint (* value) (GimpChannel *channel,
gint x,
gint y);
void (* feather) (GimpChannel *channel,
gdouble radius_x,
......@@ -180,9 +177,6 @@ gboolean gimp_channel_bounds (GimpChannel *mask,
gint *x2,
gint *y2);
gboolean gimp_channel_is_empty (GimpChannel *mask);
gint gimp_channel_value (GimpChannel *mask,
gint x,
gint y);
void gimp_channel_feather (GimpChannel *mask,
gdouble radius_x,
......
......@@ -55,6 +55,7 @@
#include "gimplist.h"
#include "gimpmarshal.h"
#include "gimpparasitelist.h"
#include "gimppickable.h"
#include "gimpprojection.h"
#include "gimpselection.h"
#include "gimptemplate.h"
......@@ -3565,9 +3566,15 @@ gimp_image_pick_correlate_layer (const GimpImage *gimage,
list = g_list_next (list))
{
GimpLayer *layer = list->data;
gint off_x, off_y;
if (gimp_layer_pick_correlate (layer, x, y))
return layer;
gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
if (gimp_pickable_get_opacity_at (GIMP_PICKABLE (layer),
x - off_x, y - off_y) > 63)
{
return layer;
}
}
return NULL;
......
......@@ -46,6 +46,7 @@
#include "gimplayer.h"
#include "gimplayermask.h"
#include "gimpmarshal.h"
#include "gimppickable.h"
#include "gimp-intl.h"
......@@ -70,6 +71,7 @@ enum
static void gimp_layer_class_init (GimpLayerClass *klass);
static void gimp_layer_init (GimpLayer *layer);
static void gimp_layer_pickable_iface_init (GimpPickableInterface *pickable_iface);
static void gimp_layer_set_property (GObject *object,
guint property_id,
......@@ -147,6 +149,9 @@ static void gimp_layer_set_tiles (GimpDrawable *drawable,
GimpImageType type,
gint offset_x,
gint offset_y);
static gint gimp_layer_get_opacity_at (GimpPickable *pickable,
gint x,
gint y);
static void gimp_layer_transform_color (GimpImage *gimage,
PixelRegion *layerPR,
......@@ -187,9 +192,19 @@ gimp_layer_get_type (void)
(GInstanceInitFunc) gimp_layer_init,
};
static const GInterfaceInfo pickable_iface_info =
{
(GInterfaceInitFunc) gimp_layer_pickable_iface_init,
NULL, /* iface_finalize */
NULL /* iface_data */
};
layer_type = g_type_register_static (GIMP_TYPE_DRAWABLE,
"GimpLayer",
&layer_info, 0);
g_type_add_interface_static (layer_type, GIMP_TYPE_PICKABLE,
&pickable_iface_info);
}
return layer_type;
......@@ -321,6 +336,12 @@ gimp_layer_init (GimpLayer *layer)
layer->fs.num_segs = 0;
}
static void
gimp_layer_pickable_iface_init (GimpPickableInterface *pickable_iface)
{
pickable_iface->get_opacity_at = gimp_layer_get_opacity_at;
}
static void
gimp_layer_set_property (GObject *object,
guint property_id,
......@@ -850,6 +871,52 @@ gimp_layer_invalidate_boundary (GimpDrawable *drawable)
floating_sel_invalidate (layer);
}
static gint
gimp_layer_get_opacity_at (GimpPickable *pickable,
gint x,
gint y)
{
GimpLayer *layer = GIMP_LAYER (pickable);
Tile *tile;
gint val = 0;
if (x >= 0 && x < GIMP_ITEM (layer)->width &&
y >= 0 && y < GIMP_ITEM (layer)->height &&
gimp_item_get_visible (GIMP_ITEM (layer)))
{
/* If the point is inside, and the layer has no
* alpha channel, success!
*/
if (! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
return OPAQUE_OPACITY;
/* Otherwise, determine if the alpha value at
* the given point is non-zero
*/
tile = tile_manager_get_tile (GIMP_DRAWABLE (layer)->tiles,
x, y, TRUE, FALSE);
val = * ((guchar *) tile_data_pointer (tile,
x % TILE_WIDTH,
y % TILE_HEIGHT) +
tile_bpp (tile) - 1);
if (layer->mask)
{
gint mask_val;
mask_val = gimp_pickable_get_opacity_at (GIMP_PICKABLE (layer->mask),
x, y);
val = val * mask_val / 255;
}
tile_release (tile, FALSE);
}
return val;
}
static void
gimp_layer_transform_color (GimpImage *gimage,
PixelRegion *layerPR,
......@@ -1671,64 +1738,6 @@ gimp_layer_boundary (GimpLayer *layer,
return new_segs;
}
gboolean
gimp_layer_pick_correlate (GimpLayer *layer,
gint x,
gint y)
{
Tile *tile;
Tile *mask_tile;
gint val;
g_return_val_if_fail (GIMP_IS_LAYER (layer), FALSE);
/* Is the point inside the layer?
* First transform the point to layer coordinates...
*/
x -= GIMP_ITEM (layer)->offset_x;
y -= GIMP_ITEM (layer)->offset_y;
if (x >= 0 && x < GIMP_ITEM (layer)->width &&
y >= 0 && y < GIMP_ITEM (layer)->height &&
gimp_item_get_visible (GIMP_ITEM (layer)))
{
/* If the point is inside, and the layer has no
* alpha channel, success!
*/
if (! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
return TRUE;
/* Otherwise, determine if the alpha value at
* the given point is non-zero
*/
tile = tile_manager_get_tile (GIMP_DRAWABLE (layer)->tiles,
x, y, TRUE, FALSE);
val = * ((guchar *) tile_data_pointer (tile,
x % TILE_WIDTH,
y % TILE_HEIGHT) +
tile_bpp (tile) - 1);
if (layer->mask)
{
guchar *ptr;
mask_tile = tile_manager_get_tile (GIMP_DRAWABLE (layer->mask)->tiles,
x, y, TRUE, FALSE);
ptr = tile_data_pointer (mask_tile, x % TILE_WIDTH, y % TILE_HEIGHT);
val = val * (*ptr) / 255;
tile_release (mask_tile, FALSE);
}
tile_release (tile, FALSE);
if (val > 63)
return TRUE;
}
return FALSE;
}
/**********************/
/* access functions */
/**********************/
......
......@@ -112,9 +112,6 @@ void gimp_layer_resize_to_image (GimpLayer *layer,
GimpContext *context);
BoundSeg * gimp_layer_boundary (GimpLayer *layer,
gint *num_segs);
gboolean gimp_layer_pick_correlate (GimpLayer *layer,
gint x,
gint y);
GimpLayerMask * gimp_layer_get_mask (const GimpLayer *layer);
......
......@@ -118,6 +118,23 @@ gimp_pickable_get_color_at (GimpPickable *pickable,
return NULL;
}
gint
gimp_pickable_get_opacity_at (GimpPickable *pickable,
gint x,
gint y)
{
GimpPickableInterface *pickable_iface;
g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), 0);
pickable_iface = GIMP_PICKABLE_GET_INTERFACE (pickable);
if (pickable_iface->get_opacity_at)
return pickable_iface->get_opacity_at (pickable, x, y);
return 0;
}
gboolean
gimp_pickable_pick_color (GimpPickable *pickable,
gint x,
......
......@@ -42,6 +42,9 @@ struct _GimpPickableInterface
guchar * (* get_color_at) (GimpPickable *pickable,
gint x,
gint y);
gint (* get_opacity_at) (GimpPickable *pickable,
gint x,
gint y);
};
......@@ -53,6 +56,9 @@ TileManager * gimp_pickable_get_tiles (GimpPickable *pickable);
guchar * gimp_pickable_get_color_at (GimpPickable *pickable,
gint x,
gint y);
gint gimp_pickable_get_opacity_at (GimpPickable *pickable,
gint x,
gint y);
gboolean gimp_pickable_pick_color (GimpPickable *pickable,
gint x,
......
......@@ -55,6 +55,9 @@ static gint64 gimp_projection_get_memsize (GimpObject *object,
static guchar * gimp_projection_get_color_at (GimpPickable *pickable,
gint x,
gint y);
static gint gimp_projection_get_opacity_at (GimpPickable *pickable,
gint x,
gint y);
static void gimp_projection_alloc_tiles (GimpProjection *proj);
static void gimp_projection_add_update_area (GimpProjection *proj,
......@@ -189,6 +192,7 @@ gimp_projection_pickable_iface_init (GimpPickableInterface *pickable_iface)
pickable_iface->get_image_type = gimp_projection_get_image_type;
pickable_iface->get_tiles = gimp_projection_get_tiles;
pickable_iface->get_color_at = gimp_projection_get_color_at;
pickable_iface->get_opacity_at = gimp_projection_get_opacity_at;
}
static void
......@@ -257,6 +261,14 @@ gimp_projection_get_color_at (GimpPickable *pickable,
return dest;
}
static gint
gimp_projection_get_opacity_at (GimpPickable *pickable,
gint x,
gint y)
{
return OPAQUE_OPACITY;
}
GimpProjection *
gimp_projection_new (GimpImage *gimage)
{
......
......@@ -96,9 +96,6 @@ static gboolean gimp_selection_bounds (GimpChannel *channel,
gint *x2,
gint *y2);
static gboolean gimp_selection_is_empty (GimpChannel *channel);
static gint gimp_selection_value (GimpChannel *channel,
gint x,
gint y);
static void gimp_selection_feather (GimpChannel *channel,
gdouble radius_x,
gdouble radius_y,
......@@ -188,7 +185,6 @@ gimp_selection_class_init (GimpSelectionClass *klass)
channel_class->boundary = gimp_selection_boundary;
channel_class->bounds = gimp_selection_bounds;
channel_class->is_empty = gimp_selection_is_empty;
channel_class->value = gimp_selection_value;
channel_class->feather = gimp_selection_feather;
channel_class->sharpen = gimp_selection_sharpen;
channel_class->clear = gimp_selection_clear;
......@@ -454,14 +450,6 @@ gimp_selection_is_empty (GimpChannel *channel)
return GIMP_CHANNEL_CLASS (parent_class)->is_empty (channel);
}
static gint
gimp_selection_value (GimpChannel *channel,
gint x,
gint y)
{
return GIMP_CHANNEL_CLASS (parent_class)->value (channel, x, y);
}
static void
gimp_selection_feather (GimpChannel *channel,
gdouble radius_x,
......
......@@ -31,6 +31,7 @@
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimppickable.h"
#include "core/gimpselection.h"
#include "gimp-intl.h"
......@@ -188,7 +189,7 @@ selection_value_invoker (Gimp *gimp,
return_args = procedural_db_return_args (&selection_value_proc, success);
if (success)
return_args[1].value.pdb_int = gimp_channel_value (gimp_image_get_mask (gimage), x, y);
return_args[1].value.pdb_int = gimp_pickable_get_opacity_at (GIMP_PICKABLE (gimp_image_get_mask (gimage)), x, y);
return return_args;
}
......
......@@ -31,6 +31,7 @@
#include "core/gimpchannel.h"
#include "core/gimpdrawable-bucket-fill.h"
#include "core/gimpimage.h"
#include "core/gimppickable.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimphelp-ids.h"
......@@ -271,7 +272,8 @@ gimp_bucket_fill_tool_cursor_update (GimpTool *tool,
* if so, is cursor inside?
*/
if (gimp_channel_is_empty (selection) ||
gimp_channel_value (selection, coords->x, coords->y))
gimp_pickable_get_opacity_at (GIMP_PICKABLE (selection),
coords->x, coords->y))
{
switch (options->fill_mode)
{
......
......@@ -26,6 +26,7 @@
#include "core/gimpchannel.h"
#include "core/gimpimage.h"
#include "core/gimppickable.h"
#include "core/gimptoolinfo.h"
#include "paint/gimpclone.h"
......@@ -222,7 +223,8 @@ gimp_clone_tool_cursor_update (GimpTool *tool,
* if so, is cursor inside?
*/
if (gimp_channel_is_empty (selection) ||
gimp_channel_value (selection, coords->x, coords->y))
gimp_pickable_get_opacity_at (GIMP_PICKABLE (selection),
coords->x, coords->y))
ctype = GIMP_CURSOR_MOUSE;
}
......
......@@ -29,6 +29,7 @@
#include "core/gimpitem-linked.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "core/gimppickable.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimphelp-ids.h"
......@@ -197,7 +198,8 @@ gimp_flip_tool_cursor_update (GimpTool *tool,
/* Is there a selected region? If so, is cursor inside? */
if (gimp_channel_is_empty (selection) ||
gimp_channel_value (selection, coords->x, coords->y))
gimp_pickable_get_opacity_at (GIMP_PICKABLE (selection),
coords->x, coords->y))
{
bad_cursor = FALSE;
}
......
......@@ -66,6 +66,7 @@
#include "core/gimpchannel.h"
#include "core/gimpchannel-select.h"
#include "core/gimpimage.h"
#include "core/gimppickable.h"
#include "core/gimpprojection.h"
#include "core/gimpscanconvert.h"
#include "core/gimptoolinfo.h"
......@@ -477,9 +478,9 @@ gimp_iscissors_tool_button_press (GimpTool *tool,
}
/* If the iscissors is connected, check if the click was inside */
else if (iscissors->connected && iscissors->mask &&
gimp_channel_value (iscissors->mask,
iscissors->x,
iscissors->y))
gimp_pickable_get_opacity_at (GIMP_PICKABLE (iscissors->mask),
iscissors->x,
iscissors->y))
{
/* Undraw the curve */
gimp_tool_control_halt (tool->control);
......@@ -972,7 +973,8 @@ gimp_iscissors_tool_oper_update (GimpTool *tool,
}
else if (iscissors->connected && iscissors->mask)
{
if (gimp_channel_value (iscissors->mask, coords->x, coords->y))
if (gimp_pickable_get_opacity_at (GIMP_PICKABLE (iscissors->mask),
coords->x, coords->y))
{
iscissors->op = ISCISSORS_OP_SELECT;
}
......
......@@ -28,6 +28,7 @@
#include "core/gimpchannel-select.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimpimage.h"
#include "core/gimppickable.h"
#include "core/gimptoolinfo.h"
#include "core/gimp-utils.h"
......@@ -248,8 +249,8 @@ gimp_new_rect_select_tool_execute (GimpRectangleTool *rectangle,
}
val = gimp_channel_value (selection_mask,
rectangle->pressx, rectangle->pressy);
val = gimp_pickable_get_opacity_at (GIMP_PICKABLE (selection_mask),
rectangle->pressx, rectangle->pressy);
selected = (val > 127);
......
......@@ -28,6 +28,7 @@
#include "core/gimpchannel-select.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimpimage.h"
#include "core/gimppickable.h"
#include "core/gimptoolinfo.h"
#include "core/gimp-utils.h"
......@@ -248,8 +249,8 @@ gimp_new_rect_select_tool_execute (GimpRectangleTool *rectangle,
}
val = gimp_channel_value (selection_mask,
rectangle->pressx, rectangle->pressy);
val = gimp_pickable_get_opacity_at (GIMP_PICKABLE (selection_mask),
rectangle->pressx, rectangle->pressy);
selected = (val > 127);
......
......@@ -32,6 +32,7 @@
#include "core/gimpchannel-select.h"
#include "core/gimpimage.h"
#include "core/gimpimage-crop.h"
#include "core/gimppickable.h"
#include "core/gimptoolinfo.h"
#include "core/gimpunit.h"
#include "core/gimp-utils.h"
......@@ -1458,8 +1459,8 @@ gimp_rectangle_tool_real_execute (GimpRectangleTool *rectangle,
gimage = tool->gdisp->gimage;
selection_mask = gimp_image_get_mask (gimage);
val = gimp_channel_value (selection_mask,
rectangle->pressx, rectangle->pressy);
val = gimp_pickable_get_opacity_at (GIMP_PICKABLE (selection_mask),
rectangle->pressx, rectangle->pressy);
selected = (val > 127);
......
......@@ -28,6 +28,7 @@
#include "core/gimpchannel.h"
#include "core/gimpimage.h"
#include "core/gimppickable.h"
#include "core/gimptoolinfo.h"
#include "display/gimpdisplay.h"
......@@ -208,7 +209,8 @@ gimp_selection_tool_oper_update (GimpTool *tool,
if (layer == floating_sel)
move_floating_sel = TRUE;
}
else if (gimp_channel_value (selection, coords->x, coords->y))
else if (gimp_pickable_get_opacity_at (GIMP_PICKABLE (selection),
coords->x, coords->y))
{
move_layer = TRUE;
}
......
......@@ -26,6 +26,7 @@
#include "core/gimpchannel.h"
#include "core/gimpimage.h"
#include "core/gimppickable.h"
#include "core/gimptoolinfo.h"
#include "paint/gimpclone.h"
......@@ -222,7 +223,8 @@ gimp_clone_tool_cursor_update (GimpTool *tool,
* if so, is cursor inside?
*/
if (gimp_channel_is_empty (selection) ||
gimp_channel_value (selection, coords->x, coords->y))
gimp_pickable_get_opacity_at (GIMP_PICKABLE (selection),
coords->x, coords->y))
ctype = GIMP_CURSOR_MOUSE;
}
......
......@@ -41,6 +41,7 @@
#include "core/gimpitem-linked.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"