[gimp/wip/Jehan/classy-GIMP: 10/50] libgimp, pdb: add GimpItem > GimpDrawable > GimpLayer classes.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/Jehan/classy-GIMP: 10/50] libgimp, pdb: add GimpItem > GimpDrawable > GimpLayer classes.
- Date: Thu, 22 Aug 2019 13:29:11 +0000 (UTC)
commit 70b10ea84a641266fdc058360c504c9f77b07b5b
Author: Jehan <jehan girinstud io>
Date: Tue Aug 13 13:59:33 2019 +0200
libgimp, pdb: add GimpItem > GimpDrawable > GimpLayer classes.
Only class and subclasses creation and PDB generation for this first
step.
I'll later do other types of items.
libgimp/Makefile.gi | 2 +
libgimp/gimp.h | 1 +
libgimp/gimpdrawable.c | 18 +
libgimp/gimpdrawable.h | 34 +
libgimp/gimpdrawable_pdb.c | 1760 ++++++++++++++++++++++++++-----
libgimp/gimpdrawable_pdb.h | 154 ++-
libgimp/gimpdrawablecolor_pdb.c | 946 +++++++++++++++--
libgimp/gimpdrawablecolor_pdb.h | 110 +-
libgimp/gimpdrawableedit_pdb.c | 381 ++++++-
libgimp/gimpdrawableedit_pdb.h | 72 +-
libgimp/gimpedit_pdb.c | 318 +++++-
libgimp/gimpedit_pdb.h | 48 +-
libgimp/gimpfileops_pdb.c | 24 +-
libgimp/gimpfileops_pdb.h | 34 +-
libgimp/gimpfloatingsel_pdb.c | 178 +++-
libgimp/gimpfloatingsel_pdb.h | 22 +-
libgimp/gimpimage_pdb.c | 193 ++--
libgimp/gimpimage_pdb.h | 46 +-
libgimp/gimpimageselect_pdb.c | 18 +-
libgimp/gimpimageselect_pdb.h | 6 +-
libgimp/gimpitem.c | 165 +++
libgimp/gimpitem.h | 75 ++
libgimp/gimpitem_pdb.c | 2049 ++++++++++++++++++++++++++++++------
libgimp/gimpitem_pdb.h | 152 ++-
libgimp/gimpitemtransform_pdb.c | 896 ++++++++++++++--
libgimp/gimpitemtransform_pdb.h | 184 ++--
libgimp/gimplayer.c | 19 +
libgimp/gimplayer.h | 33 +
libgimp/gimplayer_pdb.c | 2179 +++++++++++++++++++++++++++++++--------
libgimp/gimplayer_pdb.h | 243 +++--
libgimp/gimppainttools_pdb.c | 1362 ++++++++++++++++++++----
libgimp/gimppainttools_pdb.h | 134 ++-
libgimp/gimpselection_pdb.c | 56 +-
libgimp/gimpselection_pdb.h | 65 +-
libgimp/gimptextlayer_pdb.c | 1899 ++++++++++++++++++++++++++++------
libgimp/gimptextlayer_pdb.h | 157 ++-
libgimp/gimptexttool_pdb.c | 16 +-
libgimp/gimptexttool_pdb.h | 20 +-
libgimp/gimptypes.h | 3 +
libgimp/gimpvectors_pdb.c | 6 +-
libgimp/gimpvectors_pdb.h | 2 +-
pdb/lib.pl | 39 +-
pdb/pdb.pl | 18 +-
43 files changed, 11763 insertions(+), 2374 deletions(-)
---
diff --git a/libgimp/Makefile.gi b/libgimp/Makefile.gi
index fc982dcfd9..5b2147c69d 100644
--- a/libgimp/Makefile.gi
+++ b/libgimp/Makefile.gi
@@ -119,6 +119,7 @@ libgimp_introspectable_headers = \
../libgimp/gimpimage.h \
../libgimp/gimpimagecolorprofile.h \
../libgimp/gimpimageprocedure.h \
+ ../libgimp/gimpitem.h \
../libgimp/gimplayer.h \
../libgimp/gimploadprocedure.h \
../libgimp/gimppaletteselect.h \
@@ -147,6 +148,7 @@ libgimp_introspectable = \
../libgimp/gimpimage.c \
../libgimp/gimpimagecolorprofile.c \
../libgimp/gimpimageprocedure.c \
+ ../libgimp/gimpitem.c \
../libgimp/gimplayer.c \
../libgimp/gimploadprocedure.c \
../libgimp/gimppaletteselect.c \
diff --git a/libgimp/gimp.h b/libgimp/gimp.h
index 46e14f8473..8d3bc6171d 100644
--- a/libgimp/gimp.h
+++ b/libgimp/gimp.h
@@ -44,6 +44,7 @@
#include <libgimp/gimpimage.h>
#include <libgimp/gimpimagecolorprofile.h>
#include <libgimp/gimpimageprocedure.h>
+#include <libgimp/gimpitem.h>
#include <libgimp/gimplayer.h>
#include <libgimp/gimploadprocedure.h>
#include <libgimp/gimplegacy.h>
diff --git a/libgimp/gimpdrawable.c b/libgimp/gimpdrawable.c
index da9b5c332a..c0a9eff740 100644
--- a/libgimp/gimpdrawable.c
+++ b/libgimp/gimpdrawable.c
@@ -26,6 +26,24 @@
#include "gimptilebackendplugin.h"
+G_DEFINE_ABSTRACT_TYPE (GimpDrawable, gimp_drawable, GIMP_TYPE_ITEM)
+
+#define parent_class gimp_drawable_parent_class
+
+static void
+gimp_drawable_class_init (GimpDrawableClass *klass)
+{
+}
+
+static void
+gimp_drawable_init (GimpDrawable *drawable)
+{
+}
+
+
+/* Public API. */
+
+
guchar *
gimp_drawable_get_thumbnail_data (gint32 drawable_ID,
gint *width,
diff --git a/libgimp/gimpdrawable.h b/libgimp/gimpdrawable.h
index 04b05610d8..95c4abc57a 100644
--- a/libgimp/gimpdrawable.h
+++ b/libgimp/gimpdrawable.h
@@ -29,6 +29,40 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
+#include <libgimp/gimpitem.h>
+
+#define GIMP_TYPE_DRAWABLE (gimp_drawable_get_type ())
+#define GIMP_DRAWABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DRAWABLE, GimpDrawable))
+#define GIMP_DRAWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DRAWABLE,
GimpDrawableClass))
+#define GIMP_IS_DRAWABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DRAWABLE))
+#define GIMP_IS_DRAWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DRAWABLE))
+#define GIMP_DRAWABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DRAWABLE,
GimpDrawableClass))
+
+
+typedef struct _GimpDrawableClass GimpDrawableClass;
+
+struct _GimpDrawable
+{
+ GimpItem parent_instance;
+};
+
+struct _GimpDrawableClass
+{
+ GimpItemClass parent_class;
+
+ /* Padding for future expansion */
+ void (*_gimp_reserved1) (void);
+ void (*_gimp_reserved2) (void);
+ void (*_gimp_reserved3) (void);
+ void (*_gimp_reserved4) (void);
+ void (*_gimp_reserved5) (void);
+ void (*_gimp_reserved6) (void);
+ void (*_gimp_reserved7) (void);
+ void (*_gimp_reserved8) (void);
+ void (*_gimp_reserved9) (void);
+};
+
+GType gimp_drawable_get_type (void) G_GNUC_CONST;
GeglBuffer * gimp_drawable_get_buffer (gint32 drawable_ID);
GeglBuffer * gimp_drawable_get_shadow_buffer (gint32 drawable_ID);
diff --git a/libgimp/gimpdrawable_pdb.c b/libgimp/gimpdrawable_pdb.c
index 98c1dfc01d..8078e7cbc6 100644
--- a/libgimp/gimpdrawable_pdb.c
+++ b/libgimp/gimpdrawable_pdb.c
@@ -36,7 +36,7 @@
/**
* _gimp_drawable_get_format:
- * @drawable_ID: The drawable.
+ * @drawable: The drawable.
*
* Returns the drawable's Babl format
*
@@ -51,7 +51,7 @@
* Since: 2.10
**/
gchar *
-_gimp_drawable_get_format (gint32 drawable_ID)
+_gimp_drawable_get_format (GimpDrawable *drawable)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -59,7 +59,7 @@ _gimp_drawable_get_format (gint32 drawable_ID)
gchar *format = NULL;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_NONE);
if (pdb)
@@ -80,22 +80,23 @@ _gimp_drawable_get_format (gint32 drawable_ID)
}
/**
- * _gimp_drawable_get_thumbnail_format:
+ * __gimp_drawable_get_format: (skip)
* @drawable_ID: The drawable.
*
- * Returns the drawable's thumbnail Babl format
+ * Returns the drawable's Babl format
*
- * This procedure returns the drawable's thumbnail Babl format.
- * Thumbnails are always 8-bit images, see gimp_drawable_thumbnail()
- * and gimp_drawable_sub_thmbnail().
+ * This procedure returns the drawable's Babl format.
+ * Note that the actual PDB procedure only transfers the format's
+ * encoding. In order to get to the real format, the libbgimp C wrapper
+ * must be used.
*
- * Returns: (transfer full): The drawable's thumbnail Babl format.
+ * Returns: The drawable's Babl format.
* The returned value must be freed with g_free().
*
- * Since: 2.10.14
+ * Since: 2.10
**/
gchar *
-_gimp_drawable_get_thumbnail_format (gint32 drawable_ID)
+__gimp_drawable_get_format (gint32 drawable_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -108,10 +109,10 @@ _gimp_drawable_get_thumbnail_format (gint32 drawable_ID)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-drawable-get-thumbnail-format",
+ "gimp-drawable-get-format",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-drawable-get-thumbnail-format",
+ return_vals = gimp_run_procedure_array ("gimp-drawable-get-format",
args);
gimp_value_array_unref (args);
@@ -124,64 +125,71 @@ _gimp_drawable_get_thumbnail_format (gint32 drawable_ID)
}
/**
- * gimp_drawable_type:
- * @drawable_ID: The drawable.
+ * _gimp_drawable_get_thumbnail_format:
+ * @drawable: The drawable.
*
- * Returns the drawable's type.
+ * Returns the drawable's thumbnail Babl format
*
- * This procedure returns the drawable's type.
+ * This procedure returns the drawable's thumbnail Babl format.
+ * Thumbnails are always 8-bit images, see gimp_drawable_thumbnail()
+ * and gimp_drawable_sub_thmbnail().
*
- * Returns: The drawable's type.
+ * Returns: (transfer full): The drawable's thumbnail Babl format.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.10.14
**/
-GimpImageType
-gimp_drawable_type (gint32 drawable_ID)
+gchar *
+_gimp_drawable_get_thumbnail_format (GimpDrawable *drawable)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- GimpImageType type = 0;
+ gchar *format = NULL;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-drawable-type",
+ "gimp-drawable-get-thumbnail-format",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-drawable-type",
+ return_vals = gimp_run_procedure_array ("gimp-drawable-get-thumbnail-format",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- type = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+ format = g_value_dup_string (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return type;
+ return format;
}
/**
- * gimp_drawable_type_with_alpha:
+ * __gimp_drawable_get_thumbnail_format: (skip)
* @drawable_ID: The drawable.
*
- * Returns the drawable's type with alpha.
+ * Returns the drawable's thumbnail Babl format
*
- * 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.
+ * This procedure returns the drawable's thumbnail Babl format.
+ * Thumbnails are always 8-bit images, see gimp_drawable_thumbnail()
+ * and gimp_drawable_sub_thmbnail().
*
- * Returns: The drawable's type with alpha.
+ * Returns: The drawable's thumbnail Babl format.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.10.14
**/
-GimpImageType
-gimp_drawable_type_with_alpha (gint32 drawable_ID)
+gchar *
+__gimp_drawable_get_thumbnail_format (gint32 drawable_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- GimpImageType type_with_alpha = 0;
+ gchar *format = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
@@ -189,80 +197,77 @@ gimp_drawable_type_with_alpha (gint32 drawable_ID)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-drawable-type-with-alpha",
+ "gimp-drawable-get-thumbnail-format",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-drawable-type-with-alpha",
+ return_vals = gimp_run_procedure_array ("gimp-drawable-get-thumbnail-format",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- type_with_alpha = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+ format = g_value_dup_string (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return type_with_alpha;
+ return format;
}
/**
- * gimp_drawable_has_alpha:
- * @drawable_ID: The drawable.
+ * gimp_drawable_type:
+ * @drawable: The drawable.
*
- * Returns TRUE if the drawable has an alpha channel.
+ * Returns the drawable's type.
*
- * 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 }.
+ * This procedure returns the drawable's type.
*
- * Returns: Does the drawable have an alpha channel?
+ * Returns: The drawable's type.
**/
-gboolean
-gimp_drawable_has_alpha (gint32 drawable_ID)
+GimpImageType
+gimp_drawable_type (GimpDrawable *drawable)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean has_alpha = FALSE;
+ GimpImageType type = 0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-drawable-has-alpha",
+ "gimp-drawable-type",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-drawable-has-alpha",
+ return_vals = gimp_run_procedure_array ("gimp-drawable-type",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- has_alpha = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ type = g_value_get_enum (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return has_alpha;
+ return type;
}
/**
- * gimp_drawable_is_rgb:
+ * _gimp_drawable_type: (skip)
* @drawable_ID: The drawable.
*
- * Returns whether the drawable is an RGB type.
+ * Returns the drawable's type.
*
- * This procedure returns TRUE if the specified drawable is of type {
- * RGB, RGBA }.
+ * This procedure returns the drawable's type.
*
- * Returns: TRUE if the drawable is an RGB type.
+ * Returns: The drawable's type.
**/
-gboolean
-gimp_drawable_is_rgb (gint32 drawable_ID)
+GimpImageType
+_gimp_drawable_type (gint32 drawable_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean is_rgb = FALSE;
+ GimpImageType type = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
@@ -270,79 +275,83 @@ gimp_drawable_is_rgb (gint32 drawable_ID)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-drawable-is-rgb",
+ "gimp-drawable-type",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-drawable-is-rgb",
+ return_vals = gimp_run_procedure_array ("gimp-drawable-type",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- is_rgb = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ type = g_value_get_enum (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return is_rgb;
+ return type;
}
/**
- * gimp_drawable_is_gray:
- * @drawable_ID: The drawable.
+ * gimp_drawable_type_with_alpha:
+ * @drawable: The drawable.
*
- * Returns whether the drawable is a grayscale type.
+ * Returns the drawable's type with alpha.
*
- * This procedure returns TRUE if the specified drawable is of type {
- * Gray, GrayA }.
+ * 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.
*
- * Returns: TRUE if the drawable is a grayscale type.
+ * Returns: The drawable's type with alpha.
**/
-gboolean
-gimp_drawable_is_gray (gint32 drawable_ID)
+GimpImageType
+gimp_drawable_type_with_alpha (GimpDrawable *drawable)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean is_gray = FALSE;
+ GimpImageType type_with_alpha = 0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-drawable-is-gray",
+ "gimp-drawable-type-with-alpha",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-drawable-is-gray",
+ return_vals = gimp_run_procedure_array ("gimp-drawable-type-with-alpha",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- is_gray = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ type_with_alpha = g_value_get_enum (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return is_gray;
+ return type_with_alpha;
}
/**
- * gimp_drawable_is_indexed:
+ * _gimp_drawable_type_with_alpha: (skip)
* @drawable_ID: The drawable.
*
- * Returns whether the drawable is an indexed type.
+ * Returns the drawable's type with alpha.
*
- * This procedure returns TRUE if the specified drawable is of type {
- * Indexed, IndexedA }.
+ * 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.
*
- * Returns: TRUE if the drawable is an indexed type.
+ * Returns: The drawable's type with alpha.
**/
-gboolean
-gimp_drawable_is_indexed (gint32 drawable_ID)
+GimpImageType
+_gimp_drawable_type_with_alpha (gint32 drawable_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean is_indexed = FALSE;
+ GimpImageType type_with_alpha = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
@@ -350,77 +359,81 @@ gimp_drawable_is_indexed (gint32 drawable_ID)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-drawable-is-indexed",
+ "gimp-drawable-type-with-alpha",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-drawable-is-indexed",
+ return_vals = gimp_run_procedure_array ("gimp-drawable-type-with-alpha",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- is_indexed = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ type_with_alpha = g_value_get_enum (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return is_indexed;
+ return type_with_alpha;
}
/**
- * gimp_drawable_bpp:
- * @drawable_ID: The drawable.
+ * gimp_drawable_has_alpha:
+ * @drawable: The drawable.
*
- * Returns the bytes per pixel.
+ * Returns TRUE if the drawable has an alpha channel.
*
- * This procedure returns the number of bytes per pixel.
+ * 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 }.
*
- * Returns: Bytes per pixel.
+ * Returns: Does the drawable have an alpha channel?
**/
-gint
-gimp_drawable_bpp (gint32 drawable_ID)
+gboolean
+gimp_drawable_has_alpha (GimpDrawable *drawable)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint bpp = 0;
+ gboolean has_alpha = FALSE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-drawable-bpp",
+ "gimp-drawable-has-alpha",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-drawable-bpp",
+ return_vals = gimp_run_procedure_array ("gimp-drawable-has-alpha",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- bpp = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ has_alpha = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return bpp;
+ return has_alpha;
}
/**
- * gimp_drawable_width:
+ * _gimp_drawable_has_alpha: (skip)
* @drawable_ID: The drawable.
*
- * Returns the width of the drawable.
+ * Returns TRUE if the drawable has an alpha channel.
*
- * This procedure returns the specified drawable's width in pixels.
+ * 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 }.
*
- * Returns: Width of drawable.
+ * Returns: Does the drawable have an alpha channel?
**/
-gint
-gimp_drawable_width (gint32 drawable_ID)
+gboolean
+_gimp_drawable_has_alpha (gint32 drawable_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint width = 0;
+ gboolean has_alpha = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
@@ -428,83 +441,79 @@ gimp_drawable_width (gint32 drawable_ID)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-drawable-width",
+ "gimp-drawable-has-alpha",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-drawable-width",
+ return_vals = gimp_run_procedure_array ("gimp-drawable-has-alpha",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- width = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ has_alpha = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return width;
+ return has_alpha;
}
/**
- * gimp_drawable_height:
- * @drawable_ID: The drawable.
+ * gimp_drawable_is_rgb:
+ * @drawable: The drawable.
*
- * Returns the height of the drawable.
+ * Returns whether the drawable is an RGB type.
*
- * This procedure returns the specified drawable's height in pixels.
+ * This procedure returns TRUE if the specified drawable is of type {
+ * RGB, RGBA }.
*
- * Returns: Height of drawable.
+ * Returns: TRUE if the drawable is an RGB type.
**/
-gint
-gimp_drawable_height (gint32 drawable_ID)
+gboolean
+gimp_drawable_is_rgb (GimpDrawable *drawable)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint height = 0;
+ gboolean is_rgb = FALSE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-drawable-height",
+ "gimp-drawable-is-rgb",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-drawable-height",
+ return_vals = gimp_run_procedure_array ("gimp-drawable-is-rgb",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- height = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ is_rgb = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return height;
+ return is_rgb;
}
/**
- * gimp_drawable_offsets:
+ * _gimp_drawable_is_rgb: (skip)
* @drawable_ID: The drawable.
- * @offset_x: (out): x offset of drawable.
- * @offset_y: (out): y offset of drawable.
*
- * Returns the offsets for the drawable.
+ * Returns whether the drawable is an RGB type.
*
- * 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.
+ * This procedure returns TRUE if the specified drawable is of type {
+ * RGB, RGBA }.
*
- * Returns: TRUE on success.
+ * Returns: TRUE if the drawable is an RGB type.
**/
gboolean
-gimp_drawable_offsets (gint32 drawable_ID,
- gint *offset_x,
- gint *offset_y)
+_gimp_drawable_is_rgb (gint32 drawable_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ gboolean is_rgb = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
@@ -512,17 +521,509 @@ gimp_drawable_offsets (gint32 drawable_ID,
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-drawable-offsets",
+ "gimp-drawable-is-rgb",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-drawable-offsets",
+ return_vals = gimp_run_procedure_array ("gimp-drawable-is-rgb",
args);
gimp_value_array_unref (args);
- *offset_x = 0;
- *offset_y = 0;
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ is_rgb = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
- success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+ gimp_value_array_unref (return_vals);
+
+ return is_rgb;
+}
+
+/**
+ * gimp_drawable_is_gray:
+ * @drawable: The drawable.
+ *
+ * Returns whether the drawable is a grayscale type.
+ *
+ * This procedure returns TRUE if the specified drawable is of type {
+ * Gray, GrayA }.
+ *
+ * Returns: TRUE if the drawable is a grayscale type.
+ **/
+gboolean
+gimp_drawable_is_gray (GimpDrawable *drawable)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean is_gray = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-is-gray",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-is-gray",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ is_gray = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return is_gray;
+}
+
+/**
+ * _gimp_drawable_is_gray: (skip)
+ * @drawable_ID: The drawable.
+ *
+ * Returns whether the drawable is a grayscale type.
+ *
+ * This procedure returns TRUE if the specified drawable is of type {
+ * Gray, GrayA }.
+ *
+ * Returns: TRUE if the drawable is a grayscale type.
+ **/
+gboolean
+_gimp_drawable_is_gray (gint32 drawable_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean is_gray = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-is-gray",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-is-gray",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ is_gray = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return is_gray;
+}
+
+/**
+ * gimp_drawable_is_indexed:
+ * @drawable: The drawable.
+ *
+ * Returns whether the drawable is an indexed type.
+ *
+ * This procedure returns TRUE if the specified drawable is of type {
+ * Indexed, IndexedA }.
+ *
+ * Returns: TRUE if the drawable is an indexed type.
+ **/
+gboolean
+gimp_drawable_is_indexed (GimpDrawable *drawable)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean is_indexed = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-is-indexed",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-is-indexed",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ is_indexed = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return is_indexed;
+}
+
+/**
+ * _gimp_drawable_is_indexed: (skip)
+ * @drawable_ID: The drawable.
+ *
+ * Returns whether the drawable is an indexed type.
+ *
+ * This procedure returns TRUE if the specified drawable is of type {
+ * Indexed, IndexedA }.
+ *
+ * Returns: TRUE if the drawable is an indexed type.
+ **/
+gboolean
+_gimp_drawable_is_indexed (gint32 drawable_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean is_indexed = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-is-indexed",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-is-indexed",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ is_indexed = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return is_indexed;
+}
+
+/**
+ * gimp_drawable_bpp:
+ * @drawable: The drawable.
+ *
+ * Returns the bytes per pixel.
+ *
+ * This procedure returns the number of bytes per pixel.
+ *
+ * Returns: Bytes per pixel.
+ **/
+gint
+gimp_drawable_bpp (GimpDrawable *drawable)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint bpp = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-bpp",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-bpp",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ bpp = g_value_get_int (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return bpp;
+}
+
+/**
+ * _gimp_drawable_bpp: (skip)
+ * @drawable_ID: The drawable.
+ *
+ * Returns the bytes per pixel.
+ *
+ * This procedure returns the number of bytes per pixel.
+ *
+ * Returns: Bytes per pixel.
+ **/
+gint
+_gimp_drawable_bpp (gint32 drawable_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint bpp = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-bpp",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-bpp",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ bpp = g_value_get_int (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return bpp;
+}
+
+/**
+ * gimp_drawable_width:
+ * @drawable: The drawable.
+ *
+ * Returns the width of the drawable.
+ *
+ * This procedure returns the specified drawable's width in pixels.
+ *
+ * Returns: Width of drawable.
+ **/
+gint
+gimp_drawable_width (GimpDrawable *drawable)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint width = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-width",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-width",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ width = g_value_get_int (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return width;
+}
+
+/**
+ * _gimp_drawable_width: (skip)
+ * @drawable_ID: The drawable.
+ *
+ * Returns the width of the drawable.
+ *
+ * This procedure returns the specified drawable's width in pixels.
+ *
+ * Returns: Width of drawable.
+ **/
+gint
+_gimp_drawable_width (gint32 drawable_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint width = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-width",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-width",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ width = g_value_get_int (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return width;
+}
+
+/**
+ * gimp_drawable_height:
+ * @drawable: The drawable.
+ *
+ * Returns the height of the drawable.
+ *
+ * This procedure returns the specified drawable's height in pixels.
+ *
+ * Returns: Height of drawable.
+ **/
+gint
+gimp_drawable_height (GimpDrawable *drawable)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint height = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-height",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-height",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ height = g_value_get_int (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return height;
+}
+
+/**
+ * _gimp_drawable_height: (skip)
+ * @drawable_ID: The drawable.
+ *
+ * Returns the height of the drawable.
+ *
+ * This procedure returns the specified drawable's height in pixels.
+ *
+ * Returns: Height of drawable.
+ **/
+gint
+_gimp_drawable_height (gint32 drawable_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint height = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-height",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-height",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ height = g_value_get_int (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return height;
+}
+
+/**
+ * gimp_drawable_offsets:
+ * @drawable: The drawable.
+ * @offset_x: (out): x offset of drawable.
+ * @offset_y: (out): y offset of drawable.
+ *
+ * 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.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_offsets (GimpDrawable *drawable,
+ gint *offset_x,
+ gint *offset_y)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-offsets",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-offsets",
+ args);
+ gimp_value_array_unref (args);
+
+ *offset_x = 0;
+ *offset_y = 0;
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *offset_x = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ *offset_y = g_value_get_int (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_offsets: (skip)
+ * @drawable_ID: The drawable.
+ * @offset_x: (out): x offset of drawable.
+ * @offset_y: (out): y offset of drawable.
+ *
+ * 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.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_drawable_offsets (gint32 drawable_ID,
+ gint *offset_x,
+ gint *offset_y)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-offsets",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-offsets",
+ args);
+ gimp_value_array_unref (args);
+
+ *offset_x = 0;
+ *offset_y = 0;
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
if (success)
{
@@ -537,6 +1038,71 @@ gimp_drawable_offsets (gint32 drawable_ID,
/**
* gimp_drawable_mask_bounds:
+ * @drawable: The drawable.
+ * @x1: (out): x coordinate of the upper left corner of selection bounds.
+ * @y1: (out): y coordinate of the upper left corner of selection bounds.
+ * @x2: (out): x coordinate of the lower right corner of selection bounds.
+ * @y2: (out): y coordinate of the lower right corner of selection bounds.
+ *
+ * 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.
+ *
+ * Returns: TRUE if there is a selection.
+ **/
+gboolean
+gimp_drawable_mask_bounds (GimpDrawable *drawable,
+ gint *x1,
+ gint *y1,
+ gint *x2,
+ gint *y2)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean non_empty = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-mask-bounds",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-mask-bounds",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ {
+ non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ *x1 = g_value_get_int (gimp_value_array_index (return_vals, 2));
+ *y1 = g_value_get_int (gimp_value_array_index (return_vals, 3));
+ *x2 = g_value_get_int (gimp_value_array_index (return_vals, 4));
+ *y2 = g_value_get_int (gimp_value_array_index (return_vals, 5));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return non_empty;
+}
+
+/**
+ * _gimp_drawable_mask_bounds: (skip)
* @drawable_ID: The drawable.
* @x1: (out): x coordinate of the upper left corner of selection bounds.
* @y1: (out): y coordinate of the upper left corner of selection bounds.
@@ -559,124 +1125,315 @@ gimp_drawable_offsets (gint32 drawable_ID,
* is non_empty. See gimp_drawable_mask_intersect() for a boolean
* return value which is more useful in most cases.
*
- * Returns: TRUE if there is a selection.
+ * Returns: TRUE if there is a selection.
+ **/
+gboolean
+_gimp_drawable_mask_bounds (gint32 drawable_ID,
+ gint *x1,
+ gint *y1,
+ gint *x2,
+ gint *y2)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean non_empty = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-mask-bounds",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-mask-bounds",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ {
+ non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ *x1 = g_value_get_int (gimp_value_array_index (return_vals, 2));
+ *y1 = g_value_get_int (gimp_value_array_index (return_vals, 3));
+ *x2 = g_value_get_int (gimp_value_array_index (return_vals, 4));
+ *y2 = g_value_get_int (gimp_value_array_index (return_vals, 5));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return non_empty;
+}
+
+/**
+ * gimp_drawable_mask_intersect:
+ * @drawable: The drawable.
+ * @x: (out): x coordinate of the upper left corner of the intersection.
+ * @y: (out): y coordinate of the upper left corner of the intersection.
+ * @width: (out): width of the intersection.
+ * @height: (out): height of the intersection.
+ *
+ * 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.
+ *
+ * Returns: TRUE if the returned area is not empty.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_drawable_mask_intersect (GimpDrawable *drawable,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean non_empty = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-mask-intersect",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-mask-intersect",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ {
+ non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ *x = g_value_get_int (gimp_value_array_index (return_vals, 2));
+ *y = g_value_get_int (gimp_value_array_index (return_vals, 3));
+ *width = g_value_get_int (gimp_value_array_index (return_vals, 4));
+ *height = g_value_get_int (gimp_value_array_index (return_vals, 5));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return non_empty;
+}
+
+/**
+ * _gimp_drawable_mask_intersect: (skip)
+ * @drawable_ID: The drawable.
+ * @x: (out): x coordinate of the upper left corner of the intersection.
+ * @y: (out): y coordinate of the upper left corner of the intersection.
+ * @width: (out): width of the intersection.
+ * @height: (out): height of the intersection.
+ *
+ * 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.
+ *
+ * Returns: TRUE if the returned area is not empty.
+ *
+ * Since: 2.2
+ **/
+gboolean
+_gimp_drawable_mask_intersect (gint32 drawable_ID,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean non_empty = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-mask-intersect",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-mask-intersect",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ {
+ non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ *x = g_value_get_int (gimp_value_array_index (return_vals, 2));
+ *y = g_value_get_int (gimp_value_array_index (return_vals, 3));
+ *width = g_value_get_int (gimp_value_array_index (return_vals, 4));
+ *height = g_value_get_int (gimp_value_array_index (return_vals, 5));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return non_empty;
+}
+
+/**
+ * gimp_drawable_merge_shadow:
+ * @drawable: The drawable.
+ * @undo: Push merge to undo stack?
+ *
+ * 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'.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_merge_shadow (GimpDrawable *drawable,
+ gboolean undo)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_BOOLEAN, undo,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-merge-shadow",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-merge-shadow",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_merge_shadow: (skip)
+ * @drawable_ID: The drawable.
+ * @undo: Push merge to undo stack?
+ *
+ * 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'.
+ *
+ * Returns: TRUE on success.
**/
gboolean
-gimp_drawable_mask_bounds (gint32 drawable_ID,
- gint *x1,
- gint *y1,
- gint *x2,
- gint *y2)
+_gimp_drawable_merge_shadow (gint32 drawable_ID,
+ gboolean undo)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean non_empty = FALSE;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_BOOLEAN, undo,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-drawable-mask-bounds",
+ "gimp-drawable-merge-shadow",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-drawable-mask-bounds",
+ return_vals = gimp_run_procedure_array ("gimp-drawable-merge-shadow",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- {
- non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
- *x1 = g_value_get_int (gimp_value_array_index (return_vals, 2));
- *y1 = g_value_get_int (gimp_value_array_index (return_vals, 3));
- *x2 = g_value_get_int (gimp_value_array_index (return_vals, 4));
- *y2 = g_value_get_int (gimp_value_array_index (return_vals, 5));
- }
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return non_empty;
+ return success;
}
/**
- * gimp_drawable_mask_intersect:
- * @drawable_ID: The drawable.
- * @x: (out): x coordinate of the upper left corner of the intersection.
- * @y: (out): y coordinate of the upper left corner of the intersection.
- * @width: (out): width of the intersection.
- * @height: (out): height of the intersection.
+ * gimp_drawable_free_shadow:
+ * @drawable: The drawable.
*
- * Find the bounding box of the current selection in relation to the
- * specified drawable.
+ * Free the specified drawable's shadow data (if it exists).
*
- * 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.
+ * 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.
*
- * Returns: TRUE if the returned area is not empty.
+ * Returns: TRUE on success.
*
- * Since: 2.2
+ * Since: 2.6
**/
gboolean
-gimp_drawable_mask_intersect (gint32 drawable_ID,
- gint *x,
- gint *y,
- gint *width,
- gint *height)
+gimp_drawable_free_shadow (GimpDrawable *drawable)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean non_empty = FALSE;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-drawable-mask-intersect",
+ "gimp-drawable-free-shadow",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-drawable-mask-intersect",
+ return_vals = gimp_run_procedure_array ("gimp-drawable-free-shadow",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- {
- non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
- *x = g_value_get_int (gimp_value_array_index (return_vals, 2));
- *y = g_value_get_int (gimp_value_array_index (return_vals, 3));
- *width = g_value_get_int (gimp_value_array_index (return_vals, 4));
- *height = g_value_get_int (gimp_value_array_index (return_vals, 5));
- }
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return non_empty;
+ return success;
}
/**
- * gimp_drawable_merge_shadow:
+ * _gimp_drawable_free_shadow: (skip)
* @drawable_ID: The drawable.
- * @undo: Push merge to undo stack?
*
- * Merge the shadow buffer with the specified drawable.
+ * Free the specified drawable's shadow data (if it exists).
*
- * 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'.
+ * 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.
*
* Returns: TRUE on success.
+ *
+ * Since: 2.6
**/
gboolean
-gimp_drawable_merge_shadow (gint32 drawable_ID,
- gboolean undo)
+_gimp_drawable_free_shadow (gint32 drawable_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -685,15 +1442,14 @@ gimp_drawable_merge_shadow (gint32 drawable_ID,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
- G_TYPE_BOOLEAN, undo,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-drawable-merge-shadow",
+ "gimp-drawable-free-shadow",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-drawable-merge-shadow",
+ return_vals = gimp_run_procedure_array ("gimp-drawable-free-shadow",
args);
gimp_value_array_unref (args);
@@ -705,22 +1461,28 @@ gimp_drawable_merge_shadow (gint32 drawable_ID,
}
/**
- * gimp_drawable_free_shadow:
- * @drawable_ID: The drawable.
+ * gimp_drawable_update:
+ * @drawable: 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.
*
- * Free the specified drawable's shadow data (if it exists).
+ * Update the specified region of the drawable.
*
- * 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.
+ * 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).
*
* Returns: TRUE on success.
- *
- * Since: 2.6
**/
gboolean
-gimp_drawable_free_shadow (gint32 drawable_ID)
+gimp_drawable_update (GimpDrawable *drawable,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -728,15 +1490,19 @@ gimp_drawable_free_shadow (gint32 drawable_ID)
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_INT, x,
+ G_TYPE_INT, y,
+ G_TYPE_INT, width,
+ G_TYPE_INT, height,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-drawable-free-shadow",
+ "gimp-drawable-update",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-drawable-free-shadow",
+ return_vals = gimp_run_procedure_array ("gimp-drawable-update",
args);
gimp_value_array_unref (args);
@@ -748,7 +1514,7 @@ gimp_drawable_free_shadow (gint32 drawable_ID)
}
/**
- * gimp_drawable_update:
+ * _gimp_drawable_update: (skip)
* @drawable_ID: The drawable.
* @x: x coordinate of upper left corner of update region.
* @y: y coordinate of upper left corner of update region.
@@ -765,11 +1531,11 @@ gimp_drawable_free_shadow (gint32 drawable_ID)
* Returns: TRUE on success.
**/
gboolean
-gimp_drawable_update (gint32 drawable_ID,
- gint x,
- gint y,
- gint width,
- gint height)
+_gimp_drawable_update (gint32 drawable_ID,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -802,7 +1568,7 @@ gimp_drawable_update (gint32 drawable_ID,
/**
* gimp_drawable_get_pixel:
- * @drawable_ID: The drawable.
+ * @drawable: The drawable.
* @x_coord: The x coordinate.
* @y_coord: The y coordinate.
* @num_channels: (out): The number of channels for the pixel.
@@ -818,10 +1584,65 @@ gimp_drawable_update (gint32 drawable_ID,
* The returned value must be freed with g_free().
**/
guint8 *
-gimp_drawable_get_pixel (gint32 drawable_ID,
- gint x_coord,
- gint y_coord,
- gint *num_channels)
+gimp_drawable_get_pixel (GimpDrawable *drawable,
+ gint x_coord,
+ gint y_coord,
+ gint *num_channels)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ guint8 *pixel = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_INT, x_coord,
+ G_TYPE_INT, y_coord,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-get-pixel",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-get-pixel",
+ args);
+ gimp_value_array_unref (args);
+
+ *num_channels = 0;
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ {
+ *num_channels = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ pixel = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return pixel;
+}
+
+/**
+ * _gimp_drawable_get_pixel: (skip)
+ * @drawable_ID: The drawable.
+ * @x_coord: The x coordinate.
+ * @y_coord: The y coordinate.
+ * @num_channels: (out): The number of channels for the pixel.
+ *
+ * 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.
+ *
+ * Returns: (array length=num_channels): The pixel value.
+ * The returned value must be freed with g_free().
+ **/
+guint8 *
+_gimp_drawable_get_pixel (gint32 drawable_ID,
+ gint x_coord,
+ gint y_coord,
+ gint *num_channels)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -858,28 +1679,138 @@ gimp_drawable_get_pixel (gint32 drawable_ID,
/**
* gimp_drawable_set_pixel:
+ * @drawable: The drawable.
+ * @x_coord: The x coordinate.
+ * @y_coord: The y coordinate.
+ * @num_channels: The number of channels for the pixel.
+ * @pixel: (array length=num_channels) (element-type guint8): The pixel value.
+ *
+ * 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.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_set_pixel (GimpDrawable *drawable,
+ gint x_coord,
+ gint y_coord,
+ gint num_channels,
+ const guint8 *pixel)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_INT, x_coord,
+ G_TYPE_INT, y_coord,
+ G_TYPE_INT, num_channels,
+ GIMP_TYPE_UINT8_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_uint8_array (gimp_value_array_index (args, 4), pixel, num_channels);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-set-pixel",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-set-pixel",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_set_pixel: (skip)
* @drawable_ID: The drawable.
* @x_coord: The x coordinate.
* @y_coord: The y coordinate.
* @num_channels: The number of channels for the pixel.
* @pixel: (array length=num_channels) (element-type guint8): The pixel value.
*
- * Sets the value of the pixel at the specified coordinates.
+ * 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.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_drawable_set_pixel (gint32 drawable_ID,
+ gint x_coord,
+ gint y_coord,
+ gint num_channels,
+ const guint8 *pixel)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_INT, x_coord,
+ G_TYPE_INT, y_coord,
+ G_TYPE_INT, num_channels,
+ GIMP_TYPE_UINT8_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_uint8_array (gimp_value_array_index (args, 4), pixel, num_channels);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-set-pixel",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-set-pixel",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_fill:
+ * @drawable: The drawable.
+ * @fill_type: The type of fill.
+ *
+ * Fill the drawable with the specified fill mode.
*
- * 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.
+ * 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.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_drawable_set_pixel (gint32 drawable_ID,
- gint x_coord,
- gint y_coord,
- gint num_channels,
- const guint8 *pixel)
+gimp_drawable_fill (GimpDrawable *drawable,
+ GimpFillType fill_type)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -887,20 +1818,16 @@ gimp_drawable_set_pixel (gint32 drawable_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
- G_TYPE_INT, x_coord,
- G_TYPE_INT, y_coord,
- G_TYPE_INT, num_channels,
- GIMP_TYPE_UINT8_ARRAY, NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ GIMP_TYPE_FILL_TYPE, fill_type,
G_TYPE_NONE);
- gimp_value_set_uint8_array (gimp_value_array_index (args, 4), pixel, num_channels);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-drawable-set-pixel",
+ "gimp-drawable-fill",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-drawable-set-pixel",
+ return_vals = gimp_run_procedure_array ("gimp-drawable-fill",
args);
gimp_value_array_unref (args);
@@ -912,7 +1839,7 @@ gimp_drawable_set_pixel (gint32 drawable_ID,
}
/**
- * gimp_drawable_fill:
+ * _gimp_drawable_fill: (skip)
* @drawable_ID: The drawable.
* @fill_type: The type of fill.
*
@@ -933,8 +1860,8 @@ gimp_drawable_set_pixel (gint32 drawable_ID,
* Returns: TRUE on success.
**/
gboolean
-gimp_drawable_fill (gint32 drawable_ID,
- GimpFillType fill_type)
+_gimp_drawable_fill (gint32 drawable_ID,
+ GimpFillType fill_type)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -964,6 +1891,62 @@ gimp_drawable_fill (gint32 drawable_ID,
/**
* gimp_drawable_offset:
+ * @drawable: The drawable to offset.
+ * @wrap_around: wrap image around or fill vacated regions.
+ * @fill_type: fill vacated regions of drawable with background or transparent.
+ * @offset_x: offset by this amount in X direction.
+ * @offset_y: offset by this amount in Y direction.
+ *
+ * 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.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_offset (GimpDrawable *drawable,
+ gboolean wrap_around,
+ GimpOffsetType fill_type,
+ gint offset_x,
+ gint offset_y)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_BOOLEAN, wrap_around,
+ GIMP_TYPE_OFFSET_TYPE, fill_type,
+ G_TYPE_INT, offset_x,
+ G_TYPE_INT, offset_y,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-offset",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-offset",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_offset: (skip)
* @drawable_ID: The drawable to offset.
* @wrap_around: wrap image around or fill vacated regions.
* @fill_type: fill vacated regions of drawable with background or transparent.
@@ -983,11 +1966,11 @@ gimp_drawable_fill (gint32 drawable_ID,
* Returns: TRUE on success.
**/
gboolean
-gimp_drawable_offset (gint32 drawable_ID,
- gboolean wrap_around,
- GimpOffsetType fill_type,
- gint offset_x,
- gint offset_y)
+_gimp_drawable_offset (gint32 drawable_ID,
+ gboolean wrap_around,
+ GimpOffsetType fill_type,
+ gint offset_x,
+ gint offset_y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1020,7 +2003,7 @@ gimp_drawable_offset (gint32 drawable_ID,
/**
* _gimp_drawable_thumbnail:
- * @drawable_ID: The drawable.
+ * @drawable: The drawable.
* @width: The requested thumbnail width.
* @height: The requested thumbnail height.
* @actual_width: (out): The previews width.
@@ -1039,14 +2022,86 @@ gimp_drawable_offset (gint32 drawable_ID,
* Returns: TRUE on success.
**/
gboolean
-_gimp_drawable_thumbnail (gint32 drawable_ID,
- gint width,
- gint height,
- gint *actual_width,
- gint *actual_height,
- gint *bpp,
- gint *thumbnail_data_count,
- guint8 **thumbnail_data)
+_gimp_drawable_thumbnail (GimpDrawable *drawable,
+ gint width,
+ gint height,
+ gint *actual_width,
+ gint *actual_height,
+ gint *bpp,
+ gint *thumbnail_data_count,
+ guint8 **thumbnail_data)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_INT, width,
+ G_TYPE_INT, height,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-thumbnail",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-thumbnail",
+ args);
+ gimp_value_array_unref (args);
+
+ *actual_width = 0;
+ *actual_height = 0;
+ *bpp = 0;
+ *thumbnail_data_count = 0;
+ *thumbnail_data = NULL;
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *actual_width = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ *actual_height = g_value_get_int (gimp_value_array_index (return_vals, 2));
+ *bpp = g_value_get_int (gimp_value_array_index (return_vals, 3));
+ *thumbnail_data_count = g_value_get_int (gimp_value_array_index (return_vals, 4));
+ *thumbnail_data = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 5));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * __gimp_drawable_thumbnail: (skip)
+ * @drawable_ID: The drawable.
+ * @width: The requested thumbnail width.
+ * @height: The requested thumbnail height.
+ * @actual_width: (out): The previews width.
+ * @actual_height: (out): The previews height.
+ * @bpp: (out): The previews bpp.
+ * @thumbnail_data_count: (out): The number of bytes in thumbnail data.
+ * @thumbnail_data: (out) (array length=thumbnail_data_count): The thumbnail data.
+ *
+ * Get a thumbnail of a drawable.
+ *
+ * This function gets data from which a thumbnail of a drawable preview
+ * can be created. Maximum x or y dimension is 1024 pixels. The pixels
+ * are returned in RGB[A] or GRAY[A] format. The bpp return value gives
+ * the number of bytes in the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+__gimp_drawable_thumbnail (gint32 drawable_ID,
+ gint width,
+ gint height,
+ gint *actual_width,
+ gint *actual_height,
+ gint *bpp,
+ gint *thumbnail_data_count,
+ guint8 **thumbnail_data)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1092,7 +2147,7 @@ _gimp_drawable_thumbnail (gint32 drawable_ID,
/**
* _gimp_drawable_sub_thumbnail:
- * @drawable_ID: The drawable.
+ * @drawable: The drawable.
* @src_x: The x coordinate of the area.
* @src_y: The y coordinate of the area.
* @src_width: The width of the area.
@@ -1117,18 +2172,104 @@ _gimp_drawable_thumbnail (gint32 drawable_ID,
* Since: 2.2
**/
gboolean
-_gimp_drawable_sub_thumbnail (gint32 drawable_ID,
- gint src_x,
- gint src_y,
- gint src_width,
- gint src_height,
- gint dest_width,
- gint dest_height,
- gint *width,
- gint *height,
- gint *bpp,
- gint *thumbnail_data_count,
- guint8 **thumbnail_data)
+_gimp_drawable_sub_thumbnail (GimpDrawable *drawable,
+ gint src_x,
+ gint src_y,
+ gint src_width,
+ gint src_height,
+ gint dest_width,
+ gint dest_height,
+ gint *width,
+ gint *height,
+ gint *bpp,
+ gint *thumbnail_data_count,
+ guint8 **thumbnail_data)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_INT, src_x,
+ G_TYPE_INT, src_y,
+ G_TYPE_INT, src_width,
+ G_TYPE_INT, src_height,
+ G_TYPE_INT, dest_width,
+ G_TYPE_INT, dest_height,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-sub-thumbnail",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-sub-thumbnail",
+ args);
+ gimp_value_array_unref (args);
+
+ *width = 0;
+ *height = 0;
+ *bpp = 0;
+ *thumbnail_data_count = 0;
+ *thumbnail_data = NULL;
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *width = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ *height = g_value_get_int (gimp_value_array_index (return_vals, 2));
+ *bpp = g_value_get_int (gimp_value_array_index (return_vals, 3));
+ *thumbnail_data_count = g_value_get_int (gimp_value_array_index (return_vals, 4));
+ *thumbnail_data = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 5));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * __gimp_drawable_sub_thumbnail: (skip)
+ * @drawable_ID: The drawable.
+ * @src_x: The x coordinate of the area.
+ * @src_y: The y coordinate of the area.
+ * @src_width: The width of the area.
+ * @src_height: The height of the area.
+ * @dest_width: The thumbnail width.
+ * @dest_height: The thumbnail height.
+ * @width: (out): The previews width.
+ * @height: (out): The previews height.
+ * @bpp: (out): The previews bpp.
+ * @thumbnail_data_count: (out): The number of bytes in thumbnail data.
+ * @thumbnail_data: (out) (array length=thumbnail_data_count): The thumbnail data.
+ *
+ * Get a thumbnail of a sub-area of a drawable drawable.
+ *
+ * This function gets data from which a thumbnail of a drawable preview
+ * can be created. Maximum x or y dimension is 1024 pixels. The pixels
+ * are returned in RGB[A] or GRAY[A] format. The bpp return value gives
+ * the number of bytes in the image.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+__gimp_drawable_sub_thumbnail (gint32 drawable_ID,
+ gint src_x,
+ gint src_y,
+ gint src_width,
+ gint src_height,
+ gint dest_width,
+ gint dest_height,
+ gint *width,
+ gint *height,
+ gint *bpp,
+ gint *thumbnail_data_count,
+ guint8 **thumbnail_data)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1178,6 +2319,53 @@ _gimp_drawable_sub_thumbnail (gint32 drawable_ID,
/**
* gimp_drawable_foreground_extract:
+ * @drawable: The drawable.
+ * @mode: The algorithm to use.
+ * @mask: Tri-Map.
+ *
+ * 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
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_drawable_foreground_extract (GimpDrawable *drawable,
+ GimpForegroundExtractMode mode,
+ GimpDrawable *mask)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ GIMP_TYPE_FOREGROUND_EXTRACT_MODE, mode,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (mask)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-foreground-extract",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-foreground-extract",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_foreground_extract: (skip)
* @drawable_ID: The drawable.
* @mode: The algorithm to use.
* @mask_ID: Tri-Map.
@@ -1192,9 +2380,9 @@ _gimp_drawable_sub_thumbnail (gint32 drawable_ID,
* Since: 2.4
**/
gboolean
-gimp_drawable_foreground_extract (gint32 drawable_ID,
- GimpForegroundExtractMode mode,
- gint32 mask_ID)
+_gimp_drawable_foreground_extract (gint32 drawable_ID,
+ GimpForegroundExtractMode mode,
+ gint32 mask_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
diff --git a/libgimp/gimpdrawable_pdb.h b/libgimp/gimpdrawable_pdb.h
index 6916584eeb..56e54f4f10 100644
--- a/libgimp/gimpdrawable_pdb.h
+++ b/libgimp/gimpdrawable_pdb.h
@@ -32,55 +32,59 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-G_GNUC_INTERNAL gchar* _gimp_drawable_get_format (gint32 drawable_ID);
-G_GNUC_INTERNAL gchar* _gimp_drawable_get_thumbnail_format (gint32 drawable_ID);
-GimpImageType gimp_drawable_type (gint32 drawable_ID);
-GimpImageType gimp_drawable_type_with_alpha (gint32 drawable_ID);
-gboolean gimp_drawable_has_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_bpp (gint32 drawable_ID);
-gint gimp_drawable_width (gint32 drawable_ID);
-gint gimp_drawable_height (gint32 drawable_ID);
-gboolean gimp_drawable_offsets (gint32 drawable_ID,
+
+
+#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+
+G_GNUC_INTERNAL gchar* _gimp_drawable_get_format (GimpDrawable *drawable);
+G_GNUC_INTERNAL gchar* _gimp_drawable_get_thumbnail_format (GimpDrawable *drawable);
+GimpImageType gimp_drawable_type (GimpDrawable *drawable);
+GimpImageType gimp_drawable_type_with_alpha (GimpDrawable *drawable);
+gboolean gimp_drawable_has_alpha (GimpDrawable *drawable);
+gboolean gimp_drawable_is_rgb (GimpDrawable *drawable);
+gboolean gimp_drawable_is_gray (GimpDrawable *drawable);
+gboolean gimp_drawable_is_indexed (GimpDrawable *drawable);
+gint gimp_drawable_bpp (GimpDrawable *drawable);
+gint gimp_drawable_width (GimpDrawable *drawable);
+gint gimp_drawable_height (GimpDrawable *drawable);
+gboolean gimp_drawable_offsets (GimpDrawable *drawable,
gint *offset_x,
gint *offset_y);
-gboolean gimp_drawable_mask_bounds (gint32 drawable_ID,
+gboolean gimp_drawable_mask_bounds (GimpDrawable *drawable,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
-gboolean gimp_drawable_mask_intersect (gint32 drawable_ID,
+gboolean gimp_drawable_mask_intersect (GimpDrawable *drawable,
gint *x,
gint *y,
gint *width,
gint *height);
-gboolean gimp_drawable_merge_shadow (gint32 drawable_ID,
+gboolean gimp_drawable_merge_shadow (GimpDrawable *drawable,
gboolean undo);
-gboolean gimp_drawable_free_shadow (gint32 drawable_ID);
-gboolean gimp_drawable_update (gint32 drawable_ID,
+gboolean gimp_drawable_free_shadow (GimpDrawable *drawable);
+gboolean gimp_drawable_update (GimpDrawable *drawable,
gint x,
gint y,
gint width,
gint height);
-guint8* gimp_drawable_get_pixel (gint32 drawable_ID,
+guint8* gimp_drawable_get_pixel (GimpDrawable *drawable,
gint x_coord,
gint y_coord,
gint *num_channels);
-gboolean gimp_drawable_set_pixel (gint32 drawable_ID,
+gboolean gimp_drawable_set_pixel (GimpDrawable *drawable,
gint x_coord,
gint y_coord,
gint num_channels,
const guint8 *pixel);
-gboolean gimp_drawable_fill (gint32 drawable_ID,
+gboolean gimp_drawable_fill (GimpDrawable *drawable,
GimpFillType fill_type);
-gboolean gimp_drawable_offset (gint32 drawable_ID,
+gboolean gimp_drawable_offset (GimpDrawable *drawable,
gboolean wrap_around,
GimpOffsetType fill_type,
gint offset_x,
gint offset_y);
-G_GNUC_INTERNAL gboolean _gimp_drawable_thumbnail (gint32 drawable_ID,
+G_GNUC_INTERNAL gboolean _gimp_drawable_thumbnail (GimpDrawable *drawable,
gint width,
gint height,
gint *actual_width,
@@ -88,7 +92,7 @@ G_GNUC_INTERNAL gboolean _gimp_drawable_thumbnail (gint32
gint *bpp,
gint
*thumbnail_data_count,
guint8 **thumbnail_data);
-G_GNUC_INTERNAL gboolean _gimp_drawable_sub_thumbnail (gint32 drawable_ID,
+G_GNUC_INTERNAL gboolean _gimp_drawable_sub_thumbnail (GimpDrawable *drawable,
gint src_x,
gint src_y,
gint src_width,
@@ -100,16 +104,36 @@ G_GNUC_INTERNAL gboolean _gimp_drawable_sub_thumbnail (gint32
gint *bpp,
gint
*thumbnail_data_count,
guint8 **thumbnail_data);
-gboolean gimp_drawable_foreground_extract (gint32 drawable_ID,
+gboolean gimp_drawable_foreground_extract (GimpDrawable *drawable,
GimpForegroundExtractMode mode,
- gint32 mask_ID);
-
-#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
-
-
+ GimpDrawable *mask);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
+#define _gimp_drawable_get_format __gimp_drawable_get_format
+#define _gimp_drawable_get_thumbnail_format __gimp_drawable_get_thumbnail_format
+#define gimp_drawable_type _gimp_drawable_type
+#define gimp_drawable_type_with_alpha _gimp_drawable_type_with_alpha
+#define gimp_drawable_has_alpha _gimp_drawable_has_alpha
+#define gimp_drawable_is_rgb _gimp_drawable_is_rgb
+#define gimp_drawable_is_gray _gimp_drawable_is_gray
+#define gimp_drawable_is_indexed _gimp_drawable_is_indexed
+#define gimp_drawable_bpp _gimp_drawable_bpp
+#define gimp_drawable_width _gimp_drawable_width
+#define gimp_drawable_height _gimp_drawable_height
+#define gimp_drawable_offsets _gimp_drawable_offsets
+#define gimp_drawable_mask_bounds _gimp_drawable_mask_bounds
+#define gimp_drawable_mask_intersect _gimp_drawable_mask_intersect
+#define gimp_drawable_merge_shadow _gimp_drawable_merge_shadow
+#define gimp_drawable_free_shadow _gimp_drawable_free_shadow
+#define gimp_drawable_update _gimp_drawable_update
+#define gimp_drawable_get_pixel _gimp_drawable_get_pixel
+#define gimp_drawable_set_pixel _gimp_drawable_set_pixel
+#define gimp_drawable_fill _gimp_drawable_fill
+#define gimp_drawable_offset _gimp_drawable_offset
+#define _gimp_drawable_thumbnail __gimp_drawable_thumbnail
+#define _gimp_drawable_sub_thumbnail __gimp_drawable_sub_thumbnail
+#define gimp_drawable_foreground_extract _gimp_drawable_foreground_extract
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@@ -118,7 +142,77 @@ gboolean gimp_drawable_foreground_extract (gint32
* They are not marked internal as a trick to keep the old API alive for now.
*/
-
+gchar* __gimp_drawable_get_format (gint32 drawable_ID);
+gchar* __gimp_drawable_get_thumbnail_format (gint32 drawable_ID);
+GimpImageType _gimp_drawable_type (gint32 drawable_ID);
+GimpImageType _gimp_drawable_type_with_alpha (gint32 drawable_ID);
+gboolean _gimp_drawable_has_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_bpp (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_mask_bounds (gint32 drawable_ID,
+ gint *x1,
+ gint *y1,
+ gint *x2,
+ gint *y2);
+gboolean _gimp_drawable_mask_intersect (gint32 drawable_ID,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height);
+gboolean _gimp_drawable_merge_shadow (gint32 drawable_ID,
+ gboolean undo);
+gboolean _gimp_drawable_free_shadow (gint32 drawable_ID);
+gboolean _gimp_drawable_update (gint32 drawable_ID,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
+guint8* _gimp_drawable_get_pixel (gint32 drawable_ID,
+ gint x_coord,
+ gint y_coord,
+ gint *num_channels);
+gboolean _gimp_drawable_set_pixel (gint32 drawable_ID,
+ gint x_coord,
+ gint y_coord,
+ gint num_channels,
+ const guint8 *pixel);
+gboolean _gimp_drawable_fill (gint32 drawable_ID,
+ GimpFillType fill_type);
+gboolean _gimp_drawable_offset (gint32 drawable_ID,
+ gboolean wrap_around,
+ GimpOffsetType fill_type,
+ gint offset_x,
+ gint offset_y);
+gboolean __gimp_drawable_thumbnail (gint32 drawable_ID,
+ gint width,
+ gint height,
+ gint *actual_width,
+ gint *actual_height,
+ gint *bpp,
+ gint *thumbnail_data_count,
+ guint8 **thumbnail_data);
+gboolean __gimp_drawable_sub_thumbnail (gint32 drawable_ID,
+ gint src_x,
+ gint src_y,
+ gint src_width,
+ gint src_height,
+ gint dest_width,
+ gint dest_height,
+ gint *width,
+ gint *height,
+ gint *bpp,
+ gint *thumbnail_data_count,
+ guint8 **thumbnail_data);
+gboolean _gimp_drawable_foreground_extract (gint32 drawable_ID,
+ GimpForegroundExtractMode mode,
+ gint32 mask_ID);
G_END_DECLS
diff --git a/libgimp/gimpdrawablecolor_pdb.c b/libgimp/gimpdrawablecolor_pdb.c
index f5576c17e7..b472e694c0 100644
--- a/libgimp/gimpdrawablecolor_pdb.c
+++ b/libgimp/gimpdrawablecolor_pdb.c
@@ -37,6 +37,54 @@
/**
* gimp_drawable_brightness_contrast:
+ * @drawable: The drawable.
+ * @brightness: Brightness adjustment.
+ * @contrast: Contrast adjustment.
+ *
+ * Modify brightness/contrast in the specified drawable.
+ *
+ * This procedures allows the brightness and contrast of the specified
+ * drawable to be modified. Both 'brightness' and 'contrast' parameters
+ * are defined between -0.5 and 0.5.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_brightness_contrast (GimpDrawable *drawable,
+ gdouble brightness,
+ gdouble contrast)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_DOUBLE, brightness,
+ G_TYPE_DOUBLE, contrast,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-brightness-contrast",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-brightness-contrast",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_brightness_contrast: (skip)
* @drawable_ID: The drawable.
* @brightness: Brightness adjustment.
* @contrast: Contrast adjustment.
@@ -52,9 +100,9 @@
* Since: 2.10
**/
gboolean
-gimp_drawable_brightness_contrast (gint32 drawable_ID,
- gdouble brightness,
- gdouble contrast)
+_gimp_drawable_brightness_contrast (gint32 drawable_ID,
+ gdouble brightness,
+ gdouble contrast)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -85,6 +133,68 @@ gimp_drawable_brightness_contrast (gint32 drawable_ID,
/**
* gimp_drawable_color_balance:
+ * @drawable: The drawable.
+ * @transfer_mode: Transfer mode.
+ * @preserve_lum: Preserve luminosity values at each pixel.
+ * @cyan_red: Cyan-Red color balance.
+ * @magenta_green: Magenta-Green color balance.
+ * @yellow_blue: Yellow-Blue color balance.
+ *
+ * Modify the color balance of the specified drawable.
+ *
+ * Modify the color balance of the specified drawable. There are three
+ * axis which can be modified: cyan-red, magenta-green, and
+ * yellow-blue. Negative values increase the amount of the former,
+ * positive values increase the amount of the latter. Color balance can
+ * be controlled with the 'transfer_mode' setting, which allows
+ * shadows, mid-tones, and highlights in an image to be affected
+ * differently. The 'preserve-lum' parameter, if TRUE, ensures that the
+ * luminosity of each pixel remains fixed.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_color_balance (GimpDrawable *drawable,
+ GimpTransferMode transfer_mode,
+ gboolean preserve_lum,
+ gdouble cyan_red,
+ gdouble magenta_green,
+ gdouble yellow_blue)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ GIMP_TYPE_TRANSFER_MODE, transfer_mode,
+ G_TYPE_BOOLEAN, preserve_lum,
+ G_TYPE_DOUBLE, cyan_red,
+ G_TYPE_DOUBLE, magenta_green,
+ G_TYPE_DOUBLE, yellow_blue,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-color-balance",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-color-balance",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_color_balance: (skip)
* @drawable_ID: The drawable.
* @transfer_mode: Transfer mode.
* @preserve_lum: Preserve luminosity values at each pixel.
@@ -108,12 +218,12 @@ gimp_drawable_brightness_contrast (gint32 drawable_ID,
* Since: 2.10
**/
gboolean
-gimp_drawable_color_balance (gint32 drawable_ID,
- GimpTransferMode transfer_mode,
- gboolean preserve_lum,
- gdouble cyan_red,
- gdouble magenta_green,
- gdouble yellow_blue)
+_gimp_drawable_color_balance (gint32 drawable_ID,
+ GimpTransferMode transfer_mode,
+ gboolean preserve_lum,
+ gdouble cyan_red,
+ gdouble magenta_green,
+ gdouble yellow_blue)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -147,6 +257,58 @@ gimp_drawable_color_balance (gint32 drawable_ID,
/**
* gimp_drawable_colorize_hsl:
+ * @drawable: The drawable.
+ * @hue: Hue in degrees.
+ * @saturation: Saturation in percent.
+ * @lightness: Lightness in percent.
+ *
+ * Render the drawable as a grayscale image seen through a colored
+ * glass.
+ *
+ * Desaturates the drawable, then tints it with the specified color.
+ * This tool is only valid on RGB color images. It will not operate on
+ * grayscale drawables.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_colorize_hsl (GimpDrawable *drawable,
+ gdouble hue,
+ gdouble saturation,
+ gdouble lightness)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_DOUBLE, hue,
+ G_TYPE_DOUBLE, saturation,
+ G_TYPE_DOUBLE, lightness,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-colorize-hsl",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-colorize-hsl",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_colorize_hsl: (skip)
* @drawable_ID: The drawable.
* @hue: Hue in degrees.
* @saturation: Saturation in percent.
@@ -164,10 +326,10 @@ gimp_drawable_color_balance (gint32 drawable_ID,
* Since: 2.10
**/
gboolean
-gimp_drawable_colorize_hsl (gint32 drawable_ID,
- gdouble hue,
- gdouble saturation,
- gdouble lightness)
+_gimp_drawable_colorize_hsl (gint32 drawable_ID,
+ gdouble hue,
+ gdouble saturation,
+ gdouble lightness)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -199,7 +361,7 @@ gimp_drawable_colorize_hsl (gint32 drawable_ID,
/**
* gimp_drawable_curves_explicit:
- * @drawable_ID: The drawable.
+ * @drawable: The drawable.
* @channel: The channel to modify.
* @num_values: The number of values in the new curve.
* @values: (array length=num_values) (element-type gdouble): The explicit curve.
@@ -218,7 +380,7 @@ gimp_drawable_colorize_hsl (gint32 drawable_ID,
* Since: 2.10
**/
gboolean
-gimp_drawable_curves_explicit (gint32 drawable_ID,
+gimp_drawable_curves_explicit (GimpDrawable *drawable,
GimpHistogramChannel channel,
gint num_values,
const gdouble *values)
@@ -228,6 +390,61 @@ gimp_drawable_curves_explicit (gint32 drawable_ID,
GimpValueArray *return_vals;
gboolean success = TRUE;
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ GIMP_TYPE_HISTOGRAM_CHANNEL, channel,
+ G_TYPE_INT, num_values,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 3), values, num_values);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-curves-explicit",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-curves-explicit",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_curves_explicit: (skip)
+ * @drawable_ID: The drawable.
+ * @channel: The channel to modify.
+ * @num_values: The number of values in the new curve.
+ * @values: (array length=num_values) (element-type gdouble): The explicit curve.
+ *
+ * Modifies the intensity curve(s) for specified drawable.
+ *
+ * Modifies the intensity mapping for one channel in the specified
+ * drawable. The channel can be either an intensity component, or the
+ * value. The 'values' parameter is an array of doubles which
+ * explicitly defines how each pixel value in the drawable will be
+ * modified. Use the gimp_curves_spline() function to modify intensity
+ * levels with Catmull Rom splines.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+_gimp_drawable_curves_explicit (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint num_values,
+ const gdouble *values)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
GIMP_TYPE_HISTOGRAM_CHANNEL, channel,
@@ -254,7 +471,7 @@ gimp_drawable_curves_explicit (gint32 drawable_ID,
/**
* gimp_drawable_curves_spline:
- * @drawable_ID: The drawable.
+ * @drawable: The drawable.
* @channel: The channel to modify.
* @num_points: The number of values in the control point array.
* @points: (array length=num_points) (element-type gdouble): The spline control points: { cp1.x, cp1.y,
cp2.x, cp2.y, ... }.
@@ -273,7 +490,7 @@ gimp_drawable_curves_explicit (gint32 drawable_ID,
* Since: 2.10
**/
gboolean
-gimp_drawable_curves_spline (gint32 drawable_ID,
+gimp_drawable_curves_spline (GimpDrawable *drawable,
GimpHistogramChannel channel,
gint num_points,
const gdouble *points)
@@ -284,7 +501,7 @@ gimp_drawable_curves_spline (gint32 drawable_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
GIMP_TYPE_HISTOGRAM_CHANNEL, channel,
G_TYPE_INT, num_points,
GIMP_TYPE_FLOAT_ARRAY, NULL,
@@ -308,24 +525,30 @@ gimp_drawable_curves_spline (gint32 drawable_ID,
}
/**
- * gimp_drawable_desaturate:
+ * _gimp_drawable_curves_spline: (skip)
* @drawable_ID: The drawable.
- * @desaturate_mode: The formula to use to desaturate.
+ * @channel: The channel to modify.
+ * @num_points: The number of values in the control point array.
+ * @points: (array length=num_points) (element-type gdouble): The spline control points: { cp1.x, cp1.y,
cp2.x, cp2.y, ... }.
*
- * Desaturate the contents of the specified drawable, with the
- * specified formula.
+ * Modifies the intensity curve(s) for specified drawable.
*
- * This procedure desaturates the contents of the specified drawable,
- * with the specified formula. This procedure only works on drawables
- * of type RGB color.
+ * Modifies the intensity mapping for one channel in the specified
+ * drawable. The channel can be either an intensity component, or the
+ * value. The 'points' parameter is an array of doubles which define a
+ * set of control points which describe a Catmull Rom spline which
+ * yields the final intensity curve. Use the gimp_curves_explicit()
+ * function to explicitly modify intensity levels.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
-gimp_drawable_desaturate (gint32 drawable_ID,
- GimpDesaturateMode desaturate_mode)
+_gimp_drawable_curves_spline (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint num_points,
+ const gdouble *points)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -334,15 +557,18 @@ gimp_drawable_desaturate (gint32 drawable_ID,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
- GIMP_TYPE_DESATURATE_MODE, desaturate_mode,
+ GIMP_TYPE_HISTOGRAM_CHANNEL, channel,
+ G_TYPE_INT, num_points,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 3), points, num_points);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-drawable-desaturate",
+ "gimp-drawable-curves-spline",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-drawable-desaturate",
+ return_vals = gimp_run_procedure_array ("gimp-drawable-curves-spline",
args);
gimp_value_array_unref (args);
@@ -354,27 +580,24 @@ gimp_drawable_desaturate (gint32 drawable_ID,
}
/**
- * gimp_drawable_equalize:
- * @drawable_ID: The drawable.
- * @mask_only: Equalization option.
+ * gimp_drawable_desaturate:
+ * @drawable: The drawable.
+ * @desaturate_mode: The formula to use to desaturate.
*
- * Equalize the contents of the specified drawable.
+ * Desaturate the contents of the specified drawable, with the
+ * specified formula.
*
- * This procedure equalizes the contents of the specified drawable.
- * Each intensity channel is equalized independently. The equalized
- * intensity is given as inten' = (255 - inten). The 'mask_only' option
- * specifies whether to adjust only the area of the image within the
- * selection bounds, or the entire image based on the histogram of the
- * selected area. If there is no selection, the entire image is
- * adjusted based on the histogram for the entire image.
+ * This procedure desaturates the contents of the specified drawable,
+ * with the specified formula. This procedure only works on drawables
+ * of type RGB color.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
-gimp_drawable_equalize (gint32 drawable_ID,
- gboolean mask_only)
+gimp_drawable_desaturate (GimpDrawable *drawable,
+ GimpDesaturateMode desaturate_mode)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -382,16 +605,16 @@ gimp_drawable_equalize (gint32 drawable_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
- G_TYPE_BOOLEAN, mask_only,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ GIMP_TYPE_DESATURATE_MODE, desaturate_mode,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-drawable-equalize",
+ "gimp-drawable-desaturate",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-drawable-equalize",
+ return_vals = gimp_run_procedure_array ("gimp-drawable-desaturate",
args);
gimp_value_array_unref (args);
@@ -403,20 +626,164 @@ gimp_drawable_equalize (gint32 drawable_ID,
}
/**
- * gimp_drawable_histogram:
+ * _gimp_drawable_desaturate: (skip)
* @drawable_ID: The drawable.
- * @channel: The channel to query.
- * @start_range: Start of the intensity measurement range.
- * @end_range: End of the intensity measurement range.
- * @mean: (out): Mean intensity value.
- * @std_dev: (out): Standard deviation of intensity values.
- * @median: (out): Median intensity value.
- * @pixels: (out): Alpha-weighted pixel count for entire image.
- * @count: (out): Alpha-weighted pixel count for range.
- * @percentile: (out): Percentile that range falls under.
+ * @desaturate_mode: The formula to use to desaturate.
*
- * Returns information on the intensity histogram for the specified
- * drawable.
+ * Desaturate the contents of the specified drawable, with the
+ * specified formula.
+ *
+ * This procedure desaturates the contents of the specified drawable,
+ * with the specified formula. This procedure only works on drawables
+ * of type RGB color.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+_gimp_drawable_desaturate (gint32 drawable_ID,
+ GimpDesaturateMode desaturate_mode)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DESATURATE_MODE, desaturate_mode,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-desaturate",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-desaturate",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_equalize:
+ * @drawable: The drawable.
+ * @mask_only: Equalization option.
+ *
+ * Equalize the contents of the specified drawable.
+ *
+ * This procedure equalizes the contents of the specified drawable.
+ * Each intensity channel is equalized independently. The equalized
+ * intensity is given as inten' = (255 - inten). The 'mask_only' option
+ * specifies whether to adjust only the area of the image within the
+ * selection bounds, or the entire image based on the histogram of the
+ * selected area. If there is no selection, the entire image is
+ * adjusted based on the histogram for the entire image.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_equalize (GimpDrawable *drawable,
+ gboolean mask_only)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_BOOLEAN, mask_only,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-equalize",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-equalize",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_equalize: (skip)
+ * @drawable_ID: The drawable.
+ * @mask_only: Equalization option.
+ *
+ * Equalize the contents of the specified drawable.
+ *
+ * This procedure equalizes the contents of the specified drawable.
+ * Each intensity channel is equalized independently. The equalized
+ * intensity is given as inten' = (255 - inten). The 'mask_only' option
+ * specifies whether to adjust only the area of the image within the
+ * selection bounds, or the entire image based on the histogram of the
+ * selected area. If there is no selection, the entire image is
+ * adjusted based on the histogram for the entire image.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+_gimp_drawable_equalize (gint32 drawable_ID,
+ gboolean mask_only)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_BOOLEAN, mask_only,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-equalize",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-equalize",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_drawable_histogram:
+ * @drawable: The drawable.
+ * @channel: The channel to query.
+ * @start_range: Start of the intensity measurement range.
+ * @end_range: End of the intensity measurement range.
+ * @mean: (out): Mean intensity value.
+ * @std_dev: (out): Standard deviation of intensity values.
+ * @median: (out): Median intensity value.
+ * @pixels: (out): Alpha-weighted pixel count for entire image.
+ * @count: (out): Alpha-weighted pixel count for range.
+ * @percentile: (out): Percentile that range falls under.
+ *
+ * Returns information on the intensity histogram for the specified
+ * drawable.
*
* This tool makes it possible to gather information about the
* intensity histogram of a drawable. A channel to examine is first
@@ -439,7 +806,7 @@ gimp_drawable_equalize (gint32 drawable_ID,
* Since: 2.10
**/
gboolean
-gimp_drawable_histogram (gint32 drawable_ID,
+gimp_drawable_histogram (GimpDrawable *drawable,
GimpHistogramChannel channel,
gdouble start_range,
gdouble end_range,
@@ -455,6 +822,99 @@ gimp_drawable_histogram (gint32 drawable_ID,
GimpValueArray *return_vals;
gboolean success = TRUE;
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ GIMP_TYPE_HISTOGRAM_CHANNEL, channel,
+ G_TYPE_DOUBLE, start_range,
+ G_TYPE_DOUBLE, end_range,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-histogram",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-histogram",
+ args);
+ gimp_value_array_unref (args);
+
+ *mean = 0.0;
+ *std_dev = 0.0;
+ *median = 0.0;
+ *pixels = 0.0;
+ *count = 0.0;
+ *percentile = 0.0;
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *mean = g_value_get_double (gimp_value_array_index (return_vals, 1));
+ *std_dev = g_value_get_double (gimp_value_array_index (return_vals, 2));
+ *median = g_value_get_double (gimp_value_array_index (return_vals, 3));
+ *pixels = g_value_get_double (gimp_value_array_index (return_vals, 4));
+ *count = g_value_get_double (gimp_value_array_index (return_vals, 5));
+ *percentile = g_value_get_double (gimp_value_array_index (return_vals, 6));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_histogram: (skip)
+ * @drawable_ID: The drawable.
+ * @channel: The channel to query.
+ * @start_range: Start of the intensity measurement range.
+ * @end_range: End of the intensity measurement range.
+ * @mean: (out): Mean intensity value.
+ * @std_dev: (out): Standard deviation of intensity values.
+ * @median: (out): Median intensity value.
+ * @pixels: (out): Alpha-weighted pixel count for entire image.
+ * @count: (out): Alpha-weighted pixel count for range.
+ * @percentile: (out): Percentile that range falls under.
+ *
+ * Returns information on the intensity histogram for the specified
+ * drawable.
+ *
+ * This tool makes it possible to gather information about the
+ * intensity histogram of a drawable. A channel to examine is first
+ * specified. This can be either value, red, green, or blue, depending
+ * on whether the drawable is of type color or grayscale. Second, a
+ * range of intensities are specified. The gimp_drawable_histogram()
+ * function returns statistics based on the pixels in the drawable that
+ * fall under this range of values. Mean, standard deviation, median,
+ * number of pixels, and percentile are all returned. Additionally, the
+ * total count of pixels in the image is returned. Counts of pixels are
+ * weighted by any associated alpha values and by the current selection
+ * mask. That is, pixels that lie outside an active selection mask will
+ * not be counted. Similarly, pixels with transparent alpha values will
+ * not be counted. The returned mean, std_dev and median are in the
+ * range (0..255) for 8-bit images or if the plug-in is not
+ * precision-aware, and in the range (0.0..1.0) otherwise.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+_gimp_drawable_histogram (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gdouble start_range,
+ gdouble end_range,
+ gdouble *mean,
+ gdouble *std_dev,
+ gdouble *median,
+ gdouble *pixels,
+ gdouble *count,
+ gdouble *percentile)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
GIMP_TYPE_HISTOGRAM_CHANNEL, channel,
@@ -497,6 +957,65 @@ gimp_drawable_histogram (gint32 drawable_ID,
/**
* gimp_drawable_hue_saturation:
+ * @drawable: The drawable.
+ * @hue_range: Range of affected hues.
+ * @hue_offset: Hue offset in degrees.
+ * @lightness: Lightness modification.
+ * @saturation: Saturation modification.
+ * @overlap: Overlap other hue channels.
+ *
+ * Modify hue, lightness, and saturation in the specified drawable.
+ *
+ * This procedure allows the hue, lightness, and saturation in the
+ * specified drawable to be modified. The 'hue-range' parameter
+ * provides the capability to limit range of affected hues. The
+ * 'overlap' parameter provides blending into neighboring hue channels
+ * when rendering.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_hue_saturation (GimpDrawable *drawable,
+ GimpHueRange hue_range,
+ gdouble hue_offset,
+ gdouble lightness,
+ gdouble saturation,
+ gdouble overlap)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ GIMP_TYPE_HUE_RANGE, hue_range,
+ G_TYPE_DOUBLE, hue_offset,
+ G_TYPE_DOUBLE, lightness,
+ G_TYPE_DOUBLE, saturation,
+ G_TYPE_DOUBLE, overlap,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-hue-saturation",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-hue-saturation",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_hue_saturation: (skip)
* @drawable_ID: The drawable.
* @hue_range: Range of affected hues.
* @hue_offset: Hue offset in degrees.
@@ -517,12 +1036,12 @@ gimp_drawable_histogram (gint32 drawable_ID,
* Since: 2.10
**/
gboolean
-gimp_drawable_hue_saturation (gint32 drawable_ID,
- GimpHueRange hue_range,
- gdouble hue_offset,
- gdouble lightness,
- gdouble saturation,
- gdouble overlap)
+_gimp_drawable_hue_saturation (gint32 drawable_ID,
+ GimpHueRange hue_range,
+ gdouble hue_offset,
+ gdouble lightness,
+ gdouble saturation,
+ gdouble overlap)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -556,6 +1075,52 @@ gimp_drawable_hue_saturation (gint32 drawable_ID,
/**
* gimp_drawable_invert:
+ * @drawable: The drawable.
+ * @linear: Whether to invert in linear space.
+ *
+ * Invert the contents of the specified drawable.
+ *
+ * This procedure inverts the contents of the specified drawable. Each
+ * intensity channel is inverted independently. The inverted intensity
+ * is given as inten' = (255 - inten). If 'linear' is TRUE, the
+ * drawable is inverted in linear space.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_invert (GimpDrawable *drawable,
+ gboolean linear)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_BOOLEAN, linear,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-invert",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-invert",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_invert: (skip)
* @drawable_ID: The drawable.
* @linear: Whether to invert in linear space.
*
@@ -571,8 +1136,8 @@ gimp_drawable_hue_saturation (gint32 drawable_ID,
* Since: 2.10
**/
gboolean
-gimp_drawable_invert (gint32 drawable_ID,
- gboolean linear)
+_gimp_drawable_invert (gint32 drawable_ID,
+ gboolean linear)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -602,6 +1167,81 @@ gimp_drawable_invert (gint32 drawable_ID,
/**
* gimp_drawable_levels:
+ * @drawable: The drawable.
+ * @channel: The channel to modify.
+ * @low_input: Intensity of lowest input.
+ * @high_input: Intensity of highest input.
+ * @clamp_input: Clamp input values before applying output levels.
+ * @gamma: Gamma adjustment factor.
+ * @low_output: Intensity of lowest output.
+ * @high_output: Intensity of highest output.
+ * @clamp_output: Clamp final output values.
+ *
+ * Modifies intensity levels in the specified drawable.
+ *
+ * This tool allows intensity levels in the specified drawable to be
+ * remapped according to a set of parameters. The low/high input levels
+ * specify an initial mapping from the source intensities. The gamma
+ * value determines how intensities between the low and high input
+ * intensities are interpolated. A gamma value of 1.0 results in a
+ * linear interpolation. Higher gamma values result in more high-level
+ * intensities. Lower gamma values result in more low-level
+ * intensities. The low/high output levels constrain the final
+ * intensity mapping--that is, no final intensity will be lower than
+ * the low output level and no final intensity will be higher than the
+ * high output level. This tool is only valid on RGB color and
+ * grayscale images.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_levels (GimpDrawable *drawable,
+ GimpHistogramChannel channel,
+ gdouble low_input,
+ gdouble high_input,
+ gboolean clamp_input,
+ gdouble gamma,
+ gdouble low_output,
+ gdouble high_output,
+ gboolean clamp_output)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ GIMP_TYPE_HISTOGRAM_CHANNEL, channel,
+ G_TYPE_DOUBLE, low_input,
+ G_TYPE_DOUBLE, high_input,
+ G_TYPE_BOOLEAN, clamp_input,
+ G_TYPE_DOUBLE, gamma,
+ G_TYPE_DOUBLE, low_output,
+ G_TYPE_DOUBLE, high_output,
+ G_TYPE_BOOLEAN, clamp_output,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-levels",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-levels",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_levels: (skip)
* @drawable_ID: The drawable.
* @channel: The channel to modify.
* @low_input: Intensity of lowest input.
@@ -632,15 +1272,15 @@ gimp_drawable_invert (gint32 drawable_ID,
* Since: 2.10
**/
gboolean
-gimp_drawable_levels (gint32 drawable_ID,
- GimpHistogramChannel channel,
- gdouble low_input,
- gdouble high_input,
- gboolean clamp_input,
- gdouble gamma,
- gdouble low_output,
- gdouble high_output,
- gboolean clamp_output)
+_gimp_drawable_levels (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gdouble low_input,
+ gdouble high_input,
+ gboolean clamp_input,
+ gdouble gamma,
+ gdouble low_output,
+ gdouble high_output,
+ gboolean clamp_output)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -677,6 +1317,48 @@ gimp_drawable_levels (gint32 drawable_ID,
/**
* gimp_drawable_levels_stretch:
+ * @drawable: The drawable.
+ *
+ * Automatically modifies intensity levels in the specified drawable.
+ *
+ * This procedure allows intensity levels in the specified drawable to
+ * be remapped according to a set of guessed parameters. It is
+ * equivalent to clicking the \"Auto\" button in the Levels tool.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_levels_stretch (GimpDrawable *drawable)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-levels-stretch",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-levels-stretch",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_levels_stretch: (skip)
* @drawable_ID: The drawable.
*
* Automatically modifies intensity levels in the specified drawable.
@@ -690,7 +1372,7 @@ gimp_drawable_levels (gint32 drawable_ID,
* Since: 2.10
**/
gboolean
-gimp_drawable_levels_stretch (gint32 drawable_ID)
+_gimp_drawable_levels_stretch (gint32 drawable_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -719,6 +1401,50 @@ gimp_drawable_levels_stretch (gint32 drawable_ID)
/**
* gimp_drawable_posterize:
+ * @drawable: The drawable.
+ * @levels: Levels of posterization.
+ *
+ * Posterize the specified drawable.
+ *
+ * This procedures reduces the number of shades allows in each
+ * intensity channel to the specified 'levels' parameter.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_posterize (GimpDrawable *drawable,
+ gint levels)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_INT, levels,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-posterize",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-posterize",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_posterize: (skip)
* @drawable_ID: The drawable.
* @levels: Levels of posterization.
*
@@ -732,8 +1458,8 @@ gimp_drawable_levels_stretch (gint32 drawable_ID)
* Since: 2.10
**/
gboolean
-gimp_drawable_posterize (gint32 drawable_ID,
- gint levels)
+_gimp_drawable_posterize (gint32 drawable_ID,
+ gint levels)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -763,6 +1489,58 @@ gimp_drawable_posterize (gint32 drawable_ID,
/**
* gimp_drawable_threshold:
+ * @drawable: The drawable.
+ * @channel: The channel to base the threshold on.
+ * @low_threshold: The low threshold value.
+ * @high_threshold: The high threshold value.
+ *
+ * Threshold the specified drawable.
+ *
+ * This procedures generates a threshold map of the specified drawable.
+ * All pixels between the values of 'low_threshold' and
+ * 'high_threshold', on the scale of 'channel' are replaced with white,
+ * and all other pixels with black.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_threshold (GimpDrawable *drawable,
+ GimpHistogramChannel channel,
+ gdouble low_threshold,
+ gdouble high_threshold)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ GIMP_TYPE_HISTOGRAM_CHANNEL, channel,
+ G_TYPE_DOUBLE, low_threshold,
+ G_TYPE_DOUBLE, high_threshold,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-threshold",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-threshold",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_threshold: (skip)
* @drawable_ID: The drawable.
* @channel: The channel to base the threshold on.
* @low_threshold: The low threshold value.
@@ -780,10 +1558,10 @@ gimp_drawable_posterize (gint32 drawable_ID,
* Since: 2.10
**/
gboolean
-gimp_drawable_threshold (gint32 drawable_ID,
- GimpHistogramChannel channel,
- gdouble low_threshold,
- gdouble high_threshold)
+_gimp_drawable_threshold (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gdouble low_threshold,
+ gdouble high_threshold)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
diff --git a/libgimp/gimpdrawablecolor_pdb.h b/libgimp/gimpdrawablecolor_pdb.h
index 3a7be30253..c5fdacc834 100644
--- a/libgimp/gimpdrawablecolor_pdb.h
+++ b/libgimp/gimpdrawablecolor_pdb.h
@@ -32,32 +32,36 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gboolean gimp_drawable_brightness_contrast (gint32 drawable_ID,
+
+
+#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+
+gboolean gimp_drawable_brightness_contrast (GimpDrawable *drawable,
gdouble brightness,
gdouble contrast);
-gboolean gimp_drawable_color_balance (gint32 drawable_ID,
+gboolean gimp_drawable_color_balance (GimpDrawable *drawable,
GimpTransferMode transfer_mode,
gboolean preserve_lum,
gdouble cyan_red,
gdouble magenta_green,
gdouble yellow_blue);
-gboolean gimp_drawable_colorize_hsl (gint32 drawable_ID,
+gboolean gimp_drawable_colorize_hsl (GimpDrawable *drawable,
gdouble hue,
gdouble saturation,
gdouble lightness);
-gboolean gimp_drawable_curves_explicit (gint32 drawable_ID,
+gboolean gimp_drawable_curves_explicit (GimpDrawable *drawable,
GimpHistogramChannel channel,
gint num_values,
const gdouble *values);
-gboolean gimp_drawable_curves_spline (gint32 drawable_ID,
+gboolean gimp_drawable_curves_spline (GimpDrawable *drawable,
GimpHistogramChannel channel,
gint num_points,
const gdouble *points);
-gboolean gimp_drawable_desaturate (gint32 drawable_ID,
+gboolean gimp_drawable_desaturate (GimpDrawable *drawable,
GimpDesaturateMode desaturate_mode);
-gboolean gimp_drawable_equalize (gint32 drawable_ID,
+gboolean gimp_drawable_equalize (GimpDrawable *drawable,
gboolean mask_only);
-gboolean gimp_drawable_histogram (gint32 drawable_ID,
+gboolean gimp_drawable_histogram (GimpDrawable *drawable,
GimpHistogramChannel channel,
gdouble start_range,
gdouble end_range,
@@ -67,15 +71,15 @@ gboolean gimp_drawable_histogram (gint32 drawable_ID,
gdouble *pixels,
gdouble *count,
gdouble *percentile);
-gboolean gimp_drawable_hue_saturation (gint32 drawable_ID,
+gboolean gimp_drawable_hue_saturation (GimpDrawable *drawable,
GimpHueRange hue_range,
gdouble hue_offset,
gdouble lightness,
gdouble saturation,
gdouble overlap);
-gboolean gimp_drawable_invert (gint32 drawable_ID,
+gboolean gimp_drawable_invert (GimpDrawable *drawable,
gboolean linear);
-gboolean gimp_drawable_levels (gint32 drawable_ID,
+gboolean gimp_drawable_levels (GimpDrawable *drawable,
GimpHistogramChannel channel,
gdouble low_input,
gdouble high_input,
@@ -84,20 +88,30 @@ gboolean gimp_drawable_levels (gint32 drawable_ID,
gdouble low_output,
gdouble high_output,
gboolean clamp_output);
-gboolean gimp_drawable_levels_stretch (gint32 drawable_ID);
-gboolean gimp_drawable_posterize (gint32 drawable_ID,
+gboolean gimp_drawable_levels_stretch (GimpDrawable *drawable);
+gboolean gimp_drawable_posterize (GimpDrawable *drawable,
gint levels);
-gboolean gimp_drawable_threshold (gint32 drawable_ID,
+gboolean gimp_drawable_threshold (GimpDrawable *drawable,
GimpHistogramChannel channel,
gdouble low_threshold,
gdouble high_threshold);
-#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
-
-
-
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
+#define gimp_drawable_brightness_contrast _gimp_drawable_brightness_contrast
+#define gimp_drawable_color_balance _gimp_drawable_color_balance
+#define gimp_drawable_colorize_hsl _gimp_drawable_colorize_hsl
+#define gimp_drawable_curves_explicit _gimp_drawable_curves_explicit
+#define gimp_drawable_curves_spline _gimp_drawable_curves_spline
+#define gimp_drawable_desaturate _gimp_drawable_desaturate
+#define gimp_drawable_equalize _gimp_drawable_equalize
+#define gimp_drawable_histogram _gimp_drawable_histogram
+#define gimp_drawable_hue_saturation _gimp_drawable_hue_saturation
+#define gimp_drawable_invert _gimp_drawable_invert
+#define gimp_drawable_levels _gimp_drawable_levels
+#define gimp_drawable_levels_stretch _gimp_drawable_levels_stretch
+#define gimp_drawable_posterize _gimp_drawable_posterize
+#define gimp_drawable_threshold _gimp_drawable_threshold
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@@ -106,7 +120,65 @@ gboolean gimp_drawable_threshold (gint32 drawable_ID,
* They are not marked internal as a trick to keep the old API alive for now.
*/
-
+gboolean _gimp_drawable_brightness_contrast (gint32 drawable_ID,
+ gdouble brightness,
+ gdouble contrast);
+gboolean _gimp_drawable_color_balance (gint32 drawable_ID,
+ GimpTransferMode transfer_mode,
+ gboolean preserve_lum,
+ gdouble cyan_red,
+ gdouble magenta_green,
+ gdouble yellow_blue);
+gboolean _gimp_drawable_colorize_hsl (gint32 drawable_ID,
+ gdouble hue,
+ gdouble saturation,
+ gdouble lightness);
+gboolean _gimp_drawable_curves_explicit (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint num_values,
+ const gdouble *values);
+gboolean _gimp_drawable_curves_spline (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gint num_points,
+ const gdouble *points);
+gboolean _gimp_drawable_desaturate (gint32 drawable_ID,
+ GimpDesaturateMode desaturate_mode);
+gboolean _gimp_drawable_equalize (gint32 drawable_ID,
+ gboolean mask_only);
+gboolean _gimp_drawable_histogram (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gdouble start_range,
+ gdouble end_range,
+ gdouble *mean,
+ gdouble *std_dev,
+ gdouble *median,
+ gdouble *pixels,
+ gdouble *count,
+ gdouble *percentile);
+gboolean _gimp_drawable_hue_saturation (gint32 drawable_ID,
+ GimpHueRange hue_range,
+ gdouble hue_offset,
+ gdouble lightness,
+ gdouble saturation,
+ gdouble overlap);
+gboolean _gimp_drawable_invert (gint32 drawable_ID,
+ gboolean linear);
+gboolean _gimp_drawable_levels (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gdouble low_input,
+ gdouble high_input,
+ gboolean clamp_input,
+ gdouble gamma,
+ gdouble low_output,
+ gdouble high_output,
+ gboolean clamp_output);
+gboolean _gimp_drawable_levels_stretch (gint32 drawable_ID);
+gboolean _gimp_drawable_posterize (gint32 drawable_ID,
+ gint levels);
+gboolean _gimp_drawable_threshold (gint32 drawable_ID,
+ GimpHistogramChannel channel,
+ gdouble low_threshold,
+ gdouble high_threshold);
G_END_DECLS
diff --git a/libgimp/gimpdrawableedit_pdb.c b/libgimp/gimpdrawableedit_pdb.c
index 8ca9fe6cf7..b570bbbd21 100644
--- a/libgimp/gimpdrawableedit_pdb.c
+++ b/libgimp/gimpdrawableedit_pdb.c
@@ -36,6 +36,51 @@
/**
* gimp_drawable_edit_clear:
+ * @drawable: The drawable to clear from.
+ *
+ * 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.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_background().
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_edit_clear (GimpDrawable *drawable)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-edit-clear",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-edit-clear",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_edit_clear: (skip)
* @drawable_ID: The drawable to clear from.
*
* Clear selected area of drawable.
@@ -52,7 +97,7 @@
* Returns: TRUE on success.
**/
gboolean
-gimp_drawable_edit_clear (gint32 drawable_ID)
+_gimp_drawable_edit_clear (gint32 drawable_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -81,6 +126,55 @@ gimp_drawable_edit_clear (gint32 drawable_ID)
/**
* gimp_drawable_edit_fill:
+ * @drawable: The drawable to fill to.
+ * @fill_type: The type of fill.
+ *
+ * Fill selected area of drawable.
+ *
+ * This procedure fills the specified drawable according to fill mode.
+ * 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().
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
+ * gimp_context_set_foreground(), gimp_context_set_background(),
+ * gimp_context_set_pattern().
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_edit_fill (GimpDrawable *drawable,
+ GimpFillType fill_type)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ GIMP_TYPE_FILL_TYPE, fill_type,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-edit-fill",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-edit-fill",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_edit_fill: (skip)
* @drawable_ID: The drawable to fill to.
* @fill_type: The type of fill.
*
@@ -99,8 +193,8 @@ gimp_drawable_edit_clear (gint32 drawable_ID)
* Returns: TRUE on success.
**/
gboolean
-gimp_drawable_edit_fill (gint32 drawable_ID,
- GimpFillType fill_type)
+_gimp_drawable_edit_fill (gint32 drawable_ID,
+ GimpFillType fill_type)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -130,6 +224,67 @@ gimp_drawable_edit_fill (gint32 drawable_ID,
/**
* gimp_drawable_edit_bucket_fill:
+ * @drawable: The affected drawable.
+ * @fill_type: The type of fill.
+ * @x: The x coordinate of this bucket fill's application.
+ * @y: The y coordinate of this bucket fill's application.
+ *
+ * Fill the area by a seed fill starting at the specified coordinates.
+ *
+ * This procedure does a seed fill at the specified coordinates, using
+ * various parameters from the current context.
+ * 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.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
+ * gimp_context_set_foreground(), gimp_context_set_background(),
+ * gimp_context_set_pattern(), gimp_context_set_sample_threshold(),
+ * gimp_context_set_sample_merged(),
+ * gimp_context_set_sample_criterion(),
+ * gimp_context_set_diagonal_neighbors(), gimp_context_set_antialias().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_edit_bucket_fill (GimpDrawable *drawable,
+ GimpFillType fill_type,
+ gdouble x,
+ gdouble y)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ GIMP_TYPE_FILL_TYPE, fill_type,
+ G_TYPE_DOUBLE, x,
+ G_TYPE_DOUBLE, y,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-edit-bucket-fill",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-edit-bucket-fill",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_edit_bucket_fill: (skip)
* @drawable_ID: The affected drawable.
* @fill_type: The type of fill.
* @x: The x coordinate of this bucket fill's application.
@@ -156,10 +311,10 @@ gimp_drawable_edit_fill (gint32 drawable_ID,
* Since: 2.10
**/
gboolean
-gimp_drawable_edit_bucket_fill (gint32 drawable_ID,
- GimpFillType fill_type,
- gdouble x,
- gdouble y)
+_gimp_drawable_edit_bucket_fill (gint32 drawable_ID,
+ GimpFillType fill_type,
+ gdouble x,
+ gdouble y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -191,6 +346,87 @@ gimp_drawable_edit_bucket_fill (gint32 drawable_ID,
/**
* gimp_drawable_edit_gradient_fill:
+ * @drawable: The affected drawable.
+ * @gradient_type: The type of gradient.
+ * @offset: Offset relates to the starting and ending coordinates specified for the blend. This parameter is
mode dependent.
+ * @supersample: Do adaptive supersampling.
+ * @supersample_max_depth: Maximum recursion levels for supersampling.
+ * @supersample_threshold: Supersampling threshold.
+ * @dither: Use dithering to reduce banding.
+ * @x1: The x coordinate of this gradient's starting point.
+ * @y1: The y coordinate of this gradient's starting point.
+ * @x2: The x coordinate of this gradient's ending point.
+ * @y2: The y coordinate of this gradient's ending point.
+ *
+ * Draw a gradient between the starting and ending coordinates with the
+ * specified gradient type.
+ *
+ * This tool requires information on the gradient type. It creates the
+ * specified variety of gradient using the starting and ending
+ * coordinates as defined for each gradient type. For shapeburst
+ * gradient types, the context's distance metric is also relevant and
+ * can be updated with gimp_context_set_distance_metric().
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
+ * gimp_context_set_foreground(), gimp_context_set_background(),
+ * gimp_context_set_gradient() and all gradient property settings,
+ * gimp_context_set_distance_metric().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_edit_gradient_fill (GimpDrawable *drawable,
+ GimpGradientType gradient_type,
+ gdouble offset,
+ gboolean supersample,
+ gint supersample_max_depth,
+ gdouble supersample_threshold,
+ gboolean dither,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ GIMP_TYPE_GRADIENT_TYPE, gradient_type,
+ G_TYPE_DOUBLE, offset,
+ G_TYPE_BOOLEAN, supersample,
+ G_TYPE_INT, supersample_max_depth,
+ G_TYPE_DOUBLE, supersample_threshold,
+ G_TYPE_BOOLEAN, dither,
+ G_TYPE_DOUBLE, x1,
+ G_TYPE_DOUBLE, y1,
+ G_TYPE_DOUBLE, x2,
+ G_TYPE_DOUBLE, y2,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-edit-gradient-fill",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-edit-gradient-fill",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_edit_gradient_fill: (skip)
* @drawable_ID: The affected drawable.
* @gradient_type: The type of gradient.
* @offset: Offset relates to the starting and ending coordinates specified for the blend. This parameter is
mode dependent.
@@ -223,17 +459,17 @@ gimp_drawable_edit_bucket_fill (gint32 drawable_ID,
* Since: 2.10
**/
gboolean
-gimp_drawable_edit_gradient_fill (gint32 drawable_ID,
- GimpGradientType gradient_type,
- gdouble offset,
- gboolean supersample,
- gint supersample_max_depth,
- gdouble supersample_threshold,
- gboolean dither,
- gdouble x1,
- gdouble y1,
- gdouble x2,
- gdouble y2)
+_gimp_drawable_edit_gradient_fill (gint32 drawable_ID,
+ GimpGradientType gradient_type,
+ gdouble offset,
+ gboolean supersample,
+ gint supersample_max_depth,
+ gdouble supersample_threshold,
+ gboolean dither,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -272,6 +508,55 @@ gimp_drawable_edit_gradient_fill (gint32 drawable_ID,
/**
* gimp_drawable_edit_stroke_selection:
+ * @drawable: The drawable to stroke to.
+ *
+ * Stroke the current selection
+ *
+ * This procedure strokes the current selection, painting along the
+ * selection boundary with the active paint method and brush, or using
+ * a plain line with configurable properties. The paint is applied to
+ * the specified drawable regardless of the active selection.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
+ * gimp_context_set_paint_method(), gimp_context_set_stroke_method(),
+ * gimp_context_set_foreground(), gimp_context_set_brush() and all
+ * brush property settings, gimp_context_set_gradient() and all
+ * gradient property settings, gimp_context_set_line_width() and all
+ * line property settings, gimp_context_set_antialias().
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_drawable_edit_stroke_selection (GimpDrawable *drawable)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-edit-stroke-selection",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-edit-stroke-selection",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_edit_stroke_selection: (skip)
* @drawable_ID: The drawable to stroke to.
*
* Stroke the current selection
@@ -292,7 +577,7 @@ gimp_drawable_edit_gradient_fill (gint32 drawable_ID,
* Returns: TRUE on success.
**/
gboolean
-gimp_drawable_edit_stroke_selection (gint32 drawable_ID)
+_gimp_drawable_edit_stroke_selection (gint32 drawable_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -321,6 +606,60 @@ gimp_drawable_edit_stroke_selection (gint32 drawable_ID)
/**
* gimp_drawable_edit_stroke_item:
+ * @drawable: The drawable to stroke to.
+ * @item: The item to stroke.
+ *
+ * Stroke the specified item
+ *
+ * This procedure strokes the specified item, painting along its
+ * outline (e.g. along a path, or along a channel's boundary), with the
+ * active paint method and brush, or using a plain line with
+ * configurable properties.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_opacity(), gimp_context_set_paint_mode(),
+ * gimp_context_set_paint_method(), gimp_context_set_stroke_method(),
+ * gimp_context_set_foreground(), gimp_context_set_brush() and all
+ * brush property settings, gimp_context_set_gradient() and all
+ * gradient property settings, gimp_context_set_line_width() and all
+ * line property settings, gimp_context_set_antialias().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_drawable_edit_stroke_item (GimpDrawable *drawable,
+ GimpItem *item)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-drawable-edit-stroke-item",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-drawable-edit-stroke-item",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_drawable_edit_stroke_item: (skip)
* @drawable_ID: The drawable to stroke to.
* @item_ID: The item to stroke.
*
@@ -344,8 +683,8 @@ gimp_drawable_edit_stroke_selection (gint32 drawable_ID)
* Since: 2.10
**/
gboolean
-gimp_drawable_edit_stroke_item (gint32 drawable_ID,
- gint32 item_ID)
+_gimp_drawable_edit_stroke_item (gint32 drawable_ID,
+ gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
diff --git a/libgimp/gimpdrawableedit_pdb.h b/libgimp/gimpdrawableedit_pdb.h
index d3f23aa42f..8eec9ef43d 100644
--- a/libgimp/gimpdrawableedit_pdb.h
+++ b/libgimp/gimpdrawableedit_pdb.h
@@ -32,34 +32,40 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gboolean gimp_drawable_edit_clear (gint32 drawable_ID);
-gboolean gimp_drawable_edit_fill (gint32 drawable_ID,
- GimpFillType fill_type);
-gboolean gimp_drawable_edit_bucket_fill (gint32 drawable_ID,
- GimpFillType fill_type,
- gdouble x,
- gdouble y);
-gboolean gimp_drawable_edit_gradient_fill (gint32 drawable_ID,
- GimpGradientType gradient_type,
- gdouble offset,
- gboolean supersample,
- gint supersample_max_depth,
- gdouble supersample_threshold,
- gboolean dither,
- gdouble x1,
- gdouble y1,
- gdouble x2,
- gdouble y2);
-gboolean gimp_drawable_edit_stroke_selection (gint32 drawable_ID);
-gboolean gimp_drawable_edit_stroke_item (gint32 drawable_ID,
- gint32 item_ID);
-#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+gboolean gimp_drawable_edit_clear (GimpDrawable *drawable);
+gboolean gimp_drawable_edit_fill (GimpDrawable *drawable,
+ GimpFillType fill_type);
+gboolean gimp_drawable_edit_bucket_fill (GimpDrawable *drawable,
+ GimpFillType fill_type,
+ gdouble x,
+ gdouble y);
+gboolean gimp_drawable_edit_gradient_fill (GimpDrawable *drawable,
+ GimpGradientType gradient_type,
+ gdouble offset,
+ gboolean supersample,
+ gint supersample_max_depth,
+ gdouble supersample_threshold,
+ gboolean dither,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2);
+gboolean gimp_drawable_edit_stroke_selection (GimpDrawable *drawable);
+gboolean gimp_drawable_edit_stroke_item (GimpDrawable *drawable,
+ GimpItem *item);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
+#define gimp_drawable_edit_clear _gimp_drawable_edit_clear
+#define gimp_drawable_edit_fill _gimp_drawable_edit_fill
+#define gimp_drawable_edit_bucket_fill _gimp_drawable_edit_bucket_fill
+#define gimp_drawable_edit_gradient_fill _gimp_drawable_edit_gradient_fill
+#define gimp_drawable_edit_stroke_selection _gimp_drawable_edit_stroke_selection
+#define gimp_drawable_edit_stroke_item _gimp_drawable_edit_stroke_item
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@@ -68,7 +74,27 @@ gboolean gimp_drawable_edit_stroke_item (gint32 drawable_ID,
* They are not marked internal as a trick to keep the old API alive for now.
*/
-
+gboolean _gimp_drawable_edit_clear (gint32 drawable_ID);
+gboolean _gimp_drawable_edit_fill (gint32 drawable_ID,
+ GimpFillType fill_type);
+gboolean _gimp_drawable_edit_bucket_fill (gint32 drawable_ID,
+ GimpFillType fill_type,
+ gdouble x,
+ gdouble y);
+gboolean _gimp_drawable_edit_gradient_fill (gint32 drawable_ID,
+ GimpGradientType gradient_type,
+ gdouble offset,
+ gboolean supersample,
+ gint supersample_max_depth,
+ gdouble supersample_threshold,
+ gboolean dither,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2);
+gboolean _gimp_drawable_edit_stroke_selection (gint32 drawable_ID);
+gboolean _gimp_drawable_edit_stroke_item (gint32 drawable_ID,
+ gint32 item_ID);
G_END_DECLS
diff --git a/libgimp/gimpedit_pdb.c b/libgimp/gimpedit_pdb.c
index 4d459445e1..db17527177 100644
--- a/libgimp/gimpedit_pdb.c
+++ b/libgimp/gimpedit_pdb.c
@@ -36,6 +36,52 @@
/**
* gimp_edit_cut:
+ * @drawable: The drawable to cut from.
+ *
+ * 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.
+ *
+ * Returns: TRUE if the cut was successful, FALSE if there was nothing to copy from.
+ **/
+gboolean
+gimp_edit_cut (GimpDrawable *drawable)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean non_empty = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-edit-cut",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-edit-cut",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return non_empty;
+}
+
+/**
+ * _gimp_edit_cut: (skip)
* @drawable_ID: The drawable to cut from.
*
* Cut from the specified drawable.
@@ -52,7 +98,7 @@
* Returns: TRUE if the cut was successful, FALSE if there was nothing to copy from.
**/
gboolean
-gimp_edit_cut (gint32 drawable_ID)
+_gimp_edit_cut (gint32 drawable_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -82,6 +128,52 @@ gimp_edit_cut (gint32 drawable_ID)
/**
* gimp_edit_copy:
+ * @drawable: The drawable to copy from.
+ *
+ * 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.
+ *
+ * Returns: TRUE if the cut was successful, FALSE if there was nothing to copy from.
+ **/
+gboolean
+gimp_edit_copy (GimpDrawable *drawable)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean non_empty = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-edit-copy",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-edit-copy",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ non_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return non_empty;
+}
+
+/**
+ * _gimp_edit_copy: (skip)
* @drawable_ID: The drawable to copy from.
*
* Copy from the specified drawable.
@@ -98,7 +190,7 @@ gimp_edit_cut (gint32 drawable_ID)
* Returns: TRUE if the cut was successful, FALSE if there was nothing to copy from.
**/
gboolean
-gimp_edit_copy (gint32 drawable_ID)
+_gimp_edit_copy (gint32 drawable_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -220,6 +312,62 @@ _gimp_edit_copy_visible (gint32 image_ID)
/**
* gimp_edit_paste:
+ * @drawable: The drawable to paste to.
+ * @paste_into: Clear selection, or paste behind it?
+ *
+ * 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 its 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.
+ *
+ * Returns: (transfer full): The new floating selection.
+ **/
+GimpLayer *
+gimp_edit_paste (GimpDrawable *drawable,
+ gboolean paste_into)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpLayer *floating_sel = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_BOOLEAN, paste_into,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-edit-paste",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-edit-paste",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ floating_sel = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index
(return_vals, 1))));
+
+ gimp_value_array_unref (return_vals);
+
+ return floating_sel;
+}
+
+/**
+ * _gimp_edit_paste: (skip)
* @drawable_ID: The drawable to paste to.
* @paste_into: Clear selection, or paste behind it?
*
@@ -244,8 +392,8 @@ _gimp_edit_copy_visible (gint32 image_ID)
* Returns: The new floating selection.
**/
gint32
-gimp_edit_paste (gint32 drawable_ID,
- gboolean paste_into)
+_gimp_edit_paste (gint32 drawable_ID,
+ gboolean paste_into)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -360,7 +508,7 @@ _gimp_edit_paste_as_new_image (void)
/**
* gimp_edit_named_cut:
- * @drawable_ID: The drawable to cut from.
+ * @drawable: The drawable to cut from.
* @buffer_name: The name of the buffer to create.
*
* Cut into a named buffer.
@@ -377,8 +525,56 @@ _gimp_edit_paste_as_new_image (void)
* Since: 2.4
**/
gchar *
-gimp_edit_named_cut (gint32 drawable_ID,
- const gchar *buffer_name)
+gimp_edit_named_cut (GimpDrawable *drawable,
+ const gchar *buffer_name)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *real_name = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_STRING, buffer_name,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-edit-named-cut",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-edit-named-cut",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ real_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return real_name;
+}
+
+/**
+ * _gimp_edit_named_cut: (skip)
+ * @drawable_ID: The drawable to cut from.
+ * @buffer_name: The name of the buffer to create.
+ *
+ * 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.
+ *
+ * Returns: The real name given to the buffer, or NULL if the cut failed.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.4
+ **/
+gchar *
+_gimp_edit_named_cut (gint32 drawable_ID,
+ const gchar *buffer_name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -409,7 +605,7 @@ gimp_edit_named_cut (gint32 drawable_ID,
/**
* gimp_edit_named_copy:
- * @drawable_ID: The drawable to copy from.
+ * @drawable: The drawable to copy from.
* @buffer_name: The name of the buffer to create.
*
* Copy into a named buffer.
@@ -426,8 +622,56 @@ gimp_edit_named_cut (gint32 drawable_ID,
* Since: 2.4
**/
gchar *
-gimp_edit_named_copy (gint32 drawable_ID,
- const gchar *buffer_name)
+gimp_edit_named_copy (GimpDrawable *drawable,
+ const gchar *buffer_name)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *real_name = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_STRING, buffer_name,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-edit-named-copy",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-edit-named-copy",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ real_name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return real_name;
+}
+
+/**
+ * _gimp_edit_named_copy: (skip)
+ * @drawable_ID: The drawable to copy from.
+ * @buffer_name: The name of the buffer to create.
+ *
+ * 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.
+ *
+ * Returns: The real name given to the buffer, or NULL if the copy failed.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.4
+ **/
+gchar *
+_gimp_edit_named_copy (gint32 drawable_ID,
+ const gchar *buffer_name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -555,6 +799,54 @@ _gimp_edit_named_copy_visible (gint32 image_ID,
/**
* gimp_edit_named_paste:
+ * @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.
+ *
+ * Returns: (transfer full): The new floating selection.
+ *
+ * Since: 2.4
+ **/
+GimpLayer *
+gimp_edit_named_paste (GimpDrawable *drawable,
+ const gchar *buffer_name,
+ gboolean paste_into)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpLayer *floating_sel = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_STRING, buffer_name,
+ G_TYPE_BOOLEAN, paste_into,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-edit-named-paste",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-edit-named-paste",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ floating_sel = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index
(return_vals, 1))));
+
+ gimp_value_array_unref (return_vals);
+
+ return floating_sel;
+}
+
+/**
+ * _gimp_edit_named_paste: (skip)
* @drawable_ID: The drawable to paste to.
* @buffer_name: The name of the buffer to paste.
* @paste_into: Clear selection, or paste behind it?
@@ -569,9 +861,9 @@ _gimp_edit_named_copy_visible (gint32 image_ID,
* Since: 2.4
**/
gint32
-gimp_edit_named_paste (gint32 drawable_ID,
- const gchar *buffer_name,
- gboolean paste_into)
+_gimp_edit_named_paste (gint32 drawable_ID,
+ const gchar *buffer_name,
+ gboolean paste_into)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
diff --git a/libgimp/gimpedit_pdb.h b/libgimp/gimpedit_pdb.h
index de5cfab9b7..2326b01136 100644
--- a/libgimp/gimpedit_pdb.h
+++ b/libgimp/gimpedit_pdb.h
@@ -32,31 +32,38 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gboolean gimp_edit_cut (gint32 drawable_ID);
-gboolean gimp_edit_copy (gint32 drawable_ID);
-gint32 gimp_edit_paste (gint32 drawable_ID,
- gboolean paste_into);
-gchar* gimp_edit_named_cut (gint32 drawable_ID,
- const gchar *buffer_name);
-gchar* gimp_edit_named_copy (gint32 drawable_ID,
- const gchar *buffer_name);
-gint32 gimp_edit_named_paste (gint32 drawable_ID,
- const gchar *buffer_name,
- gboolean paste_into);
+
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
-gboolean gimp_edit_copy_visible (GimpImage *image);
+gboolean gimp_edit_cut (GimpDrawable *drawable);
+gboolean gimp_edit_copy (GimpDrawable *drawable);
+gboolean gimp_edit_copy_visible (GimpImage *image);
+GimpLayer* gimp_edit_paste (GimpDrawable *drawable,
+ gboolean paste_into);
GimpImage* gimp_edit_paste_as_new_image (void);
-gchar* gimp_edit_named_copy_visible (GimpImage *image,
- const gchar *buffer_name);
-GimpImage* gimp_edit_named_paste_as_new_image (const gchar *buffer_name);
+gchar* gimp_edit_named_cut (GimpDrawable *drawable,
+ const gchar *buffer_name);
+gchar* gimp_edit_named_copy (GimpDrawable *drawable,
+ const gchar *buffer_name);
+gchar* gimp_edit_named_copy_visible (GimpImage *image,
+ const gchar *buffer_name);
+GimpLayer* gimp_edit_named_paste (GimpDrawable *drawable,
+ const gchar *buffer_name,
+ gboolean paste_into);
+GimpImage* gimp_edit_named_paste_as_new_image (const gchar *buffer_name);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
+#define gimp_edit_cut _gimp_edit_cut
+#define gimp_edit_copy _gimp_edit_copy
#define gimp_edit_copy_visible _gimp_edit_copy_visible
+#define gimp_edit_paste _gimp_edit_paste
#define gimp_edit_paste_as_new_image _gimp_edit_paste_as_new_image
+#define gimp_edit_named_cut _gimp_edit_named_cut
+#define gimp_edit_named_copy _gimp_edit_named_copy
#define gimp_edit_named_copy_visible _gimp_edit_named_copy_visible
+#define gimp_edit_named_paste _gimp_edit_named_paste
#define gimp_edit_named_paste_as_new_image _gimp_edit_named_paste_as_new_image
@@ -66,10 +73,21 @@ GimpImage* gimp_edit_named_paste_as_new_image (const gchar *buffer_name);
* They are not marked internal as a trick to keep the old API alive for now.
*/
+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_image (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_image (const gchar *buffer_name);
diff --git a/libgimp/gimpfileops_pdb.c b/libgimp/gimpfileops_pdb.c
index 794da05541..7ae4f8b035 100644
--- a/libgimp/gimpfileops_pdb.c
+++ b/libgimp/gimpfileops_pdb.c
@@ -149,11 +149,11 @@ _gimp_file_load (GimpRunMode run_mode,
* needs to be added to the existing image with
* gimp_image_insert_layer().
*
- * Returns: The layer created when loading the image file.
+ * Returns: (transfer full): The layer created when loading the image file.
*
* Since: 2.4
**/
-gint32
+GimpLayer *
gimp_file_load_layer (GimpRunMode run_mode,
GimpImage *image,
const gchar *filename)
@@ -161,7 +161,7 @@ gimp_file_load_layer (GimpRunMode run_mode,
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 layer_ID = -1;
+ GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_RUN_MODE, run_mode,
@@ -179,11 +179,11 @@ gimp_file_load_layer (GimpRunMode run_mode,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
+ layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals,
1))));
gimp_value_array_unref (return_vals);
- return layer_ID;
+ return layer;
}
/**
@@ -357,7 +357,7 @@ _gimp_file_load_layers (GimpRunMode run_mode,
* gimp_file_save:
* @run_mode: The run mode.
* @image: Input image.
- * @drawable_ID: Drawable to save.
+ * @drawable: Drawable to save.
* @filename: The name of the file to save the image in.
* @raw_filename: The name as entered by the user.
*
@@ -374,11 +374,11 @@ _gimp_file_load_layers (GimpRunMode run_mode,
* Returns: TRUE on success.
**/
gboolean
-gimp_file_save (GimpRunMode run_mode,
- GimpImage *image,
- gint32 drawable_ID,
- const gchar *filename,
- const gchar *raw_filename)
+gimp_file_save (GimpRunMode run_mode,
+ GimpImage *image,
+ GimpDrawable *drawable,
+ const gchar *filename,
+ const gchar *raw_filename)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -388,7 +388,7 @@ gimp_file_save (GimpRunMode run_mode,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_RUN_MODE, run_mode,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_STRING, filename,
G_TYPE_STRING, raw_filename,
G_TYPE_NONE);
diff --git a/libgimp/gimpfileops_pdb.h b/libgimp/gimpfileops_pdb.h
index 811e92f51d..4574c7cb66 100644
--- a/libgimp/gimpfileops_pdb.h
+++ b/libgimp/gimpfileops_pdb.h
@@ -53,23 +53,23 @@ G_GNUC_INTERNAL gboolean _gimp_register_thumbnail_loader (const gchar *load
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
-GimpImage* gimp_file_load (GimpRunMode run_mode,
- const gchar *filename,
- const gchar *raw_filename);
-gint32 gimp_file_load_layer (GimpRunMode run_mode,
- GimpImage *image,
- const gchar *filename);
-gint* gimp_file_load_layers (GimpRunMode run_mode,
- GimpImage *image,
- const gchar *filename,
- gint *num_layers);
-gboolean gimp_file_save (GimpRunMode run_mode,
- GimpImage *image,
- gint32 drawable_ID,
- const gchar *filename,
- const gchar *raw_filename);
-gboolean gimp_file_save_thumbnail (GimpImage *image,
- const gchar *filename);
+GimpImage* gimp_file_load (GimpRunMode run_mode,
+ const gchar *filename,
+ const gchar *raw_filename);
+GimpLayer* gimp_file_load_layer (GimpRunMode run_mode,
+ GimpImage *image,
+ const gchar *filename);
+gint* gimp_file_load_layers (GimpRunMode run_mode,
+ GimpImage *image,
+ const gchar *filename,
+ gint *num_layers);
+gboolean gimp_file_save (GimpRunMode run_mode,
+ GimpImage *image,
+ GimpDrawable *drawable,
+ const gchar *filename,
+ const gchar *raw_filename);
+gboolean gimp_file_save_thumbnail (GimpImage *image,
+ const gchar *filename);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
diff --git a/libgimp/gimpfloatingsel_pdb.c b/libgimp/gimpfloatingsel_pdb.c
index 29c1b77ee3..e14c58a891 100644
--- a/libgimp/gimpfloatingsel_pdb.c
+++ b/libgimp/gimpfloatingsel_pdb.c
@@ -36,6 +36,46 @@
/**
* gimp_floating_sel_remove:
+ * @floating_sel: The floating selection.
+ *
+ * Remove the specified floating selection from its associated
+ * drawable.
+ *
+ * This procedure removes the floating selection completely, without
+ * any side effects. The associated drawable is then set to active.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_floating_sel_remove (GimpLayer *floating_sel)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (floating_sel)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-floating-sel-remove",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-floating-sel-remove",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_floating_sel_remove: (skip)
* @floating_sel_ID: The floating selection.
*
* Remove the specified floating selection from its associated
@@ -47,7 +87,7 @@
* Returns: TRUE on success.
**/
gboolean
-gimp_floating_sel_remove (gint32 floating_sel_ID)
+_gimp_floating_sel_remove (gint32 floating_sel_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -76,6 +116,47 @@ gimp_floating_sel_remove (gint32 floating_sel_ID)
/**
* gimp_floating_sel_anchor:
+ * @floating_sel: The floating selection.
+ *
+ * Anchor the specified floating selection to its associated drawable.
+ *
+ * This procedure anchors the floating selection to its associated
+ * drawable. This is similar to merging with a merge type of
+ * ClipToBottomLayer. The floating selection layer is no longer valid
+ * after this operation.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_floating_sel_anchor (GimpLayer *floating_sel)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (floating_sel)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-floating-sel-anchor",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-floating-sel-anchor",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_floating_sel_anchor: (skip)
* @floating_sel_ID: The floating selection.
*
* Anchor the specified floating selection to its associated drawable.
@@ -88,7 +169,7 @@ gimp_floating_sel_remove (gint32 floating_sel_ID)
* Returns: TRUE on success.
**/
gboolean
-gimp_floating_sel_anchor (gint32 floating_sel_ID)
+_gimp_floating_sel_anchor (gint32 floating_sel_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -117,6 +198,51 @@ gimp_floating_sel_anchor (gint32 floating_sel_ID)
/**
* gimp_floating_sel_to_layer:
+ * @floating_sel: The floating selection.
+ *
+ * Transforms the specified floating selection into a layer.
+ *
+ * This procedure transforms the specified floating selection into a
+ * layer with the same offsets and extents. The composited image will
+ * look precisely the same, but the floating selection layer will no
+ * longer be clipped to the extents of the drawable it was attached to.
+ * The floating selection will become the active layer. This procedure
+ * will not work if the floating selection has a different base type
+ * from the underlying image. This might be the case if the floating
+ * selection is above an auxiliary channel or a layer mask.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_floating_sel_to_layer (GimpLayer *floating_sel)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (floating_sel)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-floating-sel-to-layer",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-floating-sel-to-layer",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_floating_sel_to_layer: (skip)
* @floating_sel_ID: The floating selection.
*
* Transforms the specified floating selection into a layer.
@@ -133,7 +259,7 @@ gimp_floating_sel_anchor (gint32 floating_sel_ID)
* Returns: TRUE on success.
**/
gboolean
-gimp_floating_sel_to_layer (gint32 floating_sel_ID)
+_gimp_floating_sel_to_layer (gint32 floating_sel_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -162,6 +288,48 @@ gimp_floating_sel_to_layer (gint32 floating_sel_ID)
/**
* gimp_floating_sel_attach:
+ * @layer: The layer (is attached as floating selection).
+ * @drawable: The drawable (where to attach the floating selection).
+ *
+ * Attach the specified layer as floating to the specified drawable.
+ *
+ * This procedure attaches the layer as floating selection to the
+ * drawable.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_floating_sel_attach (GimpLayer *layer,
+ GimpDrawable *drawable)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-floating-sel-attach",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-floating-sel-attach",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_floating_sel_attach: (skip)
* @layer_ID: The layer (is attached as floating selection).
* @drawable_ID: The drawable (where to attach the floating selection).
*
@@ -173,8 +341,8 @@ gimp_floating_sel_to_layer (gint32 floating_sel_ID)
* Returns: TRUE on success.
**/
gboolean
-gimp_floating_sel_attach (gint32 layer_ID,
- gint32 drawable_ID)
+_gimp_floating_sel_attach (gint32 layer_ID,
+ gint32 drawable_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
diff --git a/libgimp/gimpfloatingsel_pdb.h b/libgimp/gimpfloatingsel_pdb.h
index b8f9e631ae..38d557a34b 100644
--- a/libgimp/gimpfloatingsel_pdb.h
+++ b/libgimp/gimpfloatingsel_pdb.h
@@ -32,18 +32,22 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gboolean gimp_floating_sel_remove (gint32 floating_sel_ID);
-gboolean gimp_floating_sel_anchor (gint32 floating_sel_ID);
-gboolean gimp_floating_sel_to_layer (gint32 floating_sel_ID);
-gboolean gimp_floating_sel_attach (gint32 layer_ID,
- gint32 drawable_ID);
-#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+gboolean gimp_floating_sel_remove (GimpLayer *floating_sel);
+gboolean gimp_floating_sel_anchor (GimpLayer *floating_sel);
+gboolean gimp_floating_sel_to_layer (GimpLayer *floating_sel);
+gboolean gimp_floating_sel_attach (GimpLayer *layer,
+ GimpDrawable *drawable);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
+#define gimp_floating_sel_remove _gimp_floating_sel_remove
+#define gimp_floating_sel_anchor _gimp_floating_sel_anchor
+#define gimp_floating_sel_to_layer _gimp_floating_sel_to_layer
+#define gimp_floating_sel_attach _gimp_floating_sel_attach
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@@ -52,7 +56,11 @@ gboolean gimp_floating_sel_attach (gint32 layer_ID,
* They are not marked internal as a trick to keep the old API alive for now.
*/
-
+gboolean _gimp_floating_sel_remove (gint32 floating_sel_ID);
+gboolean _gimp_floating_sel_anchor (gint32 floating_sel_ID);
+gboolean _gimp_floating_sel_to_layer (gint32 floating_sel_ID);
+gboolean _gimp_floating_sel_attach (gint32 layer_ID,
+ gint32 drawable_ID);
G_END_DECLS
diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c
index b3970d9e77..4221e39cc6 100644
--- a/libgimp/gimpimage_pdb.c
+++ b/libgimp/gimpimage_pdb.c
@@ -1267,15 +1267,15 @@ _gimp_image_get_vectors (gint32 image_ID,
* layer mask and the layer mask is in edit mode, then the layer mask
* is the active drawable.
*
- * Returns: The active drawable.
+ * Returns: (transfer full): The active drawable.
**/
-gint32
+GimpDrawable *
gimp_image_get_active_drawable (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 drawable_ID = -1;
+ GimpDrawable *drawable = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@@ -1291,11 +1291,11 @@ gimp_image_get_active_drawable (GimpImage *image)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- drawable_ID = gimp_value_get_drawable_id (gimp_value_array_index (return_vals, 1));
+ drawable = GIMP_DRAWABLE (gimp_item_new_by_id (gimp_value_get_drawable_id (gimp_value_array_index
(return_vals, 1))));
gimp_value_array_unref (return_vals);
- return drawable_ID;
+ return drawable;
}
/**
@@ -1433,15 +1433,15 @@ _gimp_image_unset_active_channel (gint32 image_ID)
* This procedure returns the image's floating selection, if it exists.
* If it doesn't exist, -1 is returned as the layer ID.
*
- * Returns: The image's floating selection.
+ * Returns: (transfer full): The image's floating selection.
**/
-gint32
+GimpLayer *
gimp_image_get_floating_sel (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 floating_sel_ID = -1;
+ GimpLayer *floating_sel = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@@ -1457,11 +1457,11 @@ gimp_image_get_floating_sel (GimpImage *image)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- floating_sel_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
+ floating_sel = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index
(return_vals, 1))));
gimp_value_array_unref (return_vals);
- return floating_sel_ID;
+ return floating_sel;
}
/**
@@ -1514,15 +1514,16 @@ _gimp_image_get_floating_sel (gint32 image_ID)
* is attached to, if it exists. If it doesn't exist, -1 is returned as
* the drawable ID.
*
- * Returns: The drawable the floating selection is attached to.
+ * Returns: (transfer full):
+ * The drawable the floating selection is attached to.
**/
-gint32
+GimpDrawable *
gimp_image_floating_sel_attached_to (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 drawable_ID = -1;
+ GimpDrawable *drawable = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@@ -1538,11 +1539,11 @@ gimp_image_floating_sel_attached_to (GimpImage *image)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- drawable_ID = gimp_value_get_drawable_id (gimp_value_array_index (return_vals, 1));
+ drawable = GIMP_DRAWABLE (gimp_item_new_by_id (gimp_value_get_drawable_id (gimp_value_array_index
(return_vals, 1))));
gimp_value_array_unref (return_vals);
- return drawable_ID;
+ return drawable;
}
/**
@@ -1589,7 +1590,7 @@ _gimp_image_floating_sel_attached_to (gint32 image_ID)
/**
* gimp_image_pick_color:
* @image: The image.
- * @drawable_ID: The drawable to pick from.
+ * @drawable: The drawable to pick from.
* @x: x coordinate of upper-left corner of rectangle.
* @y: y coordinate of upper-left corner of rectangle.
* @sample_merged: Use the composite image, not the drawable.
@@ -1614,14 +1615,14 @@ _gimp_image_floating_sel_attached_to (gint32 image_ID)
* Returns: TRUE on success.
**/
gboolean
-gimp_image_pick_color (GimpImage *image,
- gint32 drawable_ID,
- gdouble x,
- gdouble y,
- gboolean sample_merged,
- gboolean sample_average,
- gdouble average_radius,
- GimpRGB *color)
+gimp_image_pick_color (GimpImage *image,
+ GimpDrawable *drawable,
+ gdouble x,
+ gdouble y,
+ gboolean sample_merged,
+ gboolean sample_average,
+ gdouble average_radius,
+ GimpRGB *color)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1630,7 +1631,7 @@ gimp_image_pick_color (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_DOUBLE, x,
G_TYPE_DOUBLE, y,
G_TYPE_BOOLEAN, sample_merged,
@@ -1742,9 +1743,9 @@ _gimp_image_pick_color (gint32 image_ID,
* at the specified coordinates. This procedure will return -1 if no
* layer is found.
*
- * Returns: The layer found at the specified coordinates.
+ * Returns: (transfer full): The layer found at the specified coordinates.
**/
-gint32
+GimpLayer *
gimp_image_pick_correlate_layer (GimpImage *image,
gint x,
gint y)
@@ -1752,7 +1753,7 @@ gimp_image_pick_correlate_layer (GimpImage *image,
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 layer_ID = -1;
+ GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@@ -1770,11 +1771,11 @@ gimp_image_pick_correlate_layer (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
+ layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals,
1))));
gimp_value_array_unref (return_vals);
- return layer_ID;
+ return layer;
}
/**
@@ -1829,8 +1830,8 @@ _gimp_image_pick_correlate_layer (gint32 image_ID,
/**
* gimp_image_insert_layer:
* @image: The image.
- * @layer_ID: The layer.
- * @parent_ID: The parent layer.
+ * @layer: The layer.
+ * @parent: The parent layer.
* @position: The layer position.
*
* Add the specified layer to the image.
@@ -1851,8 +1852,8 @@ _gimp_image_pick_correlate_layer (gint32 image_ID,
**/
gboolean
gimp_image_insert_layer (GimpImage *image,
- gint32 layer_ID,
- gint32 parent_ID,
+ GimpLayer *layer,
+ GimpLayer *parent,
gint position)
{
GimpPDB *pdb = gimp_get_pdb ();
@@ -1862,8 +1863,8 @@ gimp_image_insert_layer (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_LAYER_ID, layer_ID,
- GIMP_TYPE_LAYER_ID, parent_ID,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (parent)),
G_TYPE_INT, position,
G_TYPE_NONE);
@@ -1943,7 +1944,7 @@ _gimp_image_insert_layer (gint32 image_ID,
/**
* gimp_image_remove_layer:
* @image: The image.
- * @layer_ID: The layer.
+ * @layer: The layer.
*
* Remove the specified layer from the image.
*
@@ -1957,7 +1958,7 @@ _gimp_image_insert_layer (gint32 image_ID,
**/
gboolean
gimp_image_remove_layer (GimpImage *image,
- gint32 layer_ID)
+ GimpLayer *layer)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1966,7 +1967,7 @@ gimp_image_remove_layer (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
G_TYPE_NONE);
if (pdb)
@@ -2957,7 +2958,7 @@ _gimp_image_thaw_vectors (gint32 image_ID)
/**
* gimp_image_get_item_position:
* @image: The image.
- * @item_ID: The item.
+ * @item: The item.
*
* Returns the position of the item in its level of its item tree.
*
@@ -2972,7 +2973,7 @@ _gimp_image_thaw_vectors (gint32 image_ID)
**/
gint
gimp_image_get_item_position (GimpImage *image,
- gint32 item_ID)
+ GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -2981,7 +2982,7 @@ gimp_image_get_item_position (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_ITEM_ID, item_ID,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
@@ -3051,7 +3052,7 @@ _gimp_image_get_item_position (gint32 image_ID,
/**
* gimp_image_raise_item:
* @image: The image.
- * @item_ID: The item to raise.
+ * @item: The item to raise.
*
* Raise the specified item in its level in its item tree
*
@@ -3064,7 +3065,7 @@ _gimp_image_get_item_position (gint32 image_ID,
**/
gboolean
gimp_image_raise_item (GimpImage *image,
- gint32 item_ID)
+ GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -3073,7 +3074,7 @@ gimp_image_raise_item (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_ITEM_ID, item_ID,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
@@ -3139,7 +3140,7 @@ _gimp_image_raise_item (gint32 image_ID,
/**
* gimp_image_lower_item:
* @image: The image.
- * @item_ID: The item to lower.
+ * @item: The item to lower.
*
* Lower the specified item in its level in its item tree
*
@@ -3152,7 +3153,7 @@ _gimp_image_raise_item (gint32 image_ID,
**/
gboolean
gimp_image_lower_item (GimpImage *image,
- gint32 item_ID)
+ GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -3161,7 +3162,7 @@ gimp_image_lower_item (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_ITEM_ID, item_ID,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
@@ -3227,7 +3228,7 @@ _gimp_image_lower_item (gint32 image_ID,
/**
* gimp_image_raise_item_to_top:
* @image: The image.
- * @item_ID: The item to raise to top.
+ * @item: The item to raise to top.
*
* Raise the specified item to the top of its level in its item tree
*
@@ -3240,7 +3241,7 @@ _gimp_image_lower_item (gint32 image_ID,
**/
gboolean
gimp_image_raise_item_to_top (GimpImage *image,
- gint32 item_ID)
+ GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -3249,7 +3250,7 @@ gimp_image_raise_item_to_top (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_ITEM_ID, item_ID,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
@@ -3315,7 +3316,7 @@ _gimp_image_raise_item_to_top (gint32 image_ID,
/**
* gimp_image_lower_item_to_bottom:
* @image: The image.
- * @item_ID: The item to lower to bottom.
+ * @item: The item to lower to bottom.
*
* Lower the specified item to the bottom of its level in its item tree
*
@@ -3329,7 +3330,7 @@ _gimp_image_raise_item_to_top (gint32 image_ID,
**/
gboolean
gimp_image_lower_item_to_bottom (GimpImage *image,
- gint32 item_ID)
+ GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -3338,7 +3339,7 @@ gimp_image_lower_item_to_bottom (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_ITEM_ID, item_ID,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
@@ -3405,8 +3406,8 @@ _gimp_image_lower_item_to_bottom (gint32 image_ID,
/**
* gimp_image_reorder_item:
* @image: The image.
- * @item_ID: The item to reorder.
- * @parent_ID: The new parent item.
+ * @item: The item to reorder.
+ * @parent: The new parent item.
* @position: The new position of the item.
*
* Reorder the specified item within its item tree
@@ -3419,8 +3420,8 @@ _gimp_image_lower_item_to_bottom (gint32 image_ID,
**/
gboolean
gimp_image_reorder_item (GimpImage *image,
- gint32 item_ID,
- gint32 parent_ID,
+ GimpItem *item,
+ GimpItem *parent,
gint position)
{
GimpPDB *pdb = gimp_get_pdb ();
@@ -3430,8 +3431,8 @@ gimp_image_reorder_item (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_ITEM_ID, item_ID,
- GIMP_TYPE_ITEM_ID, parent_ID,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (parent)),
G_TYPE_INT, position,
G_TYPE_NONE);
@@ -3511,15 +3512,15 @@ _gimp_image_reorder_item (gint32 image_ID,
* merging with the CLIP_TO_IMAGE merge type. Non-visible layers are
* discarded, and the resulting image is stripped of its alpha channel.
*
- * Returns: The resulting layer.
+ * Returns: (transfer full): The resulting layer.
**/
-gint32
+GimpLayer *
gimp_image_flatten (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 layer_ID = -1;
+ GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@@ -3535,11 +3536,11 @@ gimp_image_flatten (GimpImage *image)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
+ layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals,
1))));
gimp_value_array_unref (return_vals);
- return layer_ID;
+ return layer;
}
/**
@@ -3598,16 +3599,16 @@ _gimp_image_flatten (gint32 image_ID)
* extents of the image. A merge type of CLIP_TO_BOTTOM_LAYER clips the
* final layer to the size of the bottommost layer.
*
- * Returns: The resulting layer.
+ * Returns: (transfer full): The resulting layer.
**/
-gint32
+GimpLayer *
gimp_image_merge_visible_layers (GimpImage *image,
GimpMergeType merge_type)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 layer_ID = -1;
+ GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@@ -3624,11 +3625,11 @@ gimp_image_merge_visible_layers (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
+ layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals,
1))));
gimp_value_array_unref (return_vals);
- return layer_ID;
+ return layer;
}
/**
@@ -3681,7 +3682,7 @@ _gimp_image_merge_visible_layers (gint32 image_ID,
/**
* gimp_image_merge_down:
* @image: The image.
- * @merge_layer_ID: The layer to merge down from.
+ * @merge_layer: The layer to merge down from.
* @merge_type: The type of merge.
*
* Merge the layer passed and the first visible layer below.
@@ -3694,21 +3695,21 @@ _gimp_image_merge_visible_layers (gint32 image_ID,
* CLIP_TO_BOTTOM_LAYER clips the final layer to the size of the
* bottommost layer.
*
- * Returns: The resulting layer.
+ * Returns: (transfer full): The resulting layer.
**/
-gint32
+GimpLayer *
gimp_image_merge_down (GimpImage *image,
- gint32 merge_layer_ID,
+ GimpLayer *merge_layer,
GimpMergeType merge_type)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 layer_ID = -1;
+ GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_LAYER_ID, merge_layer_ID,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (merge_layer)),
GIMP_TYPE_MERGE_TYPE, merge_type,
G_TYPE_NONE);
@@ -3722,11 +3723,11 @@ gimp_image_merge_down (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
+ layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals,
1))));
gimp_value_array_unref (return_vals);
- return layer_ID;
+ return layer;
}
/**
@@ -4467,15 +4468,15 @@ __gimp_image_thumbnail (gint32 image_ID,
* If a channel is currently active, then no layer will be. If a layer
* mask is active, then this will return the associated layer.
*
- * Returns: The active layer.
+ * Returns: (transfer full): The active layer.
**/
-gint32
+GimpLayer *
gimp_image_get_active_layer (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 active_layer_ID = -1;
+ GimpLayer *active_layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@@ -4491,11 +4492,11 @@ gimp_image_get_active_layer (GimpImage *image)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- active_layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
+ active_layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index
(return_vals, 1))));
gimp_value_array_unref (return_vals);
- return active_layer_ID;
+ return active_layer;
}
/**
@@ -4542,7 +4543,7 @@ _gimp_image_get_active_layer (gint32 image_ID)
/**
* gimp_image_set_active_layer:
* @image: The image.
- * @active_layer_ID: The new image active layer.
+ * @active_layer: The new image active layer.
*
* Sets the specified image's active layer.
*
@@ -4555,7 +4556,7 @@ _gimp_image_get_active_layer (gint32 image_ID)
**/
gboolean
gimp_image_set_active_layer (GimpImage *image,
- gint32 active_layer_ID)
+ GimpLayer *active_layer)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -4564,7 +4565,7 @@ gimp_image_set_active_layer (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_LAYER_ID, active_layer_ID,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (active_layer)),
G_TYPE_NONE);
if (pdb)
@@ -6595,16 +6596,16 @@ _gimp_image_set_tattoo_state (gint32 image_ID,
* This procedure returns the layer with the given tattoo in the
* specified image.
*
- * Returns: The layer with the specified tattoo.
+ * Returns: (transfer full): The layer with the specified tattoo.
**/
-gint32
+GimpLayer *
gimp_image_get_layer_by_tattoo (GimpImage *image,
guint tattoo)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 layer_ID = -1;
+ GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@@ -6621,11 +6622,11 @@ gimp_image_get_layer_by_tattoo (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
+ layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals,
1))));
gimp_value_array_unref (return_vals);
- return layer_ID;
+ return layer;
}
/**
@@ -6857,18 +6858,18 @@ _gimp_image_get_vectors_by_tattoo (gint32 image_ID,
* This procedure returns the layer with the given name in the
* specified image.
*
- * Returns: The layer with the specified name.
+ * Returns: (transfer full): The layer with the specified name.
*
* Since: 2.8
**/
-gint32
+GimpLayer *
gimp_image_get_layer_by_name (GimpImage *image,
const gchar *name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 layer_ID = -1;
+ GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@@ -6885,11 +6886,11 @@ gimp_image_get_layer_by_name (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
+ layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals,
1))));
gimp_value_array_unref (return_vals);
- return layer_ID;
+ return layer;
}
/**
diff --git a/libgimp/gimpimage_pdb.h b/libgimp/gimpimage_pdb.h
index 0e0f76a73f..53b0885ffd 100644
--- a/libgimp/gimpimage_pdb.h
+++ b/libgimp/gimpimage_pdb.h
@@ -57,27 +57,27 @@ gint* gimp_image_get_channels (GimpImage
gint *num_channels);
gint* gimp_image_get_vectors (GimpImage *image,
gint *num_vectors);
-gint32 gimp_image_get_active_drawable (GimpImage *image);
+GimpDrawable* gimp_image_get_active_drawable (GimpImage *image);
gboolean gimp_image_unset_active_channel (GimpImage *image);
-gint32 gimp_image_get_floating_sel (GimpImage *image);
-gint32 gimp_image_floating_sel_attached_to (GimpImage *image);
+GimpLayer* gimp_image_get_floating_sel (GimpImage *image);
+GimpDrawable* gimp_image_floating_sel_attached_to (GimpImage *image);
gboolean gimp_image_pick_color (GimpImage *image,
- gint32 drawable_ID,
+ GimpDrawable *drawable,
gdouble x,
gdouble y,
gboolean sample_merged,
gboolean sample_average,
gdouble average_radius,
GimpRGB *color);
-gint32 gimp_image_pick_correlate_layer (GimpImage *image,
+GimpLayer* gimp_image_pick_correlate_layer (GimpImage *image,
gint x,
gint y);
gboolean gimp_image_insert_layer (GimpImage *image,
- gint32 layer_ID,
- gint32 parent_ID,
+ GimpLayer *layer,
+ GimpLayer *parent,
gint position);
gboolean gimp_image_remove_layer (GimpImage *image,
- gint32 layer_ID);
+ GimpLayer *layer);
gboolean gimp_image_freeze_layers (GimpImage *image);
gboolean gimp_image_thaw_layers (GimpImage *image);
gboolean gimp_image_insert_channel (GimpImage *image,
@@ -97,24 +97,24 @@ gboolean gimp_image_remove_vectors (GimpImage
gboolean gimp_image_freeze_vectors (GimpImage *image);
gboolean gimp_image_thaw_vectors (GimpImage *image);
gint gimp_image_get_item_position (GimpImage *image,
- gint32 item_ID);
+ GimpItem *item);
gboolean gimp_image_raise_item (GimpImage *image,
- gint32 item_ID);
+ GimpItem *item);
gboolean gimp_image_lower_item (GimpImage *image,
- gint32 item_ID);
+ GimpItem *item);
gboolean gimp_image_raise_item_to_top (GimpImage *image,
- gint32 item_ID);
+ GimpItem *item);
gboolean gimp_image_lower_item_to_bottom (GimpImage *image,
- gint32 item_ID);
+ GimpItem *item);
gboolean gimp_image_reorder_item (GimpImage *image,
- gint32 item_ID,
- gint32 parent_ID,
+ GimpItem *item,
+ GimpItem *parent,
gint position);
-gint32 gimp_image_flatten (GimpImage *image);
-gint32 gimp_image_merge_visible_layers (GimpImage *image,
+GimpLayer* gimp_image_flatten (GimpImage *image);
+GimpLayer* gimp_image_merge_visible_layers (GimpImage *image,
GimpMergeType merge_type);
-gint32 gimp_image_merge_down (GimpImage *image,
- gint32 merge_layer_ID,
+GimpLayer* gimp_image_merge_down (GimpImage *image,
+ GimpLayer *merge_layer,
GimpMergeType merge_type);
G_GNUC_INTERNAL guint8* _gimp_image_get_colormap (GimpImage *image,
gint *num_bytes);
@@ -134,9 +134,9 @@ G_GNUC_INTERNAL gboolean _gimp_image_thumbnail (GimpImage
gint *bpp,
gint *thumbnail_data_count,
guint8 **thumbnail_data);
-gint32 gimp_image_get_active_layer (GimpImage *image);
+GimpLayer* gimp_image_get_active_layer (GimpImage *image);
gboolean gimp_image_set_active_layer (GimpImage *image,
- gint32 active_layer_ID);
+ GimpLayer *active_layer);
gint32 gimp_image_get_active_channel (GimpImage *image);
gboolean gimp_image_set_active_channel (GimpImage *image,
gint32 active_channel_ID);
@@ -174,13 +174,13 @@ gboolean gimp_image_set_unit (GimpImage
guint gimp_image_get_tattoo_state (GimpImage *image);
gboolean gimp_image_set_tattoo_state (GimpImage *image,
guint tattoo_state);
-gint32 gimp_image_get_layer_by_tattoo (GimpImage *image,
+GimpLayer* gimp_image_get_layer_by_tattoo (GimpImage *image,
guint tattoo);
gint32 gimp_image_get_channel_by_tattoo (GimpImage *image,
guint tattoo);
gint32 gimp_image_get_vectors_by_tattoo (GimpImage *image,
guint tattoo);
-gint32 gimp_image_get_layer_by_name (GimpImage *image,
+GimpLayer* gimp_image_get_layer_by_name (GimpImage *image,
const gchar *name);
gint32 gimp_image_get_channel_by_name (GimpImage *image,
const gchar *name);
diff --git a/libgimp/gimpimageselect_pdb.c b/libgimp/gimpimageselect_pdb.c
index c4e5ef3dea..efc229fb6a 100644
--- a/libgimp/gimpimageselect_pdb.c
+++ b/libgimp/gimpimageselect_pdb.c
@@ -38,7 +38,7 @@
* gimp_image_select_color:
* @image: The affected image.
* @operation: The selection operation.
- * @drawable_ID: The affected drawable.
+ * @drawable: The affected drawable.
* @color: The color to select.
*
* Create a selection by selecting all pixels (in the specified
@@ -68,7 +68,7 @@
gboolean
gimp_image_select_color (GimpImage *image,
GimpChannelOps operation,
- gint32 drawable_ID,
+ GimpDrawable *drawable,
const GimpRGB *color)
{
GimpPDB *pdb = gimp_get_pdb ();
@@ -79,7 +79,7 @@ gimp_image_select_color (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_CHANNEL_OPS, operation,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
GIMP_TYPE_RGB, color,
G_TYPE_NONE);
@@ -168,7 +168,7 @@ _gimp_image_select_color (gint32 image_ID,
* gimp_image_select_contiguous_color:
* @image: The affected image.
* @operation: The selection operation.
- * @drawable_ID: The affected drawable.
+ * @drawable: The affected drawable.
* @x: x coordinate of initial seed fill point: (image coordinates).
* @y: y coordinate of initial seed fill point: (image coordinates).
*
@@ -208,7 +208,7 @@ _gimp_image_select_color (gint32 image_ID,
gboolean
gimp_image_select_contiguous_color (GimpImage *image,
GimpChannelOps operation,
- gint32 drawable_ID,
+ GimpDrawable *drawable,
gdouble x,
gdouble y)
{
@@ -220,7 +220,7 @@ gimp_image_select_contiguous_color (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_CHANNEL_OPS, operation,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_DOUBLE, x,
G_TYPE_DOUBLE, y,
G_TYPE_NONE);
@@ -824,7 +824,7 @@ _gimp_image_select_polygon (gint32 image_ID,
* gimp_image_select_item:
* @image: The image.
* @operation: The desired operation with current selection.
- * @item_ID: The item to render to the selection.
+ * @item: The item to render to the selection.
*
* Transforms the specified item into a selection
*
@@ -844,7 +844,7 @@ _gimp_image_select_polygon (gint32 image_ID,
gboolean
gimp_image_select_item (GimpImage *image,
GimpChannelOps operation,
- gint32 item_ID)
+ GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -854,7 +854,7 @@ gimp_image_select_item (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
GIMP_TYPE_CHANNEL_OPS, operation,
- GIMP_TYPE_ITEM_ID, item_ID,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
diff --git a/libgimp/gimpimageselect_pdb.h b/libgimp/gimpimageselect_pdb.h
index 5388112b4d..1bea2480b5 100644
--- a/libgimp/gimpimageselect_pdb.h
+++ b/libgimp/gimpimageselect_pdb.h
@@ -38,11 +38,11 @@ G_BEGIN_DECLS
gboolean gimp_image_select_color (GimpImage *image,
GimpChannelOps operation,
- gint32 drawable_ID,
+ GimpDrawable *drawable,
const GimpRGB *color);
gboolean gimp_image_select_contiguous_color (GimpImage *image,
GimpChannelOps operation,
- gint32 drawable_ID,
+ GimpDrawable *drawable,
gdouble x,
gdouble y);
gboolean gimp_image_select_rectangle (GimpImage *image,
@@ -71,7 +71,7 @@ gboolean gimp_image_select_polygon (GimpImage *image,
const gdouble *segs);
gboolean gimp_image_select_item (GimpImage *image,
GimpChannelOps operation,
- gint32 item_ID);
+ GimpItem *item);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
diff --git a/libgimp/gimpitem.c b/libgimp/gimpitem.c
new file mode 100644
index 0000000000..f629dbbcba
--- /dev/null
+++ b/libgimp/gimpitem.c
@@ -0,0 +1,165 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
+ *
+ * gimpitem.c
+ * Copyright (C) Jehan
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * 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
+ * License along with this library. If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include "gimp.h"
+
+#include "gimppixbuf.h"
+
+enum
+{
+ PROP_0,
+ PROP_ID,
+ N_PROPS
+};
+
+struct _GimpItemPrivate
+{
+ gint id;
+};
+
+static void gimp_item_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_item_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GimpItem, gimp_item, G_TYPE_OBJECT)
+
+#define parent_class gimp_item_parent_class
+
+static GParamSpec *props[N_PROPS] = { NULL, };
+
+static void
+gimp_item_class_init (GimpItemClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->set_property = gimp_item_set_property;
+ object_class->get_property = gimp_item_get_property;
+
+ props[PROP_ID] =
+ g_param_spec_int ("id",
+ "The item id",
+ "The item id for internal use",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY);
+
+ g_object_class_install_properties (object_class, N_PROPS, props);
+}
+
+static void
+gimp_item_init (GimpItem *item)
+{
+ item->priv = gimp_item_get_instance_private (item);
+}
+
+static void
+gimp_item_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GimpItem *item = GIMP_ITEM (object);
+
+ switch (property_id)
+ {
+ case PROP_ID:
+ item->priv->id = g_value_get_int (value);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_item_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GimpItem *item = GIMP_ITEM (object);
+
+ switch (property_id)
+ {
+ case PROP_ID:
+ g_value_set_int (value, item->priv->id);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
+/* Public API. */
+
+
+/**
+ * gimp_item_get_id:
+ * @item: The item.
+ *
+ * Returns: the item ID.
+ *
+ * Since: 3.0
+ **/
+gint32
+gimp_item_get_id (GimpItem *item)
+{
+ return item ? item->priv->id : -1;
+}
+
+/**
+ * gimp_item_new_by_id:
+ * @item_id: The item id.
+ *
+ * Creates a #GimpItem representing @item_id. Since #GimpItem is an
+ * abstract class, the object real type will actually be the proper
+ * subclass.
+ *
+ * Returns: (nullable) (transfer full): a #GimpItem for @item_id or
+ * %NULL if @item_id does not represent a valid item.
+ *
+ * Since: 3.0
+ **/
+GimpItem *
+gimp_item_new_by_id (gint32 item_id)
+{
+ GimpItem *item = NULL;
+
+ if (_gimp_item_is_valid (item_id))
+ {
+ if (_gimp_item_is_layer (item_id))
+ item = g_object_new (GIMP_TYPE_LAYER,
+ "id", item_id,
+ NULL);
+ }
+
+ return item;
+}
diff --git a/libgimp/gimpitem.h b/libgimp/gimpitem.h
new file mode 100644
index 0000000000..4880e72b09
--- /dev/null
+++ b/libgimp/gimpitem.h
@@ -0,0 +1,75 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
+ *
+ * gimpitem.h
+ * Copyright (C) Jehan
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * 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
+ * License along with this library. If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_ITEM_H__
+#define __GIMP_ITEM_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+#define GIMP_TYPE_ITEM (gimp_item_get_type ())
+#define GIMP_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ITEM, GimpItem))
+#define GIMP_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ITEM, GimpItemClass))
+#define GIMP_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ITEM))
+#define GIMP_IS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ITEM))
+#define GIMP_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ITEM, GimpItemClass))
+
+
+typedef struct _GimpItemClass GimpItemClass;
+typedef struct _GimpItemPrivate GimpItemPrivate;
+
+struct _GimpItem
+{
+ GObject parent_instance;
+
+ GimpItemPrivate *priv;
+};
+
+struct _GimpItemClass
+{
+ GObjectClass parent_class;
+
+ /* Padding for future expansion */
+ void (*_gimp_reserved1) (void);
+ void (*_gimp_reserved2) (void);
+ void (*_gimp_reserved3) (void);
+ void (*_gimp_reserved4) (void);
+ void (*_gimp_reserved5) (void);
+ void (*_gimp_reserved6) (void);
+ void (*_gimp_reserved7) (void);
+ void (*_gimp_reserved8) (void);
+ void (*_gimp_reserved9) (void);
+};
+
+GType gimp_item_get_type (void) G_GNUC_CONST;
+
+gint32 gimp_item_get_id (GimpItem *item);
+GimpItem * gimp_item_new_by_id (gint32 item_id);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_ITEM_H__ */
diff --git a/libgimp/gimpitem_pdb.c b/libgimp/gimpitem_pdb.c
index 1761d1b0b6..dfa4809d4f 100644
--- a/libgimp/gimpitem_pdb.c
+++ b/libgimp/gimpitem_pdb.c
@@ -36,6 +36,48 @@
/**
* gimp_item_is_valid:
+ * @item: The item to check.
+ *
+ * Returns TRUE if the item is valid.
+ *
+ * This procedure checks if the given item ID is valid and refers to an
+ * existing item.
+ *
+ * Returns: Whether the item ID is valid.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_is_valid (GimpItem *item)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean valid = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-is-valid",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-is-valid",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ valid = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return valid;
+}
+
+/**
+ * _gimp_item_is_valid: (skip)
* @item_ID: The item to check.
*
* Returns TRUE if the item is valid.
@@ -48,7 +90,7 @@
* Since: 2.8
**/
gboolean
-gimp_item_is_valid (gint32 item_ID)
+_gimp_item_is_valid (gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -78,7 +120,7 @@ gimp_item_is_valid (gint32 item_ID)
/**
* gimp_item_get_image:
- * @item_ID: The item.
+ * @item: The item.
*
* Returns the item's image.
*
@@ -89,7 +131,7 @@ gimp_item_is_valid (gint32 item_ID)
* Since: 2.8
**/
GimpImage *
-gimp_item_get_image (gint32 item_ID)
+gimp_item_get_image (GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -97,7 +139,7 @@ gimp_item_get_image (gint32 item_ID)
GimpImage *image = NULL;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_ITEM_ID, item_ID,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
@@ -160,6 +202,50 @@ _gimp_item_get_image (gint32 item_ID)
/**
* gimp_item_delete:
+ * @item: The item to delete.
+ *
+ * Delete a item.
+ *
+ * This procedure deletes the specified item. This must not be done if
+ * the image containing this item was already deleted or if the item
+ * was already removed from the image. The only case in which this
+ * procedure is useful is if you want to get rid of a item which has
+ * not yet been added to an image.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_delete (GimpItem *item)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-delete",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-delete",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_item_delete: (skip)
* @item_ID: The item to delete.
*
* Delete a item.
@@ -175,7 +261,7 @@ _gimp_item_get_image (gint32 item_ID)
* Since: 2.8
**/
gboolean
-gimp_item_delete (gint32 item_ID)
+_gimp_item_delete (gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -204,7 +290,7 @@ gimp_item_delete (gint32 item_ID)
/**
* gimp_item_is_drawable:
- * @item_ID: The item.
+ * @item: The item.
*
* Returns whether the item is a drawable.
*
@@ -215,7 +301,7 @@ gimp_item_delete (gint32 item_ID)
* Since: 2.8
**/
gboolean
-gimp_item_is_drawable (gint32 item_ID)
+gimp_item_is_drawable (GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -223,7 +309,7 @@ gimp_item_is_drawable (gint32 item_ID)
gboolean drawable = FALSE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_ITEM_ID, item_ID,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
@@ -244,24 +330,24 @@ gimp_item_is_drawable (gint32 item_ID)
}
/**
- * gimp_item_is_layer:
+ * _gimp_item_is_drawable: (skip)
* @item_ID: The item.
*
- * Returns whether the item is a layer.
+ * Returns whether the item is a drawable.
*
- * This procedure returns TRUE if the specified item is a layer.
+ * This procedure returns TRUE if the specified item is a drawable.
*
- * Returns: TRUE if the item is a layer, FALSE otherwise.
+ * Returns: TRUE if the item is a drawable, FALSE otherwise.
*
* Since: 2.8
**/
gboolean
-gimp_item_is_layer (gint32 item_ID)
+_gimp_item_is_drawable (gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean layer = FALSE;
+ gboolean drawable = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, item_ID,
@@ -269,81 +355,81 @@ gimp_item_is_layer (gint32 item_ID)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-is-layer",
+ "gimp-item-is-drawable",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-is-layer",
+ return_vals = gimp_run_procedure_array ("gimp-item-is-drawable",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- layer = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ drawable = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return layer;
+ return drawable;
}
/**
- * gimp_item_is_text_layer:
- * @item_ID: The item.
+ * gimp_item_is_layer:
+ * @item: The item.
*
- * Returns whether the item is a text layer.
+ * Returns whether the item is a layer.
*
- * This procedure returns TRUE if the specified item is a text layer.
+ * This procedure returns TRUE if the specified item is a layer.
*
- * Returns: TRUE if the item is a text layer, FALSE otherwise.
+ * Returns: TRUE if the item is a layer, FALSE otherwise.
*
* Since: 2.8
**/
gboolean
-gimp_item_is_text_layer (gint32 item_ID)
+gimp_item_is_layer (GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean text_layer = FALSE;
+ gboolean layer = FALSE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_ITEM_ID, item_ID,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-is-text-layer",
+ "gimp-item-is-layer",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-is-text-layer",
+ return_vals = gimp_run_procedure_array ("gimp-item-is-layer",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- text_layer = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ layer = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return text_layer;
+ return layer;
}
/**
- * gimp_item_is_channel:
+ * _gimp_item_is_layer: (skip)
* @item_ID: The item.
*
- * Returns whether the item is a channel.
+ * Returns whether the item is a layer.
*
- * This procedure returns TRUE if the specified item is a channel.
+ * This procedure returns TRUE if the specified item is a layer.
*
- * Returns: TRUE if the item is a channel, FALSE otherwise.
+ * Returns: TRUE if the item is a layer, FALSE otherwise.
*
* Since: 2.8
**/
gboolean
-gimp_item_is_channel (gint32 item_ID)
+_gimp_item_is_layer (gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean channel = FALSE;
+ gboolean layer = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, item_ID,
@@ -351,81 +437,81 @@ gimp_item_is_channel (gint32 item_ID)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-is-channel",
+ "gimp-item-is-layer",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-is-channel",
+ return_vals = gimp_run_procedure_array ("gimp-item-is-layer",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- channel = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ layer = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return channel;
+ return layer;
}
/**
- * gimp_item_is_layer_mask:
- * @item_ID: The item.
+ * gimp_item_is_text_layer:
+ * @item: The item.
*
- * Returns whether the item is a layer mask.
+ * Returns whether the item is a text layer.
*
- * This procedure returns TRUE if the specified item is a layer mask.
+ * This procedure returns TRUE if the specified item is a text layer.
*
- * Returns: TRUE if the item is a layer mask, FALSE otherwise.
+ * Returns: TRUE if the item is a text layer, FALSE otherwise.
*
* Since: 2.8
**/
gboolean
-gimp_item_is_layer_mask (gint32 item_ID)
+gimp_item_is_text_layer (GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean layer_mask = FALSE;
+ gboolean text_layer = FALSE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_ITEM_ID, item_ID,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-is-layer-mask",
+ "gimp-item-is-text-layer",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-is-layer-mask",
+ return_vals = gimp_run_procedure_array ("gimp-item-is-text-layer",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- layer_mask = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ text_layer = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return layer_mask;
+ return text_layer;
}
/**
- * gimp_item_is_selection:
+ * _gimp_item_is_text_layer: (skip)
* @item_ID: The item.
*
- * Returns whether the item is a selection.
+ * Returns whether the item is a text layer.
*
- * This procedure returns TRUE if the specified item is a selection.
+ * This procedure returns TRUE if the specified item is a text layer.
*
- * Returns: TRUE if the item is a selection, FALSE otherwise.
+ * Returns: TRUE if the item is a text layer, FALSE otherwise.
*
* Since: 2.8
**/
gboolean
-gimp_item_is_selection (gint32 item_ID)
+_gimp_item_is_text_layer (gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean selection = FALSE;
+ gboolean text_layer = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, item_ID,
@@ -433,82 +519,81 @@ gimp_item_is_selection (gint32 item_ID)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-is-selection",
+ "gimp-item-is-text-layer",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-is-selection",
+ return_vals = gimp_run_procedure_array ("gimp-item-is-text-layer",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- selection = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ text_layer = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return selection;
+ return text_layer;
}
/**
- * gimp_item_is_vectors:
- * @item_ID: The item.
+ * gimp_item_is_channel:
+ * @item: The item.
*
- * Returns whether the item is a vectors.
+ * Returns whether the item is a channel.
*
- * This procedure returns TRUE if the specified item is a vectors.
+ * This procedure returns TRUE if the specified item is a channel.
*
- * Returns: TRUE if the item is a vectors, FALSE otherwise.
+ * Returns: TRUE if the item is a channel, FALSE otherwise.
*
* Since: 2.8
**/
gboolean
-gimp_item_is_vectors (gint32 item_ID)
+gimp_item_is_channel (GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean vectors = FALSE;
+ gboolean channel = FALSE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_ITEM_ID, item_ID,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-is-vectors",
+ "gimp-item-is-channel",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-is-vectors",
+ return_vals = gimp_run_procedure_array ("gimp-item-is-channel",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- vectors = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ channel = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return vectors;
+ return channel;
}
/**
- * gimp_item_is_group:
+ * _gimp_item_is_channel: (skip)
* @item_ID: The item.
*
- * Returns whether the item is a group item.
+ * Returns whether the item is a channel.
*
- * This procedure returns TRUE if the specified item is a group item
- * which can have children.
+ * This procedure returns TRUE if the specified item is a channel.
*
- * Returns: TRUE if the item is a group, FALSE otherwise.
+ * Returns: TRUE if the item is a channel, FALSE otherwise.
*
* Since: 2.8
**/
gboolean
-gimp_item_is_group (gint32 item_ID)
+_gimp_item_is_channel (gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean group = FALSE;
+ gboolean channel = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, item_ID,
@@ -516,86 +601,81 @@ gimp_item_is_group (gint32 item_ID)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-is-group",
+ "gimp-item-is-channel",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-is-group",
+ return_vals = gimp_run_procedure_array ("gimp-item-is-channel",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- group = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ channel = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return group;
+ return channel;
}
/**
- * gimp_item_get_parent:
- * @item_ID: The item.
+ * gimp_item_is_layer_mask:
+ * @item: The item.
*
- * Returns the item's parent item.
+ * Returns whether the item is a layer mask.
*
- * This procedure returns the item's parent item, if any.
+ * This procedure returns TRUE if the specified item is a layer mask.
*
- * Returns: The item's parent item.
+ * Returns: TRUE if the item is a layer mask, FALSE otherwise.
*
* Since: 2.8
**/
-gint32
-gimp_item_get_parent (gint32 item_ID)
+gboolean
+gimp_item_is_layer_mask (GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 parent_ID = -1;
+ gboolean layer_mask = FALSE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_ITEM_ID, item_ID,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-get-parent",
+ "gimp-item-is-layer-mask",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-get-parent",
+ return_vals = gimp_run_procedure_array ("gimp-item-is-layer-mask",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- parent_ID = gimp_value_get_item_id (gimp_value_array_index (return_vals, 1));
+ layer_mask = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return parent_ID;
+ return layer_mask;
}
/**
- * gimp_item_get_children:
+ * _gimp_item_is_layer_mask: (skip)
* @item_ID: The item.
- * @num_children: (out): The item's number of children.
*
- * Returns the item's list of children.
+ * Returns whether the item is a layer mask.
*
- * This procedure returns the list of items which are children of the
- * specified item. The order is topmost to bottommost.
+ * This procedure returns TRUE if the specified item is a layer mask.
*
- * Returns: (array length=num_children) (element-type gint32) (transfer full):
- * The item's list of children.
- * The returned value must be freed with g_free().
+ * Returns: TRUE if the item is a layer mask, FALSE otherwise.
*
* Since: 2.8
**/
-gint *
-gimp_item_get_children (gint32 item_ID,
- gint *num_children)
+gboolean
+_gimp_item_is_layer_mask (gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint *child_ids = NULL;
+ gboolean layer_mask = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, item_ID,
@@ -603,45 +683,1186 @@ gimp_item_get_children (gint32 item_ID,
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-get-children",
+ "gimp-item-is-layer-mask",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-get-children",
+ return_vals = gimp_run_procedure_array ("gimp-item-is-layer-mask",
args);
gimp_value_array_unref (args);
- *num_children = 0;
-
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- {
- *num_children = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ layer_mask = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return layer_mask;
+}
+
+/**
+ * gimp_item_is_selection:
+ * @item: The item.
+ *
+ * Returns whether the item is a selection.
+ *
+ * This procedure returns TRUE if the specified item is a selection.
+ *
+ * Returns: TRUE if the item is a selection, FALSE otherwise.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_is_selection (GimpItem *item)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean selection = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-is-selection",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-is-selection",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ selection = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return selection;
+}
+
+/**
+ * _gimp_item_is_selection: (skip)
+ * @item_ID: The item.
+ *
+ * Returns whether the item is a selection.
+ *
+ * This procedure returns TRUE if the specified item is a selection.
+ *
+ * Returns: TRUE if the item is a selection, FALSE otherwise.
+ *
+ * Since: 2.8
+ **/
+gboolean
+_gimp_item_is_selection (gint32 item_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean selection = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, item_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-is-selection",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-is-selection",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ selection = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return selection;
+}
+
+/**
+ * gimp_item_is_vectors:
+ * @item: The item.
+ *
+ * Returns whether the item is a vectors.
+ *
+ * This procedure returns TRUE if the specified item is a vectors.
+ *
+ * Returns: TRUE if the item is a vectors, FALSE otherwise.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_is_vectors (GimpItem *item)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean vectors = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-is-vectors",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-is-vectors",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ vectors = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return vectors;
+}
+
+/**
+ * _gimp_item_is_vectors: (skip)
+ * @item_ID: The item.
+ *
+ * Returns whether the item is a vectors.
+ *
+ * This procedure returns TRUE if the specified item is a vectors.
+ *
+ * Returns: TRUE if the item is a vectors, FALSE otherwise.
+ *
+ * Since: 2.8
+ **/
+gboolean
+_gimp_item_is_vectors (gint32 item_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean vectors = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, item_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-is-vectors",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-is-vectors",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ vectors = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return vectors;
+}
+
+/**
+ * gimp_item_is_group:
+ * @item: The item.
+ *
+ * Returns whether the item is a group item.
+ *
+ * This procedure returns TRUE if the specified item is a group item
+ * which can have children.
+ *
+ * Returns: TRUE if the item is a group, FALSE otherwise.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_is_group (GimpItem *item)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean group = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-is-group",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-is-group",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ group = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return group;
+}
+
+/**
+ * _gimp_item_is_group: (skip)
+ * @item_ID: The item.
+ *
+ * Returns whether the item is a group item.
+ *
+ * This procedure returns TRUE if the specified item is a group item
+ * which can have children.
+ *
+ * Returns: TRUE if the item is a group, FALSE otherwise.
+ *
+ * Since: 2.8
+ **/
+gboolean
+_gimp_item_is_group (gint32 item_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean group = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, item_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-is-group",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-is-group",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ group = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return group;
+}
+
+/**
+ * gimp_item_get_parent:
+ * @item: The item.
+ *
+ * Returns the item's parent item.
+ *
+ * This procedure returns the item's parent item, if any.
+ *
+ * Returns: (transfer full): The item's parent item.
+ *
+ * Since: 2.8
+ **/
+GimpItem *
+gimp_item_get_parent (GimpItem *item)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpItem *parent = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-get-parent",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-get-parent",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ parent = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
+
+ gimp_value_array_unref (return_vals);
+
+ return parent;
+}
+
+/**
+ * _gimp_item_get_parent: (skip)
+ * @item_ID: The item.
+ *
+ * Returns the item's parent item.
+ *
+ * This procedure returns the item's parent item, if any.
+ *
+ * Returns: The item's parent item.
+ *
+ * Since: 2.8
+ **/
+gint32
+_gimp_item_get_parent (gint32 item_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 parent_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, item_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-get-parent",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-get-parent",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ parent_ID = gimp_value_get_item_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return parent_ID;
+}
+
+/**
+ * gimp_item_get_children:
+ * @item: The item.
+ * @num_children: (out): The item's number of children.
+ *
+ * Returns the item's list of children.
+ *
+ * This procedure returns the list of items which are children of the
+ * specified item. The order is topmost to bottommost.
+ *
+ * Returns: (array length=num_children) (element-type gint32) (transfer full):
+ * The item's list of children.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.8
+ **/
+gint *
+gimp_item_get_children (GimpItem *item,
+ gint *num_children)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint *child_ids = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-get-children",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-get-children",
+ args);
+ gimp_value_array_unref (args);
+
+ *num_children = 0;
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ {
+ *num_children = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ child_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return child_ids;
+}
+
+/**
+ * _gimp_item_get_children: (skip)
+ * @item_ID: The item.
+ * @num_children: (out): The item's number of children.
+ *
+ * Returns the item's list of children.
+ *
+ * This procedure returns the list of items which are children of the
+ * specified item. The order is topmost to bottommost.
+ *
+ * Returns: (array length=num_children): The item's list of children.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.8
+ **/
+gint *
+_gimp_item_get_children (gint32 item_ID,
+ gint *num_children)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint *child_ids = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, item_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-get-children",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-get-children",
+ args);
+ gimp_value_array_unref (args);
+
+ *num_children = 0;
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ {
+ *num_children = g_value_get_int (gimp_value_array_index (return_vals, 1));
child_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
}
gimp_value_array_unref (return_vals);
- return child_ids;
+ return child_ids;
+}
+
+/**
+ * gimp_item_get_expanded:
+ * @item: The item.
+ *
+ * Returns whether the item is expanded.
+ *
+ * This procedure returns TRUE if the specified item is expanded.
+ *
+ * Returns: TRUE if the item is expanded, FALSE otherwise.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_item_get_expanded (GimpItem *item)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean expanded = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-get-expanded",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-get-expanded",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ expanded = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return expanded;
+}
+
+/**
+ * _gimp_item_get_expanded: (skip)
+ * @item_ID: The item.
+ *
+ * Returns whether the item is expanded.
+ *
+ * This procedure returns TRUE if the specified item is expanded.
+ *
+ * Returns: TRUE if the item is expanded, FALSE otherwise.
+ *
+ * Since: 2.10
+ **/
+gboolean
+_gimp_item_get_expanded (gint32 item_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean expanded = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, item_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-get-expanded",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-get-expanded",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ expanded = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return expanded;
+}
+
+/**
+ * gimp_item_set_expanded:
+ * @item: The item.
+ * @expanded: TRUE to expand the item, FALSE to collapse the item.
+ *
+ * Sets the expanded state of the item.
+ *
+ * This procedure expands or collapses the item.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_item_set_expanded (GimpItem *item,
+ gboolean expanded)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_BOOLEAN, expanded,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-set-expanded",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-set-expanded",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_item_set_expanded: (skip)
+ * @item_ID: The item.
+ * @expanded: TRUE to expand the item, FALSE to collapse the item.
+ *
+ * Sets the expanded state of the item.
+ *
+ * This procedure expands or collapses the item.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+_gimp_item_set_expanded (gint32 item_ID,
+ gboolean expanded)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, item_ID,
+ G_TYPE_BOOLEAN, expanded,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-set-expanded",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-set-expanded",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_item_get_name:
+ * @item: The item.
+ *
+ * Get the name of the specified item.
+ *
+ * This procedure returns the specified item's name.
+ *
+ * Returns: (transfer full): The item name.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.8
+ **/
+gchar *
+gimp_item_get_name (GimpItem *item)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *name = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-get-name",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-get-name",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return name;
+}
+
+/**
+ * _gimp_item_get_name: (skip)
+ * @item_ID: The item.
+ *
+ * Get the name of the specified item.
+ *
+ * This procedure returns the specified item's name.
+ *
+ * Returns: The item name.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.8
+ **/
+gchar *
+_gimp_item_get_name (gint32 item_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *name = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, item_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-get-name",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-get-name",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return name;
+}
+
+/**
+ * gimp_item_set_name:
+ * @item: The item.
+ * @name: The new item name.
+ *
+ * Set the name of the specified item.
+ *
+ * This procedure sets the specified item's name.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_set_name (GimpItem *item,
+ const gchar *name)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_STRING, name,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-set-name",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-set-name",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_item_set_name: (skip)
+ * @item_ID: The item.
+ * @name: The new item name.
+ *
+ * Set the name of the specified item.
+ *
+ * This procedure sets the specified item's name.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+_gimp_item_set_name (gint32 item_ID,
+ const gchar *name)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, item_ID,
+ G_TYPE_STRING, name,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-set-name",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-set-name",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_item_get_visible:
+ * @item: The item.
+ *
+ * Get the visibility of the specified item.
+ *
+ * This procedure returns the specified item's visibility.
+ *
+ * Returns: The item visibility.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_get_visible (GimpItem *item)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean visible = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-get-visible",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-get-visible",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ visible = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return visible;
+}
+
+/**
+ * _gimp_item_get_visible: (skip)
+ * @item_ID: The item.
+ *
+ * Get the visibility of the specified item.
+ *
+ * This procedure returns the specified item's visibility.
+ *
+ * Returns: The item visibility.
+ *
+ * Since: 2.8
+ **/
+gboolean
+_gimp_item_get_visible (gint32 item_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean visible = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, item_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-get-visible",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-get-visible",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ visible = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return visible;
+}
+
+/**
+ * gimp_item_set_visible:
+ * @item: The item.
+ * @visible: The new item visibility.
+ *
+ * Set the visibility of the specified item.
+ *
+ * This procedure sets the specified item's visibility.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_set_visible (GimpItem *item,
+ gboolean visible)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_BOOLEAN, visible,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-set-visible",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-set-visible",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_item_set_visible: (skip)
+ * @item_ID: The item.
+ * @visible: The new item visibility.
+ *
+ * Set the visibility of the specified item.
+ *
+ * This procedure sets the specified item's visibility.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+_gimp_item_set_visible (gint32 item_ID,
+ gboolean visible)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, item_ID,
+ G_TYPE_BOOLEAN, visible,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-set-visible",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-set-visible",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_item_get_linked:
+ * @item: The item.
+ *
+ * Get the linked state of the specified item.
+ *
+ * This procedure returns the specified item's linked state.
+ *
+ * Returns: The item linked state (for moves).
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_get_linked (GimpItem *item)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean linked = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-get-linked",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-get-linked",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ linked = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return linked;
+}
+
+/**
+ * _gimp_item_get_linked: (skip)
+ * @item_ID: The item.
+ *
+ * Get the linked state of the specified item.
+ *
+ * This procedure returns the specified item's linked state.
+ *
+ * Returns: The item linked state (for moves).
+ *
+ * Since: 2.8
+ **/
+gboolean
+_gimp_item_get_linked (gint32 item_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean linked = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, item_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-get-linked",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-get-linked",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ linked = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return linked;
+}
+
+/**
+ * gimp_item_set_linked:
+ * @item: The item.
+ * @linked: The new item linked state.
+ *
+ * Set the linked state of the specified item.
+ *
+ * This procedure sets the specified item's linked state.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_set_linked (GimpItem *item,
+ gboolean linked)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_BOOLEAN, linked,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-set-linked",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-set-linked",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_item_set_linked: (skip)
+ * @item_ID: The item.
+ * @linked: The new item linked state.
+ *
+ * Set the linked state of the specified item.
+ *
+ * This procedure sets the specified item's linked state.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+_gimp_item_set_linked (gint32 item_ID,
+ gboolean linked)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, item_ID,
+ G_TYPE_BOOLEAN, linked,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-set-linked",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-set-linked",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_item_get_lock_content:
+ * @item: The item.
+ *
+ * Get the 'lock content' state of the specified item.
+ *
+ * This procedure returns the specified item's lock content state.
+ *
+ * Returns: Whether the item's contents are locked.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_item_get_lock_content (GimpItem *item)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean lock_content = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-get-lock-content",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-get-lock-content",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ lock_content = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return lock_content;
}
/**
- * gimp_item_get_expanded:
+ * _gimp_item_get_lock_content: (skip)
* @item_ID: The item.
*
- * Returns whether the item is expanded.
+ * Get the 'lock content' state of the specified item.
*
- * This procedure returns TRUE if the specified item is expanded.
+ * This procedure returns the specified item's lock content state.
*
- * Returns: TRUE if the item is expanded, FALSE otherwise.
+ * Returns: Whether the item's contents are locked.
*
- * Since: 2.10
+ * Since: 2.8
**/
gboolean
-gimp_item_get_expanded (gint32 item_ID)
+_gimp_item_get_lock_content (gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean expanded = FALSE;
+ gboolean lock_content = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, item_ID,
@@ -649,37 +1870,37 @@ gimp_item_get_expanded (gint32 item_ID)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-get-expanded",
+ "gimp-item-get-lock-content",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-get-expanded",
+ return_vals = gimp_run_procedure_array ("gimp-item-get-lock-content",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- expanded = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ lock_content = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return expanded;
+ return lock_content;
}
/**
- * gimp_item_set_expanded:
- * @item_ID: The item.
- * @expanded: TRUE to expand the item, FALSE to collapse the item.
+ * gimp_item_set_lock_content:
+ * @item: The item.
+ * @lock_content: The new item 'lock content' state.
*
- * Sets the expanded state of the item.
+ * Set the 'lock content' state of the specified item.
*
- * This procedure expands or collapses the item.
+ * This procedure sets the specified item's lock content state.
*
* Returns: TRUE on success.
*
- * Since: 2.10
+ * Since: 2.8
**/
gboolean
-gimp_item_set_expanded (gint32 item_ID,
- gboolean expanded)
+gimp_item_set_lock_content (GimpItem *item,
+ gboolean lock_content)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -687,16 +1908,16 @@ gimp_item_set_expanded (gint32 item_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_ITEM_ID, item_ID,
- G_TYPE_BOOLEAN, expanded,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_BOOLEAN, lock_content,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-set-expanded",
+ "gimp-item-set-lock-content",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-set-expanded",
+ return_vals = gimp_run_procedure_array ("gimp-item-set-lock-content",
args);
gimp_value_array_unref (args);
@@ -708,109 +1929,108 @@ gimp_item_set_expanded (gint32 item_ID,
}
/**
- * gimp_item_get_name:
+ * _gimp_item_set_lock_content: (skip)
* @item_ID: The item.
+ * @lock_content: The new item 'lock content' state.
*
- * Get the name of the specified item.
+ * Set the 'lock content' state of the specified item.
*
- * This procedure returns the specified item's name.
+ * This procedure sets the specified item's lock content state.
*
- * Returns: (transfer full): The item name.
- * The returned value must be freed with g_free().
+ * Returns: TRUE on success.
*
* Since: 2.8
**/
-gchar *
-gimp_item_get_name (gint32 item_ID)
+gboolean
+_gimp_item_set_lock_content (gint32 item_ID,
+ gboolean lock_content)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gchar *name = NULL;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, item_ID,
+ G_TYPE_BOOLEAN, lock_content,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-get-name",
+ "gimp-item-set-lock-content",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-get-name",
+ return_vals = gimp_run_procedure_array ("gimp-item-set-lock-content",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- name = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return name;
+ return success;
}
/**
- * gimp_item_set_name:
- * @item_ID: The item.
- * @name: The new item name.
+ * gimp_item_get_lock_position:
+ * @item: The item.
*
- * Set the name of the specified item.
+ * Get the 'lock position' state of the specified item.
*
- * This procedure sets the specified item's name.
+ * This procedure returns the specified item's lock position state.
*
- * Returns: TRUE on success.
+ * Returns: Whether the item's position is locked.
*
- * Since: 2.8
+ * Since: 2.10
**/
gboolean
-gimp_item_set_name (gint32 item_ID,
- const gchar *name)
+gimp_item_get_lock_position (GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ gboolean lock_position = FALSE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_ITEM_ID, item_ID,
- G_TYPE_STRING, name,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-set-name",
+ "gimp-item-get-lock-position",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-set-name",
+ return_vals = gimp_run_procedure_array ("gimp-item-get-lock-position",
args);
gimp_value_array_unref (args);
- success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ lock_position = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return lock_position;
}
/**
- * gimp_item_get_visible:
+ * _gimp_item_get_lock_position: (skip)
* @item_ID: The item.
*
- * Get the visibility of the specified item.
+ * Get the 'lock position' state of the specified item.
*
- * This procedure returns the specified item's visibility.
+ * This procedure returns the specified item's lock position state.
*
- * Returns: The item visibility.
+ * Returns: Whether the item's position is locked.
*
- * Since: 2.8
+ * Since: 2.10
**/
gboolean
-gimp_item_get_visible (gint32 item_ID)
+_gimp_item_get_lock_position (gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean visible = FALSE;
+ gboolean lock_position = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, item_ID,
@@ -818,37 +2038,37 @@ gimp_item_get_visible (gint32 item_ID)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-get-visible",
+ "gimp-item-get-lock-position",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-get-visible",
+ return_vals = gimp_run_procedure_array ("gimp-item-get-lock-position",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- visible = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ lock_position = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return visible;
+ return lock_position;
}
/**
- * gimp_item_set_visible:
- * @item_ID: The item.
- * @visible: The new item visibility.
+ * gimp_item_set_lock_position:
+ * @item: The item.
+ * @lock_position: The new item 'lock position' state.
*
- * Set the visibility of the specified item.
+ * Set the 'lock position' state of the specified item.
*
- * This procedure sets the specified item's visibility.
+ * This procedure sets the specified item's lock position state.
*
* Returns: TRUE on success.
*
- * Since: 2.8
+ * Since: 2.10
**/
gboolean
-gimp_item_set_visible (gint32 item_ID,
- gboolean visible)
+gimp_item_set_lock_position (GimpItem *item,
+ gboolean lock_position)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -856,16 +2076,16 @@ gimp_item_set_visible (gint32 item_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_ITEM_ID, item_ID,
- G_TYPE_BOOLEAN, visible,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_BOOLEAN, lock_position,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-set-visible",
+ "gimp-item-set-lock-position",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-set-visible",
+ return_vals = gimp_run_procedure_array ("gimp-item-set-lock-position",
args);
gimp_value_array_unref (args);
@@ -877,146 +2097,189 @@ gimp_item_set_visible (gint32 item_ID,
}
/**
- * gimp_item_get_linked:
+ * _gimp_item_set_lock_position: (skip)
* @item_ID: The item.
+ * @lock_position: The new item 'lock position' state.
*
- * Get the linked state of the specified item.
+ * Set the 'lock position' state of the specified item.
*
- * This procedure returns the specified item's linked state.
+ * This procedure sets the specified item's lock position state.
*
- * Returns: The item linked state (for moves).
+ * Returns: TRUE on success.
*
- * Since: 2.8
+ * Since: 2.10
**/
gboolean
-gimp_item_get_linked (gint32 item_ID)
+_gimp_item_set_lock_position (gint32 item_ID,
+ gboolean lock_position)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean linked = FALSE;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, item_ID,
+ G_TYPE_BOOLEAN, lock_position,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-get-linked",
+ "gimp-item-set-lock-position",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-get-linked",
+ return_vals = gimp_run_procedure_array ("gimp-item-set-lock-position",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_item_get_color_tag:
+ * @item: The item.
+ *
+ * Get the color tag of the specified item.
+ *
+ * This procedure returns the specified item's color tag.
+ *
+ * Returns: The item's color tag.
+ *
+ * Since: 2.10
+ **/
+GimpColorTag
+gimp_item_get_color_tag (GimpItem *item)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpColorTag color_tag = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-get-color-tag",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-get-color-tag",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- linked = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ color_tag = g_value_get_enum (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return linked;
+ return color_tag;
}
/**
- * gimp_item_set_linked:
+ * _gimp_item_get_color_tag: (skip)
* @item_ID: The item.
- * @linked: The new item linked state.
*
- * Set the linked state of the specified item.
+ * Get the color tag of the specified item.
*
- * This procedure sets the specified item's linked state.
+ * This procedure returns the specified item's color tag.
*
- * Returns: TRUE on success.
+ * Returns: The item's color tag.
*
- * Since: 2.8
+ * Since: 2.10
**/
-gboolean
-gimp_item_set_linked (gint32 item_ID,
- gboolean linked)
+GimpColorTag
+_gimp_item_get_color_tag (gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ GimpColorTag color_tag = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, item_ID,
- G_TYPE_BOOLEAN, linked,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-set-linked",
+ "gimp-item-get-color-tag",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-set-linked",
+ return_vals = gimp_run_procedure_array ("gimp-item-get-color-tag",
args);
gimp_value_array_unref (args);
- success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ color_tag = g_value_get_enum (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return color_tag;
}
/**
- * gimp_item_get_lock_content:
- * @item_ID: The item.
+ * gimp_item_set_color_tag:
+ * @item: The item.
+ * @color_tag: The new item color tag.
*
- * Get the 'lock content' state of the specified item.
+ * Set the color tag of the specified item.
*
- * This procedure returns the specified item's lock content state.
+ * This procedure sets the specified item's color tag.
*
- * Returns: Whether the item's contents are locked.
+ * Returns: TRUE on success.
*
- * Since: 2.8
+ * Since: 2.10
**/
gboolean
-gimp_item_get_lock_content (gint32 item_ID)
+gimp_item_set_color_tag (GimpItem *item,
+ GimpColorTag color_tag)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean lock_content = FALSE;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_ITEM_ID, item_ID,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ GIMP_TYPE_COLOR_TAG, color_tag,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-get-lock-content",
+ "gimp-item-set-color-tag",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-get-lock-content",
+ return_vals = gimp_run_procedure_array ("gimp-item-set-color-tag",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- lock_content = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return lock_content;
+ return success;
}
/**
- * gimp_item_set_lock_content:
+ * _gimp_item_set_color_tag: (skip)
* @item_ID: The item.
- * @lock_content: The new item 'lock content' state.
+ * @color_tag: The new item color tag.
*
- * Set the 'lock content' state of the specified item.
+ * Set the color tag of the specified item.
*
- * This procedure sets the specified item's lock content state.
+ * This procedure sets the specified item's color tag.
*
* Returns: TRUE on success.
*
- * Since: 2.8
+ * Since: 2.10
**/
gboolean
-gimp_item_set_lock_content (gint32 item_ID,
- gboolean lock_content)
+_gimp_item_set_color_tag (gint32 item_ID,
+ GimpColorTag color_tag)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1025,15 +2288,15 @@ gimp_item_set_lock_content (gint32 item_ID,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, item_ID,
- G_TYPE_BOOLEAN, lock_content,
+ GIMP_TYPE_COLOR_TAG, color_tag,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-set-lock-content",
+ "gimp-item-set-color-tag",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-set-lock-content",
+ return_vals = gimp_run_procedure_array ("gimp-item-set-color-tag",
args);
gimp_value_array_unref (args);
@@ -1045,146 +2308,154 @@ gimp_item_set_lock_content (gint32 item_ID,
}
/**
- * gimp_item_get_lock_position:
- * @item_ID: The item.
+ * gimp_item_get_tattoo:
+ * @item: The item.
*
- * Get the 'lock position' state of the specified item.
+ * Get the tattoo of the specified item.
*
- * This procedure returns the specified item's lock position state.
+ * This procedure returns the specified item's tattoo. A tattoo is a
+ * unique and permanent identifier attached to a item that can be used
+ * to uniquely identify a item within an image even between sessions.
*
- * Returns: Whether the item's position is locked.
+ * Returns: The item tattoo.
*
- * Since: 2.10
+ * Since: 2.8
**/
-gboolean
-gimp_item_get_lock_position (gint32 item_ID)
+guint
+gimp_item_get_tattoo (GimpItem *item)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean lock_position = FALSE;
+ guint tattoo = 0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_ITEM_ID, item_ID,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-get-lock-position",
+ "gimp-item-get-tattoo",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-get-lock-position",
+ return_vals = gimp_run_procedure_array ("gimp-item-get-tattoo",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- lock_position = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ tattoo = g_value_get_uint (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return lock_position;
+ return tattoo;
}
/**
- * gimp_item_set_lock_position:
+ * _gimp_item_get_tattoo: (skip)
* @item_ID: The item.
- * @lock_position: The new item 'lock position' state.
*
- * Set the 'lock position' state of the specified item.
+ * Get the tattoo of the specified item.
*
- * This procedure sets the specified item's lock position state.
+ * This procedure returns the specified item's tattoo. A tattoo is a
+ * unique and permanent identifier attached to a item that can be used
+ * to uniquely identify a item within an image even between sessions.
*
- * Returns: TRUE on success.
+ * Returns: The item tattoo.
*
- * Since: 2.10
+ * Since: 2.8
**/
-gboolean
-gimp_item_set_lock_position (gint32 item_ID,
- gboolean lock_position)
+guint
+_gimp_item_get_tattoo (gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ guint tattoo = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, item_ID,
- G_TYPE_BOOLEAN, lock_position,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-set-lock-position",
+ "gimp-item-get-tattoo",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-set-lock-position",
+ return_vals = gimp_run_procedure_array ("gimp-item-get-tattoo",
args);
gimp_value_array_unref (args);
- success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ tattoo = g_value_get_uint (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return tattoo;
}
/**
- * gimp_item_get_color_tag:
- * @item_ID: The item.
+ * gimp_item_set_tattoo:
+ * @item: The item.
+ * @tattoo: The new item tattoo.
*
- * Get the color tag of the specified item.
+ * Set the tattoo of the specified item.
*
- * This procedure returns the specified item's color tag.
+ * This procedure sets the specified item's tattoo. A tattoo is a
+ * unique and permanent identifier attached to a item that can be used
+ * to uniquely identify a item within an image even between sessions.
*
- * Returns: The item's color tag.
+ * Returns: TRUE on success.
*
- * Since: 2.10
+ * Since: 2.8
**/
-GimpColorTag
-gimp_item_get_color_tag (gint32 item_ID)
+gboolean
+gimp_item_set_tattoo (GimpItem *item,
+ guint tattoo)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- GimpColorTag color_tag = 0;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_ITEM_ID, item_ID,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_UINT, tattoo,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-get-color-tag",
+ "gimp-item-set-tattoo",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-get-color-tag",
+ return_vals = gimp_run_procedure_array ("gimp-item-set-tattoo",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- color_tag = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return color_tag;
+ return success;
}
/**
- * gimp_item_set_color_tag:
+ * _gimp_item_set_tattoo: (skip)
* @item_ID: The item.
- * @color_tag: The new item color tag.
+ * @tattoo: The new item tattoo.
*
- * Set the color tag of the specified item.
+ * Set the tattoo of the specified item.
*
- * This procedure sets the specified item's color tag.
+ * This procedure sets the specified item's tattoo. A tattoo is a
+ * unique and permanent identifier attached to a item that can be used
+ * to uniquely identify a item within an image even between sessions.
*
* Returns: TRUE on success.
*
- * Since: 2.10
+ * Since: 2.8
**/
gboolean
-gimp_item_set_color_tag (gint32 item_ID,
- GimpColorTag color_tag)
+_gimp_item_set_tattoo (gint32 item_ID,
+ guint tattoo)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1193,15 +2464,15 @@ gimp_item_set_color_tag (gint32 item_ID,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, item_ID,
- GIMP_TYPE_COLOR_TAG, color_tag,
+ G_TYPE_UINT, tattoo,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-set-color-tag",
+ "gimp-item-set-tattoo",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-set-color-tag",
+ return_vals = gimp_run_procedure_array ("gimp-item-set-tattoo",
args);
gimp_value_array_unref (args);
@@ -1213,66 +2484,66 @@ gimp_item_set_color_tag (gint32 item_ID,
}
/**
- * gimp_item_get_tattoo:
- * @item_ID: The item.
+ * gimp_item_attach_parasite:
+ * @item: The item.
+ * @parasite: The parasite to attach to the item.
*
- * Get the tattoo of the specified item.
+ * Add a parasite to an item.
*
- * This procedure returns the specified item's tattoo. A tattoo is a
- * unique and permanent identifier attached to a item that can be used
- * to uniquely identify a item within an image even between sessions.
+ * This procedure attaches a parasite to an item. It has no return
+ * values.
*
- * Returns: The item tattoo.
+ * Returns: TRUE on success.
*
* Since: 2.8
**/
-guint
-gimp_item_get_tattoo (gint32 item_ID)
+gboolean
+gimp_item_attach_parasite (GimpItem *item,
+ const GimpParasite *parasite)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- guint tattoo = 0;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_ITEM_ID, item_ID,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ GIMP_TYPE_PARASITE, parasite,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-get-tattoo",
+ "gimp-item-attach-parasite",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-get-tattoo",
+ return_vals = gimp_run_procedure_array ("gimp-item-attach-parasite",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- tattoo = g_value_get_uint (gimp_value_array_index (return_vals, 1));
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return tattoo;
+ return success;
}
/**
- * gimp_item_set_tattoo:
+ * _gimp_item_attach_parasite: (skip)
* @item_ID: The item.
- * @tattoo: The new item tattoo.
+ * @parasite: The parasite to attach to the item.
*
- * Set the tattoo of the specified item.
+ * Add a parasite to an item.
*
- * This procedure sets the specified item's tattoo. A tattoo is a
- * unique and permanent identifier attached to a item that can be used
- * to uniquely identify a item within an image even between sessions.
+ * This procedure attaches a parasite to an item. It has no return
+ * values.
*
* Returns: TRUE on success.
*
* Since: 2.8
**/
gboolean
-gimp_item_set_tattoo (gint32 item_ID,
- guint tattoo)
+_gimp_item_attach_parasite (gint32 item_ID,
+ const GimpParasite *parasite)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1281,15 +2552,15 @@ gimp_item_set_tattoo (gint32 item_ID,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, item_ID,
- G_TYPE_UINT, tattoo,
+ GIMP_TYPE_PARASITE, parasite,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-set-tattoo",
+ "gimp-item-attach-parasite",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-set-tattoo",
+ return_vals = gimp_run_procedure_array ("gimp-item-attach-parasite",
args);
gimp_value_array_unref (args);
@@ -1301,13 +2572,13 @@ gimp_item_set_tattoo (gint32 item_ID,
}
/**
- * gimp_item_attach_parasite:
- * @item_ID: The item.
- * @parasite: The parasite to attach to the item.
+ * gimp_item_detach_parasite:
+ * @item: The item.
+ * @name: The name of the parasite to detach from the item.
*
- * Add a parasite to an item.
+ * Removes a parasite from an item.
*
- * This procedure attaches a parasite to an item. It has no return
+ * This procedure detaches a parasite from an item. It has no return
* values.
*
* Returns: TRUE on success.
@@ -1315,8 +2586,8 @@ gimp_item_set_tattoo (gint32 item_ID,
* Since: 2.8
**/
gboolean
-gimp_item_attach_parasite (gint32 item_ID,
- const GimpParasite *parasite)
+gimp_item_detach_parasite (GimpItem *item,
+ const gchar *name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1324,16 +2595,16 @@ gimp_item_attach_parasite (gint32 item_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_ITEM_ID, item_ID,
- GIMP_TYPE_PARASITE, parasite,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_STRING, name,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-attach-parasite",
+ "gimp-item-detach-parasite",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-attach-parasite",
+ return_vals = gimp_run_procedure_array ("gimp-item-detach-parasite",
args);
gimp_value_array_unref (args);
@@ -1345,7 +2616,7 @@ gimp_item_attach_parasite (gint32 item_ID,
}
/**
- * gimp_item_detach_parasite:
+ * _gimp_item_detach_parasite: (skip)
* @item_ID: The item.
* @name: The name of the parasite to detach from the item.
*
@@ -1359,8 +2630,8 @@ gimp_item_attach_parasite (gint32 item_ID,
* Since: 2.8
**/
gboolean
-gimp_item_detach_parasite (gint32 item_ID,
- const gchar *name)
+_gimp_item_detach_parasite (gint32 item_ID,
+ const gchar *name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1390,7 +2661,7 @@ gimp_item_detach_parasite (gint32 item_ID,
/**
* gimp_item_get_parasite:
- * @item_ID: The item.
+ * @item: The item.
* @name: The name of the parasite to find.
*
* Look up a parasite in an item
@@ -1402,7 +2673,7 @@ gimp_item_detach_parasite (gint32 item_ID,
* Since: 2.8
**/
GimpParasite *
-gimp_item_get_parasite (gint32 item_ID,
+gimp_item_get_parasite (GimpItem *item,
const gchar *name)
{
GimpPDB *pdb = gimp_get_pdb ();
@@ -1410,6 +2681,50 @@ gimp_item_get_parasite (gint32 item_ID,
GimpValueArray *return_vals;
GimpParasite *parasite = NULL;
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_STRING, name,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-get-parasite",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-get-parasite",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ parasite = g_value_dup_boxed (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return parasite;
+}
+
+/**
+ * _gimp_item_get_parasite: (skip)
+ * @item_ID: The item.
+ * @name: The name of the parasite to find.
+ *
+ * Look up a parasite in an item
+ *
+ * Finds and returns the parasite that is attached to an item.
+ *
+ * Returns: The found parasite.
+ *
+ * Since: 2.8
+ **/
+GimpParasite *
+_gimp_item_get_parasite (gint32 item_ID,
+ const gchar *name)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpParasite *parasite = NULL;
+
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, item_ID,
G_TYPE_STRING, name,
@@ -1434,7 +2749,7 @@ gimp_item_get_parasite (gint32 item_ID,
/**
* gimp_item_get_parasite_list:
- * @item_ID: The item.
+ * @item: The item.
* @num_parasites: (out): The number of attached parasites.
*
* List all parasites.
@@ -1448,8 +2763,58 @@ gimp_item_get_parasite (gint32 item_ID,
* Since: 2.8
**/
gchar **
-gimp_item_get_parasite_list (gint32 item_ID,
- gint *num_parasites)
+gimp_item_get_parasite_list (GimpItem *item,
+ gint *num_parasites)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar **parasites = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-get-parasite-list",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-get-parasite-list",
+ args);
+ gimp_value_array_unref (args);
+
+ *num_parasites = 0;
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ {
+ *num_parasites = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ parasites = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return parasites;
+}
+
+/**
+ * _gimp_item_get_parasite_list: (skip)
+ * @item_ID: The item.
+ * @num_parasites: (out): The number of attached parasites.
+ *
+ * List all parasites.
+ *
+ * Returns a list of all parasites currently attached the an item.
+ *
+ * Returns: (array length=num_parasites):
+ * The names of currently attached parasites.
+ * The returned value must be freed with g_strfreev().
+ *
+ * Since: 2.8
+ **/
+gchar **
+_gimp_item_get_parasite_list (gint32 item_ID,
+ gint *num_parasites)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
diff --git a/libgimp/gimpitem_pdb.h b/libgimp/gimpitem_pdb.h
index 9298f6ff88..a76f797dda 100644
--- a/libgimp/gimpitem_pdb.h
+++ b/libgimp/gimpitem_pdb.h
@@ -32,59 +32,92 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gboolean gimp_item_is_valid (gint32 item_ID);
-gboolean gimp_item_delete (gint32 item_ID);
-gboolean gimp_item_is_drawable (gint32 item_ID);
-gboolean gimp_item_is_layer (gint32 item_ID);
-gboolean gimp_item_is_text_layer (gint32 item_ID);
-gboolean gimp_item_is_channel (gint32 item_ID);
-gboolean gimp_item_is_layer_mask (gint32 item_ID);
-gboolean gimp_item_is_selection (gint32 item_ID);
-gboolean gimp_item_is_vectors (gint32 item_ID);
-gboolean gimp_item_is_group (gint32 item_ID);
-gint32 gimp_item_get_parent (gint32 item_ID);
-gint* gimp_item_get_children (gint32 item_ID,
+
+
+#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+
+gboolean gimp_item_is_valid (GimpItem *item);
+GimpImage* gimp_item_get_image (GimpItem *item);
+gboolean gimp_item_delete (GimpItem *item);
+gboolean gimp_item_is_drawable (GimpItem *item);
+gboolean gimp_item_is_layer (GimpItem *item);
+gboolean gimp_item_is_text_layer (GimpItem *item);
+gboolean gimp_item_is_channel (GimpItem *item);
+gboolean gimp_item_is_layer_mask (GimpItem *item);
+gboolean gimp_item_is_selection (GimpItem *item);
+gboolean gimp_item_is_vectors (GimpItem *item);
+gboolean gimp_item_is_group (GimpItem *item);
+GimpItem* gimp_item_get_parent (GimpItem *item);
+gint* gimp_item_get_children (GimpItem *item,
gint *num_children);
-gboolean gimp_item_get_expanded (gint32 item_ID);
-gboolean gimp_item_set_expanded (gint32 item_ID,
+gboolean gimp_item_get_expanded (GimpItem *item);
+gboolean gimp_item_set_expanded (GimpItem *item,
gboolean expanded);
-gchar* gimp_item_get_name (gint32 item_ID);
-gboolean gimp_item_set_name (gint32 item_ID,
+gchar* gimp_item_get_name (GimpItem *item);
+gboolean gimp_item_set_name (GimpItem *item,
const gchar *name);
-gboolean gimp_item_get_visible (gint32 item_ID);
-gboolean gimp_item_set_visible (gint32 item_ID,
+gboolean gimp_item_get_visible (GimpItem *item);
+gboolean gimp_item_set_visible (GimpItem *item,
gboolean visible);
-gboolean gimp_item_get_linked (gint32 item_ID);
-gboolean gimp_item_set_linked (gint32 item_ID,
+gboolean gimp_item_get_linked (GimpItem *item);
+gboolean gimp_item_set_linked (GimpItem *item,
gboolean linked);
-gboolean gimp_item_get_lock_content (gint32 item_ID);
-gboolean gimp_item_set_lock_content (gint32 item_ID,
+gboolean gimp_item_get_lock_content (GimpItem *item);
+gboolean gimp_item_set_lock_content (GimpItem *item,
gboolean lock_content);
-gboolean gimp_item_get_lock_position (gint32 item_ID);
-gboolean gimp_item_set_lock_position (gint32 item_ID,
+gboolean gimp_item_get_lock_position (GimpItem *item);
+gboolean gimp_item_set_lock_position (GimpItem *item,
gboolean lock_position);
-GimpColorTag gimp_item_get_color_tag (gint32 item_ID);
-gboolean gimp_item_set_color_tag (gint32 item_ID,
+GimpColorTag gimp_item_get_color_tag (GimpItem *item);
+gboolean gimp_item_set_color_tag (GimpItem *item,
GimpColorTag color_tag);
-guint gimp_item_get_tattoo (gint32 item_ID);
-gboolean gimp_item_set_tattoo (gint32 item_ID,
+guint gimp_item_get_tattoo (GimpItem *item);
+gboolean gimp_item_set_tattoo (GimpItem *item,
guint tattoo);
-gboolean gimp_item_attach_parasite (gint32 item_ID,
+gboolean gimp_item_attach_parasite (GimpItem *item,
const GimpParasite *parasite);
-gboolean gimp_item_detach_parasite (gint32 item_ID,
+gboolean gimp_item_detach_parasite (GimpItem *item,
const gchar *name);
-GimpParasite* gimp_item_get_parasite (gint32 item_ID,
+GimpParasite* gimp_item_get_parasite (GimpItem *item,
const gchar *name);
-gchar** gimp_item_get_parasite_list (gint32 item_ID,
+gchar** gimp_item_get_parasite_list (GimpItem *item,
gint *num_parasites);
-#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
-
-GimpImage* gimp_item_get_image (gint32 item_ID);
-
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
+#define gimp_item_is_valid _gimp_item_is_valid
#define gimp_item_get_image _gimp_item_get_image
+#define gimp_item_delete _gimp_item_delete
+#define gimp_item_is_drawable _gimp_item_is_drawable
+#define gimp_item_is_layer _gimp_item_is_layer
+#define gimp_item_is_text_layer _gimp_item_is_text_layer
+#define gimp_item_is_channel _gimp_item_is_channel
+#define gimp_item_is_layer_mask _gimp_item_is_layer_mask
+#define gimp_item_is_selection _gimp_item_is_selection
+#define gimp_item_is_vectors _gimp_item_is_vectors
+#define gimp_item_is_group _gimp_item_is_group
+#define gimp_item_get_parent _gimp_item_get_parent
+#define gimp_item_get_children _gimp_item_get_children
+#define gimp_item_get_expanded _gimp_item_get_expanded
+#define gimp_item_set_expanded _gimp_item_set_expanded
+#define gimp_item_get_name _gimp_item_get_name
+#define gimp_item_set_name _gimp_item_set_name
+#define gimp_item_get_visible _gimp_item_get_visible
+#define gimp_item_set_visible _gimp_item_set_visible
+#define gimp_item_get_linked _gimp_item_get_linked
+#define gimp_item_set_linked _gimp_item_set_linked
+#define gimp_item_get_lock_content _gimp_item_get_lock_content
+#define gimp_item_set_lock_content _gimp_item_set_lock_content
+#define gimp_item_get_lock_position _gimp_item_get_lock_position
+#define gimp_item_set_lock_position _gimp_item_set_lock_position
+#define gimp_item_get_color_tag _gimp_item_get_color_tag
+#define gimp_item_set_color_tag _gimp_item_set_color_tag
+#define gimp_item_get_tattoo _gimp_item_get_tattoo
+#define gimp_item_set_tattoo _gimp_item_set_tattoo
+#define gimp_item_attach_parasite _gimp_item_attach_parasite
+#define gimp_item_detach_parasite _gimp_item_detach_parasite
+#define gimp_item_get_parasite _gimp_item_get_parasite
+#define gimp_item_get_parasite_list _gimp_item_get_parasite_list
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@@ -93,7 +126,52 @@ GimpImage* gimp_item_get_image (gint32 item_ID);
* They are not marked internal as a trick to keep the old API alive for now.
*/
-gint32 _gimp_item_get_image (gint32 item_ID);
+gboolean _gimp_item_is_valid (gint32 item_ID);
+gint32 _gimp_item_get_image (gint32 item_ID);
+gboolean _gimp_item_delete (gint32 item_ID);
+gboolean _gimp_item_is_drawable (gint32 item_ID);
+gboolean _gimp_item_is_layer (gint32 item_ID);
+gboolean _gimp_item_is_text_layer (gint32 item_ID);
+gboolean _gimp_item_is_channel (gint32 item_ID);
+gboolean _gimp_item_is_layer_mask (gint32 item_ID);
+gboolean _gimp_item_is_selection (gint32 item_ID);
+gboolean _gimp_item_is_vectors (gint32 item_ID);
+gboolean _gimp_item_is_group (gint32 item_ID);
+gint32 _gimp_item_get_parent (gint32 item_ID);
+gint* _gimp_item_get_children (gint32 item_ID,
+ gint *num_children);
+gboolean _gimp_item_get_expanded (gint32 item_ID);
+gboolean _gimp_item_set_expanded (gint32 item_ID,
+ gboolean expanded);
+gchar* _gimp_item_get_name (gint32 item_ID);
+gboolean _gimp_item_set_name (gint32 item_ID,
+ const gchar *name);
+gboolean _gimp_item_get_visible (gint32 item_ID);
+gboolean _gimp_item_set_visible (gint32 item_ID,
+ gboolean visible);
+gboolean _gimp_item_get_linked (gint32 item_ID);
+gboolean _gimp_item_set_linked (gint32 item_ID,
+ gboolean linked);
+gboolean _gimp_item_get_lock_content (gint32 item_ID);
+gboolean _gimp_item_set_lock_content (gint32 item_ID,
+ gboolean lock_content);
+gboolean _gimp_item_get_lock_position (gint32 item_ID);
+gboolean _gimp_item_set_lock_position (gint32 item_ID,
+ gboolean lock_position);
+GimpColorTag _gimp_item_get_color_tag (gint32 item_ID);
+gboolean _gimp_item_set_color_tag (gint32 item_ID,
+ GimpColorTag color_tag);
+guint _gimp_item_get_tattoo (gint32 item_ID);
+gboolean _gimp_item_set_tattoo (gint32 item_ID,
+ guint tattoo);
+gboolean _gimp_item_attach_parasite (gint32 item_ID,
+ const GimpParasite *parasite);
+gboolean _gimp_item_detach_parasite (gint32 item_ID,
+ const gchar *name);
+GimpParasite* _gimp_item_get_parasite (gint32 item_ID,
+ const gchar *name);
+gchar** _gimp_item_get_parasite_list (gint32 item_ID,
+ gint *num_parasites);
G_END_DECLS
diff --git a/libgimp/gimpitemtransform_pdb.c b/libgimp/gimpitemtransform_pdb.c
index f7f3639400..285308b345 100644
--- a/libgimp/gimpitemtransform_pdb.c
+++ b/libgimp/gimpitemtransform_pdb.c
@@ -36,6 +36,61 @@
/**
* gimp_item_transform_translate:
+ * @item: The item.
+ * @off_x: Offset in x direction.
+ * @off_y: Offset in y direction.
+ *
+ * Translate the item by the specified offsets.
+ *
+ * This procedure translates the item by the amounts specified in the
+ * off_x and off_y arguments. These can be negative, and are considered
+ * offsets from the current position. The offsets will be rounded to
+ * the nearest pixel unless the item is a path.
+ *
+ * If the item is attached to an image and has its linked flag set to
+ * TRUE, all additional items contained in the image which have the
+ * linked flag set to TRUE will also be translated by the specified
+ * offsets.
+ *
+ * Returns: (transfer full): The translated item.
+ *
+ * Since: 2.10
+ **/
+GimpItem *
+gimp_item_transform_translate (GimpItem *item,
+ gdouble off_x,
+ gdouble off_y)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpItem *ret_item = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_DOUBLE, off_x,
+ G_TYPE_DOUBLE, off_y,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-transform-translate",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-transform-translate",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
+
+ gimp_value_array_unref (return_vals);
+
+ return ret_item;
+}
+
+/**
+ * _gimp_item_transform_translate: (skip)
* @item_ID: The item.
* @off_x: Offset in x direction.
* @off_y: Offset in y direction.
@@ -57,9 +112,9 @@
* Since: 2.10
**/
gint32
-gimp_item_transform_translate (gint32 item_ID,
- gdouble off_x,
- gdouble off_y)
+_gimp_item_transform_translate (gint32 item_ID,
+ gdouble off_x,
+ gdouble off_y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -91,6 +146,74 @@ gimp_item_transform_translate (gint32 item_ID,
/**
* gimp_item_transform_flip_simple:
+ * @item: The affected item.
+ * @flip_type: Type of flip.
+ * @auto_center: Whether to automatically position the axis in the selection center.
+ * @axis: coord. of flip axis.
+ *
+ * Flip the specified item either vertically or horizontally.
+ *
+ * This procedure flips the specified item.
+ *
+ * If a selection exists and the item is a drawable, the portion of the
+ * drawable which lies under the selection is cut from the drawable and
+ * made into a floating selection which is then flipped. If auto_center
+ * is set to TRUE, the flip is around the selection's center.
+ * Otherwise, the coordinate of the axis needs to be specified. The
+ * return value is the ID of the flipped floating selection.
+ *
+ * If there is no selection or the item is not a drawable, the entire
+ * item will be flipped around its center if auto_center is set to
+ * TRUE, otherwise the coordinate of the axis needs to be specified.
+ * Additionally, if the item has its linked flag set to TRUE, all
+ * additional items contained in the image which have the linked flag
+ * set to TRUE will also be flipped around the same axis. The return
+ * value will be equal to the item ID supplied as input.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_transform_resize().
+ *
+ * Returns: (transfer full): The flipped item.
+ *
+ * Since: 2.2
+ **/
+GimpItem *
+gimp_item_transform_flip_simple (GimpItem *item,
+ GimpOrientationType flip_type,
+ gboolean auto_center,
+ gdouble axis)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpItem *ret_item = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ GIMP_TYPE_ORIENTATION_TYPE, flip_type,
+ G_TYPE_BOOLEAN, auto_center,
+ G_TYPE_DOUBLE, axis,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-transform-flip-simple",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-transform-flip-simple",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
+
+ gimp_value_array_unref (return_vals);
+
+ return ret_item;
+}
+
+/**
+ * _gimp_item_transform_flip_simple: (skip)
* @item_ID: The affected item.
* @flip_type: Type of flip.
* @auto_center: Whether to automatically position the axis in the selection center.
@@ -123,10 +246,10 @@ gimp_item_transform_translate (gint32 item_ID,
* Since: 2.2
**/
gint32
-gimp_item_transform_flip_simple (gint32 item_ID,
- GimpOrientationType flip_type,
- gboolean auto_center,
- gdouble axis)
+_gimp_item_transform_flip_simple (gint32 item_ID,
+ GimpOrientationType flip_type,
+ gboolean auto_center,
+ gdouble axis)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -159,6 +282,77 @@ gimp_item_transform_flip_simple (gint32 item_ID,
/**
* gimp_item_transform_flip:
+ * @item: The affected item.
+ * @x0: horz. coord. of one end of axis.
+ * @y0: vert. coord. of one end of axis.
+ * @x1: horz. coord. of other end of axis.
+ * @y1: vert. coord. of other end of axis.
+ *
+ * Flip the specified item around a given line.
+ *
+ * This procedure flips the specified item.
+ *
+ * If a selection exists and the item is a drawable, the portion of the
+ * drawable which lies under the selection is cut from the drawable and
+ * made into a floating selection which is then flipped. The axis to
+ * flip around is specified by specifying two points from that line.
+ * The return value is the ID of the flipped floating selection.
+ *
+ * If there is no selection or the item is not a drawable, the entire
+ * item will be flipped around the specified axis. Additionally, if the
+ * item has its linked flag set to TRUE, all additional items contained
+ * in the image which have the linked flag set to TRUE will also be
+ * flipped around the same axis. The return value will be equal to the
+ * item ID supplied as input.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_interpolation(),
+ * gimp_context_set_transform_direction(),
+ * gimp_context_set_transform_resize().
+ *
+ * Returns: (transfer full): The flipped item.
+ *
+ * Since: 2.8
+ **/
+GimpItem *
+gimp_item_transform_flip (GimpItem *item,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpItem *ret_item = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_DOUBLE, x0,
+ G_TYPE_DOUBLE, y0,
+ G_TYPE_DOUBLE, x1,
+ G_TYPE_DOUBLE, y1,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-transform-flip",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-transform-flip",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
+
+ gimp_value_array_unref (return_vals);
+
+ return ret_item;
+}
+
+/**
+ * _gimp_item_transform_flip: (skip)
* @item_ID: The affected item.
* @x0: horz. coord. of one end of axis.
* @y0: vert. coord. of one end of axis.
@@ -192,11 +386,11 @@ gimp_item_transform_flip_simple (gint32 item_ID,
* Since: 2.8
**/
gint32
-gimp_item_transform_flip (gint32 item_ID,
- gdouble x0,
- gdouble y0,
- gdouble x1,
- gdouble y1)
+_gimp_item_transform_flip (gint32 item_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -230,6 +424,98 @@ gimp_item_transform_flip (gint32 item_ID,
/**
* gimp_item_transform_perspective:
+ * @item: The affected item.
+ * @x0: The new x coordinate of upper-left corner of original bounding box.
+ * @y0: The new y coordinate of upper-left corner of original bounding box.
+ * @x1: The new x coordinate of upper-right corner of original bounding box.
+ * @y1: The new y coordinate of upper-right corner of original bounding box.
+ * @x2: The new x coordinate of lower-left corner of original bounding box.
+ * @y2: The new y coordinate of lower-left corner of original bounding box.
+ * @x3: The new x coordinate of lower-right corner of original bounding box.
+ * @y3: The new y coordinate of lower-right corner of original bounding box.
+ *
+ * Perform a possibly non-affine transformation on the specified item.
+ *
+ * This procedure performs a possibly non-affine transformation on the
+ * specified item by allowing the corners of the original bounding box
+ * to be arbitrarily remapped to any values.
+ *
+ * The 4 coordinates specify the new locations of each corner of the
+ * original bounding box. By specifying these values, any affine
+ * transformation (rotation, scaling, translation) can be affected.
+ * Additionally, these values can be specified such that the resulting
+ * transformed item will appear to have been projected via a
+ * perspective transform.
+ *
+ * If a selection exists and the item is a drawable, the portion of the
+ * drawable which lies under the selection is cut from the drawable and
+ * made into a floating selection which is then transformed as
+ * specified. The return value is the ID of the transformed floating
+ * selection.
+ *
+ * If there is no selection or the item is not a drawable, the entire
+ * item will be transformed according to the specified mapping.
+ * Additionally, if the item has its linked flag set to TRUE, all
+ * additional items contained in the image which have the linked flag
+ * set to TRUE will also be transformed the same way. The return value
+ * will be equal to the item ID supplied as input.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_interpolation(),
+ * gimp_context_set_transform_direction(),
+ * gimp_context_set_transform_resize().
+ *
+ * Returns: (transfer full): The transformed item.
+ *
+ * Since: 2.8
+ **/
+GimpItem *
+gimp_item_transform_perspective (GimpItem *item,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2,
+ gdouble x3,
+ gdouble y3)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpItem *ret_item = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_DOUBLE, x0,
+ G_TYPE_DOUBLE, y0,
+ G_TYPE_DOUBLE, x1,
+ G_TYPE_DOUBLE, y1,
+ G_TYPE_DOUBLE, x2,
+ G_TYPE_DOUBLE, y2,
+ G_TYPE_DOUBLE, x3,
+ G_TYPE_DOUBLE, y3,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-transform-perspective",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-transform-perspective",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
+
+ gimp_value_array_unref (return_vals);
+
+ return ret_item;
+}
+
+/**
+ * _gimp_item_transform_perspective: (skip)
* @item_ID: The affected item.
* @x0: The new x coordinate of upper-left corner of original bounding box.
* @y0: The new y coordinate of upper-left corner of original bounding box.
@@ -276,15 +562,15 @@ gimp_item_transform_flip (gint32 item_ID,
* Since: 2.8
**/
gint32
-gimp_item_transform_perspective (gint32 item_ID,
- gdouble x0,
- gdouble y0,
- gdouble x1,
- gdouble y1,
- gdouble x2,
- gdouble y2,
- gdouble x3,
- gdouble y3)
+_gimp_item_transform_perspective (gint32 item_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2,
+ gdouble x3,
+ gdouble y3)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -322,7 +608,7 @@ gimp_item_transform_perspective (gint32 item_ID,
/**
* gimp_item_transform_rotate_simple:
- * @item_ID: The affected item.
+ * @item: The affected item.
* @rotate_type: Type of rotation.
* @auto_center: Whether to automatically rotate around the selection center.
* @center_x: The hor. coordinate of the center of rotation.
@@ -353,24 +639,24 @@ gimp_item_transform_perspective (gint32 item_ID,
* This procedure is affected by the following context setters:
* gimp_context_set_transform_resize().
*
- * Returns: The rotated item.
+ * Returns: (transfer full): The rotated item.
*
* Since: 2.8
**/
-gint32
-gimp_item_transform_rotate_simple (gint32 item_ID,
- GimpRotationType rotate_type,
- gboolean auto_center,
- gdouble center_x,
- gdouble center_y)
+GimpItem *
+gimp_item_transform_rotate_simple (GimpItem *item,
+ GimpRotationType rotate_type,
+ gboolean auto_center,
+ gdouble center_x,
+ gdouble center_y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 ret_item_ID = -1;
+ GimpItem *ret_item = NULL;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_ITEM_ID, item_ID,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
GIMP_TYPE_ROTATION_TYPE, rotate_type,
G_TYPE_BOOLEAN, auto_center,
G_TYPE_DOUBLE, center_x,
@@ -387,17 +673,17 @@ gimp_item_transform_rotate_simple (gint32 item_ID,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- ret_item_ID = gimp_value_get_item_id (gimp_value_array_index (return_vals, 1));
+ ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
- return ret_item_ID;
+ return ret_item;
}
/**
- * gimp_item_transform_rotate:
+ * _gimp_item_transform_rotate_simple: (skip)
* @item_ID: The affected item.
- * @angle: The angle of rotation (radians).
+ * @rotate_type: Type of rotation.
* @auto_center: Whether to automatically rotate around the selection center.
* @center_x: The hor. coordinate of the center of rotation.
* @center_y: The vert. coordinate of the center of rotation.
@@ -425,8 +711,6 @@ gimp_item_transform_rotate_simple (gint32 item_ID,
* input.
*
* This procedure is affected by the following context setters:
- * gimp_context_set_interpolation(),
- * gimp_context_set_transform_direction(),
* gimp_context_set_transform_resize().
*
* Returns: The rotated item.
@@ -434,11 +718,11 @@ gimp_item_transform_rotate_simple (gint32 item_ID,
* Since: 2.8
**/
gint32
-gimp_item_transform_rotate (gint32 item_ID,
- gdouble angle,
- gboolean auto_center,
- gdouble center_x,
- gdouble center_y)
+_gimp_item_transform_rotate_simple (gint32 item_ID,
+ GimpRotationType rotate_type,
+ gboolean auto_center,
+ gdouble center_x,
+ gdouble center_y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -447,7 +731,7 @@ gimp_item_transform_rotate (gint32 item_ID,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_ITEM_ID, item_ID,
- G_TYPE_DOUBLE, angle,
+ GIMP_TYPE_ROTATION_TYPE, rotate_type,
G_TYPE_BOOLEAN, auto_center,
G_TYPE_DOUBLE, center_x,
G_TYPE_DOUBLE, center_y,
@@ -455,10 +739,10 @@ gimp_item_transform_rotate (gint32 item_ID,
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-item-transform-rotate",
+ "gimp-item-transform-rotate-simple",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-item-transform-rotate",
+ return_vals = gimp_run_procedure_array ("gimp-item-transform-rotate-simple",
args);
gimp_value_array_unref (args);
@@ -471,7 +755,232 @@ gimp_item_transform_rotate (gint32 item_ID,
}
/**
- * gimp_item_transform_scale:
+ * gimp_item_transform_rotate:
+ * @item: The affected item.
+ * @angle: The angle of rotation (radians).
+ * @auto_center: Whether to automatically rotate around the selection center.
+ * @center_x: The hor. coordinate of the center of rotation.
+ * @center_y: The vert. coordinate of the center of rotation.
+ *
+ * Rotate the specified item about given coordinates through the
+ * specified angle.
+ *
+ * This function rotates the specified item.
+ *
+ * If a selection exists and the item is a drawable, the portion of the
+ * drawable which lies under the selection is cut from the drawable and
+ * made into a floating selection which is then rotated by the
+ * specified amount. If auto_center is set to TRUE, the rotation is
+ * around the selection's center. Otherwise, the coordinate of the
+ * center point needs to be specified. The return value is the ID of
+ * the rotated floating selection.
+ *
+ * If there is no selection or the item is not a drawable, the entire
+ * item will be rotated around its center if auto_center is set to
+ * TRUE, otherwise the coordinate of the center point needs to be
+ * specified. Additionally, if the item has its linked flag set to
+ * TRUE, all additional items contained in the image which have the
+ * linked flag set to TRUE will also be rotated around the same center
+ * point. The return value will be equal to the item ID supplied as
+ * input.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_interpolation(),
+ * gimp_context_set_transform_direction(),
+ * gimp_context_set_transform_resize().
+ *
+ * Returns: (transfer full): The rotated item.
+ *
+ * Since: 2.8
+ **/
+GimpItem *
+gimp_item_transform_rotate (GimpItem *item,
+ gdouble angle,
+ gboolean auto_center,
+ gdouble center_x,
+ gdouble center_y)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpItem *ret_item = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_DOUBLE, angle,
+ G_TYPE_BOOLEAN, auto_center,
+ G_TYPE_DOUBLE, center_x,
+ G_TYPE_DOUBLE, center_y,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-transform-rotate",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-transform-rotate",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
+
+ gimp_value_array_unref (return_vals);
+
+ return ret_item;
+}
+
+/**
+ * _gimp_item_transform_rotate: (skip)
+ * @item_ID: The affected item.
+ * @angle: The angle of rotation (radians).
+ * @auto_center: Whether to automatically rotate around the selection center.
+ * @center_x: The hor. coordinate of the center of rotation.
+ * @center_y: The vert. coordinate of the center of rotation.
+ *
+ * Rotate the specified item about given coordinates through the
+ * specified angle.
+ *
+ * This function rotates the specified item.
+ *
+ * If a selection exists and the item is a drawable, the portion of the
+ * drawable which lies under the selection is cut from the drawable and
+ * made into a floating selection which is then rotated by the
+ * specified amount. If auto_center is set to TRUE, the rotation is
+ * around the selection's center. Otherwise, the coordinate of the
+ * center point needs to be specified. The return value is the ID of
+ * the rotated floating selection.
+ *
+ * If there is no selection or the item is not a drawable, the entire
+ * item will be rotated around its center if auto_center is set to
+ * TRUE, otherwise the coordinate of the center point needs to be
+ * specified. Additionally, if the item has its linked flag set to
+ * TRUE, all additional items contained in the image which have the
+ * linked flag set to TRUE will also be rotated around the same center
+ * point. The return value will be equal to the item ID supplied as
+ * input.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_interpolation(),
+ * gimp_context_set_transform_direction(),
+ * gimp_context_set_transform_resize().
+ *
+ * Returns: The rotated item.
+ *
+ * Since: 2.8
+ **/
+gint32
+_gimp_item_transform_rotate (gint32 item_ID,
+ gdouble angle,
+ gboolean auto_center,
+ gdouble center_x,
+ gdouble center_y)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 ret_item_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, item_ID,
+ G_TYPE_DOUBLE, angle,
+ G_TYPE_BOOLEAN, auto_center,
+ G_TYPE_DOUBLE, center_x,
+ G_TYPE_DOUBLE, center_y,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-transform-rotate",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-transform-rotate",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ ret_item_ID = gimp_value_get_item_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return ret_item_ID;
+}
+
+/**
+ * gimp_item_transform_scale:
+ * @item: The affected item.
+ * @x0: The new x coordinate of the upper-left corner of the scaled region.
+ * @y0: The new y coordinate of the upper-left corner of the scaled region.
+ * @x1: The new x coordinate of the lower-right corner of the scaled region.
+ * @y1: The new y coordinate of the lower-right corner of the scaled region.
+ *
+ * Scale the specified item.
+ *
+ * This procedure scales the specified item.
+ *
+ * The 2 coordinates specify the new locations of the top-left and
+ * bottom-roght corners of the original bounding box.
+ *
+ * If a selection exists and the item is a drawable, the portion of the
+ * drawable which lies under the selection is cut from the drawable and
+ * made into a floating selection which is then scaled as specified.
+ * The return value is the ID of the scaled floating selection.
+ *
+ * If there is no selection or the item is not a drawable, the entire
+ * item will be scaled according to the specified coordinates.
+ * Additionally, if the item has its linked flag set to TRUE, all
+ * additional items contained in the image which have the linked flag
+ * set to TRUE will also be scaled the same way. The return value will
+ * be equal to the item ID supplied as input.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_interpolation(),
+ * gimp_context_set_transform_direction(),
+ * gimp_context_set_transform_resize().
+ *
+ * Returns: (transfer full): The scaled item.
+ *
+ * Since: 2.8
+ **/
+GimpItem *
+gimp_item_transform_scale (GimpItem *item,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpItem *ret_item = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_DOUBLE, x0,
+ G_TYPE_DOUBLE, y0,
+ G_TYPE_DOUBLE, x1,
+ G_TYPE_DOUBLE, y1,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-transform-scale",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-transform-scale",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
+
+ gimp_value_array_unref (return_vals);
+
+ return ret_item;
+}
+
+/**
+ * _gimp_item_transform_scale: (skip)
* @item_ID: The affected item.
* @x0: The new x coordinate of the upper-left corner of the scaled region.
* @y0: The new y coordinate of the upper-left corner of the scaled region.
@@ -507,11 +1016,11 @@ gimp_item_transform_rotate (gint32 item_ID,
* Since: 2.8
**/
gint32
-gimp_item_transform_scale (gint32 item_ID,
- gdouble x0,
- gdouble y0,
- gdouble x1,
- gdouble y1)
+_gimp_item_transform_scale (gint32 item_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -545,6 +1054,75 @@ gimp_item_transform_scale (gint32 item_ID,
/**
* gimp_item_transform_shear:
+ * @item: The affected item.
+ * @shear_type: Type of shear.
+ * @magnitude: The magnitude of the shear.
+ *
+ * Shear the specified item about its center by the specified
+ * magnitude.
+ *
+ * This procedure shears the specified item.
+ *
+ * The shear type parameter indicates whether the shear will be applied
+ * horizontally or vertically. The magnitude can be either positive or
+ * negative and indicates the extent (in pixels) to shear by.
+ *
+ * If a selection exists and the item is a drawable, the portion of the
+ * drawable which lies under the selection is cut from the drawable and
+ * made into a floating selection which is then sheared as specified.
+ * The return value is the ID of the sheared floating selection.
+ *
+ * If there is no selection or the item is not a drawable, the entire
+ * item will be sheared according to the specified parameters.
+ * Additionally, if the item has its linked flag set to TRUE, all
+ * additional items contained in the image which have the linked flag
+ * set to TRUE will also be sheared the same way. The return value will
+ * be equal to the item ID supplied as input.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_interpolation(),
+ * gimp_context_set_transform_direction(),
+ * gimp_context_set_transform_resize().
+ *
+ * Returns: (transfer full): The sheared item.
+ *
+ * Since: 2.8
+ **/
+GimpItem *
+gimp_item_transform_shear (GimpItem *item,
+ GimpOrientationType shear_type,
+ gdouble magnitude)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpItem *ret_item = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ GIMP_TYPE_ORIENTATION_TYPE, shear_type,
+ G_TYPE_DOUBLE, magnitude,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-transform-shear",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-transform-shear",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
+
+ gimp_value_array_unref (return_vals);
+
+ return ret_item;
+}
+
+/**
+ * _gimp_item_transform_shear: (skip)
* @item_ID: The affected item.
* @shear_type: Type of shear.
* @magnitude: The magnitude of the shear.
@@ -580,9 +1158,9 @@ gimp_item_transform_scale (gint32 item_ID,
* Since: 2.8
**/
gint32
-gimp_item_transform_shear (gint32 item_ID,
- GimpOrientationType shear_type,
- gdouble magnitude)
+_gimp_item_transform_shear (gint32 item_ID,
+ GimpOrientationType shear_type,
+ gdouble magnitude)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -614,6 +1192,91 @@ gimp_item_transform_shear (gint32 item_ID,
/**
* gimp_item_transform_2d:
+ * @item: The affected item.
+ * @source_x: X coordinate of the transformation center.
+ * @source_y: Y coordinate of the transformation center.
+ * @scale_x: Amount to scale in x direction.
+ * @scale_y: Amount to scale in y direction.
+ * @angle: The angle of rotation (radians).
+ * @dest_x: X coordinate of where the center goes.
+ * @dest_y: Y coordinate of where the center goes.
+ *
+ * Transform the specified item in 2d.
+ *
+ * This procedure transforms the specified item.
+ *
+ * The transformation is done by scaling by the x and y scale factors
+ * about the point (source_x, source_y), then rotating around the same
+ * point, then translating that point to the new position (dest_x,
+ * dest_y).
+ *
+ * If a selection exists and the item is a drawable, the portion of the
+ * drawable which lies under the selection is cut from the drawable and
+ * made into a floating selection which is then transformed as
+ * specified. The return value is the ID of the transformed floating
+ * selection.
+ *
+ * If there is no selection or the item is not a drawable, the entire
+ * item will be transformed according to the specified parameters.
+ * Additionally, if the item has its linked flag set to TRUE, all
+ * additional items contained in the image which have the linked flag
+ * set to TRUE will also be transformed the same way. The return value
+ * will be equal to the item ID supplied as input.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_interpolation(),
+ * gimp_context_set_transform_direction(),
+ * gimp_context_set_transform_resize().
+ *
+ * Returns: (transfer full): The transformed item.
+ *
+ * Since: 2.8
+ **/
+GimpItem *
+gimp_item_transform_2d (GimpItem *item,
+ gdouble source_x,
+ gdouble source_y,
+ gdouble scale_x,
+ gdouble scale_y,
+ gdouble angle,
+ gdouble dest_x,
+ gdouble dest_y)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpItem *ret_item = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_DOUBLE, source_x,
+ G_TYPE_DOUBLE, source_y,
+ G_TYPE_DOUBLE, scale_x,
+ G_TYPE_DOUBLE, scale_y,
+ G_TYPE_DOUBLE, angle,
+ G_TYPE_DOUBLE, dest_x,
+ G_TYPE_DOUBLE, dest_y,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-transform-2d",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-transform-2d",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
+
+ gimp_value_array_unref (return_vals);
+
+ return ret_item;
+}
+
+/**
+ * _gimp_item_transform_2d: (skip)
* @item_ID: The affected item.
* @source_x: X coordinate of the transformation center.
* @source_y: Y coordinate of the transformation center.
@@ -655,14 +1318,14 @@ gimp_item_transform_shear (gint32 item_ID,
* Since: 2.8
**/
gint32
-gimp_item_transform_2d (gint32 item_ID,
- gdouble source_x,
- gdouble source_y,
- gdouble scale_x,
- gdouble scale_y,
- gdouble angle,
- gdouble dest_x,
- gdouble dest_y)
+_gimp_item_transform_2d (gint32 item_ID,
+ gdouble source_x,
+ gdouble source_y,
+ gdouble scale_x,
+ gdouble scale_y,
+ gdouble angle,
+ gdouble dest_x,
+ gdouble dest_y)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -699,6 +1362,95 @@ gimp_item_transform_2d (gint32 item_ID,
/**
* gimp_item_transform_matrix:
+ * @item: The affected item.
+ * @coeff_0_0: coefficient (0,0) of the transformation matrix.
+ * @coeff_0_1: coefficient (0,1) of the transformation matrix.
+ * @coeff_0_2: coefficient (0,2) of the transformation matrix.
+ * @coeff_1_0: coefficient (1,0) of the transformation matrix.
+ * @coeff_1_1: coefficient (1,1) of the transformation matrix.
+ * @coeff_1_2: coefficient (1,2) of the transformation matrix.
+ * @coeff_2_0: coefficient (2,0) of the transformation matrix.
+ * @coeff_2_1: coefficient (2,1) of the transformation matrix.
+ * @coeff_2_2: coefficient (2,2) of the transformation matrix.
+ *
+ * Transform the specified item in 2d.
+ *
+ * This procedure transforms the specified item.
+ *
+ * The transformation is done by assembling a 3x3 matrix from the
+ * coefficients passed.
+ *
+ * If a selection exists and the item is a drawable, the portion of the
+ * drawable which lies under the selection is cut from the drawable and
+ * made into a floating selection which is then transformed as
+ * specified. The return value is the ID of the transformed floating
+ * selection.
+ *
+ * If there is no selection or the item is not a drawable, the entire
+ * item will be transformed according to the specified matrix.
+ * Additionally, if the item has its linked flag set to TRUE, all
+ * additional items contained in the image which have the linked flag
+ * set to TRUE will also be transformed the same way. The return value
+ * will be equal to the item ID supplied as input.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_interpolation(),
+ * gimp_context_set_transform_direction(),
+ * gimp_context_set_transform_resize().
+ *
+ * Returns: (transfer full): The transformed item.
+ *
+ * Since: 2.8
+ **/
+GimpItem *
+gimp_item_transform_matrix (GimpItem *item,
+ gdouble coeff_0_0,
+ gdouble coeff_0_1,
+ gdouble coeff_0_2,
+ gdouble coeff_1_0,
+ gdouble coeff_1_1,
+ gdouble coeff_1_2,
+ gdouble coeff_2_0,
+ gdouble coeff_2_1,
+ gdouble coeff_2_2)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpItem *ret_item = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_ITEM_ID, gimp_item_get_id (GIMP_ITEM (item)),
+ G_TYPE_DOUBLE, coeff_0_0,
+ G_TYPE_DOUBLE, coeff_0_1,
+ G_TYPE_DOUBLE, coeff_0_2,
+ G_TYPE_DOUBLE, coeff_1_0,
+ G_TYPE_DOUBLE, coeff_1_1,
+ G_TYPE_DOUBLE, coeff_1_2,
+ G_TYPE_DOUBLE, coeff_2_0,
+ G_TYPE_DOUBLE, coeff_2_1,
+ G_TYPE_DOUBLE, coeff_2_2,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-item-transform-matrix",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-transform-matrix",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ ret_item = gimp_item_new_by_id (gimp_value_get_item_id (gimp_value_array_index (return_vals, 1)));
+
+ gimp_value_array_unref (return_vals);
+
+ return ret_item;
+}
+
+/**
+ * _gimp_item_transform_matrix: (skip)
* @item_ID: The affected item.
* @coeff_0_0: coefficient (0,0) of the transformation matrix.
* @coeff_0_1: coefficient (0,1) of the transformation matrix.
@@ -740,16 +1492,16 @@ gimp_item_transform_2d (gint32 item_ID,
* Since: 2.8
**/
gint32
-gimp_item_transform_matrix (gint32 item_ID,
- gdouble coeff_0_0,
- gdouble coeff_0_1,
- gdouble coeff_0_2,
- gdouble coeff_1_0,
- gdouble coeff_1_1,
- gdouble coeff_1_2,
- gdouble coeff_2_0,
- gdouble coeff_2_1,
- gdouble coeff_2_2)
+_gimp_item_transform_matrix (gint32 item_ID,
+ gdouble coeff_0_0,
+ gdouble coeff_0_1,
+ gdouble coeff_0_2,
+ gdouble coeff_1_0,
+ gdouble coeff_1_1,
+ gdouble coeff_1_2,
+ gdouble coeff_2_0,
+ gdouble coeff_2_1,
+ gdouble coeff_2_2)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
diff --git a/libgimp/gimpitemtransform_pdb.h b/libgimp/gimpitemtransform_pdb.h
index 0d89bf58c2..b379c69a94 100644
--- a/libgimp/gimpitemtransform_pdb.h
+++ b/libgimp/gimpitemtransform_pdb.h
@@ -32,70 +32,80 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gint32 gimp_item_transform_translate (gint32 item_ID,
- gdouble off_x,
- gdouble off_y);
-gint32 gimp_item_transform_flip_simple (gint32 item_ID,
- GimpOrientationType flip_type,
- gboolean auto_center,
- gdouble axis);
-gint32 gimp_item_transform_flip (gint32 item_ID,
- gdouble x0,
- gdouble y0,
- gdouble x1,
- gdouble y1);
-gint32 gimp_item_transform_perspective (gint32 item_ID,
- gdouble x0,
- gdouble y0,
- gdouble x1,
- gdouble y1,
- gdouble x2,
- gdouble y2,
- gdouble x3,
- gdouble y3);
-gint32 gimp_item_transform_rotate_simple (gint32 item_ID,
- GimpRotationType rotate_type,
- gboolean auto_center,
- gdouble center_x,
- gdouble center_y);
-gint32 gimp_item_transform_rotate (gint32 item_ID,
- gdouble angle,
- gboolean auto_center,
- gdouble center_x,
- gdouble center_y);
-gint32 gimp_item_transform_scale (gint32 item_ID,
- gdouble x0,
- gdouble y0,
- gdouble x1,
- gdouble y1);
-gint32 gimp_item_transform_shear (gint32 item_ID,
- GimpOrientationType shear_type,
- gdouble magnitude);
-gint32 gimp_item_transform_2d (gint32 item_ID,
- gdouble source_x,
- gdouble source_y,
- gdouble scale_x,
- gdouble scale_y,
- gdouble angle,
- gdouble dest_x,
- gdouble dest_y);
-gint32 gimp_item_transform_matrix (gint32 item_ID,
- gdouble coeff_0_0,
- gdouble coeff_0_1,
- gdouble coeff_0_2,
- gdouble coeff_1_0,
- gdouble coeff_1_1,
- gdouble coeff_1_2,
- gdouble coeff_2_0,
- gdouble coeff_2_1,
- gdouble coeff_2_2);
-#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+GimpItem* gimp_item_transform_translate (GimpItem *item,
+ gdouble off_x,
+ gdouble off_y);
+GimpItem* gimp_item_transform_flip_simple (GimpItem *item,
+ GimpOrientationType flip_type,
+ gboolean auto_center,
+ gdouble axis);
+GimpItem* gimp_item_transform_flip (GimpItem *item,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1);
+GimpItem* gimp_item_transform_perspective (GimpItem *item,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2,
+ gdouble x3,
+ gdouble y3);
+GimpItem* gimp_item_transform_rotate_simple (GimpItem *item,
+ GimpRotationType rotate_type,
+ gboolean auto_center,
+ gdouble center_x,
+ gdouble center_y);
+GimpItem* gimp_item_transform_rotate (GimpItem *item,
+ gdouble angle,
+ gboolean auto_center,
+ gdouble center_x,
+ gdouble center_y);
+GimpItem* gimp_item_transform_scale (GimpItem *item,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1);
+GimpItem* gimp_item_transform_shear (GimpItem *item,
+ GimpOrientationType shear_type,
+ gdouble magnitude);
+GimpItem* gimp_item_transform_2d (GimpItem *item,
+ gdouble source_x,
+ gdouble source_y,
+ gdouble scale_x,
+ gdouble scale_y,
+ gdouble angle,
+ gdouble dest_x,
+ gdouble dest_y);
+GimpItem* gimp_item_transform_matrix (GimpItem *item,
+ gdouble coeff_0_0,
+ gdouble coeff_0_1,
+ gdouble coeff_0_2,
+ gdouble coeff_1_0,
+ gdouble coeff_1_1,
+ gdouble coeff_1_2,
+ gdouble coeff_2_0,
+ gdouble coeff_2_1,
+ gdouble coeff_2_2);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
+#define gimp_item_transform_translate _gimp_item_transform_translate
+#define gimp_item_transform_flip_simple _gimp_item_transform_flip_simple
+#define gimp_item_transform_flip _gimp_item_transform_flip
+#define gimp_item_transform_perspective _gimp_item_transform_perspective
+#define gimp_item_transform_rotate_simple _gimp_item_transform_rotate_simple
+#define gimp_item_transform_rotate _gimp_item_transform_rotate
+#define gimp_item_transform_scale _gimp_item_transform_scale
+#define gimp_item_transform_shear _gimp_item_transform_shear
+#define gimp_item_transform_2d _gimp_item_transform_2d
+#define gimp_item_transform_matrix _gimp_item_transform_matrix
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@@ -104,7 +114,63 @@ gint32 gimp_item_transform_matrix (gint32 item_ID,
* They are not marked internal as a trick to keep the old API alive for now.
*/
-
+gint32 _gimp_item_transform_translate (gint32 item_ID,
+ gdouble off_x,
+ gdouble off_y);
+gint32 _gimp_item_transform_flip_simple (gint32 item_ID,
+ GimpOrientationType flip_type,
+ gboolean auto_center,
+ gdouble axis);
+gint32 _gimp_item_transform_flip (gint32 item_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1);
+gint32 _gimp_item_transform_perspective (gint32 item_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2,
+ gdouble x3,
+ gdouble y3);
+gint32 _gimp_item_transform_rotate_simple (gint32 item_ID,
+ GimpRotationType rotate_type,
+ gboolean auto_center,
+ gdouble center_x,
+ gdouble center_y);
+gint32 _gimp_item_transform_rotate (gint32 item_ID,
+ gdouble angle,
+ gboolean auto_center,
+ gdouble center_x,
+ gdouble center_y);
+gint32 _gimp_item_transform_scale (gint32 item_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1);
+gint32 _gimp_item_transform_shear (gint32 item_ID,
+ GimpOrientationType shear_type,
+ gdouble magnitude);
+gint32 _gimp_item_transform_2d (gint32 item_ID,
+ gdouble source_x,
+ gdouble source_y,
+ gdouble scale_x,
+ gdouble scale_y,
+ gdouble angle,
+ gdouble dest_x,
+ gdouble dest_y);
+gint32 _gimp_item_transform_matrix (gint32 item_ID,
+ gdouble coeff_0_0,
+ gdouble coeff_0_1,
+ gdouble coeff_0_2,
+ gdouble coeff_1_0,
+ gdouble coeff_1_1,
+ gdouble coeff_1_2,
+ gdouble coeff_2_0,
+ gdouble coeff_2_1,
+ gdouble coeff_2_2);
G_END_DECLS
diff --git a/libgimp/gimplayer.c b/libgimp/gimplayer.c
index dcff5daf57..d019cb76a2 100644
--- a/libgimp/gimplayer.c
+++ b/libgimp/gimplayer.c
@@ -25,6 +25,25 @@
#include "gimp.h"
+G_DEFINE_TYPE (GimpLayer, gimp_layer, GIMP_TYPE_DRAWABLE)
+
+#define parent_class gimp_layer_parent_class
+
+
+static void
+gimp_layer_class_init (GimpLayerClass *klass)
+{
+}
+
+static void
+gimp_layer_init (GimpLayer *layer)
+{
+}
+
+
+/* Public API. */
+
+
/**
* gimp_layer_new:
* @image: The image to which to add the layer.
diff --git a/libgimp/gimplayer.h b/libgimp/gimplayer.h
index f6895b94a7..fc4dfd530d 100644
--- a/libgimp/gimplayer.h
+++ b/libgimp/gimplayer.h
@@ -29,6 +29,39 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
+#define GIMP_TYPE_LAYER (gimp_layer_get_type ())
+#define GIMP_LAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LAYER, GimpLayer))
+#define GIMP_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LAYER, GimpLayerClass))
+#define GIMP_IS_LAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LAYER))
+#define GIMP_IS_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LAYER))
+#define GIMP_LAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_LAYER, GimpLayerClass))
+
+
+typedef struct _GimpLayerClass GimpLayerClass;
+typedef struct _GimpLayerPrivate GimpLayerPrivate;
+
+struct _GimpLayer
+{
+ GimpDrawable parent_instance;
+};
+
+struct _GimpLayerClass
+{
+ GimpDrawableClass parent_class;
+
+ /* Padding for future expansion */
+ void (*_gimp_reserved1) (void);
+ void (*_gimp_reserved2) (void);
+ void (*_gimp_reserved3) (void);
+ void (*_gimp_reserved4) (void);
+ void (*_gimp_reserved5) (void);
+ void (*_gimp_reserved6) (void);
+ void (*_gimp_reserved7) (void);
+ void (*_gimp_reserved8) (void);
+ void (*_gimp_reserved9) (void);
+};
+
+GType gimp_layer_get_type (void) G_GNUC_CONST;
gint32 gimp_layer_copy (gint32 layer_ID);
diff --git a/libgimp/gimplayer_pdb.c b/libgimp/gimplayer_pdb.c
index 01babe8e57..e0cb6aa97e 100644
--- a/libgimp/gimplayer_pdb.c
+++ b/libgimp/gimplayer_pdb.c
@@ -53,9 +53,9 @@
* command. Other attributes such as layer mask modes, and offsets
* should be set with explicit procedure calls.
*
- * Returns: The newly created layer.
+ * Returns: (transfer full): The newly created layer.
**/
-gint32
+GimpLayer *
_gimp_layer_new (GimpImage *image,
gint width,
gint height,
@@ -67,7 +67,7 @@ _gimp_layer_new (GimpImage *image,
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 layer_ID = -1;
+ GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@@ -89,11 +89,11 @@ _gimp_layer_new (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
+ layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals,
1))));
gimp_value_array_unref (return_vals);
- return layer_ID;
+ return layer;
}
/**
@@ -172,11 +172,11 @@ __gimp_layer_new (gint32 image_ID,
* gimp_image_insert_layer() command. Other attributes such as layer
* mask modes, and offsets should be set with explicit procedure calls.
*
- * Returns: The newly created layer.
+ * Returns: (transfer full): The newly created layer.
*
* Since: 2.6
**/
-gint32
+GimpLayer *
gimp_layer_new_from_visible (GimpImage *image,
GimpImage *dest_image,
const gchar *name)
@@ -184,7 +184,7 @@ gimp_layer_new_from_visible (GimpImage *image,
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 layer_ID = -1;
+ GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@@ -202,11 +202,11 @@ gimp_layer_new_from_visible (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
+ layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals,
1))));
gimp_value_array_unref (return_vals);
- return layer_ID;
+ return layer;
}
/**
@@ -262,7 +262,7 @@ _gimp_layer_new_from_visible (gint32 image_ID,
/**
* gimp_layer_new_from_drawable:
- * @drawable_ID: The source drawable from where the new layer is copied.
+ * @drawable: The source drawable from where the new layer is copied.
* @dest_image: The destination image to which to add the layer.
*
* Create a new layer by copying an existing drawable.
@@ -273,19 +273,19 @@ _gimp_layer_new_from_visible (gint32 image_ID,
* gimp_image_insert_layer() command. Other attributes such as layer
* mask modes, and offsets should be set with explicit procedure calls.
*
- * Returns: The newly copied layer.
+ * Returns: (transfer full): The newly copied layer.
**/
-gint32
-gimp_layer_new_from_drawable (gint32 drawable_ID,
- GimpImage *dest_image)
+GimpLayer *
+gimp_layer_new_from_drawable (GimpDrawable *drawable,
+ GimpImage *dest_image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 layer_copy_ID = -1;
+ GimpLayer *layer_copy = NULL;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (dest_image),
G_TYPE_NONE);
@@ -299,11 +299,11 @@ gimp_layer_new_from_drawable (gint32 drawable_ID,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- layer_copy_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
+ layer_copy = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index
(return_vals, 1))));
gimp_value_array_unref (return_vals);
- return layer_copy_ID;
+ return layer_copy;
}
/**
@@ -366,17 +366,17 @@ _gimp_layer_new_from_drawable (gint32 drawable_ID,
* gimp_image_reorder_item(), gimp_item_get_parent(),
* gimp_item_get_children(), gimp_item_is_group().
*
- * Returns: The newly created layer group.
+ * Returns: (transfer full): The newly created layer group.
*
* Since: 2.8
**/
-gint32
+GimpLayer *
gimp_layer_group_new (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 layer_group_ID = -1;
+ GimpLayer *layer_group = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@@ -392,11 +392,11 @@ gimp_layer_group_new (GimpImage *image)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- layer_group_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
+ layer_group = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index
(return_vals, 1))));
gimp_value_array_unref (return_vals);
- return layer_group_ID;
+ return layer_group;
}
/**
@@ -448,6 +448,53 @@ _gimp_layer_group_new (gint32 image_ID)
/**
* _gimp_layer_copy:
+ * @layer: The layer to copy.
+ * @add_alpha: Add an alpha channel to the copied layer.
+ *
+ * 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. The copied
+ * layer can optionally have an added alpha channel. This is useful if
+ * the background layer in an image is being copied and added to the
+ * same image.
+ *
+ * Returns: (transfer full): The newly copied layer.
+ **/
+GimpLayer *
+_gimp_layer_copy (GimpLayer *layer,
+ gboolean add_alpha)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpLayer *layer_copy = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_BOOLEAN, add_alpha,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-copy",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-copy",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ layer_copy = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index
(return_vals, 1))));
+
+ gimp_value_array_unref (return_vals);
+
+ return layer_copy;
+}
+
+/**
+ * __gimp_layer_copy: (skip)
* @layer_ID: The layer to copy.
* @add_alpha: Add an alpha channel to the copied layer.
*
@@ -463,8 +510,8 @@ _gimp_layer_group_new (gint32 image_ID)
* Returns: The newly copied layer.
**/
gint32
-_gimp_layer_copy (gint32 layer_ID,
- gboolean add_alpha)
+__gimp_layer_copy (gint32 layer_ID,
+ gboolean add_alpha)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -495,6 +542,48 @@ _gimp_layer_copy (gint32 layer_ID,
/**
* gimp_layer_add_alpha:
+ * @layer: The layer.
+ *
+ * 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 clear and erase to transparency, instead of the
+ * background color. This transforms layers of type RGB to RGBA, GRAY
+ * to GRAYA, and INDEXED to INDEXEDA.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_add_alpha (GimpLayer *layer)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-add-alpha",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-add-alpha",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_layer_add_alpha: (skip)
* @layer_ID: The layer.
*
* Add an alpha channel to the layer if it doesn't already have one.
@@ -508,7 +597,7 @@ _gimp_layer_copy (gint32 layer_ID,
* Returns: TRUE on success.
**/
gboolean
-gimp_layer_add_alpha (gint32 layer_ID)
+_gimp_layer_add_alpha (gint32 layer_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -537,6 +626,49 @@ gimp_layer_add_alpha (gint32 layer_ID)
/**
* gimp_layer_flatten:
+ * @layer: The layer.
+ *
+ * Remove the alpha channel from the layer if it has one.
+ *
+ * This procedure removes the alpha channel from a layer, blending all
+ * (partially) transparent pixels in the layer against the background
+ * color. This transforms layers of type RGBA to RGB, GRAYA to GRAY,
+ * and INDEXEDA to INDEXED.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_layer_flatten (GimpLayer *layer)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-flatten",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-flatten",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_layer_flatten: (skip)
* @layer_ID: The layer.
*
* Remove the alpha channel from the layer if it has one.
@@ -551,7 +683,7 @@ gimp_layer_add_alpha (gint32 layer_ID)
* Since: 2.4
**/
gboolean
-gimp_layer_flatten (gint32 layer_ID)
+_gimp_layer_flatten (gint32 layer_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -580,7 +712,7 @@ gimp_layer_flatten (gint32 layer_ID)
/**
* gimp_layer_scale:
- * @layer_ID: The layer.
+ * @layer: The layer.
* @new_width: New layer width.
* @new_height: New layer height.
* @local_origin: Use a local origin (as opposed to the image origin).
@@ -597,10 +729,10 @@ gimp_layer_flatten (gint32 layer_ID)
* Returns: TRUE on success.
**/
gboolean
-gimp_layer_scale (gint32 layer_ID,
- gint new_width,
- gint new_height,
- gboolean local_origin)
+gimp_layer_scale (GimpLayer *layer,
+ gint new_width,
+ gint new_height,
+ gboolean local_origin)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -608,7 +740,7 @@ gimp_layer_scale (gint32 layer_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
G_TYPE_INT, new_width,
G_TYPE_INT, new_height,
G_TYPE_BOOLEAN, local_origin,
@@ -631,28 +763,28 @@ gimp_layer_scale (gint32 layer_ID,
}
/**
- * gimp_layer_resize:
+ * _gimp_layer_scale: (skip)
* @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: (old - new).
- * @offy: y offset between upper left corner of old and new layers: (old - new).
+ * @local_origin: Use a local origin (as opposed to the image origin).
*
- * Resize the layer to the specified extents.
+ * Scale the layer using the default interpolation method.
*
- * This procedure resizes the layer so that its 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.
+ * This procedure scales the layer so that its 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. The interpolation method used can be set with
+ * gimp_context_set_interpolation().
*
* Returns: TRUE on success.
**/
gboolean
-gimp_layer_resize (gint32 layer_ID,
- gint new_width,
- gint new_height,
- gint offx,
- gint offy)
+_gimp_layer_scale (gint32 layer_ID,
+ gint new_width,
+ gint new_height,
+ gboolean local_origin)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -663,16 +795,15 @@ gimp_layer_resize (gint32 layer_ID,
GIMP_TYPE_LAYER_ID, layer_ID,
G_TYPE_INT, new_width,
G_TYPE_INT, new_height,
- G_TYPE_INT, offx,
- G_TYPE_INT, offy,
+ G_TYPE_BOOLEAN, local_origin,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-resize",
+ "gimp-layer-scale",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-resize",
+ return_vals = gimp_run_procedure_array ("gimp-layer-scale",
args);
gimp_value_array_unref (args);
@@ -684,18 +815,28 @@ gimp_layer_resize (gint32 layer_ID,
}
/**
- * gimp_layer_resize_to_image_size:
- * @layer_ID: The layer to resize.
+ * gimp_layer_resize:
+ * @layer: The layer.
+ * @new_width: New layer width.
+ * @new_height: New layer height.
+ * @offx: x offset between upper left corner of old and new layers: (old - new).
+ * @offy: y offset between upper left corner of old and new layers: (old - new).
*
- * Resize a layer to the image size.
+ * Resize the layer to the specified extents.
*
- * This procedure resizes the layer so that it's new width and height
- * are equal to the width and height of its image container.
+ * This procedure resizes the layer so that its 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.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_layer_resize_to_image_size (gint32 layer_ID)
+gimp_layer_resize (GimpLayer *layer,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -703,15 +844,19 @@ gimp_layer_resize_to_image_size (gint32 layer_ID)
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_INT, new_width,
+ G_TYPE_INT, new_height,
+ G_TYPE_INT, offx,
+ G_TYPE_INT, offy,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-resize-to-image-size",
+ "gimp-layer-resize",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-resize-to-image-size",
+ return_vals = gimp_run_procedure_array ("gimp-layer-resize",
args);
gimp_value_array_unref (args);
@@ -723,23 +868,28 @@ gimp_layer_resize_to_image_size (gint32 layer_ID)
}
/**
- * gimp_layer_set_offsets:
+ * _gimp_layer_resize: (skip)
* @layer_ID: The layer.
- * @offx: Offset in x direction.
- * @offy: Offset in y direction.
+ * @new_width: New layer width.
+ * @new_height: New layer height.
+ * @offx: x offset between upper left corner of old and new layers: (old - new).
+ * @offy: y offset between upper left corner of old and new layers: (old - new).
*
- * Set the layer offsets.
+ * Resize the layer to the specified extents.
*
- * 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.
+ * This procedure resizes the layer so that its 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.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_layer_set_offsets (gint32 layer_ID,
- gint offx,
- gint offy)
+_gimp_layer_resize (gint32 layer_ID,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -748,16 +898,18 @@ gimp_layer_set_offsets (gint32 layer_ID,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_INT, new_width,
+ G_TYPE_INT, new_height,
G_TYPE_INT, offx,
G_TYPE_INT, offy,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-set-offsets",
+ "gimp-layer-resize",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-set-offsets",
+ return_vals = gimp_run_procedure_array ("gimp-layer-resize",
args);
gimp_value_array_unref (args);
@@ -769,84 +921,1287 @@ gimp_layer_set_offsets (gint32 layer_ID,
}
/**
- * gimp_layer_create_mask:
- * @layer_ID: The layer to which to add the mask.
- * @mask_type: The type of mask.
- *
- * Create a layer mask for the specified layer.
- *
- * This procedure creates a layer mask for the specified layer.
- * Layer masks serve as an additional alpha channel for a layer.
- * Different types of masks are allowed for initialisation:
- * - white mask (leaves the layer fully visible);
- * - black mask (gives the layer complete transparency);
- * - the layer's alpha channel (either a copy, or a transfer, which
- * leaves the layer fully visible, but which may be more useful than a
- * white mask);
- * - the current selection;
- * - a grayscale copy of the layer;
- * - or a copy of the active channel.
+ * gimp_layer_resize_to_image_size:
+ * @layer: The layer to resize.
*
- * The layer mask still needs to be added to the layer. This can be
- * done with a call to gimp_layer_add_mask().
+ * Resize a layer to the image size.
*
- * gimp_layer_create_mask() will fail if there are no active channels
- * on the image, when called with 'ADD-CHANNEL-MASK'. It will return a
- * black mask when called with 'ADD-ALPHA-MASK' or
- * 'ADD-ALPHA-TRANSFER-MASK' on a layer with no alpha channels, or with
- * 'ADD-SELECTION-MASK' when there is no selection on the image.
+ * This procedure resizes the layer so that it's new width and height
+ * are equal to the width and height of its image container.
*
- * Returns: The newly created mask.
+ * Returns: TRUE on success.
**/
-gint32
-gimp_layer_create_mask (gint32 layer_ID,
- GimpAddMaskType mask_type)
+gboolean
+gimp_layer_resize_to_image_size (GimpLayer *layer)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 mask_ID = -1;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
- GIMP_TYPE_ADD_MASK_TYPE, mask_type,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-create-mask",
+ "gimp-layer-resize-to-image-size",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-create-mask",
+ return_vals = gimp_run_procedure_array ("gimp-layer-resize-to-image-size",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- mask_ID = gimp_value_get_layer_mask_id (gimp_value_array_index (return_vals, 1));
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return mask_ID;
+ return success;
}
/**
- * gimp_layer_get_mask:
- * @layer_ID: The layer.
+ * _gimp_layer_resize_to_image_size: (skip)
+ * @layer_ID: The layer to resize.
*
- * Get the specified layer's mask if it exists.
+ * Resize a layer to the image size.
+ *
+ * This procedure resizes the layer so that it's new width and height
+ * are equal to the width and height of its image container.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_layer_resize_to_image_size (gint32 layer_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-resize-to-image-size",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-resize-to-image-size",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_set_offsets:
+ * @layer: The layer.
+ * @offx: Offset in x direction.
+ * @offy: Offset in y direction.
+ *
+ * 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.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_set_offsets (GimpLayer *layer,
+ gint offx,
+ gint offy)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_INT, offx,
+ G_TYPE_INT, offy,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-set-offsets",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-offsets",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_layer_set_offsets: (skip)
+ * @layer_ID: The layer.
+ * @offx: Offset in x direction.
+ * @offy: Offset in y direction.
+ *
+ * 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.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_layer_set_offsets (gint32 layer_ID,
+ gint offx,
+ gint offy)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_INT, offx,
+ G_TYPE_INT, offy,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-set-offsets",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-offsets",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_create_mask:
+ * @layer: The layer to which to add the mask.
+ * @mask_type: The type of mask.
+ *
+ * Create a layer mask for the specified layer.
+ *
+ * This procedure creates a layer mask for the specified layer.
+ * Layer masks serve as an additional alpha channel for a layer.
+ * Different types of masks are allowed for initialisation:
+ * - white mask (leaves the layer fully visible);
+ * - black mask (gives the layer complete transparency);
+ * - the layer's alpha channel (either a copy, or a transfer, which
+ * leaves the layer fully visible, but which may be more useful than a
+ * white mask);
+ * - the current selection;
+ * - a grayscale copy of the layer;
+ * - or a copy of the active channel.
+ *
+ * The layer mask still needs to be added to the layer. This can be
+ * done with a call to gimp_layer_add_mask().
+ *
+ * gimp_layer_create_mask() will fail if there are no active channels
+ * on the image, when called with 'ADD-CHANNEL-MASK'. It will return a
+ * black mask when called with 'ADD-ALPHA-MASK' or
+ * 'ADD-ALPHA-TRANSFER-MASK' on a layer with no alpha channels, or with
+ * 'ADD-SELECTION-MASK' when there is no selection on the image.
+ *
+ * Returns: The newly created mask.
+ **/
+gint32
+gimp_layer_create_mask (GimpLayer *layer,
+ GimpAddMaskType mask_type)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 mask_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ GIMP_TYPE_ADD_MASK_TYPE, mask_type,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-create-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-create-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ mask_ID = gimp_value_get_layer_mask_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return mask_ID;
+}
+
+/**
+ * _gimp_layer_create_mask: (skip)
+ * @layer_ID: The layer to which to add the mask.
+ * @mask_type: The type of mask.
+ *
+ * Create a layer mask for the specified layer.
+ *
+ * This procedure creates a layer mask for the specified layer.
+ * Layer masks serve as an additional alpha channel for a layer.
+ * Different types of masks are allowed for initialisation:
+ * - white mask (leaves the layer fully visible);
+ * - black mask (gives the layer complete transparency);
+ * - the layer's alpha channel (either a copy, or a transfer, which
+ * leaves the layer fully visible, but which may be more useful than a
+ * white mask);
+ * - the current selection;
+ * - a grayscale copy of the layer;
+ * - or a copy of the active channel.
+ *
+ * The layer mask still needs to be added to the layer. This can be
+ * done with a call to gimp_layer_add_mask().
+ *
+ * gimp_layer_create_mask() will fail if there are no active channels
+ * on the image, when called with 'ADD-CHANNEL-MASK'. It will return a
+ * black mask when called with 'ADD-ALPHA-MASK' or
+ * 'ADD-ALPHA-TRANSFER-MASK' on a layer with no alpha channels, or with
+ * 'ADD-SELECTION-MASK' when there is no selection on the image.
+ *
+ * Returns: The newly created mask.
+ **/
+gint32
+_gimp_layer_create_mask (gint32 layer_ID,
+ GimpAddMaskType mask_type)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 mask_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_ADD_MASK_TYPE, mask_type,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-create-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-create-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ mask_ID = gimp_value_get_layer_mask_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return mask_ID;
+}
+
+/**
+ * gimp_layer_get_mask:
+ * @layer: The layer.
+ *
+ * Get the specified layer's mask if it exists.
+ *
+ * This procedure returns the specified layer's mask, or -1 if none
+ * exists.
+ *
+ * Returns: The layer mask.
+ **/
+gint32
+gimp_layer_get_mask (GimpLayer *layer)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 mask_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-get-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ mask_ID = gimp_value_get_layer_mask_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return mask_ID;
+}
+
+/**
+ * _gimp_layer_get_mask: (skip)
+ * @layer_ID: The layer.
+ *
+ * Get the specified layer's mask if it exists.
+ *
+ * This procedure returns the specified layer's mask, or -1 if none
+ * exists.
+ *
+ * Returns: The layer mask.
+ **/
+gint32
+_gimp_layer_get_mask (gint32 layer_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 mask_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-get-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ mask_ID = gimp_value_get_layer_mask_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return mask_ID;
+}
+
+/**
+ * gimp_layer_from_mask:
+ * @mask_ID: Mask for which to return the layer.
+ *
+ * Get the specified mask's layer.
+ *
+ * This procedure returns the specified mask's layer , or -1 if none
+ * exists.
+ *
+ * Returns: (transfer full): The mask's layer.
+ *
+ * Since: 2.2
+ **/
+GimpLayer *
+gimp_layer_from_mask (gint32 mask_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpLayer *layer = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_MASK_ID, mask_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-from-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-from-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals,
1))));
+
+ gimp_value_array_unref (return_vals);
+
+ return layer;
+}
+
+/**
+ * _gimp_layer_from_mask: (skip)
+ * @mask_ID: Mask for which to return the layer.
+ *
+ * Get the specified mask's layer.
+ *
+ * This procedure returns the specified mask's layer , or -1 if none
+ * exists.
+ *
+ * Returns: The mask's layer.
+ *
+ * Since: 2.2
+ **/
+gint32
+_gimp_layer_from_mask (gint32 mask_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 layer_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_MASK_ID, mask_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-from-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-from-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return layer_ID;
+}
+
+/**
+ * gimp_layer_add_mask:
+ * @layer: The layer to receive the mask.
+ * @mask_ID: The mask to add to the layer.
+ *
+ * Add a layer mask to the specified layer.
+ *
+ * This procedure adds a layer mask to the specified layer. Layer masks
+ * serve as an additional alpha channel for a layer. This procedure
+ * will fail if a number of prerequisites aren't met. The layer cannot
+ * already have a layer mask. The specified mask must exist and have
+ * the same dimensions as the layer. The layer must have been created
+ * for use with the specified image and the mask must have been created
+ * with the procedure 'gimp-layer-create-mask'.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_add_mask (GimpLayer *layer,
+ gint32 mask_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ GIMP_TYPE_LAYER_MASK_ID, mask_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-add-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-add-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_layer_add_mask: (skip)
+ * @layer_ID: The layer to receive the mask.
+ * @mask_ID: The mask to add to the layer.
+ *
+ * Add a layer mask to the specified layer.
+ *
+ * This procedure adds a layer mask to the specified layer. Layer masks
+ * serve as an additional alpha channel for a layer. This procedure
+ * will fail if a number of prerequisites aren't met. The layer cannot
+ * already have a layer mask. The specified mask must exist and have
+ * the same dimensions as the layer. The layer must have been created
+ * for use with the specified image and the mask must have been created
+ * with the procedure 'gimp-layer-create-mask'.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_layer_add_mask (gint32 layer_ID,
+ gint32 mask_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_LAYER_MASK_ID, mask_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-add-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-add-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_remove_mask:
+ * @layer: The layer from which to remove mask.
+ * @mode: Removal mode.
+ *
+ * Remove the specified layer mask from the layer.
+ *
+ * This procedure removes the specified layer mask from the layer. If
+ * the mask doesn't exist, an error is returned.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_remove_mask (GimpLayer *layer,
+ GimpMaskApplyMode mode)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ GIMP_TYPE_MASK_APPLY_MODE, mode,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-remove-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-remove-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_layer_remove_mask: (skip)
+ * @layer_ID: The layer from which to remove mask.
+ * @mode: Removal mode.
+ *
+ * Remove the specified layer mask from the layer.
+ *
+ * This procedure removes the specified layer mask from the layer. If
+ * the mask doesn't exist, an error is returned.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_layer_remove_mask (gint32 layer_ID,
+ GimpMaskApplyMode mode)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_MASK_APPLY_MODE, mode,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-remove-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-remove-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_is_floating_sel:
+ * @layer: The layer.
+ *
+ * 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.
+ *
+ * Returns: TRUE if the layer is a floating selection.
+ **/
+gboolean
+gimp_layer_is_floating_sel (GimpLayer *layer)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean is_floating_sel = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-is-floating-sel",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-is-floating-sel",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ is_floating_sel = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return is_floating_sel;
+}
+
+/**
+ * _gimp_layer_is_floating_sel: (skip)
+ * @layer_ID: The layer.
+ *
+ * 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.
+ *
+ * Returns: TRUE if the layer is a floating selection.
+ **/
+gboolean
+_gimp_layer_is_floating_sel (gint32 layer_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean is_floating_sel = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-is-floating-sel",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-is-floating-sel",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ is_floating_sel = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return is_floating_sel;
+}
+
+/**
+ * gimp_layer_get_lock_alpha:
+ * @layer: The layer.
+ *
+ * Get the lock alpha channel setting of the specified layer.
+ *
+ * This procedure returns the specified layer's lock alpha channel
+ * setting.
+ *
+ * Returns: The layer's lock alpha channel setting.
+ **/
+gboolean
+gimp_layer_get_lock_alpha (GimpLayer *layer)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean lock_alpha = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-get-lock-alpha",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-lock-alpha",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ lock_alpha = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return lock_alpha;
+}
+
+/**
+ * _gimp_layer_get_lock_alpha: (skip)
+ * @layer_ID: The layer.
+ *
+ * Get the lock alpha channel setting of the specified layer.
+ *
+ * This procedure returns the specified layer's lock alpha channel
+ * setting.
+ *
+ * Returns: The layer's lock alpha channel setting.
+ **/
+gboolean
+_gimp_layer_get_lock_alpha (gint32 layer_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean lock_alpha = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-get-lock-alpha",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-lock-alpha",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ lock_alpha = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return lock_alpha;
+}
+
+/**
+ * gimp_layer_set_lock_alpha:
+ * @layer: The layer.
+ * @lock_alpha: The new layer's lock alpha channel setting.
+ *
+ * Set the lock alpha channel setting of the specified layer.
+ *
+ * This procedure sets the specified layer's lock alpha channel
+ * setting.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_set_lock_alpha (GimpLayer *layer,
+ gboolean lock_alpha)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_BOOLEAN, lock_alpha,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-set-lock-alpha",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-lock-alpha",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_layer_set_lock_alpha: (skip)
+ * @layer_ID: The layer.
+ * @lock_alpha: The new layer's lock alpha channel setting.
+ *
+ * Set the lock alpha channel setting of the specified layer.
+ *
+ * This procedure sets the specified layer's lock alpha channel
+ * setting.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_layer_set_lock_alpha (gint32 layer_ID,
+ gboolean lock_alpha)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_BOOLEAN, lock_alpha,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-set-lock-alpha",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-lock-alpha",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_get_apply_mask:
+ * @layer: The layer.
+ *
+ * Get the apply mask setting of the specified layer.
+ *
+ * This procedure returns the specified layer's apply mask setting. If
+ * the value is TRUE, then the layer mask for this layer is currently
+ * being composited with the layer's alpha channel.
+ *
+ * Returns: The layer's apply mask setting.
+ **/
+gboolean
+gimp_layer_get_apply_mask (GimpLayer *layer)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean apply_mask = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-get-apply-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-apply-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ apply_mask = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return apply_mask;
+}
+
+/**
+ * _gimp_layer_get_apply_mask: (skip)
+ * @layer_ID: The layer.
+ *
+ * Get the apply mask setting of the specified layer.
+ *
+ * This procedure returns the specified layer's apply mask setting. If
+ * the value is TRUE, then the layer mask for this layer is currently
+ * being composited with the layer's alpha channel.
+ *
+ * Returns: The layer's apply mask setting.
+ **/
+gboolean
+_gimp_layer_get_apply_mask (gint32 layer_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean apply_mask = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-get-apply-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-apply-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ apply_mask = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return apply_mask;
+}
+
+/**
+ * gimp_layer_set_apply_mask:
+ * @layer: The layer.
+ * @apply_mask: The new layer's apply mask setting.
+ *
+ * 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.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_set_apply_mask (GimpLayer *layer,
+ gboolean apply_mask)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_BOOLEAN, apply_mask,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-set-apply-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-apply-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_layer_set_apply_mask: (skip)
+ * @layer_ID: The layer.
+ * @apply_mask: The new layer's apply mask setting.
+ *
+ * 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.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_layer_set_apply_mask (gint32 layer_ID,
+ gboolean apply_mask)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_BOOLEAN, apply_mask,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-set-apply-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-apply-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_get_show_mask:
+ * @layer: The layer.
+ *
+ * Get the show mask setting of the specified layer.
+ *
+ * This procedure returns the specified layer's show mask setting. This
+ * controls whether the layer or its mask is visible. TRUE indicates
+ * that the mask should be visible. If the layer has no mask, then this
+ * function returns an error.
+ *
+ * Returns: The layer's show mask setting.
+ **/
+gboolean
+gimp_layer_get_show_mask (GimpLayer *layer)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean show_mask = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-get-show-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-show-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ show_mask = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return show_mask;
+}
+
+/**
+ * _gimp_layer_get_show_mask: (skip)
+ * @layer_ID: The layer.
+ *
+ * Get the show mask setting of the specified layer.
+ *
+ * This procedure returns the specified layer's show mask setting. This
+ * controls whether the layer or its mask is visible. TRUE indicates
+ * that the mask should be visible. If the layer has no mask, then this
+ * function returns an error.
+ *
+ * Returns: The layer's show mask setting.
+ **/
+gboolean
+_gimp_layer_get_show_mask (gint32 layer_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean show_mask = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-get-show-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-show-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ show_mask = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return show_mask;
+}
+
+/**
+ * gimp_layer_set_show_mask:
+ * @layer: The layer.
+ * @show_mask: The new layer's show mask setting.
+ *
+ * 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 its mask is visible. TRUE indicates
+ * that the mask should be visible. If there is no layer mask, this
+ * function will return an error.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_layer_set_show_mask (GimpLayer *layer,
+ gboolean show_mask)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_BOOLEAN, show_mask,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-set-show-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-show-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_layer_set_show_mask: (skip)
+ * @layer_ID: The layer.
+ * @show_mask: The new layer's show mask setting.
+ *
+ * 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 its mask is visible. TRUE indicates
+ * that the mask should be visible. If there is no layer mask, this
+ * function will return an error.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_layer_set_show_mask (gint32 layer_ID,
+ gboolean show_mask)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_BOOLEAN, show_mask,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-set-show-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-show-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_layer_get_edit_mask:
+ * @layer: The layer.
+ *
+ * Get the edit mask setting of the specified layer.
+ *
+ * This procedure returns the specified layer's edit mask setting. If
+ * the value is TRUE, then the layer mask for this layer is currently
+ * active, and not the layer.
+ *
+ * Returns: The layer's edit mask setting.
+ **/
+gboolean
+gimp_layer_get_edit_mask (GimpLayer *layer)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean edit_mask = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-get-edit-mask",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-edit-mask",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ edit_mask = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return edit_mask;
+}
+
+/**
+ * _gimp_layer_get_edit_mask: (skip)
+ * @layer_ID: The layer.
*
- * This procedure returns the specified layer's mask, or -1 if none
- * exists.
+ * Get the edit mask setting of the specified layer.
*
- * Returns: The layer mask.
+ * This procedure returns the specified layer's edit mask setting. If
+ * the value is TRUE, then the layer mask for this layer is currently
+ * active, and not the layer.
+ *
+ * Returns: The layer's edit mask setting.
**/
-gint32
-gimp_layer_get_mask (gint32 layer_ID)
+gboolean
+_gimp_layer_get_edit_mask (gint32 layer_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 mask_ID = -1;
+ gboolean edit_mask = FALSE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
@@ -854,83 +2209,82 @@ gimp_layer_get_mask (gint32 layer_ID)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-get-mask",
+ "gimp-layer-get-edit-mask",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-get-mask",
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-edit-mask",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- mask_ID = gimp_value_get_layer_mask_id (gimp_value_array_index (return_vals, 1));
+ edit_mask = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return mask_ID;
+ return edit_mask;
}
/**
- * gimp_layer_from_mask:
- * @mask_ID: Mask for which to return the layer.
- *
- * Get the specified mask's layer.
+ * gimp_layer_set_edit_mask:
+ * @layer: The layer.
+ * @edit_mask: The new layer's edit mask setting.
*
- * This procedure returns the specified mask's layer , or -1 if none
- * exists.
+ * Set the edit mask setting of the specified layer.
*
- * Returns: The mask's layer.
+ * This procedure sets the specified layer's edit 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.
*
- * Since: 2.2
+ * Returns: TRUE on success.
**/
-gint32
-gimp_layer_from_mask (gint32 mask_ID)
+gboolean
+gimp_layer_set_edit_mask (GimpLayer *layer,
+ gboolean edit_mask)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 layer_ID = -1;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_MASK_ID, mask_ID,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_BOOLEAN, edit_mask,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-from-mask",
+ "gimp-layer-set-edit-mask",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-from-mask",
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-edit-mask",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return layer_ID;
+ return success;
}
/**
- * gimp_layer_add_mask:
- * @layer_ID: The layer to receive the mask.
- * @mask_ID: The mask to add to the layer.
+ * _gimp_layer_set_edit_mask: (skip)
+ * @layer_ID: The layer.
+ * @edit_mask: The new layer's edit mask setting.
*
- * Add a layer mask to the specified layer.
+ * Set the edit mask setting of the specified layer.
*
- * This procedure adds a layer mask to the specified layer. Layer masks
- * serve as an additional alpha channel for a layer. This procedure
- * will fail if a number of prerequisites aren't met. The layer cannot
- * already have a layer mask. The specified mask must exist and have
- * the same dimensions as the layer. The layer must have been created
- * for use with the specified image and the mask must have been created
- * with the procedure 'gimp-layer-create-mask'.
+ * This procedure sets the specified layer's edit 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.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_layer_add_mask (gint32 layer_ID,
- gint32 mask_ID)
+_gimp_layer_set_edit_mask (gint32 layer_ID,
+ gboolean edit_mask)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -939,15 +2293,15 @@ gimp_layer_add_mask (gint32 layer_ID,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
- GIMP_TYPE_LAYER_MASK_ID, mask_ID,
+ G_TYPE_BOOLEAN, edit_mask,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-add-mask",
+ "gimp-layer-set-edit-mask",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-add-mask",
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-edit-mask",
args);
gimp_value_array_unref (args);
@@ -959,66 +2313,61 @@ gimp_layer_add_mask (gint32 layer_ID,
}
/**
- * gimp_layer_remove_mask:
- * @layer_ID: The layer from which to remove mask.
- * @mode: Removal mode.
+ * gimp_layer_get_opacity:
+ * @layer: The layer.
*
- * Remove the specified layer mask from the layer.
+ * Get the opacity of the specified layer.
*
- * This procedure removes the specified layer mask from the layer. If
- * the mask doesn't exist, an error is returned.
+ * This procedure returns the specified layer's opacity.
*
- * Returns: TRUE on success.
+ * Returns: The layer opacity.
**/
-gboolean
-gimp_layer_remove_mask (gint32 layer_ID,
- GimpMaskApplyMode mode)
+gdouble
+gimp_layer_get_opacity (GimpLayer *layer)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ gdouble opacity = 0.0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
- GIMP_TYPE_MASK_APPLY_MODE, mode,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-remove-mask",
+ "gimp-layer-get-opacity",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-remove-mask",
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-opacity",
args);
gimp_value_array_unref (args);
- success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ opacity = g_value_get_double (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return opacity;
}
/**
- * gimp_layer_is_floating_sel:
+ * _gimp_layer_get_opacity: (skip)
* @layer_ID: The layer.
*
- * Is the specified layer a floating selection?
+ * Get the opacity of the specified layer.
*
- * This procedure returns whether the layer is a floating selection.
- * Floating selections are special cases of layers which are attached
- * to a specific drawable.
+ * This procedure returns the specified layer's opacity.
*
- * Returns: TRUE if the layer is a floating selection.
+ * Returns: The layer opacity.
**/
-gboolean
-gimp_layer_is_floating_sel (gint32 layer_ID)
+gdouble
+_gimp_layer_get_opacity (gint32 layer_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean is_floating_sel = FALSE;
+ gdouble opacity = 0.0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
@@ -1026,76 +2375,76 @@ gimp_layer_is_floating_sel (gint32 layer_ID)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-is-floating-sel",
+ "gimp-layer-get-opacity",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-is-floating-sel",
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-opacity",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- is_floating_sel = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ opacity = g_value_get_double (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return is_floating_sel;
+ return opacity;
}
/**
- * gimp_layer_get_lock_alpha:
- * @layer_ID: The layer.
+ * gimp_layer_set_opacity:
+ * @layer: The layer.
+ * @opacity: The new layer opacity.
*
- * Get the lock alpha channel setting of the specified layer.
+ * Set the opacity of the specified layer.
*
- * This procedure returns the specified layer's lock alpha channel
- * setting.
+ * This procedure sets the specified layer's opacity.
*
- * Returns: The layer's lock alpha channel setting.
+ * Returns: TRUE on success.
**/
gboolean
-gimp_layer_get_lock_alpha (gint32 layer_ID)
+gimp_layer_set_opacity (GimpLayer *layer,
+ gdouble opacity)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean lock_alpha = FALSE;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_DOUBLE, opacity,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-get-lock-alpha",
+ "gimp-layer-set-opacity",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-get-lock-alpha",
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-opacity",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- lock_alpha = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return lock_alpha;
+ return success;
}
/**
- * gimp_layer_set_lock_alpha:
+ * _gimp_layer_set_opacity: (skip)
* @layer_ID: The layer.
- * @lock_alpha: The new layer's lock alpha channel setting.
+ * @opacity: The new layer opacity.
*
- * Set the lock alpha channel setting of the specified layer.
+ * Set the opacity of the specified layer.
*
- * This procedure sets the specified layer's lock alpha channel
- * setting.
+ * This procedure sets the specified layer's opacity.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_layer_set_lock_alpha (gint32 layer_ID,
- gboolean lock_alpha)
+_gimp_layer_set_opacity (gint32 layer_ID,
+ gdouble opacity)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1104,15 +2453,15 @@ gimp_layer_set_lock_alpha (gint32 layer_ID,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
- G_TYPE_BOOLEAN, lock_alpha,
+ G_TYPE_DOUBLE, opacity,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-set-lock-alpha",
+ "gimp-layer-set-opacity",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-set-lock-alpha",
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-opacity",
args);
gimp_value_array_unref (args);
@@ -1124,149 +2473,138 @@ gimp_layer_set_lock_alpha (gint32 layer_ID,
}
/**
- * gimp_layer_get_apply_mask:
- * @layer_ID: The layer.
+ * gimp_layer_get_mode:
+ * @layer: The layer.
*
- * Get the apply mask setting of the specified layer.
+ * Get the combination mode of the specified layer.
*
- * This procedure returns the specified layer's apply mask setting. If
- * the value is TRUE, then the layer mask for this layer is currently
- * being composited with the layer's alpha channel.
+ * This procedure returns the specified layer's combination mode.
*
- * Returns: The layer's apply mask setting.
+ * Returns: The layer combination mode.
**/
-gboolean
-gimp_layer_get_apply_mask (gint32 layer_ID)
+GimpLayerMode
+gimp_layer_get_mode (GimpLayer *layer)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean apply_mask = FALSE;
+ GimpLayerMode mode = 0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-get-apply-mask",
+ "gimp-layer-get-mode",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-get-apply-mask",
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-mode",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- apply_mask = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ mode = g_value_get_enum (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return apply_mask;
+ return mode;
}
/**
- * gimp_layer_set_apply_mask:
+ * _gimp_layer_get_mode: (skip)
* @layer_ID: The layer.
- * @apply_mask: The new layer's apply mask setting.
*
- * Set the apply mask setting of the specified layer.
+ * Get the combination mode 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.
+ * This procedure returns the specified layer's combination mode.
*
- * Returns: TRUE on success.
+ * Returns: The layer combination mode.
**/
-gboolean
-gimp_layer_set_apply_mask (gint32 layer_ID,
- gboolean apply_mask)
+GimpLayerMode
+_gimp_layer_get_mode (gint32 layer_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ GimpLayerMode mode = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
- G_TYPE_BOOLEAN, apply_mask,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-set-apply-mask",
+ "gimp-layer-get-mode",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-set-apply-mask",
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-mode",
args);
gimp_value_array_unref (args);
- success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ mode = g_value_get_enum (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return mode;
}
/**
- * gimp_layer_get_show_mask:
- * @layer_ID: The layer.
+ * gimp_layer_set_mode:
+ * @layer: The layer.
+ * @mode: The new layer combination mode.
*
- * Get the show mask setting of the specified layer.
+ * Set the combination mode of the specified layer.
*
- * This procedure returns the specified layer's show mask setting. This
- * controls whether the layer or its mask is visible. TRUE indicates
- * that the mask should be visible. If the layer has no mask, then this
- * function returns an error.
+ * This procedure sets the specified layer's combination mode.
*
- * Returns: The layer's show mask setting.
+ * Returns: TRUE on success.
**/
gboolean
-gimp_layer_get_show_mask (gint32 layer_ID)
+gimp_layer_set_mode (GimpLayer *layer,
+ GimpLayerMode mode)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean show_mask = FALSE;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ GIMP_TYPE_LAYER_MODE, mode,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-get-show-mask",
+ "gimp-layer-set-mode",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-get-show-mask",
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-mode",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- show_mask = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return show_mask;
+ return success;
}
/**
- * gimp_layer_set_show_mask:
+ * _gimp_layer_set_mode: (skip)
* @layer_ID: The layer.
- * @show_mask: The new layer's show mask setting.
+ * @mode: The new layer combination mode.
*
- * Set the show mask setting of the specified layer.
+ * Set the combination mode of the specified layer.
*
- * This procedure sets the specified layer's show mask setting. This
- * controls whether the layer or its mask is visible. TRUE indicates
- * that the mask should be visible. If there is no layer mask, this
- * function will return an error.
+ * This procedure sets the specified layer's combination mode.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_layer_set_show_mask (gint32 layer_ID,
- gboolean show_mask)
+_gimp_layer_set_mode (gint32 layer_ID,
+ GimpLayerMode mode)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1275,15 +2613,15 @@ gimp_layer_set_show_mask (gint32 layer_ID,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
- G_TYPE_BOOLEAN, show_mask,
+ GIMP_TYPE_LAYER_MODE, mode,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-set-show-mask",
+ "gimp-layer-set-mode",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-set-show-mask",
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-mode",
args);
gimp_value_array_unref (args);
@@ -1295,143 +2633,146 @@ gimp_layer_set_show_mask (gint32 layer_ID,
}
/**
- * gimp_layer_get_edit_mask:
- * @layer_ID: The layer.
+ * gimp_layer_get_blend_space:
+ * @layer: The layer.
*
- * Get the edit mask setting of the specified layer.
+ * Get the blend space of the specified layer.
*
- * This procedure returns the specified layer's edit mask setting. If
- * the value is TRUE, then the layer mask for this layer is currently
- * active, and not the layer.
+ * This procedure returns the specified layer's blend space.
*
- * Returns: The layer's edit mask setting.
+ * Returns: The layer blend space.
+ *
+ * Since: 2.10
**/
-gboolean
-gimp_layer_get_edit_mask (gint32 layer_ID)
+GimpLayerColorSpace
+gimp_layer_get_blend_space (GimpLayer *layer)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean edit_mask = FALSE;
+ GimpLayerColorSpace blend_space = 0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-get-edit-mask",
+ "gimp-layer-get-blend-space",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-get-edit-mask",
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-blend-space",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- edit_mask = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ blend_space = g_value_get_enum (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return edit_mask;
+ return blend_space;
}
/**
- * gimp_layer_set_edit_mask:
+ * _gimp_layer_get_blend_space: (skip)
* @layer_ID: The layer.
- * @edit_mask: The new layer's edit mask setting.
*
- * Set the edit mask setting of the specified layer.
+ * Get the blend space of the specified layer.
*
- * This procedure sets the specified layer's edit 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.
+ * This procedure returns the specified layer's blend space.
*
- * Returns: TRUE on success.
+ * Returns: The layer blend space.
+ *
+ * Since: 2.10
**/
-gboolean
-gimp_layer_set_edit_mask (gint32 layer_ID,
- gboolean edit_mask)
+GimpLayerColorSpace
+_gimp_layer_get_blend_space (gint32 layer_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ GimpLayerColorSpace blend_space = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
- G_TYPE_BOOLEAN, edit_mask,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-set-edit-mask",
+ "gimp-layer-get-blend-space",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-set-edit-mask",
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-blend-space",
args);
gimp_value_array_unref (args);
- success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ blend_space = g_value_get_enum (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return blend_space;
}
/**
- * gimp_layer_get_opacity:
- * @layer_ID: The layer.
+ * gimp_layer_set_blend_space:
+ * @layer: The layer.
+ * @blend_space: The new layer blend space.
*
- * Get the opacity of the specified layer.
+ * Set the blend space of the specified layer.
*
- * This procedure returns the specified layer's opacity.
+ * This procedure sets the specified layer's blend space.
*
- * Returns: The layer opacity.
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
**/
-gdouble
-gimp_layer_get_opacity (gint32 layer_ID)
+gboolean
+gimp_layer_set_blend_space (GimpLayer *layer,
+ GimpLayerColorSpace blend_space)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gdouble opacity = 0.0;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ GIMP_TYPE_LAYER_COLOR_SPACE, blend_space,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-get-opacity",
+ "gimp-layer-set-blend-space",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-get-opacity",
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-blend-space",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- opacity = g_value_get_double (gimp_value_array_index (return_vals, 1));
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return opacity;
+ return success;
}
/**
- * gimp_layer_set_opacity:
+ * _gimp_layer_set_blend_space: (skip)
* @layer_ID: The layer.
- * @opacity: The new layer opacity.
+ * @blend_space: The new layer blend space.
*
- * Set the opacity of the specified layer.
+ * Set the blend space of the specified layer.
*
- * This procedure sets the specified layer's opacity.
+ * This procedure sets the specified layer's blend space.
*
* Returns: TRUE on success.
+ *
+ * Since: 2.10
**/
gboolean
-gimp_layer_set_opacity (gint32 layer_ID,
- gdouble opacity)
+_gimp_layer_set_blend_space (gint32 layer_ID,
+ GimpLayerColorSpace blend_space)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1440,15 +2781,15 @@ gimp_layer_set_opacity (gint32 layer_ID,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
- G_TYPE_DOUBLE, opacity,
+ GIMP_TYPE_LAYER_COLOR_SPACE, blend_space,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-set-opacity",
+ "gimp-layer-set-blend-space",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-set-opacity",
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-blend-space",
args);
gimp_value_array_unref (args);
@@ -1460,142 +2801,146 @@ gimp_layer_set_opacity (gint32 layer_ID,
}
/**
- * gimp_layer_get_mode:
- * @layer_ID: The layer.
+ * gimp_layer_get_composite_space:
+ * @layer: The layer.
*
- * Get the combination mode of the specified layer.
+ * Get the composite space of the specified layer.
*
- * This procedure returns the specified layer's combination mode.
+ * This procedure returns the specified layer's composite space.
*
- * Returns: The layer combination mode.
+ * Returns: The layer composite space.
+ *
+ * Since: 2.10
**/
-GimpLayerMode
-gimp_layer_get_mode (gint32 layer_ID)
+GimpLayerColorSpace
+gimp_layer_get_composite_space (GimpLayer *layer)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- GimpLayerMode mode = 0;
+ GimpLayerColorSpace composite_space = 0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-get-mode",
+ "gimp-layer-get-composite-space",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-get-mode",
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-composite-space",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- mode = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+ composite_space = g_value_get_enum (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return mode;
+ return composite_space;
}
/**
- * gimp_layer_set_mode:
+ * _gimp_layer_get_composite_space: (skip)
* @layer_ID: The layer.
- * @mode: The new layer combination mode.
*
- * Set the combination mode of the specified layer.
+ * Get the composite space of the specified layer.
*
- * This procedure sets the specified layer's combination mode.
+ * This procedure returns the specified layer's composite space.
*
- * Returns: TRUE on success.
+ * Returns: The layer composite space.
+ *
+ * Since: 2.10
**/
-gboolean
-gimp_layer_set_mode (gint32 layer_ID,
- GimpLayerMode mode)
+GimpLayerColorSpace
+_gimp_layer_get_composite_space (gint32 layer_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ GimpLayerColorSpace composite_space = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
- GIMP_TYPE_LAYER_MODE, mode,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-set-mode",
+ "gimp-layer-get-composite-space",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-set-mode",
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-composite-space",
args);
gimp_value_array_unref (args);
- success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ composite_space = g_value_get_enum (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return composite_space;
}
/**
- * gimp_layer_get_blend_space:
- * @layer_ID: The layer.
+ * gimp_layer_set_composite_space:
+ * @layer: The layer.
+ * @composite_space: The new layer composite space.
*
- * Get the blend space of the specified layer.
+ * Set the composite space of the specified layer.
*
- * This procedure returns the specified layer's blend space.
+ * This procedure sets the specified layer's composite space.
*
- * Returns: The layer blend space.
+ * Returns: TRUE on success.
*
* Since: 2.10
**/
-GimpLayerColorSpace
-gimp_layer_get_blend_space (gint32 layer_ID)
+gboolean
+gimp_layer_set_composite_space (GimpLayer *layer,
+ GimpLayerColorSpace composite_space)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- GimpLayerColorSpace blend_space = 0;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ GIMP_TYPE_LAYER_COLOR_SPACE, composite_space,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-get-blend-space",
+ "gimp-layer-set-composite-space",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-get-blend-space",
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-composite-space",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- blend_space = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return blend_space;
+ return success;
}
/**
- * gimp_layer_set_blend_space:
+ * _gimp_layer_set_composite_space: (skip)
* @layer_ID: The layer.
- * @blend_space: The new layer blend space.
+ * @composite_space: The new layer composite space.
*
- * Set the blend space of the specified layer.
+ * Set the composite space of the specified layer.
*
- * This procedure sets the specified layer's blend space.
+ * This procedure sets the specified layer's composite space.
*
* Returns: TRUE on success.
*
* Since: 2.10
**/
gboolean
-gimp_layer_set_blend_space (gint32 layer_ID,
- GimpLayerColorSpace blend_space)
+_gimp_layer_set_composite_space (gint32 layer_ID,
+ GimpLayerColorSpace composite_space)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1604,15 +2949,15 @@ gimp_layer_set_blend_space (gint32 layer_ID,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
- GIMP_TYPE_LAYER_COLOR_SPACE, blend_space,
+ GIMP_TYPE_LAYER_COLOR_SPACE, composite_space,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-set-blend-space",
+ "gimp-layer-set-composite-space",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-set-blend-space",
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-composite-space",
args);
gimp_value_array_unref (args);
@@ -1624,132 +2969,132 @@ gimp_layer_set_blend_space (gint32 layer_ID,
}
/**
- * gimp_layer_get_composite_space:
- * @layer_ID: The layer.
+ * gimp_layer_get_composite_mode:
+ * @layer: The layer.
*
- * Get the composite space of the specified layer.
+ * Get the composite mode of the specified layer.
*
- * This procedure returns the specified layer's composite space.
+ * This procedure returns the specified layer's composite mode.
*
- * Returns: The layer composite space.
+ * Returns: The layer composite mode.
*
* Since: 2.10
**/
-GimpLayerColorSpace
-gimp_layer_get_composite_space (gint32 layer_ID)
+GimpLayerCompositeMode
+gimp_layer_get_composite_mode (GimpLayer *layer)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- GimpLayerColorSpace composite_space = 0;
+ GimpLayerCompositeMode composite_mode = 0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-get-composite-space",
+ "gimp-layer-get-composite-mode",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-get-composite-space",
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-composite-mode",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- composite_space = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+ composite_mode = g_value_get_enum (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return composite_space;
+ return composite_mode;
}
/**
- * gimp_layer_set_composite_space:
+ * _gimp_layer_get_composite_mode: (skip)
* @layer_ID: The layer.
- * @composite_space: The new layer composite space.
*
- * Set the composite space of the specified layer.
+ * Get the composite mode of the specified layer.
*
- * This procedure sets the specified layer's composite space.
+ * This procedure returns the specified layer's composite mode.
*
- * Returns: TRUE on success.
+ * Returns: The layer composite mode.
*
* Since: 2.10
**/
-gboolean
-gimp_layer_set_composite_space (gint32 layer_ID,
- GimpLayerColorSpace composite_space)
+GimpLayerCompositeMode
+_gimp_layer_get_composite_mode (gint32 layer_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ GimpLayerCompositeMode composite_mode = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
- GIMP_TYPE_LAYER_COLOR_SPACE, composite_space,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-set-composite-space",
+ "gimp-layer-get-composite-mode",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-set-composite-space",
+ return_vals = gimp_run_procedure_array ("gimp-layer-get-composite-mode",
args);
gimp_value_array_unref (args);
- success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ composite_mode = g_value_get_enum (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return composite_mode;
}
/**
- * gimp_layer_get_composite_mode:
- * @layer_ID: The layer.
+ * gimp_layer_set_composite_mode:
+ * @layer: The layer.
+ * @composite_mode: The new layer composite mode.
*
- * Get the composite mode of the specified layer.
+ * Set the composite mode of the specified layer.
*
- * This procedure returns the specified layer's composite mode.
+ * This procedure sets the specified layer's composite mode.
*
- * Returns: The layer composite mode.
+ * Returns: TRUE on success.
*
* Since: 2.10
**/
-GimpLayerCompositeMode
-gimp_layer_get_composite_mode (gint32 layer_ID)
+gboolean
+gimp_layer_set_composite_mode (GimpLayer *layer,
+ GimpLayerCompositeMode composite_mode)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- GimpLayerCompositeMode composite_mode = 0;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ GIMP_TYPE_LAYER_COMPOSITE_MODE, composite_mode,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-layer-get-composite-mode",
+ "gimp-layer-set-composite-mode",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-layer-get-composite-mode",
+ return_vals = gimp_run_procedure_array ("gimp-layer-set-composite-mode",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- composite_mode = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return composite_mode;
+ return success;
}
/**
- * gimp_layer_set_composite_mode:
+ * _gimp_layer_set_composite_mode: (skip)
* @layer_ID: The layer.
* @composite_mode: The new layer composite mode.
*
@@ -1762,8 +3107,8 @@ gimp_layer_get_composite_mode (gint32 layer_ID)
* Since: 2.10
**/
gboolean
-gimp_layer_set_composite_mode (gint32 layer_ID,
- GimpLayerCompositeMode composite_mode)
+_gimp_layer_set_composite_mode (gint32 layer_ID,
+ GimpLayerCompositeMode composite_mode)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
diff --git a/libgimp/gimplayer_pdb.h b/libgimp/gimplayer_pdb.h
index 453b6f177f..3070256ff9 100644
--- a/libgimp/gimplayer_pdb.h
+++ b/libgimp/gimplayer_pdb.h
@@ -32,75 +32,76 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-G_GNUC_INTERNAL gint32 _gimp_layer_copy (gint32 layer_ID,
- gboolean add_alpha);
-gboolean gimp_layer_add_alpha (gint32 layer_ID);
-gboolean gimp_layer_flatten (gint32 layer_ID);
-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_resize_to_image_size (gint32 layer_ID);
-gboolean gimp_layer_set_offsets (gint32 layer_ID,
- gint offx,
- gint offy);
-gint32 gimp_layer_create_mask (gint32 layer_ID,
- GimpAddMaskType mask_type);
-gint32 gimp_layer_get_mask (gint32 layer_ID);
-gint32 gimp_layer_from_mask (gint32 mask_ID);
-gboolean gimp_layer_add_mask (gint32 layer_ID,
- gint32 mask_ID);
-gboolean gimp_layer_remove_mask (gint32 layer_ID,
- GimpMaskApplyMode mode);
-gboolean gimp_layer_is_floating_sel (gint32 layer_ID);
-gboolean gimp_layer_get_lock_alpha (gint32 layer_ID);
-gboolean gimp_layer_set_lock_alpha (gint32 layer_ID,
- gboolean lock_alpha);
-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);
-GimpLayerMode gimp_layer_get_mode (gint32 layer_ID);
-gboolean gimp_layer_set_mode (gint32 layer_ID,
- GimpLayerMode mode);
-GimpLayerColorSpace gimp_layer_get_blend_space (gint32 layer_ID);
-gboolean gimp_layer_set_blend_space (gint32 layer_ID,
- GimpLayerColorSpace blend_space);
-GimpLayerColorSpace gimp_layer_get_composite_space (gint32 layer_ID);
-gboolean gimp_layer_set_composite_space (gint32 layer_ID,
- GimpLayerColorSpace composite_space);
-GimpLayerCompositeMode gimp_layer_get_composite_mode (gint32 layer_ID);
-gboolean gimp_layer_set_composite_mode (gint32 layer_ID,
- GimpLayerCompositeMode composite_mode);
+
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
-G_GNUC_INTERNAL gint32 _gimp_layer_new (GimpImage *image,
- gint width,
- gint height,
- GimpImageType type,
- const gchar *name,
- gdouble opacity,
- GimpLayerMode mode);
-gint32 gimp_layer_new_from_visible (GimpImage *image,
- GimpImage *dest_image,
- const gchar *name);
-gint32 gimp_layer_new_from_drawable (gint32 drawable_ID,
- GimpImage *dest_image);
-gint32 gimp_layer_group_new (GimpImage *image);
+G_GNUC_INTERNAL GimpLayer* _gimp_layer_new (GimpImage *image,
+ gint width,
+ gint height,
+ GimpImageType type,
+ const gchar *name,
+ gdouble opacity,
+ GimpLayerMode mode);
+GimpLayer* gimp_layer_new_from_visible (GimpImage *image,
+ GimpImage *dest_image,
+ const gchar *name);
+GimpLayer* gimp_layer_new_from_drawable (GimpDrawable *drawable,
+ GimpImage *dest_image);
+GimpLayer* gimp_layer_group_new (GimpImage *image);
+G_GNUC_INTERNAL GimpLayer* _gimp_layer_copy (GimpLayer *layer,
+ gboolean add_alpha);
+gboolean gimp_layer_add_alpha (GimpLayer *layer);
+gboolean gimp_layer_flatten (GimpLayer *layer);
+gboolean gimp_layer_scale (GimpLayer *layer,
+ gint new_width,
+ gint new_height,
+ gboolean local_origin);
+gboolean gimp_layer_resize (GimpLayer *layer,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy);
+gboolean gimp_layer_resize_to_image_size (GimpLayer *layer);
+gboolean gimp_layer_set_offsets (GimpLayer *layer,
+ gint offx,
+ gint offy);
+gint32 gimp_layer_create_mask (GimpLayer *layer,
+ GimpAddMaskType mask_type);
+gint32 gimp_layer_get_mask (GimpLayer *layer);
+GimpLayer* gimp_layer_from_mask (gint32 mask_ID);
+gboolean gimp_layer_add_mask (GimpLayer *layer,
+ gint32 mask_ID);
+gboolean gimp_layer_remove_mask (GimpLayer *layer,
+ GimpMaskApplyMode mode);
+gboolean gimp_layer_is_floating_sel (GimpLayer *layer);
+gboolean gimp_layer_get_lock_alpha (GimpLayer *layer);
+gboolean gimp_layer_set_lock_alpha (GimpLayer *layer,
+ gboolean lock_alpha);
+gboolean gimp_layer_get_apply_mask (GimpLayer *layer);
+gboolean gimp_layer_set_apply_mask (GimpLayer *layer,
+ gboolean apply_mask);
+gboolean gimp_layer_get_show_mask (GimpLayer *layer);
+gboolean gimp_layer_set_show_mask (GimpLayer *layer,
+ gboolean show_mask);
+gboolean gimp_layer_get_edit_mask (GimpLayer *layer);
+gboolean gimp_layer_set_edit_mask (GimpLayer *layer,
+ gboolean edit_mask);
+gdouble gimp_layer_get_opacity (GimpLayer *layer);
+gboolean gimp_layer_set_opacity (GimpLayer *layer,
+ gdouble opacity);
+GimpLayerMode gimp_layer_get_mode (GimpLayer *layer);
+gboolean gimp_layer_set_mode (GimpLayer *layer,
+ GimpLayerMode mode);
+GimpLayerColorSpace gimp_layer_get_blend_space (GimpLayer *layer);
+gboolean gimp_layer_set_blend_space (GimpLayer *layer,
+ GimpLayerColorSpace blend_space);
+GimpLayerColorSpace gimp_layer_get_composite_space (GimpLayer *layer);
+gboolean gimp_layer_set_composite_space (GimpLayer *layer,
+ GimpLayerColorSpace composite_space);
+GimpLayerCompositeMode gimp_layer_get_composite_mode (GimpLayer *layer);
+gboolean gimp_layer_set_composite_mode (GimpLayer *layer,
+ GimpLayerCompositeMode composite_mode);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
@@ -108,6 +109,37 @@ gint32 gimp_layer_group_new (GimpImage *image);
#define gimp_layer_new_from_visible _gimp_layer_new_from_visible
#define gimp_layer_new_from_drawable _gimp_layer_new_from_drawable
#define gimp_layer_group_new _gimp_layer_group_new
+#define _gimp_layer_copy __gimp_layer_copy
+#define gimp_layer_add_alpha _gimp_layer_add_alpha
+#define gimp_layer_flatten _gimp_layer_flatten
+#define gimp_layer_scale _gimp_layer_scale
+#define gimp_layer_resize _gimp_layer_resize
+#define gimp_layer_resize_to_image_size _gimp_layer_resize_to_image_size
+#define gimp_layer_set_offsets _gimp_layer_set_offsets
+#define gimp_layer_create_mask _gimp_layer_create_mask
+#define gimp_layer_get_mask _gimp_layer_get_mask
+#define gimp_layer_from_mask _gimp_layer_from_mask
+#define gimp_layer_add_mask _gimp_layer_add_mask
+#define gimp_layer_remove_mask _gimp_layer_remove_mask
+#define gimp_layer_is_floating_sel _gimp_layer_is_floating_sel
+#define gimp_layer_get_lock_alpha _gimp_layer_get_lock_alpha
+#define gimp_layer_set_lock_alpha _gimp_layer_set_lock_alpha
+#define gimp_layer_get_apply_mask _gimp_layer_get_apply_mask
+#define gimp_layer_set_apply_mask _gimp_layer_set_apply_mask
+#define gimp_layer_get_show_mask _gimp_layer_get_show_mask
+#define gimp_layer_set_show_mask _gimp_layer_set_show_mask
+#define gimp_layer_get_edit_mask _gimp_layer_get_edit_mask
+#define gimp_layer_set_edit_mask _gimp_layer_set_edit_mask
+#define gimp_layer_get_opacity _gimp_layer_get_opacity
+#define gimp_layer_set_opacity _gimp_layer_set_opacity
+#define gimp_layer_get_mode _gimp_layer_get_mode
+#define gimp_layer_set_mode _gimp_layer_set_mode
+#define gimp_layer_get_blend_space _gimp_layer_get_blend_space
+#define gimp_layer_set_blend_space _gimp_layer_set_blend_space
+#define gimp_layer_get_composite_space _gimp_layer_get_composite_space
+#define gimp_layer_set_composite_space _gimp_layer_set_composite_space
+#define gimp_layer_get_composite_mode _gimp_layer_get_composite_mode
+#define gimp_layer_set_composite_mode _gimp_layer_set_composite_mode
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@@ -116,19 +148,72 @@ gint32 gimp_layer_group_new (GimpImage *image);
* They are not marked internal as a trick to keep the old API alive for now.
*/
-gint32 __gimp_layer_new (gint32 image_ID,
- gint width,
- gint height,
- GimpImageType type,
- const gchar *name,
- gdouble opacity,
- GimpLayerMode mode);
-gint32 _gimp_layer_new_from_visible (gint32 image_ID,
- gint32 dest_image_ID,
- const gchar *name);
-gint32 _gimp_layer_new_from_drawable (gint32 drawable_ID,
- gint32 dest_image_ID);
-gint32 _gimp_layer_group_new (gint32 image_ID);
+gint32 __gimp_layer_new (gint32 image_ID,
+ gint width,
+ gint height,
+ GimpImageType type,
+ const gchar *name,
+ gdouble opacity,
+ GimpLayerMode mode);
+gint32 _gimp_layer_new_from_visible (gint32 image_ID,
+ gint32 dest_image_ID,
+ const gchar *name);
+gint32 _gimp_layer_new_from_drawable (gint32 drawable_ID,
+ gint32 dest_image_ID);
+gint32 _gimp_layer_group_new (gint32 image_ID);
+gint32 __gimp_layer_copy (gint32 layer_ID,
+ gboolean add_alpha);
+gboolean _gimp_layer_add_alpha (gint32 layer_ID);
+gboolean _gimp_layer_flatten (gint32 layer_ID);
+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_resize_to_image_size (gint32 layer_ID);
+gboolean _gimp_layer_set_offsets (gint32 layer_ID,
+ gint offx,
+ gint offy);
+gint32 _gimp_layer_create_mask (gint32 layer_ID,
+ GimpAddMaskType mask_type);
+gint32 _gimp_layer_get_mask (gint32 layer_ID);
+gint32 _gimp_layer_from_mask (gint32 mask_ID);
+gboolean _gimp_layer_add_mask (gint32 layer_ID,
+ gint32 mask_ID);
+gboolean _gimp_layer_remove_mask (gint32 layer_ID,
+ GimpMaskApplyMode mode);
+gboolean _gimp_layer_is_floating_sel (gint32 layer_ID);
+gboolean _gimp_layer_get_lock_alpha (gint32 layer_ID);
+gboolean _gimp_layer_set_lock_alpha (gint32 layer_ID,
+ gboolean lock_alpha);
+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);
+GimpLayerMode _gimp_layer_get_mode (gint32 layer_ID);
+gboolean _gimp_layer_set_mode (gint32 layer_ID,
+ GimpLayerMode mode);
+GimpLayerColorSpace _gimp_layer_get_blend_space (gint32 layer_ID);
+gboolean _gimp_layer_set_blend_space (gint32 layer_ID,
+ GimpLayerColorSpace blend_space);
+GimpLayerColorSpace _gimp_layer_get_composite_space (gint32 layer_ID);
+gboolean _gimp_layer_set_composite_space (gint32 layer_ID,
+ GimpLayerColorSpace composite_space);
+GimpLayerCompositeMode _gimp_layer_get_composite_mode (gint32 layer_ID);
+gboolean _gimp_layer_set_composite_mode (gint32 layer_ID,
+ GimpLayerCompositeMode composite_mode);
G_END_DECLS
diff --git a/libgimp/gimppainttools_pdb.c b/libgimp/gimppainttools_pdb.c
index 6f782f4e6e..4563025c57 100644
--- a/libgimp/gimppainttools_pdb.c
+++ b/libgimp/gimppainttools_pdb.c
@@ -36,7 +36,7 @@
/**
* gimp_airbrush:
- * @drawable_ID: The affected drawable.
+ * @drawable: The affected drawable.
* @pressure: The pressure of the airbrush strokes.
* @num_strokes: Number of stroke control points (count each coordinate as 2 points).
* @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
@@ -52,7 +52,7 @@
* Returns: TRUE on success.
**/
gboolean
-gimp_airbrush (gint32 drawable_ID,
+gimp_airbrush (GimpDrawable *drawable,
gdouble pressure,
gint num_strokes,
const gdouble *strokes)
@@ -62,6 +62,58 @@ gimp_airbrush (gint32 drawable_ID,
GimpValueArray *return_vals;
gboolean success = TRUE;
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_DOUBLE, pressure,
+ G_TYPE_INT, num_strokes,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 3), strokes, num_strokes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-airbrush",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-airbrush",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_airbrush: (skip)
+ * @drawable_ID: The affected drawable.
+ * @pressure: The pressure of the airbrush strokes.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Paint in the current brush with varying pressure. Paint application
+ * is time-dependent.
+ *
+ * This tool simulates the use of an airbrush. Paint pressure
+ * represents the relative intensity of the paint application. High
+ * pressure results in a thicker layer of paint while low pressure
+ * results in a thinner layer.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_airbrush (gint32 drawable_ID,
+ gdouble pressure,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
G_TYPE_DOUBLE, pressure,
@@ -88,7 +140,7 @@ gimp_airbrush (gint32 drawable_ID,
/**
* gimp_airbrush_default:
- * @drawable_ID: The affected drawable.
+ * @drawable: The affected drawable.
* @num_strokes: Number of stroke control points (count each coordinate as 2 points).
* @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
*
@@ -103,7 +155,7 @@ gimp_airbrush (gint32 drawable_ID,
* Returns: TRUE on success.
**/
gboolean
-gimp_airbrush_default (gint32 drawable_ID,
+gimp_airbrush_default (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes)
{
@@ -112,6 +164,55 @@ gimp_airbrush_default (gint32 drawable_ID,
GimpValueArray *return_vals;
gboolean success = TRUE;
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_INT, num_strokes,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-airbrush-default",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-airbrush-default",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_airbrush_default: (skip)
+ * @drawable_ID: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Paint in the current brush with varying pressure. Paint application
+ * is time-dependent.
+ *
+ * This tool simulates the use of an airbrush. It is similar to
+ * gimp_airbrush() except that the pressure is derived from the
+ * airbrush tools options box. It the option has not been set the
+ * default for the option will be used.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_airbrush_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
G_TYPE_INT, num_strokes,
@@ -137,8 +238,8 @@ gimp_airbrush_default (gint32 drawable_ID,
/**
* gimp_clone:
- * @drawable_ID: The affected drawable.
- * @src_drawable_ID: The source drawable.
+ * @drawable: The affected drawable.
+ * @src_drawable: The source drawable.
* @clone_type: The type of clone.
* @src_x: The x coordinate in the source image.
* @src_y: The y coordinate in the source image.
@@ -163,8 +264,8 @@ gimp_airbrush_default (gint32 drawable_ID,
* Returns: TRUE on success.
**/
gboolean
-gimp_clone (gint32 drawable_ID,
- gint32 src_drawable_ID,
+gimp_clone (GimpDrawable *drawable,
+ GimpDrawable *src_drawable,
GimpCloneType clone_type,
gdouble src_x,
gdouble src_y,
@@ -177,8 +278,8 @@ gimp_clone (gint32 drawable_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
- GIMP_TYPE_DRAWABLE_ID, src_drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (src_drawable)),
GIMP_TYPE_CLONE_TYPE, clone_type,
G_TYPE_DOUBLE, src_x,
G_TYPE_DOUBLE, src_y,
@@ -204,26 +305,40 @@ gimp_clone (gint32 drawable_ID,
}
/**
- * gimp_clone_default:
+ * _gimp_clone: (skip)
* @drawable_ID: The affected drawable.
+ * @src_drawable_ID: The source drawable.
+ * @clone_type: The type of clone.
+ * @src_x: The x coordinate in the source image.
+ * @src_y: The y coordinate in the source image.
* @num_strokes: Number of stroke control points (count each coordinate as 2 points).
* @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
*
* Clone from the source to the dest drawable using the current brush
*
* This tool clones (copies) from the source drawable starting at the
- * specified source coordinates to the dest drawable. This function
- * performs exactly the same as the gimp_clone() function except that
- * the tools arguments are obtained from the clones option dialog. It
- * this dialog has not been activated then the dialogs default values
- * will be used.
+ * specified source coordinates to the dest drawable. If the
+ * \"clone_type\" argument is set to PATTERN-CLONE, then the current
+ * pattern is used as the source and the \"src_drawable\" argument is
+ * ignored. Pattern cloning assumes a tileable pattern and mods the sum
+ * of the src coordinates and subsequent stroke offsets with the width
+ * and height of the pattern. For image cloning, if the sum of the src
+ * coordinates and subsequent stroke offsets exceeds the extents of the
+ * src drawable, then no paint is transferred. The clone tool is
+ * capable of transforming between any image types including
+ * RGB->Indexed--although converting from any type to indexed is
+ * significantly slower.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_clone_default (gint32 drawable_ID,
- gint num_strokes,
- const gdouble *strokes)
+_gimp_clone (gint32 drawable_ID,
+ gint32 src_drawable_ID,
+ GimpCloneType clone_type,
+ gdouble src_x,
+ gdouble src_y,
+ gint num_strokes,
+ const gdouble *strokes)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -232,17 +347,21 @@ gimp_clone_default (gint32 drawable_ID,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, src_drawable_ID,
+ GIMP_TYPE_CLONE_TYPE, clone_type,
+ G_TYPE_DOUBLE, src_x,
+ G_TYPE_DOUBLE, src_y,
G_TYPE_INT, num_strokes,
GIMP_TYPE_FLOAT_ARRAY, NULL,
G_TYPE_NONE);
- gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
+ gimp_value_set_float_array (gimp_value_array_index (args, 6), strokes, num_strokes);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-clone-default",
+ "gimp-clone",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-clone-default",
+ return_vals = gimp_run_procedure_array ("gimp-clone",
args);
gimp_value_array_unref (args);
@@ -254,28 +373,26 @@ gimp_clone_default (gint32 drawable_ID,
}
/**
- * gimp_convolve:
- * @drawable_ID: The affected drawable.
- * @pressure: The pressure.
- * @convolve_type: Convolve type.
+ * gimp_clone_default:
+ * @drawable: The affected drawable.
* @num_strokes: Number of stroke control points (count each coordinate as 2 points).
* @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
*
- * Convolve (Blur, Sharpen) using the current brush.
+ * Clone from the source to the dest drawable using the current brush
*
- * This tool convolves the specified drawable with either a sharpening
- * or blurring kernel. The pressure parameter controls the magnitude of
- * the operation. Like the paintbrush, this tool linearly interpolates
- * between the specified stroke coordinates.
+ * This tool clones (copies) from the source drawable starting at the
+ * specified source coordinates to the dest drawable. This function
+ * performs exactly the same as the gimp_clone() function except that
+ * the tools arguments are obtained from the clones option dialog. It
+ * this dialog has not been activated then the dialogs default values
+ * will be used.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_convolve (gint32 drawable_ID,
- gdouble pressure,
- GimpConvolveType convolve_type,
- gint num_strokes,
- const gdouble *strokes)
+gimp_clone_default (GimpDrawable *drawable,
+ gint num_strokes,
+ const gdouble *strokes)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -283,20 +400,18 @@ gimp_convolve (gint32 drawable_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
- G_TYPE_DOUBLE, pressure,
- GIMP_TYPE_CONVOLVE_TYPE, convolve_type,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_INT, num_strokes,
GIMP_TYPE_FLOAT_ARRAY, NULL,
G_TYPE_NONE);
- gimp_value_set_float_array (gimp_value_array_index (args, 4), strokes, num_strokes);
+ gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-convolve",
+ "gimp-clone-default",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-convolve",
+ return_vals = gimp_run_procedure_array ("gimp-clone-default",
args);
gimp_value_array_unref (args);
@@ -308,25 +423,26 @@ gimp_convolve (gint32 drawable_ID,
}
/**
- * gimp_convolve_default:
+ * _gimp_clone_default: (skip)
* @drawable_ID: The affected drawable.
* @num_strokes: Number of stroke control points (count each coordinate as 2 points).
* @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
*
- * Convolve (Blur, Sharpen) using the current brush.
+ * Clone from the source to the dest drawable using the current brush
*
- * This tool convolves the specified drawable with either a sharpening
- * or blurring kernel. This function performs exactly the same as the
- * gimp_convolve() function except that the tools arguments are
- * obtained from the convolve option dialog. It this dialog has not
- * been activated then the dialogs default values will be used.
+ * This tool clones (copies) from the source drawable starting at the
+ * specified source coordinates to the dest drawable. This function
+ * performs exactly the same as the gimp_clone() function except that
+ * the tools arguments are obtained from the clones option dialog. It
+ * this dialog has not been activated then the dialogs default values
+ * will be used.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_convolve_default (gint32 drawable_ID,
- gint num_strokes,
- const gdouble *strokes)
+_gimp_clone_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -342,10 +458,10 @@ gimp_convolve_default (gint32 drawable_ID,
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-convolve-default",
+ "gimp-clone-default",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-convolve-default",
+ return_vals = gimp_run_procedure_array ("gimp-clone-default",
args);
gimp_value_array_unref (args);
@@ -357,27 +473,28 @@ gimp_convolve_default (gint32 drawable_ID,
}
/**
- * gimp_dodgeburn:
- * @drawable_ID: The affected drawable.
- * @exposure: The exposure of the strokes.
- * @dodgeburn_type: The type either dodge or burn.
- * @dodgeburn_mode: The mode.
+ * gimp_convolve:
+ * @drawable: The affected drawable.
+ * @pressure: The pressure.
+ * @convolve_type: Convolve type.
* @num_strokes: Number of stroke control points (count each coordinate as 2 points).
* @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
*
- * Dodgeburn image with varying exposure.
+ * Convolve (Blur, Sharpen) using the current brush.
*
- * Dodgeburn. More details here later.
+ * This tool convolves the specified drawable with either a sharpening
+ * or blurring kernel. The pressure parameter controls the magnitude of
+ * the operation. Like the paintbrush, this tool linearly interpolates
+ * between the specified stroke coordinates.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_dodgeburn (gint32 drawable_ID,
- gdouble exposure,
- GimpDodgeBurnType dodgeburn_type,
- GimpTransferMode dodgeburn_mode,
- gint num_strokes,
- const gdouble *strokes)
+gimp_convolve (GimpDrawable *drawable,
+ gdouble pressure,
+ GimpConvolveType convolve_type,
+ gint num_strokes,
+ const gdouble *strokes)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -385,21 +502,20 @@ gimp_dodgeburn (gint32 drawable_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
- G_TYPE_DOUBLE, exposure,
- GIMP_TYPE_DODGE_BURN_TYPE, dodgeburn_type,
- GIMP_TYPE_TRANSFER_MODE, dodgeburn_mode,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_DOUBLE, pressure,
+ GIMP_TYPE_CONVOLVE_TYPE, convolve_type,
G_TYPE_INT, num_strokes,
GIMP_TYPE_FLOAT_ARRAY, NULL,
G_TYPE_NONE);
- gimp_value_set_float_array (gimp_value_array_index (args, 5), strokes, num_strokes);
+ gimp_value_set_float_array (gimp_value_array_index (args, 4), strokes, num_strokes);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-dodgeburn",
+ "gimp-convolve",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-dodgeburn",
+ return_vals = gimp_run_procedure_array ("gimp-convolve",
args);
gimp_value_array_unref (args);
@@ -411,24 +527,28 @@ gimp_dodgeburn (gint32 drawable_ID,
}
/**
- * gimp_dodgeburn_default:
+ * _gimp_convolve: (skip)
* @drawable_ID: The affected drawable.
+ * @pressure: The pressure.
+ * @convolve_type: Convolve type.
* @num_strokes: Number of stroke control points (count each coordinate as 2 points).
* @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
*
- * Dodgeburn image with varying exposure. This is the same as the
- * gimp_dodgeburn() function except that the exposure, type and mode
- * are taken from the tools option dialog. If the dialog has not been
- * activated then the defaults as used by the dialog will be used.
+ * Convolve (Blur, Sharpen) using the current brush.
*
- * Dodgeburn. More details here later.
+ * This tool convolves the specified drawable with either a sharpening
+ * or blurring kernel. The pressure parameter controls the magnitude of
+ * the operation. Like the paintbrush, this tool linearly interpolates
+ * between the specified stroke coordinates.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_dodgeburn_default (gint32 drawable_ID,
- gint num_strokes,
- const gdouble *strokes)
+_gimp_convolve (gint32 drawable_ID,
+ gdouble pressure,
+ GimpConvolveType convolve_type,
+ gint num_strokes,
+ const gdouble *strokes)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -437,17 +557,19 @@ gimp_dodgeburn_default (gint32 drawable_ID,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_DOUBLE, pressure,
+ GIMP_TYPE_CONVOLVE_TYPE, convolve_type,
G_TYPE_INT, num_strokes,
GIMP_TYPE_FLOAT_ARRAY, NULL,
G_TYPE_NONE);
- gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
+ gimp_value_set_float_array (gimp_value_array_index (args, 4), strokes, num_strokes);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-dodgeburn-default",
+ "gimp-convolve",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-dodgeburn-default",
+ return_vals = gimp_run_procedure_array ("gimp-convolve",
args);
gimp_value_array_unref (args);
@@ -459,17 +581,374 @@ gimp_dodgeburn_default (gint32 drawable_ID,
}
/**
- * gimp_eraser:
- * @drawable_ID: The affected drawable.
+ * gimp_convolve_default:
+ * @drawable: The affected drawable.
* @num_strokes: Number of stroke control points (count each coordinate as 2 points).
* @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
- * @hardness: How to apply the brush.
- * @method: The paint method to use.
*
- * Erase using the current brush.
+ * Convolve (Blur, Sharpen) using the current brush.
*
- * This tool erases using the current brush mask. If the specified
- * drawable contains an alpha channel, then the erased pixels will
+ * This tool convolves the specified drawable with either a sharpening
+ * or blurring kernel. This function performs exactly the same as the
+ * gimp_convolve() function except that the tools arguments are
+ * obtained from the convolve option dialog. It this dialog has not
+ * been activated then the dialogs default values will be used.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_convolve_default (GimpDrawable *drawable,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_INT, num_strokes,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-convolve-default",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-convolve-default",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_convolve_default: (skip)
+ * @drawable_ID: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Convolve (Blur, Sharpen) using the current brush.
+ *
+ * This tool convolves the specified drawable with either a sharpening
+ * or blurring kernel. This function performs exactly the same as the
+ * gimp_convolve() function except that the tools arguments are
+ * obtained from the convolve option dialog. It this dialog has not
+ * been activated then the dialogs default values will be used.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_convolve_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_INT, num_strokes,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-convolve-default",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-convolve-default",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_dodgeburn:
+ * @drawable: The affected drawable.
+ * @exposure: The exposure of the strokes.
+ * @dodgeburn_type: The type either dodge or burn.
+ * @dodgeburn_mode: The mode.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Dodgeburn image with varying exposure.
+ *
+ * Dodgeburn. More details here later.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_dodgeburn (GimpDrawable *drawable,
+ gdouble exposure,
+ GimpDodgeBurnType dodgeburn_type,
+ GimpTransferMode dodgeburn_mode,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_DOUBLE, exposure,
+ GIMP_TYPE_DODGE_BURN_TYPE, dodgeburn_type,
+ GIMP_TYPE_TRANSFER_MODE, dodgeburn_mode,
+ G_TYPE_INT, num_strokes,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 5), strokes, num_strokes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-dodgeburn",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-dodgeburn",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_dodgeburn: (skip)
+ * @drawable_ID: The affected drawable.
+ * @exposure: The exposure of the strokes.
+ * @dodgeburn_type: The type either dodge or burn.
+ * @dodgeburn_mode: The mode.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Dodgeburn image with varying exposure.
+ *
+ * Dodgeburn. More details here later.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_dodgeburn (gint32 drawable_ID,
+ gdouble exposure,
+ GimpDodgeBurnType dodgeburn_type,
+ GimpTransferMode dodgeburn_mode,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_DOUBLE, exposure,
+ GIMP_TYPE_DODGE_BURN_TYPE, dodgeburn_type,
+ GIMP_TYPE_TRANSFER_MODE, dodgeburn_mode,
+ G_TYPE_INT, num_strokes,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 5), strokes, num_strokes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-dodgeburn",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-dodgeburn",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_dodgeburn_default:
+ * @drawable: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Dodgeburn image with varying exposure. This is the same as the
+ * gimp_dodgeburn() function except that the exposure, type and mode
+ * are taken from the tools option dialog. If the dialog has not been
+ * activated then the defaults as used by the dialog will be used.
+ *
+ * Dodgeburn. More details here later.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_dodgeburn_default (GimpDrawable *drawable,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_INT, num_strokes,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-dodgeburn-default",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-dodgeburn-default",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_dodgeburn_default: (skip)
+ * @drawable_ID: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Dodgeburn image with varying exposure. This is the same as the
+ * gimp_dodgeburn() function except that the exposure, type and mode
+ * are taken from the tools option dialog. If the dialog has not been
+ * activated then the defaults as used by the dialog will be used.
+ *
+ * Dodgeburn. More details here later.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_dodgeburn_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_INT, num_strokes,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-dodgeburn-default",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-dodgeburn-default",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_eraser:
+ * @drawable: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
+ * @hardness: How to apply the brush.
+ * @method: The paint method to use.
+ *
+ * Erase using the current brush.
+ *
+ * This tool erases using the current brush mask. If the specified
+ * drawable contains an alpha channel, then the erased pixels will
+ * become transparent. Otherwise, the eraser tool replaces the contents
+ * of the drawable with the background color. Like paintbrush, this
+ * tool linearly interpolates between the specified stroke coordinates.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_eraser (GimpDrawable *drawable,
+ gint num_strokes,
+ const gdouble *strokes,
+ GimpBrushApplicationMode hardness,
+ GimpPaintApplicationMode method)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_INT, num_strokes,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
+ GIMP_TYPE_BRUSH_APPLICATION_MODE, hardness,
+ GIMP_TYPE_PAINT_APPLICATION_MODE, method,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-eraser",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-eraser",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_eraser: (skip)
+ * @drawable_ID: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
+ * @hardness: How to apply the brush.
+ * @method: The paint method to use.
+ *
+ * Erase using the current brush.
+ *
+ * This tool erases using the current brush mask. If the specified
+ * drawable contains an alpha channel, then the erased pixels will
* become transparent. Otherwise, the eraser tool replaces the contents
* of the drawable with the background color. Like paintbrush, this
* tool linearly interpolates between the specified stroke coordinates.
@@ -477,11 +956,337 @@ gimp_dodgeburn_default (gint32 drawable_ID,
* Returns: TRUE on success.
**/
gboolean
-gimp_eraser (gint32 drawable_ID,
- gint num_strokes,
- const gdouble *strokes,
- GimpBrushApplicationMode hardness,
- GimpPaintApplicationMode method)
+_gimp_eraser (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes,
+ GimpBrushApplicationMode hardness,
+ GimpPaintApplicationMode method)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_INT, num_strokes,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
+ GIMP_TYPE_BRUSH_APPLICATION_MODE, hardness,
+ GIMP_TYPE_PAINT_APPLICATION_MODE, method,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-eraser",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-eraser",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_eraser_default:
+ * @drawable: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Erase using the current brush.
+ *
+ * This tool erases using the current brush mask. This function
+ * performs exactly the same as the gimp_eraser() function except that
+ * the tools arguments are obtained from the eraser option dialog. It
+ * this dialog has not been activated then the dialogs default values
+ * will be used.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_eraser_default (GimpDrawable *drawable,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_INT, num_strokes,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-eraser-default",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-eraser-default",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_eraser_default: (skip)
+ * @drawable_ID: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Erase using the current brush.
+ *
+ * This tool erases using the current brush mask. This function
+ * performs exactly the same as the gimp_eraser() function except that
+ * the tools arguments are obtained from the eraser option dialog. It
+ * this dialog has not been activated then the dialogs default values
+ * will be used.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_eraser_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_INT, num_strokes,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-eraser-default",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-eraser-default",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_heal:
+ * @drawable: The affected drawable.
+ * @src_drawable: The source drawable.
+ * @src_x: The x coordinate in the source image.
+ * @src_y: The y coordinate in the source image.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Heal from the source to the dest drawable using the current brush
+ *
+ * This tool heals the source drawable starting at the specified source
+ * coordinates to the dest drawable. For image healing, if the sum of
+ * the src coordinates and subsequent stroke offsets exceeds the
+ * extents of the src drawable, then no paint is transferred. The
+ * healing tool is capable of transforming between any image types
+ * except RGB->Indexed.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_heal (GimpDrawable *drawable,
+ GimpDrawable *src_drawable,
+ gdouble src_x,
+ gdouble src_y,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (src_drawable)),
+ G_TYPE_DOUBLE, src_x,
+ G_TYPE_DOUBLE, src_y,
+ G_TYPE_INT, num_strokes,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 5), strokes, num_strokes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-heal",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-heal",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_heal: (skip)
+ * @drawable_ID: The affected drawable.
+ * @src_drawable_ID: The source drawable.
+ * @src_x: The x coordinate in the source image.
+ * @src_y: The y coordinate in the source image.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Heal from the source to the dest drawable using the current brush
+ *
+ * This tool heals the source drawable starting at the specified source
+ * coordinates to the dest drawable. For image healing, if the sum of
+ * the src coordinates and subsequent stroke offsets exceeds the
+ * extents of the src drawable, then no paint is transferred. The
+ * healing tool is capable of transforming between any image types
+ * except RGB->Indexed.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+_gimp_heal (gint32 drawable_ID,
+ gint32 src_drawable_ID,
+ gdouble src_x,
+ gdouble src_y,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, src_drawable_ID,
+ G_TYPE_DOUBLE, src_x,
+ G_TYPE_DOUBLE, src_y,
+ G_TYPE_INT, num_strokes,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 5), strokes, num_strokes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-heal",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-heal",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_heal_default:
+ * @drawable: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Heal from the source to the dest drawable using the current brush
+ *
+ * This tool heals from the source drawable starting at the specified
+ * source coordinates to the dest drawable. This function performs
+ * exactly the same as the gimp_heal() function except that the tools
+ * arguments are obtained from the healing option dialog. It this
+ * dialog has not been activated then the dialogs default values will
+ * be used.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_heal_default (GimpDrawable *drawable,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_INT, num_strokes,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-heal-default",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-heal-default",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_heal_default: (skip)
+ * @drawable_ID: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Heal from the source to the dest drawable using the current brush
+ *
+ * This tool heals from the source drawable starting at the specified
+ * source coordinates to the dest drawable. This function performs
+ * exactly the same as the gimp_heal() function except that the tools
+ * arguments are obtained from the healing option dialog. It this
+ * dialog has not been activated then the dialogs default values will
+ * be used.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+_gimp_heal_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -492,17 +1297,78 @@ gimp_eraser (gint32 drawable_ID,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
G_TYPE_INT, num_strokes,
GIMP_TYPE_FLOAT_ARRAY, NULL,
- GIMP_TYPE_BRUSH_APPLICATION_MODE, hardness,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-heal-default",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-heal-default",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_paintbrush:
+ * @drawable: The affected drawable.
+ * @fade_out: Fade out parameter.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
+ * @method: The paint method to use.
+ * @gradient_length: Length of gradient to draw.
+ *
+ * Paint in the current brush with optional fade out parameter and pull
+ * colors from a gradient.
+ *
+ * This tool is the standard paintbrush. It draws linearly interpolated
+ * lines through the specified stroke coordinates. It operates on the
+ * specified drawable in the foreground color with the active brush.
+ * The 'fade-out' parameter is measured in pixels and allows the brush
+ * stroke to linearly fall off. The pressure is set to the maximum at
+ * the beginning of the stroke. As the distance of the stroke nears the
+ * fade-out value, the pressure will approach zero. The gradient-length
+ * is the distance to spread the gradient over. It is measured in
+ * pixels. If the gradient-length is 0, no gradient is used.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_paintbrush (GimpDrawable *drawable,
+ gdouble fade_out,
+ gint num_strokes,
+ const gdouble *strokes,
+ GimpPaintApplicationMode method,
+ gdouble gradient_length)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_DOUBLE, fade_out,
+ G_TYPE_INT, num_strokes,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
GIMP_TYPE_PAINT_APPLICATION_MODE, method,
+ G_TYPE_DOUBLE, gradient_length,
G_TYPE_NONE);
- gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
+ gimp_value_set_float_array (gimp_value_array_index (args, 3), strokes, num_strokes);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-eraser",
+ "gimp-paintbrush",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-eraser",
+ return_vals = gimp_run_procedure_array ("gimp-paintbrush",
args);
gimp_value_array_unref (args);
@@ -514,25 +1380,36 @@ gimp_eraser (gint32 drawable_ID,
}
/**
- * gimp_eraser_default:
+ * _gimp_paintbrush: (skip)
* @drawable_ID: The affected drawable.
+ * @fade_out: Fade out parameter.
* @num_strokes: Number of stroke control points (count each coordinate as 2 points).
* @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
+ * @method: The paint method to use.
+ * @gradient_length: Length of gradient to draw.
*
- * Erase using the current brush.
+ * Paint in the current brush with optional fade out parameter and pull
+ * colors from a gradient.
*
- * This tool erases using the current brush mask. This function
- * performs exactly the same as the gimp_eraser() function except that
- * the tools arguments are obtained from the eraser option dialog. It
- * this dialog has not been activated then the dialogs default values
- * will be used.
+ * This tool is the standard paintbrush. It draws linearly interpolated
+ * lines through the specified stroke coordinates. It operates on the
+ * specified drawable in the foreground color with the active brush.
+ * The 'fade-out' parameter is measured in pixels and allows the brush
+ * stroke to linearly fall off. The pressure is set to the maximum at
+ * the beginning of the stroke. As the distance of the stroke nears the
+ * fade-out value, the pressure will approach zero. The gradient-length
+ * is the distance to spread the gradient over. It is measured in
+ * pixels. If the gradient-length is 0, no gradient is used.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_eraser_default (gint32 drawable_ID,
- gint num_strokes,
- const gdouble *strokes)
+_gimp_paintbrush (gint32 drawable_ID,
+ gdouble fade_out,
+ gint num_strokes,
+ const gdouble *strokes,
+ GimpPaintApplicationMode method,
+ gdouble gradient_length)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -541,17 +1418,20 @@ gimp_eraser_default (gint32 drawable_ID,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_DOUBLE, fade_out,
G_TYPE_INT, num_strokes,
GIMP_TYPE_FLOAT_ARRAY, NULL,
+ GIMP_TYPE_PAINT_APPLICATION_MODE, method,
+ G_TYPE_DOUBLE, gradient_length,
G_TYPE_NONE);
- gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
+ gimp_value_set_float_array (gimp_value_array_index (args, 3), strokes, num_strokes);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-eraser-default",
+ "gimp-paintbrush",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-eraser-default",
+ return_vals = gimp_run_procedure_array ("gimp-paintbrush",
args);
gimp_value_array_unref (args);
@@ -563,34 +1443,34 @@ gimp_eraser_default (gint32 drawable_ID,
}
/**
- * gimp_heal:
- * @drawable_ID: The affected drawable.
- * @src_drawable_ID: The source drawable.
- * @src_x: The x coordinate in the source image.
- * @src_y: The y coordinate in the source image.
+ * gimp_paintbrush_default:
+ * @drawable: The affected drawable.
* @num_strokes: Number of stroke control points (count each coordinate as 2 points).
* @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
*
- * Heal from the source to the dest drawable using the current brush
+ * Paint in the current brush. The fade out parameter and pull colors
+ * from a gradient parameter are set from the paintbrush options
+ * dialog. If this dialog has not been activated then the dialog
+ * defaults will be used.
*
- * This tool heals the source drawable starting at the specified source
- * coordinates to the dest drawable. For image healing, if the sum of
- * the src coordinates and subsequent stroke offsets exceeds the
- * extents of the src drawable, then no paint is transferred. The
- * healing tool is capable of transforming between any image types
- * except RGB->Indexed.
+ * This tool is similar to the standard paintbrush. It draws linearly
+ * interpolated lines through the specified stroke coordinates. It
+ * operates on the specified drawable in the foreground color with the
+ * active brush. The 'fade-out' parameter is measured in pixels and
+ * allows the brush stroke to linearly fall off (value obtained from
+ * the option dialog). The pressure is set to the maximum at the
+ * beginning of the stroke. As the distance of the stroke nears the
+ * fade-out value, the pressure will approach zero. The gradient-length
+ * (value obtained from the option dialog) is the distance to spread
+ * the gradient over. It is measured in pixels. If the gradient-length
+ * is 0, no gradient is used.
*
* Returns: TRUE on success.
- *
- * Since: 2.4
**/
gboolean
-gimp_heal (gint32 drawable_ID,
- gint32 src_drawable_ID,
- gdouble src_x,
- gdouble src_y,
- gint num_strokes,
- const gdouble *strokes)
+gimp_paintbrush_default (GimpDrawable *drawable,
+ gint num_strokes,
+ const gdouble *strokes)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -598,21 +1478,18 @@ gimp_heal (gint32 drawable_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
- GIMP_TYPE_DRAWABLE_ID, src_drawable_ID,
- G_TYPE_DOUBLE, src_x,
- G_TYPE_DOUBLE, src_y,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_INT, num_strokes,
GIMP_TYPE_FLOAT_ARRAY, NULL,
G_TYPE_NONE);
- gimp_value_set_float_array (gimp_value_array_index (args, 5), strokes, num_strokes);
+ gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-heal",
+ "gimp-paintbrush-default",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-heal",
+ return_vals = gimp_run_procedure_array ("gimp-paintbrush-default",
args);
gimp_value_array_unref (args);
@@ -624,28 +1501,34 @@ gimp_heal (gint32 drawable_ID,
}
/**
- * gimp_heal_default:
+ * _gimp_paintbrush_default: (skip)
* @drawable_ID: The affected drawable.
* @num_strokes: Number of stroke control points (count each coordinate as 2 points).
* @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
*
- * Heal from the source to the dest drawable using the current brush
+ * Paint in the current brush. The fade out parameter and pull colors
+ * from a gradient parameter are set from the paintbrush options
+ * dialog. If this dialog has not been activated then the dialog
+ * defaults will be used.
*
- * This tool heals from the source drawable starting at the specified
- * source coordinates to the dest drawable. This function performs
- * exactly the same as the gimp_heal() function except that the tools
- * arguments are obtained from the healing option dialog. It this
- * dialog has not been activated then the dialogs default values will
- * be used.
+ * This tool is similar to the standard paintbrush. It draws linearly
+ * interpolated lines through the specified stroke coordinates. It
+ * operates on the specified drawable in the foreground color with the
+ * active brush. The 'fade-out' parameter is measured in pixels and
+ * allows the brush stroke to linearly fall off (value obtained from
+ * the option dialog). The pressure is set to the maximum at the
+ * beginning of the stroke. As the distance of the stroke nears the
+ * fade-out value, the pressure will approach zero. The gradient-length
+ * (value obtained from the option dialog) is the distance to spread
+ * the gradient over. It is measured in pixels. If the gradient-length
+ * is 0, no gradient is used.
*
* Returns: TRUE on success.
- *
- * Since: 2.4
**/
gboolean
-gimp_heal_default (gint32 drawable_ID,
- gint num_strokes,
- const gdouble *strokes)
+_gimp_paintbrush_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -661,10 +1544,10 @@ gimp_heal_default (gint32 drawable_ID,
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-heal-default",
+ "gimp-paintbrush-default",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-heal-default",
+ return_vals = gimp_run_procedure_array ("gimp-paintbrush-default",
args);
gimp_value_array_unref (args);
@@ -676,36 +1559,26 @@ gimp_heal_default (gint32 drawable_ID,
}
/**
- * gimp_paintbrush:
- * @drawable_ID: The affected drawable.
- * @fade_out: Fade out parameter.
+ * gimp_pencil:
+ * @drawable: The affected drawable.
* @num_strokes: Number of stroke control points (count each coordinate as 2 points).
* @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
- * @method: The paint method to use.
- * @gradient_length: Length of gradient to draw.
*
- * Paint in the current brush with optional fade out parameter and pull
- * colors from a gradient.
+ * Paint in the current brush without sub-pixel sampling.
*
- * This tool is the standard paintbrush. It draws linearly interpolated
+ * This tool is the standard pencil. It draws linearly interpolated
* lines through the specified stroke coordinates. It operates on the
* specified drawable in the foreground color with the active brush.
- * The 'fade-out' parameter is measured in pixels and allows the brush
- * stroke to linearly fall off. The pressure is set to the maximum at
- * the beginning of the stroke. As the distance of the stroke nears the
- * fade-out value, the pressure will approach zero. The gradient-length
- * is the distance to spread the gradient over. It is measured in
- * pixels. If the gradient-length is 0, no gradient is used.
+ * The brush mask is treated as though it contains only black and white
+ * values. Any value below half is treated as black; any above half, as
+ * white.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_paintbrush (gint32 drawable_ID,
- gdouble fade_out,
- gint num_strokes,
- const gdouble *strokes,
- GimpPaintApplicationMode method,
- gdouble gradient_length)
+gimp_pencil (GimpDrawable *drawable,
+ gint num_strokes,
+ const gdouble *strokes)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -713,21 +1586,18 @@ gimp_paintbrush (gint32 drawable_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
- G_TYPE_DOUBLE, fade_out,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_INT, num_strokes,
GIMP_TYPE_FLOAT_ARRAY, NULL,
- GIMP_TYPE_PAINT_APPLICATION_MODE, method,
- G_TYPE_DOUBLE, gradient_length,
G_TYPE_NONE);
- gimp_value_set_float_array (gimp_value_array_index (args, 3), strokes, num_strokes);
+ gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-paintbrush",
+ "gimp-pencil",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-paintbrush",
+ return_vals = gimp_run_procedure_array ("gimp-pencil",
args);
gimp_value_array_unref (args);
@@ -739,34 +1609,26 @@ gimp_paintbrush (gint32 drawable_ID,
}
/**
- * gimp_paintbrush_default:
+ * _gimp_pencil: (skip)
* @drawable_ID: The affected drawable.
* @num_strokes: Number of stroke control points (count each coordinate as 2 points).
* @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
*
- * Paint in the current brush. The fade out parameter and pull colors
- * from a gradient parameter are set from the paintbrush options
- * dialog. If this dialog has not been activated then the dialog
- * defaults will be used.
+ * Paint in the current brush without sub-pixel sampling.
*
- * This tool is similar to the standard paintbrush. It draws linearly
- * interpolated lines through the specified stroke coordinates. It
- * operates on the specified drawable in the foreground color with the
- * active brush. The 'fade-out' parameter is measured in pixels and
- * allows the brush stroke to linearly fall off (value obtained from
- * the option dialog). The pressure is set to the maximum at the
- * beginning of the stroke. As the distance of the stroke nears the
- * fade-out value, the pressure will approach zero. The gradient-length
- * (value obtained from the option dialog) is the distance to spread
- * the gradient over. It is measured in pixels. If the gradient-length
- * is 0, no gradient is used.
+ * This tool is the standard pencil. It draws linearly interpolated
+ * lines through the specified stroke coordinates. It operates on the
+ * specified drawable in the foreground color with the active brush.
+ * The brush mask is treated as though it contains only black and white
+ * values. Any value below half is treated as black; any above half, as
+ * white.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_paintbrush_default (gint32 drawable_ID,
- gint num_strokes,
- const gdouble *strokes)
+_gimp_pencil (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -782,10 +1644,10 @@ gimp_paintbrush_default (gint32 drawable_ID,
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-paintbrush-default",
+ "gimp-pencil",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-paintbrush-default",
+ return_vals = gimp_run_procedure_array ("gimp-pencil",
args);
gimp_value_array_unref (args);
@@ -797,24 +1659,23 @@ gimp_paintbrush_default (gint32 drawable_ID,
}
/**
- * gimp_pencil:
- * @drawable_ID: The affected drawable.
+ * gimp_smudge:
+ * @drawable: The affected drawable.
+ * @pressure: The pressure of the smudge strokes.
* @num_strokes: Number of stroke control points (count each coordinate as 2 points).
* @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
*
- * Paint in the current brush without sub-pixel sampling.
+ * Smudge image with varying pressure.
*
- * This tool is the standard pencil. It draws linearly interpolated
- * lines through the specified stroke coordinates. It operates on the
- * specified drawable in the foreground color with the active brush.
- * The brush mask is treated as though it contains only black and white
- * values. Any value below half is treated as black; any above half, as
- * white.
+ * This tool simulates a smudge using the current brush. High pressure
+ * results in a greater smudge of paint while low pressure results in a
+ * lesser smudge.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_pencil (gint32 drawable_ID,
+gimp_smudge (GimpDrawable *drawable,
+ gdouble pressure,
gint num_strokes,
const gdouble *strokes)
{
@@ -824,18 +1685,19 @@ gimp_pencil (gint32 drawable_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_DOUBLE, pressure,
G_TYPE_INT, num_strokes,
GIMP_TYPE_FLOAT_ARRAY, NULL,
G_TYPE_NONE);
- gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
+ gimp_value_set_float_array (gimp_value_array_index (args, 3), strokes, num_strokes);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-pencil",
+ "gimp-smudge",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-pencil",
+ return_vals = gimp_run_procedure_array ("gimp-smudge",
args);
gimp_value_array_unref (args);
@@ -847,7 +1709,7 @@ gimp_pencil (gint32 drawable_ID,
}
/**
- * gimp_smudge:
+ * _gimp_smudge: (skip)
* @drawable_ID: The affected drawable.
* @pressure: The pressure of the smudge strokes.
* @num_strokes: Number of stroke control points (count each coordinate as 2 points).
@@ -862,10 +1724,10 @@ gimp_pencil (gint32 drawable_ID,
* Returns: TRUE on success.
**/
gboolean
-gimp_smudge (gint32 drawable_ID,
- gdouble pressure,
- gint num_strokes,
- const gdouble *strokes)
+_gimp_smudge (gint32 drawable_ID,
+ gdouble pressure,
+ gint num_strokes,
+ const gdouble *strokes)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -898,7 +1760,7 @@ gimp_smudge (gint32 drawable_ID,
/**
* gimp_smudge_default:
- * @drawable_ID: The affected drawable.
+ * @drawable: The affected drawable.
* @num_strokes: Number of stroke control points (count each coordinate as 2 points).
* @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
*
@@ -912,7 +1774,7 @@ gimp_smudge (gint32 drawable_ID,
* Returns: TRUE on success.
**/
gboolean
-gimp_smudge_default (gint32 drawable_ID,
+gimp_smudge_default (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes)
{
@@ -921,6 +1783,54 @@ gimp_smudge_default (gint32 drawable_ID,
GimpValueArray *return_vals;
gboolean success = TRUE;
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_INT, num_strokes,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 2), strokes, num_strokes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-smudge-default",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-smudge-default",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_smudge_default: (skip)
+ * @drawable_ID: The affected drawable.
+ * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
+ * @strokes: (array length=num_strokes) (element-type gdouble): Array of stroke coordinates: { s1.x, s1.y,
s2.x, s2.y, ..., sn.x, sn.y }.
+ *
+ * Smudge image with varying pressure.
+ *
+ * This tool simulates a smudge using the current brush. It behaves
+ * exactly the same as gimp_smudge() except that the pressure value is
+ * taken from the smudge tool options or the options default if the
+ * tools option dialog has not been activated.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_smudge_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_DRAWABLE_ID, drawable_ID,
G_TYPE_INT, num_strokes,
diff --git a/libgimp/gimppainttools_pdb.h b/libgimp/gimppainttools_pdb.h
index b2c1d9b17b..ec648c32ae 100644
--- a/libgimp/gimppainttools_pdb.h
+++ b/libgimp/gimppainttools_pdb.h
@@ -32,83 +32,100 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gboolean gimp_airbrush (gint32 drawable_ID,
+
+
+#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+
+gboolean gimp_airbrush (GimpDrawable *drawable,
gdouble pressure,
gint num_strokes,
const gdouble *strokes);
-gboolean gimp_airbrush_default (gint32 drawable_ID,
+gboolean gimp_airbrush_default (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes);
-gboolean gimp_clone (gint32 drawable_ID,
- gint32 src_drawable_ID,
+gboolean gimp_clone (GimpDrawable *drawable,
+ GimpDrawable *src_drawable,
GimpCloneType clone_type,
gdouble src_x,
gdouble src_y,
gint num_strokes,
const gdouble *strokes);
-gboolean gimp_clone_default (gint32 drawable_ID,
+gboolean gimp_clone_default (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes);
-gboolean gimp_convolve (gint32 drawable_ID,
+gboolean gimp_convolve (GimpDrawable *drawable,
gdouble pressure,
GimpConvolveType convolve_type,
gint num_strokes,
const gdouble *strokes);
-gboolean gimp_convolve_default (gint32 drawable_ID,
+gboolean gimp_convolve_default (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes);
-gboolean gimp_dodgeburn (gint32 drawable_ID,
+gboolean gimp_dodgeburn (GimpDrawable *drawable,
gdouble exposure,
GimpDodgeBurnType dodgeburn_type,
GimpTransferMode dodgeburn_mode,
gint num_strokes,
const gdouble *strokes);
-gboolean gimp_dodgeburn_default (gint32 drawable_ID,
+gboolean gimp_dodgeburn_default (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes);
-gboolean gimp_eraser (gint32 drawable_ID,
+gboolean gimp_eraser (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes,
GimpBrushApplicationMode hardness,
GimpPaintApplicationMode method);
-gboolean gimp_eraser_default (gint32 drawable_ID,
+gboolean gimp_eraser_default (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes);
-gboolean gimp_heal (gint32 drawable_ID,
- gint32 src_drawable_ID,
+gboolean gimp_heal (GimpDrawable *drawable,
+ GimpDrawable *src_drawable,
gdouble src_x,
gdouble src_y,
gint num_strokes,
const gdouble *strokes);
-gboolean gimp_heal_default (gint32 drawable_ID,
+gboolean gimp_heal_default (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes);
-gboolean gimp_paintbrush (gint32 drawable_ID,
+gboolean gimp_paintbrush (GimpDrawable *drawable,
gdouble fade_out,
gint num_strokes,
const gdouble *strokes,
GimpPaintApplicationMode method,
gdouble gradient_length);
-gboolean gimp_paintbrush_default (gint32 drawable_ID,
+gboolean gimp_paintbrush_default (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes);
-gboolean gimp_pencil (gint32 drawable_ID,
+gboolean gimp_pencil (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes);
-gboolean gimp_smudge (gint32 drawable_ID,
+gboolean gimp_smudge (GimpDrawable *drawable,
gdouble pressure,
gint num_strokes,
const gdouble *strokes);
-gboolean gimp_smudge_default (gint32 drawable_ID,
+gboolean gimp_smudge_default (GimpDrawable *drawable,
gint num_strokes,
const gdouble *strokes);
-#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
-
-
-
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
+#define gimp_airbrush _gimp_airbrush
+#define gimp_airbrush_default _gimp_airbrush_default
+#define gimp_clone _gimp_clone
+#define gimp_clone_default _gimp_clone_default
+#define gimp_convolve _gimp_convolve
+#define gimp_convolve_default _gimp_convolve_default
+#define gimp_dodgeburn _gimp_dodgeburn
+#define gimp_dodgeburn_default _gimp_dodgeburn_default
+#define gimp_eraser _gimp_eraser
+#define gimp_eraser_default _gimp_eraser_default
+#define gimp_heal _gimp_heal
+#define gimp_heal_default _gimp_heal_default
+#define gimp_paintbrush _gimp_paintbrush
+#define gimp_paintbrush_default _gimp_paintbrush_default
+#define gimp_pencil _gimp_pencil
+#define gimp_smudge _gimp_smudge
+#define gimp_smudge_default _gimp_smudge_default
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@@ -117,7 +134,76 @@ gboolean gimp_smudge_default (gint32 drawable_ID,
* They are not marked internal as a trick to keep the old API alive for now.
*/
-
+gboolean _gimp_airbrush (gint32 drawable_ID,
+ gdouble pressure,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean _gimp_airbrush_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean _gimp_clone (gint32 drawable_ID,
+ gint32 src_drawable_ID,
+ GimpCloneType clone_type,
+ gdouble src_x,
+ gdouble src_y,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean _gimp_clone_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean _gimp_convolve (gint32 drawable_ID,
+ gdouble pressure,
+ GimpConvolveType convolve_type,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean _gimp_convolve_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean _gimp_dodgeburn (gint32 drawable_ID,
+ gdouble exposure,
+ GimpDodgeBurnType dodgeburn_type,
+ GimpTransferMode dodgeburn_mode,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean _gimp_dodgeburn_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean _gimp_eraser (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes,
+ GimpBrushApplicationMode hardness,
+ GimpPaintApplicationMode method);
+gboolean _gimp_eraser_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean _gimp_heal (gint32 drawable_ID,
+ gint32 src_drawable_ID,
+ gdouble src_x,
+ gdouble src_y,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean _gimp_heal_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean _gimp_paintbrush (gint32 drawable_ID,
+ gdouble fade_out,
+ gint num_strokes,
+ const gdouble *strokes,
+ GimpPaintApplicationMode method,
+ gdouble gradient_length);
+gboolean _gimp_paintbrush_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean _gimp_pencil (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean _gimp_smudge (gint32 drawable_ID,
+ gdouble pressure,
+ gint num_strokes,
+ const gdouble *strokes);
+gboolean _gimp_smudge_default (gint32 drawable_ID,
+ gint num_strokes,
+ const gdouble *strokes);
G_END_DECLS
diff --git a/libgimp/gimpselection_pdb.c b/libgimp/gimpselection_pdb.c
index ff61666190..bfdd3e315e 100644
--- a/libgimp/gimpselection_pdb.c
+++ b/libgimp/gimpselection_pdb.c
@@ -444,6 +444,56 @@ _gimp_selection_translate (gint32 image_ID,
/**
* _gimp_selection_float:
+ * @drawable: The drawable from which to float selection.
+ * @offx: x offset for translation.
+ * @offy: y offset for translation.
+ *
+ * Float the selection from the specified drawable with initial offsets
+ * as specified.
+ *
+ * This procedure determines the region of the specified drawable that
+ * lies beneath the current selection. The region is then cut from the
+ * drawable and the resulting data is made into a new layer which is
+ * instantiated as a floating selection. The offsets allow initial
+ * positioning of the new floating selection.
+ *
+ * Returns: (transfer full): The floated layer.
+ **/
+GimpLayer *
+_gimp_selection_float (GimpDrawable *drawable,
+ gint offx,
+ gint offy)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpLayer *layer = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
+ G_TYPE_INT, offx,
+ G_TYPE_INT, offy,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-selection-float",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-selection-float",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals,
1))));
+
+ gimp_value_array_unref (return_vals);
+
+ return layer;
+}
+
+/**
+ * __gimp_selection_float: (skip)
* @drawable_ID: The drawable from which to float selection.
* @offx: x offset for translation.
* @offy: y offset for translation.
@@ -460,9 +510,9 @@ _gimp_selection_translate (gint32 image_ID,
* Returns: The floated layer.
**/
gint32
-_gimp_selection_float (gint32 drawable_ID,
- gint offx,
- gint offy)
+__gimp_selection_float (gint32 drawable_ID,
+ gint offx,
+ gint offy)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
diff --git a/libgimp/gimpselection_pdb.h b/libgimp/gimpselection_pdb.h
index 387952d365..62e190e295 100644
--- a/libgimp/gimpselection_pdb.h
+++ b/libgimp/gimpselection_pdb.h
@@ -32,39 +32,40 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-G_GNUC_INTERNAL gint32 _gimp_selection_float (gint32 drawable_ID,
- gint offx,
- gint offy);
+
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
-gboolean gimp_selection_bounds (GimpImage *image,
- gboolean *non_empty,
- gint *x1,
- gint *y1,
- gint *x2,
- gint *y2);
-gint gimp_selection_value (GimpImage *image,
- gint x,
- gint y);
-gboolean gimp_selection_is_empty (GimpImage *image);
-gboolean gimp_selection_translate (GimpImage *image,
- gint offx,
- gint offy);
-gboolean gimp_selection_invert (GimpImage *image);
-gboolean gimp_selection_sharpen (GimpImage *image);
-gboolean gimp_selection_all (GimpImage *image);
-gboolean gimp_selection_none (GimpImage *image);
-gboolean gimp_selection_feather (GimpImage *image,
- gdouble radius);
-gboolean gimp_selection_border (GimpImage *image,
- gint radius);
-gboolean gimp_selection_grow (GimpImage *image,
- gint steps);
-gboolean gimp_selection_shrink (GimpImage *image,
- gint steps);
-gboolean gimp_selection_flood (GimpImage *image);
-gint32 gimp_selection_save (GimpImage *image);
+gboolean gimp_selection_bounds (GimpImage *image,
+ gboolean *non_empty,
+ gint *x1,
+ gint *y1,
+ gint *x2,
+ gint *y2);
+gint gimp_selection_value (GimpImage *image,
+ gint x,
+ gint y);
+gboolean gimp_selection_is_empty (GimpImage *image);
+gboolean gimp_selection_translate (GimpImage *image,
+ gint offx,
+ gint offy);
+G_GNUC_INTERNAL GimpLayer* _gimp_selection_float (GimpDrawable *drawable,
+ gint offx,
+ gint offy);
+gboolean gimp_selection_invert (GimpImage *image);
+gboolean gimp_selection_sharpen (GimpImage *image);
+gboolean gimp_selection_all (GimpImage *image);
+gboolean gimp_selection_none (GimpImage *image);
+gboolean gimp_selection_feather (GimpImage *image,
+ gdouble radius);
+gboolean gimp_selection_border (GimpImage *image,
+ gint radius);
+gboolean gimp_selection_grow (GimpImage *image,
+ gint steps);
+gboolean gimp_selection_shrink (GimpImage *image,
+ gint steps);
+gboolean gimp_selection_flood (GimpImage *image);
+gint32 gimp_selection_save (GimpImage *image);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
@@ -72,6 +73,7 @@ gint32 gimp_selection_save (GimpImage *image);
#define gimp_selection_value _gimp_selection_value
#define gimp_selection_is_empty _gimp_selection_is_empty
#define gimp_selection_translate _gimp_selection_translate
+#define _gimp_selection_float __gimp_selection_float
#define gimp_selection_invert _gimp_selection_invert
#define gimp_selection_sharpen _gimp_selection_sharpen
#define gimp_selection_all _gimp_selection_all
@@ -103,6 +105,9 @@ gboolean _gimp_selection_is_empty (gint32 image_ID);
gboolean _gimp_selection_translate (gint32 image_ID,
gint offx,
gint offy);
+gint32 __gimp_selection_float (gint32 drawable_ID,
+ gint offx,
+ gint offy);
gboolean _gimp_selection_invert (gint32 image_ID);
gboolean _gimp_selection_sharpen (gint32 image_ID);
gboolean _gimp_selection_all (gint32 image_ID);
diff --git a/libgimp/gimptextlayer_pdb.c b/libgimp/gimptextlayer_pdb.c
index c2082de921..098b6db778 100644
--- a/libgimp/gimptextlayer_pdb.c
+++ b/libgimp/gimptextlayer_pdb.c
@@ -51,11 +51,11 @@
* added to the image, as this is not automatic. Add the new layer
* using gimp_image_insert_layer().
*
- * Returns: The new text layer.
+ * Returns: (transfer full): The new text layer.
*
* Since: 2.6
**/
-gint32
+GimpLayer *
gimp_text_layer_new (GimpImage *image,
const gchar *text,
const gchar *fontname,
@@ -65,7 +65,7 @@ gimp_text_layer_new (GimpImage *image,
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 layer_ID = -1;
+ GimpLayer *layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@@ -85,11 +85,11 @@ gimp_text_layer_new (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
+ layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index (return_vals,
1))));
gimp_value_array_unref (return_vals);
- return layer_ID;
+ return layer;
}
/**
@@ -152,7 +152,7 @@ _gimp_text_layer_new (gint32 image_ID,
/**
* gimp_text_layer_get_text:
- * @layer_ID: The text layer.
+ * @layer: The text layer.
*
* Get the text from a text layer as string.
*
@@ -164,7 +164,49 @@ _gimp_text_layer_new (gint32 image_ID,
* Since: 2.6
**/
gchar *
-gimp_text_layer_get_text (gint32 layer_ID)
+gimp_text_layer_get_text (GimpLayer *layer)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *text = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-get-text",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-text",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ text = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return text;
+}
+
+/**
+ * _gimp_text_layer_get_text: (skip)
+ * @layer_ID: The text layer.
+ *
+ * Get the text from a text layer as string.
+ *
+ * This procedure returns the text from a text layer as a string.
+ *
+ * Returns: The text from the specified text layer.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.6
+ **/
+gchar *
+_gimp_text_layer_get_text (gint32 layer_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -194,7 +236,7 @@ gimp_text_layer_get_text (gint32 layer_ID)
/**
* gimp_text_layer_set_text:
- * @layer_ID: The text layer.
+ * @layer: The text layer.
* @text: The new text to set.
*
* Set the text of a text layer.
@@ -206,7 +248,7 @@ gimp_text_layer_get_text (gint32 layer_ID)
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_text (gint32 layer_ID,
+gimp_text_layer_set_text (GimpLayer *layer,
const gchar *text)
{
GimpPDB *pdb = gimp_get_pdb ();
@@ -214,6 +256,49 @@ gimp_text_layer_set_text (gint32 layer_ID,
GimpValueArray *return_vals;
gboolean success = TRUE;
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_STRING, text,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-set-text",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-text",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_text_layer_set_text: (skip)
+ * @layer_ID: The text layer.
+ * @text: The new text to set.
+ *
+ * Set the text of a text layer.
+ *
+ * This procedure changes the text of a text layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+_gimp_text_layer_set_text (gint32 layer_ID,
+ const gchar *text)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
G_TYPE_STRING, text,
@@ -237,7 +322,7 @@ gimp_text_layer_set_text (gint32 layer_ID,
/**
* gimp_text_layer_get_markup:
- * @layer_ID: The text layer.
+ * @layer: The text layer.
*
* Get the markup from a text layer as string.
*
@@ -254,7 +339,7 @@ gimp_text_layer_set_text (gint32 layer_ID,
* Since: 2.8
**/
gchar *
-gimp_text_layer_get_markup (gint32 layer_ID)
+gimp_text_layer_get_markup (GimpLayer *layer)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -262,7 +347,7 @@ gimp_text_layer_get_markup (gint32 layer_ID)
gchar *markup = NULL;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
G_TYPE_NONE);
if (pdb)
@@ -283,26 +368,29 @@ gimp_text_layer_get_markup (gint32 layer_ID)
}
/**
- * gimp_text_layer_get_font:
+ * _gimp_text_layer_get_markup: (skip)
* @layer_ID: The text layer.
*
- * Get the font from a text layer as string.
+ * Get the markup from a text layer as string.
*
- * This procedure returns the name of the font from a text layer.
+ * This procedure returns the markup of the styles from a text layer.
+ * The markup will be in the form of Pango's markup - See
+ * https://www.pango.org/ for more information about Pango and its
+ * markup. Note: Setting the markup of a text layer using Pango's
+ * markup is not supported for now.
*
- * Returns: (transfer full):
- * The font which is used in the specified text layer.
+ * Returns: The markup which represents the style of the specified text layer.
* The returned value must be freed with g_free().
*
- * Since: 2.6
+ * Since: 2.8
**/
gchar *
-gimp_text_layer_get_font (gint32 layer_ID)
+_gimp_text_layer_get_markup (gint32 layer_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gchar *font = NULL;
+ gchar *markup = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
@@ -310,87 +398,84 @@ gimp_text_layer_get_font (gint32 layer_ID)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-get-font",
+ "gimp-text-layer-get-markup",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-get-font",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-markup",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- font = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+ markup = g_value_dup_string (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return font;
+ return markup;
}
/**
- * gimp_text_layer_set_font:
- * @layer_ID: The text layer.
- * @font: The new font to use.
+ * gimp_text_layer_get_font:
+ * @layer: The text layer.
*
- * Set the font of a text layer.
+ * Get the font from a text layer as string.
*
- * This procedure modifies the font used in the specified text layer.
+ * This procedure returns the name of the font from a text layer.
*
- * Returns: TRUE on success.
+ * Returns: (transfer full):
+ * The font which is used in the specified text layer.
+ * The returned value must be freed with g_free().
*
* Since: 2.6
**/
-gboolean
-gimp_text_layer_set_font (gint32 layer_ID,
- const gchar *font)
+gchar *
+gimp_text_layer_get_font (GimpLayer *layer)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ gchar *font = NULL;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
- G_TYPE_STRING, font,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-set-font",
+ "gimp-text-layer-get-font",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-set-font",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-font",
args);
gimp_value_array_unref (args);
- success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ font = g_value_dup_string (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return font;
}
/**
- * gimp_text_layer_get_font_size:
+ * _gimp_text_layer_get_font: (skip)
* @layer_ID: The text layer.
- * @unit: (out) (transfer none): The unit used for the font size.
*
- * Get the font size from a text layer.
+ * Get the font from a text layer as string.
*
- * This procedure returns the size of the font which is used in a text
- * layer. You will receive the size as a float 'font-size' in 'unit'
- * units.
+ * This procedure returns the name of the font from a text layer.
*
- * Returns: The font size.
+ * Returns: The font which is used in the specified text layer.
+ * The returned value must be freed with g_free().
*
* Since: 2.6
**/
-gdouble
-gimp_text_layer_get_font_size (gint32 layer_ID,
- GimpUnit *unit)
+gchar *
+_gimp_text_layer_get_font (gint32 layer_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gdouble font_size = 0.0;
+ gchar *font = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
@@ -398,43 +483,37 @@ gimp_text_layer_get_font_size (gint32 layer_ID,
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-get-font-size",
+ "gimp-text-layer-get-font",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-get-font-size",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-font",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- {
- font_size = g_value_get_double (gimp_value_array_index (return_vals, 1));
- *unit = g_value_get_int (gimp_value_array_index (return_vals, 2));
- }
+ font = g_value_dup_string (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return font_size;
+ return font;
}
/**
- * gimp_text_layer_set_font_size:
- * @layer_ID: The text layer.
- * @font_size: The font size.
- * @unit: The unit to use for the font size.
+ * gimp_text_layer_set_font:
+ * @layer: The text layer.
+ * @font: The new font to use.
*
- * Set the font size.
+ * Set the font of a text layer.
*
- * This procedure changes the font size of a text layer. The size of
- * your font will be a double 'font-size' of 'unit' units.
+ * This procedure modifies the font used in the specified text layer.
*
* Returns: TRUE on success.
*
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_font_size (gint32 layer_ID,
- gdouble font_size,
- GimpUnit unit)
+gimp_text_layer_set_font (GimpLayer *layer,
+ const gchar *font)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -442,17 +521,16 @@ gimp_text_layer_set_font_size (gint32 layer_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
- G_TYPE_DOUBLE, font_size,
- GIMP_TYPE_UNIT, unit,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_STRING, font,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-set-font-size",
+ "gimp-text-layer-set-font",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-set-font-size",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-font",
args);
gimp_value_array_unref (args);
@@ -464,112 +542,119 @@ gimp_text_layer_set_font_size (gint32 layer_ID,
}
/**
- * gimp_text_layer_get_antialias:
+ * _gimp_text_layer_set_font: (skip)
* @layer_ID: The text layer.
+ * @font: The new font to use.
*
- * Check if antialiasing is used in the text layer.
+ * Set the font of a text layer.
*
- * This procedure checks if antialiasing is enabled in the specified
- * text layer.
+ * This procedure modifies the font used in the specified text layer.
*
- * Returns: A flag which is true if antialiasing is used for rendering the font in the text layer.
+ * Returns: TRUE on success.
*
* Since: 2.6
**/
gboolean
-gimp_text_layer_get_antialias (gint32 layer_ID)
+_gimp_text_layer_set_font (gint32 layer_ID,
+ const gchar *font)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean antialias = FALSE;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_STRING, font,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-get-antialias",
+ "gimp-text-layer-set-font",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-get-antialias",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-font",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- antialias = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return antialias;
+ return success;
}
/**
- * gimp_text_layer_set_antialias:
- * @layer_ID: The text layer.
- * @antialias: Enable/disable antialiasing of the text.
+ * gimp_text_layer_get_font_size:
+ * @layer: The text layer.
+ * @unit: (out) (transfer none): The unit used for the font size.
*
- * Enable/disable anti-aliasing in a text layer.
+ * Get the font size from a text layer.
*
- * This procedure enables or disables anti-aliasing of the text in a
- * text layer.
+ * This procedure returns the size of the font which is used in a text
+ * layer. You will receive the size as a float 'font-size' in 'unit'
+ * units.
*
- * Returns: TRUE on success.
+ * Returns: The font size.
*
* Since: 2.6
**/
-gboolean
-gimp_text_layer_set_antialias (gint32 layer_ID,
- gboolean antialias)
+gdouble
+gimp_text_layer_get_font_size (GimpLayer *layer,
+ GimpUnit *unit)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ gdouble font_size = 0.0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
- G_TYPE_BOOLEAN, antialias,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-set-antialias",
+ "gimp-text-layer-get-font-size",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-set-antialias",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-font-size",
args);
gimp_value_array_unref (args);
- success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ {
+ font_size = g_value_get_double (gimp_value_array_index (return_vals, 1));
+ *unit = g_value_get_int (gimp_value_array_index (return_vals, 2));
+ }
gimp_value_array_unref (return_vals);
- return success;
+ return font_size;
}
/**
- * gimp_text_layer_get_hint_style:
+ * _gimp_text_layer_get_font_size: (skip)
* @layer_ID: The text layer.
+ * @unit: (out): The unit used for the font size.
*
- * Get information about hinting in the specified text layer.
+ * Get the font size from a text layer.
*
- * This procedure provides information about the hinting that is being
- * used in a text layer. Hinting can be optimized for fidelity or
- * contrast or it can be turned entirely off.
+ * This procedure returns the size of the font which is used in a text
+ * layer. You will receive the size as a float 'font-size' in 'unit'
+ * units.
*
- * Returns: The hint style used for font outlines.
+ * Returns: The font size.
*
- * Since: 2.8
+ * Since: 2.6
**/
-GimpTextHintStyle
-gimp_text_layer_get_hint_style (gint32 layer_ID)
+gdouble
+_gimp_text_layer_get_font_size (gint32 layer_ID,
+ GimpUnit *unit)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- GimpTextHintStyle style = 0;
+ gdouble font_size = 0.0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
@@ -577,10 +662,322 @@ gimp_text_layer_get_hint_style (gint32 layer_ID)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-get-hint-style",
+ "gimp-text-layer-get-font-size",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-get-hint-style",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-font-size",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ {
+ font_size = g_value_get_double (gimp_value_array_index (return_vals, 1));
+ *unit = g_value_get_int (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return font_size;
+}
+
+/**
+ * gimp_text_layer_set_font_size:
+ * @layer: The text layer.
+ * @font_size: The font size.
+ * @unit: The unit to use for the font size.
+ *
+ * Set the font size.
+ *
+ * This procedure changes the font size of a text layer. The size of
+ * your font will be a double 'font-size' of 'unit' units.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_font_size (GimpLayer *layer,
+ gdouble font_size,
+ GimpUnit unit)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_DOUBLE, font_size,
+ GIMP_TYPE_UNIT, unit,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-set-font-size",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-font-size",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_text_layer_set_font_size: (skip)
+ * @layer_ID: The text layer.
+ * @font_size: The font size.
+ * @unit: The unit to use for the font size.
+ *
+ * Set the font size.
+ *
+ * This procedure changes the font size of a text layer. The size of
+ * your font will be a double 'font-size' of 'unit' units.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+_gimp_text_layer_set_font_size (gint32 layer_ID,
+ gdouble font_size,
+ GimpUnit unit)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_DOUBLE, font_size,
+ GIMP_TYPE_UNIT, unit,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-set-font-size",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-font-size",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_antialias:
+ * @layer: The text layer.
+ *
+ * Check if antialiasing is used in the text layer.
+ *
+ * This procedure checks if antialiasing is enabled in the specified
+ * text layer.
+ *
+ * Returns: A flag which is true if antialiasing is used for rendering the font in the text layer.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_get_antialias (GimpLayer *layer)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean antialias = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-get-antialias",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-antialias",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ antialias = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return antialias;
+}
+
+/**
+ * _gimp_text_layer_get_antialias: (skip)
+ * @layer_ID: The text layer.
+ *
+ * Check if antialiasing is used in the text layer.
+ *
+ * This procedure checks if antialiasing is enabled in the specified
+ * text layer.
+ *
+ * Returns: A flag which is true if antialiasing is used for rendering the font in the text layer.
+ *
+ * Since: 2.6
+ **/
+gboolean
+_gimp_text_layer_get_antialias (gint32 layer_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean antialias = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-get-antialias",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-antialias",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ antialias = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return antialias;
+}
+
+/**
+ * gimp_text_layer_set_antialias:
+ * @layer: The text layer.
+ * @antialias: Enable/disable antialiasing of the text.
+ *
+ * Enable/disable anti-aliasing in a text layer.
+ *
+ * This procedure enables or disables anti-aliasing of the text in a
+ * text layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_antialias (GimpLayer *layer,
+ gboolean antialias)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_BOOLEAN, antialias,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-set-antialias",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-antialias",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_text_layer_set_antialias: (skip)
+ * @layer_ID: The text layer.
+ * @antialias: Enable/disable antialiasing of the text.
+ *
+ * Enable/disable anti-aliasing in a text layer.
+ *
+ * This procedure enables or disables anti-aliasing of the text in a
+ * text layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+_gimp_text_layer_set_antialias (gint32 layer_ID,
+ gboolean antialias)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_BOOLEAN, antialias,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-set-antialias",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-antialias",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_hint_style:
+ * @layer: The text layer.
+ *
+ * Get information about hinting in the specified text layer.
+ *
+ * This procedure provides information about the hinting that is being
+ * used in a text layer. Hinting can be optimized for fidelity or
+ * contrast or it can be turned entirely off.
+ *
+ * Returns: The hint style used for font outlines.
+ *
+ * Since: 2.8
+ **/
+GimpTextHintStyle
+gimp_text_layer_get_hint_style (GimpLayer *layer)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpTextHintStyle style = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-get-hint-style",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-hint-style",
args);
gimp_value_array_unref (args);
@@ -589,27 +986,759 @@ gimp_text_layer_get_hint_style (gint32 layer_ID)
gimp_value_array_unref (return_vals);
- return style;
+ return style;
+}
+
+/**
+ * _gimp_text_layer_get_hint_style: (skip)
+ * @layer_ID: The text layer.
+ *
+ * Get information about hinting in the specified text layer.
+ *
+ * This procedure provides information about the hinting that is being
+ * used in a text layer. Hinting can be optimized for fidelity or
+ * contrast or it can be turned entirely off.
+ *
+ * Returns: The hint style used for font outlines.
+ *
+ * Since: 2.8
+ **/
+GimpTextHintStyle
+_gimp_text_layer_get_hint_style (gint32 layer_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpTextHintStyle style = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-get-hint-style",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-hint-style",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ style = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return style;
+}
+
+/**
+ * gimp_text_layer_set_hint_style:
+ * @layer: The text layer.
+ * @style: The new hint style.
+ *
+ * Control how font outlines are hinted in a text layer.
+ *
+ * This procedure sets the hint style for font outlines in a text
+ * layer. This controls whether to fit font outlines to the pixel grid,
+ * and if so, whether to optimize for fidelity or contrast.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+gimp_text_layer_set_hint_style (GimpLayer *layer,
+ GimpTextHintStyle style)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ GIMP_TYPE_TEXT_HINT_STYLE, style,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-set-hint-style",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-hint-style",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_text_layer_set_hint_style: (skip)
+ * @layer_ID: The text layer.
+ * @style: The new hint style.
+ *
+ * Control how font outlines are hinted in a text layer.
+ *
+ * This procedure sets the hint style for font outlines in a text
+ * layer. This controls whether to fit font outlines to the pixel grid,
+ * and if so, whether to optimize for fidelity or contrast.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+_gimp_text_layer_set_hint_style (gint32 layer_ID,
+ GimpTextHintStyle style)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_TEXT_HINT_STYLE, style,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-set-hint-style",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-hint-style",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_kerning:
+ * @layer: The text layer.
+ *
+ * Check if kerning is used in the text layer.
+ *
+ * This procedure checks if kerning is enabled in the specified text
+ * layer.
+ *
+ * Returns: A flag which is true if kerning is used in the text layer.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_get_kerning (GimpLayer *layer)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean kerning = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-get-kerning",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-kerning",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ kerning = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return kerning;
+}
+
+/**
+ * _gimp_text_layer_get_kerning: (skip)
+ * @layer_ID: The text layer.
+ *
+ * Check if kerning is used in the text layer.
+ *
+ * This procedure checks if kerning is enabled in the specified text
+ * layer.
+ *
+ * Returns: A flag which is true if kerning is used in the text layer.
+ *
+ * Since: 2.6
+ **/
+gboolean
+_gimp_text_layer_get_kerning (gint32 layer_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean kerning = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-get-kerning",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-kerning",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ kerning = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return kerning;
+}
+
+/**
+ * gimp_text_layer_set_kerning:
+ * @layer: The text layer.
+ * @kerning: Enable/disable kerning in the text.
+ *
+ * Enable/disable kerning in a text layer.
+ *
+ * This procedure enables or disables kerning in a text layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_kerning (GimpLayer *layer,
+ gboolean kerning)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_BOOLEAN, kerning,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-set-kerning",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-kerning",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_text_layer_set_kerning: (skip)
+ * @layer_ID: The text layer.
+ * @kerning: Enable/disable kerning in the text.
+ *
+ * Enable/disable kerning in a text layer.
+ *
+ * This procedure enables or disables kerning in a text layer.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+_gimp_text_layer_set_kerning (gint32 layer_ID,
+ gboolean kerning)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_BOOLEAN, kerning,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-set-kerning",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-kerning",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_language:
+ * @layer: The text layer.
+ *
+ * Get the language used in the text layer.
+ *
+ * This procedure returns the language string which is set for the text
+ * in the text layer.
+ *
+ * Returns: (transfer full): The language used in the text layer.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.6
+ **/
+gchar *
+gimp_text_layer_get_language (GimpLayer *layer)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *language = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-get-language",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-language",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ language = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return language;
+}
+
+/**
+ * _gimp_text_layer_get_language: (skip)
+ * @layer_ID: The text layer.
+ *
+ * Get the language used in the text layer.
+ *
+ * This procedure returns the language string which is set for the text
+ * in the text layer.
+ *
+ * Returns: The language used in the text layer.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.6
+ **/
+gchar *
+_gimp_text_layer_get_language (gint32 layer_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *language = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-get-language",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-language",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ language = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return language;
+}
+
+/**
+ * gimp_text_layer_set_language:
+ * @layer: The text layer.
+ * @language: The new language to use for the text layer.
+ *
+ * Set the language of the text layer.
+ *
+ * This procedure sets the language of the text in text layer. For some
+ * scripts the language has an influence of how the text is rendered.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_language (GimpLayer *layer,
+ const gchar *language)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_STRING, language,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-set-language",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-language",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_text_layer_set_language: (skip)
+ * @layer_ID: The text layer.
+ * @language: The new language to use for the text layer.
+ *
+ * Set the language of the text layer.
+ *
+ * This procedure sets the language of the text in text layer. For some
+ * scripts the language has an influence of how the text is rendered.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+_gimp_text_layer_set_language (gint32 layer_ID,
+ const gchar *language)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_STRING, language,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-set-language",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-language",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_base_direction:
+ * @layer: The text layer.
+ *
+ * Get the base direction used for rendering the text layer.
+ *
+ * This procedure returns the base direction used for rendering the
+ * text in the text layer
+ *
+ * Returns: The based direction used for the text layer.
+ *
+ * Since: 2.6
+ **/
+GimpTextDirection
+gimp_text_layer_get_base_direction (GimpLayer *layer)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpTextDirection direction = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-get-base-direction",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-base-direction",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ direction = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return direction;
+}
+
+/**
+ * _gimp_text_layer_get_base_direction: (skip)
+ * @layer_ID: The text layer.
+ *
+ * Get the base direction used for rendering the text layer.
+ *
+ * This procedure returns the base direction used for rendering the
+ * text in the text layer
+ *
+ * Returns: The based direction used for the text layer.
+ *
+ * Since: 2.6
+ **/
+GimpTextDirection
+_gimp_text_layer_get_base_direction (gint32 layer_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpTextDirection direction = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-get-base-direction",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-base-direction",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ direction = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return direction;
+}
+
+/**
+ * gimp_text_layer_set_base_direction:
+ * @layer: The text layer.
+ * @direction: The base direction of the text.
+ *
+ * Set the base direction in the text layer.
+ *
+ * This procedure sets the base direction used in applying the Unicode
+ * bidirectional algorithm when rendering the text.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_base_direction (GimpLayer *layer,
+ GimpTextDirection direction)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ GIMP_TYPE_TEXT_DIRECTION, direction,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-set-base-direction",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-base-direction",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_text_layer_set_base_direction: (skip)
+ * @layer_ID: The text layer.
+ * @direction: The base direction of the text.
+ *
+ * Set the base direction in the text layer.
+ *
+ * This procedure sets the base direction used in applying the Unicode
+ * bidirectional algorithm when rendering the text.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+_gimp_text_layer_set_base_direction (gint32 layer_ID,
+ GimpTextDirection direction)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_TEXT_DIRECTION, direction,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-set-base-direction",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-base-direction",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_text_layer_get_justification:
+ * @layer: The text layer.
+ *
+ * Get the text justification information of the text layer.
+ *
+ * This procedure returns the alignment of the lines in the text layer
+ * relative to each other.
+ *
+ * Returns: The justification used in the text layer.
+ *
+ * Since: 2.6
+ **/
+GimpTextJustification
+gimp_text_layer_get_justification (GimpLayer *layer)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpTextJustification justify = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-get-justification",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-justification",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ justify = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return justify;
}
/**
- * gimp_text_layer_set_hint_style:
+ * _gimp_text_layer_get_justification: (skip)
* @layer_ID: The text layer.
- * @style: The new hint style.
*
- * Control how font outlines are hinted in a text layer.
+ * Get the text justification information of the text layer.
*
- * This procedure sets the hint style for font outlines in a text
- * layer. This controls whether to fit font outlines to the pixel grid,
- * and if so, whether to optimize for fidelity or contrast.
+ * This procedure returns the alignment of the lines in the text layer
+ * relative to each other.
+ *
+ * Returns: The justification used in the text layer.
+ *
+ * Since: 2.6
+ **/
+GimpTextJustification
+_gimp_text_layer_get_justification (gint32 layer_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpTextJustification justify = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-get-justification",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-justification",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ justify = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return justify;
+}
+
+/**
+ * gimp_text_layer_set_justification:
+ * @layer: The text layer.
+ * @justify: The justification for your text.
+ *
+ * Set the justification of the text in a text layer.
+ *
+ * This procedure sets the alignment of the lines in the text layer
+ * relative to each other.
*
* Returns: TRUE on success.
*
- * Since: 2.8
+ * Since: 2.6
**/
gboolean
-gimp_text_layer_set_hint_style (gint32 layer_ID,
- GimpTextHintStyle style)
+gimp_text_layer_set_justification (GimpLayer *layer,
+ GimpTextJustification justify)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -617,16 +1746,16 @@ gimp_text_layer_set_hint_style (gint32 layer_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
- GIMP_TYPE_TEXT_HINT_STYLE, style,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ GIMP_TYPE_TEXT_JUSTIFICATION, justify,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-set-hint-style",
+ "gimp-text-layer-set-justification",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-set-hint-style",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-justification",
args);
gimp_value_array_unref (args);
@@ -638,63 +1767,65 @@ gimp_text_layer_set_hint_style (gint32 layer_ID,
}
/**
- * gimp_text_layer_get_kerning:
+ * _gimp_text_layer_set_justification: (skip)
* @layer_ID: The text layer.
+ * @justify: The justification for your text.
*
- * Check if kerning is used in the text layer.
+ * Set the justification of the text in a text layer.
*
- * This procedure checks if kerning is enabled in the specified text
- * layer.
+ * This procedure sets the alignment of the lines in the text layer
+ * relative to each other.
*
- * Returns: A flag which is true if kerning is used in the text layer.
+ * Returns: TRUE on success.
*
* Since: 2.6
**/
gboolean
-gimp_text_layer_get_kerning (gint32 layer_ID)
+_gimp_text_layer_set_justification (gint32 layer_ID,
+ GimpTextJustification justify)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean kerning = FALSE;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_TEXT_JUSTIFICATION, justify,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-get-kerning",
+ "gimp-text-layer-set-justification",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-get-kerning",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-justification",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- kerning = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return kerning;
+ return success;
}
/**
- * gimp_text_layer_set_kerning:
- * @layer_ID: The text layer.
- * @kerning: Enable/disable kerning in the text.
+ * gimp_text_layer_get_color:
+ * @layer: The text layer.
+ * @color: (out caller-allocates): The color of the text.
*
- * Enable/disable kerning in a text layer.
+ * Get the color of the text in a text layer.
*
- * This procedure enables or disables kerning in a text layer.
+ * This procedure returns the color of the text in a text layer.
*
* Returns: TRUE on success.
*
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_kerning (gint32 layer_ID,
- gboolean kerning)
+gimp_text_layer_get_color (GimpLayer *layer,
+ GimpRGB *color)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -702,47 +1833,49 @@ gimp_text_layer_set_kerning (gint32 layer_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
- G_TYPE_BOOLEAN, kerning,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-set-kerning",
+ "gimp-text-layer-get-color",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-set-kerning",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-color",
args);
gimp_value_array_unref (args);
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+ if (success)
+ gimp_value_get_rgb (gimp_value_array_index (return_vals, 1), &*color);
+
gimp_value_array_unref (return_vals);
return success;
}
/**
- * gimp_text_layer_get_language:
+ * _gimp_text_layer_get_color: (skip)
* @layer_ID: The text layer.
+ * @color: (out caller-allocates): The color of the text.
*
- * Get the language used in the text layer.
+ * Get the color of the text in a text layer.
*
- * This procedure returns the language string which is set for the text
- * in the text layer.
+ * This procedure returns the color of the text in a text layer.
*
- * Returns: (transfer full): The language used in the text layer.
- * The returned value must be freed with g_free().
+ * Returns: TRUE on success.
*
* Since: 2.6
**/
-gchar *
-gimp_text_layer_get_language (gint32 layer_ID)
+gboolean
+_gimp_text_layer_get_color (gint32 layer_ID,
+ GimpRGB *color)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gchar *language = NULL;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
@@ -750,38 +1883,82 @@ gimp_text_layer_get_language (gint32 layer_ID)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-get-language",
+ "gimp-text-layer-get-color",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-get-language",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-color",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- language = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ if (success)
+ gimp_value_get_rgb (gimp_value_array_index (return_vals, 1), &*color);
gimp_value_array_unref (return_vals);
- return language;
+ return success;
}
/**
- * gimp_text_layer_set_language:
+ * gimp_text_layer_set_color:
+ * @layer: The text layer.
+ * @color: The color to use for the text.
+ *
+ * Set the color of the text in the text layer.
+ *
+ * This procedure sets the text color in the text layer 'layer'.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gimp_text_layer_set_color (GimpLayer *layer,
+ const GimpRGB *color)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ GIMP_TYPE_RGB, color,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-set-color",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-color",
+ args);
+ gimp_value_array_unref (args);
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_text_layer_set_color: (skip)
* @layer_ID: The text layer.
- * @language: The new language to use for the text layer.
+ * @color: The color to use for the text.
*
- * Set the language of the text layer.
+ * Set the color of the text in the text layer.
*
- * This procedure sets the language of the text in text layer. For some
- * scripts the language has an influence of how the text is rendered.
+ * This procedure sets the text color in the text layer 'layer'.
*
* Returns: TRUE on success.
*
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_language (gint32 layer_ID,
- const gchar *language)
+_gimp_text_layer_set_color (gint32 layer_ID,
+ const GimpRGB *color)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -790,15 +1967,15 @@ gimp_text_layer_set_language (gint32 layer_ID,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
- G_TYPE_STRING, language,
+ GIMP_TYPE_RGB, color,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-set-language",
+ "gimp-text-layer-set-color",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-set-language",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-color",
args);
gimp_value_array_unref (args);
@@ -810,25 +1987,67 @@ gimp_text_layer_set_language (gint32 layer_ID,
}
/**
- * gimp_text_layer_get_base_direction:
+ * gimp_text_layer_get_indent:
+ * @layer: The text layer.
+ *
+ * Get the line indentation of text layer.
+ *
+ * This procedure returns the indentation of the first line in a text
+ * layer.
+ *
+ * Returns: The indentation value of the first line.
+ *
+ * Since: 2.6
+ **/
+gdouble
+gimp_text_layer_get_indent (GimpLayer *layer)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gdouble indent = 0.0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-get-indent",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-indent",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ indent = g_value_get_double (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return indent;
+}
+
+/**
+ * _gimp_text_layer_get_indent: (skip)
* @layer_ID: The text layer.
*
- * Get the base direction used for rendering the text layer.
+ * Get the line indentation of text layer.
*
- * This procedure returns the base direction used for rendering the
- * text in the text layer
+ * This procedure returns the indentation of the first line in a text
+ * layer.
*
- * Returns: The based direction used for the text layer.
+ * Returns: The indentation value of the first line.
*
* Since: 2.6
**/
-GimpTextDirection
-gimp_text_layer_get_base_direction (gint32 layer_ID)
+gdouble
+_gimp_text_layer_get_indent (gint32 layer_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- GimpTextDirection direction = 0;
+ gdouble indent = 0.0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
@@ -836,38 +2055,38 @@ gimp_text_layer_get_base_direction (gint32 layer_ID)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-get-base-direction",
+ "gimp-text-layer-get-indent",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-get-base-direction",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-indent",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- direction = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+ indent = g_value_get_double (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return direction;
+ return indent;
}
/**
- * gimp_text_layer_set_base_direction:
- * @layer_ID: The text layer.
- * @direction: The base direction of the text.
+ * gimp_text_layer_set_indent:
+ * @layer: The text layer.
+ * @indent: The indentation for the first line.
*
- * Set the base direction in the text layer.
+ * Set the indentation of the first line in a text layer.
*
- * This procedure sets the base direction used in applying the Unicode
- * bidirectional algorithm when rendering the text.
+ * This procedure sets the indentation of the first line in the text
+ * layer.
*
* Returns: TRUE on success.
*
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_base_direction (gint32 layer_ID,
- GimpTextDirection direction)
+gimp_text_layer_set_indent (GimpLayer *layer,
+ gdouble indent)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -875,16 +2094,16 @@ gimp_text_layer_set_base_direction (gint32 layer_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
- GIMP_TYPE_TEXT_DIRECTION, direction,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_DOUBLE, indent,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-set-base-direction",
+ "gimp-text-layer-set-indent",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-set-base-direction",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-indent",
args);
gimp_value_array_unref (args);
@@ -896,112 +2115,111 @@ gimp_text_layer_set_base_direction (gint32 layer_ID,
}
/**
- * gimp_text_layer_get_justification:
+ * _gimp_text_layer_set_indent: (skip)
* @layer_ID: The text layer.
+ * @indent: The indentation for the first line.
*
- * Get the text justification information of the text layer.
+ * Set the indentation of the first line in a text layer.
*
- * This procedure returns the alignment of the lines in the text layer
- * relative to each other.
+ * This procedure sets the indentation of the first line in the text
+ * layer.
*
- * Returns: The justification used in the text layer.
+ * Returns: TRUE on success.
*
* Since: 2.6
**/
-GimpTextJustification
-gimp_text_layer_get_justification (gint32 layer_ID)
+gboolean
+_gimp_text_layer_set_indent (gint32 layer_ID,
+ gdouble indent)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- GimpTextJustification justify = 0;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_DOUBLE, indent,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-get-justification",
+ "gimp-text-layer-set-indent",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-get-justification",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-indent",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- justify = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return justify;
+ return success;
}
/**
- * gimp_text_layer_set_justification:
- * @layer_ID: The text layer.
- * @justify: The justification for your text.
+ * gimp_text_layer_get_line_spacing:
+ * @layer: The text layer.
*
- * Set the justification of the text in a text layer.
+ * Get the spacing between lines of text.
*
- * This procedure sets the alignment of the lines in the text layer
- * relative to each other.
+ * This procedure returns the line-spacing between lines of text in a
+ * text layer.
*
- * Returns: TRUE on success.
+ * Returns: The line-spacing value.
*
* Since: 2.6
**/
-gboolean
-gimp_text_layer_set_justification (gint32 layer_ID,
- GimpTextJustification justify)
+gdouble
+gimp_text_layer_get_line_spacing (GimpLayer *layer)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ gdouble line_spacing = 0.0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
- GIMP_TYPE_TEXT_JUSTIFICATION, justify,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-set-justification",
+ "gimp-text-layer-get-line-spacing",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-set-justification",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-line-spacing",
args);
gimp_value_array_unref (args);
- success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ line_spacing = g_value_get_double (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return line_spacing;
}
/**
- * gimp_text_layer_get_color:
+ * _gimp_text_layer_get_line_spacing: (skip)
* @layer_ID: The text layer.
- * @color: (out caller-allocates): The color of the text.
*
- * Get the color of the text in a text layer.
+ * Get the spacing between lines of text.
*
- * This procedure returns the color of the text in a text layer.
+ * This procedure returns the line-spacing between lines of text in a
+ * text layer.
*
- * Returns: TRUE on success.
+ * Returns: The line-spacing value.
*
* Since: 2.6
**/
-gboolean
-gimp_text_layer_get_color (gint32 layer_ID,
- GimpRGB *color)
+gdouble
+_gimp_text_layer_get_line_spacing (gint32 layer_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ gdouble line_spacing = 0.0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
@@ -1009,39 +2227,38 @@ gimp_text_layer_get_color (gint32 layer_ID,
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-get-color",
+ "gimp-text-layer-get-line-spacing",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-get-color",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-line-spacing",
args);
gimp_value_array_unref (args);
- success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
-
- if (success)
- gimp_value_get_rgb (gimp_value_array_index (return_vals, 1), &*color);
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ line_spacing = g_value_get_double (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return line_spacing;
}
/**
- * gimp_text_layer_set_color:
- * @layer_ID: The text layer.
- * @color: The color to use for the text.
+ * gimp_text_layer_set_line_spacing:
+ * @layer: The text layer.
+ * @line_spacing: The additional line spacing to use.
*
- * Set the color of the text in the text layer.
+ * Adjust the line spacing in a text layer.
*
- * This procedure sets the text color in the text layer 'layer'.
+ * This procedure sets the additional spacing used between lines a text
+ * layer.
*
* Returns: TRUE on success.
*
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_color (gint32 layer_ID,
- const GimpRGB *color)
+gimp_text_layer_set_line_spacing (GimpLayer *layer,
+ gdouble line_spacing)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1049,16 +2266,16 @@ gimp_text_layer_set_color (gint32 layer_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
- GIMP_TYPE_RGB, color,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_DOUBLE, line_spacing,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-set-color",
+ "gimp-text-layer-set-line-spacing",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-set-color",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-line-spacing",
args);
gimp_value_array_unref (args);
@@ -1070,111 +2287,111 @@ gimp_text_layer_set_color (gint32 layer_ID,
}
/**
- * gimp_text_layer_get_indent:
+ * _gimp_text_layer_set_line_spacing: (skip)
* @layer_ID: The text layer.
+ * @line_spacing: The additional line spacing to use.
*
- * Get the line indentation of text layer.
+ * Adjust the line spacing in a text layer.
*
- * This procedure returns the indentation of the first line in a text
+ * This procedure sets the additional spacing used between lines a text
* layer.
*
- * Returns: The indentation value of the first line.
+ * Returns: TRUE on success.
*
* Since: 2.6
**/
-gdouble
-gimp_text_layer_get_indent (gint32 layer_ID)
+gboolean
+_gimp_text_layer_set_line_spacing (gint32 layer_ID,
+ gdouble line_spacing)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gdouble indent = 0.0;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_DOUBLE, line_spacing,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-get-indent",
+ "gimp-text-layer-set-line-spacing",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-get-indent",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-line-spacing",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- indent = g_value_get_double (gimp_value_array_index (return_vals, 1));
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return indent;
+ return success;
}
/**
- * gimp_text_layer_set_indent:
- * @layer_ID: The text layer.
- * @indent: The indentation for the first line.
+ * gimp_text_layer_get_letter_spacing:
+ * @layer: The text layer.
*
- * Set the indentation of the first line in a text layer.
+ * Get the letter spacing used in a text layer.
*
- * This procedure sets the indentation of the first line in the text
- * layer.
+ * This procedure returns the additional spacing between the single
+ * glyphs in a text layer.
*
- * Returns: TRUE on success.
+ * Returns: The letter-spacing value.
*
* Since: 2.6
**/
-gboolean
-gimp_text_layer_set_indent (gint32 layer_ID,
- gdouble indent)
+gdouble
+gimp_text_layer_get_letter_spacing (GimpLayer *layer)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ gdouble letter_spacing = 0.0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
- G_TYPE_DOUBLE, indent,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-set-indent",
+ "gimp-text-layer-get-letter-spacing",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-set-indent",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-letter-spacing",
args);
gimp_value_array_unref (args);
- success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ letter_spacing = g_value_get_double (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return letter_spacing;
}
/**
- * gimp_text_layer_get_line_spacing:
+ * _gimp_text_layer_get_letter_spacing: (skip)
* @layer_ID: The text layer.
*
- * Get the spacing between lines of text.
+ * Get the letter spacing used in a text layer.
*
- * This procedure returns the line-spacing between lines of text in a
- * text layer.
+ * This procedure returns the additional spacing between the single
+ * glyphs in a text layer.
*
- * Returns: The line-spacing value.
+ * Returns: The letter-spacing value.
*
* Since: 2.6
**/
gdouble
-gimp_text_layer_get_line_spacing (gint32 layer_ID)
+_gimp_text_layer_get_letter_spacing (gint32 layer_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gdouble line_spacing = 0.0;
+ gdouble letter_spacing = 0.0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
@@ -1182,38 +2399,38 @@ gimp_text_layer_get_line_spacing (gint32 layer_ID)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-get-line-spacing",
+ "gimp-text-layer-get-letter-spacing",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-get-line-spacing",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-get-letter-spacing",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- line_spacing = g_value_get_double (gimp_value_array_index (return_vals, 1));
+ letter_spacing = g_value_get_double (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return line_spacing;
+ return letter_spacing;
}
/**
- * gimp_text_layer_set_line_spacing:
- * @layer_ID: The text layer.
- * @line_spacing: The additional line spacing to use.
+ * gimp_text_layer_set_letter_spacing:
+ * @layer: The text layer.
+ * @letter_spacing: The additional letter spacing to use.
*
- * Adjust the line spacing in a text layer.
+ * Adjust the letter spacing in a text layer.
*
- * This procedure sets the additional spacing used between lines a text
- * layer.
+ * This procedure sets the additional spacing between the single glyphs
+ * in a text layer.
*
* Returns: TRUE on success.
*
* Since: 2.6
**/
gboolean
-gimp_text_layer_set_line_spacing (gint32 layer_ID,
- gdouble line_spacing)
+gimp_text_layer_set_letter_spacing (GimpLayer *layer,
+ gdouble letter_spacing)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1221,16 +2438,16 @@ gimp_text_layer_set_line_spacing (gint32 layer_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
- G_TYPE_DOUBLE, line_spacing,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_DOUBLE, letter_spacing,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-set-line-spacing",
+ "gimp-text-layer-set-letter-spacing",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-set-line-spacing",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-letter-spacing",
args);
gimp_value_array_unref (args);
@@ -1242,64 +2459,69 @@ gimp_text_layer_set_line_spacing (gint32 layer_ID,
}
/**
- * gimp_text_layer_get_letter_spacing:
+ * _gimp_text_layer_set_letter_spacing: (skip)
* @layer_ID: The text layer.
+ * @letter_spacing: The additional letter spacing to use.
*
- * Get the letter spacing used in a text layer.
+ * Adjust the letter spacing in a text layer.
*
- * This procedure returns the additional spacing between the single
- * glyphs in a text layer.
+ * This procedure sets the additional spacing between the single glyphs
+ * in a text layer.
*
- * Returns: The letter-spacing value.
+ * Returns: TRUE on success.
*
* Since: 2.6
**/
-gdouble
-gimp_text_layer_get_letter_spacing (gint32 layer_ID)
+gboolean
+_gimp_text_layer_set_letter_spacing (gint32 layer_ID,
+ gdouble letter_spacing)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gdouble letter_spacing = 0.0;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_DOUBLE, letter_spacing,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-get-letter-spacing",
+ "gimp-text-layer-set-letter-spacing",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-get-letter-spacing",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-set-letter-spacing",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- letter_spacing = g_value_get_double (gimp_value_array_index (return_vals, 1));
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return letter_spacing;
+ return success;
}
/**
- * gimp_text_layer_set_letter_spacing:
- * @layer_ID: The text layer.
- * @letter_spacing: The additional letter spacing to use.
+ * gimp_text_layer_resize:
+ * @layer: The text layer.
+ * @width: The new box width in pixels.
+ * @height: The new box height in pixels.
*
- * Adjust the letter spacing in a text layer.
+ * Resize the box of a text layer.
*
- * This procedure sets the additional spacing between the single glyphs
- * in a text layer.
+ * This procedure changes the width and height of a text layer while
+ * keeping it as a text layer and not converting it to a bitmap like
+ * gimp_layer_resize() would do.
*
* Returns: TRUE on success.
*
- * Since: 2.6
+ * Since: 2.8
**/
gboolean
-gimp_text_layer_set_letter_spacing (gint32 layer_ID,
- gdouble letter_spacing)
+gimp_text_layer_resize (GimpLayer *layer,
+ gdouble width,
+ gdouble height)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1307,16 +2529,17 @@ gimp_text_layer_set_letter_spacing (gint32 layer_ID,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_LAYER_ID, layer_ID,
- G_TYPE_DOUBLE, letter_spacing,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
+ G_TYPE_DOUBLE, width,
+ G_TYPE_DOUBLE, height,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-text-layer-set-letter-spacing",
+ "gimp-text-layer-resize",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-text-layer-set-letter-spacing",
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-resize",
args);
gimp_value_array_unref (args);
@@ -1328,7 +2551,7 @@ gimp_text_layer_set_letter_spacing (gint32 layer_ID,
}
/**
- * gimp_text_layer_resize:
+ * _gimp_text_layer_resize: (skip)
* @layer_ID: The text layer.
* @width: The new box width in pixels.
* @height: The new box height in pixels.
@@ -1344,9 +2567,9 @@ gimp_text_layer_set_letter_spacing (gint32 layer_ID,
* Since: 2.8
**/
gboolean
-gimp_text_layer_resize (gint32 layer_ID,
- gdouble width,
- gdouble height)
+_gimp_text_layer_resize (gint32 layer_ID,
+ gdouble width,
+ gdouble height)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
diff --git a/libgimp/gimptextlayer_pdb.h b/libgimp/gimptextlayer_pdb.h
index d409cfca1c..eb0c3f56f4 100644
--- a/libgimp/gimptextlayer_pdb.h
+++ b/libgimp/gimptextlayer_pdb.h
@@ -32,64 +32,93 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gchar* gimp_text_layer_get_text (gint32 layer_ID);
-gboolean gimp_text_layer_set_text (gint32 layer_ID,
+
+
+#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
+
+GimpLayer* gimp_text_layer_new (GimpImage *image,
+ const gchar *text,
+ const gchar *fontname,
+ gdouble size,
+ GimpUnit unit);
+gchar* gimp_text_layer_get_text (GimpLayer *layer);
+gboolean gimp_text_layer_set_text (GimpLayer *layer,
const gchar *text);
-gchar* gimp_text_layer_get_markup (gint32 layer_ID);
-gchar* gimp_text_layer_get_font (gint32 layer_ID);
-gboolean gimp_text_layer_set_font (gint32 layer_ID,
+gchar* gimp_text_layer_get_markup (GimpLayer *layer);
+gchar* gimp_text_layer_get_font (GimpLayer *layer);
+gboolean gimp_text_layer_set_font (GimpLayer *layer,
const gchar *font);
-gdouble gimp_text_layer_get_font_size (gint32 layer_ID,
+gdouble gimp_text_layer_get_font_size (GimpLayer *layer,
GimpUnit *unit);
-gboolean gimp_text_layer_set_font_size (gint32 layer_ID,
+gboolean gimp_text_layer_set_font_size (GimpLayer *layer,
gdouble font_size,
GimpUnit unit);
-gboolean gimp_text_layer_get_antialias (gint32 layer_ID);
-gboolean gimp_text_layer_set_antialias (gint32 layer_ID,
+gboolean gimp_text_layer_get_antialias (GimpLayer *layer);
+gboolean gimp_text_layer_set_antialias (GimpLayer *layer,
gboolean antialias);
-GimpTextHintStyle gimp_text_layer_get_hint_style (gint32 layer_ID);
-gboolean gimp_text_layer_set_hint_style (gint32 layer_ID,
+GimpTextHintStyle gimp_text_layer_get_hint_style (GimpLayer *layer);
+gboolean gimp_text_layer_set_hint_style (GimpLayer *layer,
GimpTextHintStyle style);
-gboolean gimp_text_layer_get_kerning (gint32 layer_ID);
-gboolean gimp_text_layer_set_kerning (gint32 layer_ID,
+gboolean gimp_text_layer_get_kerning (GimpLayer *layer);
+gboolean gimp_text_layer_set_kerning (GimpLayer *layer,
gboolean kerning);
-gchar* gimp_text_layer_get_language (gint32 layer_ID);
-gboolean gimp_text_layer_set_language (gint32 layer_ID,
+gchar* gimp_text_layer_get_language (GimpLayer *layer);
+gboolean gimp_text_layer_set_language (GimpLayer *layer,
const gchar *language);
-GimpTextDirection gimp_text_layer_get_base_direction (gint32 layer_ID);
-gboolean gimp_text_layer_set_base_direction (gint32 layer_ID,
+GimpTextDirection gimp_text_layer_get_base_direction (GimpLayer *layer);
+gboolean gimp_text_layer_set_base_direction (GimpLayer *layer,
GimpTextDirection direction);
-GimpTextJustification gimp_text_layer_get_justification (gint32 layer_ID);
-gboolean gimp_text_layer_set_justification (gint32 layer_ID,
+GimpTextJustification gimp_text_layer_get_justification (GimpLayer *layer);
+gboolean gimp_text_layer_set_justification (GimpLayer *layer,
GimpTextJustification justify);
-gboolean gimp_text_layer_get_color (gint32 layer_ID,
+gboolean gimp_text_layer_get_color (GimpLayer *layer,
GimpRGB *color);
-gboolean gimp_text_layer_set_color (gint32 layer_ID,
+gboolean gimp_text_layer_set_color (GimpLayer *layer,
const GimpRGB *color);
-gdouble gimp_text_layer_get_indent (gint32 layer_ID);
-gboolean gimp_text_layer_set_indent (gint32 layer_ID,
+gdouble gimp_text_layer_get_indent (GimpLayer *layer);
+gboolean gimp_text_layer_set_indent (GimpLayer *layer,
gdouble indent);
-gdouble gimp_text_layer_get_line_spacing (gint32 layer_ID);
-gboolean gimp_text_layer_set_line_spacing (gint32 layer_ID,
+gdouble gimp_text_layer_get_line_spacing (GimpLayer *layer);
+gboolean gimp_text_layer_set_line_spacing (GimpLayer *layer,
gdouble line_spacing);
-gdouble gimp_text_layer_get_letter_spacing (gint32 layer_ID);
-gboolean gimp_text_layer_set_letter_spacing (gint32 layer_ID,
+gdouble gimp_text_layer_get_letter_spacing (GimpLayer *layer);
+gboolean gimp_text_layer_set_letter_spacing (GimpLayer *layer,
gdouble letter_spacing);
-gboolean gimp_text_layer_resize (gint32 layer_ID,
+gboolean gimp_text_layer_resize (GimpLayer *layer,
gdouble width,
gdouble height);
-#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
-
-gint32 gimp_text_layer_new (GimpImage *image,
- const gchar *text,
- const gchar *fontname,
- gdouble size,
- GimpUnit unit);
-
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
#define gimp_text_layer_new _gimp_text_layer_new
+#define gimp_text_layer_get_text _gimp_text_layer_get_text
+#define gimp_text_layer_set_text _gimp_text_layer_set_text
+#define gimp_text_layer_get_markup _gimp_text_layer_get_markup
+#define gimp_text_layer_get_font _gimp_text_layer_get_font
+#define gimp_text_layer_set_font _gimp_text_layer_set_font
+#define gimp_text_layer_get_font_size _gimp_text_layer_get_font_size
+#define gimp_text_layer_set_font_size _gimp_text_layer_set_font_size
+#define gimp_text_layer_get_antialias _gimp_text_layer_get_antialias
+#define gimp_text_layer_set_antialias _gimp_text_layer_set_antialias
+#define gimp_text_layer_get_hint_style _gimp_text_layer_get_hint_style
+#define gimp_text_layer_set_hint_style _gimp_text_layer_set_hint_style
+#define gimp_text_layer_get_kerning _gimp_text_layer_get_kerning
+#define gimp_text_layer_set_kerning _gimp_text_layer_set_kerning
+#define gimp_text_layer_get_language _gimp_text_layer_get_language
+#define gimp_text_layer_set_language _gimp_text_layer_set_language
+#define gimp_text_layer_get_base_direction _gimp_text_layer_get_base_direction
+#define gimp_text_layer_set_base_direction _gimp_text_layer_set_base_direction
+#define gimp_text_layer_get_justification _gimp_text_layer_get_justification
+#define gimp_text_layer_set_justification _gimp_text_layer_set_justification
+#define gimp_text_layer_get_color _gimp_text_layer_get_color
+#define gimp_text_layer_set_color _gimp_text_layer_set_color
+#define gimp_text_layer_get_indent _gimp_text_layer_get_indent
+#define gimp_text_layer_set_indent _gimp_text_layer_set_indent
+#define gimp_text_layer_get_line_spacing _gimp_text_layer_get_line_spacing
+#define gimp_text_layer_set_line_spacing _gimp_text_layer_set_line_spacing
+#define gimp_text_layer_get_letter_spacing _gimp_text_layer_get_letter_spacing
+#define gimp_text_layer_set_letter_spacing _gimp_text_layer_set_letter_spacing
+#define gimp_text_layer_resize _gimp_text_layer_resize
#endif /* GIMP_DEPRECATED_REPLACE_NEW_API */
@@ -98,11 +127,57 @@ gint32 gimp_text_layer_new (GimpImage *image,
* They are not marked internal as a trick to keep the old API alive for now.
*/
-gint32 _gimp_text_layer_new (gint32 image_ID,
- const gchar *text,
- const gchar *fontname,
- gdouble size,
- GimpUnit unit);
+gint32 _gimp_text_layer_new (gint32 image_ID,
+ const gchar *text,
+ const gchar *fontname,
+ gdouble size,
+ GimpUnit unit);
+gchar* _gimp_text_layer_get_text (gint32 layer_ID);
+gboolean _gimp_text_layer_set_text (gint32 layer_ID,
+ const gchar *text);
+gchar* _gimp_text_layer_get_markup (gint32 layer_ID);
+gchar* _gimp_text_layer_get_font (gint32 layer_ID);
+gboolean _gimp_text_layer_set_font (gint32 layer_ID,
+ const gchar *font);
+gdouble _gimp_text_layer_get_font_size (gint32 layer_ID,
+ GimpUnit *unit);
+gboolean _gimp_text_layer_set_font_size (gint32 layer_ID,
+ gdouble font_size,
+ GimpUnit unit);
+gboolean _gimp_text_layer_get_antialias (gint32 layer_ID);
+gboolean _gimp_text_layer_set_antialias (gint32 layer_ID,
+ gboolean antialias);
+GimpTextHintStyle _gimp_text_layer_get_hint_style (gint32 layer_ID);
+gboolean _gimp_text_layer_set_hint_style (gint32 layer_ID,
+ GimpTextHintStyle style);
+gboolean _gimp_text_layer_get_kerning (gint32 layer_ID);
+gboolean _gimp_text_layer_set_kerning (gint32 layer_ID,
+ gboolean kerning);
+gchar* _gimp_text_layer_get_language (gint32 layer_ID);
+gboolean _gimp_text_layer_set_language (gint32 layer_ID,
+ const gchar *language);
+GimpTextDirection _gimp_text_layer_get_base_direction (gint32 layer_ID);
+gboolean _gimp_text_layer_set_base_direction (gint32 layer_ID,
+ GimpTextDirection direction);
+GimpTextJustification _gimp_text_layer_get_justification (gint32 layer_ID);
+gboolean _gimp_text_layer_set_justification (gint32 layer_ID,
+ GimpTextJustification justify);
+gboolean _gimp_text_layer_get_color (gint32 layer_ID,
+ GimpRGB *color);
+gboolean _gimp_text_layer_set_color (gint32 layer_ID,
+ const GimpRGB *color);
+gdouble _gimp_text_layer_get_indent (gint32 layer_ID);
+gboolean _gimp_text_layer_set_indent (gint32 layer_ID,
+ gdouble indent);
+gdouble _gimp_text_layer_get_line_spacing (gint32 layer_ID);
+gboolean _gimp_text_layer_set_line_spacing (gint32 layer_ID,
+ gdouble line_spacing);
+gdouble _gimp_text_layer_get_letter_spacing (gint32 layer_ID);
+gboolean _gimp_text_layer_set_letter_spacing (gint32 layer_ID,
+ gdouble letter_spacing);
+gboolean _gimp_text_layer_resize (gint32 layer_ID,
+ gdouble width,
+ gdouble height);
G_END_DECLS
diff --git a/libgimp/gimptexttool_pdb.c b/libgimp/gimptexttool_pdb.c
index 8777c5937c..34fd711e6c 100644
--- a/libgimp/gimptexttool_pdb.c
+++ b/libgimp/gimptexttool_pdb.c
@@ -37,7 +37,7 @@
/**
* gimp_text_fontname:
* @image: The image.
- * @drawable_ID: The affected drawable: (-1 for a new text layer).
+ * @drawable: The affected drawable: (-1 for a new text layer).
* @x: The x coordinate for the left of the text bounding box.
* @y: The y coordinate for the top of the text bounding box.
* @text: The text to generate (in UTF-8 encoding).
@@ -64,11 +64,11 @@
* divide the size in points by 72.0 and multiply it by the image's
* vertical resolution.
*
- * Returns: The new text layer or -1 if no layer was created.
+ * Returns: (transfer full): The new text layer or -1 if no layer was created.
**/
-gint32
+GimpLayer *
gimp_text_fontname (GimpImage *image,
- gint32 drawable_ID,
+ GimpDrawable *drawable,
gdouble x,
gdouble y,
const gchar *text,
@@ -81,11 +81,11 @@ gimp_text_fontname (GimpImage *image,
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 text_layer_ID = -1;
+ GimpLayer *text_layer = NULL;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_DRAWABLE_ID, gimp_item_get_id (GIMP_ITEM (drawable)),
G_TYPE_DOUBLE, x,
G_TYPE_DOUBLE, y,
G_TYPE_STRING, text,
@@ -106,11 +106,11 @@ gimp_text_fontname (GimpImage *image,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- text_layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
+ text_layer = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id (gimp_value_array_index
(return_vals, 1))));
gimp_value_array_unref (return_vals);
- return text_layer_ID;
+ return text_layer;
}
/**
diff --git a/libgimp/gimptexttool_pdb.h b/libgimp/gimptexttool_pdb.h
index 3d9b1c03b2..09d1fe5093 100644
--- a/libgimp/gimptexttool_pdb.h
+++ b/libgimp/gimptexttool_pdb.h
@@ -43,16 +43,16 @@ gboolean gimp_text_get_extents_fontname (const gchar *text,
#ifndef GIMP_DEPRECATED_REPLACE_NEW_API
-gint32 gimp_text_fontname (GimpImage *image,
- gint32 drawable_ID,
- gdouble x,
- gdouble y,
- const gchar *text,
- gint border,
- gboolean antialias,
- gdouble size,
- GimpSizeType size_type,
- const gchar *fontname);
+GimpLayer* gimp_text_fontname (GimpImage *image,
+ GimpDrawable *drawable,
+ gdouble x,
+ gdouble y,
+ const gchar *text,
+ gint border,
+ gboolean antialias,
+ gdouble size,
+ GimpSizeType size_type,
+ const gchar *fontname);
#else /* GIMP_DEPRECATED_REPLACE_NEW_API */
diff --git a/libgimp/gimptypes.h b/libgimp/gimptypes.h
index 515ff5caea..49d827b310 100644
--- a/libgimp/gimptypes.h
+++ b/libgimp/gimptypes.h
@@ -38,6 +38,9 @@ typedef union _GimpParamData GimpParamData;
typedef struct _GimpParam GimpParam;
typedef struct _GimpImage GimpImage;
+typedef struct _GimpItem GimpItem;
+typedef struct _GimpDrawable GimpDrawable;
+typedef struct _GimpLayer GimpLayer;
/* FIXME move somewhere else */
diff --git a/libgimp/gimpvectors_pdb.c b/libgimp/gimpvectors_pdb.c
index 3f3a6c7499..4589f516b6 100644
--- a/libgimp/gimpvectors_pdb.c
+++ b/libgimp/gimpvectors_pdb.c
@@ -127,7 +127,7 @@ _gimp_vectors_new (gint32 image_ID,
/**
* gimp_vectors_new_from_text_layer:
* @image: The image.
- * @layer_ID: The text layer.
+ * @layer: The text layer.
*
* Creates a new vectors object from a text layer.
*
@@ -140,7 +140,7 @@ _gimp_vectors_new (gint32 image_ID,
**/
gint32
gimp_vectors_new_from_text_layer (GimpImage *image,
- gint32 layer_ID)
+ GimpLayer *layer)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -149,7 +149,7 @@ gimp_vectors_new_from_text_layer (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_LAYER_ID, gimp_item_get_id (GIMP_ITEM (layer)),
G_TYPE_NONE);
if (pdb)
diff --git a/libgimp/gimpvectors_pdb.h b/libgimp/gimpvectors_pdb.h
index 62126fc6cf..e12c21c795 100644
--- a/libgimp/gimpvectors_pdb.h
+++ b/libgimp/gimpvectors_pdb.h
@@ -121,7 +121,7 @@ gint gimp_vectors_bezier_stroke_new_ellipse (gint32
gint32 gimp_vectors_new (GimpImage *image,
const gchar *name);
gint32 gimp_vectors_new_from_text_layer (GimpImage *image,
- gint32 layer_ID);
+ GimpLayer *layer);
gboolean gimp_vectors_import_from_file (GimpImage *image,
const gchar *filename,
gboolean merge,
diff --git a/pdb/lib.pl b/pdb/lib.pl
index 74efcbdb3e..9ff9460859 100644
--- a/pdb/lib.pl
+++ b/pdb/lib.pl
@@ -45,8 +45,17 @@ sub desc_wrap {
return $wrapped;
}
+sub is_id_arg {
+ my ($arg) = @_;
+
+ return ($arg->{name} eq 'IMAGE' ||
+ $arg->{name} eq 'ITEM' ||
+ $arg->{name} eq 'DRAWABLE' ||
+ $arg->{name} eq 'LAYER');
+}
+
sub generate_fun {
- my ($proc, $out, $api_deprecated, $has_image_arg) = @_;
+ my ($proc, $out, $api_deprecated, $has_id_arg) = @_;
my @inargs = @{$proc->{inargs}} if (defined $proc->{inargs});
my @outargs = @{$proc->{outargs}} if (defined $proc->{outargs});
@@ -58,7 +67,7 @@ sub generate_fun {
my $argtype = $arg_types{$type};
my $rettype = '';
- if ($api_deprecated && $argtype->{name} eq 'IMAGE') {
+ if ($api_deprecated && is_id_arg($argtype)) {
return 'gint32 ';
}
@@ -211,7 +220,7 @@ sub generate_fun {
my $desc = exists $_->{desc} ? $_->{desc} : "";
my $var_len;
my $value;
- my $is_id = ($arg->{id} || ($api_deprecated && $arg->{name} eq 'IMAGE'));
+ my $is_id = ($arg->{id} || ($api_deprecated && is_id_arg($arg)));
$var .= '_ID' if $is_id;
@@ -309,7 +318,7 @@ sub generate_fun {
my ($type) = &arg_parse($_->{type});
my $arg = $arg_types{$type};
my $var;
- my $is_id = ($arg->{id} || ($api_deprecated && $arg->{name} eq 'IMAGE'));
+ my $is_id = ($arg->{id} || ($api_deprecated && is_id_arg($arg)));
$return_marshal = "" unless $once++;
@@ -390,7 +399,7 @@ CODE
my ($type) = &arg_parse($_->{type});
my $desc = exists $_->{desc} ? $_->{desc} : "";
my $arg = $arg_types{$type};
- my $is_id = ($arg->{id} || ($api_deprecated && $arg->{name} eq 'IMAGE'));
+ my $is_id = ($arg->{id} || ($api_deprecated && is_id_arg($arg)));
my $var;
# The return value variable
@@ -521,7 +530,7 @@ CODE
push @{$out->{protos_deprecated}}, $proto;
push @{$out->{defines_deprecated}}, $define_dep;
}
- elsif (! $has_image_arg){
+ elsif (! $has_id_arg){
push @{$out->{protos_no_alt}}, $proto;
}
else {
@@ -720,28 +729,28 @@ sub generate {
my @outargs = @{$proc->{outargs}} if (defined $proc->{outargs});
# Check if any of the argument or returned value is an image.
- $has_image_arg = 0;
+ $has_id_arg = 0;
foreach (@outargs) {
my ($type, @typeinfo) = &arg_parse($_->{type});
my $arg = $arg_types{$type};
- if ($arg->{name} eq 'IMAGE') {
- $has_image_arg = 1;
+ if (is_id_arg($arg)) {
+ $has_id_arg = 1;
last;
}
}
- unless ($has_image_arg) {
+ unless ($has_id_arg) {
foreach (@inargs) {
my ($type, @typeinfo) = &arg_parse($_->{type});
my $arg = $arg_types{$type};
- if ($arg->{name} eq 'IMAGE') {
- $has_image_arg = 1;
+ if (is_id_arg($arg)) {
+ $has_id_arg = 1;
last;
}
}
}
- $out->{code} .= generate_fun($proc, $out, 0, $has_image_arg);
- if ($has_image_arg) {
- $out->{code} .= generate_fun($proc, $out, 1, $has_image_arg);
+ $out->{code} .= generate_fun($proc, $out, 0, $has_id_arg);
+ if ($has_id_arg) {
+ $out->{code} .= generate_fun($proc, $out, 1, $has_id_arg);
}
}
diff --git a/pdb/pdb.pl b/pdb/pdb.pl
index 409ddee7c7..0775c55e48 100644
--- a/pdb/pdb.pl
+++ b/pdb/pdb.pl
@@ -177,24 +177,28 @@ package Gimp::CodeGen::pdb;
gtype => 'GIMP_TYPE_ITEM_ID',
type => 'GimpItem *',
const_type => 'GimpItem *',
- id => 1,
init_value => 'NULL',
+ out_annotate => '(transfer full)',
get_value_func => '$var = gimp_value_get_item ($value, gimp)',
- dup_value_func => '$var = gimp_value_get_item_id ($value)',
+ dup_value_func => '$var = gimp_item_new_by_id (gimp_value_get_item_id ($value))',
+ dup_value_func_d=> '$var = gimp_value_get_item_id ($value)',
set_value_func => 'gimp_value_set_item_id ($value, $var)',
take_value_func => 'gimp_value_set_item ($value, $var)',
+ convert_func => 'gimp_item_get_id (GIMP_ITEM ($var))',
headers => [ qw("core/gimpitem.h") ] },
layer => { name => 'LAYER',
gtype => 'GIMP_TYPE_LAYER_ID',
type => 'GimpLayer *',
const_type => 'GimpLayer *',
- id => 1,
init_value => 'NULL',
+ out_annotate => '(transfer full)',
get_value_func => '$var = gimp_value_get_layer ($value, gimp)',
- dup_value_func => '$var = gimp_value_get_layer_id ($value)',
+ dup_value_func => '$var = GIMP_LAYER (gimp_item_new_by_id (gimp_value_get_layer_id
($value)))',
+ dup_value_func_d=> '$var = gimp_value_get_layer_id ($value)',
set_value_func => 'gimp_value_set_layer_id ($value, $var)',
take_value_func => 'gimp_value_set_layer ($value, $var)',
+ convert_func => 'gimp_item_get_id (GIMP_ITEM ($var))',
headers => [ qw("core/gimplayer.h") ] },
channel => { name => 'CHANNEL',
@@ -213,12 +217,14 @@ package Gimp::CodeGen::pdb;
gtype => 'GIMP_TYPE_DRAWABLE_ID',
type => 'GimpDrawable *',
const_type => 'GimpDrawable *',
- id => 1,
init_value => 'NULL',
+ out_annotate => '(transfer full)',
get_value_func => '$var = gimp_value_get_drawable ($value, gimp)',
- dup_value_func => '$var = gimp_value_get_drawable_id ($value)',
+ dup_value_func => '$var = GIMP_DRAWABLE (gimp_item_new_by_id
(gimp_value_get_drawable_id ($value)))',
+ dup_value_func_d=> '$var = gimp_value_get_drawable_id ($value)',
set_value_func => 'gimp_value_set_drawable_id ($value, $var)',
take_value_func => 'gimp_value_set_drawable ($value, $var)',
+ convert_func => 'gimp_item_get_id (GIMP_ITEM ($var))',
headers => [ qw("core/gimpdrawable.h") ] },
selection => { name => 'SELECTION',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]