## gimpedit

gimpedit — Edit menu functions (cut, copy, paste, clear, etc.)

## Synopsis

    gboolean            gimp_edit_cut                       (gint32 drawable_ID);
    gboolean            gimp_edit_copy                      (gint32 drawable_ID);
    gboolean            gimp_edit_copy_visible              (gint32 image_ID);
    gint32              gimp_edit_paste                     (gint32 drawable_ID,
                                                             gboolean paste_into);
    gint32              gimp_edit_paste_as_new              (void);
    gchar*              gimp_edit_named_cut                 (gint32 drawable_ID,
                                                             const gchar *buffer_name);
    gchar*              gimp_edit_named_copy                (gint32 drawable_ID,
                                                             const gchar *buffer_name);
    gchar*              gimp_edit_named_copy_visible        (gint32 image_ID,
                                                             const gchar *buffer_name);
    gint32              gimp_edit_named_paste               (gint32 drawable_ID,
                                                             const gchar *buffer_name,
                                                             gboolean paste_into);
    gint32              gimp_edit_named_paste_as_new        (const gchar *buffer_name);
    gboolean            gimp_edit_clear                     (gint32 drawable_ID);
    gboolean            gimp_edit_fill                      (gint32 drawable_ID,
                                                             GimpFillType fill_type);
    gboolean            gimp_edit_bucket_fill               (gint32 drawable_ID,
                                                             GimpBucketFillMode fill_mode,
                                                             GimpLayerModeEffects paint_mode,
                                                             gdouble opacity,
                                                             gdouble threshold,
                                                             gboolean sample_merged,
                                                             gdouble x,
                                                             gdouble y);
    gboolean            gimp_edit_blend                     (gint32 drawable_ID,
                                                             GimpBlendMode blend_mode,
                                                             GimpLayerModeEffects paint_mode,
                                                             GimpGradientType gradient_type,
                                                             gdouble opacity,
                                                             gdouble offset,
                                                             GimpRepeatMode repeat,
                                                             gboolean reverse,
                                                             gboolean supersample,
                                                             gint max_depth,
                                                             gdouble threshold,
                                                             gboolean dither,
                                                             gdouble x1,
                                                             gdouble y1,
                                                             gdouble x2,
                                                             gdouble y2);
    gboolean            gimp_edit_stroke                    (gint32 drawable_ID);
    gboolean            gimp_edit_stroke_vectors            (gint32 drawable_ID,
                                                             gint32 vectors_ID);

## Description

Edit menu functions (cut, copy, paste, clear, etc.)

## Details

### gimp_edit_cut ()

    gboolean            gimp_edit_cut                       (gint32 drawable_ID);

Cut from the specified drawable.

If there is a selection in the image, then the area specified by the selection is cut from the specified drawable and placed in an internal GIMP edit buffer. It can subsequently be retrieved using the `gimp_edit_paste()` command. If there is no selection, then the specified drawable will be removed and its contents stored in the internal GIMP edit buffer. This procedure will fail if the selected area lies completely outside the bounds of the current drawable and there is nothing to copy from.

`drawable_ID` : | The drawable to cut from.
Returns : | TRUE if the cut was successful, FALSE if there was nothing to copy from.

### gimp_edit_copy ()

    gboolean            gimp_edit_copy                      (gint32 drawable_ID);

Copy from the specified drawable.

If there is a selection in the image, then the area specified by the selection is copied from the specified drawable and placed in an internal GIMP edit buffer. It can subsequently be retrieved using the `gimp_edit_paste()` command. If there is no selection, then the specified drawable's contents will be stored in the internal GIMP edit buffer. This procedure will fail if the selected area lies completely outside the bounds of the current drawable and there is nothing to copy from.

`drawable_ID` : | The drawable to copy from.
Returns : | TRUE if the cut was successful, FALSE if there was nothing to copy from.

### gimp_edit_copy_visible ()

    gboolean            gimp_edit_copy_visible              (gint32 image_ID);

Copy from the projection.

If there is a selection in the image, then the area specified by the selection is copied from the projection and placed in an internal GIMP edit buffer. It can subsequently be retrieved using the `gimp_edit_paste()` command. If there is no selection, then the projection's contents will be stored in the internal GIMP edit buffer.

`image_ID` : | The image to copy from.
Returns : | TRUE if the copy was successful.

Since GIMP 2.2

### gimp_edit_paste ()

    gint32              gimp_edit_paste                     (gint32 drawable_ID,
                                                             gboolean paste_into);

Paste buffer to the specified drawable.

This procedure pastes a copy of the internal GIMP edit buffer to the specified drawable. The GIMP edit buffer will be empty unless a call was previously made to either `gimp_edit_cut()` or `gimp_edit_copy()`. The \"paste_into\" option specifies whether to clear the current image selection, or to paste the buffer \"behind\" the selection. This allows the selection to act as a mask for the pasted buffer. Anywhere that the selection mask is non-zero, the pasted buffer will show through. The pasted buffer will be a new layer in the image which is designated as the image floating selection. If the image has a floating selection at the time of pasting, the old floating selection will be anchored to it's drawable before the new floating selection is added. This procedure returns the new floating layer. The resulting floating selection will already be attached to the specified drawable, and a subsequent call to floating_sel_attach is not needed.

`drawable_ID` : | The drawable to paste to.
`paste_into` : | Clear selection, or paste behind it?
Returns : | The new floating selection.

### gimp_edit_paste_as_new ()

    gint32              gimp_edit_paste_as_new              (void);

Paste buffer to a new image.

This procedure pastes a copy of the internal GIMP edit buffer to a new image. The GIMP edit buffer will be empty unless a call was previously made to either `gimp_edit_cut()` or `gimp_edit_copy()`. This procedure returns the new image or -1 if the edit buffer was empty.

Returns : | The new image.

Since GIMP 2.4

### gimp_edit_named_cut ()

    gchar*              gimp_edit_named_cut                 (gint32 drawable_ID,
                                                             const gchar *buffer_name);

Cut into a named buffer.

This procedure works like `gimp_edit_cut()`, but additionally stores the cut buffer into a named buffer that will stay available for later pasting, regardless of any intermediate copy or cut operations.

`drawable_ID` : | The drawable to cut from.
`buffer_name` : | The name of the buffer to create.
Returns : | The real name given to the buffer, or NULL if the cut failed.

Since GIMP 2.4

### gimp_edit_named_copy ()

    gchar*              gimp_edit_named_copy                (gint32 drawable_ID,
                                                             const gchar *buffer_name);

Copy into a named buffer.

This procedure works like `gimp_edit_copy()`, but additionally stores the copied buffer into a named buffer that will stay available for later pasting, regardless of any intermediate copy or cut operations.

`drawable_ID` : | The drawable to copy from.
`buffer_name` : | The name of the buffer to create.
Returns : | The real name given to the buffer, or NULL if the copy failed.

Since GIMP 2.4

### gimp_edit_named_copy_visible ()

    gchar*              gimp_edit_named_copy_visible        (gint32 image_ID,
                                                             const gchar *buffer_name);

Copy from the projection into a named buffer.

This procedure works like `gimp_edit_copy_visible()`, but additionally stores the copied buffer into a named buffer that will stay available for later pasting, regardless of any intermediate copy or cut operations.

`image_ID` : | The image to copy from.
`buffer_name` : | The name of the buffer to create.
Returns : | The real name given to the buffer, or NULL if the copy failed.

Since GIMP 2.4

### gimp_edit_named_paste ()

    gint32              gimp_edit_named_paste               (gint32 drawable_ID,
                                                             const gchar *buffer_name,
                                                             gboolean paste_into);

Paste named buffer to the specified drawable.

This procedure works like `gimp_edit_paste()` but pastes a named buffer instead of the global buffer.

`drawable_ID` : | The drawable to paste to.
`buffer_name` : | The name of the buffer to paste.
`paste_into` : | Clear selection, or paste behind it?
Returns : | The new floating selection.

Since GIMP 2.4

### gimp_edit_named_paste_as_new ()

    gint32              gimp_edit_named_paste_as_new        (const gchar *buffer_name);

Paste named buffer to a new image.

This procedure works like `gimp_edit_paste_as_new()` but pastes a named buffer instead of the global buffer.

`buffer_name` : | The name of the buffer to paste.
Returns : | The new image.

Since GIMP 2.4

### gimp_edit_clear ()

    gboolean            gimp_edit_clear                     (gint32 drawable_ID);

Clear selected area of drawable.

This procedure clears the specified drawable. If the drawable has an alpha channel, the cleared pixels will become transparent. If the drawable does not have an alpha channel, cleared pixels will be set to the background color. This procedure only affects regions within a selection if there is a selection active.

`drawable_ID` : | The drawable to clear from.
Returns : | TRUE on success.

### gimp_edit_fill ()

    gboolean            gimp_edit_fill                      (gint32 drawable_ID,
                                                             GimpFillType fill_type);

Fill selected area of drawable.

This procedure fills the specified 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. Other fill modes should not be used. This procedure only affects regions within a selection if there is a selection active. If you want to fill the whole drawable, regardless of the selection, use `gimp_drawable_fill()`.

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

### gimp_edit_bucket_fill ()

    gboolean            gimp_edit_bucket_fill               (gint32 drawable_ID,
                                                             GimpBucketFillMode fill_mode,
                                                             GimpLayerModeEffects paint_mode,
                                                             gdouble opacity,
                                                             gdouble threshold,
                                                             gboolean sample_merged,
                                                             gdouble x,
                                                             gdouble y);

Fill the area specified either by the current selection if there is one, or by a seed fill starting at the specified coordinates.

This tool requires information on the paint application mode, and the fill mode, which can either be in the foreground color, or in the currently active pattern. If there is no selection, a seed fill is executed at the specified coordinates and extends outward in keeping with the threshold parameter. If there is a selection in the target image, the threshold, sample merged, x, and y arguments are unused. If the sample_merged parameter is TRUE, the data of the composite image will be used instead of that for the specified drawable. This is equivalent to sampling for colors after merging all visible layers. In the case of merged sampling, the x and y coordinates are relative to the image's origin; otherwise, they are relative to the drawable's origin.

`drawable_ID` : | The affected drawable.
`fill_mode` : | The type of fill.
`paint_mode` : | The paint application mode.
`opacity` : | The opacity of the final bucket fill.
`threshold` : | The threshold determines how extensive the seed fill will be. It's value is specified in terms of intensity levels. This parameter is only valid when there is no selection in the specified image.
`sample_merged` : | Use the composite image, not the drawable.
`x` : | The x coordinate of this bucket fill's application. This parameter is only valid when there is no selection in the specified image.
`y` : | The y coordinate of this bucket fill's application. This parameter is only valid when there is no selection in the specified image.
Returns : | TRUE on success.

### gimp_edit_blend ()

    gboolean            gimp_edit_blend                     (gint32 drawable_ID,
                                                             GimpBlendMode blend_mode,
                                                             GimpLayerModeEffects paint_mode,
                                                             GimpGradientType gradient_type,
                                                             gdouble opacity,
                                                             gdouble offset,
                                                             GimpRepeatMode repeat,
                                                             gboolean reverse,
                                                             gboolean supersample,
                                                             gint max_depth,
                                                             gdouble threshold,
                                                             gboolean dither,
                                                             gdouble x1,
                                                             gdouble y1,
                                                             gdouble x2,
                                                             gdouble y2);

Blend between the starting and ending coordinates with the specified blend mode and gradient type.

This tool requires information on the paint application mode, the blend mode, and the gradient type. It creates the specified variety of blend using the starting and ending coordinates as defined for each gradient type.

`drawable_ID` : | The affected drawable.
`blend_mode` : | The type of blend.
`paint_mode` : | The paint application mode.
`gradient_type` : | The type of gradient.
`opacity` : | The opacity of the final blend.
`offset` : | Offset relates to the starting and ending coordinates specified for the blend. This parameter is mode dependent.
`repeat` : | Repeat mode.
`reverse` : | Use the reverse gradient.
`supersample` : | Do adaptive supersampling.
`max_depth` : | Maximum recursion levels for supersampling.
`threshold` : | Supersampling threshold.
`dither` : | Use dithering to reduce banding.
`x1` : | The x coordinate of this blend's starting point.
`y1` : | The y coordinate of this blend's starting point.
`x2` : | The x coordinate of this blend's ending point.
`y2` : | The y coordinate of this blend's ending point.
Returns : | TRUE on success.

### gimp_edit_stroke ()

    gboolean            gimp_edit_stroke                    (gint32 drawable_ID);

Stroke the current selection

This procedure strokes the current selection, painting along the selection boundary with the active brush and foreground color. The paint is applied to the specified drawable regardless of the active selection.

`drawable_ID` : | The drawable to stroke to.
Returns : | TRUE on success.

### gimp_edit_stroke_vectors ()

    gboolean            gimp_edit_stroke_vectors            (gint32 drawable_ID,
                                                             gint32 vectors_ID);

Stroke the specified vectors object

This procedure strokes the specified vectors object, painting along the path with the active brush and foreground color.

`drawable_ID` : | The drawable to stroke to.
`vectors_ID` : | The vectors object.
Returns : | TRUE on success.

Since GIMP 2.4