gimpitem.h 14.1 KB
Newer Older
1
/* GIMP - The GNU Image Manipulation Program
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
 * 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_H__
#define __GIMP_ITEM_H__


#include "gimpviewable.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
{
  GimpViewable      parent_instance;

40 41
  gint              ID;                 /*  provides a unique ID     */
  guint32           tattoo;             /*  provides a permanent ID  */
42

43
  GimpImage        *image;              /*  item owner               */
44

45 46 47 48
  GimpParasiteList *parasites;          /*  Plug-in parasite data    */

  gint              width, height;      /*  size in pixels           */
  gint              offset_x, offset_y; /*  pixel offset in image    */
49

50
  gboolean          visible;            /*  control visibility       */
51
  gboolean          linked;             /*  control linkage          */
52

53
  gboolean          removed;            /*  removed from the image?  */
54 55 56

  GeglNode         *node;               /*  the GEGL node to plug
                                            into the graph           */
57 58 59 60 61 62
};

struct _GimpItemClass
{
  GimpViewableClass  parent_class;

63
  /*  signals  */
64 65 66
  void       (* removed)            (GimpItem      *item);
  void       (* visibility_changed) (GimpItem      *item);
  void       (* linked_changed)     (GimpItem      *item);
67 68

  /*  virtual functions  */
69 70
  gboolean   (* is_attached)  (GimpItem               *item);
  GimpItem * (* duplicate)    (GimpItem               *item,
71
                               GType                   new_type);
72 73
  void       (* convert)      (GimpItem               *item,
                               GimpImage              *dest_image);
74 75
  gboolean   (* rename)       (GimpItem               *item,
                               const gchar            *new_name,
76 77
                               const gchar            *undo_desc,
                               GError                **error);
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
  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,
                               GimpProgress           *progress);
  void       (* resize)       (GimpItem               *item,
                               GimpContext            *context,
                               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,
                               gint                    recursion_level,
112
                               GimpTransformResize     clip_result,
113 114 115
                               GimpProgress           *progress);
  gboolean   (* stroke)       (GimpItem               *item,
                               GimpDrawable           *drawable,
116
                               GimpStrokeOptions      *stroke_options,
117
                               gboolean                push_undo,
118 119
                               GimpProgress           *progress,
                               GError                **error);
120 121
  GeglNode * (* get_node)     (GimpItem               *item);

122 123 124

  const gchar *default_name;
  const gchar *rename_desc;
125 126 127 128 129 130
  const gchar *translate_desc;
  const gchar *scale_desc;
  const gchar *resize_desc;
  const gchar *flip_desc;
  const gchar *rotate_desc;
  const gchar *transform_desc;
131
  const gchar *stroke_desc;
132 133 134
};


135 136
GType           gimp_item_get_type         (void) G_GNUC_CONST;

137 138 139 140 141 142 143 144 145 146 147 148 149
void            gimp_item_removed          (GimpItem           *item);
gboolean        gimp_item_is_removed       (const GimpItem     *item);

gboolean        gimp_item_is_attached      (GimpItem           *item);

void            gimp_item_configure        (GimpItem           *item,
                                            GimpImage          *image,
                                            gint                offset_x,
                                            gint                offset_y,
                                            gint                width,
                                            gint                height,
                                            const gchar        *name);
GimpItem      * gimp_item_duplicate        (GimpItem           *item,
150
                                            GType               new_type);
151 152
GimpItem      * gimp_item_convert          (GimpItem           *item,
                                            GimpImage          *dest_image,
153
                                            GType               new_type);
154 155

gboolean        gimp_item_rename           (GimpItem           *item,
156 157
                                            const gchar        *new_name,
                                            GError            **error);
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177

gint            gimp_item_width            (const GimpItem     *item);
gint            gimp_item_height           (const GimpItem     *item);
void            gimp_item_offsets          (const GimpItem     *item,
                                            gint               *offset_x,
                                            gint               *offset_y);

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

gboolean        gimp_item_check_scaling    (const 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,
178
                                            GimpInterpolationType interpolation,
179 180 181 182
                                            GimpProgress       *progress);
gboolean        gimp_item_scale_by_factors (GimpItem           *item,
                                            gdouble             w_factor,
                                            gdouble             h_factor,
183
                                            GimpInterpolationType interpolation,
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
                                            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,
                                            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,
201
                                            GimpOrientationType flip_type,
202 203 204 205 206 207 208 209 210 211 212
                                            gdouble             axis,
                                            gboolean            flip_result);
void            gimp_item_rotate           (GimpItem           *item,
                                            GimpContext        *context,
                                            GimpRotationType    rotate_type,
                                            gdouble             center_x,
                                            gdouble             center_y,
                                            gboolean            flip_result);
void            gimp_item_transform        (GimpItem           *item,
                                            GimpContext        *context,
                                            const GimpMatrix3  *matrix,
213 214
                                            GimpTransformDirection direction,
                                            GimpInterpolationType interpolation_type,
215
                                            gint                recursion_level,
216
                                            GimpTransformResize clip_result,
217 218 219 220 221
                                            GimpProgress       *progress);

gboolean        gimp_item_stroke           (GimpItem           *item,
                                            GimpDrawable       *drawable,
                                            GimpContext        *context,
222
                                            GimpStrokeOptions  *stroke_options,
223
                                            gboolean            use_default_values,
224
                                            gboolean            push_undo,
225 226
                                            GimpProgress       *progress,
                                            GError            **error);
227

228 229 230
GeglNode      * gimp_item_get_node         (GimpItem           *item);


231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
gint            gimp_item_get_ID           (GimpItem           *item);
GimpItem      * gimp_item_get_by_ID        (Gimp               *gimp,
                                            gint                id);

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

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

void            gimp_item_parasite_attach  (GimpItem           *item,
                                            const GimpParasite *parasite);
void            gimp_item_parasite_detach  (GimpItem           *item,
                                            const gchar        *name);
const GimpParasite *gimp_item_parasite_find(const GimpItem     *item,
                                            const gchar        *name);
gchar        ** gimp_item_parasite_list    (const GimpItem     *item,
                                            gint               *count);

252
gboolean        gimp_item_get_visible      (const GimpItem     *item);
253 254 255 256 257 258 259 260
void            gimp_item_set_visible      (GimpItem           *item,
                                            gboolean            visible,
                                            gboolean            push_undo);

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

262 263 264
gboolean        gimp_item_is_in_set        (GimpItem           *item,
                                            GimpItemSet         set);

265 266

#endif /* __GIMP_ITEM_H__ */