summaryrefslogtreecommitdiffstats
path: root/app/core/gimpitem.h
blob: 6bc56e3dcbefdebf78b4fb1a2c049d2922b7835b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
/* GIMP - The GNU 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 3 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, see <https://www.gnu.org/licenses/>.
 */

#ifndef __GIMP_ITEM_H__
#define __GIMP_ITEM_H__


#include "gimpfilter.h"


#define GIMP_TYPE_ITEM            (gimp_item_get_type ())
#define GIMP_ITEM(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ITEM, GimpItem))
#define GIMP_ITEM_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ITEM, GimpItemClass))
#define GIMP_IS_ITEM(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ITEM))
#define GIMP_IS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ITEM))
#define GIMP_ITEM_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ITEM, GimpItemClass))


typedef struct _GimpItemClass GimpItemClass;

struct _GimpItem
{
  GimpFilter  parent_instance;
};

struct _GimpItemClass
{
  GimpFilterClass  parent_class;

  /*  signals  */
  void            (* removed)               (GimpItem            *item);
  void            (* visibility_changed)    (GimpItem            *item);
  void            (* linked_changed)        (GimpItem            *item);
  void            (* color_tag_changed)     (GimpItem            *item);
  void            (* lock_content_changed)  (GimpItem            *item);
  void            (* lock_position_changed) (GimpItem            *item);

  /*  virtual functions  */
  void            (* unset_removed)      (GimpItem               *item);
  gboolean        (* is_attached)        (GimpItem               *item);
  gboolean        (* is_content_locked)  (GimpItem               *item);
  gboolean        (* is_position_locked) (GimpItem               *item);
  GimpItemTree  * (* get_tree)           (GimpItem               *item);
  gboolean        (* bounds)             (GimpItem               *item,
                                          gdouble                *x,
                                          gdouble                *y,
                                          gdouble                *width,
                                          gdouble                *height);
  GimpItem      * (* duplicate)          (GimpItem               *item,
                                          GType                   new_type);
  void            (* convert)            (GimpItem               *item,
                                          GimpImage              *dest_image,
                                          GType                   old_type);
  gboolean        (* rename)             (GimpItem               *item,
                                          const gchar            *new_name,
                                          const gchar            *undo_desc,
                                          GError                **error);
  void            (* start_move)         (GimpItem               *item,
                                          gboolean                push_undo);
  void            (* end_move)           (GimpItem               *item,
                                          gboolean                push_undo);
  void            (* start_transform)    (GimpItem               *item,
                                          gboolean                push_undo);
  void            (* end_transform)      (GimpItem               *item,
                                          gboolean                push_undo);
  void            (* translate)          (GimpItem               *item,
                                          gdouble                 offset_x,
                                          gdouble                 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,
                                          GimpProgress           *progress);
  void            (* resize)             (GimpItem               *item,
                                          GimpContext            *context,
                                          GimpFillType            fill_type,
                                          gint                    new_width,
                                          gint                    new_height,
                                          gint                    offset_x,
                                          gint                    offset_y);
  void            (* flip)               (GimpItem               *item,
                                          GimpContext            *context,
                                          GimpOrientationType     flip_type,
                                          gdouble                 axis,
                                          gboolean                clip_result);
  void            (* rotate)             (GimpItem               *item,
                                          GimpContext            *context,
                                          GimpRotationType        rotate_type,
                                          gdouble                 center_x,
                                          gdouble                 center_y,
                                          gboolean                clip_result);
  void            (* transform)          (GimpItem               *item,
                                          GimpContext            *context,
                                          const GimpMatrix3      *matrix,
                                          GimpTransformDirection  direction,
                                          GimpInterpolationType   interpolation_type,
                                          GimpTransformResize     clip_result,
                                          GimpProgress           *progress);
  GimpTransformResize (* get_clip)       (GimpItem               *item,
                                          GimpTransformResize     clip_result);
  gboolean        (* fill)               (GimpItem               *item,
                                          GimpDrawable           *drawable,
                                          GimpFillOptions        *fill_options,
                                          gboolean                push_undo,
                                          GimpProgress           *progress,
                                          GError                **error);
  gboolean        (* stroke)             (GimpItem               *item,
                                          GimpDrawable           *drawable,
                                          GimpStrokeOptions      *stroke_options,
                                          gboolean                push_undo,
                                          GimpProgress           *progress,
                                          GError                **error);
  void            (* to_selection)       (GimpItem               *item,
                                          GimpChannelOps          op,
                                          gboolean                antialias,
                                          gboolean                feather,
                                          gdouble                 feather_radius_x,
                                          gdouble                 feather_radius_y);

  const gchar *default_name;
  const gchar *rename_desc;
  const gchar *translate_desc;
  const gchar *scale_desc;
  const gchar *resize_desc;
  const gchar *flip_desc;
  const gchar *rotate_desc;
  const gchar *transform_desc;
  const gchar *to_selection_desc;
  const gchar *fill_desc;
  const gchar *stroke_desc;

  const gchar *reorder_desc;
  const gchar *raise_desc;
  const gchar *raise_to_top_desc;
  const gchar *lower_desc;
  const gchar *lower_to_bottom_desc;

  const gchar *raise_failed;
  const gchar *lower_failed;
};


GType           gimp_item_get_type           (void) G_GNUC_CONST;

GimpItem      * gimp_item_new                (GType               type,
                                              GimpImage          *image,
                                              const gchar        *name,
                                              gint                offset_x,
                                              gint                offset_y,
                                              gint                width,
                                              gint                height);

void            gimp_item_removed            (GimpItem           *item);
gboolean        gimp_item_is_removed         (GimpItem           *item);
void            gimp_item_unset_removed      (GimpItem           *item);

gboolean        gimp_item_is_attached        (GimpItem           *item);

GimpItem      * gimp_item_get_parent         (GimpItem           *item);

GimpItemTree  * gimp_item_get_tree           (GimpItem           *item);
GimpContainer * gimp_item_get_container      (GimpItem           *item);
GList         * gimp_item_get_container_iter (GimpItem           *item);
gint            gimp_item_get_index          (GimpItem           *item);
GList         * gimp_item_get_path           (GimpItem           *item);

gboolean        gimp_item_bounds             (GimpItem           *item,
                                              gint               *x,
                                              gint               *y,
                                              gint               *width,
                                              gint               *height);
gboolean        gimp_item_bounds_f           (GimpItem           *item,
                                              gdouble            *x,
                                              gdouble            *y,
                                              gdouble            *width,
                                              gdouble            *height);

GimpItem      * gimp_item_duplicate          (GimpItem           *item,
                                              GType               new_type);
GimpItem      * gimp_item_convert            (GimpItem           *item,
                                              GimpImage          *dest_image,
                                              GType               new_type);

gboolean        gimp_item_rename             (GimpItem           *item,
                                              const gchar        *new_name,
                                              GError            **error);

gint            gimp_item_get_width          (GimpItem           *item);
gint            gimp_item_get_height         (GimpItem           *item);
void            gimp_item_set_size           (GimpItem           *item,
                                              gint                width,
                                              gint                height);

void            gimp_item_get_offset         (GimpItem           *item,
                                              gint               *offset_x,
                                              gint               *offset_y);
void            gimp_item_set_offset         (GimpItem           *item,
                                              gint                offset_x,
                                              gint                offset_y);
gint            gimp_item_get_offset_x       (GimpItem           *item);
gint            gimp_item_get_offset_y       (GimpItem           *item);

void            gimp_item_start_move         (GimpItem           *item,
                                              gboolean            push_undo);
void            gimp_item_end_move           (GimpItem           *item,
                                              gboolean            push_undo);

void            gimp_item_start_transform    (GimpItem           *item,
                                              gboolean            push_undo);
void            gimp_item_end_transform      (GimpItem           *item,
                                              gboolean            push_undo);

void            gimp_item_translate          (GimpItem           *item,
                                              gdouble             offset_x,
                                              gdouble             offset_y,
                                              gboolean            push_undo);

gboolean        gimp_item_check_scaling      (GimpItem           *item,
                                              gint                new_width,
                                              gint                new_height);
void            gimp_item_scale              (GimpItem           *item,
                                              gint                new_width,
                                              gint                new_height,
                                              gint                new_offset_x,
                                              gint                new_offset_y,
                                              GimpInterpolationType interpolation,
                                              GimpProgress       *progress);
gboolean        gimp_item_scale_by_factors   (GimpItem           *item,
                                              gdouble             w_factor,
                                              gdouble             h_factor,
                                              GimpInterpolationType interpolation,
                                              GimpProgress       *progress);
gboolean
      gimp_item_scale_by_factors_with_origin (GimpItem           *item,
                                              gdouble             w_factor,
                                              gdouble             h_factor,
                                              gint                origin_x,
                                              gint                origin_y,
                                              gint                new_origin_x,
                                              gint                new_origin_y,
                                              GimpInterpolationType interpolation,
                                              GimpProgress       *progress);
void            gimp_item_scale_by_origin    (GimpItem           *item,
                                              gint                new_width,
                                              gint                new_height,
                                              GimpInterpolationType interpolation,
                                              GimpProgress       *progress,
                                              gboolean            local_origin);
void            gimp_item_resize             (GimpItem           *item,
                                              GimpContext        *context,
                                              GimpFillType        fill_type,
                                              gint                new_width,
                                              gint                new_height,
                                              gint                offset_x,
                                              gint                offset_y);
void            gimp_item_resize_to_image    (GimpItem           *item);

void            gimp_item_flip               (GimpItem           *item,
                                              GimpContext        *context,
                                              GimpOrientationType flip_type,
                                              gdouble             axis,
                                              gboolean            clip_result);
void            gimp_item_rotate             (GimpItem           *item,
                                              GimpContext        *context,
                                              GimpRotationType    rotate_type,
                                              gdouble             center_x,
                                              gdouble             center_y,
                                              gboolean            clip_result);
void            gimp_item_transform          (GimpItem           *item,
                                              GimpContext        *context,
                                              const GimpMatrix3  *matrix,
                                              GimpTransformDirection direction,
                                              GimpInterpolationType interpolation_type,
                                              GimpTransformResize clip_result,
                                              GimpProgress       *progress);
GimpTransformResize   gimp_item_get_clip     (GimpItem           *item,
                                              GimpTransformResize clip_result);

gboolean        gimp_item_fill               (GimpItem           *item,
                                              GimpDrawable       *drawable,
                                              GimpFillOptions    *fill_options,
                                              gboolean            push_undo,
                                              GimpProgress       *progress,
                                              GError            **error);
gboolean        gimp_item_stroke             (GimpItem           *item,
                                              GimpDrawable       *drawable,
                                              GimpContext        *context,
                                              GimpStrokeOptions  *stroke_options,
                                              GimpPaintOptions   *paint_options,
                                              gboolean            push_undo,
                                              GimpProgress       *progress,
                                              GError            **error);

void            gimp_item_to_selection       (GimpItem           *item,
                                              GimpChannelOps      op,
                                              gboolean            antialias,
                                              gboolean            feather,
                                              gdouble             feather_radius_x,
                                              gdouble             feather_radius_y);

void            gimp_item_add_offset_node    (GimpItem           *item,
                                              GeglNode           *node);
void            gimp_item_remove_offset_node (GimpItem           *item,
                                              GeglNode           *node);

gint            gimp_item_get_ID             (GimpItem           *item);
GimpItem      * gimp_item_get_by_ID          (Gimp               *gimp,
                                              gint                id);

GimpTattoo      gimp_item_get_tattoo         (GimpItem           *item);
void            gimp_item_set_tattoo         (GimpItem           *item,
                                              GimpTattoo          tattoo);

GimpImage     * gimp_item_get_image          (GimpItem           *item);
void            gimp_item_set_image          (GimpItem           *item,
                                              GimpImage          *image);

void            gimp_item_replace_item       (GimpItem           *item,
                                              GimpItem           *replace);

void               gimp_item_set_parasites   (GimpItem           *item,
                                              GimpParasiteList   *parasites);
GimpParasiteList * gimp_item_get_parasites   (GimpItem           *item);

gboolean        gimp_item_parasite_validate  (GimpItem           *item,
                                              const GimpParasite *parasite,
                                              GError            **error);
void            gimp_item_parasite_attach    (GimpItem           *item,
                                              const GimpParasite *parasite,
                                              gboolean            push_undo);
void            gimp_item_parasite_detach    (GimpItem           *item,
                                              const gchar        *name,
                                              gboolean            push_undo);
const GimpParasite * gimp_item_parasite_find (GimpItem           *item,
                                              const gchar        *name);
gchar        ** gimp_item_parasite_list      (GimpItem           *item,
                                              gint               *count);

void            gimp_item_set_visible        (GimpItem           *item,
                                              gboolean            visible,
                                              gboolean            push_undo);
gboolean        gimp_item_get_visible        (GimpItem           *item);
gboolean        gimp_item_is_visible         (GimpItem           *item);

void        gimp_item_bind_visible_to_active (GimpItem           *item,
                                              gboolean            bind);

void            gimp_item_set_linked         (GimpItem           *item,
                                              gboolean            linked,
                                              gboolean            push_undo);
gboolean        gimp_item_get_linked         (GimpItem           *item);

void            gimp_item_set_color_tag      (GimpItem           *item,
                                              GimpColorTag        color_tag,
                                              gboolean            push_undo);
GimpColorTag    gimp_item_get_color_tag      (GimpItem           *item);
GimpColorTag  gimp_item_get_merged_color_tag (GimpItem           *item);

void            gimp_item_set_lock_content   (GimpItem           *item,
                                              gboolean            lock_content,
                                              gboolean            push_undo);
gboolean        gimp_item_get_lock_content   (GimpItem           *item);
gboolean        gimp_item_can_lock_content   (GimpItem           *item);
gboolean        gimp_item_is_content_locked  (GimpItem           *item);

void            gimp_item_set_lock_position  (GimpItem          *item,
                                              gboolean           lock_position,
                                              gboolean           push_undo);
gboolean        gimp_item_get_lock_position  (GimpItem          *item);
gboolean        gimp_item_can_lock_position  (GimpItem          *item);
gboolean        gimp_item_is_position_locked (GimpItem          *item);

gboolean        gimp_item_mask_bounds        (GimpItem           *item,
                                              gint               *x1,
                                              gint               *y1,
                                              gint               *x2,
                                              gint               *y2);
gboolean        gimp_item_mask_intersect     (GimpItem           *item,
                                              gint               *x,
                                              gint               *y,
                                              gint               *width,
                                              gint               *height);

gboolean        gimp_item_is_in_set          (GimpItem           *item,
                                              GimpItemSet         set);


#endif /* __GIMP_ITEM_H__ */