From e837849934ff28d011036e7e9d82bdc363ca5239 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Wed, 3 Sep 2003 15:13:19 +0000 Subject: [PATCH] removed the _value() and _is_empty() wrappers. 2003-09-03 Michael Natterer * app/core/gimpimage-mask.[ch]: removed the _value() and _is_empty() wrappers. * app/display/gimpdisplayshell.[ch]: removed gimp_display_shell_mask_value() since it is not used. * app/core/gimpdrawable-blend.c * app/core/gimpdrawable-transform.c * app/core/gimpedit.c * app/core/gimpimage.c * app/core/gimplayer.c * app/gui/image-menu.c * app/gui/vectors-menu.c * app/tools/gimpclonetool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimpmovetool.c * app/tools/gimpselectiontool.c * app/tools/gimptransformtool.c * tools/pdbgen/pdb/misc_tools.pdb: changed accordingly. * app/pdb/misc_tools_cmds.c: regenerated. --- ChangeLog | 25 +++++++++++++++++++++++++ app/core/gimp-edit.c | 6 +++--- app/core/gimp-transform-region.c | 2 +- app/core/gimpdrawable-blend.c | 9 ++++----- app/core/gimpdrawable-transform.c | 2 +- app/core/gimpedit.c | 6 +++--- app/core/gimpimage-mask.c | 18 ------------------ app/core/gimpimage-mask.h | 4 ---- app/core/gimpimage.c | 9 ++++++--- app/core/gimplayer.c | 2 +- app/display/gimpdisplayshell-draw.c | 14 -------------- app/display/gimpdisplayshell-draw.h | 3 --- app/display/gimpdisplayshell.c | 14 -------------- app/display/gimpdisplayshell.h | 3 --- app/gui/image-menu.c | 3 ++- app/gui/vectors-menu.c | 4 ++-- app/menus/image-menu.c | 3 ++- app/paint/gimpink.c | 9 +++++---- app/pdb/misc_tools_cmds.c | 8 +++++--- app/tools/gimpclonetool.c | 9 +++++---- app/tools/gimpfliptool.c | 9 +++++---- app/tools/gimpinktool.c | 9 +++++---- app/tools/gimpmovetool.c | 8 +++++--- app/tools/gimpselectiontool.c | 11 +++++++---- app/tools/gimpsourcetool.c | 9 +++++---- app/tools/gimptransformtool.c | 14 +++++++------- tools/pdbgen/pdb/misc_tools.pdb | 8 +++++--- 27 files changed, 104 insertions(+), 117 deletions(-) diff --git a/ChangeLog b/ChangeLog index d178af2a11..98149ddc9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2003-09-03 Michael Natterer + + * app/core/gimpimage-mask.[ch]: removed the _value() and + _is_empty() wrappers. + + * app/display/gimpdisplayshell.[ch]: removed + gimp_display_shell_mask_value() since it is not used. + + * app/core/gimpdrawable-blend.c + * app/core/gimpdrawable-transform.c + * app/core/gimpedit.c + * app/core/gimpimage.c + * app/core/gimplayer.c + * app/gui/image-menu.c + * app/gui/vectors-menu.c + * app/tools/gimpclonetool.c + * app/tools/gimpfliptool.c + * app/tools/gimpinktool.c + * app/tools/gimpmovetool.c + * app/tools/gimpselectiontool.c + * app/tools/gimptransformtool.c + * tools/pdbgen/pdb/misc_tools.pdb: changed accordingly. + + * app/pdb/misc_tools_cmds.c: regenerated. + 2003-09-03 Michael Natterer * app/core/gimpimage-mask-select.[ch]: removed the _clear() wrapper. diff --git a/app/core/gimp-edit.c b/app/core/gimp-edit.c index 3583edfa99..2b37d273a7 100644 --- a/app/core/gimp-edit.c +++ b/app/core/gimp-edit.c @@ -61,7 +61,7 @@ gimp_edit_cut (GimpImage *gimage, _("Cut")); /* See if the gimage mask is empty */ - empty = gimp_image_mask_is_empty (gimage); + empty = gimp_channel_is_empty (gimp_image_get_mask (gimage)); /* Next, cut the mask portion from the gimage */ cut = gimp_image_mask_extract (gimage, drawable, TRUE, FALSE, TRUE); @@ -119,7 +119,7 @@ gimp_edit_copy (GimpImage *gimage, _("Copy")); /* See if the gimage mask is empty */ - empty = gimp_image_mask_is_empty (gimage); + empty = gimp_channel_is_empty (gimp_image_get_mask (gimage)); /* First, copy the masked portion of the gimage */ copy = gimp_image_mask_extract (gimage, drawable, FALSE, FALSE, TRUE); @@ -219,7 +219,7 @@ gimp_edit_paste (GimpImage *gimage, * this might not always be desired, but in general, * it seems like the correct behavior. */ - if (! gimp_image_mask_is_empty (gimage) && ! paste_into) + if (! gimp_channel_is_empty (gimp_image_get_mask (gimage)) && ! paste_into) gimp_channel_clear (gimp_image_get_mask (gimage), NULL, TRUE); /* if there's a drawable, add a new floating selection */ diff --git a/app/core/gimp-transform-region.c b/app/core/gimp-transform-region.c index 498b6cc54a..8573162b29 100644 --- a/app/core/gimp-transform-region.c +++ b/app/core/gimp-transform-region.c @@ -1001,7 +1001,7 @@ gimp_drawable_transform_cut (GimpDrawable *drawable, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); /* extract the selected mask if there is a selection */ - if (! gimp_image_mask_is_empty (gimage)) + if (! gimp_channel_is_empty (gimp_image_get_mask (gimage))) { /* set the keep_indexed flag to FALSE here, since we use * gimp_layer_new_from_tiles() later which assumes that the tiles diff --git a/app/core/gimpdrawable-blend.c b/app/core/gimpdrawable-blend.c index 2ba74a2923..625f6ba21c 100644 --- a/app/core/gimpdrawable-blend.c +++ b/app/core/gimpdrawable-blend.c @@ -34,12 +34,11 @@ #include "paint-funcs/paint-funcs.h" #include "gimp.h" +#include "gimpchannel.h" #include "gimpcontext.h" -#include "gimpdrawable.h" #include "gimpdrawable-blend.h" #include "gimpgradient.h" #include "gimpimage.h" -#include "gimpimage-mask.h" #include "gimp-intl.h" @@ -621,8 +620,10 @@ gradient_precalc_shapeburst (GimpImage *gimage, tempR.tiles = tile_manager_new (PR->w, PR->h, 1); pixel_region_init (&tempR, tempR.tiles, 0, 0, PR->w, PR->h, TRUE); + mask = gimp_image_get_mask (gimage); + /* If the gimage mask is not empty, use it as the shape burst source */ - if (! gimp_image_mask_is_empty (gimage)) + if (! gimp_channel_is_empty (mask)) { PixelRegion maskR; gint x1, y1, x2, y2; @@ -631,8 +632,6 @@ gradient_precalc_shapeburst (GimpImage *gimage, gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); gimp_item_offsets (GIMP_ITEM (drawable), &offx, &offy); - /* the selection mask */ - mask = gimp_image_get_mask (gimage); pixel_region_init (&maskR, gimp_drawable_data (GIMP_DRAWABLE (mask)), x1 + offx, y1 + offy, (x2 - x1), (y2 - y1), FALSE); diff --git a/app/core/gimpdrawable-transform.c b/app/core/gimpdrawable-transform.c index 498b6cc54a..8573162b29 100644 --- a/app/core/gimpdrawable-transform.c +++ b/app/core/gimpdrawable-transform.c @@ -1001,7 +1001,7 @@ gimp_drawable_transform_cut (GimpDrawable *drawable, g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); /* extract the selected mask if there is a selection */ - if (! gimp_image_mask_is_empty (gimage)) + if (! gimp_channel_is_empty (gimp_image_get_mask (gimage))) { /* set the keep_indexed flag to FALSE here, since we use * gimp_layer_new_from_tiles() later which assumes that the tiles diff --git a/app/core/gimpedit.c b/app/core/gimpedit.c index 3583edfa99..2b37d273a7 100644 --- a/app/core/gimpedit.c +++ b/app/core/gimpedit.c @@ -61,7 +61,7 @@ gimp_edit_cut (GimpImage *gimage, _("Cut")); /* See if the gimage mask is empty */ - empty = gimp_image_mask_is_empty (gimage); + empty = gimp_channel_is_empty (gimp_image_get_mask (gimage)); /* Next, cut the mask portion from the gimage */ cut = gimp_image_mask_extract (gimage, drawable, TRUE, FALSE, TRUE); @@ -119,7 +119,7 @@ gimp_edit_copy (GimpImage *gimage, _("Copy")); /* See if the gimage mask is empty */ - empty = gimp_image_mask_is_empty (gimage); + empty = gimp_channel_is_empty (gimp_image_get_mask (gimage)); /* First, copy the masked portion of the gimage */ copy = gimp_image_mask_extract (gimage, drawable, FALSE, FALSE, TRUE); @@ -219,7 +219,7 @@ gimp_edit_paste (GimpImage *gimage, * this might not always be desired, but in general, * it seems like the correct behavior. */ - if (! gimp_image_mask_is_empty (gimage) && ! paste_into) + if (! gimp_channel_is_empty (gimp_image_get_mask (gimage)) && ! paste_into) gimp_channel_clear (gimp_image_get_mask (gimage), NULL, TRUE); /* if there's a drawable, add a new floating selection */ diff --git a/app/core/gimpimage-mask.c b/app/core/gimpimage-mask.c index 890b8a17a4..233d09023b 100644 --- a/app/core/gimpimage-mask.c +++ b/app/core/gimpimage-mask.c @@ -73,24 +73,6 @@ gimp_image_mask_bounds (GimpImage *gimage, return gimp_channel_bounds (gimp_image_get_mask (gimage), x1, y1, x2, y2); } -gint -gimp_image_mask_value (GimpImage *gimage, - gint x, - gint y) -{ - g_return_val_if_fail (GIMP_IS_IMAGE (gimage), 0); - - return gimp_channel_value (gimp_image_get_mask (gimage), x, y); -} - -gboolean -gimp_image_mask_is_empty (GimpImage *gimage) -{ - g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE); - - return gimp_channel_is_empty (gimp_image_get_mask (gimage)); -} - void gimp_image_mask_push_undo (GimpImage *gimage, const gchar *undo_desc) diff --git a/app/core/gimpimage-mask.h b/app/core/gimpimage-mask.h index ad5a348cda..80ca7b8680 100644 --- a/app/core/gimpimage-mask.h +++ b/app/core/gimpimage-mask.h @@ -32,10 +32,6 @@ gboolean gimp_image_mask_bounds (GimpImage *gimage, gint *y1, gint *x2, gint *y2); -gint gimp_image_mask_value (GimpImage *gimage, - gint x, - gint y); -gboolean gimp_image_mask_is_empty (GimpImage *gimage); /* pure wrappers around the resp. GimpSelection functions: */ diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c index 8ae5bc4560..9aac30feb4 100644 --- a/app/core/gimpimage.c +++ b/app/core/gimpimage.c @@ -1687,8 +1687,9 @@ gimp_image_apply_image (GimpImage *gimage, item = GIMP_ITEM (drawable); /* get the selection mask if one exists */ - mask = (gimp_image_mask_is_empty (gimage) ? - NULL : gimp_image_get_mask (gimage)); + mask = gimp_image_get_mask (gimage); + if (gimp_channel_is_empty (mask)) + mask = NULL; /* configure the active channel array */ gimp_image_get_active_components (gimage, drawable, active_components); @@ -1810,7 +1811,9 @@ gimp_image_replace_image (GimpImage *gimage, item = GIMP_ITEM (drawable); /* get the selection mask if one exists */ - mask = (gimp_image_mask_is_empty (gimage)) ? NULL : gimp_image_get_mask (gimage); + mask = gimp_image_get_mask (gimage); + if (gimp_channel_is_empty (mask)) + mask = NULL; /* configure the active channel array */ gimp_image_get_active_components (gimage, drawable, active_components); diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c index e80f7e5ca7..9242c7ac7b 100644 --- a/app/core/gimplayer.c +++ b/app/core/gimplayer.c @@ -964,7 +964,7 @@ gimp_layer_create_mask (const GimpLayer *layer, gint copy_width, copy_height; selection = gimp_image_get_mask (gimage); - selection_empty = gimp_image_mask_is_empty (gimage); + selection_empty = gimp_channel_is_empty (selection); gimp_rectangle_intersect (0, 0, gimage->width, gimage->height, item->offset_x, item->offset_y, diff --git a/app/display/gimpdisplayshell-draw.c b/app/display/gimpdisplayshell-draw.c index 7b338d8ba1..e100b995e7 100644 --- a/app/display/gimpdisplayshell-draw.c +++ b/app/display/gimpdisplayshell-draw.c @@ -38,7 +38,6 @@ #include "core/gimpcontext.h" #include "core/gimpgrid.h" #include "core/gimpimage.h" -#include "core/gimpimage-mask.h" #include "core/gimpimage-snap.h" #include "core/gimplayer.h" #include "core/gimplayermask.h" @@ -1050,19 +1049,6 @@ gimp_display_shell_snap_coords (GimpDisplayShell *shell, } } -gint -gimp_display_shell_mask_value (GimpDisplayShell *shell, - gint x, - gint y) -{ - g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), 0); - - /* move the coordinates from screen space to image space */ - gimp_display_shell_untransform_xy (shell, x, y, &x, &y, FALSE, FALSE); - - return gimp_image_mask_value (shell->gdisp->gimage, x, y); -} - gboolean gimp_display_shell_mask_bounds (GimpDisplayShell *shell, gint *x1, diff --git a/app/display/gimpdisplayshell-draw.h b/app/display/gimpdisplayshell-draw.h index 7edfe1f8b8..908e1c827e 100644 --- a/app/display/gimpdisplayshell-draw.h +++ b/app/display/gimpdisplayshell-draw.h @@ -205,9 +205,6 @@ void gimp_display_shell_snap_coords (GimpDisplayShell *shell, gint snap_width, gint snap_height); -gint gimp_display_shell_mask_value (GimpDisplayShell *shell, - gint x, - gint y); gboolean gimp_display_shell_mask_bounds (GimpDisplayShell *shell, gint *x1, gint *y1, diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c index 7b338d8ba1..e100b995e7 100644 --- a/app/display/gimpdisplayshell.c +++ b/app/display/gimpdisplayshell.c @@ -38,7 +38,6 @@ #include "core/gimpcontext.h" #include "core/gimpgrid.h" #include "core/gimpimage.h" -#include "core/gimpimage-mask.h" #include "core/gimpimage-snap.h" #include "core/gimplayer.h" #include "core/gimplayermask.h" @@ -1050,19 +1049,6 @@ gimp_display_shell_snap_coords (GimpDisplayShell *shell, } } -gint -gimp_display_shell_mask_value (GimpDisplayShell *shell, - gint x, - gint y) -{ - g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), 0); - - /* move the coordinates from screen space to image space */ - gimp_display_shell_untransform_xy (shell, x, y, &x, &y, FALSE, FALSE); - - return gimp_image_mask_value (shell->gdisp->gimage, x, y); -} - gboolean gimp_display_shell_mask_bounds (GimpDisplayShell *shell, gint *x1, diff --git a/app/display/gimpdisplayshell.h b/app/display/gimpdisplayshell.h index 7edfe1f8b8..908e1c827e 100644 --- a/app/display/gimpdisplayshell.h +++ b/app/display/gimpdisplayshell.h @@ -205,9 +205,6 @@ void gimp_display_shell_snap_coords (GimpDisplayShell *shell, gint snap_width, gint snap_height); -gint gimp_display_shell_mask_value (GimpDisplayShell *shell, - gint x, - gint y); gboolean gimp_display_shell_mask_bounds (GimpDisplayShell *shell, gint *x1, gint *y1, diff --git a/app/gui/image-menu.c b/app/gui/image-menu.c index 89d5552b42..cf6efa78d7 100644 --- a/app/gui/image-menu.c +++ b/app/gui/image-menu.c @@ -27,6 +27,7 @@ #include "config/gimpguiconfig.h" #include "core/gimp.h" +#include "core/gimpchannel.h" #include "core/gimpcontext.h" #include "core/gimpimage.h" #include "core/gimpimage-mask.h" @@ -1341,7 +1342,7 @@ image_menu_update (GtkItemFactory *item_factory, fs = (gimp_image_floating_sel (gimage) != NULL); aux = (gimp_image_get_active_channel (gimage) != NULL); lp = ! gimp_image_is_empty (gimage); - sel = ! gimp_image_mask_is_empty (gimage); + sel = ! gimp_channel_is_empty (gimp_image_get_mask (gimage)); drawable = gimp_image_active_drawable (gimage); if (drawable) diff --git a/app/gui/vectors-menu.c b/app/gui/vectors-menu.c index 90f7a7a268..2536a8d551 100644 --- a/app/gui/vectors-menu.c +++ b/app/gui/vectors-menu.c @@ -24,8 +24,8 @@ #include "gui-types.h" +#include "core/gimpchannel.h" #include "core/gimpimage.h" -#include "core/gimpimage-mask.h" #include "core/gimplist.h" #include "widgets/gimphelp-ids.h" @@ -161,7 +161,7 @@ vectors_menu_update (GtkItemFactory *factory, vectors = gimp_image_get_active_vectors (gimage); - mask_empty = gimp_image_mask_is_empty (gimage); + mask_empty = gimp_channel_is_empty (gimp_image_get_mask (gimage)); global_buf = FALSE; diff --git a/app/menus/image-menu.c b/app/menus/image-menu.c index 89d5552b42..cf6efa78d7 100644 --- a/app/menus/image-menu.c +++ b/app/menus/image-menu.c @@ -27,6 +27,7 @@ #include "config/gimpguiconfig.h" #include "core/gimp.h" +#include "core/gimpchannel.h" #include "core/gimpcontext.h" #include "core/gimpimage.h" #include "core/gimpimage-mask.h" @@ -1341,7 +1342,7 @@ image_menu_update (GtkItemFactory *item_factory, fs = (gimp_image_floating_sel (gimage) != NULL); aux = (gimp_image_get_active_channel (gimage) != NULL); lp = ! gimp_image_is_empty (gimage); - sel = ! gimp_image_mask_is_empty (gimage); + sel = ! gimp_channel_is_empty (gimp_image_get_mask (gimage)); drawable = gimp_image_active_drawable (gimage); if (drawable) diff --git a/app/paint/gimpink.c b/app/paint/gimpink.c index b637924b8c..ed71b210ca 100644 --- a/app/paint/gimpink.c +++ b/app/paint/gimpink.c @@ -35,9 +35,8 @@ #include "paint-funcs/paint-funcs.h" #include "core/gimp.h" -#include "core/gimpdrawable.h" +#include "core/gimpchannel.h" #include "core/gimpimage.h" -#include "core/gimpimage-mask.h" #include "core/gimpimage-undo-push.h" #include "core/gimptoolinfo.h" @@ -465,12 +464,14 @@ gimp_ink_tool_cursor_update (GimpTool *tool, if (gimp_display_coords_in_active_drawable (gdisp, coords)) { + GimpChannel *selection = gimp_image_get_mask (gdisp->gimage); + /* One more test--is there a selected region? * if so, is cursor inside? */ - if (gimp_image_mask_is_empty (gdisp->gimage)) + if (gimp_channel_is_empty (selection)) ctype = GIMP_MOUSE_CURSOR; - else if (gimp_image_mask_value (gdisp->gimage, coords->x, coords->y)) + else if (gimp_channel_value (selection, coords->x, coords->y)) ctype = GIMP_MOUSE_CURSOR; } diff --git a/app/pdb/misc_tools_cmds.c b/app/pdb/misc_tools_cmds.c index 2fe9ddfb05..33d73a46b4 100644 --- a/app/pdb/misc_tools_cmds.c +++ b/app/pdb/misc_tools_cmds.c @@ -28,10 +28,10 @@ #include "pdb-types.h" #include "procedural_db.h" +#include "core/gimpchannel.h" #include "core/gimpdrawable-blend.h" #include "core/gimpdrawable-bucket-fill.h" #include "core/gimpdrawable.h" -#include "core/gimpimage-mask.h" #include "core/gimpimage-pick-color.h" #include "core/gimpimage.h" @@ -288,7 +288,9 @@ bucket_fill_invoker (Gimp *gimp, if (success) { - if (! gimp_item_get_image (GIMP_ITEM (drawable))) + GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (drawable)); + + if (! gimage) { success = FALSE; } @@ -296,7 +298,7 @@ bucket_fill_invoker (Gimp *gimp, { gboolean do_seed_fill; - do_seed_fill = gimp_image_mask_is_empty (gimp_item_get_image (GIMP_ITEM (drawable))); + do_seed_fill = gimp_channel_is_empty (gimp_image_get_mask (gimage)); gimp_drawable_bucket_fill (drawable, fill_mode, paint_mode, opacity / 100.0, diff --git a/app/tools/gimpclonetool.c b/app/tools/gimpclonetool.c index 0df3a57e17..4a31083a2c 100644 --- a/app/tools/gimpclonetool.c +++ b/app/tools/gimpclonetool.c @@ -24,9 +24,8 @@ #include "tools-types.h" -#include "core/gimpdrawable.h" +#include "core/gimpchannel.h" #include "core/gimpimage.h" -#include "core/gimpimage-mask.h" #include "core/gimptoolinfo.h" #include "paint/gimpclone.h" @@ -247,12 +246,14 @@ gimp_clone_tool_cursor_update (GimpTool *tool, if (gimp_display_coords_in_active_drawable (gdisp, coords)) { + GimpChannel *selection = gimp_image_get_mask (gdisp->gimage); + /* One more test--is there a selected region? * if so, is cursor inside? */ - if (gimp_image_mask_is_empty (gdisp->gimage)) + if (gimp_channel_is_empty (selection)) ctype = GIMP_MOUSE_CURSOR; - else if (gimp_image_mask_value (gdisp->gimage, coords->x, coords->y)) + else if (gimp_channel_value (selection, coords->x, coords->y)) ctype = GIMP_MOUSE_CURSOR; } diff --git a/app/tools/gimpfliptool.c b/app/tools/gimpfliptool.c index 64c3233099..194d58c33b 100644 --- a/app/tools/gimpfliptool.c +++ b/app/tools/gimpfliptool.c @@ -29,10 +29,9 @@ #include "base/tile-manager.h" -#include "core/gimpdrawable.h" +#include "core/gimpchannel.h" #include "core/gimpdrawable-transform.h" #include "core/gimpimage.h" -#include "core/gimpimage-mask.h" #include "core/gimpitem-linked.h" #include "core/gimptoolinfo.h" @@ -206,9 +205,11 @@ gimp_flip_tool_cursor_update (GimpTool *tool, if (gimp_display_coords_in_active_drawable (gdisp, coords)) { + GimpChannel *selection = gimp_image_get_mask (gdisp->gimage); + /* Is there a selected region? If so, is cursor inside? */ - if (gimp_image_mask_is_empty (gdisp->gimage) || - gimp_image_mask_value (gdisp->gimage, coords->x, coords->y)) + if (gimp_channel_is_empty (selection) || + gimp_channel_value (selection, coords->x, coords->y)) { bad_cursor = FALSE; } diff --git a/app/tools/gimpinktool.c b/app/tools/gimpinktool.c index b637924b8c..ed71b210ca 100644 --- a/app/tools/gimpinktool.c +++ b/app/tools/gimpinktool.c @@ -35,9 +35,8 @@ #include "paint-funcs/paint-funcs.h" #include "core/gimp.h" -#include "core/gimpdrawable.h" +#include "core/gimpchannel.h" #include "core/gimpimage.h" -#include "core/gimpimage-mask.h" #include "core/gimpimage-undo-push.h" #include "core/gimptoolinfo.h" @@ -465,12 +464,14 @@ gimp_ink_tool_cursor_update (GimpTool *tool, if (gimp_display_coords_in_active_drawable (gdisp, coords)) { + GimpChannel *selection = gimp_image_get_mask (gdisp->gimage); + /* One more test--is there a selected region? * if so, is cursor inside? */ - if (gimp_image_mask_is_empty (gdisp->gimage)) + if (gimp_channel_is_empty (selection)) ctype = GIMP_MOUSE_CURSOR; - else if (gimp_image_mask_value (gdisp->gimage, coords->x, coords->y)) + else if (gimp_channel_value (selection, coords->x, coords->y)) ctype = GIMP_MOUSE_CURSOR; } diff --git a/app/tools/gimpmovetool.c b/app/tools/gimpmovetool.c index 3db49c59c1..bbcd7b71ca 100644 --- a/app/tools/gimpmovetool.c +++ b/app/tools/gimpmovetool.c @@ -26,9 +26,9 @@ #include "tools-types.h" +#include "core/gimpchannel.h" #include "core/gimpimage.h" #include "core/gimpimage-guides.h" -#include "core/gimpimage-mask.h" #include "core/gimplayer.h" #include "core/gimplayer-floating-sel.h" #include "core/gimptoolinfo.h" @@ -240,7 +240,8 @@ gimp_move_tool_button_press (GimpTool *tool, move->guide_disp = NULL; move->moving_guide = FALSE; - if (options->move_mask && ! gimp_image_mask_is_empty (gdisp->gimage)) + if (options->move_mask && + ! gimp_channel_is_empty (gimp_image_get_mask (gdisp->gimage))) { init_edit_selection (tool, gdisp, coords, EDIT_MASK_TRANSLATE); gimp_tool_control_activate (tool->control); @@ -515,7 +516,8 @@ gimp_move_tool_cursor_update (GimpTool *tool, move = GIMP_MOVE_TOOL (tool); options = GIMP_MOVE_OPTIONS (tool->tool_info->tool_options); - if (options->move_mask && ! gimp_image_mask_is_empty (gdisp->gimage)) + if (options->move_mask && + ! gimp_channel_is_empty (gimp_image_get_mask (gdisp->gimage))) { gimp_tool_set_cursor (tool, gdisp, GIMP_MOUSE_CURSOR, diff --git a/app/tools/gimpselectiontool.c b/app/tools/gimpselectiontool.c index afb195be34..3e3cefaf60 100644 --- a/app/tools/gimpselectiontool.c +++ b/app/tools/gimpselectiontool.c @@ -25,8 +25,8 @@ #include "tools-types.h" +#include "core/gimpchannel.h" #include "core/gimpimage.h" -#include "core/gimpimage-mask.h" #include "core/gimptoolinfo.h" #include "display/gimpdisplay.h" @@ -177,6 +177,7 @@ gimp_selection_tool_oper_update (GimpTool *tool, { GimpSelectionTool *selection_tool; GimpSelectionOptions *options; + GimpChannel *selection; GimpLayer *layer; GimpLayer *floating_sel; gboolean move_layer = FALSE; @@ -185,7 +186,9 @@ gimp_selection_tool_oper_update (GimpTool *tool, selection_tool = GIMP_SELECTION_TOOL (tool); options = GIMP_SELECTION_OPTIONS (tool->tool_info->tool_options); - layer = gimp_image_pick_correlate_layer (gdisp->gimage, coords->x, coords->y); + selection = gimp_image_get_mask (gdisp->gimage); + layer = gimp_image_pick_correlate_layer (gdisp->gimage, + coords->x, coords->y); floating_sel = gimp_image_floating_sel (gdisp->gimage); if (layer) @@ -195,7 +198,7 @@ gimp_selection_tool_oper_update (GimpTool *tool, if (layer == floating_sel) move_floating_sel = TRUE; } - else if (gimp_image_mask_value (gdisp->gimage, coords->x, coords->y)) + else if (gimp_channel_value (selection, coords->x, coords->y)) { move_layer = TRUE; } @@ -205,7 +208,7 @@ gimp_selection_tool_oper_update (GimpTool *tool, { selection_tool->op = SELECTION_MOVE_COPY; /* move a copy of the selection */ } - else if ((state & GDK_MOD1_MASK) && ! gimp_image_mask_is_empty (gdisp->gimage)) + else if ((state & GDK_MOD1_MASK) && ! gimp_channel_is_empty (selection)) { selection_tool->op = SELECTION_MOVE_MASK; /* move the selection mask */ } diff --git a/app/tools/gimpsourcetool.c b/app/tools/gimpsourcetool.c index 0df3a57e17..4a31083a2c 100644 --- a/app/tools/gimpsourcetool.c +++ b/app/tools/gimpsourcetool.c @@ -24,9 +24,8 @@ #include "tools-types.h" -#include "core/gimpdrawable.h" +#include "core/gimpchannel.h" #include "core/gimpimage.h" -#include "core/gimpimage-mask.h" #include "core/gimptoolinfo.h" #include "paint/gimpclone.h" @@ -247,12 +246,14 @@ gimp_clone_tool_cursor_update (GimpTool *tool, if (gimp_display_coords_in_active_drawable (gdisp, coords)) { + GimpChannel *selection = gimp_image_get_mask (gdisp->gimage); + /* One more test--is there a selected region? * if so, is cursor inside? */ - if (gimp_image_mask_is_empty (gdisp->gimage)) + if (gimp_channel_is_empty (selection)) ctype = GIMP_MOUSE_CURSOR; - else if (gimp_image_mask_value (gdisp->gimage, coords->x, coords->y)) + else if (gimp_channel_value (selection, coords->x, coords->y)) ctype = GIMP_MOUSE_CURSOR; } diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c index aeca0d5a9d..0f3426413c 100644 --- a/app/tools/gimptransformtool.c +++ b/app/tools/gimptransformtool.c @@ -609,8 +609,9 @@ gimp_transform_tool_cursor_update (GimpTool *tool, if (tr_tool->use_grid) { - GdkCursorType ctype = GDK_TOP_LEFT_ARROW; - GimpCursorModifier cmodifier = GIMP_CURSOR_MODIFIER_NONE; + GimpChannel *selection = gimp_image_get_mask (gdisp->gimage); + GdkCursorType ctype = GDK_TOP_LEFT_ARROW; + GimpCursorModifier cmodifier = GIMP_CURSOR_MODIFIER_NONE; switch (options->type) { @@ -629,9 +630,8 @@ gimp_transform_tool_cursor_update (GimpTool *tool, } else if (gimp_display_coords_in_active_drawable (gdisp, coords)) { - if (gimp_image_mask_is_empty (gdisp->gimage) || - gimp_image_mask_value (gdisp->gimage, - coords->x, coords->y)) + if (gimp_channel_is_empty (selection) || + gimp_channel_value (selection, coords->x, coords->y)) { ctype = GIMP_MOUSE_CURSOR; } @@ -641,8 +641,8 @@ gimp_transform_tool_cursor_update (GimpTool *tool, break; case GIMP_TRANSFORM_TYPE_SELECTION: - if (gimp_image_mask_is_empty (gdisp->gimage) || - gimp_image_mask_value (gdisp->gimage, coords->x, coords->y)) + if (gimp_channel_is_empty (selection) || + gimp_channel_value (selection, coords->x, coords->y)) { ctype = GIMP_MOUSE_CURSOR; } diff --git a/tools/pdbgen/pdb/misc_tools.pdb b/tools/pdbgen/pdb/misc_tools.pdb index d713200fb3..c0f06e7bd7 100644 --- a/tools/pdbgen/pdb/misc_tools.pdb +++ b/tools/pdbgen/pdb/misc_tools.pdb @@ -175,10 +175,12 @@ HELP %invoke = ( headers => [ qw ("core/gimpdrawable-bucket-fill.h" - "core/gimpimage-mask.h") ], + "core/gimpchannel.h") ], code => <<'CODE' { - if (! gimp_item_get_image (GIMP_ITEM (drawable))) + GimpImage *gimage = gimp_item_get_image (GIMP_ITEM (drawable)); + + if (! gimage) { success = FALSE; } @@ -186,7 +188,7 @@ HELP { gboolean do_seed_fill; - do_seed_fill = gimp_image_mask_is_empty (gimp_item_get_image (GIMP_ITEM (drawable))); + do_seed_fill = gimp_channel_is_empty (gimp_image_get_mask (gimage)); gimp_drawable_bucket_fill (drawable, fill_mode, paint_mode, opacity / 100.0,