pdb: fix image-mask transforms

In the various PDB transform functions, avoid erroneously creating
a floating selection when transforming the image mask, and rather
transform the mask normally.
This commit is contained in:
Ell
2019-08-09 22:18:24 +03:00
parent f221b424c0
commit 75d3276aa7
6 changed files with 296 additions and 162 deletions

View File

@ -80,11 +80,15 @@ drawable_transform_flip_simple_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
gimp_transform_get_flip_axis (x, y, width, height, gimp_transform_get_flip_axis (x, y, width, height,
flip_type, auto_center, &axis); flip_type, auto_center, &axis);
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_flip (drawable, context, if (! gimp_drawable_transform_flip (drawable, context,
flip_type, axis, clip_result)) flip_type, axis, clip_result))
@ -151,6 +155,8 @@ drawable_transform_flip_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
gint off_x, off_y; gint off_x, off_y;
@ -167,8 +173,9 @@ drawable_transform_flip_invoker (GimpProcedure *procedure,
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("Flipping")); gimp_progress_start (progress, FALSE, _("Flipping"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction, &matrix, transform_direction,
@ -239,6 +246,8 @@ drawable_transform_flip_default_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y; gint off_x, off_y;
@ -259,8 +268,9 @@ drawable_transform_flip_default_invoker (GimpProcedure *procedure,
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("Flipping")); gimp_progress_start (progress, FALSE, _("Flipping"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD, &matrix, GIMP_TRANSFORM_FORWARD,
@ -342,6 +352,8 @@ drawable_transform_perspective_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
gint off_x, off_y; gint off_x, off_y;
@ -360,8 +372,9 @@ drawable_transform_perspective_invoker (GimpProcedure *procedure,
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("Perspective")); gimp_progress_start (progress, FALSE, _("Perspective"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction, &matrix, transform_direction,
@ -440,6 +453,8 @@ drawable_transform_perspective_default_invoker (GimpProcedure *procedure
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y; gint off_x, off_y;
@ -462,8 +477,9 @@ drawable_transform_perspective_default_invoker (GimpProcedure *procedure
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("Perspective")); gimp_progress_start (progress, FALSE, _("Perspective"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD, &matrix, GIMP_TRANSFORM_FORWARD,
@ -532,14 +548,17 @@ drawable_transform_rotate_simple_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
gdouble cx = center_x; gdouble cx = center_x;
gdouble cy = center_y; gdouble cy = center_y;
gimp_transform_get_rotate_center (x, y, width, height, gimp_transform_get_rotate_center (x, y, width, height,
auto_center, &cx, &cy); auto_center, &cx, &cy);
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_rotate (drawable, context, if (! gimp_drawable_transform_rotate (drawable, context,
rotate_type, cx, cy, rotate_type, cx, cy,
@ -608,6 +627,8 @@ drawable_transform_rotate_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
gint off_x, off_y; gint off_x, off_y;
@ -628,8 +649,9 @@ drawable_transform_rotate_invoker (GimpProcedure *procedure,
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("Rotating")); gimp_progress_start (progress, FALSE, _("Rotating"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction, &matrix, transform_direction,
@ -700,6 +722,8 @@ drawable_transform_rotate_default_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y; gint off_x, off_y;
@ -724,8 +748,9 @@ drawable_transform_rotate_default_invoker (GimpProcedure *procedure,
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("Rotating")); gimp_progress_start (progress, FALSE, _("Rotating"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD, &matrix, GIMP_TRANSFORM_FORWARD,
@ -798,6 +823,8 @@ drawable_transform_scale_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
gint off_x, off_y; gint off_x, off_y;
@ -815,8 +842,9 @@ drawable_transform_scale_invoker (GimpProcedure *procedure,
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("Scaling")); gimp_progress_start (progress, FALSE, _("Scaling"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction, &matrix, transform_direction,
@ -887,6 +915,8 @@ drawable_transform_scale_default_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y; gint off_x, off_y;
@ -908,8 +938,9 @@ drawable_transform_scale_default_invoker (GimpProcedure *procedure,
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("Scaling")); gimp_progress_start (progress, FALSE, _("Scaling"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD, &matrix, GIMP_TRANSFORM_FORWARD,
@ -979,6 +1010,8 @@ drawable_transform_shear_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
gint off_x, off_y; gint off_x, off_y;
@ -996,8 +1029,9 @@ drawable_transform_shear_invoker (GimpProcedure *procedure,
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("Shearing")); gimp_progress_start (progress, FALSE, _("Shearing"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction, &matrix, transform_direction,
@ -1064,6 +1098,8 @@ drawable_transform_shear_default_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y; gint off_x, off_y;
@ -1085,8 +1121,9 @@ drawable_transform_shear_default_invoker (GimpProcedure *procedure,
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("Shearing")); gimp_progress_start (progress, FALSE, _("Shearing"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD, &matrix, GIMP_TRANSFORM_FORWARD,
@ -1166,6 +1203,8 @@ drawable_transform_2d_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
gint off_x, off_y; gint off_x, off_y;
@ -1184,8 +1223,9 @@ drawable_transform_2d_invoker (GimpProcedure *procedure,
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("2D Transform")); gimp_progress_start (progress, FALSE, _("2D Transform"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction, &matrix, transform_direction,
@ -1262,6 +1302,8 @@ drawable_transform_2d_default_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y; gint off_x, off_y;
@ -1284,8 +1326,9 @@ drawable_transform_2d_default_invoker (GimpProcedure *procedure,
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("2D Transforming")); gimp_progress_start (progress, FALSE, _("2D Transforming"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD, &matrix, GIMP_TRANSFORM_FORWARD,
@ -1369,6 +1412,8 @@ drawable_transform_matrix_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
gint off_x, off_y; gint off_x, off_y;
@ -1391,8 +1436,9 @@ drawable_transform_matrix_invoker (GimpProcedure *procedure,
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("2D Transforming")); gimp_progress_start (progress, FALSE, _("2D Transforming"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction, &matrix, transform_direction,
@ -1473,6 +1519,8 @@ drawable_transform_matrix_default_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y; gint off_x, off_y;
@ -1499,8 +1547,9 @@ drawable_transform_matrix_default_invoker (GimpProcedure *procedure,
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("2D Transforming")); gimp_progress_start (progress, FALSE, _("2D Transforming"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD, &matrix, GIMP_TRANSFORM_FORWARD,

View File

@ -125,6 +125,8 @@ item_transform_flip_simple_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height)) gimp_item_mask_intersect (item, &x, &y, &width, &height))
{ {
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
gint off_x, off_y; gint off_x, off_y;
gimp_item_get_offset (item, &off_x, &off_y); gimp_item_get_offset (item, &off_x, &off_y);
@ -135,8 +137,9 @@ item_transform_flip_simple_invoker (GimpProcedure *procedure,
flip_type, auto_center, &axis); flip_type, auto_center, &axis);
if (GIMP_IS_DRAWABLE (item) && if (GIMP_IS_DRAWABLE (item) &&
item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) && ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item)))) ! gimp_channel_is_empty (mask))
{ {
GimpDrawable *drawable; GimpDrawable *drawable;
@ -208,6 +211,8 @@ item_transform_flip_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height)) gimp_item_mask_intersect (item, &x, &y, &width, &height))
{ {
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
gint off_x, off_y; gint off_x, off_y;
@ -223,8 +228,9 @@ item_transform_flip_invoker (GimpProcedure *procedure,
gimp_progress_start (progress, FALSE, _("Flipping")); gimp_progress_start (progress, FALSE, _("Flipping"));
if (GIMP_IS_DRAWABLE (item) && if (GIMP_IS_DRAWABLE (item) &&
item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) && ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item)))) ! gimp_channel_is_empty (mask))
{ {
GimpDrawable *drawable; GimpDrawable *drawable;
@ -314,6 +320,8 @@ item_transform_perspective_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height)) gimp_item_mask_intersect (item, &x, &y, &width, &height))
{ {
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
gint off_x, off_y; gint off_x, off_y;
@ -332,8 +340,9 @@ item_transform_perspective_invoker (GimpProcedure *procedure,
gimp_progress_start (progress, FALSE, _("Perspective")); gimp_progress_start (progress, FALSE, _("Perspective"));
if (GIMP_IS_DRAWABLE (item) && if (GIMP_IS_DRAWABLE (item) &&
item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) && ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item)))) ! gimp_channel_is_empty (mask))
{ {
GimpDrawable *drawable; GimpDrawable *drawable;
@ -415,6 +424,8 @@ item_transform_rotate_simple_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height)) gimp_item_mask_intersect (item, &x, &y, &width, &height))
{ {
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
gint off_x, off_y; gint off_x, off_y;
gimp_item_get_offset (item, &off_x, &off_y); gimp_item_get_offset (item, &off_x, &off_y);
@ -425,8 +436,9 @@ item_transform_rotate_simple_invoker (GimpProcedure *procedure,
auto_center, &center_x, &center_y); auto_center, &center_x, &center_y);
if (GIMP_IS_DRAWABLE (item) && if (GIMP_IS_DRAWABLE (item) &&
item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) && ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item)))) ! gimp_channel_is_empty (mask))
{ {
GimpDrawable *drawable; GimpDrawable *drawable;
@ -502,6 +514,8 @@ item_transform_rotate_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height)) gimp_item_mask_intersect (item, &x, &y, &width, &height))
{ {
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
gint off_x, off_y; gint off_x, off_y;
@ -522,8 +536,9 @@ item_transform_rotate_invoker (GimpProcedure *procedure,
gimp_progress_start (progress, FALSE, _("Rotating")); gimp_progress_start (progress, FALSE, _("Rotating"));
if (GIMP_IS_DRAWABLE (item) && if (GIMP_IS_DRAWABLE (item) &&
item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) && ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item)))) ! gimp_channel_is_empty (mask))
{ {
GimpDrawable *drawable; GimpDrawable *drawable;
@ -606,6 +621,8 @@ item_transform_scale_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height)) gimp_item_mask_intersect (item, &x, &y, &width, &height))
{ {
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
gint off_x, off_y; gint off_x, off_y;
@ -623,8 +640,9 @@ item_transform_scale_invoker (GimpProcedure *procedure,
gimp_progress_start (progress, FALSE, _("Scaling")); gimp_progress_start (progress, FALSE, _("Scaling"));
if (GIMP_IS_DRAWABLE (item) && if (GIMP_IS_DRAWABLE (item) &&
item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) && ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item)))) ! gimp_channel_is_empty (mask))
{ {
GimpDrawable *drawable; GimpDrawable *drawable;
@ -702,6 +720,8 @@ item_transform_shear_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height)) gimp_item_mask_intersect (item, &x, &y, &width, &height))
{ {
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
gint off_x, off_y; gint off_x, off_y;
@ -719,8 +739,9 @@ item_transform_shear_invoker (GimpProcedure *procedure,
gimp_progress_start (progress, FALSE, _("Shearing")); gimp_progress_start (progress, FALSE, _("Shearing"));
if (GIMP_IS_DRAWABLE (item) && if (GIMP_IS_DRAWABLE (item) &&
item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) && ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item)))) ! gimp_channel_is_empty (mask))
{ {
GimpDrawable *drawable; GimpDrawable *drawable;
@ -808,6 +829,8 @@ item_transform_2d_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height)) gimp_item_mask_intersect (item, &x, &y, &width, &height))
{ {
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
gint off_x, off_y; gint off_x, off_y;
@ -826,8 +849,9 @@ item_transform_2d_invoker (GimpProcedure *procedure,
gimp_progress_start (progress, FALSE, _("2D Transform")); gimp_progress_start (progress, FALSE, _("2D Transform"));
if (GIMP_IS_DRAWABLE (item) && if (GIMP_IS_DRAWABLE (item) &&
item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) && ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item)))) ! gimp_channel_is_empty (mask))
{ {
GimpDrawable *drawable; GimpDrawable *drawable;
@ -919,6 +943,8 @@ item_transform_matrix_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height)) gimp_item_mask_intersect (item, &x, &y, &width, &height))
{ {
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
gint off_x, off_y; gint off_x, off_y;
@ -941,8 +967,9 @@ item_transform_matrix_invoker (GimpProcedure *procedure,
gimp_progress_start (progress, FALSE, _("2D Transforming")); gimp_progress_start (progress, FALSE, _("2D Transforming"));
if (GIMP_IS_DRAWABLE (item) && if (GIMP_IS_DRAWABLE (item) &&
item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) && ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item)))) ! gimp_channel_is_empty (mask))
{ {
GimpDrawable *drawable; GimpDrawable *drawable;

View File

@ -74,13 +74,16 @@ flip_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
gdouble axis; gdouble axis;
gimp_transform_get_flip_axis (x, y, width, height, gimp_transform_get_flip_axis (x, y, width, height,
flip_type, TRUE, &axis); flip_type, TRUE, &axis);
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_flip (drawable, context, if (! gimp_drawable_transform_flip (drawable, context,
flip_type, axis, FALSE)) flip_type, axis, FALSE))
@ -149,6 +152,8 @@ perspective_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y; gint off_x, off_y;
@ -171,8 +176,9 @@ perspective_invoker (GimpProcedure *procedure,
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("Perspective")); gimp_progress_start (progress, FALSE, _("Perspective"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, &matrix,
@ -235,6 +241,8 @@ rotate_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y; gint off_x, off_y;
@ -256,8 +264,9 @@ rotate_invoker (GimpProcedure *procedure,
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("Rotating")); gimp_progress_start (progress, FALSE, _("Rotating"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, &matrix,
@ -327,6 +336,8 @@ scale_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y; gint off_x, off_y;
@ -348,8 +359,9 @@ scale_invoker (GimpProcedure *procedure,
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("Scaling")); gimp_progress_start (progress, FALSE, _("Scaling"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, &matrix,
@ -414,6 +426,8 @@ shear_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y; gint off_x, off_y;
@ -435,8 +449,9 @@ shear_invoker (GimpProcedure *procedure,
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("Shearing")); gimp_progress_start (progress, FALSE, _("Shearing"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, &matrix,
@ -511,6 +526,8 @@ transform_2d_invoker (GimpProcedure *procedure,
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
@ -527,8 +544,9 @@ transform_2d_invoker (GimpProcedure *procedure,
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("2D Transform")); gimp_progress_start (progress, FALSE, _("2D Transform"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD, &matrix, GIMP_TRANSFORM_FORWARD,

View File

@ -45,6 +45,8 @@ sub transform_invoke {
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
gint off_x, off_y; gint off_x, off_y;
@ -59,8 +61,9 @@ $assemble_matrix
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _(\"$progress_text\")); gimp_progress_start (progress, FALSE, _(\"$progress_text\"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction, &matrix, transform_direction,
@ -110,6 +113,8 @@ sub transform_default_invoke {
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y; gint off_x, off_y;
@ -128,8 +133,9 @@ $assemble_matrix
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _(\"$progress_text\")); gimp_progress_start (progress, FALSE, _(\"$progress_text\"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD, &matrix, GIMP_TRANSFORM_FORWARD,
@ -195,11 +201,15 @@ sub drawable_transform_flip_simple {
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
gimp_transform_get_flip_axis (x, y, width, height, gimp_transform_get_flip_axis (x, y, width, height,
flip_type, auto_center, &axis); flip_type, auto_center, &axis);
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_flip (drawable, context, if (! gimp_drawable_transform_flip (drawable, context,
flip_type, axis, clip_result)) flip_type, axis, clip_result))
@ -441,14 +451,17 @@ sub drawable_transform_rotate_simple {
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
gdouble cx = center_x; gdouble cx = center_x;
gdouble cy = center_y; gdouble cy = center_y;
gimp_transform_get_rotate_center (x, y, width, height, gimp_transform_get_rotate_center (x, y, width, height,
auto_center, &cx, &cy); auto_center, &cx, &cy);
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_rotate (drawable, context, if (! gimp_drawable_transform_rotate (drawable, context,
rotate_type, cx, cy, rotate_type, cx, cy,

View File

@ -48,6 +48,8 @@ $success_check
gimp_item_mask_intersect (item, &x, &y, &width, &height)) gimp_item_mask_intersect (item, &x, &y, &width, &height))
{ {
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
gint off_x, off_y; gint off_x, off_y;
@ -62,8 +64,9 @@ $assemble_matrix
gimp_progress_start (progress, FALSE, _(\"$progress_text\")); gimp_progress_start (progress, FALSE, _(\"$progress_text\"));
if (GIMP_IS_DRAWABLE (item) && if (GIMP_IS_DRAWABLE (item) &&
item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) && ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item)))) ! gimp_channel_is_empty (mask))
{ {
GimpDrawable *drawable; GimpDrawable *drawable;
@ -223,6 +226,8 @@ HELP
gimp_item_mask_intersect (item, &x, &y, &width, &height)) gimp_item_mask_intersect (item, &x, &y, &width, &height))
{ {
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
gint off_x, off_y; gint off_x, off_y;
gimp_item_get_offset (item, &off_x, &off_y); gimp_item_get_offset (item, &off_x, &off_y);
@ -233,8 +238,9 @@ HELP
flip_type, auto_center, &axis); flip_type, auto_center, &axis);
if (GIMP_IS_DRAWABLE (item) && if (GIMP_IS_DRAWABLE (item) &&
item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) && ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item)))) ! gimp_channel_is_empty (mask))
{ {
GimpDrawable *drawable; GimpDrawable *drawable;
@ -471,6 +477,8 @@ HELP
gimp_item_mask_intersect (item, &x, &y, &width, &height)) gimp_item_mask_intersect (item, &x, &y, &width, &height))
{ {
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context); GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
gint off_x, off_y; gint off_x, off_y;
gimp_item_get_offset (item, &off_x, &off_y); gimp_item_get_offset (item, &off_x, &off_y);
@ -481,8 +489,9 @@ HELP
auto_center, &center_x, &center_y); auto_center, &center_x, &center_y);
if (GIMP_IS_DRAWABLE (item) && if (GIMP_IS_DRAWABLE (item) &&
item != GIMP_ITEM (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (item)) && ! gimp_viewable_get_children (GIMP_VIEWABLE (item)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item)))) ! gimp_channel_is_empty (mask))
{ {
GimpDrawable *drawable; GimpDrawable *drawable;

View File

@ -44,13 +44,16 @@ sub flip {
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
gdouble axis; gdouble axis;
gimp_transform_get_flip_axis (x, y, width, height, gimp_transform_get_flip_axis (x, y, width, height,
flip_type, TRUE, &axis); flip_type, TRUE, &axis);
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_flip (drawable, context, if (! gimp_drawable_transform_flip (drawable, context,
flip_type, axis, FALSE)) flip_type, axis, FALSE))
@ -121,6 +124,8 @@ sub perspective {
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y; gint off_x, off_y;
@ -143,8 +148,9 @@ sub perspective {
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("Perspective")); gimp_progress_start (progress, FALSE, _("Perspective"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, &matrix,
@ -201,6 +207,8 @@ sub rotate {
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y; gint off_x, off_y;
@ -222,8 +230,9 @@ sub rotate {
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("Rotating")); gimp_progress_start (progress, FALSE, _("Rotating"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, &matrix,
@ -291,6 +300,8 @@ sub scale {
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y; gint off_x, off_y;
@ -312,8 +323,9 @@ sub scale {
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("Scaling")); gimp_progress_start (progress, FALSE, _("Scaling"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, &matrix,
@ -373,6 +385,8 @@ sub shear {
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y; gint off_x, off_y;
@ -394,8 +408,9 @@ sub shear {
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("Shearing")); gimp_progress_start (progress, FALSE, _("Shearing"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, &matrix,
@ -464,6 +479,8 @@ sub transform_2d {
if (success && if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height)) gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{ {
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix; GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE; GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
@ -480,8 +497,9 @@ sub transform_2d {
if (progress) if (progress)
gimp_progress_start (progress, FALSE, _("2D Transform")); gimp_progress_start (progress, FALSE, _("2D Transform"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) && if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable))))) ! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{ {
if (! gimp_drawable_transform_affine (drawable, context, if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD, &matrix, GIMP_TRANSFORM_FORWARD,