Commit 45334e63 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Added support for transforming linked layers, channels and vectors. Fixes

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

	Added support for transforming linked layers, channels
	and vectors. Fixes bug #86277.

	* app/core/gimpdrawable-transform.[ch]
	(gimp_drawable_transform_tiles_flip): added "gdouble axis" and
	calculate the resulting drawable offset.
	(gimp_drawable_transform_flip): calculate the axis and pass it to
	the function above.
	(gimp_drawable_transform_[tiles_]affine): reordered parameters.

	* app/core/gimpitem.[ch]: added virtual functions GimpItem::flip()
	and GimpItem::transform().

	* app/core/gimpchannel.c
	* app/core/gimplayer.c
	* app/vectors/gimpvectors.c: implement flip() and transform().
	Note that all functions always transform the whole item,
	regardless of a present selection.

	* app/core/Makefile.am
	* app/core/gimpitem-linked.[ch]: new files containing utility
	functions which translate, flip and transform all linked items.

	* app/tools/gimpfliptool.c
	* app/tools/gimptransformtool.c
	* tools/pdbgen/pdb/layer.pdb: use the new gimp_item_linked_*()
	functions to translate, flip and transform all linked items.

	* tools/pdbgen/pdb/transform_tools.pdb: follow
	gimp_drawable_transform_affine() API change.

	* app/pdb/layer_cmds.c
	* app/pdb/transform_tools_cmds.c: regenerated.
parent 305dc2ff
2003-05-12 Michael Natterer <mitch@gimp.org>
Added support for transforming linked layers, channels
and vectors. Fixes bug #86277.
* app/core/gimpdrawable-transform.[ch]
(gimp_drawable_transform_tiles_flip): added "gdouble axis" and
calculate the resulting drawable offset.
(gimp_drawable_transform_flip): calculate the axis and pass it to
the function above.
(gimp_drawable_transform_[tiles_]affine): reordered parameters.
* app/core/gimpitem.[ch]: added virtual functions GimpItem::flip()
and GimpItem::transform().
* app/core/gimpchannel.c
* app/core/gimplayer.c
* app/vectors/gimpvectors.c: implement flip() and transform().
Note that all functions always transform the whole item,
regardless of a present selection.
* app/core/Makefile.am
* app/core/gimpitem-linked.[ch]: new files containing utility
functions which translate, flip and transform all linked items.
* app/tools/gimpfliptool.c
* app/tools/gimptransformtool.c
* tools/pdbgen/pdb/layer.pdb: use the new gimp_item_linked_*()
functions to translate, flip and transform all linked items.
* tools/pdbgen/pdb/transform_tools.pdb: follow
gimp_drawable_transform_affine() API change.
* app/pdb/layer_cmds.c
* app/pdb/transform_tools_cmds.c: regenerated.
2003-05-12 Michael Natterer <mitch@gimp.org> 2003-05-12 Michael Natterer <mitch@gimp.org>
* app/tools/tool_manager.c (tool_manager_tool_changed): make sure * app/tools/tool_manager.c (tool_manager_tool_changed): make sure
...@@ -129,6 +129,8 @@ libappcore_a_sources = \ ...@@ -129,6 +129,8 @@ libappcore_a_sources = \
gimpimagemap.h \ gimpimagemap.h \
gimpitem.c \ gimpitem.c \
gimpitem.h \ gimpitem.h \
gimpitem-linked.c \
gimpitem-linked.h \
gimpitemundo.c \ gimpitemundo.c \
gimpitemundo.h \ gimpitemundo.h \
gimplayer.c \ gimplayer.c \
......
...@@ -99,10 +99,10 @@ sample_linear(PixelSurround *surround, ...@@ -99,10 +99,10 @@ sample_linear(PixelSurround *surround,
TileManager * TileManager *
gimp_drawable_transform_tiles_affine (GimpDrawable *drawable, gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
TileManager *float_tiles, TileManager *float_tiles,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpMatrix3 matrix, GimpMatrix3 matrix,
GimpTransformDirection direction, GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback, GimpProgressFunc progress_callback,
gpointer progress_data) gpointer progress_data)
{ {
...@@ -140,6 +140,7 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable, ...@@ -140,6 +140,7 @@ gimp_drawable_transform_tiles_affine (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 (float_tiles != NULL, NULL); g_return_val_if_fail (float_tiles != NULL, NULL);
g_return_val_if_fail (matrix != NULL, NULL);
gimage = gimp_item_get_image (GIMP_ITEM (drawable)); gimage = gimp_item_get_image (GIMP_ITEM (drawable));
...@@ -433,7 +434,8 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable, ...@@ -433,7 +434,8 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
TileManager * 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)
{ {
TileManager *new; TileManager *new;
PixelRegion srcPR, destPR; PixelRegion srcPR, destPR;
...@@ -441,6 +443,7 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable, ...@@ -441,6 +443,7 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
gint orig_height; gint orig_height;
gint orig_bpp; gint orig_bpp;
gint orig_x, orig_y; gint orig_x, orig_y;
gint flipped_x, flipped_y;
gint i; gint i;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL); g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
...@@ -451,8 +454,27 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable, ...@@ -451,8 +454,27 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
orig_bpp = tile_manager_bpp (orig); orig_bpp = tile_manager_bpp (orig);
tile_manager_get_offsets (orig, &orig_x, &orig_y); tile_manager_get_offsets (orig, &orig_x, &orig_y);
flipped_x = orig_x;
flipped_y = orig_y;
switch (flip_type)
{
case GIMP_ORIENTATION_HORIZONTAL:
flipped_x = ROUND (-((gdouble) orig_x +
(gdouble) orig_width - axis) + axis);
break;
case GIMP_ORIENTATION_VERTICAL:
flipped_y = ROUND (-((gdouble) orig_y +
(gdouble) orig_height - axis) + axis);
break;
default:
break;
}
new = tile_manager_new (orig_width, orig_height, orig_bpp); new = tile_manager_new (orig_width, orig_height, orig_bpp);
tile_manager_set_offsets (new, orig_x, orig_y); tile_manager_set_offsets (new, flipped_x, flipped_y);
if (flip_type == GIMP_ORIENTATION_HORIZONTAL) if (flip_type == GIMP_ORIENTATION_HORIZONTAL)
{ {
...@@ -475,29 +497,15 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable, ...@@ -475,29 +497,15 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
} }
} }
#ifdef __GNUC__
#warning FIXME: path_transform_flip_horz/vert
#endif
#if 0
/* flip locked paths */
/* Note that the undo structures etc are setup before we enter this
* function.
*/
if (flip_type == GIMP_ORIENTATION_HORIZONTAL)
path_transform_flip_horz (gimage);
else
path_transform_flip_vert (gimage);
#endif
return new; return new;
} }
gboolean gboolean
gimp_drawable_transform_affine (GimpDrawable *drawable, gimp_drawable_transform_affine (GimpDrawable *drawable,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpMatrix3 matrix, GimpMatrix3 matrix,
GimpTransformDirection direction) GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result)
{ {
GimpImage *gimage; GimpImage *gimage;
TileManager *float_tiles; TileManager *float_tiles;
...@@ -505,6 +513,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable, ...@@ -505,6 +513,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
gboolean success = FALSE; gboolean success = FALSE;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE); g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (matrix != NULL, FALSE);
gimage = gimp_item_get_image (GIMP_ITEM (drawable)); gimage = gimp_item_get_image (GIMP_ITEM (drawable));
...@@ -524,10 +533,10 @@ gimp_drawable_transform_affine (GimpDrawable *drawable, ...@@ -524,10 +533,10 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
/* 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,
interpolation_type,
FALSE,
matrix, matrix,
GIMP_TRANSFORM_FORWARD, GIMP_TRANSFORM_FORWARD,
interpolation_type,
FALSE,
NULL, NULL); NULL, NULL);
/* Free the cut/copied buffer */ /* Free the cut/copied buffer */
...@@ -569,18 +578,38 @@ gimp_drawable_transform_flip (GimpDrawable *drawable, ...@@ -569,18 +578,38 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
if (float_tiles) if (float_tiles)
{ {
TileManager *new_tiles; TileManager *new_tiles;
gint off_x, off_y;
gint width, height;
gdouble axis = 0.0;
tile_manager_get_offsets (float_tiles, &off_x, &off_y);
width = tile_manager_width (float_tiles);
height = tile_manager_height (float_tiles);
switch (flip_type)
{
case GIMP_ORIENTATION_HORIZONTAL:
axis = ((gdouble) off_x + (gdouble) width / 2.0);
break;
case GIMP_ORIENTATION_VERTICAL:
axis = ((gdouble) off_y + (gdouble) height / 2.0);
break;
default:
break;
}
/* transform the buffer */ /* transform the buffer */
new_tiles = gimp_drawable_transform_tiles_flip (drawable, new_tiles = gimp_drawable_transform_tiles_flip (drawable, float_tiles,
float_tiles, flip_type, axis);
flip_type);
/* Free the cut/copied buffer */ /* Free the cut/copied buffer */
tile_manager_destroy (float_tiles); tile_manager_destroy (float_tiles);
if (new_tiles) if (new_tiles)
success = gimp_drawable_transform_paste (drawable, success = gimp_drawable_transform_paste (drawable, new_tiles,
new_tiles, new_layer); new_layer);
} }
/* push the undo group end */ /* push the undo group end */
......
...@@ -40,8 +40,10 @@ ...@@ -40,8 +40,10 @@
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpimage-projection.h" #include "gimpimage-projection.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"
...@@ -73,6 +75,16 @@ static void gimp_channel_resize (GimpItem *item, ...@@ -73,6 +75,16 @@ static void gimp_channel_resize (GimpItem *item,
gint new_height, gint new_height,
gint offx, gint offx,
gint offy); gint offy);
static void gimp_channel_flip (GimpItem *item,
GimpOrientationType flip_type,
gdouble axis);
static void gimp_channel_transform (GimpItem *item,
GimpMatrix3 matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
static void gimp_channel_push_undo (GimpChannel *mask, static void gimp_channel_push_undo (GimpChannel *mask,
const gchar *undo_desc); const gchar *undo_desc);
...@@ -136,6 +148,8 @@ gimp_channel_class_init (GimpChannelClass *klass) ...@@ -136,6 +148,8 @@ gimp_channel_class_init (GimpChannelClass *klass)
item_class->translate = gimp_channel_translate; item_class->translate = gimp_channel_translate;
item_class->scale = gimp_channel_scale; item_class->scale = gimp_channel_scale;
item_class->resize = gimp_channel_resize; item_class->resize = gimp_channel_resize;
item_class->flip = gimp_channel_flip;
item_class->transform = gimp_channel_transform;
item_class->default_name = _("Channel"); item_class->default_name = _("Channel");
item_class->rename_desc = _("Rename Channel"); item_class->rename_desc = _("Rename Channel");
} }
...@@ -380,6 +394,79 @@ gimp_channel_resize (GimpItem *item, ...@@ -380,6 +394,79 @@ gimp_channel_resize (GimpItem *item,
channel->bounds_known = FALSE; channel->bounds_known = FALSE;
} }
static void
gimp_channel_flip (GimpItem *item,
GimpOrientationType flip_type,
gdouble axis)
{
#ifdef __GNUC__
#warning FIXME: implement clip_result for flipping
#endif
g_print ("FIXME: implement channel flipping\n");
#if 0
GimpChannel *channel;
GimpImage *gimage;
TileManager *tiles;
channel = GIMP_CHANNEL (item);
gimage = gimp_item_get_image (item);
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Flip Channel"));
tiles = gimp_drawable_transform_tiles_flip (GIMP_DRAWABLE (channel),
GIMP_DRAWABLE (channel)->tiles,
flip_type, axis,
TRUE /* always clip_result */);
if (tiles)
gimp_drawable_transform_paste (GIMP_DRAWABLE (channel), tiles, FALSE);
gimp_image_undo_group_end (gimage);
/* bounds are now unknown */
channel->bounds_known = FALSE;
#endif
}
static void
gimp_channel_transform (GimpItem *item,
GimpMatrix3 matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data)
{
GimpChannel *channel;
GimpImage *gimage;
TileManager *tiles;
channel = GIMP_CHANNEL (item);
gimage = gimp_item_get_image (item);
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Transform Channel"));
tiles = gimp_drawable_transform_tiles_affine (GIMP_DRAWABLE (channel),
GIMP_DRAWABLE (channel)->tiles,
matrix, direction,
interpolation_type,
TRUE, /* always clip_result */
progress_callback,
progress_data);
if (tiles)
gimp_drawable_transform_paste (GIMP_DRAWABLE (channel), tiles, FALSE);
gimp_image_undo_group_end (gimage);
/* bounds are now unknown */
channel->bounds_known = FALSE;
}
static void static void
gimp_channel_push_undo (GimpChannel *mask, gimp_channel_push_undo (GimpChannel *mask,
const gchar *undo_desc) const gchar *undo_desc)
......
...@@ -40,8 +40,10 @@ ...@@ -40,8 +40,10 @@
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpimage-projection.h" #include "gimpimage-projection.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"
...@@ -73,6 +75,16 @@ static void gimp_channel_resize (GimpItem *item, ...@@ -73,6 +75,16 @@ static void gimp_channel_resize (GimpItem *item,
gint new_height, gint new_height,
gint offx, gint offx,
gint offy); gint offy);
static void gimp_channel_flip (GimpItem *item,
GimpOrientationType flip_type,
gdouble axis);
static void gimp_channel_transform (GimpItem *item,
GimpMatrix3 matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
static void gimp_channel_push_undo (GimpChannel *mask, static void gimp_channel_push_undo (GimpChannel *mask,
const gchar *undo_desc); const gchar *undo_desc);
...@@ -136,6 +148,8 @@ gimp_channel_class_init (GimpChannelClass *klass) ...@@ -136,6 +148,8 @@ gimp_channel_class_init (GimpChannelClass *klass)
item_class->translate = gimp_channel_translate; item_class->translate = gimp_channel_translate;
item_class->scale = gimp_channel_scale; item_class->scale = gimp_channel_scale;
item_class->resize = gimp_channel_resize; item_class->resize = gimp_channel_resize;
item_class->flip = gimp_channel_flip;
item_class->transform = gimp_channel_transform;
item_class->default_name = _("Channel"); item_class->default_name = _("Channel");
item_class->rename_desc = _("Rename Channel"); item_class->rename_desc = _("Rename Channel");
} }
...@@ -380,6 +394,79 @@ gimp_channel_resize (GimpItem *item, ...@@ -380,6 +394,79 @@ gimp_channel_resize (GimpItem *item,
channel->bounds_known = FALSE; channel->bounds_known = FALSE;
} }
static void
gimp_channel_flip (GimpItem *item,
GimpOrientationType flip_type,
gdouble axis)
{
#ifdef __GNUC__
#warning FIXME: implement clip_result for flipping
#endif
g_print ("FIXME: implement channel flipping\n");
#if 0
GimpChannel *channel;
GimpImage *gimage;
TileManager *tiles;
channel = GIMP_CHANNEL (item);
gimage = gimp_item_get_image (item);
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Flip Channel"));
tiles = gimp_drawable_transform_tiles_flip (GIMP_DRAWABLE (channel),
GIMP_DRAWABLE (channel)->tiles,
flip_type, axis,
TRUE /* always clip_result */);
if (tiles)
gimp_drawable_transform_paste (GIMP_DRAWABLE (channel), tiles, FALSE);
gimp_image_undo_group_end (gimage);
/* bounds are now unknown */
channel->bounds_known = FALSE;
#endif
}
static void
gimp_channel_transform (GimpItem *item,
GimpMatrix3 matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data)
{
GimpChannel *channel;
GimpImage *gimage;
TileManager *tiles;
channel = GIMP_CHANNEL (item);
gimage = gimp_item_get_image (item);
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Transform Channel"));
tiles = gimp_drawable_transform_tiles_affine (GIMP_DRAWABLE (channel),
GIMP_DRAWABLE (channel)->tiles,
matrix, direction,
interpolation_type,
TRUE, /* always clip_result */
progress_callback,
progress_data);
if (tiles)
gimp_drawable_transform_paste (GIMP_DRAWABLE (channel), tiles, FALSE);
gimp_image_undo_group_end (gimage);
/* bounds are now unknown */
channel->bounds_known = FALSE;
}
static void static void
gimp_channel_push_undo (GimpChannel *mask, gimp_channel_push_undo (GimpChannel *mask,
const gchar *undo_desc) const gchar *undo_desc)
......
...@@ -99,10 +99,10 @@ sample_linear(PixelSurround *surround, ...@@ -99,10 +99,10 @@ sample_linear(PixelSurround *surround,
TileManager * TileManager *
gimp_drawable_transform_tiles_affine (GimpDrawable *drawable, gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
TileManager *float_tiles, TileManager *float_tiles,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpMatrix3 matrix, GimpMatrix3 matrix,
GimpTransformDirection direction, GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback, GimpProgressFunc progress_callback,
gpointer progress_data) gpointer progress_data)
{ {
...@@ -140,6 +140,7 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable, ...@@ -140,6 +140,7 @@ gimp_drawable_transform_tiles_affine (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 (float_tiles != NULL, NULL); g_return_val_if_fail (float_tiles != NULL, NULL);
g_return_val_if_fail (matrix != NULL, NULL);
gimage = gimp_item_get_image (GIMP_ITEM (drawable)); gimage = gimp_item_get_image (GIMP_ITEM (drawable));
...@@ -433,7 +434,8 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable, ...@@ -433,7 +434,8 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
TileManager * 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)
{ {
TileManager *new; TileManager *new;
PixelRegion srcPR, destPR; PixelRegion srcPR, destPR;
...@@ -441,6 +443,7 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable, ...@@ -441,6 +443,7 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
gint orig_height; gint orig_height;
gint orig_bpp; gint orig_bpp;
gint orig_x, orig_y; gint orig_x, orig_y;
gint flipped_x, flipped_y;
gint i; gint i;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL); g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
...@@ -451,8 +454,27 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable, ...@@ -451,8 +454,27 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
orig_bpp = tile_manager_bpp (orig); orig_bpp = tile_manager_bpp (orig);
tile_manager_get_offsets (orig, &orig_x, &orig_y); tile_manager_get_offsets (orig, &orig_x, &orig_y);
flipped_x = orig_x;
flipped_y = orig_y;
switch (flip_type)
{
case GIMP_ORIENTATION_HORIZONTAL:
flipped_x = ROUND (-((gdouble) orig_x +
(gdouble) orig_width - axis) + axis);
break;
case GIMP_ORIENTATION_VERTICAL:
flipped_y = ROUND (-((gdouble) orig_y +
(gdouble) orig_height - axis) + axis);
break;
default:
break;
}
new = tile_manager_new (orig_width, orig_height, orig_bpp); new = tile_manager_new (orig_width, orig_height, orig_bpp);
tile_manager_set_offsets (new, orig_x, orig_y); tile_manager_set_offsets (new, flipped_x, flipped_y);
if (flip_type == GIMP_ORIENTATION_HORIZONTAL) if (flip_type == GIMP_ORIENTATION_HORIZONTAL)
{ {
...@@ -475,29 +497,15 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable, ...@@ -475,29 +497,15 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
} }
} }
#ifdef __GNUC__
#warning FIXME: path_transform_flip_horz/vert
#endif
#if 0
/* flip locked paths */
/* Note that the undo structures etc are setup before we enter this
* function.
*/
if (flip_type == GIMP_ORIENTATION_HORIZONTAL)
path_transform_flip_horz (gimage);
else
path_transform_flip_vert (gimage);
#endif
return new; return new;
} }
gboolean gboolean
gimp_drawable_transform_affine (GimpDrawable *drawable, gimp_drawable_transform_affine (GimpDrawable *drawable,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpMatrix3 matrix, GimpMatrix3 matrix,
GimpTransformDirection direction) GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result)
{ {
GimpImage *gimage; GimpImage *gimage;
TileManager *float_tiles; TileManager *float_tiles;
...@@ -505,6 +513,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable, ...@@ -505,6 +513,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
gboolean success = FALSE; gboolean success = FALSE;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE); g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
g_return_val_if_fail (matrix != NULL, FALSE);
gimage = gimp_item_get_image (GIMP_ITEM (drawable)); gimage = gimp_item_get_image (GIMP_ITEM (drawable));
...@@ -524,10 +533,10 @@ gimp_drawable_transform_affine (GimpDrawable *drawable, ...@@ -524,10 +533,10 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
/* 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,
interpolation_type,
FALSE,
matrix, matrix,
GIMP_TRANSFORM_FORWARD, GIMP_TRANSFORM_FORWARD,
interpolation_type,
FALSE,
NULL, NULL); NULL, NULL);
/* Free the cut/copied buffer */ /* Free the cut/copied buffer */
...@@ -569,18 +578,38 @@ gimp_drawable_transform_flip (GimpDrawable *drawable, ...@@ -569,18 +578,38 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
if (float_tiles) if (float_tiles)
{ {
TileManager *new_tiles; TileManager *new_tiles;
gint off_x, off_y;
gint width, height;
gdouble axis = 0.0;
tile_manager_get_offsets (float_tiles, &off_x, &off_y);
width = tile_manager_width (float_tiles);
height = tile_manager_height (float_tiles);
switch (flip_type)
{
case GIMP_ORIENTATION_HORIZONTAL:
axis = ((gdouble) off_x + (gdouble) width / 2.0);
break;
case GIMP_ORIENTATION_VERTICAL:
axis = ((gdouble) off_y + (gdouble) height / 2.0);
break;
default:
break;
}
/* transform the buffer */ /* transform the buffer */
new_tiles = gimp_drawable_transform_tiles_flip (drawable, new_tiles = gimp_drawable_transform_tiles_flip (drawable, float_tiles,
float_tiles,