GIMP Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# gimpdrawable

## Name

gimpdrawable --

## Synopsis

    struct      GimpDrawable;
    GimpDrawable* gimp_drawable_get             (gint32 drawable_ID);
    void        gimp_drawable_detach            (GimpDrawable *drawable);
    void        gimp_drawable_flush             (GimpDrawable *drawable);
    void        gimp_drawable_delete            (GimpDrawable *drawable);
    gchar*      gimp_drawable_name              (gint32 drawable_ID);
    gboolean    gimp_drawable_visible           (gint32 drawable_ID);
    void        gimp_drawable_set_name          (gint32 drawable_ID,
                                                 gchar *name);
    void        gimp_drawable_set_visible       (gint32 drawable_ID,
                                                 gboolean visible);
    GimpTile*   gimp_drawable_get_tile          (GimpDrawable *drawable,
                                                 gint shadow,
                                                 gint row,
                                                 gint col);
    GimpTile*   gimp_drawable_get_tile2         (GimpDrawable *drawable,
                                                 gint shadow,
                                                 gint x,
                                                 gint y);
    guchar*     gimp_drawable_get_thumbnail_data
                                                (gint32 drawable_ID,
                                                 gint *width,
                                                 gint *height,
                                                 gint *bpp);
    gboolean    gimp_drawable_merge_shadow      (gint32 drawable_ID,
                                                 gboolean undo);
    gboolean    gimp_drawable_fill              (gint32 drawable_ID,
                                                 GimpFillType fill_type);
    gboolean    gimp_drawable_update            (gint32 drawable_ID,
                                                 gint x,
                                                 gint y,
                                                 gint width,
                                                 gint height);
    gboolean    gimp_drawable_mask_bounds       (gint32 drawable_ID,
                                                 gint *x1,
                                                 gint *y1,
                                                 gint *x2,
                                                 gint *y2);
    gint32      gimp_drawable_image             (gint32 drawable_ID);
    GimpImageType gimp_drawable_type            (gint32 drawable_ID);
    gboolean    gimp_drawable_has_alpha         (gint32 drawable_ID);
    GimpImageType gimp_drawable_type_with_alpha (gint32 drawable_ID);
    gboolean    gimp_drawable_is_rgb            (gint32 drawable_ID);
    gboolean    gimp_drawable_is_gray           (gint32 drawable_ID);
    gboolean    gimp_drawable_is_indexed        (gint32 drawable_ID);
    gint        gimp_drawable_bytes             (gint32 drawable_ID);
    gint        gimp_drawable_width             (gint32 drawable_ID);
    gint        gimp_drawable_height            (gint32 drawable_ID);
    gboolean    gimp_drawable_offsets           (gint32 drawable_ID,
                                                 gint *offset_x,
                                                 gint *offset_y);
    gboolean    gimp_drawable_is_layer          (gint32 drawable_ID);
    gboolean    gimp_drawable_is_layer_mask     (gint32 drawable_ID);
    gboolean    gimp_drawable_is_channel        (gint32 drawable_ID);
    #define     gimp_drawable_offset
    #define     gimp_drawable_image_id
    #define     gimp_drawable_bpp

## Description

## Details

### struct GimpDrawable

    struct GimpDrawable
    {
      gint32    id;            /* drawable ID */
      guint     width;         /* width of drawble */
      guint     height;        /* height of drawble */
      guint     bpp;           /* bytes per pixel of drawable */
      guint     ntile_rows;    /* # of tile rows */
      guint     ntile_cols;    /* # of tile columns */
      GimpTile *tiles;         /* the normal tiles */
      GimpTile *shadow_tiles;  /* the shadow tiles */
    };

### gimp_drawable_get ()

    GimpDrawable* gimp_drawable_get             (gint32 drawable_ID);

`drawable_ID` : |
Returns : |

### gimp_drawable_detach ()

    void        gimp_drawable_detach            (GimpDrawable *drawable);

`drawable` : |

### gimp_drawable_flush ()

    void        gimp_drawable_flush             (GimpDrawable *drawable);

`drawable` : |

### gimp_drawable_delete ()

    void        gimp_drawable_delete            (GimpDrawable *drawable);

`drawable` : |

### gimp_drawable_name ()

    gchar*      gimp_drawable_name              (gint32 drawable_ID);

`drawable_ID` : |
Returns : |

### gimp_drawable_visible ()

    gboolean    gimp_drawable_visible           (gint32 drawable_ID);

`drawable_ID` : |
Returns : |

### gimp_drawable_set_name ()

    void        gimp_drawable_set_name          (gint32 drawable_ID,
                                                 gchar *name);

`drawable_ID` : |
`name` : |

### gimp_drawable_set_visible ()

    void        gimp_drawable_set_visible       (gint32 drawable_ID,
                                                 gboolean visible);

`drawable_ID` : |
`visible` : |

### gimp_drawable_get_tile ()

    GimpTile*   gimp_drawable_get_tile          (GimpDrawable *drawable,
                                                 gint shadow,
                                                 gint row,
                                                 gint col);

`drawable` : |
`shadow` : |
`row` : |
`col` : |
Returns : |

### gimp_drawable_get_tile2 ()

    GimpTile*   gimp_drawable_get_tile2         (GimpDrawable *drawable,
                                                 gint shadow,
                                                 gint x,
                                                 gint y);

`drawable` : |
`shadow` : |
`x` : |
`y` : |
Returns : |

### gimp_drawable_get_thumbnail_data ()

    guchar*     gimp_drawable_get_thumbnail_data
                                                (gint32 drawable_ID,
                                                 gint *width,
                                                 gint *height,
                                                 gint *bpp);

`drawable_ID` : |
`width` : |
`height` : |
`bpp` : |

### gimp_drawable_merge_shadow ()

    gboolean    gimp_drawable_merge_shadow      (gint32 drawable_ID,
                                                 gboolean undo);

Merge the shadow buffer with the specified drawable.

This procedure combines the contents of the image's shadow buffer (for temporary processing) with the specified drawable. The \"undo\" parameter specifies whether to add an undo step for the operation. Requesting no undo is useful for such applications as 'auto-apply'.

`drawable_ID` : | The drawable.
`undo` : | Push merge to undo stack?
Returns : | TRUE on success.

### gimp_drawable_fill ()

    gboolean    gimp_drawable_fill              (gint32 drawable_ID,
                                                 GimpFillType fill_type);

Fill the drawable with the specified fill mode.

This procedure fills the drawable with the fill mode. If the fill mode is foreground the current foreground color is used. If the fill mode is background, the current background color is used. If the fill type is white, then white is used. Transparent fill only affects layers with an alpha channel, in which case the alpha channel is set to transparent. If the drawable has no alpha channel, it is filled to white. No fill leaves the drawable's contents undefined. This procedure is unlike the bucket fill tool because it fills regardless of a selection

`drawable_ID` : | The drawable.
`fill_type` : | The type of fill.
Returns : | TRUE on success.

### gimp_drawable_update ()

    gboolean    gimp_drawable_update            (gint32 drawable_ID,
                                                 gint x,
                                                 gint y,
                                                 gint width,
                                                 gint height);

Update the specified region of the drawable.

This procedure updates the specified region of the drawable. The (x, y) coordinate pair is relative to the drawable's origin, not to the image origin. Therefore, the entire drawable can be updated with: {x->0, y->0, w->width, h->height }.

`drawable_ID` : | The drawable.
`x` : | x coordinate of upper left corner of update region.
`y` : | y coordinate of upper left corner of update region.
`width` : | Width of update region.
`height` : | Height of update region.
Returns : | TRUE on success.

### gimp_drawable_mask_bounds ()

    gboolean    gimp_drawable_mask_bounds       (gint32 drawable_ID,
                                                 gint *x1,
                                                 gint *y1,
                                                 gint *x2,
                                                 gint *y2);

Find the bounding box of the current selection in relation to the specified drawable.

This procedure returns the whether there is a selection. If there is one, the upper left and lower righthand corners of its bounding box are returned. These coordinates are specified relative to the drawable's origin, and bounded by the drawable's extents.

`drawable_ID` : | The drawable.
`x1` : | x coordinate of the upper left corner of selection bounds.
`y1` : | y coordinate of the upper left corner of selection bounds.
`x2` : | x coordinate of the lower right corner of selection bounds.
`y2` : | y coordinate of the lower right corner of selection bounds.
Returns : | TRUE if there is a selection.

### gimp_drawable_image ()

    gint32      gimp_drawable_image             (gint32 drawable_ID);

Returns the drawable's image.

This procedure returns the drawable's image.

`drawable_ID` : | The drawable.
Returns : | The drawable's image.

### gimp_drawable_type ()

    GimpImageType gimp_drawable_type            (gint32 drawable_ID);

Returns the drawable's type.

This procedure returns the drawable's type.

`drawable_ID` : | The drawable.
Returns : | The drawable's type.

### gimp_drawable_has_alpha ()

    gboolean    gimp_drawable_has_alpha         (gint32 drawable_ID);

Returns non-zero if the drawable has an alpha channel.

This procedure returns whether the specified drawable has an alpha channel. This can only be true for layers, and the associated type will be one of: { RGBA , GRAYA, INDEXEDA }.

`drawable_ID` : | The drawable.
Returns : | Does the drawable have an alpha channel?

### gimp_drawable_type_with_alpha ()

    GimpImageType gimp_drawable_type_with_alpha (gint32 drawable_ID);

Returns the drawable's type with alpha.

This procedure returns the drawable's type if an alpha channel were added. If the type is currently Gray, for instance, the returned type would be GrayA. If the drawable already has an alpha channel, the drawable's type is simply returned.

`drawable_ID` : | The drawable.
Returns : | The drawable's type with alpha.

### gimp_drawable_is_rgb ()

    gboolean    gimp_drawable_is_rgb            (gint32 drawable_ID);

Returns whether the drawable is an RGB type.

This procedure returns non-zero if the specified drawable is of type { RGB, RGBA }.

`drawable_ID` : | The drawable.
Returns : | non-zero if the drawable is an RGB type.

### gimp_drawable_is_gray ()

    gboolean    gimp_drawable_is_gray           (gint32 drawable_ID);

Returns whether the drawable is a grayscale type.

This procedure returns non-zero if the specified drawable is of type { Gray, GrayA }.

`drawable_ID` : | The drawable.
Returns : | non-zero if the drawable is a grayscale type.

### gimp_drawable_is_indexed ()

    gboolean    gimp_drawable_is_indexed        (gint32 drawable_ID);

Returns whether the drawable is an indexed type.

This procedure returns non-zero if the specified drawable is of type { Indexed, IndexedA }.

`drawable_ID` : | The drawable.
Returns : | non-zero if the drawable is an indexed type.

### gimp_drawable_bytes ()

    gint        gimp_drawable_bytes             (gint32 drawable_ID);

Returns the bytes per pixel.

This procedure returns the number of bytes per pixel (or the number of channels) for the specified drawable.

`drawable_ID` : | The drawable.
Returns : | Bytes per pixel.

### gimp_drawable_width ()

    gint        gimp_drawable_width             (gint32 drawable_ID);

Returns the width of the drawable.

This procedure returns the specified drawable's width in pixels.

`drawable_ID` : | The drawable.
Returns : | Width of drawable.

### gimp_drawable_height ()

    gint        gimp_drawable_height            (gint32 drawable_ID);

Returns the height of the drawable.

This procedure returns the specified drawable's height in pixels.

`drawable_ID` : | The drawable.
Returns : | Height of drawable.

### gimp_drawable_offsets ()

    gboolean    gimp_drawable_offsets           (gint32 drawable_ID,
                                                 gint *offset_x,
                                                 gint *offset_y);

Returns the offsets for the drawable.

This procedure returns the specified drawable's offsets. This only makes sense if the drawable is a layer since channels are anchored. The offsets of a channel will be returned as 0.

`drawable_ID` : | The drawable.
`offset_x` : | x offset of drawable.
`offset_y` : | y offset of drawable.
Returns : | TRUE on success.

### gimp_drawable_is_layer ()

    gboolean    gimp_drawable_is_layer          (gint32 drawable_ID);

Returns whether the drawable is a layer.

This procedure returns non-zero if the specified drawable is a layer.

`drawable_ID` : | The drawable.
Returns : | Non-zero if the drawable is a layer.

### gimp_drawable_is_layer_mask ()

    gboolean    gimp_drawable_is_layer_mask     (gint32 drawable_ID);

Returns whether the drawable is a layer mask.

This procedure returns non-zero if the specified drawable is a layer mask.

`drawable_ID` : | The drawable.
Returns : | Non-zero if the drawable is a layer mask.

### gimp_drawable_is_channel ()

    gboolean    gimp_drawable_is_channel        (gint32 drawable_ID);

Returns whether the drawable is a channel.

This procedure returns non-zero if the specified drawable is a channel.

`drawable_ID` : | The drawable.
Returns : | Non-zero if the drawable is a channel.

### gimp_drawable_offset

    #define gimp_drawable_offset    gimp_channel_ops_offset

### gimp_drawable_image_id

    #define gimp_drawable_image_id  gimp_drawable_image

### gimp_drawable_bpp

    #define gimp_drawable_bpp       gimp_drawable_bytes

<<< Previous Page | Home | Up | Next Page >>>
gimpdisplay | gimpedit