pdb: apply recent fixes to the deprecated transform procedures

Don't transform the tiles of group layers, use the item transform API
instead. Go the same code path if there is no selection.
This commit is contained in:
Michael Natterer 2011-03-25 22:35:46 +01:00
parent 1a359a138d
commit 9424d42d36
4 changed files with 505 additions and 165 deletions

View File

@ -28,6 +28,7 @@
#include "config/gimpcoreconfig.h"
#include "core/gimp-transform-utils.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpdrawable-transform.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -76,12 +77,19 @@ drawable_transform_flip_simple_invoker (GimpProcedure *procedure,
gimp_transform_get_flip_axis (x, y, width, height,
flip_type, auto_center, &axis);
if (! gimp_drawable_transform_flip (drawable, context,
flip_type,
axis,
clip_result))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_flip (drawable, context,
flip_type, axis, clip_result))
{
success = FALSE;
}
}
else
{
gimp_item_flip (GIMP_ITEM (drawable), context,
flip_type, axis, clip_result);
}
}
}
@ -152,12 +160,23 @@ drawable_transform_flip_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("Flipping"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
interpolation, recursion_level,
clip_result, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
interpolation, recursion_level,
clip_result, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
transform_direction,
interpolation, recursion_level,
clip_result, progress);
}
if (progress)
@ -229,12 +248,23 @@ drawable_transform_flip_default_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("Flipping"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress);
}
if (progress)
@ -318,12 +348,23 @@ drawable_transform_perspective_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("Perspective"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
interpolation, recursion_level,
clip_result, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
interpolation, recursion_level,
clip_result, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
transform_direction,
interpolation, recursion_level,
clip_result, progress);
}
if (progress)
@ -405,12 +446,23 @@ drawable_transform_perspective_default_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("Perspective"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress);
}
if (progress)
@ -466,12 +518,21 @@ drawable_transform_rotate_simple_invoker (GimpProcedure *procedure,
gimp_transform_get_rotate_center (x, y, width, height,
auto_center, &cx, &cy);
if (! gimp_drawable_transform_rotate (drawable, context,
rotate_type,
cx, cy,
clip_result))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_rotate (drawable, context,
rotate_type, cx, cy,
clip_result))
{
success = FALSE;
}
}
else
{
gimp_item_rotate (GIMP_ITEM (drawable), context,
rotate_type, cx, cy,
clip_result);
}
}
}
@ -546,12 +607,23 @@ drawable_transform_rotate_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("Rotating"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
interpolation, recursion_level,
clip_result, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
interpolation, recursion_level,
clip_result, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
transform_direction,
interpolation, recursion_level,
clip_result, progress);
}
if (progress)
@ -627,12 +699,23 @@ drawable_transform_rotate_default_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("Rotating"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress);
}
if (progress)
@ -707,12 +790,23 @@ drawable_transform_scale_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("Scaling"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
interpolation, recursion_level,
clip_result, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
interpolation, recursion_level,
clip_result, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
transform_direction,
interpolation, recursion_level,
clip_result, progress);
}
if (progress)
@ -785,12 +879,23 @@ drawable_transform_scale_default_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("Scaling"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress);
}
if (progress)
@ -861,12 +966,23 @@ drawable_transform_shear_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("Shearing"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
interpolation, recursion_level,
clip_result, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
interpolation, recursion_level,
clip_result, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
transform_direction,
interpolation, recursion_level,
clip_result, progress);
}
if (progress)
@ -935,12 +1051,23 @@ drawable_transform_shear_default_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("Shearing"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress);
}
if (progress)
@ -1022,12 +1149,23 @@ drawable_transform_2d_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("2D Transform"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
interpolation, recursion_level,
clip_result, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
interpolation, recursion_level,
clip_result, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
transform_direction,
interpolation, recursion_level,
clip_result, progress);
}
if (progress)
@ -1107,12 +1245,23 @@ drawable_transform_2d_default_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("2D Transforming"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress);
}
if (progress)
@ -1202,12 +1351,23 @@ drawable_transform_matrix_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("2D Transforming"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
interpolation, recursion_level,
clip_result, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
interpolation, recursion_level,
clip_result, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
transform_direction,
interpolation, recursion_level,
clip_result, progress);
}
if (progress)
@ -1295,12 +1455,23 @@ drawable_transform_matrix_default_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("2D Transforming"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress);
}
if (progress)

View File

@ -28,6 +28,7 @@
#include "config/gimpcoreconfig.h"
#include "core/gimp-transform-utils.h"
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpdrawable-transform.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -72,10 +73,19 @@ flip_invoker (GimpProcedure *procedure,
gimp_transform_get_flip_axis (x, y, width, height,
flip_type, TRUE, &axis);
if (! gimp_drawable_transform_flip (drawable, context,
flip_type, axis, FALSE))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_flip (drawable, context,
flip_type, axis, FALSE))
{
success = FALSE;
}
}
else
{
gimp_item_flip (GIMP_ITEM (drawable), context,
flip_type, axis, FALSE);
}
}
}
@ -152,13 +162,24 @@ perspective_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("Perspective"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
@ -223,13 +244,24 @@ rotate_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("Rotating"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
@ -301,13 +333,24 @@ scale_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("Scaling"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
@ -374,13 +417,24 @@ shear_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("Shearing"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
@ -452,12 +506,23 @@ transform_2d_invoker (GimpProcedure *procedure,
if (progress)
gimp_progress_start (progress, _("2D Transform"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)

View File

@ -54,12 +54,23 @@ $assemble_matrix
if (progress)
gimp_progress_start (progress, _(\"$progress_text\"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
interpolation, recursion_level,
clip_result, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, transform_direction,
interpolation, recursion_level,
clip_result, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
transform_direction,
interpolation, recursion_level,
clip_result, progress);
}
if (progress)
@ -106,14 +117,25 @@ $assemble_matrix
if (progress)
gimp_progress_start (progress, _(\"$progress_text\"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
clip_result, progress);
}
if (progress)
gimp_progress_end (progress);
}
@ -161,12 +183,19 @@ sub drawable_transform_flip_simple {
gimp_transform_get_flip_axis (x, y, width, height,
flip_type, auto_center, &axis);
if (! gimp_drawable_transform_flip (drawable, context,
flip_type,
axis,
clip_result))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_flip (drawable, context,
flip_type, axis, clip_result))
{
success = FALSE;
}
}
else
{
gimp_item_flip (GIMP_ITEM (drawable), context,
flip_type, axis, clip_result);
}
}
}
@ -399,12 +428,21 @@ sub drawable_transform_rotate_simple {
gimp_transform_get_rotate_center (x, y, width, height,
auto_center, &cx, &cy);
if (! gimp_drawable_transform_rotate (drawable, context,
rotate_type,
cx, cy,
clip_result))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_rotate (drawable, context,
rotate_type, cx, cy,
clip_result))
{
success = FALSE;
}
}
else
{
gimp_item_rotate (GIMP_ITEM (drawable), context,
rotate_type, cx, cy,
clip_result);
}
}
}
@ -848,6 +886,7 @@ CODE
"config/gimpcoreconfig.h"
"core/gimp.h"
"core/gimp-transform-utils.h"
"core/gimpchannel.h"
"core/gimpimage.h"
"core/gimpdrawable.h"
"core/gimpdrawable-transform.h"

View File

@ -47,10 +47,19 @@ sub flip {
gimp_transform_get_flip_axis (x, y, width, height,
flip_type, TRUE, &axis);
if (! gimp_drawable_transform_flip (drawable, context,
flip_type, axis, FALSE))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_flip (drawable, context,
flip_type, axis, FALSE))
{
success = FALSE;
}
}
else
{
gimp_item_flip (GIMP_ITEM (drawable), context,
flip_type, axis, FALSE);
}
}
}
@ -129,13 +138,24 @@ sub perspective {
if (progress)
gimp_progress_start (progress, _("Perspective"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
@ -194,13 +214,24 @@ sub rotate {
if (progress)
gimp_progress_start (progress, _("Rotating"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
@ -270,13 +301,24 @@ sub scale {
if (progress)
gimp_progress_start (progress, _("Scaling"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
@ -338,13 +380,24 @@ sub shear {
if (progress)
gimp_progress_start (progress, _("Shearing"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
@ -410,12 +463,23 @@ sub transform_2d {
if (progress)
gimp_progress_start (progress, _("2D Transform"), FALSE);
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_channel_is_empty (gimp_image_get_mask (gimp_item_get_image (GIMP_ITEM (drawable)))))
{
success = FALSE;
if (! gimp_drawable_transform_affine (drawable, context,
&matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, 3,
FALSE, progress))
{
success = FALSE;
}
}
else
{
gimp_item_transform (GIMP_ITEM (drawable), context, &matrix,
GIMP_TRANSFORM_FORWARD,
interpolation, 3,
FALSE, progress);
}
if (progress)
@ -430,6 +494,7 @@ CODE
@headers = qw("libgimpmath/gimpmath.h"
"config/gimpcoreconfig.h"
"core/gimp.h"
"core/gimpchannel.h"
"core/gimp-transform-utils.h"
"core/gimpimage.h"
"core/gimpdrawable.h"