added "gboolean clip_result" to GimpItem::flip().

2003-05-13  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpitem.[ch]: added "gboolean clip_result" to
	GimpItem::flip().

	* app/vectors/gimpvectors.c
	* app/tools/gimpfliptool.c: changed accordingly.

	* app/core/gimpdrawable.c: implement GimpItem::flip() and
	GimpItem::transform().

	* app/core/gimpchannel.c
	* app/core/gimplayer.c: chain up in flip() and transform() and do
	only the layer/channel specific stuff here.

	* app/core/gimpdrawable-transform.[ch]: fixed indentation.
	(gimp_drawable_transform_tiles_flip): added "gboolean clip_result"
	and warn that it is not yet implemented.
	(gimp_drawable_transform_tiles_affine): when transforming a
	channel set bg_color to transparent. Clip channels (but not layer
	masks) only if the passed tiles have bpp == 1 (the channel is
	unfloated).
	(gimp_drawable_transform_affine): clip all unfloated channels.

	* app/core/gimpitem-linked.[ch]: added gimp_item_linked_get_list()
	utility function to avoind iterating all layers/channels/vectors
	in all functions.

	* app/tools/gimptransformtool.c: clip all unfloated channels.

	The clipping fixes above together fix bug #112858.
This commit is contained in:
Michael Natterer 2003-05-13 13:57:11 +00:00 committed by Michael Natterer
parent 6745446916
commit a4395cead9
15 changed files with 322 additions and 300 deletions

View File

@ -1,3 +1,35 @@
2003-05-13 Michael Natterer <mitch@gimp.org>
* app/core/gimpitem.[ch]: added "gboolean clip_result" to
GimpItem::flip().
* app/vectors/gimpvectors.c
* app/tools/gimpfliptool.c: changed accordingly.
* app/core/gimpdrawable.c: implement GimpItem::flip() and
GimpItem::transform().
* app/core/gimpchannel.c
* app/core/gimplayer.c: chain up in flip() and transform() and do
only the layer/channel specific stuff here.
* app/core/gimpdrawable-transform.[ch]: fixed indentation.
(gimp_drawable_transform_tiles_flip): added "gboolean clip_result"
and warn that it is not yet implemented.
(gimp_drawable_transform_tiles_affine): when transforming a
channel set bg_color to transparent. Clip channels (but not layer
masks) only if the passed tiles have bpp == 1 (the channel is
unfloated).
(gimp_drawable_transform_affine): clip all unfloated channels.
* app/core/gimpitem-linked.[ch]: added gimp_item_linked_get_list()
utility function to avoind iterating all layers/channels/vectors
in all functions.
* app/tools/gimptransformtool.c: clip all unfloated channels.
The clipping fixes above together fix bug #112858.
2003-05-13 Michael Natterer <mitch@gimp.org> 2003-05-13 Michael Natterer <mitch@gimp.org>
* app/core/gimpimage-mask.c (gimp_image_mask_extract): * app/core/gimpimage-mask.c (gimp_image_mask_extract):

View File

@ -106,13 +106,12 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
GimpProgressFunc progress_callback, GimpProgressFunc progress_callback,
gpointer progress_data) gpointer progress_data)
{ {
GimpImage *gimage; GimpImage *gimage;
PixelRegion destPR; PixelRegion destPR;
TileManager *tiles; TileManager *tiles;
GimpMatrix3 m; GimpMatrix3 m;
GimpMatrix3 im; GimpMatrix3 im;
PixelSurround surround; PixelSurround surround;
gint x1, y1, x2, y2; /* target bounding box */ gint x1, y1, x2, y2; /* target bounding box */
gint x, y; /* target coordinates */ gint x, y; /* target coordinates */
@ -155,7 +154,6 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
/* Get the background color */ /* Get the background color */
gimp_image_get_background (gimage, drawable, bg_color); gimp_image_get_background (gimage, drawable, bg_color);
switch (GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable))) switch (GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable)))
{ {
case GIMP_RGB: case GIMP_RGB:
@ -177,16 +175,15 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
break; break;
} }
/* enable rotating un-floated non-layers */ /* "Outside" a channel is transparency, not the bg color */
if (tile_manager_bpp (float_tiles) == 1) if (GIMP_IS_CHANNEL (drawable))
{ bg_color[0] = TRANSPARENT_OPACITY;
bg_color[0] = OPAQUE_OPACITY;
/* setting alpha = 0 will cause the channel's value to be treated /* setting alpha = 0 will cause the channel's value to be treated
* as alpha and the color channel loops never to be entered * as alpha and the color channel loops never to be entered
*/ */
alpha = 0; if (tile_manager_bpp (float_tiles) == 1)
} alpha = 0;
if (direction == GIMP_TRANSFORM_BACKWARD) if (direction == GIMP_TRANSFORM_BACKWARD)
{ {
@ -203,19 +200,16 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
gimp_matrix3_invert (matrix, m); gimp_matrix3_invert (matrix, m);
} }
#ifdef __GNUC__
#warning FIXME: path_transform_current_path
#endif
#if 0
path_transform_current_path (gimage, matrix, FALSE);
#endif
tile_manager_get_offsets (float_tiles, &u1, &v1); tile_manager_get_offsets (float_tiles, &u1, &v1);
u2 = u1 + tile_manager_width (float_tiles); u2 = u1 + tile_manager_width (float_tiles);
v2 = v1 + tile_manager_height (float_tiles); v2 = v1 + tile_manager_height (float_tiles);
/* Always clip unfloated channels since they must keep their size */
if (G_TYPE_FROM_INSTANCE (drawable) == GIMP_TYPE_CHANNEL && alpha == 0)
clip_result = TRUE;
/* Find the bounding coordinates of target */ /* Find the bounding coordinates of target */
if (alpha == 0 || clip_result) if (clip_result)
{ {
x1 = u1; x1 = u1;
y1 = v1; y1 = v1;
@ -242,9 +236,8 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
} }
/* Get the new temporary buffer for the transformed result */ /* Get the new temporary buffer for the transformed result */
tiles = tile_manager_new ((x2 - x1), (y2 - y1), tiles = tile_manager_new (x2 - x1, y2 - y1, tile_manager_bpp (float_tiles));
tile_manager_bpp (float_tiles)); pixel_region_init (&destPR, tiles, 0, 0, x2 - x, y2 - y1, TRUE);
pixel_region_init (&destPR, tiles, 0, 0, (x2 - x1), (y2 - y1), TRUE);
tile_manager_set_offsets (tiles, x1, y1); tile_manager_set_offsets (tiles, x1, y1);
/* initialise the pixel_surround and pixel_cache accessors */ /* initialise the pixel_surround and pixel_cache accessors */
@ -269,8 +262,7 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
vinc = m[1][0]; vinc = m[1][0];
winc = m[2][0]; winc = m[2][0];
coords = ((interpolation_type != GIMP_INTERPOLATION_NONE) ? coords = (interpolation_type != GIMP_INTERPOLATION_NONE) ? 5 : 1;
5 : 1);
/* these loops could be rearranged, depending on which bit of code /* these loops could be rearranged, depending on which bit of code
* you'd most like to write more than once. * you'd most like to write more than once.
@ -336,9 +328,9 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
if (interpolation_type == GIMP_INTERPOLATION_NONE) if (interpolation_type == GIMP_INTERPOLATION_NONE)
{ {
guchar color[MAX_CHANNELS]; guchar color[MAX_CHANNELS];
gint iu = RINT (u[0]); gint iu = RINT (u[0]);
gint iv = RINT (v[0]); gint iv = RINT (v[0]);
gint b; gint b;
if (iu >= u1 && iu < u2 && if (iu >= u1 && iu < u2 &&
iv >= v1 && iv < v2) iv >= v1 && iv < v2)
@ -435,7 +427,8 @@ TileManager *
gimp_drawable_transform_tiles_flip (GimpDrawable *drawable, gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
TileManager *orig, TileManager *orig,
GimpOrientationType flip_type, GimpOrientationType flip_type,
gdouble axis) gdouble axis,
gboolean clip_result)
{ {
TileManager *new; TileManager *new;
PixelRegion srcPR, destPR; PixelRegion srcPR, destPR;
@ -449,6 +442,16 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL); g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (orig != NULL, NULL); g_return_val_if_fail (orig != NULL, NULL);
#ifdef __GNUC__
#warning FIXME: implement clip_result for flipping
#endif
if (clip_result)
{
g_print ("FIXME: implement clip_result for gimp_drawable_transform_tiles_flip()\n");
return NULL;
}
orig_width = tile_manager_width (orig); orig_width = tile_manager_width (orig);
orig_height = tile_manager_height (orig); orig_height = tile_manager_height (orig);
orig_bpp = tile_manager_bpp (orig); orig_bpp = tile_manager_bpp (orig);
@ -530,6 +533,10 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
{ {
TileManager *new_tiles; TileManager *new_tiles;
/* always clip unfloated channels so they keep their size */
if (GIMP_IS_CHANNEL (drawable) && tile_manager_bpp (float_tiles) == 1)
clip_result = TRUE;
/* transform the buffer */ /* transform the buffer */
new_tiles = gimp_drawable_transform_tiles_affine (drawable, new_tiles = gimp_drawable_transform_tiles_affine (drawable,
float_tiles, float_tiles,
@ -602,7 +609,7 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
/* transform the buffer */ /* transform the buffer */
new_tiles = gimp_drawable_transform_tiles_flip (drawable, float_tiles, new_tiles = gimp_drawable_transform_tiles_flip (drawable, float_tiles,
flip_type, axis); flip_type, axis, FALSE);
/* Free the cut/copied buffer */ /* Free the cut/copied buffer */
tile_manager_destroy (float_tiles); tile_manager_destroy (float_tiles);
@ -680,12 +687,12 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
gimp_layer_new_from_tiles (tiles, gimp_layer_new_from_tiles (tiles,
gimage, gimage,
gimp_drawable_type_with_alpha (drawable), gimp_drawable_type_with_alpha (drawable),
_("Transformation"), _("Transformation"),
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE); GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
if (! layer) if (! layer)
{ {
g_warning ("%s: gimp_layer_new_frome_tiles() failed", g_warning ("%s: gimp_layer_new_frome_tiles() failed",
G_GNUC_FUNCTION); G_GNUC_FUNCTION);
return FALSE; return FALSE;
} }

View File

@ -43,7 +43,6 @@
#include "gimpimage-undo.h" #include "gimpimage-undo.h"
#include "gimpimage-undo-push.h" #include "gimpimage-undo-push.h"
#include "gimpchannel.h" #include "gimpchannel.h"
#include "gimpdrawable-transform.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimpparasitelist.h" #include "gimpparasitelist.h"
@ -77,7 +76,8 @@ static void gimp_channel_resize (GimpItem *item,
gint offy); gint offy);
static void gimp_channel_flip (GimpItem *item, static void gimp_channel_flip (GimpItem *item,
GimpOrientationType flip_type, GimpOrientationType flip_type,
gdouble axis); gdouble axis,
gboolean flip_result);
static void gimp_channel_transform (GimpItem *item, static void gimp_channel_transform (GimpItem *item,
GimpMatrix3 matrix, GimpMatrix3 matrix,
GimpTransformDirection direction, GimpTransformDirection direction,
@ -397,18 +397,11 @@ gimp_channel_resize (GimpItem *item,
static void static void
gimp_channel_flip (GimpItem *item, gimp_channel_flip (GimpItem *item,
GimpOrientationType flip_type, GimpOrientationType flip_type,
gdouble axis) gdouble axis,
gboolean clip_result)
{ {
#ifdef __GNUC__
#warning FIXME: implement clip_result for flipping
#endif
g_print ("FIXME: implement channel flipping\n");
#if 0
GimpChannel *channel; GimpChannel *channel;
GimpImage *gimage; GimpImage *gimage;
TileManager *tiles;
channel = GIMP_CHANNEL (item); channel = GIMP_CHANNEL (item);
gimage = gimp_item_get_image (item); gimage = gimp_item_get_image (item);
@ -416,19 +409,15 @@ gimp_channel_flip (GimpItem *item,
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM, gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Flip Channel")); _("Flip Channel"));
tiles = gimp_drawable_transform_tiles_flip (GIMP_DRAWABLE (channel), if (G_TYPE_FROM_INSTANCE (item) == GIMP_TYPE_CHANNEL)
GIMP_DRAWABLE (channel)->tiles, clip_result = TRUE;
flip_type, axis,
TRUE /* always clip_result */);
if (tiles) GIMP_ITEM_CLASS (parent_class)->flip (item, flip_type, axis, clip_result);
gimp_drawable_transform_paste (GIMP_DRAWABLE (channel), tiles, FALSE);
gimp_image_undo_group_end (gimage); gimp_image_undo_group_end (gimage);
/* bounds are now unknown */ /* bounds are now unknown */
channel->bounds_known = FALSE; channel->bounds_known = FALSE;
#endif
} }
static void static void
@ -442,7 +431,6 @@ gimp_channel_transform (GimpItem *item,
{ {
GimpChannel *channel; GimpChannel *channel;
GimpImage *gimage; GimpImage *gimage;
TileManager *tiles;
channel = GIMP_CHANNEL (item); channel = GIMP_CHANNEL (item);
gimage = gimp_item_get_image (item); gimage = gimp_item_get_image (item);
@ -450,16 +438,12 @@ gimp_channel_transform (GimpItem *item,
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM, gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Transform Channel")); _("Transform Channel"));
tiles = gimp_drawable_transform_tiles_affine (GIMP_DRAWABLE (channel), if (G_TYPE_FROM_INSTANCE (item) == GIMP_TYPE_CHANNEL)
GIMP_DRAWABLE (channel)->tiles, clip_result = TRUE;
matrix, direction,
interpolation_type,
TRUE, /* always clip_result */
progress_callback,
progress_data);
if (tiles) GIMP_ITEM_CLASS (parent_class)->transform (item, matrix, direction,
gimp_drawable_transform_paste (GIMP_DRAWABLE (channel), tiles, FALSE); interpolation_type, clip_result,
progress_callback, progress_data);
gimp_image_undo_group_end (gimage); gimp_image_undo_group_end (gimage);

View File

@ -43,7 +43,6 @@
#include "gimpimage-undo.h" #include "gimpimage-undo.h"
#include "gimpimage-undo-push.h" #include "gimpimage-undo-push.h"
#include "gimpchannel.h" #include "gimpchannel.h"
#include "gimpdrawable-transform.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimpparasitelist.h" #include "gimpparasitelist.h"
@ -77,7 +76,8 @@ static void gimp_channel_resize (GimpItem *item,
gint offy); gint offy);
static void gimp_channel_flip (GimpItem *item, static void gimp_channel_flip (GimpItem *item,
GimpOrientationType flip_type, GimpOrientationType flip_type,
gdouble axis); gdouble axis,
gboolean flip_result);
static void gimp_channel_transform (GimpItem *item, static void gimp_channel_transform (GimpItem *item,
GimpMatrix3 matrix, GimpMatrix3 matrix,
GimpTransformDirection direction, GimpTransformDirection direction,
@ -397,18 +397,11 @@ gimp_channel_resize (GimpItem *item,
static void static void
gimp_channel_flip (GimpItem *item, gimp_channel_flip (GimpItem *item,
GimpOrientationType flip_type, GimpOrientationType flip_type,
gdouble axis) gdouble axis,
gboolean clip_result)
{ {
#ifdef __GNUC__
#warning FIXME: implement clip_result for flipping
#endif
g_print ("FIXME: implement channel flipping\n");
#if 0
GimpChannel *channel; GimpChannel *channel;
GimpImage *gimage; GimpImage *gimage;
TileManager *tiles;
channel = GIMP_CHANNEL (item); channel = GIMP_CHANNEL (item);
gimage = gimp_item_get_image (item); gimage = gimp_item_get_image (item);
@ -416,19 +409,15 @@ gimp_channel_flip (GimpItem *item,
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM, gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Flip Channel")); _("Flip Channel"));
tiles = gimp_drawable_transform_tiles_flip (GIMP_DRAWABLE (channel), if (G_TYPE_FROM_INSTANCE (item) == GIMP_TYPE_CHANNEL)
GIMP_DRAWABLE (channel)->tiles, clip_result = TRUE;
flip_type, axis,
TRUE /* always clip_result */);
if (tiles) GIMP_ITEM_CLASS (parent_class)->flip (item, flip_type, axis, clip_result);
gimp_drawable_transform_paste (GIMP_DRAWABLE (channel), tiles, FALSE);
gimp_image_undo_group_end (gimage); gimp_image_undo_group_end (gimage);
/* bounds are now unknown */ /* bounds are now unknown */
channel->bounds_known = FALSE; channel->bounds_known = FALSE;
#endif
} }
static void static void
@ -442,7 +431,6 @@ gimp_channel_transform (GimpItem *item,
{ {
GimpChannel *channel; GimpChannel *channel;
GimpImage *gimage; GimpImage *gimage;
TileManager *tiles;
channel = GIMP_CHANNEL (item); channel = GIMP_CHANNEL (item);
gimage = gimp_item_get_image (item); gimage = gimp_item_get_image (item);
@ -450,16 +438,12 @@ gimp_channel_transform (GimpItem *item,
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM, gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Transform Channel")); _("Transform Channel"));
tiles = gimp_drawable_transform_tiles_affine (GIMP_DRAWABLE (channel), if (G_TYPE_FROM_INSTANCE (item) == GIMP_TYPE_CHANNEL)
GIMP_DRAWABLE (channel)->tiles, clip_result = TRUE;
matrix, direction,
interpolation_type,
TRUE, /* always clip_result */
progress_callback,
progress_data);
if (tiles) GIMP_ITEM_CLASS (parent_class)->transform (item, matrix, direction,
gimp_drawable_transform_paste (GIMP_DRAWABLE (channel), tiles, FALSE); interpolation_type, clip_result,
progress_callback, progress_data);
gimp_image_undo_group_end (gimage); gimp_image_undo_group_end (gimage);

View File

@ -106,13 +106,12 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
GimpProgressFunc progress_callback, GimpProgressFunc progress_callback,
gpointer progress_data) gpointer progress_data)
{ {
GimpImage *gimage; GimpImage *gimage;
PixelRegion destPR; PixelRegion destPR;
TileManager *tiles; TileManager *tiles;
GimpMatrix3 m; GimpMatrix3 m;
GimpMatrix3 im; GimpMatrix3 im;
PixelSurround surround; PixelSurround surround;
gint x1, y1, x2, y2; /* target bounding box */ gint x1, y1, x2, y2; /* target bounding box */
gint x, y; /* target coordinates */ gint x, y; /* target coordinates */
@ -155,7 +154,6 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
/* Get the background color */ /* Get the background color */
gimp_image_get_background (gimage, drawable, bg_color); gimp_image_get_background (gimage, drawable, bg_color);
switch (GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable))) switch (GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable)))
{ {
case GIMP_RGB: case GIMP_RGB:
@ -177,16 +175,15 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
break; break;
} }
/* enable rotating un-floated non-layers */ /* "Outside" a channel is transparency, not the bg color */
if (tile_manager_bpp (float_tiles) == 1) if (GIMP_IS_CHANNEL (drawable))
{ bg_color[0] = TRANSPARENT_OPACITY;
bg_color[0] = OPAQUE_OPACITY;
/* setting alpha = 0 will cause the channel's value to be treated /* setting alpha = 0 will cause the channel's value to be treated
* as alpha and the color channel loops never to be entered * as alpha and the color channel loops never to be entered
*/ */
alpha = 0; if (tile_manager_bpp (float_tiles) == 1)
} alpha = 0;
if (direction == GIMP_TRANSFORM_BACKWARD) if (direction == GIMP_TRANSFORM_BACKWARD)
{ {
@ -203,19 +200,16 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
gimp_matrix3_invert (matrix, m); gimp_matrix3_invert (matrix, m);
} }
#ifdef __GNUC__
#warning FIXME: path_transform_current_path
#endif
#if 0
path_transform_current_path (gimage, matrix, FALSE);
#endif
tile_manager_get_offsets (float_tiles, &u1, &v1); tile_manager_get_offsets (float_tiles, &u1, &v1);
u2 = u1 + tile_manager_width (float_tiles); u2 = u1 + tile_manager_width (float_tiles);
v2 = v1 + tile_manager_height (float_tiles); v2 = v1 + tile_manager_height (float_tiles);
/* Always clip unfloated channels since they must keep their size */
if (G_TYPE_FROM_INSTANCE (drawable) == GIMP_TYPE_CHANNEL && alpha == 0)
clip_result = TRUE;
/* Find the bounding coordinates of target */ /* Find the bounding coordinates of target */
if (alpha == 0 || clip_result) if (clip_result)
{ {
x1 = u1; x1 = u1;
y1 = v1; y1 = v1;
@ -242,9 +236,8 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
} }
/* Get the new temporary buffer for the transformed result */ /* Get the new temporary buffer for the transformed result */
tiles = tile_manager_new ((x2 - x1), (y2 - y1), tiles = tile_manager_new (x2 - x1, y2 - y1, tile_manager_bpp (float_tiles));
tile_manager_bpp (float_tiles)); pixel_region_init (&destPR, tiles, 0, 0, x2 - x, y2 - y1, TRUE);
pixel_region_init (&destPR, tiles, 0, 0, (x2 - x1), (y2 - y1), TRUE);
tile_manager_set_offsets (tiles, x1, y1); tile_manager_set_offsets (tiles, x1, y1);
/* initialise the pixel_surround and pixel_cache accessors */ /* initialise the pixel_surround and pixel_cache accessors */
@ -269,8 +262,7 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
vinc = m[1][0]; vinc = m[1][0];
winc = m[2][0]; winc = m[2][0];
coords = ((interpolation_type != GIMP_INTERPOLATION_NONE) ? coords = (interpolation_type != GIMP_INTERPOLATION_NONE) ? 5 : 1;
5 : 1);
/* these loops could be rearranged, depending on which bit of code /* these loops could be rearranged, depending on which bit of code
* you'd most like to write more than once. * you'd most like to write more than once.
@ -336,9 +328,9 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
if (interpolation_type == GIMP_INTERPOLATION_NONE) if (interpolation_type == GIMP_INTERPOLATION_NONE)
{ {
guchar color[MAX_CHANNELS]; guchar color[MAX_CHANNELS];
gint iu = RINT (u[0]); gint iu = RINT (u[0]);
gint iv = RINT (v[0]); gint iv = RINT (v[0]);
gint b; gint b;
if (iu >= u1 && iu < u2 && if (iu >= u1 && iu < u2 &&
iv >= v1 && iv < v2) iv >= v1 && iv < v2)
@ -435,7 +427,8 @@ TileManager *
gimp_drawable_transform_tiles_flip (GimpDrawable *drawable, gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
TileManager *orig, TileManager *orig,
GimpOrientationType flip_type, GimpOrientationType flip_type,
gdouble axis) gdouble axis,
gboolean clip_result)
{ {
TileManager *new; TileManager *new;
PixelRegion srcPR, destPR; PixelRegion srcPR, destPR;
@ -449,6 +442,16 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL); g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (orig != NULL, NULL); g_return_val_if_fail (orig != NULL, NULL);
#ifdef __GNUC__
#warning FIXME: implement clip_result for flipping
#endif
if (clip_result)
{
g_print ("FIXME: implement clip_result for gimp_drawable_transform_tiles_flip()\n");
return NULL;
}
orig_width = tile_manager_width (orig); orig_width = tile_manager_width (orig);
orig_height = tile_manager_height (orig); orig_height = tile_manager_height (orig);
orig_bpp = tile_manager_bpp (orig); orig_bpp = tile_manager_bpp (orig);
@ -530,6 +533,10 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
{ {
TileManager *new_tiles; TileManager *new_tiles;
/* always clip unfloated channels so they keep their size */
if (GIMP_IS_CHANNEL (drawable) && tile_manager_bpp (float_tiles) == 1)
clip_result = TRUE;
/* transform the buffer */ /* transform the buffer */
new_tiles = gimp_drawable_transform_tiles_affine (drawable, new_tiles = gimp_drawable_transform_tiles_affine (drawable,
float_tiles, float_tiles,
@ -602,7 +609,7 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
/* transform the buffer */ /* transform the buffer */
new_tiles = gimp_drawable_transform_tiles_flip (drawable, float_tiles, new_tiles = gimp_drawable_transform_tiles_flip (drawable, float_tiles,
flip_type, axis); flip_type, axis, FALSE);
/* Free the cut/copied buffer */ /* Free the cut/copied buffer */
tile_manager_destroy (float_tiles); tile_manager_destroy (float_tiles);
@ -680,12 +687,12 @@ gimp_drawable_transform_paste (GimpDrawable *drawable,
gimp_layer_new_from_tiles (tiles, gimp_layer_new_from_tiles (tiles,
gimage, gimage,
gimp_drawable_type_with_alpha (drawable), gimp_drawable_type_with_alpha (drawable),
_("Transformation"), _("Transformation"),
GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE); GIMP_OPACITY_OPAQUE, GIMP_NORMAL_MODE);
if (! layer) if (! layer)
{ {
g_warning ("%s: gimp_layer_new_frome_tiles() failed", g_warning ("%s: gimp_layer_new_frome_tiles() failed",
G_GNUC_FUNCTION); G_GNUC_FUNCTION);
return FALSE; return FALSE;
} }

View File

@ -44,7 +44,8 @@ TileManager * gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
TileManager * gimp_drawable_transform_tiles_flip (GimpDrawable *drawable, TileManager * gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
TileManager *orig, TileManager *orig,
GimpOrientationType flip_type, GimpOrientationType flip_type,
gdouble axis); gdouble axis,
gboolean clip_result);
gboolean gimp_drawable_transform_affine (GimpDrawable *drawable, gboolean gimp_drawable_transform_affine (GimpDrawable *drawable,
GimpMatrix3 matrix, GimpMatrix3 matrix,

View File

@ -41,6 +41,7 @@
#include "gimpcontext.h" #include "gimpcontext.h"
#include "gimpdrawable.h" #include "gimpdrawable.h"
#include "gimpdrawable-preview.h" #include "gimpdrawable-preview.h"
#include "gimpdrawable-transform.h"
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpimage-mask.h" #include "gimpimage-mask.h"
#include "gimpimage-undo-push.h" #include "gimpimage-undo-push.h"
@ -85,6 +86,17 @@ static void gimp_drawable_resize (GimpItem *item,
gint new_height, gint new_height,
gint offset_x, gint offset_x,
gint offset_y); gint offset_y);
static void gimp_drawable_flip (GimpItem *item,
GimpOrientationType flip_type,
gdouble axis,
gboolean clip_result);
static void gimp_drawable_transform (GimpItem *item,
GimpMatrix3 matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
/* private variables */ /* private variables */
@ -158,6 +170,8 @@ gimp_drawable_class_init (GimpDrawableClass *klass)
item_class->duplicate = gimp_drawable_duplicate; item_class->duplicate = gimp_drawable_duplicate;
item_class->scale = gimp_drawable_scale; item_class->scale = gimp_drawable_scale;
item_class->resize = gimp_drawable_resize; item_class->resize = gimp_drawable_resize;
item_class->flip = gimp_drawable_flip;
item_class->transform = gimp_drawable_transform;
klass->visibility_changed = NULL; klass->visibility_changed = NULL;
} }
@ -454,6 +468,70 @@ gimp_drawable_resize (GimpItem *item,
gimp_viewable_size_changed (GIMP_VIEWABLE (drawable)); gimp_viewable_size_changed (GIMP_VIEWABLE (drawable));
} }
static void
gimp_drawable_flip (GimpItem *item,
GimpOrientationType flip_type,
gdouble axis,
gboolean clip_result)
{
GimpDrawable *drawable;
TileManager *tiles;
gint off_x, off_y;
gint old_off_x, old_off_y;
drawable = GIMP_DRAWABLE (item);
gimp_item_offsets (item, &off_x, &off_y);
tile_manager_get_offsets (drawable->tiles, &old_off_x, &old_off_y);
tile_manager_set_offsets (drawable->tiles, off_x, off_y);
tiles = gimp_drawable_transform_tiles_flip (drawable,
drawable->tiles,
flip_type, axis,
clip_result);
tile_manager_set_offsets (drawable->tiles, old_off_x, old_off_y);
if (tiles)
gimp_drawable_transform_paste (drawable, tiles, FALSE);
}
static void
gimp_drawable_transform (GimpItem *item,
GimpMatrix3 matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data)
{
GimpDrawable *drawable;
TileManager *tiles;
gint off_x, off_y;
gint old_off_x, old_off_y;
drawable = GIMP_DRAWABLE (item);
gimp_item_offsets (item, &off_x, &off_y);
tile_manager_get_offsets (drawable->tiles, &old_off_x, &old_off_y);
tile_manager_set_offsets (drawable->tiles, off_x, off_y);
tiles = gimp_drawable_transform_tiles_affine (drawable,
drawable->tiles,
matrix, direction,
interpolation_type,
clip_result,
progress_callback,
progress_data);
tile_manager_set_offsets (drawable->tiles, old_off_x, old_off_y);
if (tiles)
gimp_drawable_transform_paste (drawable, tiles, FALSE);
}
void void
gimp_drawable_configure (GimpDrawable *drawable, gimp_drawable_configure (GimpDrawable *drawable,
GimpImage *gimage, GimpImage *gimage,

View File

@ -28,6 +28,14 @@
#include "gimplist.h" #include "gimplist.h"
/* local function prototypes */
static GList * gimp_item_linked_get_list (GimpImage *gimage,
GimpItem *item);
/* public functions */
void void
gimp_item_linked_translate (GimpItem *item, gimp_item_linked_translate (GimpItem *item,
gint offset_x, gint offset_x,
@ -35,90 +43,49 @@ gimp_item_linked_translate (GimpItem *item,
gboolean push_undo) gboolean push_undo)
{ {
GimpImage *gimage; GimpImage *gimage;
GimpItem *linked_item; GList *linked_list;
GList *list; GList *list;
g_return_if_fail (GIMP_IS_ITEM (item)); g_return_if_fail (GIMP_IS_ITEM (item));
g_return_if_fail (gimp_item_get_linked (item) == TRUE);
gimage = gimp_item_get_image (item); gimage = gimp_item_get_image (item);
g_return_if_fail (GIMP_IS_IMAGE (gimage)); g_return_if_fail (GIMP_IS_IMAGE (gimage));
for (list = GIMP_LIST (gimage->layers)->list; linked_list = gimp_item_linked_get_list (gimage, item);
list;
list = g_list_next (list))
{
linked_item = (GimpItem *) list->data;
if (linked_item != item && gimp_item_get_linked (linked_item)) for (list = linked_list; list; list = g_list_next (list))
gimp_item_translate (linked_item, offset_x, offset_y, push_undo); gimp_item_translate (GIMP_ITEM (list->data),
} offset_x, offset_y, push_undo);
for (list = GIMP_LIST (gimage->channels)->list; g_list_free (linked_list);
list;
list = g_list_next (list))
{
linked_item = (GimpItem *) list->data;
if (linked_item != item && gimp_item_get_linked (linked_item))
gimp_item_translate (linked_item, offset_x, offset_y, push_undo);
}
for (list = GIMP_LIST (gimage->vectors)->list;
list;
list = g_list_next (list))
{
linked_item = (GimpItem *) list->data;
if (linked_item != item && gimp_item_get_linked (linked_item))
gimp_item_translate (linked_item, offset_x, offset_y, push_undo);
}
} }
void void
gimp_item_linked_flip (GimpItem *item, gimp_item_linked_flip (GimpItem *item,
GimpOrientationType flip_type, GimpOrientationType flip_type,
gdouble axis) gdouble axis,
gboolean clip_result)
{ {
GimpImage *gimage; GimpImage *gimage;
GimpItem *linked_item; GList *linked_list;
GList *list; GList *list;
g_return_if_fail (GIMP_IS_ITEM (item)); g_return_if_fail (GIMP_IS_ITEM (item));
g_return_if_fail (gimp_item_get_linked (item) == TRUE);
gimage = gimp_item_get_image (item); gimage = gimp_item_get_image (item);
g_return_if_fail (GIMP_IS_IMAGE (gimage)); g_return_if_fail (GIMP_IS_IMAGE (gimage));
for (list = GIMP_LIST (gimage->layers)->list; linked_list = gimp_item_linked_get_list (gimage, item);
list;
list = g_list_next (list))
{
linked_item = (GimpItem *) list->data;
if (linked_item != item && gimp_item_get_linked (linked_item)) for (list = linked_list; list; list = g_list_next (list))
gimp_item_flip (linked_item, flip_type, axis); gimp_item_flip (GIMP_ITEM (list->data),
} flip_type, axis, clip_result);
for (list = GIMP_LIST (gimage->channels)->list; g_list_free (linked_list);
list;
list = g_list_next (list))
{
linked_item = (GimpItem *) list->data;
if (linked_item != item && gimp_item_get_linked (linked_item))
gimp_item_flip (linked_item, flip_type, axis);
}
for (list = GIMP_LIST (gimage->vectors)->list;
list;
list = g_list_next (list))
{
linked_item = (GimpItem *) list->data;
if (linked_item != item && gimp_item_get_linked (linked_item))
gimp_item_flip (linked_item, flip_type, axis);
}
} }
void void
@ -131,15 +98,38 @@ gimp_item_linked_transform (GimpItem *item,
gpointer progress_data) gpointer progress_data)
{ {
GimpImage *gimage; GimpImage *gimage;
GimpItem *linked_item; GList *linked_list;
GList *list; GList *list;
g_return_if_fail (GIMP_IS_ITEM (item)); g_return_if_fail (GIMP_IS_ITEM (item));
g_return_if_fail (gimp_item_get_linked (item) == TRUE);
gimage = gimp_item_get_image (item); gimage = gimp_item_get_image (item);
g_return_if_fail (GIMP_IS_IMAGE (gimage)); g_return_if_fail (GIMP_IS_IMAGE (gimage));
linked_list = gimp_item_linked_get_list (gimage, item);
for (list = linked_list; list; list = g_list_next (list))
gimp_item_transform (GIMP_ITEM (list->data),
matrix, direction,
interpolation_type, clip_result,
progress_callback, progress_data);
g_list_free (linked_list);
}
/* private functions */
static GList *
gimp_item_linked_get_list (GimpImage *gimage,
GimpItem *item)
{
GimpItem *linked_item;
GList *list;
GList *linked_list = NULL;
for (list = GIMP_LIST (gimage->layers)->list; for (list = GIMP_LIST (gimage->layers)->list;
list; list;
list = g_list_next (list)) list = g_list_next (list))
@ -147,9 +137,7 @@ gimp_item_linked_transform (GimpItem *item,
linked_item = (GimpItem *) list->data; linked_item = (GimpItem *) list->data;
if (linked_item != item && gimp_item_get_linked (linked_item)) if (linked_item != item && gimp_item_get_linked (linked_item))
gimp_item_transform (linked_item, matrix, direction, linked_list = g_list_prepend (linked_list, linked_item);
interpolation_type, clip_result,
progress_callback, progress_data);
} }
for (list = GIMP_LIST (gimage->channels)->list; for (list = GIMP_LIST (gimage->channels)->list;
@ -159,9 +147,7 @@ gimp_item_linked_transform (GimpItem *item,
linked_item = (GimpItem *) list->data; linked_item = (GimpItem *) list->data;
if (linked_item != item && gimp_item_get_linked (linked_item)) if (linked_item != item && gimp_item_get_linked (linked_item))
gimp_item_transform (linked_item, matrix, direction, linked_list = g_list_prepend (linked_list, linked_item);
interpolation_type, clip_result,
progress_callback, progress_data);
} }
for (list = GIMP_LIST (gimage->vectors)->list; for (list = GIMP_LIST (gimage->vectors)->list;
@ -171,8 +157,8 @@ gimp_item_linked_transform (GimpItem *item,
linked_item = (GimpItem *) list->data; linked_item = (GimpItem *) list->data;
if (linked_item != item && gimp_item_get_linked (linked_item)) if (linked_item != item && gimp_item_get_linked (linked_item))
gimp_item_transform (linked_item, matrix, direction, linked_list = g_list_prepend (linked_list, linked_item);
interpolation_type, clip_result,
progress_callback, progress_data);
} }
return g_list_reverse (linked_list);
} }

View File

@ -26,7 +26,8 @@ void gimp_item_linked_translate (GimpItem *item,
gboolean push_undo); gboolean push_undo);
void gimp_item_linked_flip (GimpItem *item, void gimp_item_linked_flip (GimpItem *item,
GimpOrientationType flip_type, GimpOrientationType flip_type,
gdouble axis); gdouble axis,
gboolean clip_result);
void gimp_item_linked_transform (GimpItem *item, void gimp_item_linked_transform (GimpItem *item,
GimpMatrix3 matrix, GimpMatrix3 matrix,
GimpTransformDirection direction, GimpTransformDirection direction,

View File

@ -683,7 +683,8 @@ gimp_item_resize (GimpItem *item,
void void
gimp_item_flip (GimpItem *item, gimp_item_flip (GimpItem *item,
GimpOrientationType flip_type, GimpOrientationType flip_type,
gdouble axis) gdouble axis,
gboolean clip_result)
{ {
GimpItemClass *item_class; GimpItemClass *item_class;
@ -691,7 +692,7 @@ gimp_item_flip (GimpItem *item,
item_class = GIMP_ITEM_GET_CLASS (item); item_class = GIMP_ITEM_GET_CLASS (item);
item_class->flip (item, flip_type, axis); item_class->flip (item, flip_type, axis, clip_result);
} }
void void

View File

@ -82,7 +82,8 @@ struct _GimpItemClass
gint offset_y); gint offset_y);
void (* flip) (GimpItem *item, void (* flip) (GimpItem *item,
GimpOrientationType flip_type, GimpOrientationType flip_type,
gdouble axis); gdouble axis,
gboolean clip_result);
void (* transform) (GimpItem *item, void (* transform) (GimpItem *item,
GimpMatrix3 matrix, GimpMatrix3 matrix,
GimpTransformDirection direction, GimpTransformDirection direction,
@ -152,7 +153,8 @@ void gimp_item_resize_to_image (GimpItem *item);
void gimp_item_flip (GimpItem *item, void gimp_item_flip (GimpItem *item,
GimpOrientationType flip_type, GimpOrientationType flip_type,
gdouble axis); gdouble axis,
gboolean flip_result);
void gimp_item_transform (GimpItem *item, void gimp_item_transform (GimpItem *item,
GimpMatrix3 matrix, GimpMatrix3 matrix,
GimpTransformDirection direction, GimpTransformDirection direction,

View File

@ -35,7 +35,6 @@
#include "paint-funcs/paint-funcs.h" #include "paint-funcs/paint-funcs.h"
#include "gimpdrawable-invert.h" #include "gimpdrawable-invert.h"
#include "gimpdrawable-transform.h"
#include "gimpcontainer.h" #include "gimpcontainer.h"
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpimage-convert.h" #include "gimpimage-convert.h"
@ -92,7 +91,8 @@ static void gimp_layer_resize (GimpItem *item,
gint offset_y); gint offset_y);
static void gimp_layer_flip (GimpItem *item, static void gimp_layer_flip (GimpItem *item,
GimpOrientationType flip_type, GimpOrientationType flip_type,
gdouble axis); gdouble axis,
gboolean clip_result);
static void gimp_layer_transform (GimpItem *item, static void gimp_layer_transform (GimpItem *item,
GimpMatrix3 matrix, GimpMatrix3 matrix,
GimpTransformDirection direction, GimpTransformDirection direction,
@ -474,13 +474,11 @@ gimp_layer_resize (GimpItem *item,
static void static void
gimp_layer_flip (GimpItem *item, gimp_layer_flip (GimpItem *item,
GimpOrientationType flip_type, GimpOrientationType flip_type,
gdouble axis) gdouble axis,
gboolean clip_result)
{ {
GimpLayer *layer; GimpLayer *layer;
GimpImage *gimage; GimpImage *gimage;
TileManager *tiles;
gint off_x, off_y;
gint old_off_x, old_off_y;
layer = GIMP_LAYER (item); layer = GIMP_LAYER (item);
gimage = gimp_item_get_image (item); gimage = gimp_item_get_image (item);
@ -488,43 +486,12 @@ gimp_layer_flip (GimpItem *item,
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM, gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Flip Layer")); _("Flip Layer"));
gimp_item_offsets (item, &off_x, &off_y); GIMP_ITEM_CLASS (parent_class)->flip (item, flip_type, axis, clip_result);
tile_manager_get_offsets (GIMP_DRAWABLE (layer)->tiles,
&old_off_x, &old_off_y);
tile_manager_set_offsets (GIMP_DRAWABLE (layer)->tiles,
off_x, off_y);
tiles = gimp_drawable_transform_tiles_flip (GIMP_DRAWABLE (layer),
GIMP_DRAWABLE (layer)->tiles,
flip_type, axis);
tile_manager_set_offsets (GIMP_DRAWABLE (layer)->tiles,
old_off_x, old_off_y);
if (tiles)
gimp_drawable_transform_paste (GIMP_DRAWABLE (layer), tiles, FALSE);
/* If there is a layer mask, make sure it gets flipped also */ /* If there is a layer mask, make sure it gets flipped also */
if (layer->mask) if (layer->mask)
{ gimp_item_flip (GIMP_ITEM (layer->mask),
tile_manager_get_offsets (GIMP_DRAWABLE (layer->mask)->tiles, flip_type, axis, clip_result);
&old_off_x, &old_off_y);
tile_manager_set_offsets (GIMP_DRAWABLE (layer->mask)->tiles,
off_x, off_y);
tiles =
gimp_drawable_transform_tiles_flip (GIMP_DRAWABLE (layer->mask),
GIMP_DRAWABLE (layer->mask)->tiles,
flip_type, axis);
tile_manager_set_offsets (GIMP_DRAWABLE (layer->mask)->tiles,
old_off_x, old_off_y);
if (tiles)
gimp_drawable_transform_paste (GIMP_DRAWABLE (layer->mask), tiles,
FALSE);
}
gimp_image_undo_group_end (gimage); gimp_image_undo_group_end (gimage);
@ -541,11 +508,8 @@ gimp_layer_transform (GimpItem *item,
GimpProgressFunc progress_callback, GimpProgressFunc progress_callback,
gpointer progress_data) gpointer progress_data)
{ {
GimpLayer *layer; GimpLayer *layer;
GimpImage *gimage; GimpImage *gimage;
TileManager *tiles;
gint off_x, off_y;
gint old_off_x, old_off_y;
layer = GIMP_LAYER (item); layer = GIMP_LAYER (item);
gimage = gimp_item_get_image (item); gimage = gimp_item_get_image (item);
@ -553,51 +517,16 @@ gimp_layer_transform (GimpItem *item,
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM, gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Transform Layer")); _("Transform Layer"));
gimp_item_offsets (item, &off_x, &off_y); GIMP_ITEM_CLASS (parent_class)->transform (item, matrix, direction,
interpolation_type, clip_result,
tile_manager_get_offsets (GIMP_DRAWABLE (layer)->tiles, progress_callback, progress_data);
&old_off_x, &old_off_y);
tile_manager_set_offsets (GIMP_DRAWABLE (layer)->tiles,
off_x, off_y);
tiles = gimp_drawable_transform_tiles_affine (GIMP_DRAWABLE (layer),
GIMP_DRAWABLE (layer)->tiles,
matrix, direction,
interpolation_type,
clip_result,
progress_callback,
progress_data);
tile_manager_set_offsets (GIMP_DRAWABLE (layer)->tiles,
old_off_x, old_off_y);
if (tiles)
gimp_drawable_transform_paste (GIMP_DRAWABLE (layer), tiles, FALSE);
/* If there is a layer mask, make sure it gets flipped also */ /* If there is a layer mask, make sure it gets flipped also */
if (layer->mask) if (layer->mask)
{ gimp_item_transform (GIMP_ITEM (layer->mask),
tile_manager_get_offsets (GIMP_DRAWABLE (layer->mask)->tiles, matrix, direction,
&old_off_x, &old_off_y); interpolation_type, clip_result,
tile_manager_set_offsets (GIMP_DRAWABLE (layer->mask)->tiles, progress_callback, progress_data);
off_x, off_y);
tiles =
gimp_drawable_transform_tiles_affine (GIMP_DRAWABLE (layer->mask),
GIMP_DRAWABLE (layer->mask)->tiles,
matrix, direction,
interpolation_type,
clip_result,
progress_callback,
progress_data);
tile_manager_set_offsets (GIMP_DRAWABLE (layer->mask)->tiles,
old_off_x, old_off_y);
if (tiles)
gimp_drawable_transform_paste (GIMP_DRAWABLE (layer->mask), tiles,
FALSE);
}
gimp_image_undo_group_end (gimage); gimp_image_undo_group_end (gimage);

View File

@ -264,9 +264,9 @@ gimp_flip_tool_transform (GimpTransformTool *trans_tool,
} }
if (gimp_item_get_linked (active_item)) if (gimp_item_get_linked (active_item))
gimp_item_linked_flip (active_item, options->flip_type, axis); gimp_item_linked_flip (active_item, options->flip_type, axis, FALSE);
return gimp_drawable_transform_tiles_flip (active_drawable, return gimp_drawable_transform_tiles_flip (active_drawable,
trans_tool->original, trans_tool->original,
options->flip_type, axis); options->flip_type, axis, FALSE);
} }

View File

@ -35,8 +35,8 @@
#include "base/tile-manager.h" #include "base/tile-manager.h"
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h" #include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpdrawable-transform.h" #include "core/gimpdrawable-transform.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimpimage-mask.h" #include "core/gimpimage-mask.h"
@ -775,6 +775,7 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
GimpDrawable *active_drawable; GimpDrawable *active_drawable;
GimpItem *active_item; GimpItem *active_item;
GimpProgress *progress; GimpProgress *progress;
gboolean clip_result;
TileManager *ret; TileManager *ret;
tool = GIMP_TOOL (tr_tool); tool = GIMP_TOOL (tr_tool);
@ -797,12 +798,19 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
gimp_progress_update_and_flush : NULL, gimp_progress_update_and_flush : NULL,
progress); progress);
clip_result = options->clip;
/* always clip unfloated channels so they keep their size */
if (GIMP_IS_CHANNEL (active_drawable) &&
tile_manager_bpp (tr_tool->original) == 1)
clip_result = TRUE;
ret = gimp_drawable_transform_tiles_affine (active_drawable, ret = gimp_drawable_transform_tiles_affine (active_drawable,
tr_tool->original, tr_tool->original,
tr_tool->transform, tr_tool->transform,
options->direction, options->direction,
options->interpolation, options->interpolation,
options->clip, clip_result,
progress ? progress ?
gimp_progress_update_and_flush : gimp_progress_update_and_flush :
NULL, NULL,

View File

@ -72,7 +72,8 @@ static void gimp_vectors_resize (GimpItem *item,
gint offset_y); gint offset_y);
static void gimp_vectors_flip (GimpItem *item, static void gimp_vectors_flip (GimpItem *item,
GimpOrientationType flip_type, GimpOrientationType flip_type,
gdouble axis); gdouble axis,
gboolean clip_result);
static void gimp_vectors_transform (GimpItem *item, static void gimp_vectors_transform (GimpItem *item,
GimpMatrix3 matrix, GimpMatrix3 matrix,
GimpTransformDirection direction, GimpTransformDirection direction,
@ -363,7 +364,8 @@ gimp_vectors_resize (GimpItem *item,
static void static void
gimp_vectors_flip (GimpItem *item, gimp_vectors_flip (GimpItem *item,
GimpOrientationType flip_type, GimpOrientationType flip_type,
gdouble axis) gdouble axis,
gboolean clip_result)
{ {
GimpVectors *vectors; GimpVectors *vectors;
GList *list; GList *list;