mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-23 04:51:44 +00:00
a4395cead9
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.
165 lines
4.7 KiB
C
165 lines
4.7 KiB
C
/* 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"
|
|
|
|
|
|
/* local function prototypes */
|
|
|
|
static GList * gimp_item_linked_get_list (GimpImage *gimage,
|
|
GimpItem *item);
|
|
|
|
|
|
/* public functions */
|
|
|
|
void
|
|
gimp_item_linked_translate (GimpItem *item,
|
|
gint offset_x,
|
|
gint offset_y,
|
|
gboolean push_undo)
|
|
{
|
|
GimpImage *gimage;
|
|
GList *linked_list;
|
|
GList *list;
|
|
|
|
g_return_if_fail (GIMP_IS_ITEM (item));
|
|
g_return_if_fail (gimp_item_get_linked (item) == TRUE);
|
|
|
|
gimage = gimp_item_get_image (item);
|
|
|
|
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_translate (GIMP_ITEM (list->data),
|
|
offset_x, offset_y, push_undo);
|
|
|
|
g_list_free (linked_list);
|
|
}
|
|
|
|
void
|
|
gimp_item_linked_flip (GimpItem *item,
|
|
GimpOrientationType flip_type,
|
|
gdouble axis,
|
|
gboolean clip_result)
|
|
{
|
|
GimpImage *gimage;
|
|
GList *linked_list;
|
|
GList *list;
|
|
|
|
g_return_if_fail (GIMP_IS_ITEM (item));
|
|
g_return_if_fail (gimp_item_get_linked (item) == TRUE);
|
|
|
|
gimage = gimp_item_get_image (item);
|
|
|
|
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_flip (GIMP_ITEM (list->data),
|
|
flip_type, axis, clip_result);
|
|
|
|
g_list_free (linked_list);
|
|
}
|
|
|
|
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;
|
|
GList *linked_list;
|
|
GList *list;
|
|
|
|
g_return_if_fail (GIMP_IS_ITEM (item));
|
|
g_return_if_fail (gimp_item_get_linked (item) == TRUE);
|
|
|
|
gimage = gimp_item_get_image (item);
|
|
|
|
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;
|
|
list;
|
|
list = g_list_next (list))
|
|
{
|
|
linked_item = (GimpItem *) list->data;
|
|
|
|
if (linked_item != item && gimp_item_get_linked (linked_item))
|
|
linked_list = g_list_prepend (linked_list, linked_item);
|
|
}
|
|
|
|
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))
|
|
linked_list = g_list_prepend (linked_list, linked_item);
|
|
}
|
|
|
|
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))
|
|
linked_list = g_list_prepend (linked_list, linked_item);
|
|
}
|
|
|
|
return g_list_reverse (linked_list);
|
|
}
|