GimpItem

GimpItem

Synopsis

                    GimpItem;
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                (const GimpItem *item);
void                gimp_item_unset_removed             (GimpItem *item);
gboolean            gimp_item_is_attached               (const GimpItem *item);
GimpItem *          gimp_item_get_parent                (const 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);
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                 (const GimpItem *item);
gint                gimp_item_get_height                (const GimpItem *item);
void                gimp_item_set_size                  (GimpItem *item,
                                                         gint width,
                                                         gint height);
void                gimp_item_get_offset                (const 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_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,
                                                         GimpInterpolationType interpolation,
                                                         GimpProgress *progress);
gboolean            gimp_item_scale_by_factors          (GimpItem *item,
                                                         gdouble w_factor,
                                                         gdouble h_factor,
                                                         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,
                                                         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 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,
                                                         GimpTransformDirection direction,
                                                         GimpInterpolationType interpolation_type,
                                                         gint recursion_level,
                                                         GimpTransformResize clip_result,
                                                         GimpProgress *progress);
gboolean            gimp_item_stroke                    (GimpItem *item,
                                                         GimpDrawable *drawable,
                                                         GimpContext *context,
                                                         GimpStrokeOptions *stroke_options,
                                                         gboolean use_default_values,
                                                         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);
GeglNode *          gimp_item_get_node                  (GimpItem *item);
GeglNode *          gimp_item_peek_node                 (GimpItem *item);
GeglNode *          gimp_item_get_offset_node           (GimpItem *item);
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_replace_item              (GimpItem *item,
                                                         GimpItem *replace);
GimpParasiteList *  gimp_item_get_parasites             (const GimpItem *item);
void                gimp_item_set_parasites             (GimpItem *item,
                                                         GimpParasiteList *parasites);
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            (const GimpItem *item,
                                                         const gchar *name);
gchar **            gimp_item_parasite_list             (const GimpItem *item,
                                                         gint *count);
gboolean            gimp_item_get_visible               (const GimpItem *item);
void                gimp_item_set_visible               (GimpItem *item,
                                                         gboolean visible,
                                                         gboolean push_undo);
gboolean            gimp_item_is_visible                (const GimpItem *item);
gboolean            gimp_item_get_linked                (const GimpItem *item);
void                gimp_item_set_linked                (GimpItem *item,
                                                         gboolean linked,
                                                         gboolean push_undo);
gboolean            gimp_item_get_lock_content          (const GimpItem *item);
void                gimp_item_set_lock_content          (GimpItem *item,
                                                         gboolean lock_content,
                                                         gboolean push_undo);
gboolean            gimp_item_can_lock_content          (const GimpItem *item);
gboolean            gimp_item_is_content_locked         (const 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);

Object Hierarchy

  GObject
   +----GimpObject
         +----GimpViewable
               +----GimpItem
                     +----GimpDrawable
                     +----GimpVectors

Implemented Interfaces

GimpItem implements GimpConfigInterface.

Properties

  "height"                   gint                  : Read
  "id"                       gint                  : Read
  "image"                    GimpImage*            : Read / Write / Construct
  "linked"                   gboolean              : Read
  "lock-content"             gboolean              : Read
  "offset-x"                 gint                  : Read
  "offset-y"                 gint                  : Read
  "visible"                  gboolean              : Read
  "width"                    gint                  : Read

Signals

  "linked-changed"                                 : Run First
  "lock-content-changed"                           : Run First
  "removed"                                        : Run First
  "visibility-changed"                             : Run First

Description

Details

GimpItem

typedef struct _GimpItem GimpItem;


gimp_item_new ()

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

type :

The new item's type.

image :

The new item's GimpImage.

name :

The name to assign the item.

offset_x :

The X offset to assign the item.

offset_y :

The Y offset to assign the item.

width :

The width to assign the item.

height :

The height to assign the item.

Returns :

The newly created item.

gimp_item_removed ()

void                gimp_item_removed                   (GimpItem *item);


gimp_item_is_removed ()

gboolean            gimp_item_is_removed                (const GimpItem *item);

item :

the GimpItem to check.

Returns :

TRUE if the 'removed' flag is set for item, FALSE otherwise.

gimp_item_unset_removed ()

void                gimp_item_unset_removed             (GimpItem *item);

Unsets an item's "removed" state. This function is called when an item was on the undo stack and is added back to its parent container during and undo or redo. It must never be called from anywhere else.

item :

a GimpItem which was on the undo stack

gimp_item_is_attached ()

gboolean            gimp_item_is_attached               (const GimpItem *item);

item :

The GimpItem to check.

Returns :

TRUE if the item is attached to an image, FALSE otherwise.

gimp_item_get_parent ()

GimpItem *          gimp_item_get_parent                (const GimpItem *item);


gimp_item_get_tree ()

GimpItemTree *      gimp_item_get_tree                  (GimpItem *item);


gimp_item_get_container ()

GimpContainer *     gimp_item_get_container             (GimpItem *item);


gimp_item_get_container_iter ()

GList *             gimp_item_get_container_iter        (GimpItem *item);


gimp_item_get_index ()

gint                gimp_item_get_index                 (GimpItem *item);


gimp_item_get_path ()

GList *             gimp_item_get_path                  (GimpItem *item);


gimp_item_duplicate ()

GimpItem *          gimp_item_duplicate                 (GimpItem *item,
                                                         GType new_type);

item :

The GimpItem to duplicate.

new_type :

The type to make the new item.

Returns :

the newly created item.

gimp_item_convert ()

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

item :

The GimpItem to convert.

dest_image :

The GimpImage in which to place the converted item.

new_type :

The type to convert the item to.

Returns :

the new item that results from the conversion.

gimp_item_rename ()

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

This function assigns a new name to the item, if the desired name is different from the name it already has, and pushes an entry onto the undo stack for the item's image. If new_name is NULL or empty, the default name for the item's class is used. If the name is changed, the GimpObject::name-changed signal is emitted for the item.

item :

The GimpItem to rename.

new_name :

The new name to give the item.

error :

Return location for error message.

Returns :

TRUE if the item could be renamed, FALSE otherwise.

gimp_item_get_width ()

gint                gimp_item_get_width                 (const GimpItem *item);

item :

The GimpItem to check.

Returns :

The width of the item.

gimp_item_get_height ()

gint                gimp_item_get_height                (const GimpItem *item);

item :

The GimpItem to check.

Returns :

The height of the item.

gimp_item_set_size ()

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


gimp_item_get_offset ()

void                gimp_item_get_offset                (const GimpItem *item,
                                                         gint *offset_x,
                                                         gint *offset_y);

Reveals the X and Y offsets of the item.

item :

The GimpItem to check.

offset_x :

Return location for the item's X offset.

offset_y :

Return location for the item's Y offset.

gimp_item_set_offset ()

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


gimp_item_get_offset_x ()

gint                gimp_item_get_offset_x              (GimpItem *item);


gimp_item_get_offset_y ()

gint                gimp_item_get_offset_y              (GimpItem *item);


gimp_item_translate ()

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

Adds the specified increments to the X and Y offsets for the item.

item :

The GimpItem to move.

offset_x :

Increment to the X offset of the item.

offset_y :

Increment to the Y offset of the item.

push_undo :

If TRUE, create an entry in the image's undo stack for this action.

gimp_item_check_scaling ()

gboolean            gimp_item_check_scaling             (const GimpItem *item,
                                                         gint new_width,
                                                         gint new_height);

Scales item dimensions, then snaps them to pixel centers

item :

Item to check

new_width :

proposed width of item, in pixels

new_height :

proposed height of item, in pixels

Returns :

FALSE if any dimension reduces to zero as a result of this; otherwise, returns TRUE.

gimp_item_scale ()

void                gimp_item_scale                     (GimpItem *item,
                                                         gint new_width,
                                                         gint new_height,
                                                         gint new_offset_x,
                                                         gint new_offset_y,
                                                         GimpInterpolationType interpolation,
                                                         GimpProgress *progress);


gimp_item_scale_by_factors ()

gboolean            gimp_item_scale_by_factors          (GimpItem *item,
                                                         gdouble w_factor,
                                                         gdouble h_factor,
                                                         GimpInterpolationType interpolation,
                                                         GimpProgress *progress);

Scales item dimensions and offsets by uniform width and height factors.

Use gimp_item_scale_by_factors() in circumstances when the same width and height scaling factors are to be uniformly applied to a set of items. In this context, the item's dimensions and offsets from the sides of the containing image all change by these predetermined factors. By fiat, the fixed point of the transform is the upper left hand corner of the image. Returns FALSE if a requested scale factor is zero or if a scaling zero's out a item dimension; returns TRUE otherwise.

Use gimp_item_scale() in circumstances where new item width and height dimensions are predetermined instead.

Side effects: Undo set created for item. Old item imagery scaled & painted to new item tiles.

item :

Item to be transformed by explicit width and height factors.

w_factor :

scale factor to apply to width and horizontal offset

h_factor :

scale factor to apply to height and vertical offset

Returns :

TRUE, if the scaled item has positive dimensions FALSE if the scaled item has at least one zero dimension

gimp_item_scale_by_origin ()

void                gimp_item_scale_by_origin           (GimpItem *item,
                                                         gint new_width,
                                                         gint new_height,
                                                         GimpInterpolationType interpolation,
                                                         GimpProgress *progress,
                                                         gboolean local_origin);

Sets item dimensions to new_width and new_height. Derives vertical and horizontal scaling transforms from new width and height. If local_origin is TRUE, the fixed point of the scaling transform coincides with the item's center point. Otherwise, the fixed point is taken to be [-GimpItem::offset_x, -GimpItem::->offset_y].

Since this function derives scale factors from new and current item dimensions, these factors will vary from item to item because of aliasing artifacts; factor variations among items can be quite large where item dimensions approach pixel dimensions. Use gimp_item_scale_by_factors() where constant scales are to be uniformly applied to a number of items.

Side effects: undo set created for item. Old item imagery scaled & painted to new item tiles

item :

The item to be transformed by width & height scale factors

new_width :

The width that item will acquire

new_height :

The height that the item will acquire

local_origin :

sets fixed point of the scaling transform. See below.

gimp_item_resize ()

void                gimp_item_resize                    (GimpItem *item,
                                                         GimpContext *context,
                                                         gint new_width,
                                                         gint new_height,
                                                         gint offset_x,
                                                         gint offset_y);


gimp_item_resize_to_image ()

void                gimp_item_resize_to_image           (GimpItem *item);


gimp_item_flip ()

void                gimp_item_flip                      (GimpItem *item,
                                                         GimpContext *context,
                                                         GimpOrientationType flip_type,
                                                         gdouble axis,
                                                         gboolean flip_result);


gimp_item_rotate ()

void                gimp_item_rotate                    (GimpItem *item,
                                                         GimpContext *context,
                                                         GimpRotationType rotate_type,
                                                         gdouble center_x,
                                                         gdouble center_y,
                                                         gboolean flip_result);


gimp_item_transform ()

void                gimp_item_transform                 (GimpItem *item,
                                                         GimpContext *context,
                                                         const GimpMatrix3 *matrix,
                                                         GimpTransformDirection direction,
                                                         GimpInterpolationType interpolation_type,
                                                         gint recursion_level,
                                                         GimpTransformResize clip_result,
                                                         GimpProgress *progress);


gimp_item_stroke ()

gboolean            gimp_item_stroke                    (GimpItem *item,
                                                         GimpDrawable *drawable,
                                                         GimpContext *context,
                                                         GimpStrokeOptions *stroke_options,
                                                         gboolean use_default_values,
                                                         gboolean push_undo,
                                                         GimpProgress *progress,
                                                         GError **error);


gimp_item_to_selection ()

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


gimp_item_get_node ()

GeglNode *          gimp_item_get_node                  (GimpItem *item);


gimp_item_peek_node ()

GeglNode *          gimp_item_peek_node                 (GimpItem *item);


gimp_item_get_offset_node ()

GeglNode *          gimp_item_get_offset_node           (GimpItem *item);


gimp_item_get_ID ()

gint                gimp_item_get_ID                    (GimpItem *item);


gimp_item_get_by_ID ()

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


gimp_item_get_tattoo ()

GimpTattoo          gimp_item_get_tattoo                (const GimpItem *item);


gimp_item_set_tattoo ()

void                gimp_item_set_tattoo                (GimpItem *item,
                                                         GimpTattoo tattoo);


gimp_item_get_image ()

GimpImage *         gimp_item_get_image                 (const GimpItem *item);


gimp_item_set_image ()

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


gimp_item_replace_item ()

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

This function shouly only be called right after item has been newly allocated.

Replaces replace by item, as far as possible within the GimpItem class. The new item takes over replace's ID, tattoo, offset, size etc. and all these properties are set to NULL on replace.

This function *only* exists to allow subclasses to do evil hacks like in XCF text layer loading. Don't ever use this function if you are not sure.

After this function returns, replace has become completely unusable, should only be used to steal everything it has (like its drawable properties if it's a drawable), and then be destroyed.

item :

a newly allocated GimpItem

replace :

the GimpItem to be replaced by item

gimp_item_get_parasites ()

GimpParasiteList *  gimp_item_get_parasites             (const GimpItem *item);

Get an item's GimpParasiteList. It's usually never needed to fiddle with an item's parasite list directly. This function exists for special purposes only, like when saving an item to XCF.

item :

a GimpItem

Returns :

The item's GimpParasiteList.

gimp_item_set_parasites ()

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

Set an item's GimpParasiteList. It's usually never needed to fiddle with an item's parasite list directly. This function exists for special purposes only, like when creating items from unusual sources.

item :

a GimpItem

parasites :

a GimpParasiteList

gimp_item_parasite_attach ()

void                gimp_item_parasite_attach           (GimpItem *item,
                                                         const GimpParasite *parasite,
                                                         gboolean push_undo);


gimp_item_parasite_detach ()

void                gimp_item_parasite_detach           (GimpItem *item,
                                                         const gchar *name,
                                                         gboolean push_undo);


gimp_item_parasite_find ()

const GimpParasite * gimp_item_parasite_find            (const GimpItem *item,
                                                         const gchar *name);


gimp_item_parasite_list ()

gchar **            gimp_item_parasite_list             (const GimpItem *item,
                                                         gint *count);


gimp_item_get_visible ()

gboolean            gimp_item_get_visible               (const GimpItem *item);


gimp_item_set_visible ()

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


gimp_item_is_visible ()

gboolean            gimp_item_is_visible                (const GimpItem *item);


gimp_item_get_linked ()

gboolean            gimp_item_get_linked                (const GimpItem *item);


gimp_item_set_linked ()

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


gimp_item_get_lock_content ()

gboolean            gimp_item_get_lock_content          (const GimpItem *item);


gimp_item_set_lock_content ()

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


gimp_item_can_lock_content ()

gboolean            gimp_item_can_lock_content          (const GimpItem *item);


gimp_item_is_content_locked ()

gboolean            gimp_item_is_content_locked         (const GimpItem *item);


gimp_item_mask_bounds ()

gboolean            gimp_item_mask_bounds               (GimpItem *item,
                                                         gint *x1,
                                                         gint *y1,
                                                         gint *x2,
                                                         gint *y2);


gimp_item_mask_intersect ()

gboolean            gimp_item_mask_intersect            (GimpItem *item,
                                                         gint *x,
                                                         gint *y,
                                                         gint *width,
                                                         gint *height);


gimp_item_is_in_set ()

gboolean            gimp_item_is_in_set                 (GimpItem *item,
                                                         GimpItemSet set);

Property Details

The "height" property

  "height"                   gint                  : Read

Allowed values: [1,262144]

Default value: 1


The "id" property

  "id"                       gint                  : Read

Allowed values: >= 0

Default value: 0


The "image" property

  "image"                    GimpImage*            : Read / Write / Construct


The "linked" property

  "linked"                   gboolean              : Read

Default value: FALSE


The "lock-content" property

  "lock-content"             gboolean              : Read

Default value: FALSE


The "offset-x" property

  "offset-x"                 gint                  : Read

Allowed values: [-262144,262144]

Default value: 0


The "offset-y" property

  "offset-y"                 gint                  : Read

Allowed values: [-262144,262144]

Default value: 0


The "visible" property

  "visible"                  gboolean              : Read

Default value: TRUE


The "width" property

  "width"                    gint                  : Read

Allowed values: [1,262144]

Default value: 1

Signal Details

The "linked-changed" signal

void                user_function                      (GimpItem *gimpitem,
                                                        gpointer  user_data)      : Run First

gimpitem :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

The "lock-content-changed" signal

void                user_function                      (GimpItem *gimpitem,
                                                        gpointer  user_data)      : Run First

gimpitem :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

The "removed" signal

void                user_function                      (GimpItem *gimpitem,
                                                        gpointer  user_data)      : Run First

gimpitem :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

The "visibility-changed" signal

void                user_function                      (GimpItem *gimpitem,
                                                        gpointer  user_data)      : Run First

gimpitem :

the object which received the signal.

user_data :

user data set when the signal handler was connected.