2000-06-01 20:20:13 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
2003-07-03 08:47:26 +08:00
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
2000-06-01 20:20:13 +08:00
|
|
|
*
|
|
|
|
* gimpedit_pdb.c
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This library is free software: you can redistribute it and/or
|
2000-06-01 20:20:13 +08:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2009-01-18 06:28:01 +08:00
|
|
|
* version 3 of the License, or (at your option) any later version.
|
2000-06-01 20:20:13 +08:00
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2009-01-18 06:28:01 +08:00
|
|
|
* License along with this library. If not, see
|
2018-07-12 05:27:07 +08:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
2000-06-01 20:20:13 +08:00
|
|
|
*/
|
|
|
|
|
2007-01-09 18:52:47 +08:00
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl */
|
2000-06-01 20:20:13 +08:00
|
|
|
|
2002-05-14 07:30:23 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2022-03-28 21:13:17 +08:00
|
|
|
#include "stamp-pdbgen.h"
|
|
|
|
|
2000-06-01 20:20:13 +08:00
|
|
|
#include "gimp.h"
|
|
|
|
|
2010-07-07 17:43:10 +08:00
|
|
|
|
|
|
|
/**
|
2019-07-31 16:04:43 +08:00
|
|
|
* SECTION: gimpedit
|
2010-07-07 17:43:10 +08:00
|
|
|
* @title: gimpedit
|
|
|
|
* @short_description: Edit menu functions (cut, copy, paste, clear, etc.)
|
|
|
|
*
|
|
|
|
* Edit menu functions (cut, copy, paste, clear, etc.)
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
|
|
|
* gimp_edit_cut:
|
2020-05-26 22:15:15 +08:00
|
|
|
* @num_drawables: The number of drawables.
|
|
|
|
* @drawables: (array length=num_drawables) (element-type GimpItem): The drawables to cut from.
|
2019-08-13 19:59:33 +08:00
|
|
|
*
|
2020-05-26 22:15:15 +08:00
|
|
|
* Cut from the specified drawables.
|
2019-08-13 19:59:33 +08:00
|
|
|
*
|
|
|
|
* If there is a selection in the image, then the area specified by the
|
2020-05-26 22:15:15 +08:00
|
|
|
* selection is cut from the specified drawables and placed in an
|
2019-08-13 19:59:33 +08:00
|
|
|
* internal GIMP edit buffer. It can subsequently be retrieved using
|
2020-05-26 22:15:15 +08:00
|
|
|
* the gimp_edit_paste() command. If there is no selection and only one
|
|
|
|
* specified drawable, 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 drawables and there is nothing to cut from.
|
2019-08-13 19:59:33 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE if the cut was successful, FALSE if there was nothing to copy from.
|
|
|
|
**/
|
|
|
|
gboolean
|
2020-05-26 22:15:15 +08:00
|
|
|
gimp_edit_cut (gint num_drawables,
|
|
|
|
const GimpItem **drawables)
|
2019-08-13 19:59:33 +08:00
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gboolean non_empty = FALSE;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2020-05-26 22:15:15 +08:00
|
|
|
G_TYPE_INT, num_drawables,
|
|
|
|
GIMP_TYPE_OBJECT_ARRAY, NULL,
|
2019-08-13 19:59:33 +08:00
|
|
|
G_TYPE_NONE);
|
2020-05-26 22:15:15 +08:00
|
|
|
gimp_value_set_object_array (gimp_value_array_index (args, 1), GIMP_TYPE_ITEM, (GObject **) drawables, num_drawables);
|
2019-08-13 19:59:33 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-edit-cut",
|
|
|
|
args);
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
non_empty = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
|
2019-08-13 19:59:33 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return non_empty;
|
|
|
|
}
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
|
|
|
* gimp_edit_copy:
|
2020-05-06 21:46:51 +08:00
|
|
|
* @num_drawables: The number of drawables to save.
|
|
|
|
* @drawables: (array length=num_drawables) (element-type GimpItem): Drawables to copy from.
|
2019-08-13 19:59:33 +08:00
|
|
|
*
|
2020-05-06 21:46:51 +08:00
|
|
|
* Copy from the specified drawables.
|
2019-08-13 19:59:33 +08:00
|
|
|
*
|
|
|
|
* If there is a selection in the image, then the area specified by the
|
2020-05-06 21:46:51 +08:00
|
|
|
* selection is copied from the specified drawables and placed in an
|
2019-08-13 19:59:33 +08:00
|
|
|
* internal GIMP edit buffer. It can subsequently be retrieved using
|
|
|
|
* the gimp_edit_paste() command. If there is no selection, then the
|
2020-05-06 21:46:51 +08:00
|
|
|
* specified drawables' contents will be stored in the internal GIMP
|
2019-08-13 19:59:33 +08:00
|
|
|
* edit buffer. This procedure will fail if the selected area lies
|
2020-05-06 21:46:51 +08:00
|
|
|
* completely outside the bounds of the current drawables and there is
|
|
|
|
* nothing to copy from. All the drawables must belong to the same
|
|
|
|
* image.
|
2019-08-13 19:59:33 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE if the cut was successful, FALSE if there was nothing to copy from.
|
|
|
|
**/
|
|
|
|
gboolean
|
2020-05-06 21:46:51 +08:00
|
|
|
gimp_edit_copy (gint num_drawables,
|
|
|
|
const GimpItem **drawables)
|
2019-08-13 19:59:33 +08:00
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gboolean non_empty = FALSE;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2020-05-06 21:46:51 +08:00
|
|
|
G_TYPE_INT, num_drawables,
|
|
|
|
GIMP_TYPE_OBJECT_ARRAY, NULL,
|
2019-08-13 19:59:33 +08:00
|
|
|
G_TYPE_NONE);
|
2020-05-06 21:46:51 +08:00
|
|
|
gimp_value_set_object_array (gimp_value_array_index (args, 1), GIMP_TYPE_ITEM, (GObject **) drawables, num_drawables);
|
2019-08-13 19:59:33 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-edit-copy",
|
|
|
|
args);
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
non_empty = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
|
2019-08-13 19:59:33 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return non_empty;
|
|
|
|
}
|
|
|
|
|
2004-12-12 22:01:08 +08:00
|
|
|
/**
|
|
|
|
* gimp_edit_copy_visible:
|
2019-08-11 20:20:05 +08:00
|
|
|
* @image: The image to copy from.
|
2004-12-12 22:01:08 +08:00
|
|
|
*
|
|
|
|
* 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
|
2006-06-14 16:32:08 +08:00
|
|
|
* gimp_edit_paste() command. If there is no selection, then the
|
2004-12-12 22:01:08 +08:00
|
|
|
* projection's contents will be stored in the internal GIMP edit
|
|
|
|
* buffer.
|
|
|
|
*
|
2008-07-15 06:52:14 +08:00
|
|
|
* Returns: TRUE if the copy was successful.
|
2004-12-12 22:01:08 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-12-12 22:01:08 +08:00
|
|
|
gboolean
|
2019-08-11 20:20:05 +08:00
|
|
|
gimp_edit_copy_visible (GimpImage *image)
|
2004-12-12 22:01:08 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-12-12 22:01:08 +08:00
|
|
|
gboolean non_empty = FALSE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_IMAGE, image,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-edit-copy-visible",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-12-12 22:01:08 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
non_empty = GIMP_VALUES_GET_BOOLEAN (return_vals, 1);
|
2004-12-12 22:01:08 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-12-12 22:01:08 +08:00
|
|
|
|
|
|
|
return non_empty;
|
|
|
|
}
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
|
|
|
* gimp_edit_paste:
|
2019-08-13 19:59:33 +08:00
|
|
|
* @drawable: The drawable to paste to.
|
|
|
|
* @paste_into: Clear selection, or paste behind it?
|
app, libgimp, pdb, plug-ins: allow pasting multiple full layers.
When a selection exists, we are copying then pasting the selection
contents. In particular, with multi-layer selection, it means pasting a
merged result of the selected layers (like a sample merged but limited
to selected layers).
Yet when no selection exists, with a single layer selected, a cut in
particular would remove the layer fully, then a paste would copy it
elsewhere (in the same image or even on a different image). This was
still working, but not with multiple layers. This is now fixed and we
can now copy/cut then paste several layers (without merge), which is
sometimes a very practical way to move layers (sometimes simpler than
drag'n drop, especially between images).
As a consequence, the PDB function gimp_edit_paste() now also returns an
array of layers (not a single layer).
2021-04-25 04:45:09 +08:00
|
|
|
* @num_layers: (out): The newly pasted layers.
|
2019-08-13 19:59:33 +08:00
|
|
|
*
|
|
|
|
* 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
|
app, libgimp, pdb, plug-ins: allow pasting multiple full layers.
When a selection exists, we are copying then pasting the selection
contents. In particular, with multi-layer selection, it means pasting a
merged result of the selected layers (like a sample merged but limited
to selected layers).
Yet when no selection exists, with a single layer selected, a cut in
particular would remove the layer fully, then a paste would copy it
elsewhere (in the same image or even on a different image). This was
still working, but not with multiple layers. This is now fixed and we
can now copy/cut then paste several layers (without merge), which is
sometimes a very practical way to move layers (sometimes simpler than
drag'n drop, especially between images).
As a consequence, the PDB function gimp_edit_paste() now also returns an
array of layers (not a single layer).
2021-04-25 04:45:09 +08:00
|
|
|
* show through. The pasted data may be a floating selection when
|
|
|
|
* relevant, layers otherwise. If the image has a floating selection at
|
|
|
|
* the time of pasting, the old floating selection will be anchored to
|
|
|
|
* its drawable before the new floating selection is added.
|
|
|
|
* This procedure returns the new layers (floating or not). If the
|
|
|
|
* result is a floating selection, it will already be attached to the
|
2019-08-13 19:59:33 +08:00
|
|
|
* specified drawable, and a subsequent call to floating_sel_attach is
|
|
|
|
* not needed.
|
|
|
|
*
|
app, libgimp, pdb, plug-ins: allow pasting multiple full layers.
When a selection exists, we are copying then pasting the selection
contents. In particular, with multi-layer selection, it means pasting a
merged result of the selected layers (like a sample merged but limited
to selected layers).
Yet when no selection exists, with a single layer selected, a cut in
particular would remove the layer fully, then a paste would copy it
elsewhere (in the same image or even on a different image). This was
still working, but not with multiple layers. This is now fixed and we
can now copy/cut then paste several layers (without merge), which is
sometimes a very practical way to move layers (sometimes simpler than
drag'n drop, especially between images).
As a consequence, the PDB function gimp_edit_paste() now also returns an
array of layers (not a single layer).
2021-04-25 04:45:09 +08:00
|
|
|
* Returns: (array length=num_layers) (element-type GimpLayer) (transfer container):
|
|
|
|
* The list of pasted layers.
|
|
|
|
* The returned value must be freed with g_free().
|
2019-08-13 19:59:33 +08:00
|
|
|
**/
|
app, libgimp, pdb, plug-ins: allow pasting multiple full layers.
When a selection exists, we are copying then pasting the selection
contents. In particular, with multi-layer selection, it means pasting a
merged result of the selected layers (like a sample merged but limited
to selected layers).
Yet when no selection exists, with a single layer selected, a cut in
particular would remove the layer fully, then a paste would copy it
elsewhere (in the same image or even on a different image). This was
still working, but not with multiple layers. This is now fixed and we
can now copy/cut then paste several layers (without merge), which is
sometimes a very practical way to move layers (sometimes simpler than
drag'n drop, especially between images).
As a consequence, the PDB function gimp_edit_paste() now also returns an
array of layers (not a single layer).
2021-04-25 04:45:09 +08:00
|
|
|
GimpLayer **
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_edit_paste (GimpDrawable *drawable,
|
app, libgimp, pdb, plug-ins: allow pasting multiple full layers.
When a selection exists, we are copying then pasting the selection
contents. In particular, with multi-layer selection, it means pasting a
merged result of the selected layers (like a sample merged but limited
to selected layers).
Yet when no selection exists, with a single layer selected, a cut in
particular would remove the layer fully, then a paste would copy it
elsewhere (in the same image or even on a different image). This was
still working, but not with multiple layers. This is now fixed and we
can now copy/cut then paste several layers (without merge), which is
sometimes a very practical way to move layers (sometimes simpler than
drag'n drop, especially between images).
As a consequence, the PDB function gimp_edit_paste() now also returns an
array of layers (not a single layer).
2021-04-25 04:45:09 +08:00
|
|
|
gboolean paste_into,
|
|
|
|
gint *num_layers)
|
2019-08-13 19:59:33 +08:00
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
app, libgimp, pdb, plug-ins: allow pasting multiple full layers.
When a selection exists, we are copying then pasting the selection
contents. In particular, with multi-layer selection, it means pasting a
merged result of the selected layers (like a sample merged but limited
to selected layers).
Yet when no selection exists, with a single layer selected, a cut in
particular would remove the layer fully, then a paste would copy it
elsewhere (in the same image or even on a different image). This was
still working, but not with multiple layers. This is now fixed and we
can now copy/cut then paste several layers (without merge), which is
sometimes a very practical way to move layers (sometimes simpler than
drag'n drop, especially between images).
As a consequence, the PDB function gimp_edit_paste() now also returns an
array of layers (not a single layer).
2021-04-25 04:45:09 +08:00
|
|
|
GimpLayer **layers = NULL;
|
2019-08-13 19:59:33 +08:00
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
2019-08-13 19:59:33 +08:00
|
|
|
G_TYPE_BOOLEAN, paste_into,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-edit-paste",
|
|
|
|
args);
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
app, libgimp, pdb, plug-ins: allow pasting multiple full layers.
When a selection exists, we are copying then pasting the selection
contents. In particular, with multi-layer selection, it means pasting a
merged result of the selected layers (like a sample merged but limited
to selected layers).
Yet when no selection exists, with a single layer selected, a cut in
particular would remove the layer fully, then a paste would copy it
elsewhere (in the same image or even on a different image). This was
still working, but not with multiple layers. This is now fixed and we
can now copy/cut then paste several layers (without merge), which is
sometimes a very practical way to move layers (sometimes simpler than
drag'n drop, especially between images).
As a consequence, the PDB function gimp_edit_paste() now also returns an
array of layers (not a single layer).
2021-04-25 04:45:09 +08:00
|
|
|
*num_layers = 0;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
app, libgimp, pdb, plug-ins: allow pasting multiple full layers.
When a selection exists, we are copying then pasting the selection
contents. In particular, with multi-layer selection, it means pasting a
merged result of the selected layers (like a sample merged but limited
to selected layers).
Yet when no selection exists, with a single layer selected, a cut in
particular would remove the layer fully, then a paste would copy it
elsewhere (in the same image or even on a different image). This was
still working, but not with multiple layers. This is now fixed and we
can now copy/cut then paste several layers (without merge), which is
sometimes a very practical way to move layers (sometimes simpler than
drag'n drop, especially between images).
As a consequence, the PDB function gimp_edit_paste() now also returns an
array of layers (not a single layer).
2021-04-25 04:45:09 +08:00
|
|
|
{
|
|
|
|
*num_layers = GIMP_VALUES_GET_INT (return_vals, 1);
|
2021-08-26 23:18:32 +08:00
|
|
|
{ GimpObjectArray *a = g_value_get_boxed (gimp_value_array_index (return_vals, 2)); if (a) layers = g_memdup2 (a->data, a->length * sizeof (gpointer)); };
|
app, libgimp, pdb, plug-ins: allow pasting multiple full layers.
When a selection exists, we are copying then pasting the selection
contents. In particular, with multi-layer selection, it means pasting a
merged result of the selected layers (like a sample merged but limited
to selected layers).
Yet when no selection exists, with a single layer selected, a cut in
particular would remove the layer fully, then a paste would copy it
elsewhere (in the same image or even on a different image). This was
still working, but not with multiple layers. This is now fixed and we
can now copy/cut then paste several layers (without merge), which is
sometimes a very practical way to move layers (sometimes simpler than
drag'n drop, especially between images).
As a consequence, the PDB function gimp_edit_paste() now also returns an
array of layers (not a single layer).
2021-04-25 04:45:09 +08:00
|
|
|
}
|
2019-08-13 19:59:33 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
app, libgimp, pdb, plug-ins: allow pasting multiple full layers.
When a selection exists, we are copying then pasting the selection
contents. In particular, with multi-layer selection, it means pasting a
merged result of the selected layers (like a sample merged but limited
to selected layers).
Yet when no selection exists, with a single layer selected, a cut in
particular would remove the layer fully, then a paste would copy it
elsewhere (in the same image or even on a different image). This was
still working, but not with multiple layers. This is now fixed and we
can now copy/cut then paste several layers (without merge), which is
sometimes a very practical way to move layers (sometimes simpler than
drag'n drop, especially between images).
As a consequence, the PDB function gimp_edit_paste() now also returns an
array of layers (not a single layer).
2021-04-25 04:45:09 +08:00
|
|
|
return layers;
|
2019-08-13 19:59:33 +08:00
|
|
|
}
|
|
|
|
|
2005-09-03 06:50:06 +08:00
|
|
|
/**
|
2016-09-21 02:20:25 +08:00
|
|
|
* gimp_edit_paste_as_new_image:
|
2005-09-03 06:50:06 +08:00
|
|
|
*
|
|
|
|
* 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
|
2006-06-14 16:32:08 +08:00
|
|
|
* previously made to either gimp_edit_cut() or gimp_edit_copy(). This
|
2007-05-06 12:42:51 +08:00
|
|
|
* procedure returns the new image or -1 if the edit buffer was empty.
|
2005-09-03 06:50:06 +08:00
|
|
|
*
|
2019-08-15 16:01:08 +08:00
|
|
|
* Returns: (transfer none): The new image.
|
2005-09-03 06:50:06 +08:00
|
|
|
*
|
2016-09-21 02:20:25 +08:00
|
|
|
* Since: 2.10
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2019-08-11 20:20:05 +08:00
|
|
|
GimpImage *
|
2016-09-21 02:20:25 +08:00
|
|
|
gimp_edit_paste_as_new_image (void)
|
2005-09-03 06:50:06 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2019-08-11 20:20:05 +08:00
|
|
|
GimpImage *image = NULL;
|
2005-09-03 06:50:06 +08:00
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_NONE);
|
2019-07-30 16:51:16 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-edit-paste-as-new-image",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-09-03 06:50:06 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
image = GIMP_VALUES_GET_IMAGE (return_vals, 1);
|
2005-09-03 06:50:06 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2005-09-03 06:50:06 +08:00
|
|
|
|
2019-08-11 20:20:05 +08:00
|
|
|
return image;
|
2005-09-03 06:50:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_edit_named_cut:
|
2020-05-26 22:15:15 +08:00
|
|
|
* @num_drawables: The number of drawables.
|
|
|
|
* @drawables: (array length=num_drawables) (element-type GimpItem): The drawables to cut from.
|
2005-09-03 06:50:06 +08:00
|
|
|
* @buffer_name: The name of the buffer to create.
|
|
|
|
*
|
|
|
|
* Cut into a named buffer.
|
|
|
|
*
|
2006-06-14 16:32:08 +08:00
|
|
|
* 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.
|
2005-09-03 06:50:06 +08:00
|
|
|
*
|
2019-08-05 04:09:04 +08:00
|
|
|
* Returns: (transfer full):
|
|
|
|
* The real name given to the buffer, or NULL if the cut failed.
|
|
|
|
* The returned value must be freed with g_free().
|
2005-09-03 06:50:06 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2005-09-03 06:50:06 +08:00
|
|
|
gchar *
|
2020-05-26 22:15:15 +08:00
|
|
|
gimp_edit_named_cut (gint num_drawables,
|
|
|
|
const GimpItem **drawables,
|
|
|
|
const gchar *buffer_name)
|
2019-08-13 19:59:33 +08:00
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gchar *real_name = NULL;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2020-05-26 22:15:15 +08:00
|
|
|
G_TYPE_INT, num_drawables,
|
|
|
|
GIMP_TYPE_OBJECT_ARRAY, NULL,
|
2019-08-13 19:59:33 +08:00
|
|
|
G_TYPE_STRING, buffer_name,
|
|
|
|
G_TYPE_NONE);
|
2020-05-26 22:15:15 +08:00
|
|
|
gimp_value_set_object_array (gimp_value_array_index (args, 1), GIMP_TYPE_ITEM, (GObject **) drawables, num_drawables);
|
2019-08-13 19:59:33 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-edit-named-cut",
|
|
|
|
args);
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
real_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
|
2019-08-13 19:59:33 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return real_name;
|
|
|
|
}
|
|
|
|
|
2005-09-03 06:50:06 +08:00
|
|
|
/**
|
|
|
|
* gimp_edit_named_copy:
|
2020-05-26 22:15:15 +08:00
|
|
|
* @num_drawables: The number of drawables.
|
|
|
|
* @drawables: (array length=num_drawables) (element-type GimpItem): The drawables to copy from.
|
2005-09-03 06:50:06 +08:00
|
|
|
* @buffer_name: The name of the buffer to create.
|
|
|
|
*
|
|
|
|
* Copy into a named buffer.
|
|
|
|
*
|
2006-06-14 16:32:08 +08:00
|
|
|
* This procedure works like gimp_edit_copy(), but additionally stores
|
2005-09-03 06:50:06 +08:00
|
|
|
* the copied buffer into a named buffer that will stay available for
|
|
|
|
* later pasting, regardless of any intermediate copy or cut
|
|
|
|
* operations.
|
|
|
|
*
|
2019-08-05 04:09:04 +08:00
|
|
|
* Returns: (transfer full):
|
|
|
|
* The real name given to the buffer, or NULL if the copy failed.
|
|
|
|
* The returned value must be freed with g_free().
|
2005-09-03 06:50:06 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2005-09-03 06:50:06 +08:00
|
|
|
gchar *
|
2020-05-26 22:15:15 +08:00
|
|
|
gimp_edit_named_copy (gint num_drawables,
|
|
|
|
const GimpItem **drawables,
|
|
|
|
const gchar *buffer_name)
|
2019-08-13 19:59:33 +08:00
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
gchar *real_name = NULL;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2020-05-26 22:15:15 +08:00
|
|
|
G_TYPE_INT, num_drawables,
|
|
|
|
GIMP_TYPE_OBJECT_ARRAY, NULL,
|
2019-08-13 19:59:33 +08:00
|
|
|
G_TYPE_STRING, buffer_name,
|
|
|
|
G_TYPE_NONE);
|
2020-05-26 22:15:15 +08:00
|
|
|
gimp_value_set_object_array (gimp_value_array_index (args, 1), GIMP_TYPE_ITEM, (GObject **) drawables, num_drawables);
|
2019-08-13 19:59:33 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-edit-named-copy",
|
|
|
|
args);
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
real_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
|
2019-08-13 19:59:33 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return real_name;
|
|
|
|
}
|
|
|
|
|
2005-09-03 06:50:06 +08:00
|
|
|
/**
|
|
|
|
* gimp_edit_named_copy_visible:
|
2019-08-11 20:20:05 +08:00
|
|
|
* @image: The image to copy from.
|
2005-09-03 06:50:06 +08:00
|
|
|
* @buffer_name: The name of the buffer to create.
|
|
|
|
*
|
|
|
|
* Copy from the projection into a named buffer.
|
|
|
|
*
|
2006-06-14 16:32:08 +08:00
|
|
|
* This procedure works like gimp_edit_copy_visible(), but additionally
|
2005-09-03 06:50:06 +08:00
|
|
|
* stores the copied buffer into a named buffer that will stay
|
|
|
|
* available for later pasting, regardless of any intermediate copy or
|
|
|
|
* cut operations.
|
|
|
|
*
|
2019-08-05 04:09:04 +08:00
|
|
|
* Returns: (transfer full):
|
|
|
|
* The real name given to the buffer, or NULL if the copy failed.
|
|
|
|
* The returned value must be freed with g_free().
|
2005-09-03 06:50:06 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2005-09-03 06:50:06 +08:00
|
|
|
gchar *
|
2019-08-11 20:20:05 +08:00
|
|
|
gimp_edit_named_copy_visible (GimpImage *image,
|
2006-04-12 18:27:31 +08:00
|
|
|
const gchar *buffer_name)
|
2005-09-03 06:50:06 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2005-09-03 06:50:06 +08:00
|
|
|
gchar *real_name = NULL;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_IMAGE, image,
|
2019-08-08 19:01:50 +08:00
|
|
|
G_TYPE_STRING, buffer_name,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-edit-named-copy-visible",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-09-03 06:50:06 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
real_name = GIMP_VALUES_DUP_STRING (return_vals, 1);
|
2005-09-03 06:50:06 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2005-09-03 06:50:06 +08:00
|
|
|
|
|
|
|
return real_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_edit_named_paste:
|
2019-08-13 19:59:33 +08:00
|
|
|
* @drawable: The drawable to paste to.
|
|
|
|
* @buffer_name: The name of the buffer to paste.
|
|
|
|
* @paste_into: Clear selection, or paste behind it?
|
|
|
|
*
|
|
|
|
* Paste named buffer to the specified drawable.
|
|
|
|
*
|
|
|
|
* This procedure works like gimp_edit_paste() but pastes a named
|
|
|
|
* buffer instead of the global buffer.
|
|
|
|
*
|
2019-08-15 18:12:25 +08:00
|
|
|
* Returns: (transfer none): The new floating selection.
|
2019-08-13 19:59:33 +08:00
|
|
|
*
|
|
|
|
* Since: 2.4
|
|
|
|
**/
|
|
|
|
GimpLayer *
|
|
|
|
gimp_edit_named_paste (GimpDrawable *drawable,
|
|
|
|
const gchar *buffer_name,
|
|
|
|
gboolean paste_into)
|
|
|
|
{
|
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
|
|
|
GimpLayer *floating_sel = NULL;
|
|
|
|
|
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
2019-08-13 19:59:33 +08:00
|
|
|
G_TYPE_STRING, buffer_name,
|
|
|
|
G_TYPE_BOOLEAN, paste_into,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-edit-named-paste",
|
|
|
|
args);
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_value_array_unref (args);
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
floating_sel = GIMP_VALUES_GET_LAYER (return_vals, 1);
|
2019-08-13 19:59:33 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
|
|
|
|
|
|
|
return floating_sel;
|
|
|
|
}
|
|
|
|
|
2005-09-03 06:50:06 +08:00
|
|
|
/**
|
2016-09-21 02:20:25 +08:00
|
|
|
* gimp_edit_named_paste_as_new_image:
|
2005-09-03 06:50:06 +08:00
|
|
|
* @buffer_name: The name of the buffer to paste.
|
|
|
|
*
|
|
|
|
* Paste named buffer to a new image.
|
|
|
|
*
|
2016-09-21 02:20:25 +08:00
|
|
|
* This procedure works like gimp_edit_paste_as_new_image() but pastes
|
|
|
|
* a named buffer instead of the global buffer.
|
2005-09-03 06:50:06 +08:00
|
|
|
*
|
2019-08-15 16:01:08 +08:00
|
|
|
* Returns: (transfer none): The new image.
|
2005-09-03 06:50:06 +08:00
|
|
|
*
|
2016-09-21 02:20:25 +08:00
|
|
|
* Since: 2.10
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2019-08-11 20:20:05 +08:00
|
|
|
GimpImage *
|
2016-09-21 02:20:25 +08:00
|
|
|
gimp_edit_named_paste_as_new_image (const gchar *buffer_name)
|
2005-09-03 06:50:06 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2019-08-11 20:20:05 +08:00
|
|
|
GimpImage *image = NULL;
|
2005-09-03 06:50:06 +08:00
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, buffer_name,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-edit-named-paste-as-new-image",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-09-03 06:50:06 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
image = GIMP_VALUES_GET_IMAGE (return_vals, 1);
|
2005-09-03 06:50:06 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2005-09-03 06:50:06 +08:00
|
|
|
|
2019-08-11 20:20:05 +08:00
|
|
|
return image;
|
2005-09-03 06:50:06 +08:00
|
|
|
}
|