1
/* GIMP - The GNU Image Manipulation Program
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
#include <glib-object.h>
23
#include "core-types.h"
25
#include "gimpcontext.h"
26
#include "gimpimage.h"
27
#include "gimpimage-item-list.h"
28
#include "gimpimage-undo.h"
31
#include "gimpprogress.h"
33
#include "gimp-intl.h"
36
/* public functions */
39
gimp_image_item_list_translate (GimpImage *image,
45
g_return_if_fail (GIMP_IS_IMAGE (image));
52
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_ITEM_DISPLACE,
53
_("Translate Items"));
55
for (l = list; l; l = g_list_next (l))
56
gimp_item_translate (GIMP_ITEM (l->data),
57
offset_x, offset_y, push_undo);
60
gimp_image_undo_group_end (image);
65
gimp_image_item_list_flip (GimpImage *image,
68
GimpOrientationType flip_type,
72
g_return_if_fail (GIMP_IS_IMAGE (image));
73
g_return_if_fail (GIMP_IS_CONTEXT (context));
79
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TRANSFORM,
82
for (l = list; l; l = g_list_next (l))
83
gimp_item_flip (GIMP_ITEM (l->data), context,
84
flip_type, axis, clip_result);
86
gimp_image_undo_group_end (image);
91
gimp_image_item_list_rotate (GimpImage *image,
94
GimpRotationType rotate_type,
99
g_return_if_fail (GIMP_IS_IMAGE (image));
100
g_return_if_fail (GIMP_IS_CONTEXT (context));
106
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TRANSFORM,
109
for (l = list; l; l = g_list_next (l))
110
gimp_item_rotate (GIMP_ITEM (l->data), context,
111
rotate_type, center_x, center_y, clip_result);
113
gimp_image_undo_group_end (image);
118
gimp_image_item_list_transform (GimpImage *image,
120
GimpContext *context,
121
const GimpMatrix3 *matrix,
122
GimpTransformDirection direction,
123
GimpInterpolationType interpolation_type,
124
gboolean supersample,
125
gint recursion_level,
126
GimpTransformResize clip_result,
127
GimpProgress *progress)
129
g_return_if_fail (GIMP_IS_IMAGE (image));
130
g_return_if_fail (GIMP_IS_CONTEXT (context));
131
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
137
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TRANSFORM,
138
_("Transform Items"));
140
for (l = list; l; l = g_list_next (l))
141
gimp_item_transform (GIMP_ITEM (l->data), context,
144
supersample, recursion_level,
145
clip_result, progress);
147
gimp_image_undo_group_end (image);
152
* gimp_image_item_list_get_list:
153
* @item: A linked @item.
154
* @which: Which items to return.
156
* This function returns a #GList og #GimpItem's for which the
157
* "linked" property is #TRUE. Note that the passed in @item
158
* must be linked too.
160
* Return value: The list of linked items, excluding the passed @item.
163
gimp_image_item_list_get_list (GimpImage *image,
165
GimpItemTypeMask type,
169
GList *return_list = NULL;
171
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
172
g_return_val_if_fail (exclude == NULL || GIMP_IS_ITEM (exclude), NULL);
174
if (type & GIMP_ITEM_TYPE_LAYERS)
176
for (list = GIMP_LIST (image->layers)->list;
178
list = g_list_next (list))
180
GimpItem *item = list->data;
182
if (item != exclude && gimp_item_is_in_set (item, set))
183
return_list = g_list_prepend (return_list, item);
187
if (type & GIMP_ITEM_TYPE_CHANNELS)
189
for (list = GIMP_LIST (image->channels)->list;
191
list = g_list_next (list))
193
GimpItem *item = list->data;
195
if (item != exclude && gimp_item_is_in_set (item, set))
196
return_list = g_list_prepend (return_list, item);
200
if (type & GIMP_ITEM_TYPE_VECTORS)
202
for (list = GIMP_LIST (image->vectors)->list;
204
list = g_list_next (list))
206
GimpItem *item = list->data;
208
if (item != exclude && gimp_item_is_in_set (item, set))
209
return_list = g_list_prepend (return_list, item);
213
return g_list_reverse (return_list);