[gimp/wip/Jehan/classy-GIMP: 6/55] libgimp: generate functions both for old and new GimpImage APIs.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/Jehan/classy-GIMP: 6/55] libgimp: generate functions both for old and new GimpImage APIs.
- Date: Tue, 20 Aug 2019 10:18:26 +0000 (UTC)
commit 500af13fe3a4843d2f82df50c29ca6370900f521
Author: Jehan <jehan girinstud io>
Date: Mon Aug 12 14:44:07 2019 +0200
libgimp: generate functions both for old and new GimpImage APIs.
This way, it would still be possible to use the old API. WIP.
libgimp/gimpchannel_pdb.c | 111 +
libgimp/gimpchannel_pdb.h | 61 +-
libgimp/gimpdisplay_pdb.c | 88 +
libgimp/gimpdisplay_pdb.h | 19 +-
libgimp/gimpedit_pdb.c | 182 +-
libgimp/gimpedit_pdb.h | 41 +-
libgimp/gimpfileops_pdb.c | 263 +-
libgimp/gimpfileops_pdb.h | 22 +
libgimp/gimpimage_pdb.c | 5713 +++++++++++++++++++++++++++++------
libgimp/gimpimage_pdb.h | 557 +++-
libgimp/gimpimagecolorprofile_pdb.c | 310 ++
libgimp/gimpimagecolorprofile_pdb.h | 60 +-
libgimp/gimpimageconvert_pdb.c | 193 ++
libgimp/gimpimageconvert_pdb.h | 45 +-
libgimp/gimpimagegrid_pdb.c | 463 +++
libgimp/gimpimagegrid_pdb.h | 79 +-
libgimp/gimpimageguides_pdb.c | 262 ++
libgimp/gimpimageguides_pdb.h | 42 +-
libgimp/gimpimagesamplepoints_pdb.c | 193 ++
libgimp/gimpimagesamplepoints_pdb.h | 34 +-
libgimp/gimpimageselect_pdb.c | 446 +++
libgimp/gimpimageselect_pdb.h | 115 +-
libgimp/gimpimagetransform_pdb.c | 284 ++
libgimp/gimpimagetransform_pdb.h | 60 +-
libgimp/gimpimageundo_pdb.c | 304 ++
libgimp/gimpimageundo_pdb.h | 28 +-
libgimp/gimpitem_pdb.c | 43 +-
libgimp/gimpitem_pdb.h | 94 +-
libgimp/gimplayer_pdb.c | 206 ++
libgimp/gimplayer_pdb.h | 17 +
libgimp/gimpselection_pdb.c | 822 ++++-
libgimp/gimpselection_pdb.h | 101 +-
libgimp/gimptextlayer_pdb.c | 58 +
libgimp/gimptextlayer_pdb.h | 108 +-
libgimp/gimptexttool_pdb.c | 79 +
libgimp/gimptexttool_pdb.h | 47 +-
libgimp/gimpvectors_pdb.c | 317 ++
libgimp/gimpvectors_pdb.h | 238 +-
pdb/lib.pl | 826 ++---
pdb/pdb.pl | 3 +-
40 files changed, 10843 insertions(+), 2091 deletions(-)
---
diff --git a/libgimp/gimpchannel_pdb.c b/libgimp/gimpchannel_pdb.c
index 7780605e00..dad21df6ea 100644
--- a/libgimp/gimpchannel_pdb.c
+++ b/libgimp/gimpchannel_pdb.c
@@ -94,6 +94,66 @@ _gimp_channel_new (GimpImage *image,
return channel_ID;
}
+/**
+ * __gimp_channel_new: (skip)
+ * @image_ID: The image to which to add the channel.
+ * @width: The channel width.
+ * @height: The channel height.
+ * @name: The channel name.
+ * @opacity: The channel opacity.
+ * @color: The channel compositing color.
+ *
+ * Create a new channel.
+ *
+ * This procedure creates a new channel with the specified width,
+ * height, name, opacity and color.
+ * The new channel still needs to be added to the image, as this is not
+ * automatic. Add the new channel with gimp_image_insert_channel().
+ * Other attributes, such as channel visibility, should be set with
+ * explicit procedure calls.
+ * The channel's contents are undefined initially.
+ *
+ * Returns: The newly created channel.
+ **/
+gint32
+__gimp_channel_new (gint32 image_ID,
+ gint width,
+ gint height,
+ const gchar *name,
+ gdouble opacity,
+ const GimpRGB *color)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 channel_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_INT, width,
+ G_TYPE_INT, height,
+ G_TYPE_STRING, name,
+ G_TYPE_DOUBLE, opacity,
+ GIMP_TYPE_RGB, color,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-channel-new",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-channel-new",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ channel_ID = gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return channel_ID;
+}
+
/**
* gimp_channel_new_from_component:
* @image: The image to which to add the channel.
@@ -145,6 +205,57 @@ gimp_channel_new_from_component (GimpImage *image,
return channel_ID;
}
+/**
+ * _gimp_channel_new_from_component: (skip)
+ * @image_ID: The image to which to add the channel.
+ * @component: The image component.
+ * @name: The channel name.
+ *
+ * Create a new channel from a color component
+ *
+ * This procedure creates a new channel from a color component.
+ * The new channel still needs to be added to the image, as this is not
+ * automatic. Add the new channel with gimp_image_insert_channel().
+ * Other attributes, such as channel visibility, should be set with
+ * explicit procedure calls.
+ *
+ * Returns: The newly created channel.
+ *
+ * Since: 2.4
+ **/
+gint32
+_gimp_channel_new_from_component (gint32 image_ID,
+ GimpChannelType component,
+ const gchar *name)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 channel_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_CHANNEL_TYPE, component,
+ G_TYPE_STRING, name,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-channel-new-from-component",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-channel-new-from-component",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ channel_ID = gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return channel_ID;
+}
+
/**
* gimp_channel_copy:
* @channel_ID: The channel to copy.
diff --git a/libgimp/gimpchannel_pdb.h b/libgimp/gimpchannel_pdb.h
index 4e1cb8318a..1aa515de72 100644
--- a/libgimp/gimpchannel_pdb.h
+++ b/libgimp/gimpchannel_pdb.h
@@ -32,31 +32,42 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-G_GNUC_INTERNAL gint32 _gimp_channel_new (GimpImage *image,
- gint width,
- gint height,
- const gchar *name,
- gdouble opacity,
- const GimpRGB *color);
-gint32 gimp_channel_new_from_component (GimpImage *image,
- GimpChannelType component,
- const gchar *name);
-gint32 gimp_channel_copy (gint32 channel_ID);
-gboolean gimp_channel_combine_masks (gint32 channel1_ID,
- gint32 channel2_ID,
- GimpChannelOps operation,
- gint offx,
- gint offy);
-gboolean gimp_channel_get_show_masked (gint32 channel_ID);
-gboolean gimp_channel_set_show_masked (gint32 channel_ID,
- gboolean show_masked);
-gdouble gimp_channel_get_opacity (gint32 channel_ID);
-gboolean gimp_channel_set_opacity (gint32 channel_ID,
- gdouble opacity);
-gboolean gimp_channel_get_color (gint32 channel_ID,
- GimpRGB *color);
-gboolean gimp_channel_set_color (gint32 channel_ID,
- const GimpRGB *color);
+G_GNUC_INTERNAL gint32 _gimp_channel_new (GimpImage *image,
+ gint width,
+ gint height,
+ const gchar *name,
+ gdouble opacity,
+ const GimpRGB *color);
+GIMP_DEPRECATED_FOR(_gimp_channel_new)
+G_GNUC_INTERNAL gint32 __gimp_channel_new (gint32 image_ID,
+ gint width,
+ gint height,
+ const gchar *name,
+ gdouble opacity,
+ const GimpRGB *color);
+gint32 gimp_channel_new_from_component (GimpImage *image,
+ GimpChannelType component,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_channel_new_from_component)
+G_GNUC_INTERNAL gint32 _gimp_channel_new_from_component (gint32 image_ID,
+ GimpChannelType component,
+ const gchar *name);
+gint32 gimp_channel_copy (gint32 channel_ID);
+gboolean gimp_channel_combine_masks (gint32 channel1_ID,
+ gint32 channel2_ID,
+ GimpChannelOps operation,
+ gint offx,
+ gint offy);
+gboolean gimp_channel_get_show_masked (gint32 channel_ID);
+gboolean gimp_channel_set_show_masked (gint32 channel_ID,
+ gboolean show_masked);
+gdouble gimp_channel_get_opacity (gint32 channel_ID);
+gboolean gimp_channel_set_opacity (gint32 channel_ID,
+ gdouble opacity);
+gboolean gimp_channel_get_color (gint32 channel_ID,
+ GimpRGB *color);
+gboolean gimp_channel_set_color (gint32 channel_ID,
+ const GimpRGB *color);
G_END_DECLS
diff --git a/libgimp/gimpdisplay_pdb.c b/libgimp/gimpdisplay_pdb.c
index f89655fead..1f88c8ad1c 100644
--- a/libgimp/gimpdisplay_pdb.c
+++ b/libgimp/gimpdisplay_pdb.c
@@ -120,6 +120,50 @@ gimp_display_new (GimpImage *image)
return display_ID;
}
+/**
+ * _gimp_display_new: (skip)
+ * @image_ID: The image.
+ *
+ * Create a new display for the specified image.
+ *
+ * Creates a new display for the specified image. If the image already
+ * has a display, another is added. Multiple displays are handled
+ * transparently by GIMP. The newly created display is returned and can
+ * be subsequently destroyed with a call to gimp_display_delete(). This
+ * procedure only makes sense for use with the GIMP UI, and will result
+ * in an execution error if called when GIMP has no UI.
+ *
+ * Returns: The new display.
+ **/
+gint32
+_gimp_display_new (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 display_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-display-new",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-display-new",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ display_ID = gimp_value_get_display_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return display_ID;
+}
+
/**
* gimp_display_delete:
* @display_ID: The display to delete.
@@ -289,3 +333,47 @@ gimp_displays_reconnect (GimpImage *old_image,
return success;
}
+
+/**
+ * _gimp_displays_reconnect: (skip)
+ * @old_image_ID: The old image (must have at least one display).
+ * @new_image_ID: The new image (must not have a display).
+ *
+ * Reconnect displays from one image to another image.
+ *
+ * This procedure connects all displays of the old_image to the
+ * new_image. If the old_image has no display or new_image already has
+ * a display the reconnect is not performed and the procedure returns
+ * without success. You should rarely need to use this function.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_displays_reconnect (gint32 old_image_ID,
+ gint32 new_image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, old_image_ID,
+ GIMP_TYPE_IMAGE_ID, new_image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-displays-reconnect",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-displays-reconnect",
+ 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;
+}
diff --git a/libgimp/gimpdisplay_pdb.h b/libgimp/gimpdisplay_pdb.h
index 94a1c00e1d..0feb8edd47 100644
--- a/libgimp/gimpdisplay_pdb.h
+++ b/libgimp/gimpdisplay_pdb.h
@@ -32,13 +32,18 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gboolean gimp_display_is_valid (gint32 display_ID);
-gint32 gimp_display_new (GimpImage *image);
-gboolean gimp_display_delete (gint32 display_ID);
-gint gimp_display_get_window_handle (gint32 display_ID);
-gboolean gimp_displays_flush (void);
-gboolean gimp_displays_reconnect (GimpImage *old_image,
- GimpImage *new_image);
+gboolean gimp_display_is_valid (gint32 display_ID);
+gint32 gimp_display_new (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_display_new)
+G_GNUC_INTERNAL gint32 _gimp_display_new (gint32 image_ID);
+gboolean gimp_display_delete (gint32 display_ID);
+gint gimp_display_get_window_handle (gint32 display_ID);
+gboolean gimp_displays_flush (void);
+gboolean gimp_displays_reconnect (GimpImage *old_image,
+ GimpImage *new_image);
+GIMP_DEPRECATED_FOR(gimp_displays_reconnect)
+G_GNUC_INTERNAL gboolean _gimp_displays_reconnect (gint32 old_image_ID,
+ gint32 new_image_ID);
G_END_DECLS
diff --git a/libgimp/gimpedit_pdb.c b/libgimp/gimpedit_pdb.c
index 7b59d6bb94..4d459445e1 100644
--- a/libgimp/gimpedit_pdb.c
+++ b/libgimp/gimpedit_pdb.c
@@ -172,6 +172,52 @@ gimp_edit_copy_visible (GimpImage *image)
return non_empty;
}
+/**
+ * _gimp_edit_copy_visible: (skip)
+ * @image_ID: The image to copy from.
+ *
+ * Copy from the projection.
+ *
+ * If there is a selection in the image, then the area specified by the
+ * selection is copied from the projection and placed in an internal
+ * GIMP edit buffer. It can subsequently be retrieved using the
+ * gimp_edit_paste() command. If there is no selection, then the
+ * projection's contents will be stored in the internal GIMP edit
+ * buffer.
+ *
+ * Returns: TRUE if the copy was successful.
+ *
+ * Since: 2.2
+ **/
+gboolean
+_gimp_edit_copy_visible (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean non_empty = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-edit-copy-visible",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-edit-copy-visible",
+ 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_paste:
* @drawable_ID: The drawable to paste to.
@@ -263,13 +309,55 @@ gimp_edit_paste_as_new_image (void)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- image = gimp_image_new_by_id (g_value_get_int (gimp_value_array_index (return_vals, 1)));
+ image = gimp_image_new_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
return image;
}
+/**
+ * _gimp_edit_paste_as_new_image: (skip)
+ *
+ * Paste buffer to a new image.
+ *
+ * This procedure pastes a copy of the internal GIMP edit buffer to a
+ * new image. The GIMP edit buffer will be empty unless a call was
+ * previously made to either gimp_edit_cut() or gimp_edit_copy(). This
+ * procedure returns the new image or -1 if the edit buffer was empty.
+ *
+ * Returns: The new image.
+ *
+ * Since: 2.10
+ **/
+gint32
+_gimp_edit_paste_as_new_image (void)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 image_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-edit-paste-as-new-image",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-edit-paste-as-new-image",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ image_ID = gimp_value_get_image_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return image_ID;
+}
+
/**
* gimp_edit_named_cut:
* @drawable_ID: The drawable to cut from.
@@ -417,6 +505,54 @@ gimp_edit_named_copy_visible (GimpImage *image,
return real_name;
}
+/**
+ * _gimp_edit_named_copy_visible: (skip)
+ * @image_ID: The image to copy from.
+ * @buffer_name: The name of the buffer to create.
+ *
+ * Copy from the projection into a named buffer.
+ *
+ * This procedure works like gimp_edit_copy_visible(), but additionally
+ * stores the copied buffer into a named buffer that will stay
+ * available for later pasting, regardless of any intermediate copy or
+ * cut operations.
+ *
+ * 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_visible (gint32 image_ID,
+ 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_IMAGE_ID, image_ID,
+ G_TYPE_STRING, buffer_name,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-edit-named-copy-visible",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-edit-named-copy-visible",
+ 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_paste:
* @drawable_ID: The drawable to paste to.
@@ -500,9 +636,51 @@ gimp_edit_named_paste_as_new_image (const gchar *buffer_name)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- image = gimp_image_new_by_id (g_value_get_int (gimp_value_array_index (return_vals, 1)));
+ image = gimp_image_new_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
return image;
}
+
+/**
+ * _gimp_edit_named_paste_as_new_image: (skip)
+ * @buffer_name: The name of the buffer to paste.
+ *
+ * Paste named buffer to a new image.
+ *
+ * This procedure works like gimp_edit_paste_as_new_image() but pastes
+ * a named buffer instead of the global buffer.
+ *
+ * Returns: The new image.
+ *
+ * Since: 2.10
+ **/
+gint32
+_gimp_edit_named_paste_as_new_image (const gchar *buffer_name)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 image_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ G_TYPE_STRING, buffer_name,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-edit-named-paste-as-new-image",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-edit-named-paste-as-new-image",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ image_ID = gimp_value_get_image_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return image_ID;
+}
diff --git a/libgimp/gimpedit_pdb.h b/libgimp/gimpedit_pdb.h
index 4092904f90..5e986004ca 100644
--- a/libgimp/gimpedit_pdb.h
+++ b/libgimp/gimpedit_pdb.h
@@ -32,22 +32,31 @@ 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);
-gboolean gimp_edit_copy_visible (GimpImage *image);
-gint32 gimp_edit_paste (gint32 drawable_ID,
- gboolean paste_into);
-GimpImage* 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 (GimpImage *image,
- const gchar *buffer_name);
-gint32 gimp_edit_named_paste (gint32 drawable_ID,
- const gchar *buffer_name,
- gboolean paste_into);
-GimpImage* gimp_edit_named_paste_as_new_image (const gchar *buffer_name);
+gboolean gimp_edit_cut (gint32 drawable_ID);
+gboolean gimp_edit_copy (gint32 drawable_ID);
+gboolean gimp_edit_copy_visible (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_edit_copy_visible)
+G_GNUC_INTERNAL gboolean _gimp_edit_copy_visible (gint32 image_ID);
+gint32 gimp_edit_paste (gint32 drawable_ID,
+ gboolean paste_into);
+GimpImage* gimp_edit_paste_as_new_image (void);
+GIMP_DEPRECATED_FOR(gimp_edit_paste_as_new_image)
+G_GNUC_INTERNAL 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 (GimpImage *image,
+ const gchar *buffer_name);
+GIMP_DEPRECATED_FOR(gimp_edit_named_copy_visible)
+G_GNUC_INTERNAL 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);
+GimpImage* gimp_edit_named_paste_as_new_image (const gchar *buffer_name);
+GIMP_DEPRECATED_FOR(gimp_edit_named_paste_as_new_image)
+G_GNUC_INTERNAL gint32 _gimp_edit_named_paste_as_new_image (const gchar *buffer_name);
G_END_DECLS
diff --git a/libgimp/gimpfileops_pdb.c b/libgimp/gimpfileops_pdb.c
index f6dc0ca92f..794da05541 100644
--- a/libgimp/gimpfileops_pdb.c
+++ b/libgimp/gimpfileops_pdb.c
@@ -78,13 +78,64 @@ gimp_file_load (GimpRunMode run_mode,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- image = gimp_image_new_by_id (g_value_get_int (gimp_value_array_index (return_vals, 1)));
+ image = gimp_image_new_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
return image;
}
+/**
+ * _gimp_file_load: (skip)
+ * @run_mode: The run mode.
+ * @filename: The name of the file to load.
+ * @raw_filename: The name as entered by the user.
+ *
+ * Loads an image file by invoking the right load handler.
+ *
+ * This procedure invokes the correct file load handler using magic if
+ * possible, and falling back on the file's extension and/or prefix if
+ * not. The name of the file to load is typically a full pathname, and
+ * the name entered is what the user actually typed before prepending a
+ * directory path. The reason for this is that if the user types
+ * https://www.gimp.org/foo.png he wants to fetch a URL, and the full
+ * pathname will not look like a URL.
+ *
+ * Returns: The output image.
+ **/
+gint32
+_gimp_file_load (GimpRunMode run_mode,
+ const gchar *filename,
+ const gchar *raw_filename)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 image_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_RUN_MODE, run_mode,
+ G_TYPE_STRING, filename,
+ G_TYPE_STRING, raw_filename,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-file-load",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-file-load",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ image_ID = gimp_value_get_image_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return image_ID;
+}
+
/**
* gimp_file_load_layer:
* @run_mode: The run mode.
@@ -135,6 +186,56 @@ gimp_file_load_layer (GimpRunMode run_mode,
return layer_ID;
}
+/**
+ * _gimp_file_load_layer: (skip)
+ * @run_mode: The run mode.
+ * @image_ID: Destination image.
+ * @filename: The name of the file to load.
+ *
+ * Loads an image file as a layer for an existing image.
+ *
+ * This procedure behaves like the file-load procedure but opens the
+ * specified image as a layer for an existing image. The returned layer
+ * needs to be added to the existing image with
+ * gimp_image_insert_layer().
+ *
+ * Returns: The layer created when loading the image file.
+ *
+ * Since: 2.4
+ **/
+gint32
+_gimp_file_load_layer (GimpRunMode run_mode,
+ gint32 image_ID,
+ const gchar *filename)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 layer_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_RUN_MODE, run_mode,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_STRING, filename,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-file-load-layer",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-file-load-layer",
+ 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_file_load_layers:
* @run_mode: The run mode.
@@ -194,6 +295,64 @@ gimp_file_load_layers (GimpRunMode run_mode,
return layer_ids;
}
+/**
+ * _gimp_file_load_layers: (skip)
+ * @run_mode: The run mode.
+ * @image_ID: Destination image.
+ * @filename: The name of the file to load.
+ * @num_layers: (out): The number of loaded layers.
+ *
+ * Loads an image file as layers for an existing image.
+ *
+ * This procedure behaves like the file-load procedure but opens the
+ * specified image as layers for an existing image. The returned layers
+ * needs to be added to the existing image with
+ * gimp_image_insert_layer().
+ *
+ * Returns: (array length=num_layers): The list of loaded layers.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.4
+ **/
+gint *
+_gimp_file_load_layers (GimpRunMode run_mode,
+ gint32 image_ID,
+ const gchar *filename,
+ gint *num_layers)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint *layer_ids = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_RUN_MODE, run_mode,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_STRING, filename,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-file-load-layers",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-file-load-layers",
+ args);
+ gimp_value_array_unref (args);
+
+ *num_layers = 0;
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ {
+ *num_layers = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ layer_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return layer_ids;
+}
+
/**
* gimp_file_save:
* @run_mode: The run mode.
@@ -250,6 +409,62 @@ gimp_file_save (GimpRunMode run_mode,
return success;
}
+/**
+ * _gimp_file_save: (skip)
+ * @run_mode: The run mode.
+ * @image_ID: Input image.
+ * @drawable_ID: Drawable to save.
+ * @filename: The name of the file to save the image in.
+ * @raw_filename: The name as entered by the user.
+ *
+ * Saves a file by extension.
+ *
+ * This procedure invokes the correct file save handler according to
+ * the file's extension and/or prefix. The name of the file to save is
+ * typically a full pathname, and the name entered is what the user
+ * actually typed before prepending a directory path. The reason for
+ * this is that if the user types https://www.gimp.org/foo.png she
+ * wants to fetch a URL, and the full pathname will not look like a
+ * URL.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_file_save (GimpRunMode run_mode,
+ gint32 image_ID,
+ gint32 drawable_ID,
+ const gchar *filename,
+ const gchar *raw_filename)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_RUN_MODE, run_mode,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_STRING, filename,
+ G_TYPE_STRING, raw_filename,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-file-save",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-file-save",
+ 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_file_save_thumbnail:
* @image: The image.
@@ -296,6 +511,52 @@ gimp_file_save_thumbnail (GimpImage *image,
return success;
}
+/**
+ * _gimp_file_save_thumbnail: (skip)
+ * @image_ID: The image.
+ * @filename: The name of the file the thumbnail belongs to.
+ *
+ * Saves a thumbnail for the given image
+ *
+ * This procedure saves a thumbnail for the given image according to
+ * the Free Desktop Thumbnail Managing Standard. The thumbnail is saved
+ * so that it belongs to the file with the given filename. This means
+ * you have to save the image under this name first, otherwise this
+ * procedure will fail. This procedure may become useful if you want to
+ * explicitly save a thumbnail with a file.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_file_save_thumbnail (gint32 image_ID,
+ const gchar *filename)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_STRING, filename,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-file-save-thumbnail",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-file-save-thumbnail",
+ 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_register_magic_load_handler:
* @procedure_name: The name of the procedure to be used for loading.
diff --git a/libgimp/gimpfileops_pdb.h b/libgimp/gimpfileops_pdb.h
index 69b11dacae..c0c0ec1a53 100644
--- a/libgimp/gimpfileops_pdb.h
+++ b/libgimp/gimpfileops_pdb.h
@@ -35,20 +35,42 @@ G_BEGIN_DECLS
GimpImage* gimp_file_load (GimpRunMode run_mode,
const gchar *filename,
const gchar *raw_filename);
+GIMP_DEPRECATED_FOR(gimp_file_load)
+G_GNUC_INTERNAL gint32 _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);
+GIMP_DEPRECATED_FOR(gimp_file_load_layer)
+G_GNUC_INTERNAL gint32 _gimp_file_load_layer (GimpRunMode run_mode,
+ gint32 image_ID,
+ const gchar *filename);
gint* gimp_file_load_layers (GimpRunMode run_mode,
GimpImage *image,
const gchar *filename,
gint *num_layers);
+GIMP_DEPRECATED_FOR(gimp_file_load_layers)
+G_GNUC_INTERNAL gint* _gimp_file_load_layers (GimpRunMode run_mode,
+ gint32 image_ID,
+ 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);
+GIMP_DEPRECATED_FOR(gimp_file_save)
+G_GNUC_INTERNAL gboolean _gimp_file_save (GimpRunMode run_mode,
+ gint32 image_ID,
+ gint32 drawable_ID,
+ const gchar *filename,
+ const gchar *raw_filename);
gboolean gimp_file_save_thumbnail (GimpImage *image,
const gchar *filename);
+GIMP_DEPRECATED_FOR(gimp_file_save_thumbnail)
+G_GNUC_INTERNAL gboolean _gimp_file_save_thumbnail (gint32 image_ID,
+ const gchar *filename);
G_GNUC_INTERNAL gboolean _gimp_register_magic_load_handler (const gchar *procedure_name,
const gchar *extensions,
const gchar *prefixes,
diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c
index 3b9dc85723..b3970d9e77 100644
--- a/libgimp/gimpimage_pdb.c
+++ b/libgimp/gimpimage_pdb.c
@@ -77,6 +77,48 @@ gimp_image_is_valid (GimpImage *image)
return valid;
}
+/**
+ * _gimp_image_is_valid: (skip)
+ * @image_ID: The image to check.
+ *
+ * Returns TRUE if the image is valid.
+ *
+ * This procedure checks if the given image is valid and refers to an
+ * existing image.
+ *
+ * Returns: Whether the image is valid.
+ *
+ * Since: 2.4
+ **/
+gboolean
+_gimp_image_is_valid (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean valid = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-is-valid",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-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_image_list:
* @num_images: (out): The number of images currently open.
@@ -169,13 +211,67 @@ gimp_image_new (gint width,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- image = gimp_image_new_by_id (g_value_get_int (gimp_value_array_index (return_vals, 1)));
+ image = gimp_image_new_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
return image;
}
+/**
+ * _gimp_image_new: (skip)
+ * @width: The width of the image.
+ * @height: The height of the image.
+ * @type: The type of image.
+ *
+ * Creates a new image with the specified width, height, and type.
+ *
+ * Creates a new image, undisplayed, with the specified extents and
+ * type. A layer should be created and added before this image is
+ * displayed, or subsequent calls to gimp_display_new() with this image
+ * as an argument will fail. Layers can be created using the
+ * gimp_layer_new() commands. They can be added to an image using the
+ * gimp_image_insert_layer() command.
+ *
+ * If your image's type if INDEXED, a colormap must also be added with
+ * gimp_image_set_colormap(). An indexed image without a colormap will
+ * output unexpected colors.
+ *
+ * Returns: The newly created image.
+ **/
+gint32
+_gimp_image_new (gint width,
+ gint height,
+ GimpImageBaseType type)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 image_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ G_TYPE_INT, width,
+ G_TYPE_INT, height,
+ GIMP_TYPE_IMAGE_BASE_TYPE, type,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-new",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-new",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ image_ID = gimp_value_get_image_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return image_ID;
+}
+
/**
* gimp_image_new_with_precision:
* @width: The width of the image.
@@ -223,13 +319,67 @@ gimp_image_new_with_precision (gint width,
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- image = gimp_image_new_by_id (g_value_get_int (gimp_value_array_index (return_vals, 1)));
+ image = gimp_image_new_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
return image;
}
+/**
+ * _gimp_image_new_with_precision: (skip)
+ * @width: The width of the image.
+ * @height: The height of the image.
+ * @type: The type of image.
+ * @precision: The precision.
+ *
+ * Creates a new image with the specified width, height, type and
+ * precision.
+ *
+ * Creates a new image, undisplayed with the specified extents, type
+ * and precision. Indexed images can only be created at
+ * GIMP_PRECISION_U8_NON_LINEAR precision. See gimp_image_new() for
+ * further details.
+ *
+ * Returns: The newly created image.
+ *
+ * Since: 2.10
+ **/
+gint32
+_gimp_image_new_with_precision (gint width,
+ gint height,
+ GimpImageBaseType type,
+ GimpPrecision precision)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 image_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ G_TYPE_INT, width,
+ G_TYPE_INT, height,
+ GIMP_TYPE_IMAGE_BASE_TYPE, type,
+ GIMP_TYPE_PRECISION, precision,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-new-with-precision",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-new-with-precision",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ image_ID = gimp_value_get_image_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return image_ID;
+}
+
/**
* gimp_image_duplicate:
* @image: The image.
@@ -263,13 +413,53 @@ gimp_image_duplicate (GimpImage *image)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- new_image = gimp_image_new_by_id (g_value_get_int (gimp_value_array_index (return_vals, 1)));
+ new_image = gimp_image_new_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
return new_image;
}
+/**
+ * _gimp_image_duplicate: (skip)
+ * @image_ID: The image.
+ *
+ * Duplicate the specified image
+ *
+ * This procedure duplicates the specified image, copying all layers,
+ * channels, and image information.
+ *
+ * Returns: The new, duplicated image.
+ **/
+gint32
+_gimp_image_duplicate (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 new_image_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-duplicate",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-duplicate",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ new_image_ID = gimp_value_get_image_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return new_image_ID;
+}
+
/**
* gimp_image_delete:
* @image: The image.
@@ -313,6 +503,49 @@ gimp_image_delete (GimpImage *image)
return success;
}
+/**
+ * _gimp_image_delete: (skip)
+ * @image_ID: The image.
+ *
+ * Delete the specified image.
+ *
+ * If there are no displays associated with this image it will be
+ * deleted. This means that you can not delete an image through the PDB
+ * that was created by the user. If the associated display was however
+ * created through the PDB and you know the display ID, you may delete
+ * the display. Removal of the last associated display will then delete
+ * the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_delete (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-delete",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-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_image_base_type:
* @image: The image.
@@ -353,6 +586,46 @@ gimp_image_base_type (GimpImage *image)
return base_type;
}
+/**
+ * _gimp_image_base_type: (skip)
+ * @image_ID: The image.
+ *
+ * Get the base type of the image.
+ *
+ * This procedure returns the image's base type. Layers in the image
+ * must be of this subtype, but can have an optional alpha channel.
+ *
+ * Returns: The image's base type.
+ **/
+GimpImageBaseType
+_gimp_image_base_type (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpImageBaseType base_type = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-base-type",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-base-type",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ base_type = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return base_type;
+}
+
/**
* gimp_image_get_precision:
* @image: The image.
@@ -395,40 +668,122 @@ gimp_image_get_precision (GimpImage *image)
}
/**
- * gimp_image_get_default_new_layer_mode:
- * @image: The image.
+ * _gimp_image_get_precision: (skip)
+ * @image_ID: The image.
*
- * Get the default mode for newly created layers of this image.
+ * Get the precision of the image.
*
- * Returns the default mode for newly created layers of this image.
+ * This procedure returns the image's precision.
*
- * Returns: The layer mode.
+ * Returns: The image's precision.
*
* Since: 2.10
**/
-GimpLayerMode
-gimp_image_get_default_new_layer_mode (GimpImage *image)
+GimpPrecision
+_gimp_image_get_precision (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- GimpLayerMode mode = 0;
+ GimpPrecision precision = 0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-default-new-layer-mode",
+ "gimp-image-get-precision",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-default-new-layer-mode",
+ return_vals = gimp_run_procedure_array ("gimp-image-get-precision",
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));
+ precision = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return precision;
+}
+
+/**
+ * gimp_image_get_default_new_layer_mode:
+ * @image: The image.
+ *
+ * Get the default mode for newly created layers of this image.
+ *
+ * Returns the default mode for newly created layers of this image.
+ *
+ * Returns: The layer mode.
+ *
+ * Since: 2.10
+ **/
+GimpLayerMode
+gimp_image_get_default_new_layer_mode (GimpImage *image)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpLayerMode mode = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-default-new-layer-mode",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-default-new-layer-mode",
+ 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));
+
+ gimp_value_array_unref (return_vals);
+
+ return mode;
+}
+
+/**
+ * _gimp_image_get_default_new_layer_mode: (skip)
+ * @image_ID: The image.
+ *
+ * Get the default mode for newly created layers of this image.
+ *
+ * Returns the default mode for newly created layers of this image.
+ *
+ * Returns: The layer mode.
+ *
+ * Since: 2.10
+ **/
+GimpLayerMode
+_gimp_image_get_default_new_layer_mode (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpLayerMode mode = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-default-new-layer-mode",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-default-new-layer-mode",
+ 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));
gimp_value_array_unref (return_vals);
@@ -475,6 +830,46 @@ gimp_image_width (GimpImage *image)
return width;
}
+/**
+ * _gimp_image_width: (skip)
+ * @image_ID: The image.
+ *
+ * Return the width of the image
+ *
+ * This procedure returns the image's width. This value is independent
+ * of any of the layers in this image. This is the \"canvas\" width.
+ *
+ * Returns: The image's width.
+ **/
+gint
+_gimp_image_width (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint width = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-width",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-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_image_height:
* @image: The image.
@@ -515,6 +910,46 @@ gimp_image_height (GimpImage *image)
return height;
}
+/**
+ * _gimp_image_height: (skip)
+ * @image_ID: The image.
+ *
+ * Return the height of the image
+ *
+ * This procedure returns the image's height. This value is independent
+ * of any of the layers in this image. This is the \"canvas\" height.
+ *
+ * Returns: The image's height.
+ **/
+gint
+_gimp_image_height (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint height = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-height",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-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_image_get_layers:
* @image: The image.
@@ -564,6 +999,55 @@ gimp_image_get_layers (GimpImage *image,
return layer_ids;
}
+/**
+ * _gimp_image_get_layers: (skip)
+ * @image_ID: The image.
+ * @num_layers: (out): The number of layers contained in the image.
+ *
+ * Returns the list of layers contained in the specified image.
+ *
+ * This procedure returns the list of layers contained in the specified
+ * image. The order of layers is from topmost to bottommost.
+ *
+ * Returns: (array length=num_layers):
+ * The list of layers contained in the image.
+ * The returned value must be freed with g_free().
+ **/
+gint *
+_gimp_image_get_layers (gint32 image_ID,
+ gint *num_layers)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint *layer_ids = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-layers",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-layers",
+ args);
+ gimp_value_array_unref (args);
+
+ *num_layers = 0;
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ {
+ *num_layers = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ layer_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return layer_ids;
+}
+
/**
* gimp_image_get_channels:
* @image: The image.
@@ -616,6 +1100,58 @@ gimp_image_get_channels (GimpImage *image,
return channel_ids;
}
+/**
+ * _gimp_image_get_channels: (skip)
+ * @image_ID: The image.
+ * @num_channels: (out): The number of channels contained in the image.
+ *
+ * Returns the list of channels contained in the specified image.
+ *
+ * This procedure returns the list of channels contained in the
+ * specified image. This does not include the selection mask, or layer
+ * masks. The order is from topmost to bottommost. Note that
+ * \"channels\" are custom channels and do not include the image's
+ * color components.
+ *
+ * Returns: (array length=num_channels):
+ * The list of channels contained in the image.
+ * The returned value must be freed with g_free().
+ **/
+gint *
+_gimp_image_get_channels (gint32 image_ID,
+ gint *num_channels)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint *channel_ids = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-channels",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-channels",
+ 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));
+ channel_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return channel_ids;
+}
+
/**
* gimp_image_get_vectors:
* @image: The image.
@@ -668,22 +1204,73 @@ gimp_image_get_vectors (GimpImage *image,
}
/**
- * gimp_image_get_active_drawable:
- * @image: The image.
+ * _gimp_image_get_vectors: (skip)
+ * @image_ID: The image.
+ * @num_vectors: (out): The number of vectors contained in the image.
*
- * Get the image's active drawable
+ * Returns the list of vectors contained in the specified image.
*
- * This procedure returns the ID of the image's active drawable. This
- * can be either a layer, a channel, or a layer mask. The active
- * drawable is specified by the active image channel. If that is -1,
- * then by the active image layer. If the active image layer has a
- * layer mask and the layer mask is in edit mode, then the layer mask
- * is the active drawable.
+ * This procedure returns the list of vectors contained in the
+ * specified image.
*
- * Returns: The active drawable.
- **/
-gint32
-gimp_image_get_active_drawable (GimpImage *image)
+ * Returns: (array length=num_vectors):
+ * The list of vectors contained in the image.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.4
+ **/
+gint *
+_gimp_image_get_vectors (gint32 image_ID,
+ gint *num_vectors)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint *vector_ids = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-vectors",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-vectors",
+ args);
+ gimp_value_array_unref (args);
+
+ *num_vectors = 0;
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ {
+ *num_vectors = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ vector_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return vector_ids;
+}
+
+/**
+ * gimp_image_get_active_drawable:
+ * @image: The image.
+ *
+ * Get the image's active drawable
+ *
+ * This procedure returns the ID of the image's active drawable. This
+ * can be either a layer, a channel, or a layer mask. The active
+ * drawable is specified by the active image channel. If that is -1,
+ * then by the active image layer. If the active image layer has a
+ * layer mask and the layer mask is in edit mode, then the layer mask
+ * is the active drawable.
+ *
+ * Returns: The active drawable.
+ **/
+gint32
+gimp_image_get_active_drawable (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -711,6 +1298,50 @@ gimp_image_get_active_drawable (GimpImage *image)
return drawable_ID;
}
+/**
+ * _gimp_image_get_active_drawable: (skip)
+ * @image_ID: The image.
+ *
+ * Get the image's active drawable
+ *
+ * This procedure returns the ID of the image's active drawable. This
+ * can be either a layer, a channel, or a layer mask. The active
+ * drawable is specified by the active image channel. If that is -1,
+ * then by the active image layer. If the active image layer has a
+ * layer mask and the layer mask is in edit mode, then the layer mask
+ * is the active drawable.
+ *
+ * Returns: The active drawable.
+ **/
+gint32
+_gimp_image_get_active_drawable (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 drawable_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-active-drawable",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-active-drawable",
+ args);
+ 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));
+
+ gimp_value_array_unref (return_vals);
+
+ return drawable_ID;
+}
+
/**
* gimp_image_unset_active_channel:
* @image: The image.
@@ -752,6 +1383,47 @@ gimp_image_unset_active_channel (GimpImage *image)
return success;
}
+/**
+ * _gimp_image_unset_active_channel: (skip)
+ * @image_ID: The image.
+ *
+ * Unsets the active channel in the specified image.
+ *
+ * If an active channel exists, it is unset. There then exists no
+ * active channel, and if desired, one can be set through a call to
+ * 'Set Active Channel'. No error is returned in the case of no
+ * existing active channel.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_unset_active_channel (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-unset-active-channel",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-unset-active-channel",
+ 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_image_get_floating_sel:
* @image: The image.
@@ -792,6 +1464,46 @@ gimp_image_get_floating_sel (GimpImage *image)
return floating_sel_ID;
}
+/**
+ * _gimp_image_get_floating_sel: (skip)
+ * @image_ID: The image.
+ *
+ * Return the floating selection of the image.
+ *
+ * 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.
+ **/
+gint32
+_gimp_image_get_floating_sel (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 floating_sel_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-floating-sel",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-floating-sel",
+ args);
+ 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));
+
+ gimp_value_array_unref (return_vals);
+
+ return floating_sel_ID;
+}
+
/**
* gimp_image_floating_sel_attached_to:
* @image: The image.
@@ -833,6 +1545,47 @@ gimp_image_floating_sel_attached_to (GimpImage *image)
return drawable_ID;
}
+/**
+ * _gimp_image_floating_sel_attached_to: (skip)
+ * @image_ID: The image.
+ *
+ * Return the drawable the floating selection is attached to.
+ *
+ * This procedure returns the drawable the image's floating selection
+ * 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.
+ **/
+gint32
+_gimp_image_floating_sel_attached_to (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 drawable_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-floating-sel-attached-to",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-floating-sel-attached-to",
+ args);
+ 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));
+
+ gimp_value_array_unref (return_vals);
+
+ return drawable_ID;
+}
+
/**
* gimp_image_pick_color:
* @image: The image.
@@ -905,47 +1658,167 @@ gimp_image_pick_color (GimpImage *image,
}
/**
- * gimp_image_pick_correlate_layer:
- * @image: The image.
- * @x: The x coordinate for the pick.
- * @y: The y coordinate for the pick.
+ * _gimp_image_pick_color: (skip)
+ * @image_ID: The image.
+ * @drawable_ID: 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.
+ * @sample_average: Average the color of all the pixels in a specified radius.
+ * @average_radius: The radius of pixels to average.
+ * @color: (out caller-allocates): The return color.
*
- * Find the layer visible at the specified coordinates.
+ * Determine the color at the given drawable coordinates
*
- * This procedure finds the layer which is visible at the specified
- * coordinates. Layers which do not qualify are those whose extents do
- * not pass within the specified coordinates, or which are transparent
- * at the specified coordinates. This procedure will return -1 if no
- * layer is found.
+ * This tool determines the color at the specified coordinates. The
+ * returned color is an RGB triplet even for grayscale and indexed
+ * drawables. If the coordinates lie outside of the extents of the
+ * specified drawable, then an error is returned. If the drawable has
+ * an alpha channel, the algorithm examines the alpha value of the
+ * drawable at the coordinates. If the alpha value is completely
+ * transparent (0), then an error is returned. If the sample_merged
+ * parameter is TRUE, the data of the composite image will be used
+ * instead of that for the specified drawable. This is equivalent to
+ * sampling for colors after merging all visible layers. In the case of
+ * a merged sampling, the supplied drawable is ignored.
*
- * Returns: The layer found at the specified coordinates.
+ * Returns: TRUE on success.
**/
-gint32
-gimp_image_pick_correlate_layer (GimpImage *image,
- gint x,
- gint y)
+gboolean
+_gimp_image_pick_color (gint32 image_ID,
+ gint32 drawable_ID,
+ gdouble x,
+ gdouble y,
+ gboolean sample_merged,
+ gboolean sample_average,
+ gdouble average_radius,
+ GimpRGB *color)
{
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_IMAGE_ID, gimp_image_get_id (image),
- G_TYPE_INT, x,
- G_TYPE_INT, y,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_DOUBLE, x,
+ G_TYPE_DOUBLE, y,
+ G_TYPE_BOOLEAN, sample_merged,
+ G_TYPE_BOOLEAN, sample_average,
+ G_TYPE_DOUBLE, average_radius,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-pick-correlate-layer",
+ "gimp-image-pick-color",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-pick-correlate-layer",
+ return_vals = gimp_run_procedure_array ("gimp-image-pick-color",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ 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_image_pick_correlate_layer:
+ * @image: The image.
+ * @x: The x coordinate for the pick.
+ * @y: The y coordinate for the pick.
+ *
+ * Find the layer visible at the specified coordinates.
+ *
+ * This procedure finds the layer which is visible at the specified
+ * coordinates. Layers which do not qualify are those whose extents do
+ * not pass within the specified coordinates, or which are transparent
+ * at the specified coordinates. This procedure will return -1 if no
+ * layer is found.
+ *
+ * Returns: The layer found at the specified coordinates.
+ **/
+gint32
+gimp_image_pick_correlate_layer (GimpImage *image,
+ gint x,
+ gint y)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 layer_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_INT, x,
+ G_TYPE_INT, y,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-pick-correlate-layer",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-pick-correlate-layer",
+ 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_image_pick_correlate_layer: (skip)
+ * @image_ID: The image.
+ * @x: The x coordinate for the pick.
+ * @y: The y coordinate for the pick.
+ *
+ * Find the layer visible at the specified coordinates.
+ *
+ * This procedure finds the layer which is visible at the specified
+ * coordinates. Layers which do not qualify are those whose extents do
+ * not pass within the specified coordinates, or which are transparent
+ * at the specified coordinates. This procedure will return -1 if no
+ * layer is found.
+ *
+ * Returns: The layer found at the specified coordinates.
+ **/
+gint32
+_gimp_image_pick_correlate_layer (gint32 image_ID,
+ gint x,
+ gint y)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 layer_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_INT, x,
+ G_TYPE_INT, y,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-pick-correlate-layer",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-pick-correlate-layer",
+ 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);
@@ -1011,23 +1884,33 @@ gimp_image_insert_layer (GimpImage *image,
}
/**
- * gimp_image_remove_layer:
- * @image: The image.
+ * _gimp_image_insert_layer: (skip)
+ * @image_ID: The image.
* @layer_ID: The layer.
+ * @parent_ID: The parent layer.
+ * @position: The layer position.
*
- * Remove the specified layer from the image.
+ * Add the specified layer to the image.
*
- * This procedure removes the specified layer from the image. If the
- * layer doesn't exist, an error is returned. If there are no layers
- * left in the image, this call will fail. If this layer is the last
- * layer remaining, the image will become empty and have no active
- * layer.
+ * This procedure adds the specified layer to the image at the given
+ * position. If the specified parent is a valid layer group (See
+ * gimp_item_is_group() and gimp_layer_group_new()) then the layer is
+ * added inside the group. If the parent is 0, the layer is added
+ * inside the main stack, outside of any group. The position argument
+ * specifies the location of the layer inside the stack (or the group,
+ * if a valid parent was supplied), starting from the top (0) and
+ * increasing. If the position is specified as -1 and the parent is
+ * specified as 0, then the layer is inserted above the active layer,
+ * or inside the group if the active layer is a layer group. The layer
+ * type must be compatible with the image base type.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_image_remove_layer (GimpImage *image,
- gint32 layer_ID)
+_gimp_image_insert_layer (gint32 image_ID,
+ gint32 layer_ID,
+ gint32 parent_ID,
+ gint position)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1035,16 +1918,18 @@ gimp_image_remove_layer (GimpImage *image,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_IMAGE_ID, image_ID,
GIMP_TYPE_LAYER_ID, layer_ID,
+ GIMP_TYPE_LAYER_ID, parent_ID,
+ G_TYPE_INT, position,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-remove-layer",
+ "gimp-image-insert-layer",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-remove-layer",
+ return_vals = gimp_run_procedure_array ("gimp-image-insert-layer",
args);
gimp_value_array_unref (args);
@@ -1056,25 +1941,23 @@ gimp_image_remove_layer (GimpImage *image,
}
/**
- * gimp_image_freeze_layers:
+ * gimp_image_remove_layer:
* @image: The image.
+ * @layer_ID: The layer.
*
- * Freeze the image's layer list.
- *
- * This procedure freezes the layer list of the image, suppressing any
- * updates to the Layers dialog in response to changes to the image's
- * layers. This can significantly improve performance while applying
- * changes affecting the layer list.
+ * Remove the specified layer from the image.
*
- * Each call to gimp_image_freeze_layers() should be matched by a
- * corresponding call to gimp_image_thaw_layers(), undoing its effects.
+ * This procedure removes the specified layer from the image. If the
+ * layer doesn't exist, an error is returned. If there are no layers
+ * left in the image, this call will fail. If this layer is the last
+ * layer remaining, the image will become empty and have no active
+ * layer.
*
* Returns: TRUE on success.
- *
- * Since: 2.10.2
**/
gboolean
-gimp_image_freeze_layers (GimpImage *image)
+gimp_image_remove_layer (GimpImage *image,
+ gint32 layer_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1083,14 +1966,15 @@ gimp_image_freeze_layers (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,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-freeze-layers",
+ "gimp-image-remove-layer",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-freeze-layers",
+ return_vals = gimp_run_procedure_array ("gimp-image-remove-layer",
args);
gimp_value_array_unref (args);
@@ -1102,23 +1986,23 @@ gimp_image_freeze_layers (GimpImage *image)
}
/**
- * gimp_image_thaw_layers:
- * @image: The image.
- *
- * Thaw the image's layer list.
+ * _gimp_image_remove_layer: (skip)
+ * @image_ID: The image.
+ * @layer_ID: The layer.
*
- * This procedure thaws the layer list of the image, re-enabling
- * updates to the Layers dialog.
+ * Remove the specified layer from the image.
*
- * This procedure should match a corresponding call to
- * gimp_image_freeze_layers().
+ * This procedure removes the specified layer from the image. If the
+ * layer doesn't exist, an error is returned. If there are no layers
+ * left in the image, this call will fail. If this layer is the last
+ * layer remaining, the image will become empty and have no active
+ * layer.
*
* Returns: TRUE on success.
- *
- * Since: 2.10.2
**/
gboolean
-gimp_image_thaw_layers (GimpImage *image)
+_gimp_image_remove_layer (gint32 image_ID,
+ gint32 layer_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1126,15 +2010,16 @@ gimp_image_thaw_layers (GimpImage *image)
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_LAYER_ID, layer_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-thaw-layers",
+ "gimp-image-remove-layer",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-thaw-layers",
+ return_vals = gimp_run_procedure_array ("gimp-image-remove-layer",
args);
gimp_value_array_unref (args);
@@ -1146,28 +2031,25 @@ gimp_image_thaw_layers (GimpImage *image)
}
/**
- * gimp_image_insert_channel:
+ * gimp_image_freeze_layers:
* @image: The image.
- * @channel_ID: The channel.
- * @parent_ID: The parent channel.
- * @position: The channel position.
*
- * Add the specified channel to the image.
+ * Freeze the image's layer list.
*
- * This procedure adds the specified channel to the image at the given
- * position. Since channel groups are not currently supported, the
- * parent argument must always be 0. The position argument specifies
- * the location of the channel inside the stack, starting from the top
- * (0) and increasing. If the position is specified as -1, then the
- * channel is inserted above the active channel.
+ * This procedure freezes the layer list of the image, suppressing any
+ * updates to the Layers dialog in response to changes to the image's
+ * layers. This can significantly improve performance while applying
+ * changes affecting the layer list.
+ *
+ * Each call to gimp_image_freeze_layers() should be matched by a
+ * corresponding call to gimp_image_thaw_layers(), undoing its effects.
*
* Returns: TRUE on success.
+ *
+ * Since: 2.10.2
**/
gboolean
-gimp_image_insert_channel (GimpImage *image,
- gint32 channel_ID,
- gint32 parent_ID,
- gint position)
+gimp_image_freeze_layers (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1176,17 +2058,14 @@ gimp_image_insert_channel (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_CHANNEL_ID, channel_ID,
- GIMP_TYPE_CHANNEL_ID, parent_ID,
- G_TYPE_INT, position,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-insert-channel",
+ "gimp-image-freeze-layers",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-insert-channel",
+ return_vals = gimp_run_procedure_array ("gimp-image-freeze-layers",
args);
gimp_value_array_unref (args);
@@ -1198,20 +2077,25 @@ gimp_image_insert_channel (GimpImage *image,
}
/**
- * gimp_image_remove_channel:
- * @image: The image.
- * @channel_ID: The channel.
+ * _gimp_image_freeze_layers: (skip)
+ * @image_ID: The image.
*
- * Remove the specified channel from the image.
+ * Freeze the image's layer list.
*
- * This procedure removes the specified channel from the image. If the
- * channel doesn't exist, an error is returned.
+ * This procedure freezes the layer list of the image, suppressing any
+ * updates to the Layers dialog in response to changes to the image's
+ * layers. This can significantly improve performance while applying
+ * changes affecting the layer list.
+ *
+ * Each call to gimp_image_freeze_layers() should be matched by a
+ * corresponding call to gimp_image_thaw_layers(), undoing its effects.
*
* Returns: TRUE on success.
+ *
+ * Since: 2.10.2
**/
gboolean
-gimp_image_remove_channel (GimpImage *image,
- gint32 channel_ID)
+_gimp_image_freeze_layers (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1219,16 +2103,15 @@ gimp_image_remove_channel (GimpImage *image,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_CHANNEL_ID, channel_ID,
+ GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-remove-channel",
+ "gimp-image-freeze-layers",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-remove-channel",
+ return_vals = gimp_run_procedure_array ("gimp-image-freeze-layers",
args);
gimp_value_array_unref (args);
@@ -1240,26 +2123,23 @@ gimp_image_remove_channel (GimpImage *image,
}
/**
- * gimp_image_freeze_channels:
+ * gimp_image_thaw_layers:
* @image: The image.
*
- * Freeze the image's channel list.
+ * Thaw the image's layer list.
*
- * This procedure freezes the channel list of the image, suppressing
- * any updates to the Channels dialog in response to changes to the
- * image's channels. This can significantly improve performance while
- * applying changes affecting the channel list.
+ * This procedure thaws the layer list of the image, re-enabling
+ * updates to the Layers dialog.
*
- * Each call to gimp_image_freeze_channels() should be matched by a
- * corresponding call to gimp_image_thaw_channels(), undoing its
- * effects.
+ * This procedure should match a corresponding call to
+ * gimp_image_freeze_layers().
*
* Returns: TRUE on success.
*
* Since: 2.10.2
**/
gboolean
-gimp_image_freeze_channels (GimpImage *image)
+gimp_image_thaw_layers (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1272,10 +2152,10 @@ gimp_image_freeze_channels (GimpImage *image)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-freeze-channels",
+ "gimp-image-thaw-layers",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-freeze-channels",
+ return_vals = gimp_run_procedure_array ("gimp-image-thaw-layers",
args);
gimp_value_array_unref (args);
@@ -1287,23 +2167,23 @@ gimp_image_freeze_channels (GimpImage *image)
}
/**
- * gimp_image_thaw_channels:
- * @image: The image.
+ * _gimp_image_thaw_layers: (skip)
+ * @image_ID: The image.
*
- * Thaw the image's channel list.
+ * Thaw the image's layer list.
*
- * This procedure thaws the channel list of the image, re-enabling
- * updates to the Channels dialog.
+ * This procedure thaws the layer list of the image, re-enabling
+ * updates to the Layers dialog.
*
* This procedure should match a corresponding call to
- * gimp_image_freeze_channels().
+ * gimp_image_freeze_layers().
*
* Returns: TRUE on success.
*
* Since: 2.10.2
**/
gboolean
-gimp_image_thaw_channels (GimpImage *image)
+_gimp_image_thaw_layers (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1311,15 +2191,15 @@ gimp_image_thaw_channels (GimpImage *image)
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-thaw-channels",
+ "gimp-image-thaw-layers",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-thaw-channels",
+ return_vals = gimp_run_procedure_array ("gimp-image-thaw-layers",
args);
gimp_value_array_unref (args);
@@ -1331,26 +2211,26 @@ gimp_image_thaw_channels (GimpImage *image)
}
/**
- * gimp_image_insert_vectors:
+ * gimp_image_insert_channel:
* @image: The image.
- * @vectors_ID: The vectors.
- * @parent_ID: The parent vectors.
- * @position: The vectors position.
+ * @channel_ID: The channel.
+ * @parent_ID: The parent channel.
+ * @position: The channel position.
*
- * Add the specified vectors to the image.
+ * Add the specified channel to the image.
*
- * This procedure adds the specified vectors to the image at the given
- * position. Since vectors groups are not currently supported, the
+ * This procedure adds the specified channel to the image at the given
+ * position. Since channel groups are not currently supported, the
* parent argument must always be 0. The position argument specifies
- * the location of the vectors inside the stack, starting from the top
+ * the location of the channel inside the stack, starting from the top
* (0) and increasing. If the position is specified as -1, then the
- * vectors is inserted above the active vectors.
+ * channel is inserted above the active channel.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_image_insert_vectors (GimpImage *image,
- gint32 vectors_ID,
+gimp_image_insert_channel (GimpImage *image,
+ gint32 channel_ID,
gint32 parent_ID,
gint position)
{
@@ -1361,17 +2241,17 @@ gimp_image_insert_vectors (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_VECTORS_ID, vectors_ID,
- GIMP_TYPE_VECTORS_ID, parent_ID,
+ GIMP_TYPE_CHANNEL_ID, channel_ID,
+ GIMP_TYPE_CHANNEL_ID, parent_ID,
G_TYPE_INT, position,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-insert-vectors",
+ "gimp-image-insert-channel",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-insert-vectors",
+ return_vals = gimp_run_procedure_array ("gimp-image-insert-channel",
args);
gimp_value_array_unref (args);
@@ -1383,22 +2263,28 @@ gimp_image_insert_vectors (GimpImage *image,
}
/**
- * gimp_image_remove_vectors:
- * @image: The image.
- * @vectors_ID: The vectors object.
+ * _gimp_image_insert_channel: (skip)
+ * @image_ID: The image.
+ * @channel_ID: The channel.
+ * @parent_ID: The parent channel.
+ * @position: The channel position.
*
- * Remove the specified path from the image.
+ * Add the specified channel to the image.
*
- * This procedure removes the specified path from the image. If the
- * path doesn't exist, an error is returned.
+ * This procedure adds the specified channel to the image at the given
+ * position. Since channel groups are not currently supported, the
+ * parent argument must always be 0. The position argument specifies
+ * the location of the channel inside the stack, starting from the top
+ * (0) and increasing. If the position is specified as -1, then the
+ * channel is inserted above the active channel.
*
* Returns: TRUE on success.
- *
- * Since: 2.4
**/
gboolean
-gimp_image_remove_vectors (GimpImage *image,
- gint32 vectors_ID)
+_gimp_image_insert_channel (gint32 image_ID,
+ gint32 channel_ID,
+ gint32 parent_ID,
+ gint position)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1406,16 +2292,18 @@ gimp_image_remove_vectors (GimpImage *image,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_VECTORS_ID, vectors_ID,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_CHANNEL_ID, channel_ID,
+ GIMP_TYPE_CHANNEL_ID, parent_ID,
+ G_TYPE_INT, position,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-remove-vectors",
+ "gimp-image-insert-channel",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-remove-vectors",
+ return_vals = gimp_run_procedure_array ("gimp-image-insert-channel",
args);
gimp_value_array_unref (args);
@@ -1427,26 +2315,20 @@ gimp_image_remove_vectors (GimpImage *image,
}
/**
- * gimp_image_freeze_vectors:
+ * gimp_image_remove_channel:
* @image: The image.
+ * @channel_ID: The channel.
*
- * Freeze the image's vectors list.
- *
- * This procedure freezes the vectors list of the image, suppressing
- * any updates to the Paths dialog in response to changes to the
- * image's vectors. This can significantly improve performance while
- * applying changes affecting the vectors list.
+ * Remove the specified channel from the image.
*
- * Each call to gimp_image_freeze_vectors() should be matched by a
- * corresponding call to gimp_image_thaw_vectors(), undoing its
- * effects.
+ * This procedure removes the specified channel from the image. If the
+ * channel doesn't exist, an error is returned.
*
* Returns: TRUE on success.
- *
- * Since: 2.10.2
**/
gboolean
-gimp_image_freeze_vectors (GimpImage *image)
+gimp_image_remove_channel (GimpImage *image,
+ gint32 channel_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1455,14 +2337,15 @@ gimp_image_freeze_vectors (GimpImage *image)
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_CHANNEL_ID, channel_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-freeze-vectors",
+ "gimp-image-remove-channel",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-freeze-vectors",
+ return_vals = gimp_run_procedure_array ("gimp-image-remove-channel",
args);
gimp_value_array_unref (args);
@@ -1474,23 +2357,20 @@ gimp_image_freeze_vectors (GimpImage *image)
}
/**
- * gimp_image_thaw_vectors:
- * @image: The image.
- *
- * Thaw the image's vectors list.
+ * _gimp_image_remove_channel: (skip)
+ * @image_ID: The image.
+ * @channel_ID: The channel.
*
- * This procedure thaws the vectors list of the image, re-enabling
- * updates to the Paths dialog.
+ * Remove the specified channel from the image.
*
- * This procedure should match a corresponding call to
- * gimp_image_freeze_vectors().
+ * This procedure removes the specified channel from the image. If the
+ * channel doesn't exist, an error is returned.
*
* Returns: TRUE on success.
- *
- * Since: 2.10.2
**/
gboolean
-gimp_image_thaw_vectors (GimpImage *image)
+_gimp_image_remove_channel (gint32 image_ID,
+ gint32 channel_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1498,15 +2378,16 @@ gimp_image_thaw_vectors (GimpImage *image)
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_CHANNEL_ID, channel_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-thaw-vectors",
+ "gimp-image-remove-channel",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-thaw-vectors",
+ return_vals = gimp_run_procedure_array ("gimp-image-remove-channel",
args);
gimp_value_array_unref (args);
@@ -1518,69 +2399,73 @@ gimp_image_thaw_vectors (GimpImage *image)
}
/**
- * gimp_image_get_item_position:
+ * gimp_image_freeze_channels:
* @image: The image.
- * @item_ID: The item.
*
- * Returns the position of the item in its level of its item tree.
+ * Freeze the image's channel list.
*
- * This procedure determines the position of the specified item in its
- * level in its item tree in the image. If the item doesn't exist in
- * the image, or the item is not part of an item tree, an error is
- * returned.
+ * This procedure freezes the channel list of the image, suppressing
+ * any updates to the Channels dialog in response to changes to the
+ * image's channels. This can significantly improve performance while
+ * applying changes affecting the channel list.
*
- * Returns: The position of the item in its level in the item tree.
+ * Each call to gimp_image_freeze_channels() should be matched by a
+ * corresponding call to gimp_image_thaw_channels(), undoing its
+ * effects.
*
- * Since: 2.8
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10.2
**/
-gint
-gimp_image_get_item_position (GimpImage *image,
- gint32 item_ID)
+gboolean
+gimp_image_freeze_channels (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint position = 0;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_ITEM_ID, item_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-item-position",
+ "gimp-image-freeze-channels",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-item-position",
+ return_vals = gimp_run_procedure_array ("gimp-image-freeze-channels",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- position = g_value_get_int (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 position;
+ return success;
}
/**
- * gimp_image_raise_item:
- * @image: The image.
- * @item_ID: The item to raise.
+ * _gimp_image_freeze_channels: (skip)
+ * @image_ID: The image.
*
- * Raise the specified item in its level in its item tree
+ * Freeze the image's channel list.
*
- * This procedure raises the specified item one step in the item tree.
- * The procedure call will fail if there is no item above it.
+ * This procedure freezes the channel list of the image, suppressing
+ * any updates to the Channels dialog in response to changes to the
+ * image's channels. This can significantly improve performance while
+ * applying changes affecting the channel list.
+ *
+ * Each call to gimp_image_freeze_channels() should be matched by a
+ * corresponding call to gimp_image_thaw_channels(), undoing its
+ * effects.
*
* Returns: TRUE on success.
*
- * Since: 2.8
+ * Since: 2.10.2
**/
gboolean
-gimp_image_raise_item (GimpImage *image,
- gint32 item_ID)
+_gimp_image_freeze_channels (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1588,16 +2473,15 @@ gimp_image_raise_item (GimpImage *image,
gboolean success = TRUE;
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_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-raise-item",
+ "gimp-image-freeze-channels",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-raise-item",
+ return_vals = gimp_run_procedure_array ("gimp-image-freeze-channels",
args);
gimp_value_array_unref (args);
@@ -1609,22 +2493,23 @@ gimp_image_raise_item (GimpImage *image,
}
/**
- * gimp_image_lower_item:
+ * gimp_image_thaw_channels:
* @image: The image.
- * @item_ID: The item to lower.
*
- * Lower the specified item in its level in its item tree
+ * Thaw the image's channel list.
*
- * This procedure lowers the specified item one step in the item tree.
- * The procedure call will fail if there is no item below it.
+ * This procedure thaws the channel list of the image, re-enabling
+ * updates to the Channels dialog.
+ *
+ * This procedure should match a corresponding call to
+ * gimp_image_freeze_channels().
*
* Returns: TRUE on success.
*
- * Since: 2.8
+ * Since: 2.10.2
**/
gboolean
-gimp_image_lower_item (GimpImage *image,
- gint32 item_ID)
+gimp_image_thaw_channels (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1633,15 +2518,14 @@ 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,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-lower-item",
+ "gimp-image-thaw-channels",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-lower-item",
+ return_vals = gimp_run_procedure_array ("gimp-image-thaw-channels",
args);
gimp_value_array_unref (args);
@@ -1653,22 +2537,23 @@ gimp_image_lower_item (GimpImage *image,
}
/**
- * gimp_image_raise_item_to_top:
- * @image: The image.
- * @item_ID: The item to raise to top.
+ * _gimp_image_thaw_channels: (skip)
+ * @image_ID: The image.
*
- * Raise the specified item to the top of its level in its item tree
+ * Thaw the image's channel list.
*
- * This procedure raises the specified item to top of its level in the
- * item tree. It will not move the item if there is no item above it.
+ * This procedure thaws the channel list of the image, re-enabling
+ * updates to the Channels dialog.
+ *
+ * This procedure should match a corresponding call to
+ * gimp_image_freeze_channels().
*
* Returns: TRUE on success.
*
- * Since: 2.8
+ * Since: 2.10.2
**/
gboolean
-gimp_image_raise_item_to_top (GimpImage *image,
- gint32 item_ID)
+_gimp_image_thaw_channels (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1676,16 +2561,15 @@ gimp_image_raise_item_to_top (GimpImage *image,
gboolean success = TRUE;
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_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-raise-item-to-top",
+ "gimp-image-thaw-channels",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-raise-item-to-top",
+ return_vals = gimp_run_procedure_array ("gimp-image-thaw-channels",
args);
gimp_value_array_unref (args);
@@ -1697,23 +2581,28 @@ gimp_image_raise_item_to_top (GimpImage *image,
}
/**
- * gimp_image_lower_item_to_bottom:
+ * gimp_image_insert_vectors:
* @image: The image.
- * @item_ID: The item to lower to bottom.
+ * @vectors_ID: The vectors.
+ * @parent_ID: The parent vectors.
+ * @position: The vectors position.
*
- * Lower the specified item to the bottom of its level in its item tree
+ * Add the specified vectors to the image.
*
- * This procedure lowers the specified item to bottom of its level in
- * the item tree. It will not move the layer if there is no layer below
- * it.
+ * This procedure adds the specified vectors to the image at the given
+ * position. Since vectors groups are not currently supported, the
+ * parent argument must always be 0. The position argument specifies
+ * the location of the vectors inside the stack, starting from the top
+ * (0) and increasing. If the position is specified as -1, then the
+ * vectors is inserted above the active vectors.
*
* Returns: TRUE on success.
- *
- * Since: 2.8
**/
gboolean
-gimp_image_lower_item_to_bottom (GimpImage *image,
- gint32 item_ID)
+gimp_image_insert_vectors (GimpImage *image,
+ gint32 vectors_ID,
+ gint32 parent_ID,
+ gint position)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1722,15 +2611,17 @@ 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,
- G_TYPE_NONE);
-
+ GIMP_TYPE_VECTORS_ID, vectors_ID,
+ GIMP_TYPE_VECTORS_ID, parent_ID,
+ G_TYPE_INT, position,
+ G_TYPE_NONE);
+
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-lower-item-to-bottom",
+ "gimp-image-insert-vectors",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-lower-item-to-bottom",
+ return_vals = gimp_run_procedure_array ("gimp-image-insert-vectors",
args);
gimp_value_array_unref (args);
@@ -1742,25 +2633,28 @@ gimp_image_lower_item_to_bottom (GimpImage *image,
}
/**
- * gimp_image_reorder_item:
- * @image: The image.
- * @item_ID: The item to reorder.
- * @parent_ID: The new parent item.
- * @position: The new position of the item.
+ * _gimp_image_insert_vectors: (skip)
+ * @image_ID: The image.
+ * @vectors_ID: The vectors.
+ * @parent_ID: The parent vectors.
+ * @position: The vectors position.
*
- * Reorder the specified item within its item tree
+ * Add the specified vectors to the image.
*
- * This procedure reorders the specified item within its item tree.
+ * This procedure adds the specified vectors to the image at the given
+ * position. Since vectors groups are not currently supported, the
+ * parent argument must always be 0. The position argument specifies
+ * the location of the vectors inside the stack, starting from the top
+ * (0) and increasing. If the position is specified as -1, then the
+ * vectors is inserted above the active vectors.
*
* Returns: TRUE on success.
- *
- * Since: 2.8
**/
gboolean
-gimp_image_reorder_item (GimpImage *image,
- gint32 item_ID,
- gint32 parent_ID,
- gint position)
+_gimp_image_insert_vectors (gint32 image_ID,
+ gint32 vectors_ID,
+ gint32 parent_ID,
+ gint position)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -1768,18 +2662,18 @@ gimp_image_reorder_item (GimpImage *image,
gboolean success = TRUE;
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_IMAGE_ID, image_ID,
+ GIMP_TYPE_VECTORS_ID, vectors_ID,
+ GIMP_TYPE_VECTORS_ID, parent_ID,
G_TYPE_INT, position,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-reorder-item",
+ "gimp-image-insert-vectors",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-reorder-item",
+ return_vals = gimp_run_procedure_array ("gimp-image-insert-vectors",
args);
gimp_value_array_unref (args);
@@ -1791,217 +2685,205 @@ gimp_image_reorder_item (GimpImage *image,
}
/**
- * gimp_image_flatten:
+ * gimp_image_remove_vectors:
* @image: The image.
+ * @vectors_ID: The vectors object.
*
- * Flatten all visible layers into a single layer. Discard all
- * invisible layers.
+ * Remove the specified path from the image.
*
- * This procedure combines the visible layers in a manner analogous to
- * merging with the CLIP_TO_IMAGE merge type. Non-visible layers are
- * discarded, and the resulting image is stripped of its alpha channel.
+ * This procedure removes the specified path from the image. If the
+ * path doesn't exist, an error is returned.
*
- * Returns: The resulting layer.
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
**/
-gint32
-gimp_image_flatten (GimpImage *image)
+gboolean
+gimp_image_remove_vectors (GimpImage *image,
+ gint32 vectors_ID)
{
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_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_VECTORS_ID, vectors_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-flatten",
+ "gimp-image-remove-vectors",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-flatten",
+ return_vals = gimp_run_procedure_array ("gimp-image-remove-vectors",
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_image_merge_visible_layers:
- * @image: The image.
- * @merge_type: The type of merge.
+ * _gimp_image_remove_vectors: (skip)
+ * @image_ID: The image.
+ * @vectors_ID: The vectors object.
*
- * Merge the visible image layers into one.
+ * Remove the specified path from the image.
*
- * This procedure combines the visible layers into a single layer using
- * the specified merge type. A merge type of EXPAND_AS_NECESSARY
- * expands the final layer to encompass the areas of the visible
- * layers. A merge type of CLIP_TO_IMAGE clips the final layer to the
- * extents of the image. A merge type of CLIP_TO_BOTTOM_LAYER clips the
- * final layer to the size of the bottommost layer.
+ * This procedure removes the specified path from the image. If the
+ * path doesn't exist, an error is returned.
*
- * Returns: The resulting layer.
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
**/
-gint32
-gimp_image_merge_visible_layers (GimpImage *image,
- GimpMergeType merge_type)
+gboolean
+_gimp_image_remove_vectors (gint32 image_ID,
+ gint32 vectors_ID)
{
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_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_MERGE_TYPE, merge_type,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_VECTORS_ID, vectors_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-merge-visible-layers",
+ "gimp-image-remove-vectors",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-merge-visible-layers",
+ return_vals = gimp_run_procedure_array ("gimp-image-remove-vectors",
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_image_merge_down:
+ * gimp_image_freeze_vectors:
* @image: The image.
- * @merge_layer_ID: The layer to merge down from.
- * @merge_type: The type of merge.
*
- * Merge the layer passed and the first visible layer below.
+ * Freeze the image's vectors list.
*
- * This procedure combines the passed layer and the first visible layer
- * below it using the specified merge type. A merge type of
- * EXPAND_AS_NECESSARY expands the final layer to encompass the areas
- * of the visible layers. A merge type of CLIP_TO_IMAGE clips the final
- * layer to the extents of the image. A merge type of
- * CLIP_TO_BOTTOM_LAYER clips the final layer to the size of the
- * bottommost layer.
+ * This procedure freezes the vectors list of the image, suppressing
+ * any updates to the Paths dialog in response to changes to the
+ * image's vectors. This can significantly improve performance while
+ * applying changes affecting the vectors list.
*
- * Returns: The resulting layer.
+ * Each call to gimp_image_freeze_vectors() should be matched by a
+ * corresponding call to gimp_image_thaw_vectors(), undoing its
+ * effects.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10.2
**/
-gint32
-gimp_image_merge_down (GimpImage *image,
- gint32 merge_layer_ID,
- GimpMergeType merge_type)
+gboolean
+gimp_image_freeze_vectors (GimpImage *image)
{
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_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_LAYER_ID, merge_layer_ID,
- GIMP_TYPE_MERGE_TYPE, merge_type,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-merge-down",
+ "gimp-image-freeze-vectors",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-merge-down",
+ return_vals = gimp_run_procedure_array ("gimp-image-freeze-vectors",
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_image_get_colormap:
- * @image: The image.
- * @num_bytes: (out): Number of bytes in the colormap array.
+ * _gimp_image_freeze_vectors: (skip)
+ * @image_ID: The image.
*
- * Returns the image's colormap
+ * Freeze the image's vectors list.
*
- * This procedure returns an actual pointer to the image's colormap, as
- * well as the number of bytes contained in the colormap. The actual
- * number of colors in the transmitted colormap will be 'num-bytes' /
- * 3. If the image is not in Indexed color mode, no colormap is
- * returned.
+ * This procedure freezes the vectors list of the image, suppressing
+ * any updates to the Paths dialog in response to changes to the
+ * image's vectors. This can significantly improve performance while
+ * applying changes affecting the vectors list.
*
- * Returns: (array length=num_bytes) (element-type guint8) (transfer full):
- * The image's colormap.
- * The returned value must be freed with g_free().
+ * Each call to gimp_image_freeze_vectors() should be matched by a
+ * corresponding call to gimp_image_thaw_vectors(), undoing its
+ * effects.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10.2
**/
-guint8 *
-_gimp_image_get_colormap (GimpImage *image,
- gint *num_bytes)
+gboolean
+_gimp_image_freeze_vectors (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- guint8 *colormap = NULL;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-colormap",
+ "gimp-image-freeze-vectors",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-colormap",
+ return_vals = gimp_run_procedure_array ("gimp-image-freeze-vectors",
args);
gimp_value_array_unref (args);
- *num_bytes = 0;
-
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- {
- *num_bytes = g_value_get_int (gimp_value_array_index (return_vals, 1));
- colormap = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 2));
- }
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return colormap;
+ return success;
}
/**
- * _gimp_image_set_colormap:
+ * gimp_image_thaw_vectors:
* @image: The image.
- * @num_bytes: Number of bytes in the colormap array.
- * @colormap: (array length=num_bytes) (element-type guint8): The new colormap values.
*
- * Sets the entries in the image's colormap.
+ * Thaw the image's vectors list.
*
- * This procedure sets the entries in the specified image's colormap.
- * The number of entries is specified by the 'num-bytes' parameter and
- * corresponds to the number of INT8 triples that must be contained in
- * the 'colormap' array. The actual number of colors in the transmitted
- * colormap is 'num-bytes' / 3.
+ * This procedure thaws the vectors list of the image, re-enabling
+ * updates to the Paths dialog.
+ *
+ * This procedure should match a corresponding call to
+ * gimp_image_freeze_vectors().
*
* Returns: TRUE on success.
+ *
+ * Since: 2.10.2
**/
gboolean
-_gimp_image_set_colormap (GimpImage *image,
- gint num_bytes,
- const guint8 *colormap)
+gimp_image_thaw_vectors (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -2010,17 +2892,14 @@ _gimp_image_set_colormap (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- G_TYPE_INT, num_bytes,
- GIMP_TYPE_UINT8_ARRAY, NULL,
G_TYPE_NONE);
- gimp_value_set_uint8_array (gimp_value_array_index (args, 2), colormap, num_bytes);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-set-colormap",
+ "gimp-image-thaw-vectors",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-set-colormap",
+ return_vals = gimp_run_procedure_array ("gimp-image-thaw-vectors",
args);
gimp_value_array_unref (args);
@@ -2032,200 +2911,204 @@ _gimp_image_set_colormap (GimpImage *image,
}
/**
- * _gimp_image_get_metadata:
- * @image: The image.
+ * _gimp_image_thaw_vectors: (skip)
+ * @image_ID: The image.
*
- * Returns the image's metadata.
+ * Thaw the image's vectors list.
*
- * Returns exif/iptc/xmp metadata from the image.
+ * This procedure thaws the vectors list of the image, re-enabling
+ * updates to the Paths dialog.
*
- * Returns: (transfer full): The exif/ptc/xmp metadata as a string.
- * The returned value must be freed with g_free().
+ * This procedure should match a corresponding call to
+ * gimp_image_freeze_vectors().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10.2
**/
-gchar *
-_gimp_image_get_metadata (GimpImage *image)
+gboolean
+_gimp_image_thaw_vectors (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gchar *metadata_string = NULL;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-metadata",
+ "gimp-image-thaw-vectors",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-metadata",
+ return_vals = gimp_run_procedure_array ("gimp-image-thaw-vectors",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- metadata_string = 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 metadata_string;
+ return success;
}
/**
- * _gimp_image_set_metadata:
+ * gimp_image_get_item_position:
* @image: The image.
- * @metadata_string: The exif/ptc/xmp metadata as a string.
+ * @item_ID: The item.
*
- * Set the image's metadata.
+ * Returns the position of the item in its level of its item tree.
*
- * Sets exif/iptc/xmp metadata on the image.
+ * This procedure determines the position of the specified item in its
+ * level in its item tree in the image. If the item doesn't exist in
+ * the image, or the item is not part of an item tree, an error is
+ * returned.
*
- * Returns: TRUE on success.
+ * Returns: The position of the item in its level in the item tree.
+ *
+ * Since: 2.8
**/
-gboolean
-_gimp_image_set_metadata (GimpImage *image,
- const gchar *metadata_string)
+gint
+gimp_image_get_item_position (GimpImage *image,
+ gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ gint position = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- G_TYPE_STRING, metadata_string,
+ GIMP_TYPE_ITEM_ID, item_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-set-metadata",
+ "gimp-image-get-item-position",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-set-metadata",
+ return_vals = gimp_run_procedure_array ("gimp-image-get-item-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)
+ position = g_value_get_int (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return position;
}
/**
- * gimp_image_clean_all:
- * @image: The image.
+ * _gimp_image_get_item_position: (skip)
+ * @image_ID: The image.
+ * @item_ID: The item.
*
- * Set the image dirty count to 0.
+ * Returns the position of the item in its level of its item tree.
*
- * This procedure sets the specified image's dirty count to 0, allowing
- * operations to occur without having a 'dirtied' image. This is
- * especially useful for creating and loading images which should not
- * initially be considered dirty, even though layers must be created,
- * filled, and installed in the image. Note that save plug-ins must NOT
- * call this function themselves after saving the image.
+ * This procedure determines the position of the specified item in its
+ * level in its item tree in the image. If the item doesn't exist in
+ * the image, or the item is not part of an item tree, an error is
+ * returned.
*
- * Returns: TRUE on success.
+ * Returns: The position of the item in its level in the item tree.
+ *
+ * Since: 2.8
**/
-gboolean
-gimp_image_clean_all (GimpImage *image)
+gint
+_gimp_image_get_item_position (gint32 image_ID,
+ gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ gint position = 0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_ITEM_ID, item_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-clean-all",
+ "gimp-image-get-item-position",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-clean-all",
+ return_vals = gimp_run_procedure_array ("gimp-image-get-item-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)
+ position = g_value_get_int (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return position;
}
/**
- * gimp_image_is_dirty:
+ * gimp_image_raise_item:
* @image: The image.
+ * @item_ID: The item to raise.
*
- * Checks if the image has unsaved changes.
+ * Raise the specified item in its level in its item tree
*
- * This procedure checks the specified image's dirty count to see if it
- * needs to be saved. Note that saving the image does not automatically
- * set the dirty count to 0, you need to call gimp_image_clean_all()
- * after calling a save procedure to make the image clean.
+ * This procedure raises the specified item one step in the item tree.
+ * The procedure call will fail if there is no item above it.
*
- * Returns: TRUE if the image has unsaved changes.
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
**/
gboolean
-gimp_image_is_dirty (GimpImage *image)
+gimp_image_raise_item (GimpImage *image,
+ gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean dirty = FALSE;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_ITEM_ID, item_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-is-dirty",
+ "gimp-image-raise-item",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-is-dirty",
+ return_vals = gimp_run_procedure_array ("gimp-image-raise-item",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- dirty = 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 dirty;
+ return success;
}
/**
- * _gimp_image_thumbnail:
- * @image: The image.
- * @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) (element-type guint8) (transfer full): The
thumbnail data.
+ * _gimp_image_raise_item: (skip)
+ * @image_ID: The image.
+ * @item_ID: The item to raise.
*
- * Get a thumbnail of an image.
+ * Raise the specified item in its level in its item tree
*
- * This function gets data from which a thumbnail of an image 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 bits per pixel in the image.
+ * This procedure raises the specified item one step in the item tree.
+ * The procedure call will fail if there is no item above it.
*
* Returns: TRUE on success.
+ *
+ * Since: 2.8
**/
gboolean
-_gimp_image_thumbnail (GimpImage *image,
- gint width,
- gint height,
- gint *actual_width,
- gint *actual_height,
- gint *bpp,
- gint *thumbnail_data_count,
- guint8 **thumbnail_data)
+_gimp_image_raise_item (gint32 image_ID,
+ gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -2233,100 +3116,87 @@ _gimp_image_thumbnail (GimpImage *image,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- G_TYPE_INT, width,
- G_TYPE_INT, height,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_ITEM_ID, item_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-thumbnail",
+ "gimp-image-raise-item",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-thumbnail",
+ return_vals = gimp_run_procedure_array ("gimp-image-raise-item",
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_image_get_active_layer:
+ * gimp_image_lower_item:
* @image: The image.
+ * @item_ID: The item to lower.
*
- * Returns the specified image's active layer.
+ * Lower the specified item in its level in its item tree
*
- * If there is an active layer, its ID will be returned, otherwise, -1.
- * If a channel is currently active, then no layer will be. If a layer
- * mask is active, then this will return the associated layer.
+ * This procedure lowers the specified item one step in the item tree.
+ * The procedure call will fail if there is no item below it.
*
- * Returns: The active layer.
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
**/
-gint32
-gimp_image_get_active_layer (GimpImage *image)
+gboolean
+gimp_image_lower_item (GimpImage *image,
+ gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 active_layer_ID = -1;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_ITEM_ID, item_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-active-layer",
+ "gimp-image-lower-item",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-active-layer",
+ return_vals = gimp_run_procedure_array ("gimp-image-lower-item",
args);
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));
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
- return active_layer_ID;
+ return success;
}
/**
- * gimp_image_set_active_layer:
- * @image: The image.
- * @active_layer_ID: The new image active layer.
+ * _gimp_image_lower_item: (skip)
+ * @image_ID: The image.
+ * @item_ID: The item to lower.
*
- * Sets the specified image's active layer.
+ * Lower the specified item in its level in its item tree
*
- * If the layer exists, it is set as the active layer in the image. Any
- * previous active layer or channel is set to inactive. An exception is
- * a previously existing floating selection, in which case this
- * procedure will return an execution error.
+ * This procedure lowers the specified item one step in the item tree.
+ * The procedure call will fail if there is no item below it.
*
* Returns: TRUE on success.
+ *
+ * Since: 2.8
**/
gboolean
-gimp_image_set_active_layer (GimpImage *image,
- gint32 active_layer_ID)
+_gimp_image_lower_item (gint32 image_ID,
+ gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -2334,16 +3204,16 @@ gimp_image_set_active_layer (GimpImage *image,
gboolean success = TRUE;
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_IMAGE_ID, image_ID,
+ GIMP_TYPE_ITEM_ID, item_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-set-active-layer",
+ "gimp-image-lower-item",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-set-active-layer",
+ return_vals = gimp_run_procedure_array ("gimp-image-lower-item",
args);
gimp_value_array_unref (args);
@@ -2355,62 +3225,66 @@ gimp_image_set_active_layer (GimpImage *image,
}
/**
- * gimp_image_get_active_channel:
+ * gimp_image_raise_item_to_top:
* @image: The image.
+ * @item_ID: The item to raise to top.
*
- * Returns the specified image's active channel.
+ * Raise the specified item to the top of its level in its item tree
*
- * If there is an active channel, this will return the channel ID,
- * otherwise, -1.
+ * This procedure raises the specified item to top of its level in the
+ * item tree. It will not move the item if there is no item above it.
*
- * Returns: The active channel.
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
**/
-gint32
-gimp_image_get_active_channel (GimpImage *image)
+gboolean
+gimp_image_raise_item_to_top (GimpImage *image,
+ gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 active_channel_ID = -1;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_ITEM_ID, item_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-active-channel",
+ "gimp-image-raise-item-to-top",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-active-channel",
+ return_vals = gimp_run_procedure_array ("gimp-image-raise-item-to-top",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- active_channel_ID = gimp_value_get_channel_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 active_channel_ID;
+ return success;
}
/**
- * gimp_image_set_active_channel:
- * @image: The image.
- * @active_channel_ID: The new image active channel.
+ * _gimp_image_raise_item_to_top: (skip)
+ * @image_ID: The image.
+ * @item_ID: The item to raise to top.
*
- * Sets the specified image's active channel.
+ * Raise the specified item to the top of its level in its item tree
*
- * If the channel exists, it is set as the active channel in the image.
- * Any previous active channel or layer is set to inactive. An
- * exception is a previously existing floating selection, in which case
- * this procedure will return an execution error.
+ * This procedure raises the specified item to top of its level in the
+ * item tree. It will not move the item if there is no item above it.
*
* Returns: TRUE on success.
+ *
+ * Since: 2.8
**/
gboolean
-gimp_image_set_active_channel (GimpImage *image,
- gint32 active_channel_ID)
+_gimp_image_raise_item_to_top (gint32 image_ID,
+ gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -2418,16 +3292,16 @@ gimp_image_set_active_channel (GimpImage *image,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_CHANNEL_ID, active_channel_ID,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_ITEM_ID, item_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-set-active-channel",
+ "gimp-image-raise-item-to-top",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-set-active-channel",
+ return_vals = gimp_run_procedure_array ("gimp-image-raise-item-to-top",
args);
gimp_value_array_unref (args);
@@ -2439,58 +3313,68 @@ gimp_image_set_active_channel (GimpImage *image,
}
/**
- * gimp_image_get_active_vectors:
+ * gimp_image_lower_item_to_bottom:
* @image: The image.
+ * @item_ID: The item to lower to bottom.
*
- * Returns the specified image's active vectors.
+ * Lower the specified item to the bottom of its level in its item tree
*
- * If there is an active path, its ID will be returned, otherwise, -1.
+ * This procedure lowers the specified item to bottom of its level in
+ * the item tree. It will not move the layer if there is no layer below
+ * it.
*
- * Returns: The active vectors.
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
**/
-gint32
-gimp_image_get_active_vectors (GimpImage *image)
+gboolean
+gimp_image_lower_item_to_bottom (GimpImage *image,
+ gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 active_vectors_ID = -1;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_ITEM_ID, item_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-active-vectors",
+ "gimp-image-lower-item-to-bottom",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-active-vectors",
+ return_vals = gimp_run_procedure_array ("gimp-image-lower-item-to-bottom",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- active_vectors_ID = gimp_value_get_vectors_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 active_vectors_ID;
+ return success;
}
/**
- * gimp_image_set_active_vectors:
- * @image: The image.
- * @active_vectors_ID: The new image active vectors.
+ * _gimp_image_lower_item_to_bottom: (skip)
+ * @image_ID: The image.
+ * @item_ID: The item to lower to bottom.
*
- * Sets the specified image's active vectors.
+ * Lower the specified item to the bottom of its level in its item tree
*
- * If the path exists, it is set as the active path in the image.
+ * This procedure lowers the specified item to bottom of its level in
+ * the item tree. It will not move the layer if there is no layer below
+ * it.
*
* Returns: TRUE on success.
+ *
+ * Since: 2.8
**/
gboolean
-gimp_image_set_active_vectors (GimpImage *image,
- gint32 active_vectors_ID)
+_gimp_image_lower_item_to_bottom (gint32 image_ID,
+ gint32 item_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -2498,16 +3382,16 @@ gimp_image_set_active_vectors (GimpImage *image,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_VECTORS_ID, active_vectors_ID,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_ITEM_ID, item_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-set-active-vectors",
+ "gimp-image-lower-item-to-bottom",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-set-active-vectors",
+ return_vals = gimp_run_procedure_array ("gimp-image-lower-item-to-bottom",
args);
gimp_value_array_unref (args);
@@ -2519,255 +3403,2077 @@ gimp_image_set_active_vectors (GimpImage *image,
}
/**
- * gimp_image_get_selection:
+ * gimp_image_reorder_item:
* @image: The image.
+ * @item_ID: The item to reorder.
+ * @parent_ID: The new parent item.
+ * @position: The new position of the item.
*
- * Returns the specified image's selection.
+ * Reorder the specified item within its item tree
*
- * This will always return a valid ID for a selection -- which is
- * represented as a channel internally.
+ * This procedure reorders the specified item within its item tree.
*
- * Returns: The selection channel.
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
**/
-gint32
-gimp_image_get_selection (GimpImage *image)
+gboolean
+gimp_image_reorder_item (GimpImage *image,
+ gint32 item_ID,
+ gint32 parent_ID,
+ gint position)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 selection_ID = -1;
+ gboolean success = TRUE;
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,
+ G_TYPE_INT, position,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-selection",
+ "gimp-image-reorder-item",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-selection",
+ return_vals = gimp_run_procedure_array ("gimp-image-reorder-item",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- selection_ID = gimp_value_get_selection_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 selection_ID;
+ return success;
}
/**
- * gimp_image_get_component_active:
- * @image: The image.
- * @component: The image component.
+ * _gimp_image_reorder_item: (skip)
+ * @image_ID: The image.
+ * @item_ID: The item to reorder.
+ * @parent_ID: The new parent item.
+ * @position: The new position of the item.
*
- * Returns if the specified image's image component is active.
+ * Reorder the specified item within its item tree
*
- * This procedure returns if the specified image's image component
- * (i.e. Red, Green, Blue intensity channels in an RGB image) is active
- * or inactive -- whether or not it can be modified. If the specified
- * component is not valid for the image type, an error is returned.
+ * This procedure reorders the specified item within its item tree.
*
- * Returns: Component is active.
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
**/
gboolean
-gimp_image_get_component_active (GimpImage *image,
- GimpChannelType component)
+_gimp_image_reorder_item (gint32 image_ID,
+ gint32 item_ID,
+ gint32 parent_ID,
+ gint position)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean active = FALSE;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_CHANNEL_TYPE, component,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_ITEM_ID, item_ID,
+ GIMP_TYPE_ITEM_ID, parent_ID,
+ G_TYPE_INT, position,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-component-active",
+ "gimp-image-reorder-item",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-component-active",
+ return_vals = gimp_run_procedure_array ("gimp-image-reorder-item",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- active = 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 active;
+ return success;
}
/**
- * gimp_image_set_component_active:
+ * gimp_image_flatten:
* @image: The image.
- * @component: The image component.
- * @active: Component is active.
*
- * Sets if the specified image's image component is active.
+ * Flatten all visible layers into a single layer. Discard all
+ * invisible layers.
*
- * This procedure sets if the specified image's image component (i.e.
- * Red, Green, Blue intensity channels in an RGB image) is active or
- * inactive -- whether or not it can be modified. If the specified
- * component is not valid for the image type, an error is returned.
+ * This procedure combines the visible layers in a manner analogous to
+ * merging with the CLIP_TO_IMAGE merge type. Non-visible layers are
+ * discarded, and the resulting image is stripped of its alpha channel.
*
- * Returns: TRUE on success.
+ * Returns: The resulting layer.
**/
-gboolean
-gimp_image_set_component_active (GimpImage *image,
- GimpChannelType component,
- gboolean active)
+gint32
+gimp_image_flatten (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ gint32 layer_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_CHANNEL_TYPE, component,
- G_TYPE_BOOLEAN, active,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-set-component-active",
+ "gimp-image-flatten",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-set-component-active",
+ return_vals = gimp_run_procedure_array ("gimp-image-flatten",
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)
+ layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return layer_ID;
}
/**
- * gimp_image_get_component_visible:
- * @image: The image.
- * @component: The image component.
+ * _gimp_image_flatten: (skip)
+ * @image_ID: The image.
*
- * Returns if the specified image's image component is visible.
+ * Flatten all visible layers into a single layer. Discard all
+ * invisible layers.
*
- * This procedure returns if the specified image's image component
- * (i.e. Red, Green, Blue intensity channels in an RGB image) is
- * visible or invisible -- whether or not it can be seen. If the
- * specified component is not valid for the image type, an error is
- * returned.
+ * This procedure combines the visible layers in a manner analogous to
+ * merging with the CLIP_TO_IMAGE merge type. Non-visible layers are
+ * discarded, and the resulting image is stripped of its alpha channel.
*
- * Returns: Component is visible.
+ * Returns: The resulting layer.
**/
-gboolean
-gimp_image_get_component_visible (GimpImage *image,
- GimpChannelType component)
+gint32
+_gimp_image_flatten (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean visible = FALSE;
+ gint32 layer_ID = -1;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_CHANNEL_TYPE, component,
+ GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-component-visible",
+ "gimp-image-flatten",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-component-visible",
+ return_vals = gimp_run_procedure_array ("gimp-image-flatten",
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));
+ layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return visible;
+ return layer_ID;
}
/**
- * gimp_image_set_component_visible:
+ * gimp_image_merge_visible_layers:
* @image: The image.
- * @component: The image component.
- * @visible: Component is visible.
+ * @merge_type: The type of merge.
*
- * Sets if the specified image's image component is visible.
+ * Merge the visible image layers into one.
*
- * This procedure sets if the specified image's image component (i.e.
- * Red, Green, Blue intensity channels in an RGB image) is visible or
- * invisible -- whether or not it can be seen. If the specified
- * component is not valid for the image type, an error is returned.
+ * This procedure combines the visible layers into a single layer using
+ * the specified merge type. A merge type of EXPAND_AS_NECESSARY
+ * expands the final layer to encompass the areas of the visible
+ * layers. A merge type of CLIP_TO_IMAGE clips the final layer to the
+ * extents of the image. A merge type of CLIP_TO_BOTTOM_LAYER clips the
+ * final layer to the size of the bottommost layer.
*
- * Returns: TRUE on success.
+ * Returns: The resulting layer.
**/
-gboolean
-gimp_image_set_component_visible (GimpImage *image,
- GimpChannelType component,
- gboolean visible)
+gint32
+gimp_image_merge_visible_layers (GimpImage *image,
+ GimpMergeType merge_type)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ gint32 layer_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_CHANNEL_TYPE, component,
- G_TYPE_BOOLEAN, visible,
+ GIMP_TYPE_MERGE_TYPE, merge_type,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-set-component-visible",
+ "gimp-image-merge-visible-layers",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-set-component-visible",
+ return_vals = gimp_run_procedure_array ("gimp-image-merge-visible-layers",
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)
+ layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return layer_ID;
}
/**
- * gimp_image_get_filename:
- * @image: The image.
+ * _gimp_image_merge_visible_layers: (skip)
+ * @image_ID: The image.
+ * @merge_type: The type of merge.
*
- * Returns the specified image's filename.
+ * Merge the visible image layers into one.
*
- * This procedure returns the specified image's filename in the
- * filesystem encoding. The image has a filename only if it was loaded
- * or imported from a file or has since been saved or exported.
- * Otherwise, this function returns %NULL. See also
- * gimp_image_get_uri().
+ * This procedure combines the visible layers into a single layer using
+ * the specified merge type. A merge type of EXPAND_AS_NECESSARY
+ * expands the final layer to encompass the areas of the visible
+ * layers. A merge type of CLIP_TO_IMAGE clips the final layer to the
+ * extents of the image. A merge type of CLIP_TO_BOTTOM_LAYER clips the
+ * final layer to the size of the bottommost layer.
*
- * Returns: (transfer full): The filename.
- * The returned value must be freed with g_free().
+ * Returns: The resulting layer.
**/
-gchar *
-gimp_image_get_filename (GimpImage *image)
+gint32
+_gimp_image_merge_visible_layers (gint32 image_ID,
+ GimpMergeType merge_type)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gchar *filename = NULL;
+ gint32 layer_ID = -1;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_MERGE_TYPE, merge_type,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-merge-visible-layers",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-merge-visible-layers",
+ 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_image_merge_down:
+ * @image: The image.
+ * @merge_layer_ID: The layer to merge down from.
+ * @merge_type: The type of merge.
+ *
+ * Merge the layer passed and the first visible layer below.
+ *
+ * This procedure combines the passed layer and the first visible layer
+ * below it using the specified merge type. A merge type of
+ * EXPAND_AS_NECESSARY expands the final layer to encompass the areas
+ * of the visible layers. A merge type of CLIP_TO_IMAGE clips the final
+ * layer to the 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.
+ **/
+gint32
+gimp_image_merge_down (GimpImage *image,
+ gint32 merge_layer_ID,
+ GimpMergeType merge_type)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 layer_ID = -1;
+
+ 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_MERGE_TYPE, merge_type,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-merge-down",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-merge-down",
+ 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_image_merge_down: (skip)
+ * @image_ID: The image.
+ * @merge_layer_ID: The layer to merge down from.
+ * @merge_type: The type of merge.
+ *
+ * Merge the layer passed and the first visible layer below.
+ *
+ * This procedure combines the passed layer and the first visible layer
+ * below it using the specified merge type. A merge type of
+ * EXPAND_AS_NECESSARY expands the final layer to encompass the areas
+ * of the visible layers. A merge type of CLIP_TO_IMAGE clips the final
+ * layer to the 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.
+ **/
+gint32
+_gimp_image_merge_down (gint32 image_ID,
+ gint32 merge_layer_ID,
+ GimpMergeType merge_type)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 layer_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_LAYER_ID, merge_layer_ID,
+ GIMP_TYPE_MERGE_TYPE, merge_type,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-merge-down",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-merge-down",
+ 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_image_get_colormap:
+ * @image: The image.
+ * @num_bytes: (out): Number of bytes in the colormap array.
+ *
+ * Returns the image's colormap
+ *
+ * This procedure returns an actual pointer to the image's colormap, as
+ * well as the number of bytes contained in the colormap. The actual
+ * number of colors in the transmitted colormap will be 'num-bytes' /
+ * 3. If the image is not in Indexed color mode, no colormap is
+ * returned.
+ *
+ * Returns: (array length=num_bytes) (element-type guint8) (transfer full):
+ * The image's colormap.
+ * The returned value must be freed with g_free().
+ **/
+guint8 *
+_gimp_image_get_colormap (GimpImage *image,
+ gint *num_bytes)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ guint8 *colormap = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-colormap",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-colormap",
+ args);
+ gimp_value_array_unref (args);
+
+ *num_bytes = 0;
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ {
+ *num_bytes = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ colormap = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return colormap;
+}
+
+/**
+ * __gimp_image_get_colormap: (skip)
+ * @image_ID: The image.
+ * @num_bytes: (out): Number of bytes in the colormap array.
+ *
+ * Returns the image's colormap
+ *
+ * This procedure returns an actual pointer to the image's colormap, as
+ * well as the number of bytes contained in the colormap. The actual
+ * number of colors in the transmitted colormap will be 'num-bytes' /
+ * 3. If the image is not in Indexed color mode, no colormap is
+ * returned.
+ *
+ * Returns: (array length=num_bytes): The image's colormap.
+ * The returned value must be freed with g_free().
+ **/
+guint8 *
+__gimp_image_get_colormap (gint32 image_ID,
+ gint *num_bytes)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ guint8 *colormap = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-colormap",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-colormap",
+ args);
+ gimp_value_array_unref (args);
+
+ *num_bytes = 0;
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ {
+ *num_bytes = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ colormap = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return colormap;
+}
+
+/**
+ * _gimp_image_set_colormap:
+ * @image: The image.
+ * @num_bytes: Number of bytes in the colormap array.
+ * @colormap: (array length=num_bytes) (element-type guint8): The new colormap values.
+ *
+ * Sets the entries in the image's colormap.
+ *
+ * This procedure sets the entries in the specified image's colormap.
+ * The number of entries is specified by the 'num-bytes' parameter and
+ * corresponds to the number of INT8 triples that must be contained in
+ * the 'colormap' array. The actual number of colors in the transmitted
+ * colormap is 'num-bytes' / 3.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_set_colormap (GimpImage *image,
+ gint num_bytes,
+ const guint8 *colormap)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_INT, num_bytes,
+ GIMP_TYPE_UINT8_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_uint8_array (gimp_value_array_index (args, 2), colormap, num_bytes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-colormap",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-colormap",
+ 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_image_set_colormap: (skip)
+ * @image_ID: The image.
+ * @num_bytes: Number of bytes in the colormap array.
+ * @colormap: (array length=num_bytes) (element-type guint8): The new colormap values.
+ *
+ * Sets the entries in the image's colormap.
+ *
+ * This procedure sets the entries in the specified image's colormap.
+ * The number of entries is specified by the 'num-bytes' parameter and
+ * corresponds to the number of INT8 triples that must be contained in
+ * the 'colormap' array. The actual number of colors in the transmitted
+ * colormap is 'num-bytes' / 3.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+__gimp_image_set_colormap (gint32 image_ID,
+ gint num_bytes,
+ const guint8 *colormap)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_INT, num_bytes,
+ GIMP_TYPE_UINT8_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_uint8_array (gimp_value_array_index (args, 2), colormap, num_bytes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-colormap",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-colormap",
+ 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_image_get_metadata:
+ * @image: The image.
+ *
+ * Returns the image's metadata.
+ *
+ * Returns exif/iptc/xmp metadata from the image.
+ *
+ * Returns: (transfer full): The exif/ptc/xmp metadata as a string.
+ * The returned value must be freed with g_free().
+ **/
+gchar *
+_gimp_image_get_metadata (GimpImage *image)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *metadata_string = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-metadata",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-metadata",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ metadata_string = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return metadata_string;
+}
+
+/**
+ * __gimp_image_get_metadata: (skip)
+ * @image_ID: The image.
+ *
+ * Returns the image's metadata.
+ *
+ * Returns exif/iptc/xmp metadata from the image.
+ *
+ * Returns: The exif/ptc/xmp metadata as a string.
+ * The returned value must be freed with g_free().
+ **/
+gchar *
+__gimp_image_get_metadata (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *metadata_string = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-metadata",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-metadata",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ metadata_string = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return metadata_string;
+}
+
+/**
+ * _gimp_image_set_metadata:
+ * @image: The image.
+ * @metadata_string: The exif/ptc/xmp metadata as a string.
+ *
+ * Set the image's metadata.
+ *
+ * Sets exif/iptc/xmp metadata on the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_set_metadata (GimpImage *image,
+ const gchar *metadata_string)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_STRING, metadata_string,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-metadata",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-metadata",
+ 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_image_set_metadata: (skip)
+ * @image_ID: The image.
+ * @metadata_string: The exif/ptc/xmp metadata as a string.
+ *
+ * Set the image's metadata.
+ *
+ * Sets exif/iptc/xmp metadata on the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+__gimp_image_set_metadata (gint32 image_ID,
+ const gchar *metadata_string)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_STRING, metadata_string,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-metadata",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-metadata",
+ 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_image_clean_all:
+ * @image: The image.
+ *
+ * Set the image dirty count to 0.
+ *
+ * This procedure sets the specified image's dirty count to 0, allowing
+ * operations to occur without having a 'dirtied' image. This is
+ * especially useful for creating and loading images which should not
+ * initially be considered dirty, even though layers must be created,
+ * filled, and installed in the image. Note that save plug-ins must NOT
+ * call this function themselves after saving the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_clean_all (GimpImage *image)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-clean-all",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-clean-all",
+ 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_image_clean_all: (skip)
+ * @image_ID: The image.
+ *
+ * Set the image dirty count to 0.
+ *
+ * This procedure sets the specified image's dirty count to 0, allowing
+ * operations to occur without having a 'dirtied' image. This is
+ * especially useful for creating and loading images which should not
+ * initially be considered dirty, even though layers must be created,
+ * filled, and installed in the image. Note that save plug-ins must NOT
+ * call this function themselves after saving the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_clean_all (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-clean-all",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-clean-all",
+ 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_image_is_dirty:
+ * @image: The image.
+ *
+ * Checks if the image has unsaved changes.
+ *
+ * This procedure checks the specified image's dirty count to see if it
+ * needs to be saved. Note that saving the image does not automatically
+ * set the dirty count to 0, you need to call gimp_image_clean_all()
+ * after calling a save procedure to make the image clean.
+ *
+ * Returns: TRUE if the image has unsaved changes.
+ **/
+gboolean
+gimp_image_is_dirty (GimpImage *image)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean dirty = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-is-dirty",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-is-dirty",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ dirty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return dirty;
+}
+
+/**
+ * _gimp_image_is_dirty: (skip)
+ * @image_ID: The image.
+ *
+ * Checks if the image has unsaved changes.
+ *
+ * This procedure checks the specified image's dirty count to see if it
+ * needs to be saved. Note that saving the image does not automatically
+ * set the dirty count to 0, you need to call gimp_image_clean_all()
+ * after calling a save procedure to make the image clean.
+ *
+ * Returns: TRUE if the image has unsaved changes.
+ **/
+gboolean
+_gimp_image_is_dirty (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean dirty = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-is-dirty",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-is-dirty",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ dirty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return dirty;
+}
+
+/**
+ * _gimp_image_thumbnail:
+ * @image: The image.
+ * @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) (element-type guint8) (transfer full): The
thumbnail data.
+ *
+ * Get a thumbnail of an image.
+ *
+ * This function gets data from which a thumbnail of an image 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 bits per pixel in the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_thumbnail (GimpImage *image,
+ 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_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_INT, width,
+ G_TYPE_INT, height,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-thumbnail",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-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_image_thumbnail: (skip)
+ * @image_ID: The image.
+ * @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 an image.
+ *
+ * This function gets data from which a thumbnail of an image 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 bits per pixel in the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+__gimp_image_thumbnail (gint32 image_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;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_INT, width,
+ G_TYPE_INT, height,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-thumbnail",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-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_image_get_active_layer:
+ * @image: The image.
+ *
+ * Returns the specified image's active layer.
+ *
+ * If there is an active layer, its ID will be returned, otherwise, -1.
+ * 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.
+ **/
+gint32
+gimp_image_get_active_layer (GimpImage *image)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 active_layer_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-active-layer",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-active-layer",
+ args);
+ 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));
+
+ gimp_value_array_unref (return_vals);
+
+ return active_layer_ID;
+}
+
+/**
+ * _gimp_image_get_active_layer: (skip)
+ * @image_ID: The image.
+ *
+ * Returns the specified image's active layer.
+ *
+ * If there is an active layer, its ID will be returned, otherwise, -1.
+ * 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.
+ **/
+gint32
+_gimp_image_get_active_layer (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 active_layer_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-active-layer",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-active-layer",
+ args);
+ 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));
+
+ gimp_value_array_unref (return_vals);
+
+ return active_layer_ID;
+}
+
+/**
+ * gimp_image_set_active_layer:
+ * @image: The image.
+ * @active_layer_ID: The new image active layer.
+ *
+ * Sets the specified image's active layer.
+ *
+ * If the layer exists, it is set as the active layer in the image. Any
+ * previous active layer or channel is set to inactive. An exception is
+ * a previously existing floating selection, in which case this
+ * procedure will return an execution error.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_set_active_layer (GimpImage *image,
+ gint32 active_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_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_LAYER_ID, active_layer_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-active-layer",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-active-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_image_set_active_layer: (skip)
+ * @image_ID: The image.
+ * @active_layer_ID: The new image active layer.
+ *
+ * Sets the specified image's active layer.
+ *
+ * If the layer exists, it is set as the active layer in the image. Any
+ * previous active layer or channel is set to inactive. An exception is
+ * a previously existing floating selection, in which case this
+ * procedure will return an execution error.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_set_active_layer (gint32 image_ID,
+ gint32 active_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_IMAGE_ID, image_ID,
+ GIMP_TYPE_LAYER_ID, active_layer_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-active-layer",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-active-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_image_get_active_channel:
+ * @image: The image.
+ *
+ * Returns the specified image's active channel.
+ *
+ * If there is an active channel, this will return the channel ID,
+ * otherwise, -1.
+ *
+ * Returns: The active channel.
+ **/
+gint32
+gimp_image_get_active_channel (GimpImage *image)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 active_channel_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-active-channel",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-active-channel",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ active_channel_ID = gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return active_channel_ID;
+}
+
+/**
+ * _gimp_image_get_active_channel: (skip)
+ * @image_ID: The image.
+ *
+ * Returns the specified image's active channel.
+ *
+ * If there is an active channel, this will return the channel ID,
+ * otherwise, -1.
+ *
+ * Returns: The active channel.
+ **/
+gint32
+_gimp_image_get_active_channel (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 active_channel_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-active-channel",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-active-channel",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ active_channel_ID = gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return active_channel_ID;
+}
+
+/**
+ * gimp_image_set_active_channel:
+ * @image: The image.
+ * @active_channel_ID: The new image active channel.
+ *
+ * Sets the specified image's active channel.
+ *
+ * If the channel exists, it is set as the active channel in the image.
+ * Any previous active channel or layer is set to inactive. An
+ * exception is a previously existing floating selection, in which case
+ * this procedure will return an execution error.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_set_active_channel (GimpImage *image,
+ gint32 active_channel_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_CHANNEL_ID, active_channel_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-active-channel",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-active-channel",
+ 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_image_set_active_channel: (skip)
+ * @image_ID: The image.
+ * @active_channel_ID: The new image active channel.
+ *
+ * Sets the specified image's active channel.
+ *
+ * If the channel exists, it is set as the active channel in the image.
+ * Any previous active channel or layer is set to inactive. An
+ * exception is a previously existing floating selection, in which case
+ * this procedure will return an execution error.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_set_active_channel (gint32 image_ID,
+ gint32 active_channel_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_CHANNEL_ID, active_channel_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-active-channel",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-active-channel",
+ 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_image_get_active_vectors:
+ * @image: The image.
+ *
+ * Returns the specified image's active vectors.
+ *
+ * If there is an active path, its ID will be returned, otherwise, -1.
+ *
+ * Returns: The active vectors.
+ **/
+gint32
+gimp_image_get_active_vectors (GimpImage *image)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 active_vectors_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-active-vectors",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-active-vectors",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ active_vectors_ID = gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return active_vectors_ID;
+}
+
+/**
+ * _gimp_image_get_active_vectors: (skip)
+ * @image_ID: The image.
+ *
+ * Returns the specified image's active vectors.
+ *
+ * If there is an active path, its ID will be returned, otherwise, -1.
+ *
+ * Returns: The active vectors.
+ **/
+gint32
+_gimp_image_get_active_vectors (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 active_vectors_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-active-vectors",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-active-vectors",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ active_vectors_ID = gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return active_vectors_ID;
+}
+
+/**
+ * gimp_image_set_active_vectors:
+ * @image: The image.
+ * @active_vectors_ID: The new image active vectors.
+ *
+ * Sets the specified image's active vectors.
+ *
+ * If the path exists, it is set as the active path in the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_set_active_vectors (GimpImage *image,
+ gint32 active_vectors_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_VECTORS_ID, active_vectors_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-active-vectors",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-active-vectors",
+ 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_image_set_active_vectors: (skip)
+ * @image_ID: The image.
+ * @active_vectors_ID: The new image active vectors.
+ *
+ * Sets the specified image's active vectors.
+ *
+ * If the path exists, it is set as the active path in the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_set_active_vectors (gint32 image_ID,
+ gint32 active_vectors_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_VECTORS_ID, active_vectors_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-active-vectors",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-active-vectors",
+ 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_image_get_selection:
+ * @image: The image.
+ *
+ * Returns the specified image's selection.
+ *
+ * This will always return a valid ID for a selection -- which is
+ * represented as a channel internally.
+ *
+ * Returns: The selection channel.
+ **/
+gint32
+gimp_image_get_selection (GimpImage *image)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 selection_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-selection",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-selection",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ selection_ID = gimp_value_get_selection_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return selection_ID;
+}
+
+/**
+ * _gimp_image_get_selection: (skip)
+ * @image_ID: The image.
+ *
+ * Returns the specified image's selection.
+ *
+ * This will always return a valid ID for a selection -- which is
+ * represented as a channel internally.
+ *
+ * Returns: The selection channel.
+ **/
+gint32
+_gimp_image_get_selection (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 selection_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-selection",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-selection",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ selection_ID = gimp_value_get_selection_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return selection_ID;
+}
+
+/**
+ * gimp_image_get_component_active:
+ * @image: The image.
+ * @component: The image component.
+ *
+ * Returns if the specified image's image component is active.
+ *
+ * This procedure returns if the specified image's image component
+ * (i.e. Red, Green, Blue intensity channels in an RGB image) is active
+ * or inactive -- whether or not it can be modified. If the specified
+ * component is not valid for the image type, an error is returned.
+ *
+ * Returns: Component is active.
+ **/
+gboolean
+gimp_image_get_component_active (GimpImage *image,
+ GimpChannelType component)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean active = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_CHANNEL_TYPE, component,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-component-active",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-component-active",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ active = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return active;
+}
+
+/**
+ * _gimp_image_get_component_active: (skip)
+ * @image_ID: The image.
+ * @component: The image component.
+ *
+ * Returns if the specified image's image component is active.
+ *
+ * This procedure returns if the specified image's image component
+ * (i.e. Red, Green, Blue intensity channels in an RGB image) is active
+ * or inactive -- whether or not it can be modified. If the specified
+ * component is not valid for the image type, an error is returned.
+ *
+ * Returns: Component is active.
+ **/
+gboolean
+_gimp_image_get_component_active (gint32 image_ID,
+ GimpChannelType component)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean active = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_CHANNEL_TYPE, component,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-component-active",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-component-active",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ active = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return active;
+}
+
+/**
+ * gimp_image_set_component_active:
+ * @image: The image.
+ * @component: The image component.
+ * @active: Component is active.
+ *
+ * Sets if the specified image's image component is active.
+ *
+ * This procedure sets if the specified image's image component (i.e.
+ * Red, Green, Blue intensity channels in an RGB image) is active or
+ * inactive -- whether or not it can be modified. If the specified
+ * component is not valid for the image type, an error is returned.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_set_component_active (GimpImage *image,
+ GimpChannelType component,
+ gboolean active)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_CHANNEL_TYPE, component,
+ G_TYPE_BOOLEAN, active,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-component-active",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-component-active",
+ 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_image_set_component_active: (skip)
+ * @image_ID: The image.
+ * @component: The image component.
+ * @active: Component is active.
+ *
+ * Sets if the specified image's image component is active.
+ *
+ * This procedure sets if the specified image's image component (i.e.
+ * Red, Green, Blue intensity channels in an RGB image) is active or
+ * inactive -- whether or not it can be modified. If the specified
+ * component is not valid for the image type, an error is returned.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_set_component_active (gint32 image_ID,
+ GimpChannelType component,
+ gboolean active)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_CHANNEL_TYPE, component,
+ G_TYPE_BOOLEAN, active,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-component-active",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-component-active",
+ 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_image_get_component_visible:
+ * @image: The image.
+ * @component: The image component.
+ *
+ * Returns if the specified image's image component is visible.
+ *
+ * This procedure returns if the specified image's image component
+ * (i.e. Red, Green, Blue intensity channels in an RGB image) is
+ * visible or invisible -- whether or not it can be seen. If the
+ * specified component is not valid for the image type, an error is
+ * returned.
+ *
+ * Returns: Component is visible.
+ **/
+gboolean
+gimp_image_get_component_visible (GimpImage *image,
+ GimpChannelType component)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean visible = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_CHANNEL_TYPE, component,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-component-visible",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-component-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_image_get_component_visible: (skip)
+ * @image_ID: The image.
+ * @component: The image component.
+ *
+ * Returns if the specified image's image component is visible.
+ *
+ * This procedure returns if the specified image's image component
+ * (i.e. Red, Green, Blue intensity channels in an RGB image) is
+ * visible or invisible -- whether or not it can be seen. If the
+ * specified component is not valid for the image type, an error is
+ * returned.
+ *
+ * Returns: Component is visible.
+ **/
+gboolean
+_gimp_image_get_component_visible (gint32 image_ID,
+ GimpChannelType component)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean visible = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_CHANNEL_TYPE, component,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-component-visible",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-component-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_image_set_component_visible:
+ * @image: The image.
+ * @component: The image component.
+ * @visible: Component is visible.
+ *
+ * Sets if the specified image's image component is visible.
+ *
+ * This procedure sets if the specified image's image component (i.e.
+ * Red, Green, Blue intensity channels in an RGB image) is visible or
+ * invisible -- whether or not it can be seen. If the specified
+ * component is not valid for the image type, an error is returned.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_set_component_visible (GimpImage *image,
+ GimpChannelType component,
+ 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_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_CHANNEL_TYPE, component,
+ G_TYPE_BOOLEAN, visible,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-component-visible",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-component-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_image_set_component_visible: (skip)
+ * @image_ID: The image.
+ * @component: The image component.
+ * @visible: Component is visible.
+ *
+ * Sets if the specified image's image component is visible.
+ *
+ * This procedure sets if the specified image's image component (i.e.
+ * Red, Green, Blue intensity channels in an RGB image) is visible or
+ * invisible -- whether or not it can be seen. If the specified
+ * component is not valid for the image type, an error is returned.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_set_component_visible (gint32 image_ID,
+ GimpChannelType component,
+ 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_IMAGE_ID, image_ID,
+ GIMP_TYPE_CHANNEL_TYPE, component,
+ G_TYPE_BOOLEAN, visible,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-component-visible",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-component-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_image_get_filename:
+ * @image: The image.
+ *
+ * Returns the specified image's filename.
+ *
+ * This procedure returns the specified image's filename in the
+ * filesystem encoding. The image has a filename only if it was loaded
+ * or imported from a file or has since been saved or exported.
+ * Otherwise, this function returns %NULL. See also
+ * gimp_image_get_uri().
+ *
+ * Returns: (transfer full): The filename.
+ * The returned value must be freed with g_free().
+ **/
+gchar *
+gimp_image_get_filename (GimpImage *image)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *filename = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-filename",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-filename",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ filename = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return filename;
+}
+
+/**
+ * _gimp_image_get_filename: (skip)
+ * @image_ID: The image.
+ *
+ * Returns the specified image's filename.
+ *
+ * This procedure returns the specified image's filename in the
+ * filesystem encoding. The image has a filename only if it was loaded
+ * or imported from a file or has since been saved or exported.
+ * Otherwise, this function returns %NULL. See also
+ * gimp_image_get_uri().
+ *
+ * Returns: The filename.
+ * The returned value must be freed with g_free().
+ **/
+gchar *
+_gimp_image_get_filename (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *filename = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
@@ -2775,33 +5481,852 @@ gimp_image_get_filename (GimpImage *image)
"gimp-image-get-filename",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-filename",
+ return_vals = gimp_run_procedure_array ("gimp-image-get-filename",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ filename = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return filename;
+}
+
+/**
+ * gimp_image_set_filename:
+ * @image: The image.
+ * @filename: The new image filename.
+ *
+ * Sets the specified image's filename.
+ *
+ * This procedure sets the specified image's filename. The filename
+ * should be in the filesystem encoding.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_set_filename (GimpImage *image,
+ const gchar *filename)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_STRING, filename,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-filename",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-filename",
+ 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_image_set_filename: (skip)
+ * @image_ID: The image.
+ * @filename: The new image filename.
+ *
+ * Sets the specified image's filename.
+ *
+ * This procedure sets the specified image's filename. The filename
+ * should be in the filesystem encoding.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_set_filename (gint32 image_ID,
+ const gchar *filename)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_STRING, filename,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-filename",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-filename",
+ 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_image_get_uri:
+ * @image: The image.
+ *
+ * Returns the URI for the specified image.
+ *
+ * This procedure returns the URI associated with the specified image.
+ * The image has an URI only if it was loaded or imported from a file
+ * or has since been saved or exported. Otherwise, this function
+ * returns %NULL. See also gimp-image-get-imported-uri to get the URI
+ * of the current file if it was imported from a non-GIMP file format
+ * and not yet saved, or gimp-image-get-exported-uri if the image has
+ * been exported to a non-GIMP file format.
+ *
+ * Returns: (transfer full): The URI.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.8
+ **/
+gchar *
+gimp_image_get_uri (GimpImage *image)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *uri = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-uri",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-uri",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ uri = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return uri;
+}
+
+/**
+ * _gimp_image_get_uri: (skip)
+ * @image_ID: The image.
+ *
+ * Returns the URI for the specified image.
+ *
+ * This procedure returns the URI associated with the specified image.
+ * The image has an URI only if it was loaded or imported from a file
+ * or has since been saved or exported. Otherwise, this function
+ * returns %NULL. See also gimp-image-get-imported-uri to get the URI
+ * of the current file if it was imported from a non-GIMP file format
+ * and not yet saved, or gimp-image-get-exported-uri if the image has
+ * been exported to a non-GIMP file format.
+ *
+ * Returns: The URI.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.8
+ **/
+gchar *
+_gimp_image_get_uri (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *uri = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-uri",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-uri",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ uri = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return uri;
+}
+
+/**
+ * gimp_image_get_xcf_uri:
+ * @image: The image.
+ *
+ * Returns the XCF URI for the specified image.
+ *
+ * This procedure returns the XCF URI associated with the image. If
+ * there is no such URI, this procedure returns %NULL.
+ *
+ * Returns: (transfer full): The imported URI.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.8
+ **/
+gchar *
+gimp_image_get_xcf_uri (GimpImage *image)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *uri = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-xcf-uri",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-xcf-uri",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ uri = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return uri;
+}
+
+/**
+ * _gimp_image_get_xcf_uri: (skip)
+ * @image_ID: The image.
+ *
+ * Returns the XCF URI for the specified image.
+ *
+ * This procedure returns the XCF URI associated with the image. If
+ * there is no such URI, this procedure returns %NULL.
+ *
+ * Returns: The imported URI.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.8
+ **/
+gchar *
+_gimp_image_get_xcf_uri (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *uri = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-xcf-uri",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-xcf-uri",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ uri = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return uri;
+}
+
+/**
+ * gimp_image_get_imported_uri:
+ * @image: The image.
+ *
+ * Returns the imported URI for the specified image.
+ *
+ * This procedure returns the URI associated with the specified image
+ * if the image was imported from a non-native Gimp format. If the
+ * image was not imported, or has since been saved in the native Gimp
+ * format, this procedure returns %NULL.
+ *
+ * Returns: (transfer full): The imported URI.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.8
+ **/
+gchar *
+gimp_image_get_imported_uri (GimpImage *image)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *uri = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-imported-uri",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-imported-uri",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ uri = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return uri;
+}
+
+/**
+ * _gimp_image_get_imported_uri: (skip)
+ * @image_ID: The image.
+ *
+ * Returns the imported URI for the specified image.
+ *
+ * This procedure returns the URI associated with the specified image
+ * if the image was imported from a non-native Gimp format. If the
+ * image was not imported, or has since been saved in the native Gimp
+ * format, this procedure returns %NULL.
+ *
+ * Returns: The imported URI.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.8
+ **/
+gchar *
+_gimp_image_get_imported_uri (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *uri = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-imported-uri",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-imported-uri",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ uri = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return uri;
+}
+
+/**
+ * gimp_image_get_exported_uri:
+ * @image: The image.
+ *
+ * Returns the exported URI for the specified image.
+ *
+ * This procedure returns the URI associated with the specified image
+ * if the image was exported a non-native GIMP format. If the image was
+ * not exported, this procedure returns %NULL.
+ *
+ * Returns: (transfer full): The exported URI.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.8
+ **/
+gchar *
+gimp_image_get_exported_uri (GimpImage *image)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *uri = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-exported-uri",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-exported-uri",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ uri = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return uri;
+}
+
+/**
+ * _gimp_image_get_exported_uri: (skip)
+ * @image_ID: The image.
+ *
+ * Returns the exported URI for the specified image.
+ *
+ * This procedure returns the URI associated with the specified image
+ * if the image was exported a non-native GIMP format. If the image was
+ * not exported, this procedure returns %NULL.
+ *
+ * Returns: The exported URI.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.8
+ **/
+gchar *
+_gimp_image_get_exported_uri (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *uri = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-exported-uri",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-exported-uri",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ uri = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return uri;
+}
+
+/**
+ * gimp_image_get_name:
+ * @image: The image.
+ *
+ * Returns the specified image's name.
+ *
+ * This procedure returns the image's name. If the image has a filename
+ * or an URI, then the returned name contains the filename's or URI's
+ * base name (the last component of the path). Otherwise it is the
+ * translated string \"Untitled\". The returned name is formatted like
+ * the image name in the image window title, it may contain '[]',
+ * '(imported)' etc. and should only be used to label user interface
+ * elements. Never use it to construct filenames.
+ *
+ * Returns: (transfer full): The name.
+ * The returned value must be freed with g_free().
+ **/
+gchar *
+gimp_image_get_name (GimpImage *image)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *name = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-name",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-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_image_get_name: (skip)
+ * @image_ID: The image.
+ *
+ * Returns the specified image's name.
+ *
+ * This procedure returns the image's name. If the image has a filename
+ * or an URI, then the returned name contains the filename's or URI's
+ * base name (the last component of the path). Otherwise it is the
+ * translated string \"Untitled\". The returned name is formatted like
+ * the image name in the image window title, it may contain '[]',
+ * '(imported)' etc. and should only be used to label user interface
+ * elements. Never use it to construct filenames.
+ *
+ * Returns: The name.
+ * The returned value must be freed with g_free().
+ **/
+gchar *
+_gimp_image_get_name (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *name = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-name",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-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_image_get_resolution:
+ * @image: The image.
+ * @xresolution: (out): The resolution in the x-axis, in dots per inch.
+ * @yresolution: (out): The resolution in the y-axis, in dots per inch.
+ *
+ * Returns the specified image's resolution.
+ *
+ * This procedure returns the specified image's resolution in dots per
+ * inch. This value is independent of any of the layers in this image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_get_resolution (GimpImage *image,
+ gdouble *xresolution,
+ gdouble *yresolution)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-resolution",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-resolution",
+ args);
+ gimp_value_array_unref (args);
+
+ *xresolution = 0.0;
+ *yresolution = 0.0;
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *xresolution = g_value_get_double (gimp_value_array_index (return_vals, 1));
+ *yresolution = g_value_get_double (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * _gimp_image_get_resolution: (skip)
+ * @image_ID: The image.
+ * @xresolution: (out): The resolution in the x-axis, in dots per inch.
+ * @yresolution: (out): The resolution in the y-axis, in dots per inch.
+ *
+ * Returns the specified image's resolution.
+ *
+ * This procedure returns the specified image's resolution in dots per
+ * inch. This value is independent of any of the layers in this image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_get_resolution (gint32 image_ID,
+ gdouble *xresolution,
+ gdouble *yresolution)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-resolution",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-resolution",
+ args);
+ gimp_value_array_unref (args);
+
+ *xresolution = 0.0;
+ *yresolution = 0.0;
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *xresolution = g_value_get_double (gimp_value_array_index (return_vals, 1));
+ *yresolution = g_value_get_double (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
+/**
+ * gimp_image_set_resolution:
+ * @image: The image.
+ * @xresolution: The new image resolution in the x-axis, in dots per inch.
+ * @yresolution: The new image resolution in the y-axis, in dots per inch.
+ *
+ * Sets the specified image's resolution.
+ *
+ * This procedure sets the specified image's resolution in dots per
+ * inch. This value is independent of any of the layers in this image.
+ * No scaling or resizing is performed.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_image_set_resolution (GimpImage *image,
+ gdouble xresolution,
+ gdouble yresolution)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_DOUBLE, xresolution,
+ G_TYPE_DOUBLE, yresolution,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-resolution",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-resolution",
+ 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_image_set_resolution: (skip)
+ * @image_ID: The image.
+ * @xresolution: The new image resolution in the x-axis, in dots per inch.
+ * @yresolution: The new image resolution in the y-axis, in dots per inch.
+ *
+ * Sets the specified image's resolution.
+ *
+ * This procedure sets the specified image's resolution in dots per
+ * inch. This value is independent of any of the layers in this image.
+ * No scaling or resizing is performed.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_set_resolution (gint32 image_ID,
+ gdouble xresolution,
+ gdouble yresolution)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_DOUBLE, xresolution,
+ G_TYPE_DOUBLE, yresolution,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-resolution",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-resolution",
+ 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_image_get_unit:
+ * @image: The image.
+ *
+ * Returns the specified image's unit.
+ *
+ * This procedure returns the specified image's unit. This value is
+ * independent of any of the layers in this image. See the
+ * gimp_unit_*() procedure definitions for the valid range of unit IDs
+ * and a description of the unit system.
+ *
+ * Returns: (transfer none): The unit.
+ **/
+GimpUnit
+gimp_image_get_unit (GimpImage *image)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpUnit unit = GIMP_UNIT_PIXEL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-unit",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-unit",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ unit = g_value_get_int (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return unit;
+}
+
+/**
+ * _gimp_image_get_unit: (skip)
+ * @image_ID: The image.
+ *
+ * Returns the specified image's unit.
+ *
+ * This procedure returns the specified image's unit. This value is
+ * independent of any of the layers in this image. See the
+ * gimp_unit_*() procedure definitions for the valid range of unit IDs
+ * and a description of the unit system.
+ *
+ * Returns: The unit.
+ **/
+GimpUnit
+_gimp_image_get_unit (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpUnit unit = GIMP_UNIT_PIXEL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-unit",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-unit",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- filename = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+ unit = g_value_get_int (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return filename;
+ return unit;
}
/**
- * gimp_image_set_filename:
+ * gimp_image_set_unit:
* @image: The image.
- * @filename: The new image filename.
+ * @unit: The new image unit.
*
- * Sets the specified image's filename.
+ * Sets the specified image's unit.
*
- * This procedure sets the specified image's filename. The filename
- * should be in the filesystem encoding.
+ * This procedure sets the specified image's unit. No scaling or
+ * resizing is performed. This value is independent of any of the
+ * layers in this image. See the gimp_unit_*() procedure definitions
+ * for the valid range of unit IDs and a description of the unit
+ * system.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_image_set_filename (GimpImage *image,
- const gchar *filename)
+gimp_image_set_unit (GimpImage *image,
+ GimpUnit unit)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -2810,15 +6335,15 @@ gimp_image_set_filename (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- G_TYPE_STRING, filename,
+ GIMP_TYPE_UNIT, unit,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-set-filename",
+ "gimp-image-set-unit",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-set-filename",
+ return_vals = gimp_run_procedure_array ("gimp-image-set-unit",
args);
gimp_value_array_unref (args);
@@ -2830,31 +6355,69 @@ gimp_image_set_filename (GimpImage *image,
}
/**
- * gimp_image_get_uri:
- * @image: The image.
+ * _gimp_image_set_unit: (skip)
+ * @image_ID: The image.
+ * @unit: The new image unit.
*
- * Returns the URI for the specified image.
+ * Sets the specified image's unit.
*
- * This procedure returns the URI associated with the specified image.
- * The image has an URI only if it was loaded or imported from a file
- * or has since been saved or exported. Otherwise, this function
- * returns %NULL. See also gimp-image-get-imported-uri to get the URI
- * of the current file if it was imported from a non-GIMP file format
- * and not yet saved, or gimp-image-get-exported-uri if the image has
- * been exported to a non-GIMP file format.
+ * This procedure sets the specified image's unit. No scaling or
+ * resizing is performed. This value is independent of any of the
+ * layers in this image. See the gimp_unit_*() procedure definitions
+ * for the valid range of unit IDs and a description of the unit
+ * system.
*
- * Returns: (transfer full): The URI.
- * The returned value must be freed with g_free().
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_set_unit (gint32 image_ID,
+ 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_IMAGE_ID, image_ID,
+ GIMP_TYPE_UNIT, unit,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-unit",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-unit",
+ 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_image_get_tattoo_state:
+ * @image: The image.
*
- * Since: 2.8
+ * Returns the tattoo state associated with the image.
+ *
+ * This procedure returns the tattoo state of the image. Use only by
+ * save/load plug-ins that wish to preserve an images tattoo state.
+ * Using this function at other times will produce unexpected results.
+ *
+ * Returns: The tattoo state.
**/
-gchar *
-gimp_image_get_uri (GimpImage *image)
+guint
+gimp_image_get_tattoo_state (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gchar *uri = NULL;
+ guint tattoo_state = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
@@ -2862,535 +6425,580 @@ gimp_image_get_uri (GimpImage *image)
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-uri",
+ "gimp-image-get-tattoo-state",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-uri",
+ return_vals = gimp_run_procedure_array ("gimp-image-get-tattoo-state",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- uri = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+ tattoo_state = g_value_get_uint (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return uri;
+ return tattoo_state;
}
/**
- * gimp_image_get_xcf_uri:
- * @image: The image.
- *
- * Returns the XCF URI for the specified image.
+ * _gimp_image_get_tattoo_state: (skip)
+ * @image_ID: The image.
*
- * This procedure returns the XCF URI associated with the image. If
- * there is no such URI, this procedure returns %NULL.
+ * Returns the tattoo state associated with the image.
*
- * Returns: (transfer full): The imported URI.
- * The returned value must be freed with g_free().
+ * This procedure returns the tattoo state of the image. Use only by
+ * save/load plug-ins that wish to preserve an images tattoo state.
+ * Using this function at other times will produce unexpected results.
*
- * Since: 2.8
+ * Returns: The tattoo state.
**/
-gchar *
-gimp_image_get_xcf_uri (GimpImage *image)
+guint
+_gimp_image_get_tattoo_state (gint32 image_ID)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gchar *uri = NULL;
+ guint tattoo_state = 0;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-xcf-uri",
+ "gimp-image-get-tattoo-state",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-xcf-uri",
+ return_vals = gimp_run_procedure_array ("gimp-image-get-tattoo-state",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- uri = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+ tattoo_state = g_value_get_uint (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return uri;
+ return tattoo_state;
}
/**
- * gimp_image_get_imported_uri:
+ * gimp_image_set_tattoo_state:
* @image: The image.
+ * @tattoo_state: The new image tattoo state.
*
- * Returns the imported URI for the specified image.
- *
- * This procedure returns the URI associated with the specified image
- * if the image was imported from a non-native Gimp format. If the
- * image was not imported, or has since been saved in the native Gimp
- * format, this procedure returns %NULL.
+ * Set the tattoo state associated with the image.
*
- * Returns: (transfer full): The imported URI.
- * The returned value must be freed with g_free().
+ * This procedure sets the tattoo state of the image. Use only by
+ * save/load plug-ins that wish to preserve an images tattoo state.
+ * Using this function at other times will produce unexpected results.
+ * A full check of uniqueness of states in layers, channels and paths
+ * will be performed by this procedure and a execution failure will be
+ * returned if this fails. A failure will also be returned if the new
+ * tattoo state value is less than the maximum tattoo value from all of
+ * the tattoos from the paths, layers and channels. After the image
+ * data has been loaded and all the tattoos have been set then this is
+ * the last procedure that should be called. If effectively does a
+ * status check on the tattoo values that have been set to make sure
+ * that all is OK.
*
- * Since: 2.8
+ * Returns: TRUE on success.
**/
-gchar *
-gimp_image_get_imported_uri (GimpImage *image)
+gboolean
+gimp_image_set_tattoo_state (GimpImage *image,
+ guint tattoo_state)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gchar *uri = NULL;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_UINT, tattoo_state,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-imported-uri",
+ "gimp-image-set-tattoo-state",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-imported-uri",
+ return_vals = gimp_run_procedure_array ("gimp-image-set-tattoo-state",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- uri = 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 uri;
+ return success;
}
/**
- * gimp_image_get_exported_uri:
- * @image: The image.
+ * _gimp_image_set_tattoo_state: (skip)
+ * @image_ID: The image.
+ * @tattoo_state: The new image tattoo state.
*
- * Returns the exported URI for the specified image.
+ * Set the tattoo state associated with the image.
*
- * This procedure returns the URI associated with the specified image
- * if the image was exported a non-native GIMP format. If the image was
- * not exported, this procedure returns %NULL.
+ * This procedure sets the tattoo state of the image. Use only by
+ * save/load plug-ins that wish to preserve an images tattoo state.
+ * Using this function at other times will produce unexpected results.
+ * A full check of uniqueness of states in layers, channels and paths
+ * will be performed by this procedure and a execution failure will be
+ * returned if this fails. A failure will also be returned if the new
+ * tattoo state value is less than the maximum tattoo value from all of
+ * the tattoos from the paths, layers and channels. After the image
+ * data has been loaded and all the tattoos have been set then this is
+ * the last procedure that should be called. If effectively does a
+ * status check on the tattoo values that have been set to make sure
+ * that all is OK.
*
- * Returns: (transfer full): The exported URI.
- * The returned value must be freed with g_free().
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_set_tattoo_state (gint32 image_ID,
+ guint tattoo_state)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_UINT, tattoo_state,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-tattoo-state",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-tattoo-state",
+ 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_image_get_layer_by_tattoo:
+ * @image: The image.
+ * @tattoo: The tattoo of the layer to find.
*
- * Since: 2.8
+ * Find a layer with a given tattoo in an image.
+ *
+ * This procedure returns the layer with the given tattoo in the
+ * specified image.
+ *
+ * Returns: The layer with the specified tattoo.
**/
-gchar *
-gimp_image_get_exported_uri (GimpImage *image)
+gint32
+gimp_image_get_layer_by_tattoo (GimpImage *image,
+ guint tattoo)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gchar *uri = NULL;
+ gint32 layer_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_UINT, tattoo,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-exported-uri",
+ "gimp-image-get-layer-by-tattoo",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-exported-uri",
+ return_vals = gimp_run_procedure_array ("gimp-image-get-layer-by-tattoo",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- uri = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+ layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return uri;
+ return layer_ID;
}
/**
- * gimp_image_get_name:
- * @image: The image.
+ * _gimp_image_get_layer_by_tattoo: (skip)
+ * @image_ID: The image.
+ * @tattoo: The tattoo of the layer to find.
*
- * Returns the specified image's name.
+ * Find a layer with a given tattoo in an image.
*
- * This procedure returns the image's name. If the image has a filename
- * or an URI, then the returned name contains the filename's or URI's
- * base name (the last component of the path). Otherwise it is the
- * translated string \"Untitled\". The returned name is formatted like
- * the image name in the image window title, it may contain '[]',
- * '(imported)' etc. and should only be used to label user interface
- * elements. Never use it to construct filenames.
+ * This procedure returns the layer with the given tattoo in the
+ * specified image.
*
- * Returns: (transfer full): The name.
- * The returned value must be freed with g_free().
+ * Returns: The layer with the specified tattoo.
**/
-gchar *
-gimp_image_get_name (GimpImage *image)
+gint32
+_gimp_image_get_layer_by_tattoo (gint32 image_ID,
+ guint tattoo)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gchar *name = NULL;
+ gint32 layer_ID = -1;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_UINT, tattoo,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-name",
+ "gimp-image-get-layer-by-tattoo",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-name",
+ return_vals = gimp_run_procedure_array ("gimp-image-get-layer-by-tattoo",
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));
+ layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return name;
+ return layer_ID;
}
/**
- * gimp_image_get_resolution:
+ * gimp_image_get_channel_by_tattoo:
* @image: The image.
- * @xresolution: (out): The resolution in the x-axis, in dots per inch.
- * @yresolution: (out): The resolution in the y-axis, in dots per inch.
+ * @tattoo: The tattoo of the channel to find.
*
- * Returns the specified image's resolution.
+ * Find a channel with a given tattoo in an image.
*
- * This procedure returns the specified image's resolution in dots per
- * inch. This value is independent of any of the layers in this image.
+ * This procedure returns the channel with the given tattoo in the
+ * specified image.
*
- * Returns: TRUE on success.
+ * Returns: The channel with the specified tattoo.
**/
-gboolean
-gimp_image_get_resolution (GimpImage *image,
- gdouble *xresolution,
- gdouble *yresolution)
+gint32
+gimp_image_get_channel_by_tattoo (GimpImage *image,
+ guint tattoo)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ gint32 channel_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_UINT, tattoo,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-resolution",
+ "gimp-image-get-channel-by-tattoo",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-resolution",
+ return_vals = gimp_run_procedure_array ("gimp-image-get-channel-by-tattoo",
args);
gimp_value_array_unref (args);
- *xresolution = 0.0;
- *yresolution = 0.0;
-
- success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
-
- if (success)
- {
- *xresolution = g_value_get_double (gimp_value_array_index (return_vals, 1));
- *yresolution = g_value_get_double (gimp_value_array_index (return_vals, 2));
- }
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ channel_ID = gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return channel_ID;
}
/**
- * gimp_image_set_resolution:
- * @image: The image.
- * @xresolution: The new image resolution in the x-axis, in dots per inch.
- * @yresolution: The new image resolution in the y-axis, in dots per inch.
+ * _gimp_image_get_channel_by_tattoo: (skip)
+ * @image_ID: The image.
+ * @tattoo: The tattoo of the channel to find.
*
- * Sets the specified image's resolution.
+ * Find a channel with a given tattoo in an image.
*
- * This procedure sets the specified image's resolution in dots per
- * inch. This value is independent of any of the layers in this image.
- * No scaling or resizing is performed.
+ * This procedure returns the channel with the given tattoo in the
+ * specified image.
*
- * Returns: TRUE on success.
+ * Returns: The channel with the specified tattoo.
**/
-gboolean
-gimp_image_set_resolution (GimpImage *image,
- gdouble xresolution,
- gdouble yresolution)
+gint32
+_gimp_image_get_channel_by_tattoo (gint32 image_ID,
+ guint tattoo)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ gint32 channel_ID = -1;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- G_TYPE_DOUBLE, xresolution,
- G_TYPE_DOUBLE, yresolution,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_UINT, tattoo,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-set-resolution",
+ "gimp-image-get-channel-by-tattoo",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-set-resolution",
+ return_vals = gimp_run_procedure_array ("gimp-image-get-channel-by-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)
+ channel_ID = gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return channel_ID;
}
/**
- * gimp_image_get_unit:
+ * gimp_image_get_vectors_by_tattoo:
* @image: The image.
+ * @tattoo: The tattoo of the vectors to find.
*
- * Returns the specified image's unit.
+ * Find a vectors with a given tattoo in an image.
*
- * This procedure returns the specified image's unit. This value is
- * independent of any of the layers in this image. See the
- * gimp_unit_*() procedure definitions for the valid range of unit IDs
- * and a description of the unit system.
+ * This procedure returns the vectors with the given tattoo in the
+ * specified image.
*
- * Returns: (transfer none): The unit.
+ * Returns: The vectors with the specified tattoo.
+ *
+ * Since: 2.6
**/
-GimpUnit
-gimp_image_get_unit (GimpImage *image)
+gint32
+gimp_image_get_vectors_by_tattoo (GimpImage *image,
+ guint tattoo)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- GimpUnit unit = GIMP_UNIT_PIXEL;
+ gint32 vectors_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_UINT, tattoo,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-unit",
+ "gimp-image-get-vectors-by-tattoo",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-unit",
+ return_vals = gimp_run_procedure_array ("gimp-image-get-vectors-by-tattoo",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- unit = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ vectors_ID = gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return unit;
+ return vectors_ID;
}
/**
- * gimp_image_set_unit:
- * @image: The image.
- * @unit: The new image unit.
+ * _gimp_image_get_vectors_by_tattoo: (skip)
+ * @image_ID: The image.
+ * @tattoo: The tattoo of the vectors to find.
*
- * Sets the specified image's unit.
+ * Find a vectors with a given tattoo in an image.
*
- * This procedure sets the specified image's unit. No scaling or
- * resizing is performed. This value is independent of any of the
- * layers in this image. See the gimp_unit_*() procedure definitions
- * for the valid range of unit IDs and a description of the unit
- * system.
+ * This procedure returns the vectors with the given tattoo in the
+ * specified image.
*
- * Returns: TRUE on success.
+ * Returns: The vectors with the specified tattoo.
+ *
+ * Since: 2.6
**/
-gboolean
-gimp_image_set_unit (GimpImage *image,
- GimpUnit unit)
+gint32
+_gimp_image_get_vectors_by_tattoo (gint32 image_ID,
+ guint tattoo)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ gint32 vectors_ID = -1;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_UNIT, unit,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_UINT, tattoo,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-set-unit",
+ "gimp-image-get-vectors-by-tattoo",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-set-unit",
+ return_vals = gimp_run_procedure_array ("gimp-image-get-vectors-by-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)
+ vectors_ID = gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return vectors_ID;
}
/**
- * gimp_image_get_tattoo_state:
+ * gimp_image_get_layer_by_name:
* @image: The image.
+ * @name: The name of the layer to find.
*
- * Returns the tattoo state associated with the image.
+ * Find a layer with a given name in an image.
*
- * This procedure returns the tattoo state of the image. Use only by
- * save/load plug-ins that wish to preserve an images tattoo state.
- * Using this function at other times will produce unexpected results.
+ * This procedure returns the layer with the given name in the
+ * specified image.
*
- * Returns: The tattoo state.
+ * Returns: The layer with the specified name.
+ *
+ * Since: 2.8
**/
-guint
-gimp_image_get_tattoo_state (GimpImage *image)
+gint32
+gimp_image_get_layer_by_name (GimpImage *image,
+ const gchar *name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- guint tattoo_state = 0;
+ gint32 layer_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_STRING, name,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-tattoo-state",
+ "gimp-image-get-layer-by-name",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-tattoo-state",
+ return_vals = gimp_run_procedure_array ("gimp-image-get-layer-by-name",
args);
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- tattoo_state = g_value_get_uint (gimp_value_array_index (return_vals, 1));
+ layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return tattoo_state;
+ return layer_ID;
}
/**
- * gimp_image_set_tattoo_state:
- * @image: The image.
- * @tattoo_state: The new image tattoo state.
+ * _gimp_image_get_layer_by_name: (skip)
+ * @image_ID: The image.
+ * @name: The name of the layer to find.
*
- * Set the tattoo state associated with the image.
+ * Find a layer with a given name in an image.
*
- * This procedure sets the tattoo state of the image. Use only by
- * save/load plug-ins that wish to preserve an images tattoo state.
- * Using this function at other times will produce unexpected results.
- * A full check of uniqueness of states in layers, channels and paths
- * will be performed by this procedure and a execution failure will be
- * returned if this fails. A failure will also be returned if the new
- * tattoo state value is less than the maximum tattoo value from all of
- * the tattoos from the paths, layers and channels. After the image
- * data has been loaded and all the tattoos have been set then this is
- * the last procedure that should be called. If effectively does a
- * status check on the tattoo values that have been set to make sure
- * that all is OK.
+ * This procedure returns the layer with the given name in the
+ * specified image.
*
- * Returns: TRUE on success.
+ * Returns: The layer with the specified name.
+ *
+ * Since: 2.8
**/
-gboolean
-gimp_image_set_tattoo_state (GimpImage *image,
- guint tattoo_state)
+gint32
+_gimp_image_get_layer_by_name (gint32 image_ID,
+ const gchar *name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gboolean success = TRUE;
+ gint32 layer_ID = -1;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- G_TYPE_UINT, tattoo_state,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_STRING, name,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-set-tattoo-state",
+ "gimp-image-get-layer-by-name",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-set-tattoo-state",
+ return_vals = gimp_run_procedure_array ("gimp-image-get-layer-by-name",
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)
+ layer_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return success;
+ return layer_ID;
}
/**
- * gimp_image_get_layer_by_tattoo:
+ * gimp_image_get_channel_by_name:
* @image: The image.
- * @tattoo: The tattoo of the layer to find.
+ * @name: The name of the channel to find.
*
- * Find a layer with a given tattoo in an image.
+ * Find a channel with a given name in an image.
*
- * This procedure returns the layer with the given tattoo in the
+ * This procedure returns the channel with the given name in the
* specified image.
*
- * Returns: The layer with the specified tattoo.
+ * Returns: The channel with the specified name.
+ *
+ * Since: 2.8
**/
gint32
-gimp_image_get_layer_by_tattoo (GimpImage *image,
- guint tattoo)
+gimp_image_get_channel_by_name (GimpImage *image,
+ const gchar *name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 layer_ID = -1;
+ gint32 channel_ID = -1;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- G_TYPE_UINT, tattoo,
+ G_TYPE_STRING, name,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-layer-by-tattoo",
+ "gimp-image-get-channel-by-name",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-layer-by-tattoo",
+ return_vals = gimp_run_procedure_array ("gimp-image-get-channel-by-name",
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));
+ channel_ID = gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return layer_ID;
+ return channel_ID;
}
/**
- * gimp_image_get_channel_by_tattoo:
- * @image: The image.
- * @tattoo: The tattoo of the channel to find.
+ * _gimp_image_get_channel_by_name: (skip)
+ * @image_ID: The image.
+ * @name: The name of the channel to find.
*
- * Find a channel with a given tattoo in an image.
+ * Find a channel with a given name in an image.
*
- * This procedure returns the channel with the given tattoo in the
+ * This procedure returns the channel with the given name in the
* specified image.
*
- * Returns: The channel with the specified tattoo.
+ * Returns: The channel with the specified name.
+ *
+ * Since: 2.8
**/
gint32
-gimp_image_get_channel_by_tattoo (GimpImage *image,
- guint tattoo)
+_gimp_image_get_channel_by_name (gint32 image_ID,
+ const gchar *name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -3398,16 +7006,16 @@ gimp_image_get_channel_by_tattoo (GimpImage *image,
gint32 channel_ID = -1;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- G_TYPE_UINT, tattoo,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_STRING, name,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-channel-by-tattoo",
+ "gimp-image-get-channel-by-name",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-channel-by-tattoo",
+ return_vals = gimp_run_procedure_array ("gimp-image-get-channel-by-name",
args);
gimp_value_array_unref (args);
@@ -3420,22 +7028,22 @@ gimp_image_get_channel_by_tattoo (GimpImage *image,
}
/**
- * gimp_image_get_vectors_by_tattoo:
+ * gimp_image_get_vectors_by_name:
* @image: The image.
- * @tattoo: The tattoo of the vectors to find.
+ * @name: The name of the vectors to find.
*
- * Find a vectors with a given tattoo in an image.
+ * Find a vectors with a given name in an image.
*
- * This procedure returns the vectors with the given tattoo in the
+ * This procedure returns the vectors with the given name in the
* specified image.
*
- * Returns: The vectors with the specified tattoo.
+ * Returns: The vectors with the specified name.
*
- * Since: 2.6
+ * Since: 2.8
**/
gint32
-gimp_image_get_vectors_by_tattoo (GimpImage *image,
- guint tattoo)
+gimp_image_get_vectors_by_name (GimpImage *image,
+ const gchar *name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -3444,15 +7052,15 @@ gimp_image_get_vectors_by_tattoo (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- G_TYPE_UINT, tattoo,
+ G_TYPE_STRING, name,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-vectors-by-tattoo",
+ "gimp-image-get-vectors-by-name",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-vectors-by-tattoo",
+ return_vals = gimp_run_procedure_array ("gimp-image-get-vectors-by-name",
args);
gimp_value_array_unref (args);
@@ -3465,148 +7073,146 @@ gimp_image_get_vectors_by_tattoo (GimpImage *image,
}
/**
- * gimp_image_get_layer_by_name:
- * @image: The image.
- * @name: The name of the layer to find.
+ * _gimp_image_get_vectors_by_name: (skip)
+ * @image_ID: The image.
+ * @name: The name of the vectors to find.
*
- * Find a layer with a given name in an image.
+ * Find a vectors with a given name in an image.
*
- * This procedure returns the layer with the given name in the
+ * This procedure returns the vectors with the given name in the
* specified image.
*
- * Returns: The layer with the specified name.
+ * Returns: The vectors with the specified name.
*
* Since: 2.8
**/
gint32
-gimp_image_get_layer_by_name (GimpImage *image,
- const gchar *name)
+_gimp_image_get_vectors_by_name (gint32 image_ID,
+ const gchar *name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 layer_ID = -1;
+ gint32 vectors_ID = -1;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_STRING, name,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-layer-by-name",
+ "gimp-image-get-vectors-by-name",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-layer-by-name",
+ return_vals = gimp_run_procedure_array ("gimp-image-get-vectors-by-name",
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));
+ vectors_ID = gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
- return layer_ID;
+ return vectors_ID;
}
/**
- * gimp_image_get_channel_by_name:
+ * gimp_image_attach_parasite:
* @image: The image.
- * @name: The name of the channel to find.
+ * @parasite: The parasite to attach to an image.
*
- * Find a channel with a given name in an image.
+ * Add a parasite to an image.
*
- * This procedure returns the channel with the given name in the
- * specified image.
+ * This procedure attaches a parasite to an image. It has no return
+ * values.
*
- * Returns: The channel with the specified name.
+ * Returns: TRUE on success.
*
* Since: 2.8
**/
-gint32
-gimp_image_get_channel_by_name (GimpImage *image,
- const gchar *name)
+gboolean
+gimp_image_attach_parasite (GimpImage *image,
+ const GimpParasite *parasite)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 channel_ID = -1;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- G_TYPE_STRING, name,
+ GIMP_TYPE_PARASITE, parasite,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-channel-by-name",
+ "gimp-image-attach-parasite",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-channel-by-name",
+ return_vals = gimp_run_procedure_array ("gimp-image-attach-parasite",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- channel_ID = gimp_value_get_channel_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 channel_ID;
+ return success;
}
/**
- * gimp_image_get_vectors_by_name:
- * @image: The image.
- * @name: The name of the vectors to find.
+ * _gimp_image_attach_parasite: (skip)
+ * @image_ID: The image.
+ * @parasite: The parasite to attach to an image.
*
- * Find a vectors with a given name in an image.
+ * Add a parasite to an image.
*
- * This procedure returns the vectors with the given name in the
- * specified image.
+ * This procedure attaches a parasite to an image. It has no return
+ * values.
*
- * Returns: The vectors with the specified name.
+ * Returns: TRUE on success.
*
* Since: 2.8
**/
-gint32
-gimp_image_get_vectors_by_name (GimpImage *image,
- const gchar *name)
+gboolean
+_gimp_image_attach_parasite (gint32 image_ID,
+ const GimpParasite *parasite)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
GimpValueArray *return_vals;
- gint32 vectors_ID = -1;
+ gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- G_TYPE_STRING, name,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_PARASITE, parasite,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-get-vectors-by-name",
+ "gimp-image-attach-parasite",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-get-vectors-by-name",
+ return_vals = gimp_run_procedure_array ("gimp-image-attach-parasite",
args);
gimp_value_array_unref (args);
- if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- vectors_ID = gimp_value_get_vectors_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 vectors_ID;
+ return success;
}
/**
- * gimp_image_attach_parasite:
+ * gimp_image_detach_parasite:
* @image: The image.
- * @parasite: The parasite to attach to an image.
+ * @name: The name of the parasite to detach from an image.
*
- * Add a parasite to an image.
+ * Removes a parasite from an image.
*
- * This procedure attaches a parasite to an image. It has no return
+ * This procedure detaches a parasite from an image. It has no return
* values.
*
* Returns: TRUE on success.
@@ -3614,8 +7220,8 @@ gimp_image_get_vectors_by_name (GimpImage *image,
* Since: 2.8
**/
gboolean
-gimp_image_attach_parasite (GimpImage *image,
- const GimpParasite *parasite)
+gimp_image_detach_parasite (GimpImage *image,
+ const gchar *name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -3624,15 +7230,15 @@ gimp_image_attach_parasite (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- GIMP_TYPE_PARASITE, parasite,
+ G_TYPE_STRING, name,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-image-attach-parasite",
+ "gimp-image-detach-parasite",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-image-attach-parasite",
+ return_vals = gimp_run_procedure_array ("gimp-image-detach-parasite",
args);
gimp_value_array_unref (args);
@@ -3644,8 +7250,8 @@ gimp_image_attach_parasite (GimpImage *image,
}
/**
- * gimp_image_detach_parasite:
- * @image: The image.
+ * _gimp_image_detach_parasite: (skip)
+ * @image_ID: The image.
* @name: The name of the parasite to detach from an image.
*
* Removes a parasite from an image.
@@ -3658,8 +7264,8 @@ gimp_image_attach_parasite (GimpImage *image,
* Since: 2.8
**/
gboolean
-gimp_image_detach_parasite (GimpImage *image,
- const gchar *name)
+_gimp_image_detach_parasite (gint32 image_ID,
+ const gchar *name)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -3667,7 +7273,7 @@ gimp_image_detach_parasite (GimpImage *image,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_STRING, name,
G_TYPE_NONE);
@@ -3732,6 +7338,51 @@ gimp_image_get_parasite (GimpImage *image,
return parasite;
}
+/**
+ * _gimp_image_get_parasite: (skip)
+ * @image_ID: The image.
+ * @name: The name of the parasite to find.
+ *
+ * Look up a parasite in an image
+ *
+ * Finds and returns the parasite that was previously attached to an
+ * image.
+ *
+ * Returns: The found parasite.
+ *
+ * Since: 2.8
+ **/
+GimpParasite *
+_gimp_image_get_parasite (gint32 image_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_IMAGE_ID, image_ID,
+ G_TYPE_STRING, name,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-parasite",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-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_image_get_parasite_list:
* @image: The image.
@@ -3781,3 +7432,53 @@ gimp_image_get_parasite_list (GimpImage *image,
return parasites;
}
+
+/**
+ * _gimp_image_get_parasite_list: (skip)
+ * @image_ID: The image.
+ * @num_parasites: (out): The number of attached parasites.
+ *
+ * List all parasites.
+ *
+ * Returns a list of all currently attached parasites.
+ *
+ * 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_image_get_parasite_list (gint32 image_ID,
+ 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_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-parasite-list",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-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;
+}
diff --git a/libgimp/gimpimage_pdb.h b/libgimp/gimpimage_pdb.h
index b7ad5ea4e6..c6a59a1aea 100644
--- a/libgimp/gimpimage_pdb.h
+++ b/libgimp/gimpimage_pdb.h
@@ -32,165 +32,404 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gboolean gimp_image_is_valid (GimpImage *image);
-gint* gimp_image_list (gint *num_images);
-GimpImage* gimp_image_new (gint width,
- gint height,
- GimpImageBaseType type);
-GimpImage* gimp_image_new_with_precision (gint width,
- gint height,
- GimpImageBaseType type,
- GimpPrecision precision);
-GimpImage* gimp_image_duplicate (GimpImage *image);
-gboolean gimp_image_delete (GimpImage *image);
-GimpImageBaseType gimp_image_base_type (GimpImage *image);
-GimpPrecision gimp_image_get_precision (GimpImage *image);
-GimpLayerMode gimp_image_get_default_new_layer_mode (GimpImage *image);
-gint gimp_image_width (GimpImage *image);
-gint gimp_image_height (GimpImage *image);
-gint* gimp_image_get_layers (GimpImage *image,
- gint *num_layers);
-gint* gimp_image_get_channels (GimpImage *image,
- gint *num_channels);
-gint* gimp_image_get_vectors (GimpImage *image,
- gint *num_vectors);
-gint32 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);
-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);
-gint32 gimp_image_pick_correlate_layer (GimpImage *image,
- gint x,
- gint y);
-gboolean gimp_image_insert_layer (GimpImage *image,
- gint32 layer_ID,
- gint32 parent_ID,
- gint position);
-gboolean gimp_image_remove_layer (GimpImage *image,
- gint32 layer_ID);
-gboolean gimp_image_freeze_layers (GimpImage *image);
-gboolean gimp_image_thaw_layers (GimpImage *image);
-gboolean gimp_image_insert_channel (GimpImage *image,
- gint32 channel_ID,
- gint32 parent_ID,
- gint position);
-gboolean gimp_image_remove_channel (GimpImage *image,
- gint32 channel_ID);
-gboolean gimp_image_freeze_channels (GimpImage *image);
-gboolean gimp_image_thaw_channels (GimpImage *image);
-gboolean gimp_image_insert_vectors (GimpImage *image,
- gint32 vectors_ID,
- gint32 parent_ID,
- gint position);
-gboolean gimp_image_remove_vectors (GimpImage *image,
- gint32 vectors_ID);
-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);
-gboolean gimp_image_raise_item (GimpImage *image,
- gint32 item_ID);
-gboolean gimp_image_lower_item (GimpImage *image,
- gint32 item_ID);
-gboolean gimp_image_raise_item_to_top (GimpImage *image,
- gint32 item_ID);
-gboolean gimp_image_lower_item_to_bottom (GimpImage *image,
- gint32 item_ID);
-gboolean gimp_image_reorder_item (GimpImage *image,
- gint32 item_ID,
- gint32 parent_ID,
- gint position);
-gint32 gimp_image_flatten (GimpImage *image);
-gint32 gimp_image_merge_visible_layers (GimpImage *image,
- GimpMergeType merge_type);
-gint32 gimp_image_merge_down (GimpImage *image,
- gint32 merge_layer_ID,
- GimpMergeType merge_type);
-G_GNUC_INTERNAL guint8* _gimp_image_get_colormap (GimpImage *image,
- gint *num_bytes);
-G_GNUC_INTERNAL gboolean _gimp_image_set_colormap (GimpImage *image,
- gint num_bytes,
- const guint8 *colormap);
-G_GNUC_INTERNAL gchar* _gimp_image_get_metadata (GimpImage *image);
-G_GNUC_INTERNAL gboolean _gimp_image_set_metadata (GimpImage *image,
- const gchar *metadata_string);
-gboolean gimp_image_clean_all (GimpImage *image);
-gboolean gimp_image_is_dirty (GimpImage *image);
-G_GNUC_INTERNAL gboolean _gimp_image_thumbnail (GimpImage *image,
- gint width,
- gint height,
- gint *actual_width,
- gint *actual_height,
- gint *bpp,
- gint *thumbnail_data_count,
- guint8 **thumbnail_data);
-gint32 gimp_image_get_active_layer (GimpImage *image);
-gboolean gimp_image_set_active_layer (GimpImage *image,
- gint32 active_layer_ID);
-gint32 gimp_image_get_active_channel (GimpImage *image);
-gboolean gimp_image_set_active_channel (GimpImage *image,
- gint32 active_channel_ID);
-gint32 gimp_image_get_active_vectors (GimpImage *image);
-gboolean gimp_image_set_active_vectors (GimpImage *image,
- gint32 active_vectors_ID);
-gint32 gimp_image_get_selection (GimpImage *image);
-gboolean gimp_image_get_component_active (GimpImage *image,
- GimpChannelType component);
-gboolean gimp_image_set_component_active (GimpImage *image,
- GimpChannelType component,
- gboolean active);
-gboolean gimp_image_get_component_visible (GimpImage *image,
- GimpChannelType component);
-gboolean gimp_image_set_component_visible (GimpImage *image,
- GimpChannelType component,
- gboolean visible);
-gchar* gimp_image_get_filename (GimpImage *image);
-gboolean gimp_image_set_filename (GimpImage *image,
- const gchar *filename);
-gchar* gimp_image_get_uri (GimpImage *image);
-gchar* gimp_image_get_xcf_uri (GimpImage *image);
-gchar* gimp_image_get_imported_uri (GimpImage *image);
-gchar* gimp_image_get_exported_uri (GimpImage *image);
-gchar* gimp_image_get_name (GimpImage *image);
-gboolean gimp_image_get_resolution (GimpImage *image,
- gdouble *xresolution,
- gdouble *yresolution);
-gboolean gimp_image_set_resolution (GimpImage *image,
- gdouble xresolution,
- gdouble yresolution);
-GimpUnit gimp_image_get_unit (GimpImage *image);
-gboolean gimp_image_set_unit (GimpImage *image,
- GimpUnit unit);
-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,
- 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,
- const gchar *name);
-gint32 gimp_image_get_channel_by_name (GimpImage *image,
- const gchar *name);
-gint32 gimp_image_get_vectors_by_name (GimpImage *image,
- const gchar *name);
-gboolean gimp_image_attach_parasite (GimpImage *image,
- const GimpParasite *parasite);
-gboolean gimp_image_detach_parasite (GimpImage *image,
- const gchar *name);
-GimpParasite* gimp_image_get_parasite (GimpImage *image,
- const gchar *name);
-gchar** gimp_image_get_parasite_list (GimpImage *image,
- gint *num_parasites);
+gboolean gimp_image_is_valid (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_is_valid)
+G_GNUC_INTERNAL gboolean _gimp_image_is_valid (gint32 image_ID);
+gint* gimp_image_list (gint *num_images);
+GimpImage* gimp_image_new (gint width,
+ gint height,
+ GimpImageBaseType type);
+GIMP_DEPRECATED_FOR(gimp_image_new)
+G_GNUC_INTERNAL gint32 _gimp_image_new (gint width,
+ gint height,
+ GimpImageBaseType type);
+GimpImage* gimp_image_new_with_precision (gint width,
+ gint height,
+ GimpImageBaseType type,
+ GimpPrecision precision);
+GIMP_DEPRECATED_FOR(gimp_image_new_with_precision)
+G_GNUC_INTERNAL gint32 _gimp_image_new_with_precision (gint width,
+ gint height,
+ GimpImageBaseType type,
+ GimpPrecision precision);
+GimpImage* gimp_image_duplicate (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_duplicate)
+G_GNUC_INTERNAL gint32 _gimp_image_duplicate (gint32 image_ID);
+gboolean gimp_image_delete (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_delete)
+G_GNUC_INTERNAL gboolean _gimp_image_delete (gint32 image_ID);
+GimpImageBaseType gimp_image_base_type (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_base_type)
+G_GNUC_INTERNAL GimpImageBaseType _gimp_image_base_type (gint32 image_ID);
+GimpPrecision gimp_image_get_precision (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_get_precision)
+G_GNUC_INTERNAL GimpPrecision _gimp_image_get_precision (gint32 image_ID);
+GimpLayerMode gimp_image_get_default_new_layer_mode (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_get_default_new_layer_mode)
+G_GNUC_INTERNAL GimpLayerMode _gimp_image_get_default_new_layer_mode (gint32 image_ID);
+gint gimp_image_width (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_width)
+G_GNUC_INTERNAL gint _gimp_image_width (gint32 image_ID);
+gint gimp_image_height (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_height)
+G_GNUC_INTERNAL gint _gimp_image_height (gint32 image_ID);
+gint* gimp_image_get_layers (GimpImage *image,
+ gint *num_layers);
+GIMP_DEPRECATED_FOR(gimp_image_get_layers)
+G_GNUC_INTERNAL gint* _gimp_image_get_layers (gint32 image_ID,
+ gint *num_layers);
+gint* gimp_image_get_channels (GimpImage *image,
+ gint *num_channels);
+GIMP_DEPRECATED_FOR(gimp_image_get_channels)
+G_GNUC_INTERNAL gint* _gimp_image_get_channels (gint32 image_ID,
+ gint *num_channels);
+gint* gimp_image_get_vectors (GimpImage *image,
+ gint *num_vectors);
+GIMP_DEPRECATED_FOR(gimp_image_get_vectors)
+G_GNUC_INTERNAL gint* _gimp_image_get_vectors (gint32 image_ID,
+ gint *num_vectors);
+gint32 gimp_image_get_active_drawable (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_get_active_drawable)
+G_GNUC_INTERNAL gint32 _gimp_image_get_active_drawable (gint32 image_ID);
+gboolean gimp_image_unset_active_channel (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_unset_active_channel)
+G_GNUC_INTERNAL gboolean _gimp_image_unset_active_channel (gint32 image_ID);
+gint32 gimp_image_get_floating_sel (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_get_floating_sel)
+G_GNUC_INTERNAL gint32 _gimp_image_get_floating_sel (gint32 image_ID);
+gint32 gimp_image_floating_sel_attached_to (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_floating_sel_attached_to)
+G_GNUC_INTERNAL gint32 _gimp_image_floating_sel_attached_to (gint32 image_ID);
+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_DEPRECATED_FOR(gimp_image_pick_color)
+G_GNUC_INTERNAL gboolean _gimp_image_pick_color (gint32 image_ID,
+ gint32 drawable_ID,
+ gdouble x,
+ gdouble y,
+ gboolean sample_merged,
+ gboolean
sample_average,
+ gdouble
average_radius,
+ GimpRGB *color);
+gint32 gimp_image_pick_correlate_layer (GimpImage *image,
+ gint x,
+ gint y);
+GIMP_DEPRECATED_FOR(gimp_image_pick_correlate_layer)
+G_GNUC_INTERNAL gint32 _gimp_image_pick_correlate_layer (gint32 image_ID,
+ gint x,
+ gint y);
+gboolean gimp_image_insert_layer (GimpImage *image,
+ gint32 layer_ID,
+ gint32 parent_ID,
+ gint position);
+GIMP_DEPRECATED_FOR(gimp_image_insert_layer)
+G_GNUC_INTERNAL gboolean _gimp_image_insert_layer (gint32 image_ID,
+ gint32 layer_ID,
+ gint32 parent_ID,
+ gint position);
+gboolean gimp_image_remove_layer (GimpImage *image,
+ gint32 layer_ID);
+GIMP_DEPRECATED_FOR(gimp_image_remove_layer)
+G_GNUC_INTERNAL gboolean _gimp_image_remove_layer (gint32 image_ID,
+ gint32 layer_ID);
+gboolean gimp_image_freeze_layers (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_freeze_layers)
+G_GNUC_INTERNAL gboolean _gimp_image_freeze_layers (gint32 image_ID);
+gboolean gimp_image_thaw_layers (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_thaw_layers)
+G_GNUC_INTERNAL gboolean _gimp_image_thaw_layers (gint32 image_ID);
+gboolean gimp_image_insert_channel (GimpImage *image,
+ gint32 channel_ID,
+ gint32 parent_ID,
+ gint position);
+GIMP_DEPRECATED_FOR(gimp_image_insert_channel)
+G_GNUC_INTERNAL gboolean _gimp_image_insert_channel (gint32 image_ID,
+ gint32 channel_ID,
+ gint32 parent_ID,
+ gint position);
+gboolean gimp_image_remove_channel (GimpImage *image,
+ gint32 channel_ID);
+GIMP_DEPRECATED_FOR(gimp_image_remove_channel)
+G_GNUC_INTERNAL gboolean _gimp_image_remove_channel (gint32 image_ID,
+ gint32 channel_ID);
+gboolean gimp_image_freeze_channels (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_freeze_channels)
+G_GNUC_INTERNAL gboolean _gimp_image_freeze_channels (gint32 image_ID);
+gboolean gimp_image_thaw_channels (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_thaw_channels)
+G_GNUC_INTERNAL gboolean _gimp_image_thaw_channels (gint32 image_ID);
+gboolean gimp_image_insert_vectors (GimpImage *image,
+ gint32 vectors_ID,
+ gint32 parent_ID,
+ gint position);
+GIMP_DEPRECATED_FOR(gimp_image_insert_vectors)
+G_GNUC_INTERNAL gboolean _gimp_image_insert_vectors (gint32 image_ID,
+ gint32 vectors_ID,
+ gint32 parent_ID,
+ gint position);
+gboolean gimp_image_remove_vectors (GimpImage *image,
+ gint32 vectors_ID);
+GIMP_DEPRECATED_FOR(gimp_image_remove_vectors)
+G_GNUC_INTERNAL gboolean _gimp_image_remove_vectors (gint32 image_ID,
+ gint32 vectors_ID);
+gboolean gimp_image_freeze_vectors (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_freeze_vectors)
+G_GNUC_INTERNAL gboolean _gimp_image_freeze_vectors (gint32 image_ID);
+gboolean gimp_image_thaw_vectors (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_thaw_vectors)
+G_GNUC_INTERNAL gboolean _gimp_image_thaw_vectors (gint32 image_ID);
+gint gimp_image_get_item_position (GimpImage *image,
+ gint32 item_ID);
+GIMP_DEPRECATED_FOR(gimp_image_get_item_position)
+G_GNUC_INTERNAL gint _gimp_image_get_item_position (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_raise_item (GimpImage *image,
+ gint32 item_ID);
+GIMP_DEPRECATED_FOR(gimp_image_raise_item)
+G_GNUC_INTERNAL gboolean _gimp_image_raise_item (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_lower_item (GimpImage *image,
+ gint32 item_ID);
+GIMP_DEPRECATED_FOR(gimp_image_lower_item)
+G_GNUC_INTERNAL gboolean _gimp_image_lower_item (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_raise_item_to_top (GimpImage *image,
+ gint32 item_ID);
+GIMP_DEPRECATED_FOR(gimp_image_raise_item_to_top)
+G_GNUC_INTERNAL gboolean _gimp_image_raise_item_to_top (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_lower_item_to_bottom (GimpImage *image,
+ gint32 item_ID);
+GIMP_DEPRECATED_FOR(gimp_image_lower_item_to_bottom)
+G_GNUC_INTERNAL gboolean _gimp_image_lower_item_to_bottom (gint32 image_ID,
+ gint32 item_ID);
+gboolean gimp_image_reorder_item (GimpImage *image,
+ gint32 item_ID,
+ gint32 parent_ID,
+ gint position);
+GIMP_DEPRECATED_FOR(gimp_image_reorder_item)
+G_GNUC_INTERNAL gboolean _gimp_image_reorder_item (gint32 image_ID,
+ gint32 item_ID,
+ gint32 parent_ID,
+ gint position);
+gint32 gimp_image_flatten (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_flatten)
+G_GNUC_INTERNAL gint32 _gimp_image_flatten (gint32 image_ID);
+gint32 gimp_image_merge_visible_layers (GimpImage *image,
+ GimpMergeType merge_type);
+GIMP_DEPRECATED_FOR(gimp_image_merge_visible_layers)
+G_GNUC_INTERNAL gint32 _gimp_image_merge_visible_layers (gint32 image_ID,
+ GimpMergeType merge_type);
+gint32 gimp_image_merge_down (GimpImage *image,
+ gint32
merge_layer_ID,
+ GimpMergeType merge_type);
+GIMP_DEPRECATED_FOR(gimp_image_merge_down)
+G_GNUC_INTERNAL gint32 _gimp_image_merge_down (gint32 image_ID,
+ gint32
merge_layer_ID,
+ GimpMergeType merge_type);
+G_GNUC_INTERNAL guint8* _gimp_image_get_colormap (GimpImage *image,
+ gint *num_bytes);
+GIMP_DEPRECATED_FOR(_gimp_image_get_colormap)
+G_GNUC_INTERNAL guint8* __gimp_image_get_colormap (gint32 image_ID,
+ gint *num_bytes);
+G_GNUC_INTERNAL gboolean _gimp_image_set_colormap (GimpImage *image,
+ gint num_bytes,
+ const guint8 *colormap);
+GIMP_DEPRECATED_FOR(_gimp_image_set_colormap)
+G_GNUC_INTERNAL gboolean __gimp_image_set_colormap (gint32 image_ID,
+ gint num_bytes,
+ const guint8 *colormap);
+G_GNUC_INTERNAL gchar* _gimp_image_get_metadata (GimpImage *image);
+GIMP_DEPRECATED_FOR(_gimp_image_get_metadata)
+G_GNUC_INTERNAL gchar* __gimp_image_get_metadata (gint32 image_ID);
+G_GNUC_INTERNAL gboolean _gimp_image_set_metadata (GimpImage *image,
+ const gchar
*metadata_string);
+GIMP_DEPRECATED_FOR(_gimp_image_set_metadata)
+G_GNUC_INTERNAL gboolean __gimp_image_set_metadata (gint32 image_ID,
+ const gchar
*metadata_string);
+gboolean gimp_image_clean_all (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_clean_all)
+G_GNUC_INTERNAL gboolean _gimp_image_clean_all (gint32 image_ID);
+gboolean gimp_image_is_dirty (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_is_dirty)
+G_GNUC_INTERNAL gboolean _gimp_image_is_dirty (gint32 image_ID);
+G_GNUC_INTERNAL gboolean _gimp_image_thumbnail (GimpImage *image,
+ gint width,
+ gint height,
+ gint *actual_width,
+ gint *actual_height,
+ gint *bpp,
+ gint
*thumbnail_data_count,
+ guint8
**thumbnail_data);
+GIMP_DEPRECATED_FOR(_gimp_image_thumbnail)
+G_GNUC_INTERNAL gboolean __gimp_image_thumbnail (gint32 image_ID,
+ gint width,
+ gint height,
+ gint *actual_width,
+ gint *actual_height,
+ gint *bpp,
+ gint
*thumbnail_data_count,
+ guint8
**thumbnail_data);
+gint32 gimp_image_get_active_layer (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_get_active_layer)
+G_GNUC_INTERNAL gint32 _gimp_image_get_active_layer (gint32 image_ID);
+gboolean gimp_image_set_active_layer (GimpImage *image,
+ gint32
active_layer_ID);
+GIMP_DEPRECATED_FOR(gimp_image_set_active_layer)
+G_GNUC_INTERNAL gboolean _gimp_image_set_active_layer (gint32 image_ID,
+ gint32
active_layer_ID);
+gint32 gimp_image_get_active_channel (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_get_active_channel)
+G_GNUC_INTERNAL gint32 _gimp_image_get_active_channel (gint32 image_ID);
+gboolean gimp_image_set_active_channel (GimpImage *image,
+ gint32
active_channel_ID);
+GIMP_DEPRECATED_FOR(gimp_image_set_active_channel)
+G_GNUC_INTERNAL gboolean _gimp_image_set_active_channel (gint32 image_ID,
+ gint32
active_channel_ID);
+gint32 gimp_image_get_active_vectors (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_get_active_vectors)
+G_GNUC_INTERNAL gint32 _gimp_image_get_active_vectors (gint32 image_ID);
+gboolean gimp_image_set_active_vectors (GimpImage *image,
+ gint32
active_vectors_ID);
+GIMP_DEPRECATED_FOR(gimp_image_set_active_vectors)
+G_GNUC_INTERNAL gboolean _gimp_image_set_active_vectors (gint32 image_ID,
+ gint32
active_vectors_ID);
+gint32 gimp_image_get_selection (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_get_selection)
+G_GNUC_INTERNAL gint32 _gimp_image_get_selection (gint32 image_ID);
+gboolean gimp_image_get_component_active (GimpImage *image,
+ GimpChannelType component);
+GIMP_DEPRECATED_FOR(gimp_image_get_component_active)
+G_GNUC_INTERNAL gboolean _gimp_image_get_component_active (gint32 image_ID,
+ GimpChannelType component);
+gboolean gimp_image_set_component_active (GimpImage *image,
+ GimpChannelType component,
+ gboolean active);
+GIMP_DEPRECATED_FOR(gimp_image_set_component_active)
+G_GNUC_INTERNAL gboolean _gimp_image_set_component_active (gint32 image_ID,
+ GimpChannelType component,
+ gboolean active);
+gboolean gimp_image_get_component_visible (GimpImage *image,
+ GimpChannelType component);
+GIMP_DEPRECATED_FOR(gimp_image_get_component_visible)
+G_GNUC_INTERNAL gboolean _gimp_image_get_component_visible (gint32 image_ID,
+ GimpChannelType component);
+gboolean gimp_image_set_component_visible (GimpImage *image,
+ GimpChannelType component,
+ gboolean visible);
+GIMP_DEPRECATED_FOR(gimp_image_set_component_visible)
+G_GNUC_INTERNAL gboolean _gimp_image_set_component_visible (gint32 image_ID,
+ GimpChannelType component,
+ gboolean visible);
+gchar* gimp_image_get_filename (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_get_filename)
+G_GNUC_INTERNAL gchar* _gimp_image_get_filename (gint32 image_ID);
+gboolean gimp_image_set_filename (GimpImage *image,
+ const gchar *filename);
+GIMP_DEPRECATED_FOR(gimp_image_set_filename)
+G_GNUC_INTERNAL gboolean _gimp_image_set_filename (gint32 image_ID,
+ const gchar *filename);
+gchar* gimp_image_get_uri (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_get_uri)
+G_GNUC_INTERNAL gchar* _gimp_image_get_uri (gint32 image_ID);
+gchar* gimp_image_get_xcf_uri (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_get_xcf_uri)
+G_GNUC_INTERNAL gchar* _gimp_image_get_xcf_uri (gint32 image_ID);
+gchar* gimp_image_get_imported_uri (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_get_imported_uri)
+G_GNUC_INTERNAL gchar* _gimp_image_get_imported_uri (gint32 image_ID);
+gchar* gimp_image_get_exported_uri (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_get_exported_uri)
+G_GNUC_INTERNAL gchar* _gimp_image_get_exported_uri (gint32 image_ID);
+gchar* gimp_image_get_name (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_get_name)
+G_GNUC_INTERNAL gchar* _gimp_image_get_name (gint32 image_ID);
+gboolean gimp_image_get_resolution (GimpImage *image,
+ gdouble *xresolution,
+ gdouble *yresolution);
+GIMP_DEPRECATED_FOR(gimp_image_get_resolution)
+G_GNUC_INTERNAL gboolean _gimp_image_get_resolution (gint32 image_ID,
+ gdouble *xresolution,
+ gdouble *yresolution);
+gboolean gimp_image_set_resolution (GimpImage *image,
+ gdouble xresolution,
+ gdouble yresolution);
+GIMP_DEPRECATED_FOR(gimp_image_set_resolution)
+G_GNUC_INTERNAL gboolean _gimp_image_set_resolution (gint32 image_ID,
+ gdouble xresolution,
+ gdouble yresolution);
+GimpUnit gimp_image_get_unit (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_get_unit)
+G_GNUC_INTERNAL GimpUnit _gimp_image_get_unit (gint32 image_ID);
+gboolean gimp_image_set_unit (GimpImage *image,
+ GimpUnit unit);
+GIMP_DEPRECATED_FOR(gimp_image_set_unit)
+G_GNUC_INTERNAL gboolean _gimp_image_set_unit (gint32 image_ID,
+ GimpUnit unit);
+guint gimp_image_get_tattoo_state (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_get_tattoo_state)
+G_GNUC_INTERNAL guint _gimp_image_get_tattoo_state (gint32 image_ID);
+gboolean gimp_image_set_tattoo_state (GimpImage *image,
+ guint tattoo_state);
+GIMP_DEPRECATED_FOR(gimp_image_set_tattoo_state)
+G_GNUC_INTERNAL gboolean _gimp_image_set_tattoo_state (gint32 image_ID,
+ guint tattoo_state);
+gint32 gimp_image_get_layer_by_tattoo (GimpImage *image,
+ guint tattoo);
+GIMP_DEPRECATED_FOR(gimp_image_get_layer_by_tattoo)
+G_GNUC_INTERNAL gint32 _gimp_image_get_layer_by_tattoo (gint32 image_ID,
+ guint tattoo);
+gint32 gimp_image_get_channel_by_tattoo (GimpImage *image,
+ guint tattoo);
+GIMP_DEPRECATED_FOR(gimp_image_get_channel_by_tattoo)
+G_GNUC_INTERNAL gint32 _gimp_image_get_channel_by_tattoo (gint32 image_ID,
+ guint tattoo);
+gint32 gimp_image_get_vectors_by_tattoo (GimpImage *image,
+ guint tattoo);
+GIMP_DEPRECATED_FOR(gimp_image_get_vectors_by_tattoo)
+G_GNUC_INTERNAL gint32 _gimp_image_get_vectors_by_tattoo (gint32 image_ID,
+ guint tattoo);
+gint32 gimp_image_get_layer_by_name (GimpImage *image,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_image_get_layer_by_name)
+G_GNUC_INTERNAL gint32 _gimp_image_get_layer_by_name (gint32 image_ID,
+ const gchar *name);
+gint32 gimp_image_get_channel_by_name (GimpImage *image,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_image_get_channel_by_name)
+G_GNUC_INTERNAL gint32 _gimp_image_get_channel_by_name (gint32 image_ID,
+ const gchar *name);
+gint32 gimp_image_get_vectors_by_name (GimpImage *image,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_image_get_vectors_by_name)
+G_GNUC_INTERNAL gint32 _gimp_image_get_vectors_by_name (gint32 image_ID,
+ const gchar *name);
+gboolean gimp_image_attach_parasite (GimpImage *image,
+ const GimpParasite *parasite);
+GIMP_DEPRECATED_FOR(gimp_image_attach_parasite)
+G_GNUC_INTERNAL gboolean _gimp_image_attach_parasite (gint32 image_ID,
+ const GimpParasite *parasite);
+gboolean gimp_image_detach_parasite (GimpImage *image,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_image_detach_parasite)
+G_GNUC_INTERNAL gboolean _gimp_image_detach_parasite (gint32 image_ID,
+ const gchar *name);
+GimpParasite* gimp_image_get_parasite (GimpImage *image,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_image_get_parasite)
+G_GNUC_INTERNAL GimpParasite* _gimp_image_get_parasite (gint32 image_ID,
+ const gchar *name);
+gchar** gimp_image_get_parasite_list (GimpImage *image,
+ gint
*num_parasites);
+GIMP_DEPRECATED_FOR(gimp_image_get_parasite_list)
+G_GNUC_INTERNAL gchar** _gimp_image_get_parasite_list (gint32 image_ID,
+ gint
*num_parasites);
G_END_DECLS
diff --git a/libgimp/gimpimagecolorprofile_pdb.c b/libgimp/gimpimagecolorprofile_pdb.c
index 170972c7ba..921cac6cc2 100644
--- a/libgimp/gimpimagecolorprofile_pdb.c
+++ b/libgimp/gimpimagecolorprofile_pdb.c
@@ -85,6 +85,56 @@ _gimp_image_get_color_profile (GimpImage *image,
return profile_data;
}
+/**
+ * __gimp_image_get_color_profile: (skip)
+ * @image_ID: The image.
+ * @num_bytes: (out): Number of bytes in the color_profile array.
+ *
+ * Returns the image's color profile
+ *
+ * This procedure returns the image's color profile, or NULL if the
+ * image has no color profile assigned.
+ *
+ * Returns: (array length=num_bytes): The image's serialized color profile.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.10
+ **/
+guint8 *
+__gimp_image_get_color_profile (gint32 image_ID,
+ gint *num_bytes)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ guint8 *profile_data = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-color-profile",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-color-profile",
+ args);
+ gimp_value_array_unref (args);
+
+ *num_bytes = 0;
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ {
+ *num_bytes = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ profile_data = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return profile_data;
+}
+
/**
* _gimp_image_get_effective_color_profile:
* @image: The image.
@@ -139,6 +189,59 @@ _gimp_image_get_effective_color_profile (GimpImage *image,
return profile_data;
}
+/**
+ * __gimp_image_get_effective_color_profile: (skip)
+ * @image_ID: The image.
+ * @num_bytes: (out): Number of bytes in the color_profile array.
+ *
+ * Returns the color profile that is used for the image
+ *
+ * This procedure returns the color profile that is actually used for
+ * this image, which is the profile returned by
+ * gimp_image_get_color_profile() if the image has a profile assigned,
+ * or a generated default RGB or grayscale profile, according to the
+ * image's type.
+ *
+ * Returns: (array length=num_bytes): The image's serialized color profile.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.10
+ **/
+guint8 *
+__gimp_image_get_effective_color_profile (gint32 image_ID,
+ gint *num_bytes)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ guint8 *profile_data = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-effective-color-profile",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-effective-color-profile",
+ args);
+ gimp_value_array_unref (args);
+
+ *num_bytes = 0;
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ {
+ *num_bytes = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ profile_data = gimp_value_dup_uint8_array (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return profile_data;
+}
+
/**
* _gimp_image_set_color_profile:
* @image: The image.
@@ -190,6 +293,57 @@ _gimp_image_set_color_profile (GimpImage *image,
return success;
}
+/**
+ * __gimp_image_set_color_profile: (skip)
+ * @image_ID: The image.
+ * @num_bytes: Number of bytes in the color_profile array.
+ * @color_profile: (array length=num_bytes) (element-type guint8): The new serialized color profile.
+ *
+ * Sets the image's color profile
+ *
+ * This procedure sets the image's color profile, or unsets it if NULL
+ * is passed as 'color_profile'. This procedure does no color
+ * conversion. However, it will change the pixel format of all layers
+ * to contain the babl space matching the profile. You must call this
+ * procedure before adding layers to the image.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+__gimp_image_set_color_profile (gint32 image_ID,
+ gint num_bytes,
+ const guint8 *color_profile)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_INT, num_bytes,
+ GIMP_TYPE_UINT8_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_uint8_array (gimp_value_array_index (args, 2), color_profile, num_bytes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-color-profile",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-color-profile",
+ 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_image_set_color_profile_from_file:
* @image: The image.
@@ -238,6 +392,54 @@ gimp_image_set_color_profile_from_file (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_set_color_profile_from_file: (skip)
+ * @image_ID: The image.
+ * @uri: The URI of the file containing the new color profile.
+ *
+ * Sets the image's color profile from an ICC file
+ *
+ * This procedure sets the image's color profile from a file containing
+ * an ICC profile, or unsets it if NULL is passed as 'uri'. This
+ * procedure does no color conversion. However, it will change the
+ * pixel format of all layers to contain the babl space matching the
+ * profile. You must call this procedure before adding layers to the
+ * image.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+_gimp_image_set_color_profile_from_file (gint32 image_ID,
+ const gchar *uri)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_STRING, uri,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-set-color-profile-from-file",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-set-color-profile-from-file",
+ 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_image_convert_color_profile:
* @image: The image.
@@ -294,6 +496,62 @@ _gimp_image_convert_color_profile (GimpImage *image,
return success;
}
+/**
+ * __gimp_image_convert_color_profile: (skip)
+ * @image_ID: The image.
+ * @num_bytes: Number of bytes in the color_profile array.
+ * @color_profile: (array length=num_bytes) (element-type guint8): The serialized color profile.
+ * @intent: Rendering intent.
+ * @bpc: Black point compensation.
+ *
+ * Convert the image's layers to a color profile
+ *
+ * This procedure converts from the image's color profile (or the
+ * default RGB or grayscale profile if none is set) to the given color
+ * profile. Only RGB and grayscale color profiles are accepted,
+ * according to the image's type.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+__gimp_image_convert_color_profile (gint32 image_ID,
+ gint num_bytes,
+ const guint8 *color_profile,
+ GimpColorRenderingIntent intent,
+ gboolean bpc)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_INT, num_bytes,
+ GIMP_TYPE_UINT8_ARRAY, NULL,
+ GIMP_TYPE_COLOR_RENDERING_INTENT, intent,
+ G_TYPE_BOOLEAN, bpc,
+ G_TYPE_NONE);
+ gimp_value_set_uint8_array (gimp_value_array_index (args, 2), color_profile, num_bytes);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-convert-color-profile",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-convert-color-profile",
+ 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_image_convert_color_profile_from_file:
* @image: The image.
@@ -345,3 +603,55 @@ gimp_image_convert_color_profile_from_file (GimpImage *image,
return success;
}
+
+/**
+ * _gimp_image_convert_color_profile_from_file: (skip)
+ * @image_ID: The image.
+ * @uri: The URI of the file containing the new color profile.
+ * @intent: Rendering intent.
+ * @bpc: Black point compensation.
+ *
+ * Convert the image's layers to a color profile
+ *
+ * This procedure converts from the image's color profile (or the
+ * default RGB or grayscale profile if none is set) to an ICC profile
+ * specified by 'uri'. Only RGB and grayscale color profiles are
+ * accepted, according to the image's type.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+_gimp_image_convert_color_profile_from_file (gint32 image_ID,
+ const gchar *uri,
+ GimpColorRenderingIntent intent,
+ gboolean bpc)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_STRING, uri,
+ GIMP_TYPE_COLOR_RENDERING_INTENT, intent,
+ G_TYPE_BOOLEAN, bpc,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-convert-color-profile-from-file",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-convert-color-profile-from-file",
+ 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;
+}
diff --git a/libgimp/gimpimagecolorprofile_pdb.h b/libgimp/gimpimagecolorprofile_pdb.h
index 454a837bfe..ded795b2e4 100644
--- a/libgimp/gimpimagecolorprofile_pdb.h
+++ b/libgimp/gimpimagecolorprofile_pdb.h
@@ -32,24 +32,48 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-G_GNUC_INTERNAL guint8* _gimp_image_get_color_profile (GimpImage *image,
- gint *num_bytes);
-G_GNUC_INTERNAL guint8* _gimp_image_get_effective_color_profile (GimpImage *image,
- gint *num_bytes);
-G_GNUC_INTERNAL gboolean _gimp_image_set_color_profile (GimpImage *image,
- gint num_bytes,
- const guint8
*color_profile);
-gboolean gimp_image_set_color_profile_from_file (GimpImage *image,
- const gchar *uri);
-G_GNUC_INTERNAL gboolean _gimp_image_convert_color_profile (GimpImage *image,
- gint num_bytes,
- const guint8 *color_profile,
- GimpColorRenderingIntent intent,
- gboolean bpc);
-gboolean gimp_image_convert_color_profile_from_file (GimpImage *image,
- const gchar *uri,
- GimpColorRenderingIntent intent,
- gboolean bpc);
+G_GNUC_INTERNAL guint8* _gimp_image_get_color_profile (GimpImage *image,
+ gint *num_bytes);
+GIMP_DEPRECATED_FOR(_gimp_image_get_color_profile)
+G_GNUC_INTERNAL guint8* __gimp_image_get_color_profile (gint32 image_ID,
+ gint *num_bytes);
+G_GNUC_INTERNAL guint8* _gimp_image_get_effective_color_profile (GimpImage *image,
+ gint *num_bytes);
+GIMP_DEPRECATED_FOR(_gimp_image_get_effective_color_profile)
+G_GNUC_INTERNAL guint8* __gimp_image_get_effective_color_profile (gint32 image_ID,
+ gint *num_bytes);
+G_GNUC_INTERNAL gboolean _gimp_image_set_color_profile (GimpImage *image,
+ gint num_bytes,
+ const guint8
*color_profile);
+GIMP_DEPRECATED_FOR(_gimp_image_set_color_profile)
+G_GNUC_INTERNAL gboolean __gimp_image_set_color_profile (gint32 image_ID,
+ gint num_bytes,
+ const guint8
*color_profile);
+gboolean gimp_image_set_color_profile_from_file (GimpImage *image,
+ const gchar *uri);
+GIMP_DEPRECATED_FOR(gimp_image_set_color_profile_from_file)
+G_GNUC_INTERNAL gboolean _gimp_image_set_color_profile_from_file (gint32 image_ID,
+ const gchar *uri);
+G_GNUC_INTERNAL gboolean _gimp_image_convert_color_profile (GimpImage *image,
+ gint num_bytes,
+ const guint8
*color_profile,
+ GimpColorRenderingIntent intent,
+ gboolean bpc);
+GIMP_DEPRECATED_FOR(_gimp_image_convert_color_profile)
+G_GNUC_INTERNAL gboolean __gimp_image_convert_color_profile (gint32 image_ID,
+ gint num_bytes,
+ const guint8
*color_profile,
+ GimpColorRenderingIntent intent,
+ gboolean bpc);
+gboolean gimp_image_convert_color_profile_from_file (GimpImage *image,
+ const gchar *uri,
+ GimpColorRenderingIntent intent,
+ gboolean bpc);
+GIMP_DEPRECATED_FOR(gimp_image_convert_color_profile_from_file)
+G_GNUC_INTERNAL gboolean _gimp_image_convert_color_profile_from_file (gint32 image_ID,
+ const gchar *uri,
+ GimpColorRenderingIntent intent,
+ gboolean bpc);
G_END_DECLS
diff --git a/libgimp/gimpimageconvert_pdb.c b/libgimp/gimpimageconvert_pdb.c
index 2033e89c22..ed49b3ec9d 100644
--- a/libgimp/gimpimageconvert_pdb.c
+++ b/libgimp/gimpimageconvert_pdb.c
@@ -75,6 +75,47 @@ gimp_image_convert_rgb (GimpImage *image)
return success;
}
+/**
+ * _gimp_image_convert_rgb: (skip)
+ * @image_ID: The image.
+ *
+ * Convert specified image to RGB color
+ *
+ * This procedure converts the specified image to RGB color. This
+ * process requires an image in Grayscale or Indexed color mode. No
+ * image content is lost in this process aside from the colormap for an
+ * indexed image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_convert_rgb (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-convert-rgb",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-convert-rgb",
+ 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_image_convert_grayscale:
* @image: The image.
@@ -114,6 +155,45 @@ gimp_image_convert_grayscale (GimpImage *image)
return success;
}
+/**
+ * _gimp_image_convert_grayscale: (skip)
+ * @image_ID: The image.
+ *
+ * Convert specified image to grayscale
+ *
+ * This procedure converts the specified image to grayscale. This
+ * process requires an image in RGB or Indexed color mode.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_convert_grayscale (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-convert-grayscale",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-convert-grayscale",
+ 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_image_convert_indexed:
* @image: The image.
@@ -182,6 +262,74 @@ gimp_image_convert_indexed (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_convert_indexed: (skip)
+ * @image_ID: The image.
+ * @dither_type: The dither type to use.
+ * @palette_type: The type of palette to use.
+ * @num_cols: The number of colors to quantize to, ignored unless (palette_type ==
GIMP_CONVERT_PALETTE_GENERATE).
+ * @alpha_dither: Dither transparency to fake partial opacity.
+ * @remove_unused: Remove unused or duplicate color entries from final palette, ignored if (palette_type ==
GIMP_CONVERT_PALETTE_GENERATE).
+ * @palette: The name of the custom palette to use, ignored unless (palette_type ==
GIMP_CONVERT_PALETTE_CUSTOM).
+ *
+ * Convert specified image to and Indexed image
+ *
+ * This procedure converts the specified image to 'indexed' color. This
+ * process requires an image in RGB or Grayscale mode. The
+ * 'palette_type' specifies what kind of palette to use, A type of '0'
+ * means to use an optimal palette of 'num_cols' generated from the
+ * colors in the image. A type of '1' means to re-use the previous
+ * palette (not currently implemented). A type of '2' means to use the
+ * so-called WWW-optimized palette. Type '3' means to use only black
+ * and white colors. A type of '4' means to use a palette from the gimp
+ * palettes directories. The 'dither type' specifies what kind of
+ * dithering to use. '0' means no dithering, '1' means standard
+ * Floyd-Steinberg error diffusion, '2' means Floyd-Steinberg error
+ * diffusion with reduced bleeding, '3' means dithering based on pixel
+ * location ('Fixed' dithering).
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_convert_indexed (gint32 image_ID,
+ GimpConvertDitherType dither_type,
+ GimpConvertPaletteType palette_type,
+ gint num_cols,
+ gboolean alpha_dither,
+ gboolean remove_unused,
+ const gchar *palette)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_CONVERT_DITHER_TYPE, dither_type,
+ GIMP_TYPE_CONVERT_PALETTE_TYPE, palette_type,
+ G_TYPE_INT, num_cols,
+ G_TYPE_BOOLEAN, alpha_dither,
+ G_TYPE_BOOLEAN, remove_unused,
+ G_TYPE_STRING, palette,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-convert-indexed",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-convert-indexed",
+ 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_image_convert_set_dither_matrix:
* @width: Width of the matrix (0 to reset to default matrix).
@@ -277,3 +425,48 @@ gimp_image_convert_precision (GimpImage *image,
return success;
}
+
+/**
+ * _gimp_image_convert_precision: (skip)
+ * @image_ID: The image.
+ * @precision: The new precision.
+ *
+ * Convert the image to the specified precision
+ *
+ * This procedure converts the image to the specified precision. Note
+ * that indexed images cannot be converted and are always in
+ * GIMP_PRECISION_U8.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+_gimp_image_convert_precision (gint32 image_ID,
+ GimpPrecision precision)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_PRECISION, precision,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-convert-precision",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-convert-precision",
+ 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;
+}
diff --git a/libgimp/gimpimageconvert_pdb.h b/libgimp/gimpimageconvert_pdb.h
index fe4cfaf973..a319d6470d 100644
--- a/libgimp/gimpimageconvert_pdb.h
+++ b/libgimp/gimpimageconvert_pdb.h
@@ -32,21 +32,36 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gboolean gimp_image_convert_rgb (GimpImage *image);
-gboolean gimp_image_convert_grayscale (GimpImage *image);
-gboolean gimp_image_convert_indexed (GimpImage *image,
- GimpConvertDitherType dither_type,
- GimpConvertPaletteType palette_type,
- gint num_cols,
- gboolean alpha_dither,
- gboolean remove_unused,
- const gchar *palette);
-gboolean gimp_image_convert_set_dither_matrix (gint width,
- gint height,
- gint matrix_length,
- const guint8 *matrix);
-gboolean gimp_image_convert_precision (GimpImage *image,
- GimpPrecision precision);
+gboolean gimp_image_convert_rgb (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_convert_rgb)
+G_GNUC_INTERNAL gboolean _gimp_image_convert_rgb (gint32 image_ID);
+gboolean gimp_image_convert_grayscale (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_convert_grayscale)
+G_GNUC_INTERNAL gboolean _gimp_image_convert_grayscale (gint32 image_ID);
+gboolean gimp_image_convert_indexed (GimpImage *image,
+ GimpConvertDitherType dither_type,
+ GimpConvertPaletteType palette_type,
+ gint num_cols,
+ gboolean alpha_dither,
+ gboolean remove_unused,
+ const gchar *palette);
+GIMP_DEPRECATED_FOR(gimp_image_convert_indexed)
+G_GNUC_INTERNAL gboolean _gimp_image_convert_indexed (gint32 image_ID,
+ GimpConvertDitherType dither_type,
+ GimpConvertPaletteType palette_type,
+ gint num_cols,
+ gboolean alpha_dither,
+ gboolean remove_unused,
+ const gchar *palette);
+gboolean gimp_image_convert_set_dither_matrix (gint width,
+ gint height,
+ gint matrix_length,
+ const guint8 *matrix);
+gboolean gimp_image_convert_precision (GimpImage *image,
+ GimpPrecision precision);
+GIMP_DEPRECATED_FOR(gimp_image_convert_precision)
+G_GNUC_INTERNAL gboolean _gimp_image_convert_precision (gint32 image_ID,
+ GimpPrecision precision);
G_END_DECLS
diff --git a/libgimp/gimpimagegrid_pdb.c b/libgimp/gimpimagegrid_pdb.c
index e64ffa672c..78d45f333c 100644
--- a/libgimp/gimpimagegrid_pdb.c
+++ b/libgimp/gimpimagegrid_pdb.c
@@ -88,6 +88,60 @@ gimp_image_grid_get_spacing (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_grid_get_spacing: (skip)
+ * @image_ID: The image.
+ * @xspacing: (out): The image's grid horizontal spacing.
+ * @yspacing: (out): The image's grid vertical spacing.
+ *
+ * Gets the spacing of an image's grid.
+ *
+ * This procedure retrieves the horizontal and vertical spacing of an
+ * image's grid. It takes the image as parameter.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+_gimp_image_grid_get_spacing (gint32 image_ID,
+ gdouble *xspacing,
+ gdouble *yspacing)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-grid-get-spacing",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-grid-get-spacing",
+ args);
+ gimp_value_array_unref (args);
+
+ *xspacing = 0.0;
+ *yspacing = 0.0;
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *xspacing = g_value_get_double (gimp_value_array_index (return_vals, 1));
+ *yspacing = g_value_get_double (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
/**
* gimp_image_grid_set_spacing:
* @image: The image.
@@ -135,6 +189,53 @@ gimp_image_grid_set_spacing (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_grid_set_spacing: (skip)
+ * @image_ID: The image.
+ * @xspacing: The image's grid horizontal spacing.
+ * @yspacing: The image's grid vertical spacing.
+ *
+ * Sets the spacing of an image's grid.
+ *
+ * This procedure sets the horizontal and vertical spacing of an
+ * image's grid.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+_gimp_image_grid_set_spacing (gint32 image_ID,
+ gdouble xspacing,
+ gdouble yspacing)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_DOUBLE, xspacing,
+ G_TYPE_DOUBLE, yspacing,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-grid-set-spacing",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-grid-set-spacing",
+ 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_image_grid_get_offset:
* @image: The image.
@@ -189,6 +290,60 @@ gimp_image_grid_get_offset (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_grid_get_offset: (skip)
+ * @image_ID: The image.
+ * @xoffset: (out): The image's grid horizontal offset.
+ * @yoffset: (out): The image's grid vertical offset.
+ *
+ * Gets the offset of an image's grid.
+ *
+ * This procedure retrieves the horizontal and vertical offset of an
+ * image's grid. It takes the image as parameter.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+_gimp_image_grid_get_offset (gint32 image_ID,
+ gdouble *xoffset,
+ gdouble *yoffset)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-grid-get-offset",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-grid-get-offset",
+ args);
+ gimp_value_array_unref (args);
+
+ *xoffset = 0.0;
+ *yoffset = 0.0;
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *xoffset = g_value_get_double (gimp_value_array_index (return_vals, 1));
+ *yoffset = g_value_get_double (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
/**
* gimp_image_grid_set_offset:
* @image: The image.
@@ -236,6 +391,53 @@ gimp_image_grid_set_offset (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_grid_set_offset: (skip)
+ * @image_ID: The image.
+ * @xoffset: The image's grid horizontal offset.
+ * @yoffset: The image's grid vertical offset.
+ *
+ * Sets the offset of an image's grid.
+ *
+ * This procedure sets the horizontal and vertical offset of an image's
+ * grid.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+_gimp_image_grid_set_offset (gint32 image_ID,
+ gdouble xoffset,
+ gdouble yoffset)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_DOUBLE, xoffset,
+ G_TYPE_DOUBLE, yoffset,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-grid-set-offset",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-grid-set-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_image_grid_get_foreground_color:
* @image: The image.
@@ -281,6 +483,51 @@ gimp_image_grid_get_foreground_color (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_grid_get_foreground_color: (skip)
+ * @image_ID: The image.
+ * @fgcolor: (out caller-allocates): The image's grid foreground color.
+ *
+ * Sets the foreground color of an image's grid.
+ *
+ * This procedure gets the foreground color of an image's grid.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+_gimp_image_grid_get_foreground_color (gint32 image_ID,
+ GimpRGB *fgcolor)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-grid-get-foreground-color",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-grid-get-foreground-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), &*fgcolor);
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
/**
* gimp_image_grid_set_foreground_color:
* @image: The image.
@@ -324,6 +571,49 @@ gimp_image_grid_set_foreground_color (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_grid_set_foreground_color: (skip)
+ * @image_ID: The image.
+ * @fgcolor: The new foreground color.
+ *
+ * Gets the foreground color of an image's grid.
+ *
+ * This procedure sets the foreground color of an image's grid.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+_gimp_image_grid_set_foreground_color (gint32 image_ID,
+ const GimpRGB *fgcolor)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_RGB, fgcolor,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-grid-set-foreground-color",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-grid-set-foreground-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_image_grid_get_background_color:
* @image: The image.
@@ -369,6 +659,51 @@ gimp_image_grid_get_background_color (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_grid_get_background_color: (skip)
+ * @image_ID: The image.
+ * @bgcolor: (out caller-allocates): The image's grid background color.
+ *
+ * Sets the background color of an image's grid.
+ *
+ * This procedure gets the background color of an image's grid.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+_gimp_image_grid_get_background_color (gint32 image_ID,
+ GimpRGB *bgcolor)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-grid-get-background-color",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-grid-get-background-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), &*bgcolor);
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
/**
* gimp_image_grid_set_background_color:
* @image: The image.
@@ -412,6 +747,49 @@ gimp_image_grid_set_background_color (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_grid_set_background_color: (skip)
+ * @image_ID: The image.
+ * @bgcolor: The new background color.
+ *
+ * Gets the background color of an image's grid.
+ *
+ * This procedure sets the background color of an image's grid.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+_gimp_image_grid_set_background_color (gint32 image_ID,
+ const GimpRGB *bgcolor)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_RGB, bgcolor,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-grid-set-background-color",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-grid-set-background-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_image_grid_get_style:
* @image: The image.
@@ -453,6 +831,47 @@ gimp_image_grid_get_style (GimpImage *image)
return style;
}
+/**
+ * _gimp_image_grid_get_style: (skip)
+ * @image_ID: The image.
+ *
+ * Gets the style of an image's grid.
+ *
+ * This procedure retrieves the style of an image's grid.
+ *
+ * Returns: The image's grid style.
+ *
+ * Since: 2.4
+ **/
+GimpGridStyle
+_gimp_image_grid_get_style (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpGridStyle style = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-grid-get-style",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-grid-get-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_image_grid_set_style:
* @image: The image.
@@ -496,3 +915,47 @@ gimp_image_grid_set_style (GimpImage *image,
return success;
}
+
+/**
+ * _gimp_image_grid_set_style: (skip)
+ * @image_ID: The image.
+ * @style: The image's grid style.
+ *
+ * Sets the style unit of an image's grid.
+ *
+ * This procedure sets the style of an image's grid. It takes the image
+ * and the new style as parameters.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+_gimp_image_grid_set_style (gint32 image_ID,
+ GimpGridStyle style)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_GRID_STYLE, style,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-grid-set-style",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-grid-set-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;
+}
diff --git a/libgimp/gimpimagegrid_pdb.h b/libgimp/gimpimagegrid_pdb.h
index e256944329..204e37585c 100644
--- a/libgimp/gimpimagegrid_pdb.h
+++ b/libgimp/gimpimagegrid_pdb.h
@@ -32,29 +32,62 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gboolean gimp_image_grid_get_spacing (GimpImage *image,
- gdouble *xspacing,
- gdouble *yspacing);
-gboolean gimp_image_grid_set_spacing (GimpImage *image,
- gdouble xspacing,
- gdouble yspacing);
-gboolean gimp_image_grid_get_offset (GimpImage *image,
- gdouble *xoffset,
- gdouble *yoffset);
-gboolean gimp_image_grid_set_offset (GimpImage *image,
- gdouble xoffset,
- gdouble yoffset);
-gboolean gimp_image_grid_get_foreground_color (GimpImage *image,
- GimpRGB *fgcolor);
-gboolean gimp_image_grid_set_foreground_color (GimpImage *image,
- const GimpRGB *fgcolor);
-gboolean gimp_image_grid_get_background_color (GimpImage *image,
- GimpRGB *bgcolor);
-gboolean gimp_image_grid_set_background_color (GimpImage *image,
- const GimpRGB *bgcolor);
-GimpGridStyle gimp_image_grid_get_style (GimpImage *image);
-gboolean gimp_image_grid_set_style (GimpImage *image,
- GimpGridStyle style);
+gboolean gimp_image_grid_get_spacing (GimpImage *image,
+ gdouble *xspacing,
+ gdouble *yspacing);
+GIMP_DEPRECATED_FOR(gimp_image_grid_get_spacing)
+G_GNUC_INTERNAL gboolean _gimp_image_grid_get_spacing (gint32 image_ID,
+ gdouble *xspacing,
+ gdouble *yspacing);
+gboolean gimp_image_grid_set_spacing (GimpImage *image,
+ gdouble xspacing,
+ gdouble yspacing);
+GIMP_DEPRECATED_FOR(gimp_image_grid_set_spacing)
+G_GNUC_INTERNAL gboolean _gimp_image_grid_set_spacing (gint32 image_ID,
+ gdouble xspacing,
+ gdouble yspacing);
+gboolean gimp_image_grid_get_offset (GimpImage *image,
+ gdouble *xoffset,
+ gdouble *yoffset);
+GIMP_DEPRECATED_FOR(gimp_image_grid_get_offset)
+G_GNUC_INTERNAL gboolean _gimp_image_grid_get_offset (gint32 image_ID,
+ gdouble *xoffset,
+ gdouble *yoffset);
+gboolean gimp_image_grid_set_offset (GimpImage *image,
+ gdouble xoffset,
+ gdouble yoffset);
+GIMP_DEPRECATED_FOR(gimp_image_grid_set_offset)
+G_GNUC_INTERNAL gboolean _gimp_image_grid_set_offset (gint32 image_ID,
+ gdouble xoffset,
+ gdouble yoffset);
+gboolean gimp_image_grid_get_foreground_color (GimpImage *image,
+ GimpRGB *fgcolor);
+GIMP_DEPRECATED_FOR(gimp_image_grid_get_foreground_color)
+G_GNUC_INTERNAL gboolean _gimp_image_grid_get_foreground_color (gint32 image_ID,
+ GimpRGB *fgcolor);
+gboolean gimp_image_grid_set_foreground_color (GimpImage *image,
+ const GimpRGB *fgcolor);
+GIMP_DEPRECATED_FOR(gimp_image_grid_set_foreground_color)
+G_GNUC_INTERNAL gboolean _gimp_image_grid_set_foreground_color (gint32 image_ID,
+ const GimpRGB *fgcolor);
+gboolean gimp_image_grid_get_background_color (GimpImage *image,
+ GimpRGB *bgcolor);
+GIMP_DEPRECATED_FOR(gimp_image_grid_get_background_color)
+G_GNUC_INTERNAL gboolean _gimp_image_grid_get_background_color (gint32 image_ID,
+ GimpRGB *bgcolor);
+gboolean gimp_image_grid_set_background_color (GimpImage *image,
+ const GimpRGB *bgcolor);
+GIMP_DEPRECATED_FOR(gimp_image_grid_set_background_color)
+G_GNUC_INTERNAL gboolean _gimp_image_grid_set_background_color (gint32 image_ID,
+ const GimpRGB *bgcolor);
+GimpGridStyle gimp_image_grid_get_style (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_grid_get_style)
+G_GNUC_INTERNAL GimpGridStyle _gimp_image_grid_get_style (gint32 image_ID);
+gboolean gimp_image_grid_set_style (GimpImage *image,
+ GimpGridStyle style);
+GIMP_DEPRECATED_FOR(gimp_image_grid_set_style)
+G_GNUC_INTERNAL gboolean _gimp_image_grid_set_style (gint32 image_ID,
+ GimpGridStyle style);
G_END_DECLS
diff --git a/libgimp/gimpimageguides_pdb.c b/libgimp/gimpimageguides_pdb.c
index 43e6342f2b..84d027d58b 100644
--- a/libgimp/gimpimageguides_pdb.c
+++ b/libgimp/gimpimageguides_pdb.c
@@ -78,6 +78,50 @@ gimp_image_add_hguide (GimpImage *image,
return guide_ID;
}
+/**
+ * _gimp_image_add_hguide: (skip)
+ * @image_ID: The image.
+ * @yposition: The guide's y-offset from top of image.
+ *
+ * Add a horizontal guide to an image.
+ *
+ * This procedure adds a horizontal guide to an image. It takes the
+ * input image and the y-position of the new guide as parameters. It
+ * returns the guide ID of the new guide.
+ *
+ * Returns: The new guide.
+ **/
+gint32
+_gimp_image_add_hguide (gint32 image_ID,
+ gint yposition)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 guide_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_INT, yposition,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-add-hguide",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-add-hguide",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ guide_ID = g_value_get_uint (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return guide_ID;
+}
+
/**
* gimp_image_add_vguide:
* @image: The image.
@@ -122,6 +166,50 @@ gimp_image_add_vguide (GimpImage *image,
return guide_ID;
}
+/**
+ * _gimp_image_add_vguide: (skip)
+ * @image_ID: The image.
+ * @xposition: The guide's x-offset from left of image.
+ *
+ * Add a vertical guide to an image.
+ *
+ * This procedure adds a vertical guide to an image. It takes the input
+ * image and the x-position of the new guide as parameters. It returns
+ * the guide ID of the new guide.
+ *
+ * Returns: The new guide.
+ **/
+gint32
+_gimp_image_add_vguide (gint32 image_ID,
+ gint xposition)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 guide_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_INT, xposition,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-add-vguide",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-add-vguide",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ guide_ID = g_value_get_uint (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return guide_ID;
+}
+
/**
* gimp_image_delete_guide:
* @image: The image.
@@ -164,6 +252,48 @@ gimp_image_delete_guide (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_delete_guide: (skip)
+ * @image_ID: The image.
+ * @guide_ID: The ID of the guide to be removed.
+ *
+ * Deletes a guide from an image.
+ *
+ * This procedure takes an image and a guide ID as input and removes
+ * the specified guide from the specified image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_delete_guide (gint32 image_ID,
+ gint32 guide_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_UINT, guide_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-delete-guide",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-delete-guide",
+ 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_image_find_next_guide:
* @image: The image.
@@ -210,6 +340,52 @@ gimp_image_find_next_guide (GimpImage *image,
return next_guide_ID;
}
+/**
+ * _gimp_image_find_next_guide: (skip)
+ * @image_ID: The image.
+ * @guide_ID: The ID of the current guide (0 if first invocation).
+ *
+ * Find next guide on an image.
+ *
+ * This procedure takes an image and a guide ID as input and finds the
+ * guide ID of the successor of the given guide ID in the image's guide
+ * list. If the supplied guide ID is 0, the procedure will return the
+ * first Guide. The procedure will return 0 if given the final guide ID
+ * as an argument or the image has no guides.
+ *
+ * Returns: The next guide's ID.
+ **/
+gint32
+_gimp_image_find_next_guide (gint32 image_ID,
+ gint32 guide_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 next_guide_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_UINT, guide_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-find-next-guide",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-find-next-guide",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ next_guide_ID = g_value_get_uint (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return next_guide_ID;
+}
+
/**
* gimp_image_get_guide_orientation:
* @image: The image.
@@ -253,6 +429,49 @@ gimp_image_get_guide_orientation (GimpImage *image,
return orientation;
}
+/**
+ * _gimp_image_get_guide_orientation: (skip)
+ * @image_ID: The image.
+ * @guide_ID: The guide.
+ *
+ * Get orientation of a guide on an image.
+ *
+ * This procedure takes an image and a guide ID as input and returns
+ * the orientations of the guide.
+ *
+ * Returns: The guide's orientation.
+ **/
+GimpOrientationType
+_gimp_image_get_guide_orientation (gint32 image_ID,
+ gint32 guide_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ GimpOrientationType orientation = GIMP_ORIENTATION_UNKNOWN;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_UINT, guide_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-guide-orientation",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-guide-orientation",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ orientation = g_value_get_enum (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return orientation;
+}
+
/**
* gimp_image_get_guide_position:
* @image: The image.
@@ -295,3 +514,46 @@ gimp_image_get_guide_position (GimpImage *image,
return position;
}
+
+/**
+ * _gimp_image_get_guide_position: (skip)
+ * @image_ID: The image.
+ * @guide_ID: The guide.
+ *
+ * Get position of a guide on an image.
+ *
+ * This procedure takes an image and a guide ID as input and returns
+ * the position of the guide relative to the top or left of the image.
+ *
+ * Returns: The guide's position relative to top or left of image.
+ **/
+gint
+_gimp_image_get_guide_position (gint32 image_ID,
+ gint32 guide_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint position = G_MININT /* GIMP_GUIDE_POSITION_UNDEFINED */;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_UINT, guide_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-guide-position",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-guide-position",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ position = g_value_get_int (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return position;
+}
diff --git a/libgimp/gimpimageguides_pdb.h b/libgimp/gimpimageguides_pdb.h
index 6e69c4fdec..c510c8c046 100644
--- a/libgimp/gimpimageguides_pdb.h
+++ b/libgimp/gimpimageguides_pdb.h
@@ -32,18 +32,36 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gint32 gimp_image_add_hguide (GimpImage *image,
- gint yposition);
-gint32 gimp_image_add_vguide (GimpImage *image,
- gint xposition);
-gboolean gimp_image_delete_guide (GimpImage *image,
- gint32 guide_ID);
-gint32 gimp_image_find_next_guide (GimpImage *image,
- gint32 guide_ID);
-GimpOrientationType gimp_image_get_guide_orientation (GimpImage *image,
- gint32 guide_ID);
-gint gimp_image_get_guide_position (GimpImage *image,
- gint32 guide_ID);
+gint32 gimp_image_add_hguide (GimpImage *image,
+ gint yposition);
+GIMP_DEPRECATED_FOR(gimp_image_add_hguide)
+G_GNUC_INTERNAL gint32 _gimp_image_add_hguide (gint32 image_ID,
+ gint yposition);
+gint32 gimp_image_add_vguide (GimpImage *image,
+ gint xposition);
+GIMP_DEPRECATED_FOR(gimp_image_add_vguide)
+G_GNUC_INTERNAL gint32 _gimp_image_add_vguide (gint32 image_ID,
+ gint xposition);
+gboolean gimp_image_delete_guide (GimpImage *image,
+ gint32 guide_ID);
+GIMP_DEPRECATED_FOR(gimp_image_delete_guide)
+G_GNUC_INTERNAL gboolean _gimp_image_delete_guide (gint32 image_ID,
+ gint32 guide_ID);
+gint32 gimp_image_find_next_guide (GimpImage *image,
+ gint32 guide_ID);
+GIMP_DEPRECATED_FOR(gimp_image_find_next_guide)
+G_GNUC_INTERNAL gint32 _gimp_image_find_next_guide (gint32 image_ID,
+ gint32 guide_ID);
+GimpOrientationType gimp_image_get_guide_orientation (GimpImage *image,
+ gint32 guide_ID);
+GIMP_DEPRECATED_FOR(gimp_image_get_guide_orientation)
+G_GNUC_INTERNAL GimpOrientationType _gimp_image_get_guide_orientation (gint32 image_ID,
+ gint32 guide_ID);
+gint gimp_image_get_guide_position (GimpImage *image,
+ gint32 guide_ID);
+GIMP_DEPRECATED_FOR(gimp_image_get_guide_position)
+G_GNUC_INTERNAL gint _gimp_image_get_guide_position (gint32 image_ID,
+ gint32 guide_ID);
G_END_DECLS
diff --git a/libgimp/gimpimagesamplepoints_pdb.c b/libgimp/gimpimagesamplepoints_pdb.c
index 4343f0ac74..effb078a37 100644
--- a/libgimp/gimpimagesamplepoints_pdb.c
+++ b/libgimp/gimpimagesamplepoints_pdb.c
@@ -83,6 +83,55 @@ gimp_image_add_sample_point (GimpImage *image,
return sample_point_ID;
}
+/**
+ * _gimp_image_add_sample_point: (skip)
+ * @image_ID: The image.
+ * @position_x: The guide'sample points x-offset from left of image.
+ * @position_y: The guide'sample points y-offset from top of image.
+ *
+ * Add a sample point to an image.
+ *
+ * This procedure adds a sample point to an image. It takes the input
+ * image and the position of the new sample points as parameters. It
+ * returns the sample point ID of the new sample point.
+ *
+ * Returns: The new sample point.
+ *
+ * Since: 2.10
+ **/
+gint32
+_gimp_image_add_sample_point (gint32 image_ID,
+ gint position_x,
+ gint position_y)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 sample_point_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_INT, position_x,
+ G_TYPE_INT, position_y,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-add-sample-point",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-add-sample-point",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ sample_point_ID = g_value_get_uint (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return sample_point_ID;
+}
+
/**
* gimp_image_delete_sample_point:
* @image: The image.
@@ -127,6 +176,50 @@ gimp_image_delete_sample_point (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_delete_sample_point: (skip)
+ * @image_ID: The image.
+ * @sample_point_ID: The ID of the sample point to be removed.
+ *
+ * Deletes a sample point from an image.
+ *
+ * This procedure takes an image and a sample point ID as input and
+ * removes the specified sample point from the specified image.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+_gimp_image_delete_sample_point (gint32 image_ID,
+ gint32 sample_point_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_UINT, sample_point_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-delete-sample-point",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-delete-sample-point",
+ 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_image_find_next_sample_point:
* @image: The image.
@@ -176,6 +269,55 @@ gimp_image_find_next_sample_point (GimpImage *image,
return next_sample_point_ID;
}
+/**
+ * _gimp_image_find_next_sample_point: (skip)
+ * @image_ID: The image.
+ * @sample_point_ID: The ID of the current sample point (0 if first invocation).
+ *
+ * Find next sample point on an image.
+ *
+ * This procedure takes an image and a sample point ID as input and
+ * finds the sample point ID of the successor of the given sample point
+ * ID in the image's sample point list. If the supplied sample point ID
+ * is 0, the procedure will return the first sample point. The
+ * procedure will return 0 if given the final sample point ID as an
+ * argument or the image has no sample points.
+ *
+ * Returns: The next sample point's ID.
+ *
+ * Since: 2.10
+ **/
+gint32
+_gimp_image_find_next_sample_point (gint32 image_ID,
+ gint32 sample_point_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 next_sample_point_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_UINT, sample_point_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-find-next-sample-point",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-find-next-sample-point",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ next_sample_point_ID = g_value_get_uint (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return next_sample_point_ID;
+}
+
/**
* gimp_image_get_sample_point_position:
* @image: The image.
@@ -226,3 +368,54 @@ gimp_image_get_sample_point_position (GimpImage *image,
return position_x;
}
+
+/**
+ * _gimp_image_get_sample_point_position: (skip)
+ * @image_ID: The image.
+ * @sample_point_ID: The guide.
+ * @position_y: (out): The sample points's position relative to top of image.
+ *
+ * Get position of a sample point on an image.
+ *
+ * This procedure takes an image and a sample point ID as input and
+ * returns the position of the sample point relative to the top and
+ * left of the image.
+ *
+ * Returns: The sample points's position relative to top of image.
+ *
+ * Since: 2.10
+ **/
+gint
+_gimp_image_get_sample_point_position (gint32 image_ID,
+ gint32 sample_point_ID,
+ gint *position_y)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint position_x = G_MININT;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_UINT, sample_point_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-get-sample-point-position",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-get-sample-point-position",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ {
+ position_x = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ *position_y = g_value_get_int (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return position_x;
+}
diff --git a/libgimp/gimpimagesamplepoints_pdb.h b/libgimp/gimpimagesamplepoints_pdb.h
index feb7b20bd9..f0d56994f9 100644
--- a/libgimp/gimpimagesamplepoints_pdb.h
+++ b/libgimp/gimpimagesamplepoints_pdb.h
@@ -32,16 +32,30 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gint32 gimp_image_add_sample_point (GimpImage *image,
- gint position_x,
- gint position_y);
-gboolean gimp_image_delete_sample_point (GimpImage *image,
- gint32 sample_point_ID);
-gint32 gimp_image_find_next_sample_point (GimpImage *image,
- gint32 sample_point_ID);
-gint gimp_image_get_sample_point_position (GimpImage *image,
- gint32 sample_point_ID,
- gint *position_y);
+gint32 gimp_image_add_sample_point (GimpImage *image,
+ gint position_x,
+ gint position_y);
+GIMP_DEPRECATED_FOR(gimp_image_add_sample_point)
+G_GNUC_INTERNAL gint32 _gimp_image_add_sample_point (gint32 image_ID,
+ gint position_x,
+ gint position_y);
+gboolean gimp_image_delete_sample_point (GimpImage *image,
+ gint32 sample_point_ID);
+GIMP_DEPRECATED_FOR(gimp_image_delete_sample_point)
+G_GNUC_INTERNAL gboolean _gimp_image_delete_sample_point (gint32 image_ID,
+ gint32 sample_point_ID);
+gint32 gimp_image_find_next_sample_point (GimpImage *image,
+ gint32 sample_point_ID);
+GIMP_DEPRECATED_FOR(gimp_image_find_next_sample_point)
+G_GNUC_INTERNAL gint32 _gimp_image_find_next_sample_point (gint32 image_ID,
+ gint32 sample_point_ID);
+gint gimp_image_get_sample_point_position (GimpImage *image,
+ gint32 sample_point_ID,
+ gint *position_y);
+GIMP_DEPRECATED_FOR(gimp_image_get_sample_point_position)
+G_GNUC_INTERNAL gint _gimp_image_get_sample_point_position (gint32 image_ID,
+ gint32 sample_point_ID,
+ gint *position_y);
G_END_DECLS
diff --git a/libgimp/gimpimageselect_pdb.c b/libgimp/gimpimageselect_pdb.c
index 6b025373d5..c4e5ef3dea 100644
--- a/libgimp/gimpimageselect_pdb.c
+++ b/libgimp/gimpimageselect_pdb.c
@@ -99,6 +99,71 @@ gimp_image_select_color (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_select_color: (skip)
+ * @image_ID: The affected image.
+ * @operation: The selection operation.
+ * @drawable_ID: The affected drawable.
+ * @color: The color to select.
+ *
+ * Create a selection by selecting all pixels (in the specified
+ * drawable) with the same (or similar) color to that specified.
+ *
+ * This tool creates a selection over the specified image. A by-color
+ * selection is determined by the supplied color under the constraints
+ * of the current context settings. Essentially, all pixels (in the
+ * drawable) that have color sufficiently close to the specified color
+ * (as determined by the threshold and criterion context values) are
+ * included in the selection. To select transparent regions, the color
+ * specified must also have minimum alpha.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_antialias(), gimp_context_set_feather(),
+ * gimp_context_set_feather_radius(), gimp_context_set_sample_merged(),
+ * gimp_context_set_sample_criterion(),
+ * gimp_context_set_sample_threshold(),
+ * gimp_context_set_sample_transparent().
+ *
+ * In the case of a merged sampling, the supplied drawable is ignored.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+_gimp_image_select_color (gint32 image_ID,
+ GimpChannelOps operation,
+ gint32 drawable_ID,
+ 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_IMAGE_ID, image_ID,
+ GIMP_TYPE_CHANNEL_OPS, operation,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_RGB, color,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-select-color",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-select-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_image_select_contiguous_color:
* @image: The affected image.
@@ -176,6 +241,83 @@ gimp_image_select_contiguous_color (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_select_contiguous_color: (skip)
+ * @image_ID: The affected image.
+ * @operation: The selection operation.
+ * @drawable_ID: The affected drawable.
+ * @x: x coordinate of initial seed fill point: (image coordinates).
+ * @y: y coordinate of initial seed fill point: (image coordinates).
+ *
+ * Create a selection by selecting all pixels around specified
+ * coordinates with the same (or similar) color to that at the
+ * coordinates.
+ *
+ * This tool creates a contiguous selection over the specified image. A
+ * contiguous color selection is determined by a seed fill under the
+ * constraints of the current context settings. Essentially, the color
+ * at the specified coordinates (in the drawable) is measured and the
+ * selection expands outwards from that point to any adjacent pixels
+ * which are not significantly different (as determined by the
+ * threshold and criterion context settings). This process continues
+ * until no more expansion is possible. If antialiasing is turned on,
+ * the final selection mask will contain intermediate values based on
+ * close misses to the threshold bar at pixels along the seed fill
+ * boundary.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_antialias(), gimp_context_set_feather(),
+ * gimp_context_set_feather_radius(), gimp_context_set_sample_merged(),
+ * gimp_context_set_sample_criterion(),
+ * gimp_context_set_sample_threshold(),
+ * gimp_context_set_sample_transparent(),
+ * gimp_context_set_diagonal_neighbors().
+ *
+ * In the case of a merged sampling, the supplied drawable is ignored.
+ * If the sample is merged, the specified coordinates are relative to
+ * the image origin; otherwise, they are relative to the drawable's
+ * origin.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+_gimp_image_select_contiguous_color (gint32 image_ID,
+ GimpChannelOps operation,
+ gint32 drawable_ID,
+ 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_IMAGE_ID, image_ID,
+ GIMP_TYPE_CHANNEL_OPS, operation,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_DOUBLE, x,
+ G_TYPE_DOUBLE, y,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-select-contiguous-color",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-select-contiguous-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_image_select_rectangle:
* @image: The image.
@@ -236,6 +378,66 @@ gimp_image_select_rectangle (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_select_rectangle: (skip)
+ * @image_ID: The image.
+ * @operation: The selection operation.
+ * @x: x coordinate of upper-left corner of rectangle.
+ * @y: y coordinate of upper-left corner of rectangle.
+ * @width: The width of the rectangle.
+ * @height: The height of the rectangle.
+ *
+ * Create a rectangular selection over the specified image;
+ *
+ * This tool creates a rectangular selection over the specified image.
+ * The rectangular region can be either added to, subtracted from, or
+ * replace the contents of the previous selection mask.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_feather(), gimp_context_set_feather_radius().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+_gimp_image_select_rectangle (gint32 image_ID,
+ GimpChannelOps operation,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_CHANNEL_OPS, operation,
+ G_TYPE_DOUBLE, x,
+ G_TYPE_DOUBLE, y,
+ G_TYPE_DOUBLE, width,
+ G_TYPE_DOUBLE, height,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-select-rectangle",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-select-rectangle",
+ 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_image_select_round_rectangle:
* @image: The image.
@@ -305,6 +507,75 @@ gimp_image_select_round_rectangle (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_select_round_rectangle: (skip)
+ * @image_ID: The image.
+ * @operation: The selection operation.
+ * @x: x coordinate of upper-left corner of rectangle.
+ * @y: y coordinate of upper-left corner of rectangle.
+ * @width: The width of the rectangle.
+ * @height: The height of the rectangle.
+ * @corner_radius_x: The corner radius in X direction.
+ * @corner_radius_y: The corner radius in Y direction.
+ *
+ * Create a rectangular selection with round corners over the specified
+ * image;
+ *
+ * This tool creates a rectangular selection with round corners over
+ * the specified image. The rectangular region can be either added to,
+ * subtracted from, or replace the contents of the previous selection
+ * mask.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_antialias(), gimp_context_set_feather(),
+ * gimp_context_set_feather_radius().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+_gimp_image_select_round_rectangle (gint32 image_ID,
+ GimpChannelOps operation,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ gdouble corner_radius_x,
+ gdouble corner_radius_y)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_CHANNEL_OPS, operation,
+ G_TYPE_DOUBLE, x,
+ G_TYPE_DOUBLE, y,
+ G_TYPE_DOUBLE, width,
+ G_TYPE_DOUBLE, height,
+ G_TYPE_DOUBLE, corner_radius_x,
+ G_TYPE_DOUBLE, corner_radius_y,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-select-round-rectangle",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-select-round-rectangle",
+ 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_image_select_ellipse:
* @image: The image.
@@ -366,6 +637,67 @@ gimp_image_select_ellipse (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_select_ellipse: (skip)
+ * @image_ID: The image.
+ * @operation: The selection operation.
+ * @x: x coordinate of upper-left corner of ellipse bounding box.
+ * @y: y coordinate of upper-left corner of ellipse bounding box.
+ * @width: The width of the ellipse.
+ * @height: The height of the ellipse.
+ *
+ * Create an elliptical selection over the specified image.
+ *
+ * This tool creates an elliptical selection over the specified image.
+ * The elliptical region can be either added to, subtracted from, or
+ * replace the contents of the previous selection mask.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_antialias(), gimp_context_set_feather(),
+ * gimp_context_set_feather_radius().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+_gimp_image_select_ellipse (gint32 image_ID,
+ GimpChannelOps operation,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_CHANNEL_OPS, operation,
+ G_TYPE_DOUBLE, x,
+ G_TYPE_DOUBLE, y,
+ G_TYPE_DOUBLE, width,
+ G_TYPE_DOUBLE, height,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-select-ellipse",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-select-ellipse",
+ 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_image_select_polygon:
* @image: The image.
@@ -427,6 +759,67 @@ gimp_image_select_polygon (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_select_polygon: (skip)
+ * @image_ID: The image.
+ * @operation: The selection operation.
+ * @num_segs: Number of points (count 1 coordinate as two points).
+ * @segs: (array length=num_segs) (element-type gdouble): Array of points: { p1.x, p1.y, p2.x, p2.y, ...,
pn.x, pn.y}.
+ *
+ * Create a polygonal selection over the specified image.
+ *
+ * This tool creates a polygonal selection over the specified image.
+ * The polygonal region can be either added to, subtracted from, or
+ * replace the contents of the previous selection mask. The polygon is
+ * specified through an array of floating point numbers and its length.
+ * The length of array must be 2n, where n is the number of points.
+ * Each point is defined by 2 floating point values which correspond to
+ * the x and y coordinates. If the final point does not connect to the
+ * starting point, a connecting segment is automatically added.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_antialias(), gimp_context_set_feather(),
+ * gimp_context_set_feather_radius().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+_gimp_image_select_polygon (gint32 image_ID,
+ GimpChannelOps operation,
+ gint num_segs,
+ const gdouble *segs)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_CHANNEL_OPS, operation,
+ G_TYPE_INT, num_segs,
+ GIMP_TYPE_FLOAT_ARRAY, NULL,
+ G_TYPE_NONE);
+ gimp_value_set_float_array (gimp_value_array_index (args, 3), segs, num_segs);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-select-polygon",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-select-polygon",
+ 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_image_select_item:
* @image: The image.
@@ -479,3 +872,56 @@ gimp_image_select_item (GimpImage *image,
return success;
}
+
+/**
+ * _gimp_image_select_item: (skip)
+ * @image_ID: The image.
+ * @operation: The desired operation with current selection.
+ * @item_ID: The item to render to the selection.
+ *
+ * Transforms the specified item into a selection
+ *
+ * This procedure renders the item's outline into the current selection
+ * of the image the item belongs to. What exactly the item's outline is
+ * depends on the item type: for layers, it's the layer's alpha
+ * channel, for vectors the vector's shape.
+ *
+ * This procedure is affected by the following context setters:
+ * gimp_context_set_antialias(), gimp_context_set_feather(),
+ * gimp_context_set_feather_radius().
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.8
+ **/
+gboolean
+_gimp_image_select_item (gint32 image_ID,
+ GimpChannelOps operation,
+ gint32 item_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_CHANNEL_OPS, operation,
+ GIMP_TYPE_ITEM_ID, item_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-select-item",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-select-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;
+}
diff --git a/libgimp/gimpimageselect_pdb.h b/libgimp/gimpimageselect_pdb.h
index 9918092421..01ae0f879b 100644
--- a/libgimp/gimpimageselect_pdb.h
+++ b/libgimp/gimpimageselect_pdb.h
@@ -32,42 +32,85 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gboolean gimp_image_select_color (GimpImage *image,
- GimpChannelOps operation,
- gint32 drawable_ID,
- const GimpRGB *color);
-gboolean gimp_image_select_contiguous_color (GimpImage *image,
- GimpChannelOps operation,
- gint32 drawable_ID,
- gdouble x,
- gdouble y);
-gboolean gimp_image_select_rectangle (GimpImage *image,
- GimpChannelOps operation,
- gdouble x,
- gdouble y,
- gdouble width,
- gdouble height);
-gboolean gimp_image_select_round_rectangle (GimpImage *image,
- GimpChannelOps operation,
- gdouble x,
- gdouble y,
- gdouble width,
- gdouble height,
- gdouble corner_radius_x,
- gdouble corner_radius_y);
-gboolean gimp_image_select_ellipse (GimpImage *image,
- GimpChannelOps operation,
- gdouble x,
- gdouble y,
- gdouble width,
- gdouble height);
-gboolean gimp_image_select_polygon (GimpImage *image,
- GimpChannelOps operation,
- gint num_segs,
- const gdouble *segs);
-gboolean gimp_image_select_item (GimpImage *image,
- GimpChannelOps operation,
- gint32 item_ID);
+gboolean gimp_image_select_color (GimpImage *image,
+ GimpChannelOps operation,
+ gint32 drawable_ID,
+ const GimpRGB *color);
+GIMP_DEPRECATED_FOR(gimp_image_select_color)
+G_GNUC_INTERNAL gboolean _gimp_image_select_color (gint32 image_ID,
+ GimpChannelOps operation,
+ gint32 drawable_ID,
+ const GimpRGB *color);
+gboolean gimp_image_select_contiguous_color (GimpImage *image,
+ GimpChannelOps operation,
+ gint32 drawable_ID,
+ gdouble x,
+ gdouble y);
+GIMP_DEPRECATED_FOR(gimp_image_select_contiguous_color)
+G_GNUC_INTERNAL gboolean _gimp_image_select_contiguous_color (gint32 image_ID,
+ GimpChannelOps operation,
+ gint32 drawable_ID,
+ gdouble x,
+ gdouble y);
+gboolean gimp_image_select_rectangle (GimpImage *image,
+ GimpChannelOps operation,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height);
+GIMP_DEPRECATED_FOR(gimp_image_select_rectangle)
+G_GNUC_INTERNAL gboolean _gimp_image_select_rectangle (gint32 image_ID,
+ GimpChannelOps operation,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height);
+gboolean gimp_image_select_round_rectangle (GimpImage *image,
+ GimpChannelOps operation,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ gdouble corner_radius_x,
+ gdouble corner_radius_y);
+GIMP_DEPRECATED_FOR(gimp_image_select_round_rectangle)
+G_GNUC_INTERNAL gboolean _gimp_image_select_round_rectangle (gint32 image_ID,
+ GimpChannelOps operation,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ gdouble corner_radius_x,
+ gdouble corner_radius_y);
+gboolean gimp_image_select_ellipse (GimpImage *image,
+ GimpChannelOps operation,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height);
+GIMP_DEPRECATED_FOR(gimp_image_select_ellipse)
+G_GNUC_INTERNAL gboolean _gimp_image_select_ellipse (gint32 image_ID,
+ GimpChannelOps operation,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height);
+gboolean gimp_image_select_polygon (GimpImage *image,
+ GimpChannelOps operation,
+ gint num_segs,
+ const gdouble *segs);
+GIMP_DEPRECATED_FOR(gimp_image_select_polygon)
+G_GNUC_INTERNAL gboolean _gimp_image_select_polygon (gint32 image_ID,
+ GimpChannelOps operation,
+ gint num_segs,
+ const gdouble *segs);
+gboolean gimp_image_select_item (GimpImage *image,
+ GimpChannelOps operation,
+ gint32 item_ID);
+GIMP_DEPRECATED_FOR(gimp_image_select_item)
+G_GNUC_INTERNAL gboolean _gimp_image_select_item (gint32 image_ID,
+ GimpChannelOps operation,
+ gint32 item_ID);
G_END_DECLS
diff --git a/libgimp/gimpimagetransform_pdb.c b/libgimp/gimpimagetransform_pdb.c
index e159b40141..daff6083c3 100644
--- a/libgimp/gimpimagetransform_pdb.c
+++ b/libgimp/gimpimagetransform_pdb.c
@@ -90,6 +90,62 @@ gimp_image_resize (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_resize: (skip)
+ * @image_ID: The image.
+ * @new_width: New image width.
+ * @new_height: New image height.
+ * @offx: x offset between upper left corner of old and new images: (new - old).
+ * @offy: y offset between upper left corner of old and new images: (new - old).
+ *
+ * Resize the image to the specified extents.
+ *
+ * This procedure resizes the image so that it's new width and height
+ * are equal to the supplied parameters. Offsets are also provided
+ * which describe the position of the previous image's content. All
+ * channels within the image are resized according to the specified
+ * parameters; this includes the image selection mask. All layers
+ * within the image are repositioned according to the specified
+ * offsets.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_resize (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ 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_IMAGE_ID, image_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-image-resize",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-resize",
+ 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_image_resize_to_layers:
* @image: The image.
@@ -133,6 +189,49 @@ gimp_image_resize_to_layers (GimpImage *image)
return success;
}
+/**
+ * _gimp_image_resize_to_layers: (skip)
+ * @image_ID: The image.
+ *
+ * Resize the image to fit all layers.
+ *
+ * This procedure resizes the image to the bounding box of all layers
+ * of the image. All channels within the image are resized to the new
+ * size; this includes the image selection mask. All layers within the
+ * image are repositioned to the new image area.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+_gimp_image_resize_to_layers (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-resize-to-layers",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-resize-to-layers",
+ 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_image_scale:
* @image: The image.
@@ -181,6 +280,54 @@ gimp_image_scale (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_scale: (skip)
+ * @image_ID: The image.
+ * @new_width: New image width.
+ * @new_height: New image height.
+ *
+ * Scale the image using the default interpolation method.
+ *
+ * This procedure scales the image so that its new width and height are
+ * equal to the supplied parameters. All layers and channels within the
+ * image are scaled according to the specified parameters; this
+ * includes the image selection mask. The interpolation method used can
+ * be set with gimp_context_set_interpolation().
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_scale (gint32 image_ID,
+ gint new_width,
+ gint new_height)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_INT, new_width,
+ G_TYPE_INT, new_height,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-scale",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-scale",
+ 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_image_crop:
* @image: The image.
@@ -236,6 +383,61 @@ gimp_image_crop (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_crop: (skip)
+ * @image_ID: The image.
+ * @new_width: New image width: (0 < new_width <= width).
+ * @new_height: New image height: (0 < new_height <= height).
+ * @offx: X offset: (0 <= offx <= (width - new_width)).
+ * @offy: Y offset: (0 <= offy <= (height - new_height)).
+ *
+ * Crop the image to the specified extents.
+ *
+ * This procedure crops the image so that it's new width and height are
+ * equal to the supplied parameters. Offsets are also provided which
+ * describe the position of the previous image's content. All channels
+ * and layers within the image are cropped to the new image extents;
+ * this includes the image selection mask. If any parameters are out of
+ * range, an error is returned.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_crop (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ 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_IMAGE_ID, image_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-image-crop",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-crop",
+ 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_image_flip:
* @image: The image.
@@ -277,6 +479,47 @@ gimp_image_flip (GimpImage *image,
return success;
}
+/**
+ * _gimp_image_flip: (skip)
+ * @image_ID: The image.
+ * @flip_type: Type of flip.
+ *
+ * Flips the image horizontally or vertically.
+ *
+ * This procedure flips (mirrors) the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_flip (gint32 image_ID,
+ GimpOrientationType flip_type)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_ORIENTATION_TYPE, flip_type,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-flip",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-flip",
+ 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_image_rotate:
* @image: The image.
@@ -317,3 +560,44 @@ gimp_image_rotate (GimpImage *image,
return success;
}
+
+/**
+ * _gimp_image_rotate: (skip)
+ * @image_ID: The image.
+ * @rotate_type: Angle of rotation.
+ *
+ * Rotates the image by the specified degrees.
+ *
+ * This procedure rotates the image.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_rotate (gint32 image_ID,
+ GimpRotationType rotate_type)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_ROTATION_TYPE, rotate_type,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-rotate",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-rotate",
+ 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;
+}
diff --git a/libgimp/gimpimagetransform_pdb.h b/libgimp/gimpimagetransform_pdb.h
index f82c018682..bee76b6852 100644
--- a/libgimp/gimpimagetransform_pdb.h
+++ b/libgimp/gimpimagetransform_pdb.h
@@ -32,24 +32,48 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gboolean gimp_image_resize (GimpImage *image,
- gint new_width,
- gint new_height,
- gint offx,
- gint offy);
-gboolean gimp_image_resize_to_layers (GimpImage *image);
-gboolean gimp_image_scale (GimpImage *image,
- gint new_width,
- gint new_height);
-gboolean gimp_image_crop (GimpImage *image,
- gint new_width,
- gint new_height,
- gint offx,
- gint offy);
-gboolean gimp_image_flip (GimpImage *image,
- GimpOrientationType flip_type);
-gboolean gimp_image_rotate (GimpImage *image,
- GimpRotationType rotate_type);
+gboolean gimp_image_resize (GimpImage *image,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy);
+GIMP_DEPRECATED_FOR(gimp_image_resize)
+G_GNUC_INTERNAL gboolean _gimp_image_resize (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy);
+gboolean gimp_image_resize_to_layers (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_resize_to_layers)
+G_GNUC_INTERNAL gboolean _gimp_image_resize_to_layers (gint32 image_ID);
+gboolean gimp_image_scale (GimpImage *image,
+ gint new_width,
+ gint new_height);
+GIMP_DEPRECATED_FOR(gimp_image_scale)
+G_GNUC_INTERNAL gboolean _gimp_image_scale (gint32 image_ID,
+ gint new_width,
+ gint new_height);
+gboolean gimp_image_crop (GimpImage *image,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy);
+GIMP_DEPRECATED_FOR(gimp_image_crop)
+G_GNUC_INTERNAL gboolean _gimp_image_crop (gint32 image_ID,
+ gint new_width,
+ gint new_height,
+ gint offx,
+ gint offy);
+gboolean gimp_image_flip (GimpImage *image,
+ GimpOrientationType flip_type);
+GIMP_DEPRECATED_FOR(gimp_image_flip)
+G_GNUC_INTERNAL gboolean _gimp_image_flip (gint32 image_ID,
+ GimpOrientationType flip_type);
+gboolean gimp_image_rotate (GimpImage *image,
+ GimpRotationType rotate_type);
+GIMP_DEPRECATED_FOR(gimp_image_rotate)
+G_GNUC_INTERNAL gboolean _gimp_image_rotate (gint32 image_ID,
+ GimpRotationType rotate_type);
G_END_DECLS
diff --git a/libgimp/gimpimageundo_pdb.c b/libgimp/gimpimageundo_pdb.c
index 0cf0465c62..6fec1695a5 100644
--- a/libgimp/gimpimageundo_pdb.c
+++ b/libgimp/gimpimageundo_pdb.c
@@ -75,6 +75,47 @@ gimp_image_undo_group_start (GimpImage *image)
return success;
}
+/**
+ * _gimp_image_undo_group_start: (skip)
+ * @image_ID: The ID of the image in which to open an undo group.
+ *
+ * Starts a group undo.
+ *
+ * This function is used to start a group undo--necessary for logically
+ * combining two or more undo operations into a single operation. This
+ * call must be used in conjunction with a gimp_image_undo_group_end()
+ * call.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_undo_group_start (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-undo-group-start",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-undo-group-start",
+ 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_image_undo_group_end:
* @image: The ID of the image in which to close an undo group.
@@ -114,6 +155,45 @@ gimp_image_undo_group_end (GimpImage *image)
return success;
}
+/**
+ * _gimp_image_undo_group_end: (skip)
+ * @image_ID: The ID of the image in which to close an undo group.
+ *
+ * Finish a group undo.
+ *
+ * This function must be called once for each
+ * gimp_image_undo_group_start() call that is made.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_image_undo_group_end (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-undo-group-end",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-undo-group-end",
+ 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_image_undo_is_enabled:
* @image: The image.
@@ -156,6 +236,48 @@ gimp_image_undo_is_enabled (GimpImage *image)
return enabled;
}
+/**
+ * _gimp_image_undo_is_enabled: (skip)
+ * @image_ID: The image.
+ *
+ * Check if the image's undo stack is enabled.
+ *
+ * This procedure checks if the image's undo stack is currently enabled
+ * or disabled. This is useful when several plug-ins or scripts call
+ * each other and want to check if their caller has already used
+ * gimp_image_undo_disable() or gimp_image_undo_freeze().
+ *
+ * Returns: TRUE if undo is enabled for this image.
+ **/
+gboolean
+_gimp_image_undo_is_enabled (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean enabled = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-undo-is-enabled",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-undo-is-enabled",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ enabled = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return enabled;
+}
+
/**
* gimp_image_undo_disable:
* @image: The image.
@@ -199,6 +321,49 @@ gimp_image_undo_disable (GimpImage *image)
return disabled;
}
+/**
+ * _gimp_image_undo_disable: (skip)
+ * @image_ID: The image.
+ *
+ * Disable the image's undo stack.
+ *
+ * This procedure disables the image's undo stack, allowing subsequent
+ * operations to ignore their undo steps. This is generally called in
+ * conjunction with gimp_image_undo_enable() to temporarily disable an
+ * image undo stack. This is advantageous because saving undo steps can
+ * be time and memory intensive.
+ *
+ * Returns: TRUE if the image undo has been disabled.
+ **/
+gboolean
+_gimp_image_undo_disable (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean disabled = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-undo-disable",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-undo-disable",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ disabled = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return disabled;
+}
+
/**
* gimp_image_undo_enable:
* @image: The image.
@@ -241,6 +406,48 @@ gimp_image_undo_enable (GimpImage *image)
return enabled;
}
+/**
+ * _gimp_image_undo_enable: (skip)
+ * @image_ID: The image.
+ *
+ * Enable the image's undo stack.
+ *
+ * This procedure enables the image's undo stack, allowing subsequent
+ * operations to store their undo steps. This is generally called in
+ * conjunction with gimp_image_undo_disable() to temporarily disable an
+ * image undo stack.
+ *
+ * Returns: TRUE if the image undo has been enabled.
+ **/
+gboolean
+_gimp_image_undo_enable (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean enabled = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-undo-enable",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-undo-enable",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ enabled = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return enabled;
+}
+
/**
* gimp_image_undo_freeze:
* @image: The image.
@@ -290,6 +497,55 @@ gimp_image_undo_freeze (GimpImage *image)
return frozen;
}
+/**
+ * _gimp_image_undo_freeze: (skip)
+ * @image_ID: The image.
+ *
+ * Freeze the image's undo stack.
+ *
+ * This procedure freezes the image's undo stack, allowing subsequent
+ * operations to ignore their undo steps. This is generally called in
+ * conjunction with gimp_image_undo_thaw() to temporarily disable an
+ * image undo stack. This is advantageous because saving undo steps can
+ * be time and memory intensive. gimp_image_undo_freeze() /
+ * gimp_image_undo_thaw() and gimp_image_undo_disable() /
+ * gimp_image_undo_enable() differ in that the former does not free up
+ * all undo steps when undo is thawed, so is more suited to interactive
+ * in-situ previews. It is important in this case that the image is
+ * back to the same state it was frozen in before thawing, else 'undo'
+ * behaviour is undefined.
+ *
+ * Returns: TRUE if the image undo has been frozen.
+ **/
+gboolean
+_gimp_image_undo_freeze (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean frozen = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-undo-freeze",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-undo-freeze",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ frozen = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return frozen;
+}
+
/**
* gimp_image_undo_thaw:
* @image: The image.
@@ -337,3 +593,51 @@ gimp_image_undo_thaw (GimpImage *image)
return thawed;
}
+
+/**
+ * _gimp_image_undo_thaw: (skip)
+ * @image_ID: The image.
+ *
+ * Thaw the image's undo stack.
+ *
+ * This procedure thaws the image's undo stack, allowing subsequent
+ * operations to store their undo steps. This is generally called in
+ * conjunction with gimp_image_undo_freeze() to temporarily freeze an
+ * image undo stack. gimp_image_undo_thaw() does NOT free the undo
+ * stack as gimp_image_undo_enable() does, so is suited for situations
+ * where one wishes to leave the undo stack in the same state in which
+ * one found it despite non-destructively playing with the image in the
+ * meantime. An example would be in-situ plug-in previews. Balancing
+ * freezes and thaws and ensuring image consistency is the
+ * responsibility of the caller.
+ *
+ * Returns: TRUE if the image undo has been thawed.
+ **/
+gboolean
+_gimp_image_undo_thaw (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean thawed = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-image-undo-thaw",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-image-undo-thaw",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ thawed = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return thawed;
+}
diff --git a/libgimp/gimpimageundo_pdb.h b/libgimp/gimpimageundo_pdb.h
index 3caa0f2227..947e11604a 100644
--- a/libgimp/gimpimageundo_pdb.h
+++ b/libgimp/gimpimageundo_pdb.h
@@ -32,13 +32,27 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gboolean gimp_image_undo_group_start (GimpImage *image);
-gboolean gimp_image_undo_group_end (GimpImage *image);
-gboolean gimp_image_undo_is_enabled (GimpImage *image);
-gboolean gimp_image_undo_disable (GimpImage *image);
-gboolean gimp_image_undo_enable (GimpImage *image);
-gboolean gimp_image_undo_freeze (GimpImage *image);
-gboolean gimp_image_undo_thaw (GimpImage *image);
+gboolean gimp_image_undo_group_start (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_undo_group_start)
+G_GNUC_INTERNAL gboolean _gimp_image_undo_group_start (gint32 image_ID);
+gboolean gimp_image_undo_group_end (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_undo_group_end)
+G_GNUC_INTERNAL gboolean _gimp_image_undo_group_end (gint32 image_ID);
+gboolean gimp_image_undo_is_enabled (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_undo_is_enabled)
+G_GNUC_INTERNAL gboolean _gimp_image_undo_is_enabled (gint32 image_ID);
+gboolean gimp_image_undo_disable (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_undo_disable)
+G_GNUC_INTERNAL gboolean _gimp_image_undo_disable (gint32 image_ID);
+gboolean gimp_image_undo_enable (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_undo_enable)
+G_GNUC_INTERNAL gboolean _gimp_image_undo_enable (gint32 image_ID);
+gboolean gimp_image_undo_freeze (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_undo_freeze)
+G_GNUC_INTERNAL gboolean _gimp_image_undo_freeze (gint32 image_ID);
+gboolean gimp_image_undo_thaw (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_image_undo_thaw)
+G_GNUC_INTERNAL gboolean _gimp_image_undo_thaw (gint32 image_ID);
G_END_DECLS
diff --git a/libgimp/gimpitem_pdb.c b/libgimp/gimpitem_pdb.c
index 5fbbedcaff..1761d1b0b6 100644
--- a/libgimp/gimpitem_pdb.c
+++ b/libgimp/gimpitem_pdb.c
@@ -110,13 +110,54 @@ gimp_item_get_image (gint32 item_ID)
gimp_value_array_unref (args);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
- image = gimp_image_new_by_id (g_value_get_int (gimp_value_array_index (return_vals, 1)));
+ image = gimp_image_new_by_id (gimp_value_get_image_id (gimp_value_array_index (return_vals, 1)));
gimp_value_array_unref (return_vals);
return image;
}
+/**
+ * _gimp_item_get_image: (skip)
+ * @item_ID: The item.
+ *
+ * Returns the item's image.
+ *
+ * This procedure returns the item's image.
+ *
+ * Returns: The item's image.
+ *
+ * Since: 2.8
+ **/
+gint32
+_gimp_item_get_image (gint32 item_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 image_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-image",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-item-get-image",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ image_ID = gimp_value_get_image_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return image_ID;
+}
+
/**
* gimp_item_delete:
* @item_ID: The item to delete.
diff --git a/libgimp/gimpitem_pdb.h b/libgimp/gimpitem_pdb.h
index 97c8ede32e..43f961e39f 100644
--- a/libgimp/gimpitem_pdb.h
+++ b/libgimp/gimpitem_pdb.h
@@ -32,52 +32,54 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gboolean gimp_item_is_valid (gint32 item_ID);
-GimpImage* 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);
+gboolean gimp_item_is_valid (gint32 item_ID);
+GimpImage* gimp_item_get_image (gint32 item_ID);
+GIMP_DEPRECATED_FOR(gimp_item_get_image)
+G_GNUC_INTERNAL 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/gimplayer_pdb.c b/libgimp/gimplayer_pdb.c
index 2e8cae9208..01babe8e57 100644
--- a/libgimp/gimplayer_pdb.c
+++ b/libgimp/gimplayer_pdb.c
@@ -96,6 +96,68 @@ _gimp_layer_new (GimpImage *image,
return layer_ID;
}
+/**
+ * __gimp_layer_new: (skip)
+ * @image_ID: The image to which to add the layer.
+ * @width: The layer width.
+ * @height: The layer height.
+ * @type: The layer type.
+ * @name: The layer name.
+ * @opacity: The layer opacity.
+ * @mode: The layer combination mode.
+ *
+ * Create a new layer.
+ *
+ * This procedure creates a new layer with the specified width, height,
+ * and type. Name, opacity, and mode are also supplied parameters. The
+ * new layer still needs to be added to the image, as this is not
+ * automatic. Add the new layer with the gimp_image_insert_layer()
+ * command. Other attributes such as layer mask modes, and offsets
+ * should be set with explicit procedure calls.
+ *
+ * Returns: The newly created layer.
+ **/
+gint32
+__gimp_layer_new (gint32 image_ID,
+ gint width,
+ gint height,
+ GimpImageType type,
+ const gchar *name,
+ gdouble opacity,
+ GimpLayerMode mode)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 layer_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_INT, width,
+ G_TYPE_INT, height,
+ GIMP_TYPE_IMAGE_TYPE, type,
+ G_TYPE_STRING, name,
+ G_TYPE_DOUBLE, opacity,
+ GIMP_TYPE_LAYER_MODE, mode,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-new",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-new",
+ 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_new_from_visible:
* @image: The source image from where the content is copied.
@@ -147,6 +209,57 @@ gimp_layer_new_from_visible (GimpImage *image,
return layer_ID;
}
+/**
+ * _gimp_layer_new_from_visible: (skip)
+ * @image_ID: The source image from where the content is copied.
+ * @dest_image_ID: The destination image to which to add the layer.
+ * @name: The layer name.
+ *
+ * Create a new layer from what is visible in an image.
+ *
+ * This procedure creates a new layer from what is visible in the given
+ * image. The new layer still needs to be added to the destination
+ * image, as this is not automatic. Add the new layer with the
+ * 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.
+ *
+ * Since: 2.6
+ **/
+gint32
+_gimp_layer_new_from_visible (gint32 image_ID,
+ gint32 dest_image_ID,
+ const gchar *name)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 layer_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_IMAGE_ID, dest_image_ID,
+ G_TYPE_STRING, name,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-new-from-visible",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-new-from-visible",
+ 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_new_from_drawable:
* @drawable_ID: The source drawable from where the new layer is copied.
@@ -193,6 +306,52 @@ gimp_layer_new_from_drawable (gint32 drawable_ID,
return layer_copy_ID;
}
+/**
+ * _gimp_layer_new_from_drawable: (skip)
+ * @drawable_ID: The source drawable from where the new layer is copied.
+ * @dest_image_ID: The destination image to which to add the layer.
+ *
+ * Create a new layer by copying an existing drawable.
+ *
+ * This procedure creates a new layer as a copy of the specified
+ * drawable. The new layer still needs to be added to the image, as
+ * this is not automatic. Add the new layer with the
+ * 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.
+ **/
+gint32
+_gimp_layer_new_from_drawable (gint32 drawable_ID,
+ gint32 dest_image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 layer_copy_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ GIMP_TYPE_IMAGE_ID, dest_image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-new-from-drawable",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-new-from-drawable",
+ args);
+ 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));
+
+ gimp_value_array_unref (return_vals);
+
+ return layer_copy_ID;
+}
+
/**
* gimp_layer_group_new:
* @image: The image to which to add the layer group.
@@ -240,6 +399,53 @@ gimp_layer_group_new (GimpImage *image)
return layer_group_ID;
}
+/**
+ * _gimp_layer_group_new: (skip)
+ * @image_ID: The image to which to add the layer group.
+ *
+ * Create a new layer group.
+ *
+ * This procedure creates a new layer group. Attributes such as layer
+ * mode and opacity should be set with explicit procedure calls. Add
+ * the new layer group (which is a kind of layer) with the
+ * gimp_image_insert_layer() command.
+ * Other procedures useful with layer groups:
+ * gimp_image_reorder_item(), gimp_item_get_parent(),
+ * gimp_item_get_children(), gimp_item_is_group().
+ *
+ * Returns: The newly created layer group.
+ *
+ * Since: 2.8
+ **/
+gint32
+_gimp_layer_group_new (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 layer_group_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-layer-group-new",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-layer-group-new",
+ args);
+ 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));
+
+ gimp_value_array_unref (return_vals);
+
+ return layer_group_ID;
+}
+
/**
* _gimp_layer_copy:
* @layer_ID: The layer to copy.
diff --git a/libgimp/gimplayer_pdb.h b/libgimp/gimplayer_pdb.h
index b46c48dac5..aad5f578fd 100644
--- a/libgimp/gimplayer_pdb.h
+++ b/libgimp/gimplayer_pdb.h
@@ -39,12 +39,29 @@ G_GNUC_INTERNAL gint32 _gimp_layer_new (GimpImage *
const gchar *name,
gdouble opacity,
GimpLayerMode mode);
+GIMP_DEPRECATED_FOR(_gimp_layer_new)
+G_GNUC_INTERNAL 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 (GimpImage *image,
GimpImage *dest_image,
const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_layer_new_from_visible)
+G_GNUC_INTERNAL 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,
GimpImage *dest_image);
+GIMP_DEPRECATED_FOR(gimp_layer_new_from_drawable)
+G_GNUC_INTERNAL gint32 _gimp_layer_new_from_drawable (gint32 drawable_ID,
+ gint32 dest_image_ID);
gint32 gimp_layer_group_new (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_layer_group_new)
+G_GNUC_INTERNAL gint32 _gimp_layer_group_new (gint32 image_ID);
G_GNUC_INTERNAL gint32 _gimp_layer_copy (gint32 layer_ID,
gboolean add_alpha);
gboolean gimp_layer_add_alpha (gint32 layer_ID);
diff --git a/libgimp/gimpselection_pdb.c b/libgimp/gimpselection_pdb.c
index 1f558a9baf..ff61666190 100644
--- a/libgimp/gimpselection_pdb.c
+++ b/libgimp/gimpselection_pdb.c
@@ -104,6 +104,76 @@ gimp_selection_bounds (GimpImage *image,
return success;
}
+/**
+ * _gimp_selection_bounds: (skip)
+ * @image_ID: The image.
+ * @non_empty: (out): TRUE if there is a selection.
+ * @x1: (out): x coordinate of upper left corner of selection bounds.
+ * @y1: (out): y coordinate of upper left corner of selection bounds.
+ * @x2: (out): x coordinate of lower right corner of selection bounds.
+ * @y2: (out): y coordinate of lower right corner of selection bounds.
+ *
+ * Find the bounding box of the current selection.
+ *
+ * This procedure returns whether there is a selection for the
+ * specified image. If there is one, the upper left and lower right
+ * corners of the bounding box are returned. These coordinates are
+ * relative to the image. Please note that the pixel specified by the
+ * lower right 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).
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_selection_bounds (gint32 image_ID,
+ gboolean *non_empty,
+ gint *x1,
+ gint *y1,
+ gint *x2,
+ gint *y2)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-selection-bounds",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-selection-bounds",
+ args);
+ gimp_value_array_unref (args);
+
+ *non_empty = FALSE;
+ *x1 = 0;
+ *y1 = 0;
+ *x2 = 0;
+ *y2 = 0;
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ if (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 success;
+}
+
/**
* gimp_selection_value:
* @image: The image.
@@ -150,6 +220,52 @@ gimp_selection_value (GimpImage *image,
return value;
}
+/**
+ * _gimp_selection_value: (skip)
+ * @image_ID: The image.
+ * @x: x coordinate of value.
+ * @y: y coordinate of value.
+ *
+ * Find the value of the selection at the specified coordinates.
+ *
+ * This procedure returns the value of the selection at the specified
+ * coordinates. If the coordinates lie out of bounds, 0 is returned.
+ *
+ * Returns: Value of the selection.
+ **/
+gint
+_gimp_selection_value (gint32 image_ID,
+ gint x,
+ gint y)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint value = 0;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_INT, x,
+ G_TYPE_INT, y,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-selection-value",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-selection-value",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ value = g_value_get_int (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return value;
+}
+
/**
* gimp_selection_is_empty:
* @image: The image.
@@ -190,6 +306,46 @@ gimp_selection_is_empty (GimpImage *image)
return is_empty;
}
+/**
+ * _gimp_selection_is_empty: (skip)
+ * @image_ID: The image.
+ *
+ * Determine whether the selection is empty.
+ *
+ * This procedure returns TRUE if the selection for the specified image
+ * is empty.
+ *
+ * Returns: Is the selection empty?
+ **/
+gboolean
+_gimp_selection_is_empty (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean is_empty = FALSE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-selection-is-empty",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-selection-is-empty",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ is_empty = g_value_get_boolean (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return is_empty;
+}
+
/**
* gimp_selection_translate:
* @image: The image.
@@ -207,9 +363,386 @@ gimp_selection_is_empty (GimpImage *image)
* Returns: TRUE on success.
**/
gboolean
-gimp_selection_translate (GimpImage *image,
- gint offx,
- gint offy)
+gimp_selection_translate (GimpImage *image,
+ 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_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_INT, offx,
+ G_TYPE_INT, offy,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-selection-translate",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-selection-translate",
+ 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_selection_translate: (skip)
+ * @image_ID: The image.
+ * @offx: x offset for translation.
+ * @offy: y offset for translation.
+ *
+ * Translate the selection by the specified offsets.
+ *
+ * This procedure actually translates the selection for the specified
+ * image by the specified offsets. Regions that are translated from
+ * beyond the bounds of the image are set to empty. Valid regions of
+ * the selection which are translated beyond the bounds of the image
+ * because of this call are lost.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_selection_translate (gint32 image_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_IMAGE_ID, image_ID,
+ G_TYPE_INT, offx,
+ G_TYPE_INT, offy,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-selection-translate",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-selection-translate",
+ 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_selection_float:
+ * @drawable_ID: 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: The floated layer.
+ **/
+gint32
+_gimp_selection_float (gint32 drawable_ID,
+ gint offx,
+ gint offy)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 layer_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ 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_ID = gimp_value_get_layer_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return layer_ID;
+}
+
+/**
+ * gimp_selection_invert:
+ * @image: The image.
+ *
+ * Invert the selection mask.
+ *
+ * This procedure inverts the selection mask. For every pixel in the
+ * selection channel, its new value is calculated as (255 - old-value).
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_selection_invert (GimpImage *image)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-selection-invert",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-selection-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_selection_invert: (skip)
+ * @image_ID: The image.
+ *
+ * Invert the selection mask.
+ *
+ * This procedure inverts the selection mask. For every pixel in the
+ * selection channel, its new value is calculated as (255 - old-value).
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_selection_invert (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-selection-invert",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-selection-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_selection_sharpen:
+ * @image: The image.
+ *
+ * Sharpen the selection mask.
+ *
+ * This procedure sharpens the selection mask. For every pixel in the
+ * selection channel, if the value is > 127, the new pixel is
+ * assigned a value of 255. This removes any \"anti-aliasing\" that
+ * might exist in the selection mask's boundary.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_selection_sharpen (GimpImage *image)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-selection-sharpen",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-selection-sharpen",
+ 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_selection_sharpen: (skip)
+ * @image_ID: The image.
+ *
+ * Sharpen the selection mask.
+ *
+ * This procedure sharpens the selection mask. For every pixel in the
+ * selection channel, if the value is > 127, the new pixel is
+ * assigned a value of 255. This removes any \"anti-aliasing\" that
+ * might exist in the selection mask's boundary.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_selection_sharpen (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-selection-sharpen",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-selection-sharpen",
+ 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_selection_all:
+ * @image: The image.
+ *
+ * Select all of the image.
+ *
+ * This procedure sets the selection mask to completely encompass the
+ * image. Every pixel in the selection channel is set to 255.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_selection_all (GimpImage *image)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-selection-all",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-selection-all",
+ 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_selection_all: (skip)
+ * @image_ID: The image.
+ *
+ * Select all of the image.
+ *
+ * This procedure sets the selection mask to completely encompass the
+ * image. Every pixel in the selection channel is set to 255.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+_gimp_selection_all (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-selection-all",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-selection-all",
+ 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_selection_none:
+ * @image: The image.
+ *
+ * Deselect the entire image.
+ *
+ * This procedure deselects the entire image. Every pixel in the
+ * selection channel is set to 0.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_selection_none (GimpImage *image)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -218,16 +751,14 @@ gimp_selection_translate (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- G_TYPE_INT, offx,
- G_TYPE_INT, offy,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-selection-translate",
+ "gimp-selection-none",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-selection-translate",
+ return_vals = gimp_run_procedure_array ("gimp-selection-none",
args);
gimp_value_array_unref (args);
@@ -239,68 +770,59 @@ gimp_selection_translate (GimpImage *image,
}
/**
- * _gimp_selection_float:
- * @drawable_ID: The drawable from which to float selection.
- * @offx: x offset for translation.
- * @offy: y offset for translation.
+ * _gimp_selection_none: (skip)
+ * @image_ID: The image.
*
- * Float the selection from the specified drawable with initial offsets
- * as specified.
+ * Deselect the entire image.
*
- * 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.
+ * This procedure deselects the entire image. Every pixel in the
+ * selection channel is set to 0.
*
- * Returns: The floated layer.
+ * Returns: TRUE on success.
**/
-gint32
-_gimp_selection_float (gint32 drawable_ID,
- gint offx,
- gint offy)
+gboolean
+_gimp_selection_none (gint32 image_ID)
{
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_DRAWABLE_ID, drawable_ID,
- G_TYPE_INT, offx,
- G_TYPE_INT, offy,
+ GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-selection-float",
+ "gimp-selection-none",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-selection-float",
+ return_vals = gimp_run_procedure_array ("gimp-selection-none",
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_selection_invert:
+ * gimp_selection_feather:
* @image: The image.
+ * @radius: Radius of feather (in pixels).
*
- * Invert the selection mask.
+ * Feather the image's selection
*
- * This procedure inverts the selection mask. For every pixel in the
- * selection channel, its new value is calculated as (255 - old-value).
+ * This procedure feathers the selection. Feathering is implemented
+ * using a gaussian blur.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_selection_invert (GimpImage *image)
+gimp_selection_feather (GimpImage *image,
+ gdouble radius)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -309,14 +831,15 @@ gimp_selection_invert (GimpImage *image)
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_DOUBLE, radius,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-selection-invert",
+ "gimp-selection-feather",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-selection-invert",
+ return_vals = gimp_run_procedure_array ("gimp-selection-feather",
args);
gimp_value_array_unref (args);
@@ -328,20 +851,20 @@ gimp_selection_invert (GimpImage *image)
}
/**
- * gimp_selection_sharpen:
- * @image: The image.
+ * _gimp_selection_feather: (skip)
+ * @image_ID: The image.
+ * @radius: Radius of feather (in pixels).
*
- * Sharpen the selection mask.
+ * Feather the image's selection
*
- * This procedure sharpens the selection mask. For every pixel in the
- * selection channel, if the value is > 127, the new pixel is
- * assigned a value of 255. This removes any \"anti-aliasing\" that
- * might exist in the selection mask's boundary.
+ * This procedure feathers the selection. Feathering is implemented
+ * using a gaussian blur.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_selection_sharpen (GimpImage *image)
+_gimp_selection_feather (gint32 image_ID,
+ gdouble radius)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -349,15 +872,16 @@ gimp_selection_sharpen (GimpImage *image)
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_DOUBLE, radius,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-selection-sharpen",
+ "gimp-selection-feather",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-selection-sharpen",
+ return_vals = gimp_run_procedure_array ("gimp-selection-feather",
args);
gimp_value_array_unref (args);
@@ -369,18 +893,21 @@ gimp_selection_sharpen (GimpImage *image)
}
/**
- * gimp_selection_all:
+ * gimp_selection_border:
* @image: The image.
+ * @radius: Radius of border (in pixels).
*
- * Select all of the image.
+ * Border the image's selection
*
- * This procedure sets the selection mask to completely encompass the
- * image. Every pixel in the selection channel is set to 255.
+ * This procedure borders the selection. Bordering creates a new
+ * selection which is defined along the boundary of the previous
+ * selection at every point within the specified radius.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_selection_all (GimpImage *image)
+gimp_selection_border (GimpImage *image,
+ gint radius)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -389,14 +916,15 @@ gimp_selection_all (GimpImage *image)
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ G_TYPE_INT, radius,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-selection-all",
+ "gimp-selection-border",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-selection-all",
+ return_vals = gimp_run_procedure_array ("gimp-selection-border",
args);
gimp_value_array_unref (args);
@@ -408,18 +936,21 @@ gimp_selection_all (GimpImage *image)
}
/**
- * gimp_selection_none:
- * @image: The image.
+ * _gimp_selection_border: (skip)
+ * @image_ID: The image.
+ * @radius: Radius of border (in pixels).
*
- * Deselect the entire image.
+ * Border the image's selection
*
- * This procedure deselects the entire image. Every pixel in the
- * selection channel is set to 0.
+ * This procedure borders the selection. Bordering creates a new
+ * selection which is defined along the boundary of the previous
+ * selection at every point within the specified radius.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_selection_none (GimpImage *image)
+_gimp_selection_border (gint32 image_ID,
+ gint radius)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -427,15 +958,16 @@ gimp_selection_none (GimpImage *image)
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_INT, radius,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-selection-none",
+ "gimp-selection-border",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-selection-none",
+ return_vals = gimp_run_procedure_array ("gimp-selection-border",
args);
gimp_value_array_unref (args);
@@ -447,20 +979,20 @@ gimp_selection_none (GimpImage *image)
}
/**
- * gimp_selection_feather:
+ * gimp_selection_grow:
* @image: The image.
- * @radius: Radius of feather (in pixels).
+ * @steps: Steps of grow (in pixels).
*
- * Feather the image's selection
+ * Grow the image's selection
*
- * This procedure feathers the selection. Feathering is implemented
- * using a gaussian blur.
+ * This procedure grows the selection. Growing involves expanding the
+ * boundary in all directions by the specified pixel amount.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_selection_feather (GimpImage *image,
- gdouble radius)
+gimp_selection_grow (GimpImage *image,
+ gint steps)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -469,15 +1001,15 @@ gimp_selection_feather (GimpImage *image,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- G_TYPE_DOUBLE, radius,
+ G_TYPE_INT, steps,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-selection-feather",
+ "gimp-selection-grow",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-selection-feather",
+ return_vals = gimp_run_procedure_array ("gimp-selection-grow",
args);
gimp_value_array_unref (args);
@@ -489,21 +1021,20 @@ gimp_selection_feather (GimpImage *image,
}
/**
- * gimp_selection_border:
- * @image: The image.
- * @radius: Radius of border (in pixels).
+ * _gimp_selection_grow: (skip)
+ * @image_ID: The image.
+ * @steps: Steps of grow (in pixels).
*
- * Border the image's selection
+ * Grow the image's selection
*
- * This procedure borders the selection. Bordering creates a new
- * selection which is defined along the boundary of the previous
- * selection at every point within the specified radius.
+ * This procedure grows the selection. Growing involves expanding the
+ * boundary in all directions by the specified pixel amount.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_selection_border (GimpImage *image,
- gint radius)
+_gimp_selection_grow (gint32 image_ID,
+ gint steps)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -511,16 +1042,16 @@ gimp_selection_border (GimpImage *image,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
- G_TYPE_INT, radius,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_INT, steps,
G_TYPE_NONE);
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-selection-border",
+ "gimp-selection-grow",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-selection-border",
+ return_vals = gimp_run_procedure_array ("gimp-selection-grow",
args);
gimp_value_array_unref (args);
@@ -532,20 +1063,21 @@ gimp_selection_border (GimpImage *image,
}
/**
- * gimp_selection_grow:
+ * gimp_selection_shrink:
* @image: The image.
- * @steps: Steps of grow (in pixels).
+ * @steps: Steps of shrink (in pixels).
*
- * Grow the image's selection
+ * Shrink the image's selection
*
- * This procedure grows the selection. Growing involves expanding the
- * boundary in all directions by the specified pixel amount.
+ * This procedure shrinks the selection. Shrinking involves trimming
+ * the existing selection boundary on all sides by the specified number
+ * of pixels.
*
* Returns: TRUE on success.
**/
gboolean
-gimp_selection_grow (GimpImage *image,
- gint steps)
+gimp_selection_shrink (GimpImage *image,
+ gint steps)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -559,10 +1091,10 @@ gimp_selection_grow (GimpImage *image,
if (pdb)
return_vals = gimp_pdb_run_procedure_array (pdb,
- "gimp-selection-grow",
+ "gimp-selection-shrink",
args);
else
- return_vals = gimp_run_procedure_array ("gimp-selection-grow",
+ return_vals = gimp_run_procedure_array ("gimp-selection-shrink",
args);
gimp_value_array_unref (args);
@@ -574,8 +1106,8 @@ gimp_selection_grow (GimpImage *image,
}
/**
- * gimp_selection_shrink:
- * @image: The image.
+ * _gimp_selection_shrink: (skip)
+ * @image_ID: The image.
* @steps: Steps of shrink (in pixels).
*
* Shrink the image's selection
@@ -587,8 +1119,8 @@ gimp_selection_grow (GimpImage *image,
* Returns: TRUE on success.
**/
gboolean
-gimp_selection_shrink (GimpImage *image,
- gint steps)
+_gimp_selection_shrink (gint32 image_ID,
+ gint steps)
{
GimpPDB *pdb = gimp_get_pdb ();
GimpValueArray *args;
@@ -596,7 +1128,7 @@ gimp_selection_shrink (GimpImage *image,
gboolean success = TRUE;
args = gimp_value_array_new_from_types (NULL,
- GIMP_TYPE_IMAGE_ID, gimp_image_get_id (image),
+ GIMP_TYPE_IMAGE_ID, image_ID,
G_TYPE_INT, steps,
G_TYPE_NONE);
@@ -659,6 +1191,49 @@ gimp_selection_flood (GimpImage *image)
return success;
}
+/**
+ * _gimp_selection_flood: (skip)
+ * @image_ID: The image.
+ *
+ * Remove holes from the image's selection
+ *
+ * This procedure removes holes from the selection, that can come from
+ * selecting a patchy area with the Fuzzy Select Tool. In technical
+ * terms this procedure floods the selection. See the Algorithms page
+ * in the developer wiki for details.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+_gimp_selection_flood (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-selection-flood",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-selection-flood",
+ 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_selection_save:
* @image: The image.
@@ -699,3 +1274,44 @@ gimp_selection_save (GimpImage *image)
return channel_ID;
}
+
+/**
+ * _gimp_selection_save: (skip)
+ * @image_ID: The image.
+ *
+ * Copy the selection mask to a new channel.
+ *
+ * This procedure copies the selection mask and stores the content in a
+ * new channel. The new channel is automatically inserted into the
+ * image's list of channels.
+ *
+ * Returns: The new channel.
+ **/
+gint32
+_gimp_selection_save (gint32 image_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 channel_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-selection-save",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-selection-save",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ channel_ID = gimp_value_get_channel_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return channel_ID;
+}
diff --git a/libgimp/gimpselection_pdb.h b/libgimp/gimpselection_pdb.h
index 740f9c8e73..c42ac1cbaa 100644
--- a/libgimp/gimpselection_pdb.h
+++ b/libgimp/gimpselection_pdb.h
@@ -32,36 +32,77 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-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 gint32 _gimp_selection_float (gint32 drawable_ID,
- 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);
+GIMP_DEPRECATED_FOR(gimp_selection_bounds)
+G_GNUC_INTERNAL gboolean _gimp_selection_bounds (gint32 image_ID,
+ gboolean *non_empty,
+ gint *x1,
+ gint *y1,
+ gint *x2,
+ gint *y2);
+gint gimp_selection_value (GimpImage *image,
+ gint x,
+ gint y);
+GIMP_DEPRECATED_FOR(gimp_selection_value)
+G_GNUC_INTERNAL gint _gimp_selection_value (gint32 image_ID,
+ gint x,
+ gint y);
+gboolean gimp_selection_is_empty (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_selection_is_empty)
+G_GNUC_INTERNAL gboolean _gimp_selection_is_empty (gint32 image_ID);
+gboolean gimp_selection_translate (GimpImage *image,
+ gint offx,
+ gint offy);
+GIMP_DEPRECATED_FOR(gimp_selection_translate)
+G_GNUC_INTERNAL gboolean _gimp_selection_translate (gint32 image_ID,
+ gint offx,
+ gint offy);
+G_GNUC_INTERNAL gint32 _gimp_selection_float (gint32 drawable_ID,
+ gint offx,
+ gint offy);
+gboolean gimp_selection_invert (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_selection_invert)
+G_GNUC_INTERNAL gboolean _gimp_selection_invert (gint32 image_ID);
+gboolean gimp_selection_sharpen (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_selection_sharpen)
+G_GNUC_INTERNAL gboolean _gimp_selection_sharpen (gint32 image_ID);
+gboolean gimp_selection_all (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_selection_all)
+G_GNUC_INTERNAL gboolean _gimp_selection_all (gint32 image_ID);
+gboolean gimp_selection_none (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_selection_none)
+G_GNUC_INTERNAL gboolean _gimp_selection_none (gint32 image_ID);
+gboolean gimp_selection_feather (GimpImage *image,
+ gdouble radius);
+GIMP_DEPRECATED_FOR(gimp_selection_feather)
+G_GNUC_INTERNAL gboolean _gimp_selection_feather (gint32 image_ID,
+ gdouble radius);
+gboolean gimp_selection_border (GimpImage *image,
+ gint radius);
+GIMP_DEPRECATED_FOR(gimp_selection_border)
+G_GNUC_INTERNAL gboolean _gimp_selection_border (gint32 image_ID,
+ gint radius);
+gboolean gimp_selection_grow (GimpImage *image,
+ gint steps);
+GIMP_DEPRECATED_FOR(gimp_selection_grow)
+G_GNUC_INTERNAL gboolean _gimp_selection_grow (gint32 image_ID,
+ gint steps);
+gboolean gimp_selection_shrink (GimpImage *image,
+ gint steps);
+GIMP_DEPRECATED_FOR(gimp_selection_shrink)
+G_GNUC_INTERNAL gboolean _gimp_selection_shrink (gint32 image_ID,
+ gint steps);
+gboolean gimp_selection_flood (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_selection_flood)
+G_GNUC_INTERNAL gboolean _gimp_selection_flood (gint32 image_ID);
+gint32 gimp_selection_save (GimpImage *image);
+GIMP_DEPRECATED_FOR(gimp_selection_save)
+G_GNUC_INTERNAL gint32 _gimp_selection_save (gint32 image_ID);
G_END_DECLS
diff --git a/libgimp/gimptextlayer_pdb.c b/libgimp/gimptextlayer_pdb.c
index d3c937d1a6..c2082de921 100644
--- a/libgimp/gimptextlayer_pdb.c
+++ b/libgimp/gimptextlayer_pdb.c
@@ -92,6 +92,64 @@ gimp_text_layer_new (GimpImage *image,
return layer_ID;
}
+/**
+ * _gimp_text_layer_new: (skip)
+ * @image_ID: The image.
+ * @text: The text to generate (in UTF-8 encoding).
+ * @fontname: The name of the font.
+ * @size: The size of text in either pixels or points.
+ * @unit: The units of specified size.
+ *
+ * Creates a new text layer.
+ *
+ * This procedure creates a new text layer. The arguments are kept as
+ * simple as necessary for the normal case. All text attributes,
+ * however, can be modified with the appropriate
+ * gimp_text_layer_set_*() procedures. The new layer still needs to be
+ * added to the image, as this is not automatic. Add the new layer
+ * using gimp_image_insert_layer().
+ *
+ * Returns: The new text layer.
+ *
+ * Since: 2.6
+ **/
+gint32
+_gimp_text_layer_new (gint32 image_ID,
+ const gchar *text,
+ const gchar *fontname,
+ gdouble size,
+ GimpUnit unit)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 layer_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_STRING, text,
+ G_TYPE_STRING, fontname,
+ G_TYPE_DOUBLE, size,
+ GIMP_TYPE_UNIT, unit,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-layer-new",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-layer-new",
+ 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_text_layer_get_text:
* @layer_ID: The text layer.
diff --git a/libgimp/gimptextlayer_pdb.h b/libgimp/gimptextlayer_pdb.h
index da4be7f6e3..2ef1b94d2a 100644
--- a/libgimp/gimptextlayer_pdb.h
+++ b/libgimp/gimptextlayer_pdb.h
@@ -32,57 +32,63 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gint32 gimp_text_layer_new (GimpImage *image,
- 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);
+gint32 gimp_text_layer_new (GimpImage *image,
+ const gchar *text,
+ const gchar *fontname,
+ gdouble size,
+ GimpUnit unit);
+GIMP_DEPRECATED_FOR(gimp_text_layer_new)
+G_GNUC_INTERNAL 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 041e1925f2..8777c5937c 100644
--- a/libgimp/gimptexttool_pdb.c
+++ b/libgimp/gimptexttool_pdb.c
@@ -113,6 +113,85 @@ gimp_text_fontname (GimpImage *image,
return text_layer_ID;
}
+/**
+ * _gimp_text_fontname: (skip)
+ * @image_ID: The image.
+ * @drawable_ID: 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).
+ * @border: The size of the border.
+ * @antialias: Antialiasing.
+ * @size: The size of text in either pixels or points.
+ * @size_type: The units of specified size.
+ * @fontname: The name of the font.
+ *
+ * Add text at the specified location as a floating selection or a new
+ * layer.
+ *
+ * This tool requires a fontname matching an installed PangoFT2 font.
+ * You can specify the fontsize in units of pixels or points, and the
+ * appropriate metric is specified using the size_type argument. The x
+ * and y parameters together control the placement of the new text by
+ * specifying the upper left corner of the text bounding box. If the
+ * specified drawable parameter is valid, the text will be created as a
+ * floating selection attached to the drawable. If the drawable
+ * parameter is not valid (-1), the text will appear as a new layer.
+ * Finally, a border can be specified around the final rendered text.
+ * The border is measured in pixels. Parameter size-type is not used
+ * and is currently ignored. If you need to display a font in points,
+ * 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.
+ **/
+gint32
+_gimp_text_fontname (gint32 image_ID,
+ gint32 drawable_ID,
+ gdouble x,
+ gdouble y,
+ const gchar *text,
+ gint border,
+ gboolean antialias,
+ gdouble size,
+ GimpSizeType size_type,
+ const gchar *fontname)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 text_layer_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_DRAWABLE_ID, drawable_ID,
+ G_TYPE_DOUBLE, x,
+ G_TYPE_DOUBLE, y,
+ G_TYPE_STRING, text,
+ G_TYPE_INT, border,
+ G_TYPE_BOOLEAN, antialias,
+ G_TYPE_DOUBLE, size,
+ GIMP_TYPE_SIZE_TYPE, size_type,
+ G_TYPE_STRING, fontname,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-text-fontname",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-text-fontname",
+ args);
+ 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));
+
+ gimp_value_array_unref (return_vals);
+
+ return text_layer_ID;
+}
+
/**
* gimp_text_get_extents_fontname:
* @text: The text to generate (in UTF-8 encoding).
diff --git a/libgimp/gimptexttool_pdb.h b/libgimp/gimptexttool_pdb.h
index cc3b6ab7f7..46a8fdc2ea 100644
--- a/libgimp/gimptexttool_pdb.h
+++ b/libgimp/gimptexttool_pdb.h
@@ -32,24 +32,35 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-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);
-gboolean gimp_text_get_extents_fontname (const gchar *text,
- gdouble size,
- GimpSizeType size_type,
- const gchar *fontname,
- gint *width,
- gint *height,
- gint *ascent,
- gint *descent);
+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);
+GIMP_DEPRECATED_FOR(gimp_text_fontname)
+G_GNUC_INTERNAL gint32 _gimp_text_fontname (gint32 image_ID,
+ gint32 drawable_ID,
+ gdouble x,
+ gdouble y,
+ const gchar *text,
+ gint border,
+ gboolean antialias,
+ gdouble size,
+ GimpSizeType size_type,
+ const gchar *fontname);
+gboolean gimp_text_get_extents_fontname (const gchar *text,
+ gdouble size,
+ GimpSizeType size_type,
+ const gchar *fontname,
+ gint *width,
+ gint *height,
+ gint *ascent,
+ gint *descent);
G_END_DECLS
diff --git a/libgimp/gimpvectors_pdb.c b/libgimp/gimpvectors_pdb.c
index f68da7e754..3f3a6c7499 100644
--- a/libgimp/gimpvectors_pdb.c
+++ b/libgimp/gimpvectors_pdb.c
@@ -79,6 +79,51 @@ gimp_vectors_new (GimpImage *image,
return vectors_ID;
}
+/**
+ * _gimp_vectors_new: (skip)
+ * @image_ID: The image.
+ * @name: the name of the new vector object.
+ *
+ * Creates a new empty vectors object.
+ *
+ * Creates a new empty vectors object. The vectors object needs to be
+ * added to the image using gimp_image_insert_vectors().
+ *
+ * Returns: the current vector object, 0 if no vector exists in the image.
+ *
+ * Since: 2.4
+ **/
+gint32
+_gimp_vectors_new (gint32 image_ID,
+ const gchar *name)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 vectors_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_STRING, name,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-vectors-new",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-vectors-new",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ vectors_ID = gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return vectors_ID;
+}
+
/**
* gimp_vectors_new_from_text_layer:
* @image: The image.
@@ -124,6 +169,51 @@ gimp_vectors_new_from_text_layer (GimpImage *image,
return vectors_ID;
}
+/**
+ * _gimp_vectors_new_from_text_layer: (skip)
+ * @image_ID: The image.
+ * @layer_ID: The text layer.
+ *
+ * Creates a new vectors object from a text layer.
+ *
+ * Creates a new vectors object from a text layer. The vectors object
+ * needs to be added to the image using gimp_image_insert_vectors().
+ *
+ * Returns: The vectors of the text layer.
+ *
+ * Since: 2.6
+ **/
+gint32
+_gimp_vectors_new_from_text_layer (gint32 image_ID,
+ gint32 layer_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gint32 vectors_ID = -1;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_LAYER_ID, layer_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-vectors-new-from-text-layer",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-vectors-new-from-text-layer",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ vectors_ID = gimp_value_get_vectors_id (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return vectors_ID;
+}
+
/**
* gimp_vectors_copy:
* @vectors_ID: The vectors object to copy.
@@ -1194,6 +1284,69 @@ gimp_vectors_import_from_file (GimpImage *image,
return success;
}
+/**
+ * _gimp_vectors_import_from_file: (skip)
+ * @image_ID: The image.
+ * @filename: The name of the SVG file to import.
+ * @merge: Merge paths into a single vectors object.
+ * @scale: Scale the SVG to image dimensions.
+ * @num_vectors: (out): The number of newly created vectors.
+ * @vectors_ids: (out) (array length=num_vectors): The list of newly created vectors.
+ *
+ * Import paths from an SVG file.
+ *
+ * This procedure imports paths from an SVG file. SVG elements other
+ * than paths and basic shapes are ignored.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+_gimp_vectors_import_from_file (gint32 image_ID,
+ const gchar *filename,
+ gboolean merge,
+ gboolean scale,
+ gint *num_vectors,
+ gint **vectors_ids)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_STRING, filename,
+ G_TYPE_BOOLEAN, merge,
+ G_TYPE_BOOLEAN, scale,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-vectors-import-from-file",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-vectors-import-from-file",
+ args);
+ gimp_value_array_unref (args);
+
+ *num_vectors = 0;
+ *vectors_ids = NULL;
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *num_vectors = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ *vectors_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
/**
* gimp_vectors_import_from_string:
* @image: The image.
@@ -1261,6 +1414,73 @@ gimp_vectors_import_from_string (GimpImage *image,
return success;
}
+/**
+ * _gimp_vectors_import_from_string: (skip)
+ * @image_ID: The image.
+ * @string: A string that must be a complete and valid SVG document.
+ * @length: Number of bytes in string or -1 if the string is NULL terminated.
+ * @merge: Merge paths into a single vectors object.
+ * @scale: Scale the SVG to image dimensions.
+ * @num_vectors: (out): The number of newly created vectors.
+ * @vectors_ids: (out) (array length=num_vectors): The list of newly created vectors.
+ *
+ * Import paths from an SVG string.
+ *
+ * This procedure works like gimp_vectors_import_from_file() but takes
+ * a string rather than reading the SVG from a file. This allows you to
+ * write scripts that generate SVG and feed it to GIMP.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+_gimp_vectors_import_from_string (gint32 image_ID,
+ const gchar *string,
+ gint length,
+ gboolean merge,
+ gboolean scale,
+ gint *num_vectors,
+ gint **vectors_ids)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_STRING, string,
+ G_TYPE_INT, length,
+ G_TYPE_BOOLEAN, merge,
+ G_TYPE_BOOLEAN, scale,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-vectors-import-from-string",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-vectors-import-from-string",
+ args);
+ gimp_value_array_unref (args);
+
+ *num_vectors = 0;
+ *vectors_ids = NULL;
+
+ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
+
+ if (success)
+ {
+ *num_vectors = g_value_get_int (gimp_value_array_index (return_vals, 1));
+ *vectors_ids = gimp_value_dup_int32_array (gimp_value_array_index (return_vals, 2));
+ }
+
+ gimp_value_array_unref (return_vals);
+
+ return success;
+}
+
/**
* gimp_vectors_export_to_file:
* @image: The image.
@@ -1310,6 +1530,55 @@ gimp_vectors_export_to_file (GimpImage *image,
return success;
}
+/**
+ * _gimp_vectors_export_to_file: (skip)
+ * @image_ID: The image.
+ * @filename: The name of the SVG file to create.
+ * @vectors_ID: The vectors object to be saved, or 0 for all in the image.
+ *
+ * save a path as an SVG file.
+ *
+ * This procedure creates an SVG file to save a Vectors object, that
+ * is, a path. The resulting file can be edited using a vector graphics
+ * application, or later reloaded into GIMP. If you pass 0 as the
+ * 'vectors' argument, then all paths in the image will be exported.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.6
+ **/
+gboolean
+_gimp_vectors_export_to_file (gint32 image_ID,
+ const gchar *filename,
+ gint32 vectors_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gboolean success = TRUE;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ G_TYPE_STRING, filename,
+ GIMP_TYPE_VECTORS_ID, vectors_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-vectors-export-to-file",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-vectors-export-to-file",
+ 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_vectors_export_to_string:
* @image: The image.
@@ -1358,3 +1627,51 @@ gimp_vectors_export_to_string (GimpImage *image,
return string;
}
+
+/**
+ * _gimp_vectors_export_to_string: (skip)
+ * @image_ID: The image.
+ * @vectors_ID: The vectors object to save, or 0 for all in the image.
+ *
+ * Save a path as an SVG string.
+ *
+ * This procedure works like gimp_vectors_export_to_file() but creates
+ * a string rather than a file. The contents are a NUL-terminated
+ * string that holds a complete XML document. If you pass 0 as the
+ * 'vectors' argument, then all paths in the image will be exported.
+ *
+ * Returns: A string whose contents are a complete SVG document.
+ * The returned value must be freed with g_free().
+ *
+ * Since: 2.6
+ **/
+gchar *
+_gimp_vectors_export_to_string (gint32 image_ID,
+ gint32 vectors_ID)
+{
+ GimpPDB *pdb = gimp_get_pdb ();
+ GimpValueArray *args;
+ GimpValueArray *return_vals;
+ gchar *string = NULL;
+
+ args = gimp_value_array_new_from_types (NULL,
+ GIMP_TYPE_IMAGE_ID, image_ID,
+ GIMP_TYPE_VECTORS_ID, vectors_ID,
+ G_TYPE_NONE);
+
+ if (pdb)
+ return_vals = gimp_pdb_run_procedure_array (pdb,
+ "gimp-vectors-export-to-string",
+ args);
+ else
+ return_vals = gimp_run_procedure_array ("gimp-vectors-export-to-string",
+ args);
+ gimp_value_array_unref (args);
+
+ if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
+ string = g_value_dup_string (gimp_value_array_index (return_vals, 1));
+
+ gimp_value_array_unref (return_vals);
+
+ return string;
+}
diff --git a/libgimp/gimpvectors_pdb.h b/libgimp/gimpvectors_pdb.h
index 27c6719f8e..18cfc9fc73 100644
--- a/libgimp/gimpvectors_pdb.h
+++ b/libgimp/gimpvectors_pdb.h
@@ -32,111 +32,139 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-gint32 gimp_vectors_new (GimpImage *image,
- const gchar *name);
-gint32 gimp_vectors_new_from_text_layer (GimpImage *image,
- gint32 layer_ID);
-gint32 gimp_vectors_copy (gint32 vectors_ID);
-gint* gimp_vectors_get_strokes (gint32 vectors_ID,
- gint *num_strokes);
-gdouble gimp_vectors_stroke_get_length (gint32 vectors_ID,
- gint stroke_id,
- gdouble precision);
-gboolean gimp_vectors_stroke_get_point_at_dist (gint32 vectors_ID,
- gint stroke_id,
- gdouble dist,
- gdouble precision,
- gdouble *x_point,
- gdouble *y_point,
- gdouble *slope,
- gboolean *valid);
-gboolean gimp_vectors_remove_stroke (gint32 vectors_ID,
- gint stroke_id);
-gboolean gimp_vectors_stroke_close (gint32 vectors_ID,
- gint stroke_id);
-gboolean gimp_vectors_stroke_translate (gint32 vectors_ID,
- gint stroke_id,
- gint off_x,
- gint off_y);
-gboolean gimp_vectors_stroke_scale (gint32 vectors_ID,
- gint stroke_id,
- gdouble scale_x,
- gdouble scale_y);
-gboolean gimp_vectors_stroke_rotate (gint32 vectors_ID,
- gint stroke_id,
- gdouble center_x,
- gdouble center_y,
- gdouble angle);
-gboolean gimp_vectors_stroke_flip (gint32 vectors_ID,
- gint stroke_id,
- GimpOrientationType flip_type,
- gdouble axis);
-gboolean gimp_vectors_stroke_flip_free (gint32 vectors_ID,
- gint stroke_id,
- gdouble x1,
- gdouble y1,
- gdouble x2,
- gdouble y2);
-GimpVectorsStrokeType gimp_vectors_stroke_get_points (gint32 vectors_ID,
- gint stroke_id,
- gint *num_points,
- gdouble **controlpoints,
- gboolean *closed);
-gint gimp_vectors_stroke_new_from_points (gint32 vectors_ID,
- GimpVectorsStrokeType type,
- gint num_points,
- const gdouble *controlpoints,
- gboolean closed);
-gdouble* gimp_vectors_stroke_interpolate (gint32 vectors_ID,
- gint stroke_id,
- gdouble precision,
- gint *num_coords,
- gboolean *closed);
-gint gimp_vectors_bezier_stroke_new_moveto (gint32 vectors_ID,
- gdouble x0,
- gdouble y0);
-gboolean gimp_vectors_bezier_stroke_lineto (gint32 vectors_ID,
- gint stroke_id,
- gdouble x0,
- gdouble y0);
-gboolean gimp_vectors_bezier_stroke_conicto (gint32 vectors_ID,
- gint stroke_id,
- gdouble x0,
- gdouble y0,
- gdouble x1,
- gdouble y1);
-gboolean gimp_vectors_bezier_stroke_cubicto (gint32 vectors_ID,
- gint stroke_id,
- gdouble x0,
- gdouble y0,
- gdouble x1,
- gdouble y1,
- gdouble x2,
- gdouble y2);
-gint gimp_vectors_bezier_stroke_new_ellipse (gint32 vectors_ID,
- gdouble x0,
- gdouble y0,
- gdouble radius_x,
- gdouble radius_y,
- gdouble angle);
-gboolean gimp_vectors_import_from_file (GimpImage *image,
- const gchar *filename,
- gboolean merge,
- gboolean scale,
- gint *num_vectors,
- gint **vectors_ids);
-gboolean gimp_vectors_import_from_string (GimpImage *image,
- const gchar *string,
- gint length,
- gboolean merge,
- gboolean scale,
- gint *num_vectors,
- gint **vectors_ids);
-gboolean gimp_vectors_export_to_file (GimpImage *image,
- const gchar *filename,
- gint32 vectors_ID);
-gchar* gimp_vectors_export_to_string (GimpImage *image,
- gint32 vectors_ID);
+gint32 gimp_vectors_new (GimpImage *image,
+ const gchar *name);
+GIMP_DEPRECATED_FOR(gimp_vectors_new)
+G_GNUC_INTERNAL gint32 _gimp_vectors_new (gint32 image_ID,
+ const gchar *name);
+gint32 gimp_vectors_new_from_text_layer (GimpImage *image,
+ gint32 layer_ID);
+GIMP_DEPRECATED_FOR(gimp_vectors_new_from_text_layer)
+G_GNUC_INTERNAL gint32 _gimp_vectors_new_from_text_layer (gint32 image_ID,
+ gint32 layer_ID);
+gint32 gimp_vectors_copy (gint32 vectors_ID);
+gint* gimp_vectors_get_strokes (gint32 vectors_ID,
+ gint *num_strokes);
+gdouble gimp_vectors_stroke_get_length (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble precision);
+gboolean gimp_vectors_stroke_get_point_at_dist (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble dist,
+ gdouble precision,
+ gdouble *x_point,
+ gdouble *y_point,
+ gdouble *slope,
+ gboolean *valid);
+gboolean gimp_vectors_remove_stroke (gint32 vectors_ID,
+ gint stroke_id);
+gboolean gimp_vectors_stroke_close (gint32 vectors_ID,
+ gint stroke_id);
+gboolean gimp_vectors_stroke_translate (gint32 vectors_ID,
+ gint stroke_id,
+ gint off_x,
+ gint off_y);
+gboolean gimp_vectors_stroke_scale (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble scale_x,
+ gdouble scale_y);
+gboolean gimp_vectors_stroke_rotate (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble center_x,
+ gdouble center_y,
+ gdouble angle);
+gboolean gimp_vectors_stroke_flip (gint32 vectors_ID,
+ gint stroke_id,
+ GimpOrientationType flip_type,
+ gdouble axis);
+gboolean gimp_vectors_stroke_flip_free (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2);
+GimpVectorsStrokeType gimp_vectors_stroke_get_points (gint32 vectors_ID,
+ gint stroke_id,
+ gint *num_points,
+ gdouble **controlpoints,
+ gboolean *closed);
+gint gimp_vectors_stroke_new_from_points (gint32 vectors_ID,
+ GimpVectorsStrokeType type,
+ gint num_points,
+ const gdouble *controlpoints,
+ gboolean closed);
+gdouble* gimp_vectors_stroke_interpolate (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble precision,
+ gint *num_coords,
+ gboolean *closed);
+gint gimp_vectors_bezier_stroke_new_moveto (gint32 vectors_ID,
+ gdouble x0,
+ gdouble y0);
+gboolean gimp_vectors_bezier_stroke_lineto (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble x0,
+ gdouble y0);
+gboolean gimp_vectors_bezier_stroke_conicto (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1);
+gboolean gimp_vectors_bezier_stroke_cubicto (gint32 vectors_ID,
+ gint stroke_id,
+ gdouble x0,
+ gdouble y0,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2);
+gint gimp_vectors_bezier_stroke_new_ellipse (gint32 vectors_ID,
+ gdouble x0,
+ gdouble y0,
+ gdouble radius_x,
+ gdouble radius_y,
+ gdouble angle);
+gboolean gimp_vectors_import_from_file (GimpImage *image,
+ const gchar *filename,
+ gboolean merge,
+ gboolean scale,
+ gint *num_vectors,
+ gint **vectors_ids);
+GIMP_DEPRECATED_FOR(gimp_vectors_import_from_file)
+G_GNUC_INTERNAL gboolean _gimp_vectors_import_from_file (gint32 image_ID,
+ const gchar *filename,
+ gboolean merge,
+ gboolean scale,
+ gint *num_vectors,
+ gint **vectors_ids);
+gboolean gimp_vectors_import_from_string (GimpImage *image,
+ const gchar *string,
+ gint length,
+ gboolean merge,
+ gboolean scale,
+ gint *num_vectors,
+ gint **vectors_ids);
+GIMP_DEPRECATED_FOR(gimp_vectors_import_from_string)
+G_GNUC_INTERNAL gboolean _gimp_vectors_import_from_string (gint32 image_ID,
+ const gchar *string,
+ gint length,
+ gboolean merge,
+ gboolean scale,
+ gint *num_vectors,
+ gint **vectors_ids);
+gboolean gimp_vectors_export_to_file (GimpImage *image,
+ const gchar *filename,
+ gint32 vectors_ID);
+GIMP_DEPRECATED_FOR(gimp_vectors_export_to_file)
+G_GNUC_INTERNAL gboolean _gimp_vectors_export_to_file (gint32 image_ID,
+ const gchar *filename,
+ gint32 vectors_ID);
+gchar* gimp_vectors_export_to_string (GimpImage *image,
+ gint32 vectors_ID);
+GIMP_DEPRECATED_FOR(gimp_vectors_export_to_string)
+G_GNUC_INTERNAL gchar* _gimp_vectors_export_to_string (gint32 image_ID,
+ gint32 vectors_ID);
G_END_DECLS
diff --git a/pdb/lib.pl b/pdb/lib.pl
index 8dda2e79c5..c76b7c8c87 100644
--- a/pdb/lib.pl
+++ b/pdb/lib.pl
@@ -45,17 +45,23 @@ sub desc_wrap {
return $wrapped;
}
-sub generate {
- my @procs = @{(shift)};
- my %out;
+sub generate_fun {
+ my ($proc, $out, $api_deprecated) = @_;
+ my @inargs = @{$proc->{inargs}} if (defined $proc->{inargs});
+ my @outargs = @{$proc->{outargs}} if (defined $proc->{outargs});
sub libtype {
my $arg = shift;
my $outarg = shift;
+ my $api_deprecated = shift;
my ($type, $name) = &arg_parse($arg->{type});
my $argtype = $arg_types{$type};
my $rettype = '';
-
+
+ if ($api_deprecated && $argtype->{name} eq 'IMAGE') {
+ return 'gint32 ';
+ }
+
if (exists $argtype->{id}) {
return 'gint32 ';
}
@@ -73,371 +79,393 @@ sub generate {
}
$rettype .= $argtype->{const_type};
}
-
+
$rettype =~ s/int32/int/ unless exists $arg->{keep_size};
$rettype .= '*' if exists $argtype->{struct};
return $rettype;
}
- foreach $name (@procs) {
- my $proc = $main::pdb{$name};
- my $out = \%{$out{$proc->{group}}};
-
- my @inargs = @{$proc->{inargs}} if (defined $proc->{inargs});
- my @outargs = @{$proc->{outargs}} if (defined $proc->{outargs});
-
- my $funcname = "gimp_$name";
- my $wrapped = "";
- my %usednames;
- my $retdesc = " * Returns:";
-
- if ($proc->{lib_private}) {
- $wrapped = '_';
- }
+ my $funcname = "gimp_$name";
+ my $wrapped = "";
+ my %usednames;
+ my $retdesc = " * Returns:";
+ my $func_annotations = "";
- if ($proc->{deprecated}) {
- if ($proc->{deprecated} eq 'NONE') {
- push @{$out->{protos}}, "GIMP_DEPRECATED\n";
- }
- else {
- my $underscores = $proc->{deprecated};
- $underscores =~ s/-/_/g;
-
- push @{$out->{protos}}, "GIMP_DEPRECATED_FOR($underscores)\n";
- }
- }
-
- # Find the return argument (defaults to the first arg if not
- # explicitly set
- my $retarg = undef;
- $retvoid = 0;
- foreach (@outargs) {
- $retarg = $_, last if exists $_->{retval};
- }
+ if ($proc->{lib_private}) {
+ $wrapped = '_';
+ }
- unless ($retarg) {
- if (scalar @outargs) {
- if (exists $outargs[0]->{void_ret}) {
- $retvoid = 1;
- }
- else {
- $retarg = exists $outargs[0]->{num} ? $outargs[1]
- : $outargs[0];
- }
- }
- }
+ if ($api_deprecated) {
+ push @{$out->{protos}}, "GIMP_DEPRECATED_FOR($wrapped$funcname)\n";
+ $func_annotations .= " (skip)";
+ }
+ elsif ($proc->{deprecated}) {
+ if ($proc->{deprecated} eq 'NONE') {
+ push @{$out->{protos}}, "GIMP_DEPRECATED\n";
+ }
+ else {
+ my $underscores = $proc->{deprecated};
+ $underscores =~ s/-/_/g;
- my $rettype;
- if ($retarg) {
- my ($type) = &arg_parse($retarg->{type});
- my $argtype = $arg_types{$type};
- my $annotate = "";
- $rettype = &libtype($retarg, 1);
- chop $rettype unless $rettype =~ /\*$/;
+ push @{$out->{protos}}, "GIMP_DEPRECATED_FOR($underscores)\n";
+ }
+ }
- $retarg->{retval} = 1;
+ # Add an underscore for deprecated API. If the original was already
+ # private, this will be 2 underscores.
+ if ($api_deprecated) {
+ $wrapped .= '_';
+ }
- if (exists $argtype->{array}) {
- $annotate = " (array length=$retarg->{array}->{name})";
- }
+ # Find the return argument (defaults to the first arg if not
+ # explicitly set
+ my $retarg = undef;
+ $retvoid = 0;
+ foreach (@outargs) {
+ $retarg = $_, last if exists $_->{retval};
+ }
- if (exists $argtype->{out_annotate}) {
- $annotate .= " $argtype->{out_annotate}";
- }
+ unless ($retarg) {
+ if (scalar @outargs) {
+ if (exists $outargs[0]->{void_ret}) {
+ $retvoid = 1;
+ }
+ else {
+ $retarg = exists $outargs[0]->{num} ? $outargs[1]
+ : $outargs[0];
+ }
+ }
+ }
- if ($annotate eq "") {
- $retdesc .= " $retarg->{desc}";
- }
- else {
- if (exists $retarg->{desc}) {
- if ((length ($annotate) +
- length ($retarg->{desc})) > 65) {
- $retdesc .= $annotate . ":\n * " . $retarg->{desc};
- }
- else {
- $retdesc .= $annotate . ": " . $retarg->{desc};
- }
- }
- }
+ my $rettype;
+ if ($retarg) {
+ my ($type) = &arg_parse($retarg->{type});
+ my $argtype = $arg_types{$type};
+ my $annotate = "";
+ $rettype = &libtype($retarg, 1, $api_deprecated);
+ chop $rettype unless $rettype =~ /\*$/;
- unless ($retdesc =~ /[\.\!\?]$/) { $retdesc .= '.' }
+ $retarg->{retval} = 1;
- if ($retarg->{type} eq 'string') {
- $retdesc .= "\n * The returned value must be freed with g_free().";
- }
- elsif ($retarg->{type} eq 'stringarray') {
- $retdesc .= "\n * The returned value must be freed with g_strfreev().";
- }
- elsif ($retarg->{type} eq 'param') {
- $retdesc .= "\n * The returned value must be freed with g_param_spec_unref().";
- }
- elsif (exists $argtype->{array}) {
- $retdesc .= "\n * The returned value must be freed with g_free().";
- }
- }
- else {
- # No return values
- $rettype = 'void';
- }
+ if (exists $argtype->{array}) {
+ $annotate = " (array length=$retarg->{array}->{name})";
+ }
- # The parameters to the function
- my $arglist = "";
- my $argdesc = "";
- my $sincedesc = "";
- my $value_array = "";
- my $arg_array = "";
- my $argc = 0;
- foreach (@inargs) {
- my ($type, @typeinfo) = &arg_parse($_->{type});
- my $arg = $arg_types{$type};
- my $var = $_->{name};
- my $desc = exists $_->{desc} ? $_->{desc} : "";
- my $var_len;
- my $value;
-
- $var .= '_ID' if $arg->{id};
-
- # This gets passed to gimp_value_array_new_with_types()
- if ($type eq 'enum') {
- $enum_type = $typeinfo[0];
- $enum_type =~ s/([a-z])([A-Z])/$1_$2/g;
- $enum_type =~ s/([A-Z]+)([A-Z])/$1_$2/g;
- $enum_type =~ tr/[a-z]/[A-Z]/;
- $enum_type =~ s/^GIMP/GIMP_TYPE/;
- $enum_type =~ s/^GEGL/GEGL_TYPE/;
-
- $value_array .= "$enum_type, ";
- }
- else {
- $value_array .= "$arg->{gtype}, ";
- }
+ if ($api_deprecated) {
+ if (exists $argtype->{out_annotate_d}) {
+ $annotate .= " $argtype->{out_annotate_d}";
+ }
+ }
+ elsif (exists $argtype->{out_annotate}) {
+ $annotate .= " $argtype->{out_annotate}";
+ }
- if (exists $_->{array}) {
- $value_array .= "NULL";
- }
- elsif (exists $arg->{convert_func}) {
- $value_array .= eval qq/"$arg->{convert_func}"/;
+ if ($annotate eq "") {
+ $retdesc .= " $retarg->{desc}";
+ }
+ else {
+ if (exists $retarg->{desc}) {
+ if ((length ($annotate) +
+ length ($retarg->{desc})) > 65) {
+ $retdesc .= $annotate . ":\n * " . $retarg->{desc};
+ }
+ else {
+ $retdesc .= $annotate . ": " . $retarg->{desc};
+ }
}
- else {
- $value_array .= "$var";
- }
+ }
- $value_array .= ",\n" . " " x 42;
+ unless ($retdesc =~ /[\.\!\?]$/) { $retdesc .= '.' }
- if (exists $_->{array}) {
- my $arrayarg = $_->{array};
+ if ($retarg->{type} eq 'string') {
+ $retdesc .= "\n * The returned value must be freed with g_free().";
+ }
+ elsif ($retarg->{type} eq 'stringarray') {
+ $retdesc .= "\n * The returned value must be freed with g_strfreev().";
+ }
+ elsif ($retarg->{type} eq 'param') {
+ $retdesc .= "\n * The returned value must be freed with g_param_spec_unref().";
+ }
+ elsif (exists $argtype->{array}) {
+ $retdesc .= "\n * The returned value must be freed with g_free().";
+ }
+ }
+ else {
+ # No return values
+ $rettype = 'void';
+ }
- $value = "gimp_value_array_index (args, $argc)";
+ # The parameters to the function
+ my $arglist = "";
+ my $argdesc = "";
+ my $sincedesc = "";
+ my $value_array = "";
+ my $arg_array = "";
+ my $argc = 0;
+ foreach (@inargs) {
+ my ($type, @typeinfo) = &arg_parse($_->{type});
+ my $arg = $arg_types{$type};
+ my $var = $_->{name};
+ my $desc = exists $_->{desc} ? $_->{desc} : "";
+ my $var_len;
+ my $value;
+ my $is_id = ($arg->{id} || ($api_deprecated && $arg->{name} eq 'IMAGE'));
+
+ $var .= '_ID' if $is_id;
+
+ # This gets passed to gimp_value_array_new_with_types()
+ if ($type eq 'enum') {
+ $enum_type = $typeinfo[0];
+ $enum_type =~ s/([a-z])([A-Z])/$1_$2/g;
+ $enum_type =~ s/([A-Z]+)([A-Z])/$1_$2/g;
+ $enum_type =~ tr/[a-z]/[A-Z]/;
+ $enum_type =~ s/^GIMP/GIMP_TYPE/;
+ $enum_type =~ s/^GEGL/GEGL_TYPE/;
+
+ $value_array .= "$enum_type, ";
+ }
+ else {
+ $value_array .= "$arg->{gtype}, ";
+ }
- if (exists $arrayarg->{name}) {
- $var_len = $arrayarg->{name};
- }
- else {
- $var_len = 'num_' . $_->{name};
- }
+ if (exists $_->{array}) {
+ $value_array .= "NULL";
+ }
+ elsif (exists $arg->{convert_func} && ! $api_deprecated) {
+ $value_array .= eval qq/"$arg->{convert_func}"/;
+ }
+ else {
+ $value_array .= "$var";
+ }
- # This is the list of g_value_set_foo_array
- $arg_array .= eval qq/" $arg->{set_value_func};\n"/;
- }
+ $value_array .= ",\n" . " " x 42;
- $usednames{$_->{name}}++;
+ if (exists $_->{array}) {
+ my $arrayarg = $_->{array};
- $arglist .= &libtype($_, 0);
- $arglist .= $_->{name};
- $arglist .= '_ID' if $arg->{id};
- $arglist .= ', ';
+ $value = "gimp_value_array_index (args, $argc)";
- $argdesc .= " * \@$_->{name}";
- $argdesc .= '_ID' if $arg->{id};
- $argdesc .= ":";
+ if (exists $arrayarg->{name}) {
+ $var_len = $arrayarg->{name};
+ }
+ else {
+ $var_len = 'num_' . $_->{name};
+ }
- if (exists $arg->{array}) {
- $argdesc .= " (array length=@inargs[$argc - 1]->{name})";
- }
+ # This is the list of g_value_set_foo_array
+ $arg_array .= eval qq/" $arg->{set_value_func};\n"/;
+ }
- if (exists $arg->{in_annotate}) {
- $argdesc .= " $arg->{in_annotate}";
- }
+ $usednames{$_->{name}}++;
- if (exists $arg->{array} || exists $arg->{in_annotate}) {
- $argdesc .= ":";
- }
+ $arglist .= &libtype($_, 0, $api_deprecated);
+ $arglist .= $_->{name};
+ $arglist .= '_ID' if $is_id;
+ $arglist .= ', ';
- $argdesc .= " $desc";
+ $argdesc .= " * \@$_->{name}";
+ $argdesc .= '_ID' if $is_id;
+ $argdesc .= ":";
- unless ($argdesc =~ /[\.\!\?]$/) { $argdesc .= '.' }
- $argdesc .= "\n";
+ if (exists $arg->{array}) {
+ $argdesc .= " (array length=@inargs[$argc - 1]->{name})";
+ }
- $argc++;
- }
+ if (exists $arg->{in_annotate}) {
+ $argdesc .= " $arg->{in_annotate}";
+ }
- # This marshals the return value(s)
- my $return_args = "";
- my $return_marshal = "gimp_value_array_unref (return_vals);";
+ if (exists $arg->{array} || exists $arg->{in_annotate}) {
+ $argdesc .= ":";
+ }
- # return success/failure boolean if we don't have anything else
- if ($rettype eq 'void') {
- $return_args .= "\n" . ' ' x 2 . "gboolean success = TRUE;";
- $retdesc .= " TRUE on success.";
- }
+ $argdesc .= " $desc";
- # We only need to bother with this if we have to return a value
- if ($rettype ne 'void' || $retvoid) {
- my $once = 0;
- my $firstvar;
- my @initnums;
+ unless ($argdesc =~ /[\.\!\?]$/) { $argdesc .= '.' }
+ $argdesc .= "\n";
- foreach (@outargs) {
- my ($type) = &arg_parse($_->{type});
- my $arg = $arg_types{$type};
- my $var;
+ $argc++;
+ }
- $return_marshal = "" unless $once++;
+ # This marshals the return value(s)
+ my $return_args = "";
+ my $return_marshal = "gimp_value_array_unref (return_vals);";
- $_->{libname} = exists $usednames{$_->{name}} ? "ret_$_->{name}"
- : $_->{name};
+ # return success/failure boolean if we don't have anything else
+ if ($rettype eq 'void') {
+ $return_args .= "\n" . ' ' x 2 . "gboolean success = TRUE;";
+ $retdesc .= " TRUE on success.";
+ }
- if (exists $_->{num}) {
- if (!exists $_->{no_lib}) {
- push @initnums, $_;
- }
- }
- elsif (exists $_->{retval}) {
- $return_args .= "\n" . ' ' x 2;
- $return_args .= &libtype($_, 1);
+ # We only need to bother with this if we have to return a value
+ if ($rettype ne 'void' || $retvoid) {
+ my $once = 0;
+ my $firstvar;
+ my @initnums;
- # The return value variable
- $var = $_->{libname};
- $var .= '_ID' if $arg->{id};
- $return_args .= $var;
+ foreach (@outargs) {
+ my ($type) = &arg_parse($_->{type});
+ my $arg = $arg_types{$type};
+ my $var;
+ my $is_id = ($arg->{id} || ($api_deprecated && $arg->{name} eq 'IMAGE'));
- # Save the first var to "return" it
- $firstvar = $var unless defined $firstvar;
+ $return_marshal = "" unless $once++;
- if ($arg->{id}) {
- # Initialize all IDs to -1
- $return_args .= " = -1";
- }
- elsif ($_->{libdef}) {
- $return_args .= " = $_->{libdef}";
- }
- else {
- $return_args .= " = $arg->{init_value}";
- }
-
- $return_args .= ";";
+ $_->{libname} = exists $usednames{$_->{name}} ? "ret_$_->{name}"
+ : $_->{name};
- if (exists $_->{array} && exists $_->{array}->{no_lib}) {
- $return_args .= "\n" . ' ' x 2 . "gint num_$var;";
- }
- }
- elsif ($retvoid) {
- push @initnums, $_ unless exists $arg->{struct};
- }
- }
+ if (exists $_->{num}) {
+ if (!exists $_->{no_lib}) {
+ push @initnums, $_;
+ }
+ }
+ elsif (exists $_->{retval}) {
+ $return_args .= "\n" . ' ' x 2;
+ $return_args .= &libtype($_, 1, $api_deprecated);
+
+ # The return value variable
+ $var = $_->{libname};
+ $var .= '_ID' if $is_id;
+ $return_args .= $var;
+
+ # Save the first var to "return" it
+ $firstvar = $var unless defined $firstvar;
+
+ if ($is_id) {
+ # Initialize all IDs to -1
+ $return_args .= " = -1";
+ }
+ elsif ($_->{libdef}) {
+ $return_args .= " = $_->{libdef}";
+ }
+ else {
+ $return_args .= " = $arg->{init_value}";
+ }
+
+ $return_args .= ";";
+
+ if (exists $_->{array} && exists $_->{array}->{no_lib}) {
+ $return_args .= "\n" . ' ' x 2 . "gint num_$var;";
+ }
+ }
+ elsif ($retvoid) {
+ push @initnums, $_ unless exists $arg->{struct};
+ }
+ }
- if (scalar(@initnums)) {
- foreach (@initnums) {
- $return_marshal .= "\*$_->{libname} = ";
- my ($type) = &arg_parse($_->{type});
- for ($arg_types{$type}->{type}) {
- /\*$/ && do { $return_marshal .= "NULL"; last };
- /boolean/ && do { $return_marshal .= "FALSE"; last };
- /double/ && do { $return_marshal .= "0.0"; last };
- $return_marshal .= "0";
- }
- $return_marshal .= ";\n ";
- }
- $return_marshal =~ s/\n $/\n\n /s;
- }
+ if (scalar(@initnums)) {
+ foreach (@initnums) {
+ $return_marshal .= "\*$_->{libname} = ";
+ my ($type) = &arg_parse($_->{type});
+ for ($arg_types{$type}->{type}) {
+ /\*$/ && do { $return_marshal .= "NULL"; last };
+ /boolean/ && do { $return_marshal .= "FALSE"; last };
+ /double/ && do { $return_marshal .= "0.0"; last };
+ $return_marshal .= "0";
+ }
+ $return_marshal .= ";\n ";
+ }
+ $return_marshal =~ s/\n $/\n\n /s;
+ }
- if ($rettype eq 'void') {
- $return_marshal .= <<CODE;
+ if ($rettype eq 'void') {
+ $return_marshal .= <<CODE;
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
if (success)
CODE
- }
- else {
- $return_marshal .= <<CODE;
+ }
+ else {
+ $return_marshal .= <<CODE;
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
CODE
- }
-
- $return_marshal .= ' ' x 4 . "{\n" if $#outargs;
-
- my $argc = 1; my ($numpos, $numtype);
- foreach (@outargs) {
- my ($type) = &arg_parse($_->{type});
- my $desc = exists $_->{desc} ? $_->{desc} : "";
- my $arg = $arg_types{$type};
- my $var;
-
- # The return value variable
- $var = "";
-
- unless (exists $_->{retval}) {
- $var .= '*';
- $arglist .= &libtype($_, 1);
- $arglist .= '*' unless exists $arg->{struct};
- $arglist .= "$_->{libname}";
- $arglist .= '_ID' if $arg->{id};
- $arglist .= ', ';
-
- $argdesc .= " * \@$_->{libname}";
- $argdesc .= '_ID' if $arg->{id};
-
- if ($arg->{name} eq 'COLOR') {
- $argdesc .= ": (out caller-allocates)";
- }
- else {
- $argdesc .= ": (out)";
- }
-
- if (exists $arg->{array}) {
- $argdesc .= " (array length=@outargs[$argc - 2]->{name})";
- }
+ }
- if (exists $arg->{out_annotate}) {
- $argdesc .= " $arg->{out_annotate}";
- }
+ $return_marshal .= ' ' x 4 . "{\n" if $#outargs;
+
+ my $argc = 1; my ($numpos, $numtype);
+ foreach (@outargs) {
+ 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 $var;
+
+ # The return value variable
+ $var = "";
+
+ unless (exists $_->{retval}) {
+ $var .= '*';
+ $arglist .= &libtype($_, 1);
+ $arglist .= '*' unless exists $arg->{struct};
+ $arglist .= "$_->{libname}";
+ $arglist .= '_ID' if $is_id;
+ $arglist .= ', ';
+
+ $argdesc .= " * \@$_->{libname}";
+ $argdesc .= '_ID' if $is_id;
+
+ if ($arg->{name} eq 'COLOR') {
+ $argdesc .= ": (out caller-allocates)";
+ }
+ else {
+ $argdesc .= ": (out)";
+ }
+
+ if (exists $arg->{array}) {
+ $argdesc .= " (array length=@outargs[$argc - 2]->{name})";
+ }
+
+ if ($api_deprecated) {
+ if (exists $arg->{out_annotate_d}) {
+ $argdesc .= " $arg->{out_annotate_d}";
+ }
+ }
+ elsif (exists $arg->{out_annotate}) {
+ $argdesc .= " $arg->{out_annotate}";
+ }
- $argdesc .= ": $desc";
- }
+ $argdesc .= ": $desc";
+ }
- $var = exists $_->{retval} ? "" : '*';
- $var .= $_->{libname};
- $var .= '_ID' if $arg->{id};
+ $var = exists $_->{retval} ? "" : '*';
+ $var .= $_->{libname};
+ $var .= '_ID' if $is_id;
- $value = "gimp_value_array_index (return_vals, $argc)";
+ $value = "gimp_value_array_index (return_vals, $argc)";
- $return_marshal .= ' ' x 2 if $#outargs;
- $return_marshal .= eval qq/" $arg->{dup_value_func};\n"/;
+ $return_marshal .= ' ' x 2 if $#outargs;
+ if ($api_deprecated && $arg->{dup_value_func_d}) {
+ $return_marshal .= eval qq/" $arg->{dup_value_func_d};\n"/;
+ }
+ else {
+ $return_marshal .= eval qq/" $arg->{dup_value_func};\n"/;
+ }
- if ($argdesc) {
- unless ($argdesc =~ /[\.\!\?]$/) { $argdesc .= '.' }
- unless ($argdesc =~ /\n$/) { $argdesc .= "\n" }
- }
+ if ($argdesc) {
+ unless ($argdesc =~ /[\.\!\?]$/) { $argdesc .= '.' }
+ unless ($argdesc =~ /\n$/) { $argdesc .= "\n" }
+ }
- $argc++;
- }
+ $argc++;
+ }
- $return_marshal .= ' ' x 4 . "}\n" if $#outargs;
+ $return_marshal .= ' ' x 4 . "}\n" if $#outargs;
- $return_marshal .= <<'CODE';
+ $return_marshal .= <<'CODE';
gimp_value_array_unref (return_vals);
CODE
- unless ($retvoid) {
- $return_marshal .= ' ' x 2 . "return $firstvar;";
- }
- else {
- $return_marshal .= ' ' x 2 . "return success;";
- }
- }
- else {
- $return_marshal = <<CODE;
+ unless ($retvoid) {
+ $return_marshal .= ' ' x 2 . "return $firstvar;";
+ }
+ else {
+ $return_marshal .= ' ' x 2 . "return success;";
+ }
+ }
+ else {
+ $return_marshal = <<CODE;
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
$return_marshal
@@ -445,94 +473,93 @@ success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB
return success;
CODE
- chop $return_marshal;
- }
+ chop $return_marshal;
+ }
- if ($arglist) {
- my @arglist = split(/, /, $arglist);
- my $longest = 0; my $seen = 0;
- foreach (@arglist) {
- /(const \w+) \S+/ || /(\w+) \S+/;
- my $len = length($1);
- my $num = scalar @{[ /\*/g ]};
- $seen = $num if $seen < $num;
- $longest = $len if $longest < $len;
- }
+ if ($arglist) {
+ my @arglist = split(/, /, $arglist);
+ my $longest = 0; my $seen = 0;
+ foreach (@arglist) {
+ /(const \w+) \S+/ || /(\w+) \S+/;
+ my $len = length($1);
+ my $num = scalar @{[ /\*/g ]};
+ $seen = $num if $seen < $num;
+ $longest = $len if $longest < $len;
+ }
- $longest += $seen;
-
- my $once = 0; $arglist = "";
- foreach (@arglist) {
- my $space = rindex($_, ' ');
- my $len = $longest - $space + 1;
- $len -= scalar @{[ /\*/g ]};
- substr($_, $space, 1) = ' ' x $len if $space != -1 && $len > 1;
- $arglist .= "\t" if $once;
- $arglist .= $_;
- $arglist .= ",\n";
- $once++;
- }
- $arglist =~ s/,\n$//;
- }
- else {
- $arglist = "void";
- }
-
- $rettype = 'gboolean' if $rettype eq 'void';
+ $longest += $seen;
+
+ my $once = 0; $arglist = "";
+ foreach (@arglist) {
+ my $space = rindex($_, ' ');
+ my $len = $longest - $space + 1;
+ $len -= scalar @{[ /\*/g ]};
+ substr($_, $space, 1) = ' ' x $len if $space != -1 && $len > 1;
+ $arglist .= "\t" if $once;
+ $arglist .= $_;
+ $arglist .= ",\n";
+ $once++;
+ }
+ $arglist =~ s/,\n$//;
+ }
+ else {
+ $arglist = "void";
+ }
- # Our function prototype for the headers
- (my $hrettype = $rettype) =~ s/ //g;
+ $rettype = 'gboolean' if $rettype eq 'void';
- my $proto = "$hrettype $wrapped$funcname ($arglist);\n";
- $proto =~ s/ +/ /g;
+ # Our function prototype for the headers
+ (my $hrettype = $rettype) =~ s/ //g;
- push @{$out->{protos}}, $proto;
+ my $proto = "$hrettype $wrapped$funcname ($arglist);\n";
+ $proto =~ s/ +/ /g;
- my $clist = $arglist;
- my $padlen = length($wrapped) + length($funcname) + 2;
- my $padding = ' ' x $padlen;
- $clist =~ s/\t/$padding/eg;
+ push @{$out->{protos}}, $proto;
- if ($proc->{since}) {
- $sincedesc = "\n *\n * Since: $proc->{since}";
- }
+ my $clist = $arglist;
+ my $padlen = length($wrapped) + length($funcname) + 2;
+ my $padding = ' ' x $padlen;
+ $clist =~ s/\t/$padding/eg;
- my $procdesc = '';
+ if ($proc->{since}) {
+ $sincedesc = "\n *\n * Since: $proc->{since}";
+ }
- if ($proc->{deprecated}) {
- if ($proc->{deprecated} eq 'NONE') {
- if ($proc->{blurb}) {
- $procdesc = &desc_wrap($proc->{blurb}) . "\n *\n";
- }
- if ($proc->{help}) {
- $procdesc .= &desc_wrap($proc->{help}) . "\n *\n";
- }
- $procdesc .= &desc_wrap("Deprecated: There is no replacement " .
- "for this procedure.");
- }
- else {
- my $underscores = $proc->{deprecated};
- $underscores =~ s/-/_/g;
+ my $procdesc = '';
- if ($proc->{blurb}) {
- $procdesc = &desc_wrap($proc->{blurb}) . "\n *\n";
- }
- if ($proc->{help}) {
- $procdesc .= &desc_wrap($proc->{help}) . "\n *\n";
- }
- $procdesc .= &desc_wrap("Deprecated: " .
- "Use $underscores() instead.");
- }
- }
- else {
- $procdesc = &desc_wrap($proc->{blurb}) . "\n *\n" .
- &desc_wrap($proc->{help});
- }
+ if ($proc->{deprecated}) {
+ if ($proc->{deprecated} eq 'NONE') {
+ if ($proc->{blurb}) {
+ $procdesc = &desc_wrap($proc->{blurb}) . "\n *\n";
+ }
+ if ($proc->{help}) {
+ $procdesc .= &desc_wrap($proc->{help}) . "\n *\n";
+ }
+ $procdesc .= &desc_wrap("Deprecated: There is no replacement " .
+ "for this procedure.");
+ }
+ else {
+ my $underscores = $proc->{deprecated};
+ $underscores =~ s/-/_/g;
- $out->{code} .= <<CODE;
+ if ($proc->{blurb}) {
+ $procdesc = &desc_wrap($proc->{blurb}) . "\n *\n";
+ }
+ if ($proc->{help}) {
+ $procdesc .= &desc_wrap($proc->{help}) . "\n *\n";
+ }
+ $procdesc .= &desc_wrap("Deprecated: " .
+ "Use $underscores() instead.");
+ }
+ }
+ else {
+ $procdesc = &desc_wrap($proc->{blurb}) . "\n *\n" .
+ &desc_wrap($proc->{help});
+ }
+ return <<CODE;
/**
- * $wrapped$funcname:
+ * $wrapped$funcname:$func_annotations
$argdesc *
$procdesc
*
@@ -560,6 +587,43 @@ $arg_array
$return_marshal
}
CODE
+}
+
+sub generate {
+ my @procs = @{(shift)};
+ my %out;
+
+ foreach $name (@procs) {
+ my $proc = $main::pdb{$name};
+ my $out = \%{$out{$proc->{group}}};
+
+ my @inargs = @{$proc->{inargs}} if (defined $proc->{inargs});
+ my @outargs = @{$proc->{outargs}} if (defined $proc->{outargs});
+
+ # Check if any of the argument or returned value is an image.
+ $has_image_arg = 0;
+ foreach (@outargs) {
+ my ($type, @typeinfo) = &arg_parse($_->{type});
+ my $arg = $arg_types{$type};
+ if ($arg->{name} eq 'IMAGE') {
+ $has_image_arg = 1;
+ last;
+ }
+ }
+ unless ($has_image_arg) {
+ foreach (@inargs) {
+ my ($type, @typeinfo) = &arg_parse($_->{type});
+ my $arg = $arg_types{$type};
+ if ($arg->{name} eq 'IMAGE') {
+ $has_image_arg = 1;
+ last;
+ }
+ }
+ }
+ $out->{code} .= generate_fun($proc, $out, 0);
+ if ($has_image_arg) {
+ $out->{code} .= generate_fun($proc, $out, 1);
+ }
}
my $lgpl_top = <<'LGPL';
diff --git a/pdb/pdb.pl b/pdb/pdb.pl
index 03fcfeb84c..409ddee7c7 100644
--- a/pdb/pdb.pl
+++ b/pdb/pdb.pl
@@ -166,7 +166,8 @@ package Gimp::CodeGen::pdb;
init_value => 'NULL',
out_annotate => '(transfer full)',
get_value_func => '$var = gimp_value_get_image ($value, gimp)',
- dup_value_func => '$var = gimp_image_new_by_id (g_value_get_int ($value))',
+ dup_value_func => '$var = gimp_image_new_by_id (gimp_value_get_image_id ($value))',
+ dup_value_func_d=> '$var = gimp_value_get_image_id ($value)',
set_value_func => 'gimp_value_set_image_id ($value, gimp_image_get_id ($var))',
take_value_func => 'gimp_value_set_image ($value, $var)',
convert_func => 'gimp_image_get_id ($var)',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]