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

# gimplayer

## Name

gimplayer --

## Synopsis

    gint32      gimp_layer_new                  (gint32 image_ID,
                                                 gchar *name,
                                                 gint width,
                                                 gint height,
                                                 GimpImageType type,
                                                 gdouble opacity,
                                                 GimpLayerModeEffects mode);
    gint32      gimp_layer_copy                 (gint32 layer_ID);
    gint32      gimp_layer_create_mask          (gint32 layer_ID,
                                                 GimpAddMaskType mask_type);
    gboolean    gimp_layer_scale                (gint32 layer_ID,
                                                 gint new_width,
                                                 gint new_height,
                                                 gboolean local_origin);
    gboolean    gimp_layer_resize               (gint32 layer_ID,
                                                 gint new_width,
                                                 gint new_height,
                                                 gint offx,
                                                 gint offy);
    gboolean    gimp_layer_delete               (gint32 layer_ID);
    gboolean    gimp_layer_translate            (gint32 layer_ID,
                                                 gint offx,
                                                 gint offy);
    gboolean    gimp_layer_add_alpha            (gint32 layer_ID);
    gboolean    gimp_layer_set_offsets          (gint32 layer_ID,
                                                 gint offx,
                                                 gint offy);
    gint32      gimp_layer_mask                 (gint32 layer_ID);
    gboolean    gimp_layer_is_floating_sel      (gint32 layer_ID);
    gchar*      gimp_layer_get_name             (gint32 layer_ID);
    gboolean    gimp_layer_set_name             (gint32 layer_ID,
                                                 gchar *name);
    gboolean    gimp_layer_get_visible          (gint32 layer_ID);
    gboolean    gimp_layer_set_visible          (gint32 layer_ID,
                                                 gboolean visible);
    gboolean    gimp_layer_get_preserve_trans   (gint32 layer_ID);
    gboolean    gimp_layer_set_preserve_trans   (gint32 layer_ID,
                                                 gboolean preserve_trans);
    gboolean    gimp_layer_get_apply_mask       (gint32 layer_ID);
    gboolean    gimp_layer_set_apply_mask       (gint32 layer_ID,
                                                 gboolean apply_mask);
    gboolean    gimp_layer_get_show_mask        (gint32 layer_ID);
    gboolean    gimp_layer_set_show_mask        (gint32 layer_ID,
                                                 gboolean show_mask);
    gboolean    gimp_layer_get_edit_mask        (gint32 layer_ID);
    gboolean    gimp_layer_set_edit_mask        (gint32 layer_ID,
                                                 gboolean edit_mask);
    gdouble     gimp_layer_get_opacity          (gint32 layer_ID);
    gboolean    gimp_layer_set_opacity          (gint32 layer_ID,
                                                 gdouble opacity);
    GimpLayerModeEffects gimp_layer_get_mode    (gint32 layer_ID);
    gboolean    gimp_layer_set_mode             (gint32 layer_ID,
                                                 GimpLayerModeEffects mode);
    gboolean    gimp_layer_get_linked           (gint32 layer_ID);
    gboolean    gimp_layer_set_linked           (gint32 layer_ID,
                                                 gboolean linked);
    gint        gimp_layer_get_tattoo           (gint32 layer_ID);
    gboolean    gimp_layer_set_tattoo           (gint32 layer_ID,
                                                 gint tattoo);
    #define     gimp_layer_get_mask_id
    #define     gimp_layer_get_image_id
    #define     gimp_layer_is_floating_selection
    #define     gimp_layer_get_preserve_transparency
    #define     gimp_layer_set_preserve_transparency

## Description

## Details

### gimp_layer_new ()

    gint32      gimp_layer_new                  (gint32 image_ID,
                                                 gchar *name,
                                                 gint width,
                                                 gint height,
                                                 GimpImageType type,
                                                 gdouble opacity,
                                                 GimpLayerModeEffects mode);

Create a new layer.

This procedure creates a new layer with the specified width, height, and type. Name, opacity, and mode are also supplied parameters. The new layer still needs to be added to the image, as this is not automatic. Add the new layer with the 'gimp_image_add_layer' command. Other attributes such as layer mask modes, and offsets should be set with explicit procedure calls.

`image_ID` : | The image to which to add the layer.
`name` : | The layer name.
`width` : | The layer width.
`height` : | The layer height.
`type` : | The layer type.
`opacity` : | The layer opacity.
`mode` : | The layer combination mode.
Returns : | The newly created layer.

### gimp_layer_copy ()

    gint32      gimp_layer_copy                 (gint32 layer_ID);

Copy a layer.

This procedure copies the specified layer and returns the copy. The newly copied layer is for use within the original layer's image. It should not be subsequently added to any other image. If you create a copy of the background layer, remember to add an alpha channel before you add the new layer to the image.

`layer_ID` : | The layer to copy.
Returns : | The newly copied layer.

### gimp_layer_create_mask ()

    gint32      gimp_layer_create_mask          (gint32 layer_ID,
                                                 GimpAddMaskType mask_type);

Create a layer mask for the specified specified layer.

This procedure creates a layer mask for the specified layer. Layer masks serve as an additional alpha channel for a layer. Three different types of masks are allowed initially: completely white masks (which will leave the layer fully visible), completely black masks (which will give the layer complete transparency, and the layer's already existing alpha channel (which will leave the layer fully visible, but which may be more useful than a white mask). The layer mask still needs to be added to the layer. This can be done with a call to 'gimage_add_layer_mask'.

`layer_ID` : | The layer to which to add the mask.
`mask_type` : | The type of mask.
Returns : | The newly created mask.

### gimp_layer_scale ()

    gboolean    gimp_layer_scale                (gint32 layer_ID,
                                                 gint new_width,
                                                 gint new_height,
                                                 gboolean local_origin);

Scale the layer to the specified extents.

This procedure scales the layer so that it's new width and height are equal to the supplied parameters. The \"local_origin\" parameter specifies whether to scale from the center of the layer, or from the image origin. This operation only works if the layer has been added to an image.

`layer_ID` : | The layer.
`new_width` : | New layer width.
`new_height` : | New layer height.
`local_origin` : | Use a local origin (as opposed to the image origin).
Returns : | TRUE on success.

### gimp_layer_resize ()

    gboolean    gimp_layer_resize               (gint32 layer_ID,
                                                 gint new_width,
                                                 gint new_height,
                                                 gint offx,
                                                 gint offy);

Resize the layer to the specified extents.

This procedure resizes the layer so that it's new width and height are equal to the supplied parameters. Offsets are also provided which describe the position of the previous layer's content. This operation only works if the layer has been added to an image.

`layer_ID` : | The layer.
`new_width` : | New layer width.
`new_height` : | New layer height.
`offx` : | x offset between upper left corner of old and new layers: (new - old).
`offy` : | y offset between upper left corner of old and new layers: (new - old).
Returns : | TRUE on success.

### gimp_layer_delete ()

    gboolean    gimp_layer_delete               (gint32 layer_ID);

Delete a layer.

This procedure deletes the specified layer. This does not need to be done if a gimage containing this layer was already deleted.

`layer_ID` : | The layer to delete.
Returns : | TRUE on success.

### gimp_layer_translate ()

    gboolean    gimp_layer_translate            (gint32 layer_ID,
                                                 gint offx,
                                                 gint offy);

Translate the layer by the specified offsets.

This procedure translates the layer by the amounts specified in the x and y arguments. These can be negative, and are considered offsets from the current position. This command only works if the layer has been added to an image. All additional layers contained in the image which have the linked flag set to TRUE w ill also be translated by the specified offsets.

`layer_ID` : | The layer.
`offx` : | Offset in x direction.
`offy` : | Offset in y direction.
Returns : | TRUE on success.

### gimp_layer_add_alpha ()

    gboolean    gimp_layer_add_alpha            (gint32 layer_ID);

Add an alpha channel to the layer if it doesn't already have one.

This procedure adds an additional component to the specified layer if it does not already possess an alpha channel. An alpha channel makes it possible to move a layer from the bottom of the layer stack and to clear and erase to transparency, instead of the background color. This transforms images of type RGB to RGBA, GRAY to GRAYA, and INDEXED to INDEXEDA.

`layer_ID` : | The layer.
Returns : | TRUE on success.

### gimp_layer_set_offsets ()

    gboolean    gimp_layer_set_offsets          (gint32 layer_ID,
                                                 gint offx,
                                                 gint offy);

Set the layer offsets.

This procedure sets the offsets for the specified layer. The offsets are relative to the image origin and can be any values. This operation is valid only on layers which have been added to an image.

`layer_ID` : | The layer.
`offx` : | Offset in x direction.
`offy` : | Offset in y direction.
Returns : | TRUE on success.

### gimp_layer_mask ()

    gint32      gimp_layer_mask                 (gint32 layer_ID);

Get the specified layer's mask if it exists.

This procedure returns the specified layer's mask, or -1 if none exists.

`layer_ID` : | The layer.
Returns : | The layer mask.

### gimp_layer_is_floating_sel ()

    gboolean    gimp_layer_is_floating_sel      (gint32 layer_ID);

Is the specified layer a floating selection?

This procedure returns whether the layer is a floating selection. Floating selections are special cases of layers which are attached to a specific drawable.

`layer_ID` : | The layer.
Returns : | Non-zero if the layer is a floating selection.

### gimp_layer_get_name ()

    gchar*      gimp_layer_get_name             (gint32 layer_ID);

Get the name of the specified layer.

This procedure returns the specified layer's name.

`layer_ID` : | The layer.
Returns : | The layer name.

### gimp_layer_set_name ()

    gboolean    gimp_layer_set_name             (gint32 layer_ID,
                                                 gchar *name);

Set the name of the specified layer.

This procedure sets the specified layer's name.

`layer_ID` : | The layer.
`name` : | The new layer name.
Returns : | TRUE on success.

### gimp_layer_get_visible ()

    gboolean    gimp_layer_get_visible          (gint32 layer_ID);

Get the visibility of the specified layer.

This procedure returns the specified layer's visibility.

`layer_ID` : | The layer.
Returns : | The layer visibility.

### gimp_layer_set_visible ()

    gboolean    gimp_layer_set_visible          (gint32 layer_ID,
                                                 gboolean visible);

Set the visibility of the specified layer.

This procedure sets the specified layer's visibility.

`layer_ID` : | The layer.
`visible` : | The new layer visibility.
Returns : | TRUE on success.

### gimp_layer_get_preserve_trans ()

    gboolean    gimp_layer_get_preserve_trans   (gint32 layer_ID);

Get the preserve transperancy setting of the specified layer.

This procedure returns the specified layer's preserve transperancy setting.

`layer_ID` : | The layer.
Returns : | The layer's preserve transperancy setting.

### gimp_layer_set_preserve_trans ()

    gboolean    gimp_layer_set_preserve_trans   (gint32 layer_ID,
                                                 gboolean preserve_trans);

Set the preserve transperancy setting of the specified layer.

This procedure sets the specified layer's preserve transperancy setting.

`layer_ID` : | The layer.
`preserve_trans` : | The new layer's preserve transperancy setting.
Returns : | TRUE on success.

### gimp_layer_get_apply_mask ()

    gboolean    gimp_layer_get_apply_mask       (gint32 layer_ID);

Get the apply mask setting of the specified layer.

This procedure returns the specified layer's apply mask setting. If the value is non-zero, then the layer mask for this layer is currently being composited with the layer's alpha channel.

`layer_ID` : | The layer.
Returns : | The layer's apply mask setting.

### gimp_layer_set_apply_mask ()

    gboolean    gimp_layer_set_apply_mask       (gint32 layer_ID,
                                                 gboolean apply_mask);

Set the apply mask setting of the specified layer.

This procedure sets the specified layer's apply mask setting. This controls whether the layer's mask is currently affecting the alpha channel. If there is no layer mask, this function will return an error.

`layer_ID` : | The layer.
`apply_mask` : | The new layer's apply mask setting.
Returns : | TRUE on success.

### gimp_layer_get_show_mask ()

    gboolean    gimp_layer_get_show_mask        (gint32 layer_ID);

Get the show mask setting of the specified layer.

This procedure returns the specified layer's show mask setting. If the value is non-zero, then the layer mask for this layer is currently being shown instead of the layer.

`layer_ID` : | The layer.
Returns : | The layer's show mask setting.

### gimp_layer_set_show_mask ()

    gboolean    gimp_layer_set_show_mask        (gint32 layer_ID,
                                                 gboolean show_mask);

Set the show mask setting of the specified layer.

This procedure sets the specified layer's show mask setting. This controls whether the layer or it's mask is visible. Non-zero values indicate that the mask should be visible. If the layer has no mask, then this function returns an error.

`layer_ID` : | The layer.
`show_mask` : | The new layer's show mask setting.
Returns : | TRUE on success.

### gimp_layer_get_edit_mask ()

    gboolean    gimp_layer_get_edit_mask        (gint32 layer_ID);

Get the show mask setting of the specified layer.

This procedure returns the specified layer's show mask setting. If the value is non-zero, then the layer mask for this layer is currently active, and not the layer.

`layer_ID` : | The layer.
Returns : | The layer's show mask setting.

### gimp_layer_set_edit_mask ()

    gboolean    gimp_layer_set_edit_mask        (gint32 layer_ID,
                                                 gboolean edit_mask);

Set the show mask setting of the specified layer.

This procedure sets the specified layer's show mask setting. This controls whether the layer or it's mask is currently active for editing. If the specified layer has no layer mask, then this procedure will return an error.

`layer_ID` : | The layer.
`edit_mask` : | The new layer's show mask setting.
Returns : | TRUE on success.

### gimp_layer_get_opacity ()

    gdouble     gimp_layer_get_opacity          (gint32 layer_ID);

Get the opacity of the specified layer.

This procedure returns the specified layer's opacity.

`layer_ID` : | The layer.
Returns : | The layer opacity.

### gimp_layer_set_opacity ()

    gboolean    gimp_layer_set_opacity          (gint32 layer_ID,
                                                 gdouble opacity);

Set the opacity of the specified layer.

This procedure sets the specified layer's opacity.

`layer_ID` : | The layer.
`opacity` : | The new layer opacity.
Returns : | TRUE on success.

### gimp_layer_get_mode ()

    GimpLayerModeEffects gimp_layer_get_mode    (gint32 layer_ID);

Get the combination mode of the specified layer.

This procedure returns the specified layer's combination mode.

`layer_ID` : | The layer.
Returns : | The layer combination mode.

### gimp_layer_set_mode ()

    gboolean    gimp_layer_set_mode             (gint32 layer_ID,
                                                 GimpLayerModeEffects mode);

Set the combination mode of the specified layer.

This procedure sets the specified layer's combination mode.

`layer_ID` : | The layer.
`mode` : | The new layer combination mode.
Returns : | TRUE on success.

### gimp_layer_get_linked ()

    gboolean    gimp_layer_get_linked           (gint32 layer_ID);

Get the linked state of the specified layer.

This procedure returns the specified layer's linked state.

`layer_ID` : | The layer.
Returns : | The layer linked state (for moves).

### gimp_layer_set_linked ()

    gboolean    gimp_layer_set_linked           (gint32 layer_ID,
                                                 gboolean linked);

Set the linked state of the specified layer.

This procedure sets the specified layer's linked state.

`layer_ID` : | The layer.
`linked` : | The new layer linked state.
Returns : | TRUE on success.

### gimp_layer_get_tattoo ()

    gint        gimp_layer_get_tattoo           (gint32 layer_ID);

Get the tattoo of the specified layer.

This procedure returns the specified layer's tattoo. A tattoo is a unique and permanent identifier attached to a layer that can be used to uniquely identify a layer within an image even between sessions

`layer_ID` : | The layer.
Returns : | The layer tattoo.

### gimp_layer_set_tattoo ()

    gboolean    gimp_layer_set_tattoo           (gint32 layer_ID,
                                                 gint tattoo);

Set the tattoo of the specified layer.

This procedure sets the specified layer's tattoo. A tattoo is a unique and permanent identifier attached to a layer that can be used to uniquely identify a layer within an image even between sessions

`layer_ID` : | The layer.
`tattoo` : | The new layer tattoo.
Returns : | TRUE on success.

### gimp_layer_get_mask_id

    #define gimp_layer_get_mask_id               gimp_layer_mask

### gimp_layer_get_image_id

    #define gimp_layer_get_image_id              gimp_drawable_image

### gimp_layer_is_floating_selection

    #define gimp_layer_is_floating_selection     gimp_layer_is_floating_sel

### gimp_layer_get_preserve_transparency

    #define gimp_layer_get_preserve_transparency gimp_layer_get_preserve_trans

### gimp_layer_set_preserve_transparency

    #define gimp_layer_set_preserve_transparency gimp_layer_set_preserve_trans

<<< Previous Page | Home | Up | Next Page >>>
gimpimage | gimpmatrix