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 &&
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,
flip_type, auto_center, &axis);
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{
if (! gimp_drawable_transform_flip (drawable, context,
flip_type, axis, clip_result))
@ -151,8 +155,10 @@ drawable_transform_flip_invoker (GimpProcedure *procedure,
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{
GimpMatrix3 matrix;
gint off_x, off_y;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
@ -167,8 +173,9 @@ drawable_transform_flip_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("Flipping"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
@ -239,9 +246,11 @@ drawable_transform_flip_default_invoker (GimpProcedure *procedure,
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{
GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
@ -259,8 +268,9 @@ drawable_transform_flip_default_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("Flipping"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
@ -342,8 +352,10 @@ drawable_transform_perspective_invoker (GimpProcedure *procedure,
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{
GimpMatrix3 matrix;
gint off_x, off_y;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
@ -360,8 +372,9 @@ drawable_transform_perspective_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("Perspective"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
@ -440,9 +453,11 @@ drawable_transform_perspective_default_invoker (GimpProcedure *procedure
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{
GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
@ -462,8 +477,9 @@ drawable_transform_perspective_default_invoker (GimpProcedure *procedure
if (progress)
gimp_progress_start (progress, FALSE, _("Perspective"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
@ -532,14 +548,17 @@ drawable_transform_rotate_simple_invoker (GimpProcedure *procedure,
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{
gdouble cx = center_x;
gdouble cy = center_y;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
gdouble cx = center_x;
gdouble cy = center_y;
gimp_transform_get_rotate_center (x, y, width, height,
auto_center, &cx, &cy);
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{
if (! gimp_drawable_transform_rotate (drawable, context,
rotate_type, cx, cy,
@ -608,8 +627,10 @@ drawable_transform_rotate_invoker (GimpProcedure *procedure,
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{
GimpMatrix3 matrix;
gint off_x, off_y;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
@ -628,8 +649,9 @@ drawable_transform_rotate_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("Rotating"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
@ -700,9 +722,11 @@ drawable_transform_rotate_default_invoker (GimpProcedure *procedure,
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{
GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
@ -724,8 +748,9 @@ drawable_transform_rotate_default_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("Rotating"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
@ -798,8 +823,10 @@ drawable_transform_scale_invoker (GimpProcedure *procedure,
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{
GimpMatrix3 matrix;
gint off_x, off_y;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
@ -815,8 +842,9 @@ drawable_transform_scale_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("Scaling"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
@ -887,9 +915,11 @@ drawable_transform_scale_default_invoker (GimpProcedure *procedure,
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{
GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
@ -908,8 +938,9 @@ drawable_transform_scale_default_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("Scaling"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
@ -979,8 +1010,10 @@ drawable_transform_shear_invoker (GimpProcedure *procedure,
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{
GimpMatrix3 matrix;
gint off_x, off_y;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
@ -996,8 +1029,9 @@ drawable_transform_shear_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("Shearing"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
@ -1064,9 +1098,11 @@ drawable_transform_shear_default_invoker (GimpProcedure *procedure,
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{
GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
@ -1085,8 +1121,9 @@ drawable_transform_shear_default_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("Shearing"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
@ -1166,8 +1203,10 @@ drawable_transform_2d_invoker (GimpProcedure *procedure,
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{
GimpMatrix3 matrix;
gint off_x, off_y;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
@ -1184,8 +1223,9 @@ drawable_transform_2d_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("2D Transform"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
@ -1262,9 +1302,11 @@ drawable_transform_2d_default_invoker (GimpProcedure *procedure,
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{
GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
@ -1284,8 +1326,9 @@ drawable_transform_2d_default_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("2D Transforming"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
@ -1369,8 +1412,10 @@ drawable_transform_matrix_invoker (GimpProcedure *procedure,
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{
GimpMatrix3 matrix;
gint off_x, off_y;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
@ -1391,8 +1436,9 @@ drawable_transform_matrix_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("2D Transforming"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
@ -1473,9 +1519,11 @@ drawable_transform_matrix_default_invoker (GimpProcedure *procedure,
if (success &&
gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height))
{
GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y;
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
GimpInterpolationType interpolation_type = GIMP_INTERPOLATION_NONE;
gint off_x, off_y;
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
@ -1499,8 +1547,9 @@ drawable_transform_matrix_default_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, FALSE, _("2D Transforming"));
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
if (drawable != GIMP_DRAWABLE (mask) &&
! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (mask))
{
if (! gimp_drawable_transform_affine (drawable, context,
&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))
{
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;
gimp_item_get_offset (item, &off_x, &off_y);
@ -134,9 +136,10 @@ item_transform_flip_simple_invoker (GimpProcedure *procedure,
gimp_transform_get_flip_axis (x, y, width, height,
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_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@ -208,6 +211,8 @@ item_transform_flip_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
@ -222,9 +227,10 @@ item_transform_flip_invoker (GimpProcedure *procedure,
if (progress)
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_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@ -314,6 +320,8 @@ item_transform_perspective_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
@ -331,9 +339,10 @@ item_transform_perspective_invoker (GimpProcedure *procedure,
if (progress)
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_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@ -415,6 +424,8 @@ item_transform_rotate_simple_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
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;
gimp_item_get_offset (item, &off_x, &off_y);
@ -424,9 +435,10 @@ item_transform_rotate_simple_invoker (GimpProcedure *procedure,
gimp_transform_get_rotate_center (x, y, width, height,
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_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@ -502,6 +514,8 @@ item_transform_rotate_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
@ -521,9 +535,10 @@ item_transform_rotate_invoker (GimpProcedure *procedure,
if (progress)
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_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@ -606,6 +621,8 @@ item_transform_scale_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
@ -622,9 +639,10 @@ item_transform_scale_invoker (GimpProcedure *procedure,
if (progress)
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_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@ -702,6 +720,8 @@ item_transform_shear_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
@ -718,9 +738,10 @@ item_transform_shear_invoker (GimpProcedure *procedure,
if (progress)
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_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@ -808,6 +829,8 @@ item_transform_2d_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
@ -825,9 +848,10 @@ item_transform_2d_invoker (GimpProcedure *procedure,
if (progress)
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_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@ -919,6 +943,8 @@ item_transform_matrix_invoker (GimpProcedure *procedure,
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
@ -940,9 +966,10 @@ item_transform_matrix_invoker (GimpProcedure *procedure,
if (progress)
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_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;

View File

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

View File

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

View File

@ -48,6 +48,8 @@ $success_check
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
GimpPDBContext *pdb_context = GIMP_PDB_CONTEXT (context);
GimpImage *image = gimp_item_get_image (item);
GimpChannel *mask = gimp_image_get_mask (image);
GimpMatrix3 matrix;
gint off_x, off_y;
@ -61,9 +63,10 @@ $assemble_matrix
if (progress)
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_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@ -223,6 +226,8 @@ HELP
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
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;
gimp_item_get_offset (item, &off_x, &off_y);
@ -232,9 +237,10 @@ HELP
gimp_transform_get_flip_axis (x, y, width, height,
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_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;
@ -471,6 +477,8 @@ HELP
gimp_item_mask_intersect (item, &x, &y, &width, &height))
{
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;
gimp_item_get_offset (item, &off_x, &off_y);
@ -480,9 +488,10 @@ HELP
gimp_transform_get_rotate_center (x, y, width, height,
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_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (item))))
! gimp_channel_is_empty (mask))
{
GimpDrawable *drawable;

View File

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