mirror of https://github.com/GNOME/gimp.git
app: move mask_bounds() and mask_intersect() from GimpDrawable to GimpItem
There is nothing drawable-specific in there, and having them on GimpItem enables some simplifications, esp. in upcoming PDB wrappers. None of these refactorings is in this commit though.
This commit is contained in:
parent
178aa9c6dc
commit
095ae5cc9b
|
@ -204,7 +204,8 @@ gimp_edit_paste (GimpImage *image,
|
|||
gboolean have_mask;
|
||||
|
||||
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
|
||||
have_mask = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
have_mask = gimp_item_mask_bounds (GIMP_ITEM (drawable),
|
||||
&x1, &y1, &x2, &y2);
|
||||
|
||||
if (! have_mask &&
|
||||
viewport_width > 0 &&
|
||||
|
@ -537,7 +538,7 @@ gimp_edit_fill_internal (GimpImage *image,
|
|||
TempBuf *pat_buf = NULL;
|
||||
gboolean new_buf;
|
||||
|
||||
if (! gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
return TRUE; /* nothing to do, but the fill succeded */
|
||||
|
||||
drawable_type = gimp_drawable_type (drawable);
|
||||
|
|
|
@ -214,7 +214,7 @@ gimp_drawable_blend (GimpDrawable *drawable,
|
|||
|
||||
image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
|
||||
if (! gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
return;
|
||||
|
||||
gimp_set_busy (image->gimp);
|
||||
|
@ -590,7 +590,7 @@ gradient_precalc_shapeburst (GimpImage *image,
|
|||
gint x, y, width, height;
|
||||
gint off_x, off_y;
|
||||
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height);
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height);
|
||||
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
|
||||
|
||||
pixel_region_init (&maskR, gimp_drawable_get_tiles (GIMP_DRAWABLE (mask)),
|
||||
|
|
|
@ -146,7 +146,7 @@ gimp_drawable_bucket_fill_full (GimpDrawable *drawable,
|
|||
image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
|
||||
bytes = gimp_drawable_bytes (drawable);
|
||||
selection = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
selection = gimp_item_mask_bounds (GIMP_ITEM (drawable), &x1, &y1, &x2, &y2);
|
||||
|
||||
if ((x1 == x2) || (y1 == y2))
|
||||
return;
|
||||
|
|
|
@ -44,7 +44,7 @@ gimp_drawable_calculate_histogram (GimpDrawable *drawable,
|
|||
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
|
||||
g_return_if_fail (histogram != NULL);
|
||||
|
||||
if (! gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
return;
|
||||
|
||||
pixel_region_init (®ion, gimp_drawable_get_tiles (drawable),
|
||||
|
|
|
@ -112,7 +112,7 @@ gimp_drawable_levels_stretch (GimpDrawable *drawable,
|
|||
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
|
||||
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
|
||||
|
||||
if (! gimp_drawable_mask_intersect (drawable, NULL, NULL, NULL, NULL))
|
||||
if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), NULL, NULL, NULL, NULL))
|
||||
return;
|
||||
|
||||
config = g_object_new (GIMP_TYPE_LEVELS_CONFIG, NULL);
|
||||
|
|
|
@ -62,9 +62,9 @@ gimp_drawable_apply_operation (GimpDrawable *drawable,
|
|||
g_return_if_fail (undo_desc != NULL);
|
||||
g_return_if_fail (GEGL_IS_NODE (operation));
|
||||
|
||||
if (! gimp_drawable_mask_intersect (drawable,
|
||||
&rect.x, &rect.y,
|
||||
&rect.width, &rect.height))
|
||||
if (! gimp_item_mask_intersect (GIMP_ITEM (drawable),
|
||||
&rect.x, &rect.y,
|
||||
&rect.width, &rect.height))
|
||||
return;
|
||||
|
||||
gimp_drawable_apply_operation_private (drawable,
|
||||
|
|
|
@ -45,7 +45,7 @@ gimp_drawable_process (GimpDrawable *drawable,
|
|||
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
|
||||
g_return_if_fail (undo_desc != NULL);
|
||||
|
||||
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
if (gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
PixelRegion srcPR, destPR;
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ gimp_drawable_merge_shadow_tiles (GimpDrawable *drawable,
|
|||
* extents of the selection mask, as it cannot extend beyond
|
||||
* them.
|
||||
*/
|
||||
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
if (gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
TileManager *tiles = tile_manager_ref (drawable->private->shadow);
|
||||
PixelRegion shadowPR;
|
||||
|
|
|
@ -329,7 +329,7 @@ gimp_drawable_stroke_scan_convert (GimpDrawable *drawable,
|
|||
PixelRegion basePR;
|
||||
|
||||
/* must call gimp_channel_is_empty() instead of relying on
|
||||
* gimp_drawable_mask_intersect() because the selection pretends to
|
||||
* gimp_item_mask_intersect() because the selection pretends to
|
||||
* be empty while it is being stroked, to prevent masking itself.
|
||||
*/
|
||||
if (gimp_channel_is_empty (gimp_image_get_mask (image)))
|
||||
|
@ -339,7 +339,7 @@ gimp_drawable_stroke_scan_convert (GimpDrawable *drawable,
|
|||
w = gimp_item_get_width (GIMP_ITEM (drawable));
|
||||
h = gimp_item_get_height (GIMP_ITEM (drawable));
|
||||
}
|
||||
else if (! gimp_drawable_mask_intersect (drawable, &x, &y, &w, &h))
|
||||
else if (! gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &w, &h))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -830,7 +830,7 @@ gimp_drawable_transform_cut (GimpDrawable *drawable,
|
|||
* gimp_layer_new_from_tiles() later which assumes that the tiles
|
||||
* are either RGB or GRAY. Eeek!!! (Sven)
|
||||
*/
|
||||
if (gimp_drawable_mask_intersect (drawable, &x, &y, &w, &h))
|
||||
if (gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &w, &h))
|
||||
{
|
||||
tiles = gimp_selection_extract (GIMP_SELECTION (gimp_image_get_mask (image)),
|
||||
GIMP_PICKABLE (drawable),
|
||||
|
|
|
@ -1742,120 +1742,6 @@ gimp_drawable_fill_by_type (GimpDrawable *drawable,
|
|||
gimp_drawable_fill (drawable, pattern ? NULL : &color, pattern);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_drawable_mask_bounds (GimpDrawable *drawable,
|
||||
gint *x1,
|
||||
gint *y1,
|
||||
gint *x2,
|
||||
gint *y2)
|
||||
{
|
||||
GimpItem *item;
|
||||
GimpImage *image;
|
||||
GimpChannel *selection;
|
||||
gint tmp_x1, tmp_y1;
|
||||
gint tmp_x2, tmp_y2;
|
||||
gboolean retval;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
|
||||
|
||||
item = GIMP_ITEM (drawable);
|
||||
|
||||
g_return_val_if_fail (gimp_item_is_attached (item), FALSE);
|
||||
|
||||
image = gimp_item_get_image (item);
|
||||
selection = gimp_image_get_mask (image);
|
||||
|
||||
if (GIMP_DRAWABLE (selection) != drawable &&
|
||||
gimp_channel_bounds (selection, &tmp_x1, &tmp_y1, &tmp_x2, &tmp_y2))
|
||||
{
|
||||
gint off_x, off_y;
|
||||
|
||||
gimp_item_get_offset (item, &off_x, &off_y);
|
||||
|
||||
tmp_x1 = CLAMP (tmp_x1 - off_x, 0, gimp_item_get_width (item));
|
||||
tmp_y1 = CLAMP (tmp_y1 - off_y, 0, gimp_item_get_height (item));
|
||||
tmp_x2 = CLAMP (tmp_x2 - off_x, 0, gimp_item_get_width (item));
|
||||
tmp_y2 = CLAMP (tmp_y2 - off_y, 0, gimp_item_get_height (item));
|
||||
|
||||
retval = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp_x1 = 0;
|
||||
tmp_y1 = 0;
|
||||
tmp_x2 = gimp_item_get_width (item);
|
||||
tmp_y2 = gimp_item_get_height (item);
|
||||
|
||||
retval = FALSE;
|
||||
}
|
||||
|
||||
if (x1) *x1 = tmp_x1;
|
||||
if (y1) *y1 = tmp_y1;
|
||||
if (x2) *x2 = tmp_x2;
|
||||
if (y2) *y2 = tmp_y2;
|
||||
|
||||
return retval;;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_drawable_mask_intersect (GimpDrawable *drawable,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
GimpItem *item;
|
||||
GimpImage *image;
|
||||
GimpChannel *selection;
|
||||
gint tmp_x, tmp_y;
|
||||
gint tmp_width, tmp_height;
|
||||
gboolean retval;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
|
||||
|
||||
item = GIMP_ITEM (drawable);
|
||||
|
||||
g_return_val_if_fail (gimp_item_is_attached (item), FALSE);
|
||||
|
||||
image = gimp_item_get_image (item);
|
||||
selection = gimp_image_get_mask (image);
|
||||
|
||||
if (GIMP_DRAWABLE (selection) != drawable &&
|
||||
gimp_channel_bounds (selection, &tmp_x, &tmp_y, &tmp_width, &tmp_height))
|
||||
{
|
||||
gint off_x, off_y;
|
||||
|
||||
gimp_item_get_offset (item, &off_x, &off_y);
|
||||
|
||||
tmp_width -= tmp_x;
|
||||
tmp_height -= tmp_y;
|
||||
|
||||
retval = gimp_rectangle_intersect (tmp_x - off_x, tmp_y - off_y,
|
||||
tmp_width, tmp_height,
|
||||
0, 0,
|
||||
gimp_item_get_width (item),
|
||||
gimp_item_get_height (item),
|
||||
&tmp_x, &tmp_y,
|
||||
&tmp_width, &tmp_height);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp_x = 0;
|
||||
tmp_y = 0;
|
||||
tmp_width = gimp_item_get_width (item);
|
||||
tmp_height = gimp_item_get_height (item);
|
||||
|
||||
retval = TRUE;
|
||||
}
|
||||
|
||||
if (x) *x = tmp_x;
|
||||
if (y) *y = tmp_y;
|
||||
if (width) *width = tmp_width;
|
||||
if (height) *height = tmp_height;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_drawable_has_alpha (const GimpDrawable *drawable)
|
||||
{
|
||||
|
|
|
@ -222,17 +222,6 @@ void gimp_drawable_fill_by_type (GimpDrawable *drawable,
|
|||
GimpContext *context,
|
||||
GimpFillType fill_type);
|
||||
|
||||
gboolean gimp_drawable_mask_bounds (GimpDrawable *drawable,
|
||||
gint *x1,
|
||||
gint *y1,
|
||||
gint *x2,
|
||||
gint *y2);
|
||||
gboolean gimp_drawable_mask_intersect (GimpDrawable *drawable,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height);
|
||||
|
||||
gboolean gimp_drawable_has_alpha (const GimpDrawable *drawable);
|
||||
GimpImageType gimp_drawable_type (const GimpDrawable *drawable);
|
||||
GimpImageType gimp_drawable_type_with_alpha (const GimpDrawable *drawable);
|
||||
|
|
|
@ -348,9 +348,9 @@ gimp_image_map_apply (GimpImageMap *image_map,
|
|||
return;
|
||||
|
||||
/* The application should occur only within selection bounds */
|
||||
if (! gimp_drawable_mask_intersect (image_map->drawable,
|
||||
&rect.x, &rect.y,
|
||||
&rect.width, &rect.height))
|
||||
if (! gimp_item_mask_intersect (GIMP_ITEM (image_map->drawable),
|
||||
&rect.x, &rect.y,
|
||||
&rect.width, &rect.height))
|
||||
return;
|
||||
|
||||
/* If undo tiles don't exist, or change size, (re)allocate */
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include "gimp.h"
|
||||
#include "gimp-parasites.h"
|
||||
#include "gimpdrawable.h"
|
||||
#include "gimpchannel.h"
|
||||
#include "gimpimage.h"
|
||||
#include "gimpimage-undo.h"
|
||||
#include "gimpimage-undo-push.h"
|
||||
|
@ -1788,6 +1788,112 @@ gimp_item_is_content_locked (const GimpItem *item)
|
|||
return GIMP_ITEM_GET_CLASS (item)->is_content_locked (item);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_item_mask_bounds (GimpItem *item,
|
||||
gint *x1,
|
||||
gint *y1,
|
||||
gint *x2,
|
||||
gint *y2)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpChannel *selection;
|
||||
gint tmp_x1, tmp_y1;
|
||||
gint tmp_x2, tmp_y2;
|
||||
gboolean retval;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
|
||||
g_return_val_if_fail (gimp_item_is_attached (item), FALSE);
|
||||
|
||||
image = gimp_item_get_image (item);
|
||||
selection = gimp_image_get_mask (image);
|
||||
|
||||
if (GIMP_ITEM (selection) != item &&
|
||||
gimp_channel_bounds (selection, &tmp_x1, &tmp_y1, &tmp_x2, &tmp_y2))
|
||||
{
|
||||
gint off_x, off_y;
|
||||
|
||||
gimp_item_get_offset (item, &off_x, &off_y);
|
||||
|
||||
tmp_x1 = CLAMP (tmp_x1 - off_x, 0, gimp_item_get_width (item));
|
||||
tmp_y1 = CLAMP (tmp_y1 - off_y, 0, gimp_item_get_height (item));
|
||||
tmp_x2 = CLAMP (tmp_x2 - off_x, 0, gimp_item_get_width (item));
|
||||
tmp_y2 = CLAMP (tmp_y2 - off_y, 0, gimp_item_get_height (item));
|
||||
|
||||
retval = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp_x1 = 0;
|
||||
tmp_y1 = 0;
|
||||
tmp_x2 = gimp_item_get_width (item);
|
||||
tmp_y2 = gimp_item_get_height (item);
|
||||
|
||||
retval = FALSE;
|
||||
}
|
||||
|
||||
if (x1) *x1 = tmp_x1;
|
||||
if (y1) *y1 = tmp_y1;
|
||||
if (x2) *x2 = tmp_x2;
|
||||
if (y2) *y2 = tmp_y2;
|
||||
|
||||
return retval;;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_item_mask_intersect (GimpItem *item,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpChannel *selection;
|
||||
gint tmp_x, tmp_y;
|
||||
gint tmp_width, tmp_height;
|
||||
gboolean retval;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
|
||||
g_return_val_if_fail (gimp_item_is_attached (item), FALSE);
|
||||
|
||||
image = gimp_item_get_image (item);
|
||||
selection = gimp_image_get_mask (image);
|
||||
|
||||
if (GIMP_ITEM (selection) != item &&
|
||||
gimp_channel_bounds (selection, &tmp_x, &tmp_y, &tmp_width, &tmp_height))
|
||||
{
|
||||
gint off_x, off_y;
|
||||
|
||||
gimp_item_get_offset (item, &off_x, &off_y);
|
||||
|
||||
tmp_width -= tmp_x;
|
||||
tmp_height -= tmp_y;
|
||||
|
||||
retval = gimp_rectangle_intersect (tmp_x - off_x, tmp_y - off_y,
|
||||
tmp_width, tmp_height,
|
||||
0, 0,
|
||||
gimp_item_get_width (item),
|
||||
gimp_item_get_height (item),
|
||||
&tmp_x, &tmp_y,
|
||||
&tmp_width, &tmp_height);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp_x = 0;
|
||||
tmp_y = 0;
|
||||
tmp_width = gimp_item_get_width (item);
|
||||
tmp_height = gimp_item_get_height (item);
|
||||
|
||||
retval = TRUE;
|
||||
}
|
||||
|
||||
if (x) *x = tmp_x;
|
||||
if (y) *y = tmp_y;
|
||||
if (width) *width = tmp_width;
|
||||
if (height) *height = tmp_height;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_item_is_in_set (GimpItem *item,
|
||||
GimpItemSet set)
|
||||
|
|
|
@ -312,6 +312,17 @@ gboolean gimp_item_get_lock_content (const GimpItem *item);
|
|||
gboolean gimp_item_can_lock_content (const GimpItem *item);
|
||||
gboolean gimp_item_is_content_locked (const GimpItem *item);
|
||||
|
||||
gboolean gimp_item_mask_bounds (GimpItem *item,
|
||||
gint *x1,
|
||||
gint *y1,
|
||||
gint *x2,
|
||||
gint *y2);
|
||||
gboolean gimp_item_mask_intersect (GimpItem *item,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height);
|
||||
|
||||
gboolean gimp_item_is_in_set (GimpItem *item,
|
||||
GimpItemSet set);
|
||||
|
||||
|
|
|
@ -474,7 +474,8 @@ gimp_palette_import_from_drawable (GimpDrawable *drawable,
|
|||
|
||||
if (selection_only)
|
||||
{
|
||||
if (! gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
if (! gimp_item_mask_intersect (GIMP_ITEM (drawable),
|
||||
&x, &y, &width, &height))
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -657,8 +657,8 @@ gimp_selection_extract (GimpSelection *selection,
|
|||
* actual selection mask
|
||||
*/
|
||||
if (GIMP_IS_DRAWABLE (pickable))
|
||||
non_empty = gimp_drawable_mask_bounds (GIMP_DRAWABLE (pickable),
|
||||
&x1, &y1, &x2, &y2);
|
||||
non_empty = gimp_item_mask_bounds (GIMP_ITEM (pickable),
|
||||
&x1, &y1, &x2, &y2);
|
||||
else
|
||||
non_empty = gimp_channel_bounds (GIMP_CHANNEL (selection),
|
||||
&x1, &y1, &x2, &y2);
|
||||
|
@ -837,7 +837,7 @@ gimp_selection_float (GimpSelection *selection,
|
|||
image = gimp_item_get_image (GIMP_ITEM (selection));
|
||||
|
||||
/* Make sure there is a region to float... */
|
||||
if (! gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2) ||
|
||||
if (! gimp_item_mask_bounds (GIMP_ITEM (drawable), &x1, &y1, &x2, &y2) ||
|
||||
(x1 == x2 || y1 == y2))
|
||||
{
|
||||
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
|
||||
|
|
|
@ -200,14 +200,14 @@ gimp_display_shell_preview_transform (GimpDisplayShell *shell)
|
|||
mask = NULL;
|
||||
mask_offx = mask_offy = 0;
|
||||
|
||||
if (gimp_drawable_mask_bounds (tool->drawable,
|
||||
&mask_x1, &mask_y1,
|
||||
&mask_x2, &mask_y2))
|
||||
if (gimp_item_mask_bounds (GIMP_ITEM (tool->drawable),
|
||||
&mask_x1, &mask_y1,
|
||||
&mask_x2, &mask_y2))
|
||||
{
|
||||
mask = gimp_image_get_mask (gimp_display_get_image (shell->display));
|
||||
|
||||
gimp_item_get_offset (GIMP_ITEM (tool->drawable),
|
||||
&mask_offx, &mask_offy);
|
||||
&mask_offx, &mask_offy);
|
||||
}
|
||||
|
||||
if (GIMP_IS_PERSPECTIVE_TOOL (tr_tool))
|
||||
|
|
|
@ -799,7 +799,7 @@ drawable_mask_bounds_invoker (GimpProcedure *procedure,
|
|||
if (success)
|
||||
{
|
||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error))
|
||||
non_empty = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
non_empty = gimp_item_mask_bounds (GIMP_ITEM (drawable), &x1, &y1, &x2, &y2);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
@ -841,8 +841,8 @@ drawable_mask_intersect_invoker (GimpProcedure *procedure,
|
|||
if (success)
|
||||
{
|
||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error))
|
||||
non_empty = gimp_drawable_mask_intersect (drawable,
|
||||
&x, &y, &width, &height);
|
||||
non_empty = gimp_item_mask_intersect (GIMP_ITEM (drawable),
|
||||
&x, &y, &width, &height);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ drawable_transform_flip_simple_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
success = gimp_drawable_transform_flip (drawable, context,
|
||||
flip_type,
|
||||
|
@ -128,7 +128,7 @@ drawable_transform_flip_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
gint off_x, off_y;
|
||||
|
@ -199,7 +199,7 @@ drawable_transform_flip_default_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
@ -288,7 +288,7 @@ drawable_transform_perspective_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
gint off_x, off_y;
|
||||
|
@ -369,7 +369,7 @@ drawable_transform_perspective_default_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
@ -444,7 +444,7 @@ drawable_transform_rotate_simple_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
success = gimp_drawable_transform_rotate (drawable, context,
|
||||
rotate_type,
|
||||
|
@ -501,7 +501,7 @@ drawable_transform_rotate_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
gint off_x, off_y;
|
||||
|
@ -576,7 +576,7 @@ drawable_transform_rotate_default_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
@ -661,7 +661,7 @@ drawable_transform_scale_invoker (GimpProcedure *procedure,
|
|||
success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) && x0 < x1 && y0 < y1);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
gint off_x, off_y;
|
||||
|
@ -733,7 +733,7 @@ drawable_transform_scale_default_invoker (GimpProcedure *procedure,
|
|||
success = (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error) && x0 < x1 && y0 < y1);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
@ -811,7 +811,7 @@ drawable_transform_shear_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
gint off_x, off_y;
|
||||
|
@ -879,7 +879,7 @@ drawable_transform_shear_default_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
@ -967,7 +967,7 @@ drawable_transform_2d_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
gint off_x, off_y;
|
||||
|
@ -1046,7 +1046,7 @@ drawable_transform_2d_default_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
@ -1139,7 +1139,7 @@ drawable_transform_matrix_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
gint off_x, off_y;
|
||||
|
@ -1226,7 +1226,7 @@ drawable_transform_matrix_default_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
|
|
@ -65,7 +65,7 @@ flip_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
success = gimp_drawable_transform_flip (drawable, context,
|
||||
flip_type, TRUE, 0.0, FALSE);
|
||||
|
@ -120,7 +120,7 @@ perspective_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
@ -190,7 +190,7 @@ rotate_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
@ -266,7 +266,7 @@ scale_invoker (GimpProcedure *procedure,
|
|||
x0 < x1 && y0 < y1);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
@ -337,7 +337,7 @@ shear_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
@ -418,7 +418,7 @@ transform_2d_invoker (GimpProcedure *procedure,
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
|
|
@ -303,9 +303,9 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
|
|||
* where the translation will result in floating the selection
|
||||
* mask and translating the resulting layer
|
||||
*/
|
||||
gimp_drawable_mask_bounds (GIMP_DRAWABLE (active_item),
|
||||
&edit_select->x1, &edit_select->y1,
|
||||
&edit_select->x2, &edit_select->y2);
|
||||
gimp_item_mask_bounds (active_item,
|
||||
&edit_select->x1, &edit_select->y1,
|
||||
&edit_select->x2, &edit_select->y2);
|
||||
}
|
||||
|
||||
gimp_edit_selection_tool_calc_coords (edit_select,
|
||||
|
|
|
@ -184,8 +184,8 @@ gimp_selection_tool_oper_update (GimpTool *tool,
|
|||
if (layer == floating_sel)
|
||||
move_floating_sel = TRUE;
|
||||
}
|
||||
else if (gimp_drawable_mask_intersect (drawable,
|
||||
NULL, NULL, NULL, NULL))
|
||||
else if (gimp_item_mask_intersect (GIMP_ITEM (drawable),
|
||||
NULL, NULL, NULL, NULL))
|
||||
{
|
||||
move_layer = TRUE;
|
||||
}
|
||||
|
|
|
@ -1540,9 +1540,9 @@ gimp_transform_tool_bounds (GimpTransformTool *tr_tool,
|
|||
|
||||
gimp_item_get_offset (GIMP_ITEM (drawable), &offset_x, &offset_y);
|
||||
|
||||
gimp_drawable_mask_bounds (drawable,
|
||||
&tr_tool->x1, &tr_tool->y1,
|
||||
&tr_tool->x2, &tr_tool->y2);
|
||||
gimp_item_mask_bounds (GIMP_ITEM (drawable),
|
||||
&tr_tool->x1, &tr_tool->y1,
|
||||
&tr_tool->x2, &tr_tool->y2);
|
||||
tr_tool->x1 += offset_x;
|
||||
tr_tool->y1 += offset_y;
|
||||
tr_tool->x2 += offset_x;
|
||||
|
|
|
@ -232,7 +232,7 @@ HELP
|
|||
code => <<'CODE'
|
||||
{
|
||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error))
|
||||
non_empty = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
non_empty = gimp_item_mask_bounds (GIMP_ITEM (drawable), &x1, &y1, &x2, &y2);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
@ -279,8 +279,8 @@ HELP
|
|||
code => <<'CODE'
|
||||
{
|
||||
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error))
|
||||
non_empty = gimp_drawable_mask_intersect (drawable,
|
||||
&x, &y, &width, &height);
|
||||
non_empty = gimp_item_mask_intersect (GIMP_ITEM (drawable),
|
||||
&x, &y, &width, &height);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ sub transform_invoke {
|
|||
success = $success_check
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
gint off_x, off_y;
|
||||
|
@ -84,7 +84,7 @@ sub transform_default_invoke {
|
|||
success = $success_check
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
@ -168,7 +168,7 @@ HELP
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
success = gimp_drawable_transform_flip (drawable, context,
|
||||
flip_type,
|
||||
|
@ -465,7 +465,7 @@ HELP
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, FALSE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
success = gimp_drawable_transform_rotate (drawable, context,
|
||||
rotate_type,
|
||||
|
|
|
@ -40,7 +40,7 @@ sub flip {
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
success = gimp_drawable_transform_flip (drawable, context,
|
||||
flip_type, TRUE, 0.0, FALSE);
|
||||
|
@ -97,7 +97,7 @@ sub perspective {
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
@ -161,7 +161,7 @@ sub rotate {
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
@ -235,7 +235,7 @@ sub scale {
|
|||
x0 < x1 && y0 < y1);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
@ -301,7 +301,7 @@ sub shear {
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
@ -376,7 +376,7 @@ sub transform_2d {
|
|||
success = gimp_pdb_item_is_attached (GIMP_ITEM (drawable), NULL, TRUE, error);
|
||||
|
||||
if (success &&
|
||||
gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
|
||||
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
|
||||
{
|
||||
GimpMatrix3 matrix;
|
||||
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
|
||||
|
|
Loading…
Reference in New Issue