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.
This commit is contained in:
Michael Natterer 2003-05-12 15:56:36 +00:00 committed by Michael Natterer
parent 305dc2ffd7
commit 45334e637e
19 changed files with 962 additions and 276 deletions

View file

@ -1,3 +1,39 @@
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>
* app/tools/tool_manager.c (tool_manager_tool_changed): make sure

View file

@ -129,6 +129,8 @@ libappcore_a_sources = \
gimpimagemap.h \
gimpitem.c \
gimpitem.h \
gimpitem-linked.c \
gimpitem-linked.h \
gimpitemundo.c \
gimpitemundo.h \
gimplayer.c \

View file

@ -99,10 +99,10 @@ sample_linear(PixelSurround *surround,
TileManager *
gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
TileManager *float_tiles,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpMatrix3 matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data)
{
@ -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 (float_tiles != NULL, NULL);
g_return_val_if_fail (matrix != NULL, NULL);
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
@ -433,7 +434,8 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
TileManager *
gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
TileManager *orig,
GimpOrientationType flip_type)
GimpOrientationType flip_type,
gdouble axis)
{
TileManager *new;
PixelRegion srcPR, destPR;
@ -441,6 +443,7 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
gint orig_height;
gint orig_bpp;
gint orig_x, orig_y;
gint flipped_x, flipped_y;
gint i;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
@ -451,8 +454,27 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
orig_bpp = tile_manager_bpp (orig);
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);
tile_manager_set_offsets (new, orig_x, orig_y);
tile_manager_set_offsets (new, flipped_x, flipped_y);
if (flip_type == GIMP_ORIENTATION_HORIZONTAL)
{
@ -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;
}
gboolean
gimp_drawable_transform_affine (GimpDrawable *drawable,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpMatrix3 matrix,
GimpTransformDirection direction)
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result)
{
GimpImage *gimage;
TileManager *float_tiles;
@ -505,6 +513,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
gboolean success = 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));
@ -524,10 +533,10 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
/* transform the buffer */
new_tiles = gimp_drawable_transform_tiles_affine (drawable,
float_tiles,
interpolation_type,
FALSE,
matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type,
FALSE,
NULL, NULL);
/* Free the cut/copied buffer */
@ -569,18 +578,38 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
if (float_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 */
new_tiles = gimp_drawable_transform_tiles_flip (drawable,
float_tiles,
flip_type);
new_tiles = gimp_drawable_transform_tiles_flip (drawable, float_tiles,
flip_type, axis);
/* Free the cut/copied buffer */
tile_manager_destroy (float_tiles);
if (new_tiles)
success = gimp_drawable_transform_paste (drawable,
new_tiles, new_layer);
success = gimp_drawable_transform_paste (drawable, new_tiles,
new_layer);
}
/* push the undo group end */

View file

@ -40,8 +40,10 @@
#include "gimpimage.h"
#include "gimpimage-projection.h"
#include "gimpimage-undo.h"
#include "gimpimage-undo-push.h"
#include "gimpchannel.h"
#include "gimpdrawable-transform.h"
#include "gimplayer.h"
#include "gimpparasitelist.h"
@ -73,6 +75,16 @@ static void gimp_channel_resize (GimpItem *item,
gint new_height,
gint offx,
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,
const gchar *undo_desc);
@ -136,6 +148,8 @@ gimp_channel_class_init (GimpChannelClass *klass)
item_class->translate = gimp_channel_translate;
item_class->scale = gimp_channel_scale;
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->rename_desc = _("Rename Channel");
}
@ -380,6 +394,79 @@ gimp_channel_resize (GimpItem *item,
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
gimp_channel_push_undo (GimpChannel *mask,
const gchar *undo_desc)

View file

@ -40,8 +40,10 @@
#include "gimpimage.h"
#include "gimpimage-projection.h"
#include "gimpimage-undo.h"
#include "gimpimage-undo-push.h"
#include "gimpchannel.h"
#include "gimpdrawable-transform.h"
#include "gimplayer.h"
#include "gimpparasitelist.h"
@ -73,6 +75,16 @@ static void gimp_channel_resize (GimpItem *item,
gint new_height,
gint offx,
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,
const gchar *undo_desc);
@ -136,6 +148,8 @@ gimp_channel_class_init (GimpChannelClass *klass)
item_class->translate = gimp_channel_translate;
item_class->scale = gimp_channel_scale;
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->rename_desc = _("Rename Channel");
}
@ -380,6 +394,79 @@ gimp_channel_resize (GimpItem *item,
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
gimp_channel_push_undo (GimpChannel *mask,
const gchar *undo_desc)

View file

@ -99,10 +99,10 @@ sample_linear(PixelSurround *surround,
TileManager *
gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
TileManager *float_tiles,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpMatrix3 matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data)
{
@ -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 (float_tiles != NULL, NULL);
g_return_val_if_fail (matrix != NULL, NULL);
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
@ -433,7 +434,8 @@ gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
TileManager *
gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
TileManager *orig,
GimpOrientationType flip_type)
GimpOrientationType flip_type,
gdouble axis)
{
TileManager *new;
PixelRegion srcPR, destPR;
@ -441,6 +443,7 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
gint orig_height;
gint orig_bpp;
gint orig_x, orig_y;
gint flipped_x, flipped_y;
gint i;
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
@ -451,8 +454,27 @@ gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
orig_bpp = tile_manager_bpp (orig);
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);
tile_manager_set_offsets (new, orig_x, orig_y);
tile_manager_set_offsets (new, flipped_x, flipped_y);
if (flip_type == GIMP_ORIENTATION_HORIZONTAL)
{
@ -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;
}
gboolean
gimp_drawable_transform_affine (GimpDrawable *drawable,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpMatrix3 matrix,
GimpTransformDirection direction)
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result)
{
GimpImage *gimage;
TileManager *float_tiles;
@ -505,6 +513,7 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
gboolean success = 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));
@ -524,10 +533,10 @@ gimp_drawable_transform_affine (GimpDrawable *drawable,
/* transform the buffer */
new_tiles = gimp_drawable_transform_tiles_affine (drawable,
float_tiles,
interpolation_type,
FALSE,
matrix,
GIMP_TRANSFORM_FORWARD,
interpolation_type,
FALSE,
NULL, NULL);
/* Free the cut/copied buffer */
@ -569,18 +578,38 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
if (float_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 */
new_tiles = gimp_drawable_transform_tiles_flip (drawable,
float_tiles,
flip_type);
new_tiles = gimp_drawable_transform_tiles_flip (drawable, float_tiles,
flip_type, axis);
/* Free the cut/copied buffer */
tile_manager_destroy (float_tiles);
if (new_tiles)
success = gimp_drawable_transform_paste (drawable,
new_tiles, new_layer);
success = gimp_drawable_transform_paste (drawable, new_tiles,
new_layer);
}
/* push the undo group end */

View file

@ -35,21 +35,22 @@ typedef enum
TileManager * gimp_drawable_transform_tiles_affine (GimpDrawable *drawable,
TileManager *float_tiles,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpMatrix3 matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
TileManager * gimp_drawable_transform_tiles_flip (GimpDrawable *drawable,
TileManager *orig,
GimpOrientationType flip_type);
GimpOrientationType flip_type,
gdouble axis);
gboolean gimp_drawable_transform_affine (GimpDrawable *drawable,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpMatrix3 matrix,
GimpTransformDirection direction);
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result);
gboolean gimp_drawable_transform_flip (GimpDrawable *drawable,
GimpOrientationType flip_type);

178
app/core/gimpitem-linked.c Normal file
View file

@ -0,0 +1,178 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <glib-object.h>
#include "core-types.h"
#include "gimpimage.h"
#include "gimpitem.h"
#include "gimpitem-linked.h"
#include "gimplist.h"
void
gimp_item_linked_translate (GimpItem *item,
gint offset_x,
gint offset_y,
gboolean push_undo)
{
GimpImage *gimage;
GimpItem *linked_item;
GList *list;
g_return_if_fail (GIMP_IS_ITEM (item));
gimage = gimp_item_get_image (item);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
for (list = GIMP_LIST (gimage->layers)->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->channels)->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
gimp_item_linked_flip (GimpItem *item,
GimpOrientationType flip_type,
gdouble axis)
{
GimpImage *gimage;
GimpItem *linked_item;
GList *list;
g_return_if_fail (GIMP_IS_ITEM (item));
gimage = gimp_item_get_image (item);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
for (list = GIMP_LIST (gimage->layers)->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->channels)->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
gimp_item_linked_transform (GimpItem *item,
GimpMatrix3 matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data)
{
GimpImage *gimage;
GimpItem *linked_item;
GList *list;
g_return_if_fail (GIMP_IS_ITEM (item));
gimage = gimp_item_get_image (item);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
for (list = GIMP_LIST (gimage->layers)->list;
list;
list = g_list_next (list))
{
linked_item = (GimpItem *) list->data;
if (linked_item != item && gimp_item_get_linked (linked_item))
gimp_item_transform (linked_item, matrix, direction,
interpolation_type, clip_result,
progress_callback, progress_data);
}
for (list = GIMP_LIST (gimage->channels)->list;
list;
list = g_list_next (list))
{
linked_item = (GimpItem *) list->data;
if (linked_item != item && gimp_item_get_linked (linked_item))
gimp_item_transform (linked_item, matrix, direction,
interpolation_type, clip_result,
progress_callback, progress_data);
}
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_transform (linked_item, matrix, direction,
interpolation_type, clip_result,
progress_callback, progress_data);
}
}

View file

@ -0,0 +1,39 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_ITEM_LINKED_H__
#define __GIMP_ITEM_LINKED_H__
void gimp_item_linked_translate (GimpItem *item,
gint offset_x,
gint offset_y,
gboolean push_undo);
void gimp_item_linked_flip (GimpItem *item,
GimpOrientationType flip_type,
gdouble axis);
void gimp_item_linked_transform (GimpItem *item,
GimpMatrix3 matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
#endif /* __GIMP_ITEM_LINKED_H__ */

View file

@ -680,6 +680,40 @@ gimp_item_resize (GimpItem *item,
item_class->resize (item, new_width, new_height, offset_x, offset_y);
}
void
gimp_item_flip (GimpItem *item,
GimpOrientationType flip_type,
gdouble axis)
{
GimpItemClass *item_class;
g_return_if_fail (GIMP_IS_ITEM (item));
item_class = GIMP_ITEM_GET_CLASS (item);
item_class->flip (item, flip_type, axis);
}
void
gimp_item_transform (GimpItem *item,
GimpMatrix3 matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data)
{
GimpItemClass *item_class;
g_return_if_fail (GIMP_IS_ITEM (item));
item_class = GIMP_ITEM_GET_CLASS (item);
item_class->transform (item, matrix, direction, interpolation_type,
clip_result,
progress_callback, progress_data);
}
gint
gimp_item_get_ID (GimpItem *item)
{

View file

@ -55,31 +55,41 @@ struct _GimpItemClass
GimpViewableClass parent_class;
/* signals */
void (* removed) (GimpItem *item);
void (* linked_changed) (GimpItem *item);
void (* removed) (GimpItem *item);
void (* linked_changed) (GimpItem *item);
/* virtual functions */
GimpItem * (* duplicate) (GimpItem *item,
GType new_type,
gboolean add_alpha);
void (* rename) (GimpItem *item,
const gchar *new_name,
const gchar *undo_desc);
void (* translate) (GimpItem *item,
gint offset_x,
gint offset_y,
gboolean push_undo);
void (* scale) (GimpItem *item,
gint new_width,
gint new_height,
gint new_offset_x,
gint new_offset_y,
GimpInterpolationType interpolation_type);
void (* resize) (GimpItem *item,
gint new_width,
gint new_height,
gint offset_x,
gint offset_y);
GimpItem * (* duplicate) (GimpItem *item,
GType new_type,
gboolean add_alpha);
void (* rename) (GimpItem *item,
const gchar *new_name,
const gchar *undo_desc);
void (* translate) (GimpItem *item,
gint offset_x,
gint offset_y,
gboolean push_undo);
void (* scale) (GimpItem *item,
gint new_width,
gint new_height,
gint new_offset_x,
gint new_offset_y,
GimpInterpolationType interpolation_type);
void (* resize) (GimpItem *item,
gint new_width,
gint new_height,
gint offset_x,
gint offset_y);
void (* flip) (GimpItem *item,
GimpOrientationType flip_type,
gdouble axis);
void (* transform) (GimpItem *item,
GimpMatrix3 matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
const gchar *default_name;
const gchar *rename_desc;
@ -140,6 +150,17 @@ void gimp_item_resize (GimpItem *item,
gint offset_y);
void gimp_item_resize_to_image (GimpItem *item);
void gimp_item_flip (GimpItem *item,
GimpOrientationType flip_type,
gdouble axis);
void gimp_item_transform (GimpItem *item,
GimpMatrix3 matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
gint gimp_item_get_ID (GimpItem *item);
GimpItem * gimp_item_get_by_ID (Gimp *gimp,
gint id);

View file

@ -35,6 +35,7 @@
#include "paint-funcs/paint-funcs.h"
#include "gimpdrawable-invert.h"
#include "gimpdrawable-transform.h"
#include "gimpcontainer.h"
#include "gimpimage.h"
#include "gimpimage-convert.h"
@ -89,6 +90,16 @@ static void gimp_layer_resize (GimpItem *item,
gint new_height,
gint offset_x,
gint offset_y);
static void gimp_layer_flip (GimpItem *item,
GimpOrientationType flip_type,
gdouble axis);
static void gimp_layer_transform (GimpItem *item,
GimpMatrix3 matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
static void gimp_layer_transform_color (GimpImage *gimage,
PixelRegion *layerPR,
@ -193,6 +204,8 @@ gimp_layer_class_init (GimpLayerClass *klass)
item_class->translate = gimp_layer_translate;
item_class->scale = gimp_layer_scale;
item_class->resize = gimp_layer_resize;
item_class->flip = gimp_layer_flip;
item_class->transform = gimp_layer_transform;
item_class->default_name = _("Layer");
item_class->rename_desc = _("Rename Layer");
@ -458,6 +471,140 @@ gimp_layer_resize (GimpItem *item,
gimp_layer_invalidate_boundary (layer);
}
static void
gimp_layer_flip (GimpItem *item,
GimpOrientationType flip_type,
gdouble axis)
{
GimpLayer *layer;
GimpImage *gimage;
TileManager *tiles;
gint off_x, off_y;
gint old_off_x, old_off_y;
layer = GIMP_LAYER (item);
gimage = gimp_item_get_image (item);
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Flip Layer"));
gimp_item_offsets (item, &off_x, &off_y);
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 (layer->mask)
{
tile_manager_get_offsets (GIMP_DRAWABLE (layer->mask)->tiles,
&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);
/* Make sure we're not caching any old selection info */
gimp_layer_invalidate_boundary (layer);
}
static void
gimp_layer_transform (GimpItem *item,
GimpMatrix3 matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data)
{
GimpLayer *layer;
GimpImage *gimage;
TileManager *tiles;
gint off_x, off_y;
gint old_off_x, old_off_y;
layer = GIMP_LAYER (item);
gimage = gimp_item_get_image (item);
gimp_image_undo_group_start (gimage, GIMP_UNDO_GROUP_TRANSFORM,
_("Transform Layer"));
gimp_item_offsets (item, &off_x, &off_y);
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_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 (layer->mask)
{
tile_manager_get_offsets (GIMP_DRAWABLE (layer->mask)->tiles,
&old_off_x, &old_off_y);
tile_manager_set_offsets (GIMP_DRAWABLE (layer->mask)->tiles,
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);
/* Make sure we're not caching any old selection info */
gimp_layer_invalidate_boundary (layer);
}
static void
gimp_layer_transform_color (GimpImage *gimage,
PixelRegion *layerPR,

View file

@ -35,10 +35,10 @@
#include "core/gimpdrawable.h"
#include "core/gimpimage-undo.h"
#include "core/gimpimage.h"
#include "core/gimpitem-linked.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "core/gimplist.h"
#include "gimp-intl.h"
#include "pdb_glue.h"
@ -646,50 +646,10 @@ layer_translate_invoker (Gimp *gimp,
TRUE);
if (gimp_item_get_linked (GIMP_ITEM (layer)))
{
GList *list;
GimpItem *item;
/* translate all linked items as well */
for (list = GIMP_LIST (gimage->layers)->list;
list;
list = g_list_next (list))
{
item = (GimpItem *) list->data;
if (item != (GimpItem *) layer && gimp_item_get_linked (item))
gimp_item_translate (item,
offx,
offy,
TRUE);
}
for (list = GIMP_LIST (gimage->channels)->list;
list;
list = g_list_next (list))
{
item = (GimpItem *) list->data;
if (gimp_item_get_linked (item))
gimp_item_translate (item,
offx,
offy,
TRUE);
}
for (list = GIMP_LIST (gimage->vectors)->list;
list;
list = g_list_next (list))
{
item = (GimpItem *) list->data;
if (gimp_item_get_linked (item))
gimp_item_translate (item,
offx,
offy,
TRUE);
}
}
gimp_item_linked_translate (GIMP_ITEM (layer),
offx,
offy,
TRUE);
if (floating_layer)
floating_sel_rigor (floating_layer, TRUE);
@ -817,50 +777,10 @@ layer_set_offsets_invoker (Gimp *gimp,
TRUE);
if (gimp_item_get_linked (GIMP_ITEM (layer)))
{
GList *list;
GimpItem *item;
/* translate all linked items as well */
for (list = GIMP_LIST (gimage->layers)->list;
list;
list = g_list_next (list))
{
item = (GimpItem *) list->data;
if (item != (GimpItem *) layer && gimp_item_get_linked (item))
gimp_item_translate (item,
offx,
offy,
TRUE);
}
for (list = GIMP_LIST (gimage->channels)->list;
list;
list = g_list_next (list))
{
item = (GimpItem *) list->data;
if (gimp_item_get_linked (item))
gimp_item_translate (item,
offx,
offy,
TRUE);
}
for (list = GIMP_LIST (gimage->vectors)->list;
list;
list = g_list_next (list))
{
item = (GimpItem *) list->data;
if (gimp_item_get_linked (item))
gimp_item_translate (item,
offx,
offy,
TRUE);
}
}
gimp_item_linked_translate (GIMP_ITEM (layer),
offx,
offy,
TRUE);
if (floating_layer)
floating_sel_rigor (floating_layer, TRUE);

View file

@ -182,10 +182,8 @@ perspective_invoker (Gimp *gimp,
/* Perspective the selection */
success = gimp_drawable_transform_affine (drawable,
interpolation_type,
FALSE,
matrix,
GIMP_TRANSFORM_FORWARD);
matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, FALSE);
}
return_args = procedural_db_return_args (&perspective_proc, success);
@ -313,10 +311,8 @@ rotate_invoker (Gimp *gimp,
/* Rotate the selection */
success = gimp_drawable_transform_affine (drawable,
interpolation_type,
FALSE,
matrix,
GIMP_TRANSFORM_FORWARD);
matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, FALSE);
}
return_args = procedural_db_return_args (&rotate_proc, success);
@ -420,10 +416,8 @@ scale_invoker (Gimp *gimp,
/* Scale the selection */
success = gimp_drawable_transform_affine (drawable,
interpolation_type,
FALSE,
matrix,
GIMP_TRANSFORM_FORWARD);
matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, FALSE);
}
else
{
@ -541,10 +535,8 @@ shear_invoker (Gimp *gimp,
/* Shear the selection */
success = gimp_drawable_transform_affine (drawable,
interpolation_type,
FALSE,
matrix,
GIMP_TRANSFORM_FORWARD);
matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, FALSE);
}
return_args = procedural_db_return_args (&shear_proc, success);
@ -658,10 +650,8 @@ transform_2d_invoker (Gimp *gimp,
/* Transform the selection */
success = gimp_drawable_transform_affine (drawable,
interpolation_type,
FALSE,
matrix,
GIMP_TRANSFORM_FORWARD);
matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, FALSE);
}
return_args = procedural_db_return_args (&transform_2d_proc, success);

View file

@ -27,10 +27,13 @@
#include "tools-types.h"
#include "base/tile-manager.h"
#include "core/gimpdrawable.h"
#include "core/gimpdrawable-transform.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimpitem-linked.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpwidgets-utils.h"
@ -41,8 +44,6 @@
#include "gimpfliptool.h"
#include "gimptoolcontrol.h"
#include "path_transform.h"
#include "gimp-intl.h"
@ -233,13 +234,39 @@ gimp_flip_tool_transform (GimpTransformTool *trans_tool,
GimpDisplay *gdisp)
{
GimpFlipOptions *options;
GimpDrawable *drawable;
GimpDrawable *active_drawable;
GimpItem *active_item;
gint off_x, off_y;
gint width, height;
gdouble axis = 0.0;
options = GIMP_FLIP_OPTIONS (GIMP_TOOL (trans_tool)->tool_info->tool_options);
drawable = gimp_image_active_drawable (gdisp->gimage);
active_drawable = gimp_image_active_drawable (gdisp->gimage);
active_item = GIMP_ITEM (active_drawable);
return gimp_drawable_transform_tiles_flip (drawable,
trans_tool->original,
options->flip_type);
tile_manager_get_offsets (trans_tool->original, &off_x, &off_y);
width = tile_manager_width (trans_tool->original);
height = tile_manager_height (trans_tool->original);
switch (options->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;
}
if (gimp_item_get_linked (active_item))
gimp_item_linked_flip (active_item, options->flip_type, axis);
return gimp_drawable_transform_tiles_flip (active_drawable,
trans_tool->original,
options->flip_type, axis);
}

View file

@ -42,6 +42,7 @@
#include "core/gimpimage-mask.h"
#include "core/gimpimage-undo.h"
#include "core/gimpimage-undo-push.h"
#include "core/gimpitem-linked.h"
#include "core/gimplayer.h"
#include "core/gimpmarshal.h"
#include "core/gimptoolinfo.h"
@ -381,7 +382,9 @@ gimp_transform_tool_button_press (GimpTool *tool,
/* Set the pointer to the active display */
tool->gdisp = gdisp;
tool->drawable = drawable;
gimp_tool_control_activate (tool->control);
if (! gimp_tool_control_is_active (tool->control))
gimp_tool_control_activate (tool->control);
/* Find the transform bounds for some tools (like scale,
* perspective) that actually need the bounds for
@ -428,7 +431,8 @@ gimp_transform_tool_button_press (GimpTool *tool,
tr_tool->lastx = tr_tool->startx = coords->x;
tr_tool->lasty = tr_tool->starty = coords->y;
gimp_tool_control_activate (tool->control);
if (! gimp_tool_control_is_active (tool->control))
gimp_tool_control_activate (tool->control);
}
}
@ -767,28 +771,38 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
GimpDisplay *gdisp)
{
GimpTool *tool;
GimpDrawable *drawable;
GimpTransformOptions *options;
GimpDrawable *active_drawable;
GimpItem *active_item;
GimpProgress *progress;
TileManager *ret;
tool = GIMP_TOOL (tr_tool);
options = GIMP_TRANSFORM_OPTIONS (tool->tool_info->tool_options);
active_drawable = gimp_image_active_drawable (gdisp->gimage);
active_item = GIMP_ITEM (active_drawable);
if (tr_tool->info_dialog)
gtk_widget_set_sensitive (GTK_WIDGET (tr_tool->info_dialog->shell), FALSE);
progress = gimp_progress_start (gdisp, tr_tool->progress_text, FALSE,
NULL, NULL);
drawable = gimp_image_active_drawable (gdisp->gimage);
if (gimp_item_get_linked (active_item))
gimp_item_linked_transform (active_item, tr_tool->transform,
options->direction,
options->interpolation, options->clip,
progress ?
gimp_progress_update_and_flush : NULL,
progress);
ret = gimp_drawable_transform_tiles_affine (drawable,
ret = gimp_drawable_transform_tiles_affine (active_drawable,
tr_tool->original,
options->interpolation,
options->clip,
tr_tool->transform,
options->direction,
options->interpolation,
options->clip,
progress ?
gimp_progress_update_and_flush :
NULL,

View file

@ -70,8 +70,18 @@ static void gimp_vectors_resize (GimpItem *item,
gint new_height,
gint offset_x,
gint offset_y);
static void gimp_vectors_flip (GimpItem *item,
GimpOrientationType flip_type,
gdouble axis);
static void gimp_vectors_transform (GimpItem *item,
GimpMatrix3 matrix,
GimpTransformDirection direction,
GimpInterpolationType interp_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data);
static void gimp_vectors_real_thaw (GimpVectors *vectors);
static void gimp_vectors_real_thaw (GimpVectors *vectors);
/* private variables */
@ -152,6 +162,8 @@ gimp_vectors_class_init (GimpVectorsClass *klass)
item_class->translate = gimp_vectors_translate;
item_class->scale = gimp_vectors_scale;
item_class->resize = gimp_vectors_resize;
item_class->flip = gimp_vectors_flip;
item_class->transform = gimp_vectors_transform;
item_class->default_name = _("Path");
item_class->rename_desc = _("Rename Path");
@ -348,6 +360,90 @@ gimp_vectors_resize (GimpItem *item,
gimp_vectors_thaw (vectors);
}
static void
gimp_vectors_flip (GimpItem *item,
GimpOrientationType flip_type,
gdouble axis)
{
GimpVectors *vectors;
GList *list;
vectors = GIMP_VECTORS (item);
gimp_vectors_freeze (vectors);
gimp_image_undo_push_vectors_mod (gimp_item_get_image (item),
_("Flip Path"),
vectors);
for (list = vectors->strokes; list; list = g_list_next (list))
{
GimpStroke *stroke = list->data;
GList *list2;
for (list2 = stroke->anchors; list2; list2 = g_list_next (list2))
{
GimpAnchor *anchor = list2->data;
switch (flip_type)
{
case GIMP_ORIENTATION_HORIZONTAL:
anchor->position.x = -(anchor->position.x - axis) + axis;
break;
case GIMP_ORIENTATION_VERTICAL:
anchor->position.y = -(anchor->position.y - axis) + axis;
break;
default:
break;
}
}
}
gimp_vectors_thaw (vectors);
}
static void
gimp_vectors_transform (GimpItem *item,
GimpMatrix3 matrix,
GimpTransformDirection direction,
GimpInterpolationType interpolation_type,
gboolean clip_result,
GimpProgressFunc progress_callback,
gpointer progress_data)
{
GimpVectors *vectors;
GList *list;
vectors = GIMP_VECTORS (item);
gimp_vectors_freeze (vectors);
gimp_image_undo_push_vectors_mod (gimp_item_get_image (item),
_("Transform Path"),
vectors);
for (list = vectors->strokes; list; list = g_list_next (list))
{
GimpStroke *stroke = list->data;
GList *list2;
for (list2 = stroke->anchors; list2; list2 = g_list_next (list2))
{
GimpAnchor *anchor = list2->data;
gimp_matrix3_transform_point (matrix,
anchor->position.x,
anchor->position.y,
&anchor->position.x,
&anchor->position.y);
}
}
gimp_vectors_thaw (vectors);
}
static void
gimp_vectors_real_thaw (GimpVectors *vectors)
{

View file

@ -408,50 +408,10 @@ HELP
TRUE);
if (gimp_item_get_linked (GIMP_ITEM (layer)))
{
GList *list;
GimpItem *item;
/* translate all linked items as well */
for (list = GIMP_LIST (gimage->layers)->list;
list;
list = g_list_next (list))
{
item = (GimpItem *) list->data;
if (item != (GimpItem *) layer && gimp_item_get_linked (item))
gimp_item_translate (item,
offx,
offy,
TRUE);
}
for (list = GIMP_LIST (gimage->channels)->list;
list;
list = g_list_next (list))
{
item = (GimpItem *) list->data;
if (gimp_item_get_linked (item))
gimp_item_translate (item,
offx,
offy,
TRUE);
}
for (list = GIMP_LIST (gimage->vectors)->list;
list;
list = g_list_next (list))
{
item = (GimpItem *) list->data;
if (gimp_item_get_linked (item))
gimp_item_translate (item,
offx,
offy,
TRUE);
}
}
gimp_item_linked_translate (GIMP_ITEM (layer),
offx,
offy,
TRUE);
}
CODE
}
@ -646,9 +606,8 @@ HELP
$date = '1998';
CODE
@headers = qw( "config/gimpcoreconfig.h"
"core/gimplist.h" "core/gimp.h" "core/gimpimage-undo.h"
"pdb_glue.h" "gimp-intl.h");
@headers = qw("config/gimpcoreconfig.h" "core/gimp.h" "core/gimpimage-undo.h"
"core/gimpitem-linked.h" "pdb_glue.h" "gimp-intl.h");
unshift @procs, qw(layer_new layer_copy layer_create_mask layer_scale
layer_resize layer_delete layer_translate layer_add_alpha

View file

@ -146,10 +146,8 @@ HELP
/* Perspective the selection */
success = gimp_drawable_transform_affine (drawable,
interpolation_type,
FALSE,
matrix,
GIMP_TRANSFORM_FORWARD);
matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, FALSE);
}
CODE
);
@ -202,10 +200,8 @@ HELP
/* Rotate the selection */
success = gimp_drawable_transform_affine (drawable,
interpolation_type,
FALSE,
matrix,
GIMP_TRANSFORM_FORWARD);
matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, FALSE);
}
CODE
);
@ -273,10 +269,8 @@ HELP
/* Scale the selection */
success = gimp_drawable_transform_affine (drawable,
interpolation_type,
FALSE,
matrix,
GIMP_TRANSFORM_FORWARD);
matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, FALSE);
}
else
{
@ -340,10 +334,8 @@ HELP
/* Shear the selection */
success = gimp_drawable_transform_affine (drawable,
interpolation_type,
FALSE,
matrix,
GIMP_TRANSFORM_FORWARD);
matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, FALSE);
}
CODE
);
@ -411,10 +403,8 @@ HELP
/* Transform the selection */
success = gimp_drawable_transform_affine (drawable,
interpolation_type,
FALSE,
matrix,
GIMP_TRANSFORM_FORWARD);
matrix, GIMP_TRANSFORM_FORWARD,
interpolation_type, FALSE);
}
CODE
);