Top |
Functions
Functions
gimp_drawable_get_buffer ()
GeglBuffer *
gimp_drawable_get_buffer (gint32 drawable_ID
);
Returns a GeglBuffer of a specified drawable. The buffer can be used
like any other GEGL buffer. Its data will we synced back with the core
drawable when the buffer gets destroyed, or when gegl_buffer_flush()
is called.
Since: 2.10
gimp_drawable_get_shadow_buffer ()
GeglBuffer *
gimp_drawable_get_shadow_buffer (gint32 drawable_ID
);
Returns a GeglBuffer of a specified drawable's shadow tiles. The
buffer can be used like any other GEGL buffer. Its data will we
synced back with the core drawable's shadow tiles when the buffer
gets destroyed, or when gegl_buffer_flush()
is called.
Since: 2.10
gimp_drawable_get_format ()
const Babl *
gimp_drawable_get_format (gint32 drawable_ID
);
Returns the Babl format of the drawable.
Since: 2.10
gimp_drawable_get_thumbnail_format ()
const Babl *
gimp_drawable_get_thumbnail_format (gint32 drawable_ID
);
Returns the Babl thumbnail format of the drawable.
Since: 2.10.14
gimp_drawable_get ()
GimpDrawable *
gimp_drawable_get (gint32 drawable_ID
);
gimp_drawable_get
is deprecated and should not be used in newly-written code.
This function creates a GimpDrawable structure for the core
drawable identified by drawable_ID
. The returned structure
contains some basic information about the drawable and can also
hold tile data for transfer to and from the core.
Note that the name of this function is somewhat misleading, because it suggests that it simply returns a handle. This is not the case: if the function is called multiple times, it creates separate tile lists each time, which will usually produce undesired results.
When a plug-in has finished working with a drawable, before exiting
it should call gimp_drawable_detach()
to make sure that all tile data is
transferred back to the core.
gimp_drawable_detach ()
void
gimp_drawable_detach (GimpDrawable *drawable
);
gimp_drawable_detach
is deprecated and should not be used in newly-written code.
This function is called when a plug-in is finished working
with a drawable. It forces all tile data held in the tile
list of the GimpDrawable to be transferred to the core, and
then frees all associated memory. You must not access the
drawable
after having called gimp_drawable_detach()
.
gimp_drawable_flush ()
void
gimp_drawable_flush (GimpDrawable *drawable
);
gimp_drawable_flush
is deprecated and should not be used in newly-written code.
This function causes all tile data in the tile list of drawable
to be
transferred to the core. It is usually called in situations where a
plug-in acts on a drawable, and then needs to read the results of its
actions. Data transferred back from the core will not generally be valid
unless gimp_drawable_flush()
has been called beforehand.
gimp_drawable_delete ()
gboolean
gimp_drawable_delete (gint32 drawable_ID
);
gimp_drawable_delete
is deprecated and should not be used in newly-written code.
Use gimp_item_delete()
instead.
gimp_drawable_is_valid ()
gboolean
gimp_drawable_is_valid (gint32 drawable_ID
);
gimp_drawable_is_valid
is deprecated and should not be used in newly-written code.
Use gimp_item_is_valid()
instead.
Since: 2.4
gimp_drawable_get_name ()
gchar *
gimp_drawable_get_name (gint32 drawable_ID
);
gimp_drawable_get_name
is deprecated and should not be used in newly-written code.
Use gimp_item_get_name()
instead.
gimp_drawable_set_name ()
gboolean gimp_drawable_set_name (gint32 drawable_ID
,const gchar *name
);
gimp_drawable_set_name
is deprecated and should not be used in newly-written code.
Use gimp_item_set_name()
instead.
gimp_drawable_get_visible ()
gboolean
gimp_drawable_get_visible (gint32 drawable_ID
);
gimp_drawable_get_visible
is deprecated and should not be used in newly-written code.
Use gimp_item_get_visible()
instead.
gimp_drawable_set_visible ()
gboolean gimp_drawable_set_visible (gint32 drawable_ID
,gboolean visible
);
gimp_drawable_set_visible
is deprecated and should not be used in newly-written code.
Use gimp_item_set_visible()
instead.
gimp_drawable_get_linked ()
gboolean
gimp_drawable_get_linked (gint32 drawable_ID
);
gimp_drawable_get_linked
is deprecated and should not be used in newly-written code.
Use gimp_item_get_linked()
instead.
gimp_drawable_set_linked ()
gboolean gimp_drawable_set_linked (gint32 drawable_ID
,gboolean linked
);
gimp_drawable_set_linked
is deprecated and should not be used in newly-written code.
Use gimp_item_set_linked()
instead.
gimp_drawable_get_tattoo ()
gint
gimp_drawable_get_tattoo (gint32 drawable_ID
);
gimp_drawable_get_tattoo
is deprecated and should not be used in newly-written code.
Use gimp_item_get_tattoo()
instead.
gimp_drawable_set_tattoo ()
gboolean gimp_drawable_set_tattoo (gint32 drawable_ID
,gint tattoo
);
gimp_drawable_set_tattoo
is deprecated and should not be used in newly-written code.
Use gimp_item_set_tattoo()
instead.
gimp_drawable_get_pixel ()
guint8 * gimp_drawable_get_pixel (gint32 drawable_ID
,gint x_coord
,gint y_coord
,gint *num_channels
);
Gets the value of the pixel at the specified coordinates.
This procedure gets the pixel value at the specified coordinates. The 'num_channels' argument must always be equal to the bytes-per-pixel value for the specified drawable.
gimp_drawable_set_pixel ()
gboolean gimp_drawable_set_pixel (gint32 drawable_ID
,gint x_coord
,gint y_coord
,gint num_channels
,const guint8 *pixel
);
Sets the value of the pixel at the specified coordinates.
This procedure sets the pixel value at the specified coordinates. The 'num_channels' argument must always be equal to the bytes-per-pixel value for the specified drawable. Note that this function is not undoable, you should use it only on drawables you just created yourself.
gimp_drawable_get_tile ()
GimpTile * gimp_drawable_get_tile (GimpDrawable *drawable
,gboolean shadow
,gint row
,gint col
);
gimp_drawable_get_tile
is deprecated and should not be used in newly-written code.
gimp_drawable_get_tile2 ()
GimpTile * gimp_drawable_get_tile2 (GimpDrawable *drawable
,gboolean shadow
,gint x
,gint y
);
gimp_drawable_get_tile2
is deprecated and should not be used in newly-written code.
gimp_drawable_get_thumbnail_data ()
guchar * gimp_drawable_get_thumbnail_data (gint32 drawable_ID
,gint *width
,gint *height
,gint *bpp
);
gimp_drawable_get_sub_thumbnail_data ()
guchar * gimp_drawable_get_sub_thumbnail_data (gint32 drawable_ID
,gint src_x
,gint src_y
,gint src_width
,gint src_height
,gint *dest_width
,gint *dest_height
,gint *bpp
);
gimp_drawable_get_color_uchar ()
void gimp_drawable_get_color_uchar (gint32 drawable_ID
,const GimpRGB *color
,guchar *color_uchar
);
gimp_drawable_get_color_uchar
is deprecated and should not be used in newly-written code.
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 drawable'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'.
gimp_drawable_free_shadow ()
gboolean
gimp_drawable_free_shadow (gint32 drawable_ID
);
Free the specified drawable's shadow data (if it exists).
This procedure is intended as a memory saving device. If any shadow memory has been allocated, it will be freed automatically when the drawable is removed from the image, or when the plug-in procedure which allocated it returns.
Since: 2.6
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. 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 gimp_edit_fill()
or the bucket fill tool
because it fills regardless of a selection. Its main purpose is to
fill a newly created drawable before adding it to the image. This
operation cannot be undone.
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 using (0, 0, width, height).
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 whether there is a selection. If there is
one, the upper left and lower right-hand corners of its bounding box
are returned. These coordinates are specified relative to the
drawable's origin, and bounded by the drawable's extents. Please
note that the pixel specified by the lower right-hand coordinate of
the bounding box is not part of the selection. The selection ends at
the upper left corner of this pixel. This means the width of the
selection can be calculated as (x2 - x1), its height as (y2 - y1).
Note that the returned boolean does NOT correspond with the returned
region being empty or not, it always returns whether the selection
is non_empty. See gimp_drawable_mask_intersect()
for a boolean
return value which is more useful in most cases.
gimp_drawable_mask_intersect ()
gboolean gimp_drawable_mask_intersect (gint32 drawable_ID
,gint *x
,gint *y
,gint *width
,gint *height
);
Find the bounding box of the current selection in relation to the specified drawable.
This procedure returns whether there is an intersection between the
drawable and the selection. Unlike gimp_drawable_mask_bounds()
, the
intersection's bounds are returned as x, y, width, height.
If there is no selection this function returns TRUE and the returned
bounds are the extents of the whole drawable.
Parameters
drawable_ID |
The drawable. |
|
x |
x coordinate of the upper left corner of the intersection. |
|
y |
y coordinate of the upper left corner of the intersection. |
|
width |
width of the intersection. |
|
height |
height of the intersection. |
Since: 2.2
gimp_drawable_get_image ()
gint32
gimp_drawable_get_image (gint32 drawable_ID
);
gimp_drawable_get_image
is deprecated and should not be used in newly-written code.
Use gimp_item_get_image()
instead.
gimp_drawable_set_image ()
gboolean gimp_drawable_set_image (gint32 drawable_ID
,gint32 image_ID
);
gimp_drawable_set_image
is deprecated and should not be used in newly-written code.
There is no replacement for this procedure.
gimp_drawable_has_alpha ()
gboolean
gimp_drawable_has_alpha (gint32 drawable_ID
);
Returns TRUE 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 }.
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 as if had an alpha channel. 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.
gimp_drawable_type ()
GimpImageType
gimp_drawable_type (gint32 drawable_ID
);
Returns the drawable's type.
This procedure returns the drawable's type.
gimp_drawable_is_rgb ()
gboolean
gimp_drawable_is_rgb (gint32 drawable_ID
);
Returns whether the drawable is an RGB type.
This procedure returns TRUE if the specified drawable is of type { RGB, RGBA }.
gimp_drawable_is_gray ()
gboolean
gimp_drawable_is_gray (gint32 drawable_ID
);
Returns whether the drawable is a grayscale type.
This procedure returns TRUE if the specified drawable is of type { Gray, GrayA }.
gimp_drawable_is_indexed ()
gboolean
gimp_drawable_is_indexed (gint32 drawable_ID
);
Returns whether the drawable is an indexed type.
This procedure returns TRUE if the specified drawable is of type { Indexed, IndexedA }.
gimp_drawable_bpp ()
gint
gimp_drawable_bpp (gint32 drawable_ID
);
Returns the bytes per pixel.
This procedure returns the number of bytes per pixel, which
corresponds to the number of components unless
gimp_plugin_enable_precision()
was called.
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.
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.
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.
gimp_drawable_is_channel ()
gboolean
gimp_drawable_is_channel (gint32 drawable_ID
);
gimp_drawable_is_channel
is deprecated and should not be used in newly-written code.
Use gimp_item_is_channel()
instead.
gimp_drawable_is_layer ()
gboolean
gimp_drawable_is_layer (gint32 drawable_ID
);
gimp_drawable_is_layer
is deprecated and should not be used in newly-written code.
Use gimp_item_is_layer()
instead.
gimp_drawable_is_layer_mask ()
gboolean
gimp_drawable_is_layer_mask (gint32 drawable_ID
);
gimp_drawable_is_layer_mask
is deprecated and should not be used in newly-written code.
Use gimp_item_is_layer_mask()
instead.
gimp_drawable_is_text_layer ()
gboolean
gimp_drawable_is_text_layer (gint32 drawable_ID
);
gimp_drawable_is_text_layer
is deprecated and should not be used in newly-written code.
Use gimp_item_is_text_layer()
instead.
Since: 2.6
gimp_drawable_offset ()
gboolean gimp_drawable_offset (gint32 drawable_ID
,gboolean wrap_around
,GimpOffsetType fill_type
,gint offset_x
,gint offset_y
);
Offset the drawable by the specified amounts in the X and Y directions
This procedure offsets the specified drawable by the amounts specified by 'offset_x' and 'offset_y'. If 'wrap_around' is set to TRUE, then portions of the drawable which are offset out of bounds are wrapped around. Alternatively, the undefined regions of the drawable can be filled with transparency or the background color, as specified by the 'fill-type' parameter.
gimp_drawable_foreground_extract ()
gboolean gimp_drawable_foreground_extract (gint32 drawable_ID
,GimpForegroundExtractMode mode
,gint32 mask_ID
);
Extract the foreground of a drawable using a given trimap.
Image Segmentation by Uniform Color Clustering, see https://www.inf.fu-berlin.de/inst/pubs/tr-b-05-07.pdf
Since: 2.4
gimp_drawable_parasite_find ()
GimpParasite * gimp_drawable_parasite_find (gint32 drawable_ID
,const gchar *name
);
gimp_drawable_parasite_find
is deprecated and should not be used in newly-written code.
Use gimp_item_get_parasite()
instead.
gimp_drawable_parasite_list ()
gboolean gimp_drawable_parasite_list (gint32 drawable_ID
,gint *num_parasites
,gchar ***parasites
);
gimp_drawable_parasite_list
is deprecated and should not be used in newly-written code.
Use gimp_item_get_parasite_list()
instead.
gimp_drawable_parasite_attach ()
gboolean gimp_drawable_parasite_attach (gint32 drawable_ID
,const GimpParasite *parasite
);
gimp_drawable_parasite_attach
is deprecated and should not be used in newly-written code.
Use gimp_item_attach_parasite()
instead.
gimp_drawable_parasite_detach ()
gboolean gimp_drawable_parasite_detach (gint32 drawable_ID
,const gchar *name
);
gimp_drawable_parasite_detach
is deprecated and should not be used in newly-written code.
Use gimp_item_detach_parasite()
instead.
gimp_drawable_attach_new_parasite ()
gboolean gimp_drawable_attach_new_parasite (gint32 drawable_ID
,const gchar *name
,gint flags
,gint size
,gconstpointer data
);
gimp_drawable_attach_new_parasite
is deprecated and should not be used in newly-written code.
use gimp_item_attach_parasite()
instead.
Convenience function that creates a parasite and attaches it to GIMP.
Parameters
drawable_ID |
the ID of the GimpDrawable to attach the GimpParasite to. |
|
name |
the name of the GimpParasite to create and attach. |
|
flags |
the flags set on the GimpParasite. |
|
size |
the size of the parasite data in bytes. |
|
data |
a pointer to the data attached with the GimpParasite. |
Returns
TRUE on successful creation and attachment of the new parasite.
See Also: gimp_drawable_parasite_attach()
Types and Values
GimpDrawable
typedef struct { gint32 drawable_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 */ } GimpDrawable;