[gimp] libgimp: deprecate gimp_image_attach_new_parasite()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimp: deprecate gimp_image_attach_new_parasite()
- Date: Fri, 9 Jul 2010 12:16:34 +0000 (UTC)
commit 611877783c8a068cf354e9e40351be0caea8bf72
Author: Michael Natterer <mitch gimp org>
Date: Fri Jul 9 14:15:55 2010 +0200
libgimp: deprecate gimp_image_attach_new_parasite()
and port all its users to gimp_image_parasite_attach().
libgimp/gimpimage.c | 70 +++++++++++++++++++++--------------------
libgimp/gimpimage.h | 15 ++++-----
plug-ins/common/decompose.c | 9 +++--
plug-ins/common/file-gbr.c | 21 ++++++++----
plug-ins/common/file-pat.c | 21 ++++++++----
plug-ins/print/print-utils.c | 12 +++++--
6 files changed, 85 insertions(+), 63 deletions(-)
---
diff --git a/libgimp/gimpimage.c b/libgimp/gimpimage.c
index 9a657f1..af639b5 100644
--- a/libgimp/gimpimage.c
+++ b/libgimp/gimpimage.c
@@ -26,40 +26,6 @@
#include "gimpimage.h"
/**
- * gimp_image_get_cmap:
- * @image_ID: The image.
- * @num_colors: Number of colors in the colormap array.
- *
- * This procedure is deprecated! Use gimp_image_get_colormap() instead.
- *
- * Returns: The image's colormap.
- */
-guchar *
-gimp_image_get_cmap (gint32 image_ID,
- gint *num_colors)
-{
- return gimp_image_get_colormap (image_ID, num_colors);
-}
-
-/**
- * gimp_image_set_cmap:
- * @image_ID: The image.
- * @cmap: The new colormap values.
- * @num_colors: Number of colors in the colormap array.
- *
- * This procedure is deprecated! Use gimp_image_set_colormap() instead.
- *
- * Returns: TRUE on success.
- */
-gboolean
-gimp_image_set_cmap (gint32 image_ID,
- const guchar *cmap,
- gint num_colors)
-{
- return gimp_image_set_colormap (image_ID, cmap, num_colors);
-}
-
-/**
* gimp_image_get_colormap:
* @image_ID: The image.
* @num_colors: Returns the number of colors in the colormap array.
@@ -137,6 +103,40 @@ gimp_image_get_thumbnail_data (gint32 image_ID,
}
/**
+ * gimp_image_get_cmap:
+ * @image_ID: The image.
+ * @num_colors: Number of colors in the colormap array.
+ *
+ * This procedure is deprecated! Use gimp_image_get_colormap() instead.
+ *
+ * Returns: The image's colormap.
+ */
+guchar *
+gimp_image_get_cmap (gint32 image_ID,
+ gint *num_colors)
+{
+ return gimp_image_get_colormap (image_ID, num_colors);
+}
+
+/**
+ * gimp_image_set_cmap:
+ * @image_ID: The image.
+ * @cmap: The new colormap values.
+ * @num_colors: Number of colors in the colormap array.
+ *
+ * This procedure is deprecated! Use gimp_image_set_colormap() instead.
+ *
+ * Returns: TRUE on success.
+ */
+gboolean
+gimp_image_set_cmap (gint32 image_ID,
+ const guchar *cmap,
+ gint num_colors)
+{
+ return gimp_image_set_colormap (image_ID, cmap, num_colors);
+}
+
+/**
* gimp_image_attach_new_parasite:
* @image_ID: the ID of the image to attach the #GimpParasite to.
* @name: the name of the #GimpParasite to create and attach.
@@ -147,6 +147,8 @@ gimp_image_get_thumbnail_data (gint32 image_ID,
* Convenience function that creates a parasite and attaches it
* to GIMP.
*
+ * Deprecated: Use gimp_image_parasite_attach() instead.
+ *
* Return value: TRUE on successful creation and attachment of
* the new parasite.
*
diff --git a/libgimp/gimpimage.h b/libgimp/gimpimage.h
index 16945e2..1aca262 100644
--- a/libgimp/gimpimage.h
+++ b/libgimp/gimpimage.h
@@ -26,14 +26,6 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
-#ifndef GIMP_DISABLE_DEPRECATED
-guchar * gimp_image_get_cmap (gint32 image_ID,
- gint *num_colors);
-gboolean gimp_image_set_cmap (gint32 image_ID,
- const guchar *cmap,
- gint num_colors);
-#endif /* GIMP_DISABLE_DEPRECATED */
-
guchar * gimp_image_get_colormap (gint32 image_ID,
gint *num_colors);
gboolean gimp_image_set_colormap (gint32 image_ID,
@@ -45,11 +37,18 @@ guchar * gimp_image_get_thumbnail_data (gint32 image_ID,
gint *height,
gint *bpp);
+#ifndef GIMP_DISABLE_DEPRECATED
+guchar * gimp_image_get_cmap (gint32 image_ID,
+ gint *num_colors);
+gboolean gimp_image_set_cmap (gint32 image_ID,
+ const guchar *cmap,
+ gint num_colors);
gboolean gimp_image_attach_new_parasite (gint32 image_ID,
const gchar *name,
gint flags,
gint size,
gconstpointer data);
+#endif /* GIMP_DISABLE_DEPRECATED */
G_END_DECLS
diff --git a/plug-ins/common/decompose.c b/plug-ins/common/decompose.c
index d304b0a..60b933e 100644
--- a/plug-ins/common/decompose.c
+++ b/plug-ins/common/decompose.c
@@ -450,14 +450,17 @@ run (const gchar *name,
for (j = 0; j < num_images; j++)
{
+ GimpParasite *parasite;
+
values[j+1].data.d_int32 = image_ID_extract[j];
gimp_image_undo_enable (image_ID_extract[j]);
gimp_image_clean_all (image_ID_extract[j]);
- gimp_image_attach_new_parasite (image_ID_extract[j],
- "decompose-data",
- 0, data->len + 1, data->str);
+ parasite = gimp_parasite_new ("decompose-data",
+ 0, data->len + 1, data->str);
+ gimp_image_parasite_attach (image_ID_extract[j], parasite);
+ gimp_parasite_free (parasite);
if (run_mode != GIMP_RUN_NONINTERACTIVE)
gimp_display_new (image_ID_extract[j]);
diff --git a/plug-ins/common/file-gbr.c b/plug-ins/common/file-gbr.c
index 4e80090..673722e 100644
--- a/plug-ins/common/file-gbr.c
+++ b/plug-ins/common/file-gbr.c
@@ -310,10 +310,14 @@ run (const gchar *name,
if (info.description && strlen (info.description))
{
- gimp_image_attach_new_parasite (orig_image_ID, "gimp-brush-name",
- GIMP_PARASITE_PERSISTENT,
- strlen (info.description) + 1,
- info.description);
+ GimpParasite *parasite;
+
+ parasite = gimp_parasite_new ("gimp-brush-name",
+ GIMP_PARASITE_PERSISTENT,
+ strlen (info.description) + 1,
+ info.description);
+ gimp_image_parasite_attach (orig_image_ID, parasite);
+ gimp_parasite_free (parasite);
}
else
{
@@ -345,6 +349,7 @@ load_image (const gchar *filename,
guchar *brush_buf = NULL;
gint32 image_ID;
gint32 layer_ID;
+ GimpParasite *parasite;
GimpDrawable *drawable;
GimpPixelRgn pixel_rgn;
gint bn_size;
@@ -577,9 +582,11 @@ load_image (const gchar *filename,
image_ID = gimp_image_new (bh.width, bh.height, base_type);
gimp_image_set_filename (image_ID, filename);
- gimp_image_attach_new_parasite (image_ID, "gimp-brush-name",
- GIMP_PARASITE_PERSISTENT,
- strlen (name) + 1, name);
+ parasite = gimp_parasite_new ("gimp-brush-name",
+ GIMP_PARASITE_PERSISTENT,
+ strlen (name) + 1, name);
+ gimp_image_parasite_attach (image_ID, parasite);
+ gimp_parasite_free (parasite);
layer_ID = gimp_layer_new (image_ID, name, bh.width, bh.height,
image_type, 100, GIMP_NORMAL_MODE);
diff --git a/plug-ins/common/file-pat.c b/plug-ins/common/file-pat.c
index a506449..617aeaf 100644
--- a/plug-ins/common/file-pat.c
+++ b/plug-ins/common/file-pat.c
@@ -279,10 +279,14 @@ run (const gchar *name,
if (strlen (description))
{
- gimp_image_attach_new_parasite (orig_image_ID, "gimp-pattern-name",
- GIMP_PARASITE_PERSISTENT,
- strlen (description) + 1,
- description);
+ GimpParasite *parasite;
+
+ parasite = gimp_parasite_new ("gimp-pattern-name",
+ GIMP_PARASITE_PERSISTENT,
+ strlen (description) + 1,
+ description);
+ gimp_image_parasite_attach (orig_image_ID, parasite);
+ gimp_parasite_free (parasite);
}
else
{
@@ -315,6 +319,7 @@ load_image (const gchar *filename,
guchar *buffer;
gint32 image_ID;
gint32 layer_ID;
+ GimpParasite *parasite;
GimpDrawable *drawable;
gint line;
GimpPixelRgn pixel_rgn;
@@ -417,9 +422,11 @@ load_image (const gchar *filename,
image_ID = gimp_image_new (ph.width, ph.height, base_type);
gimp_image_set_filename (image_ID, filename);
- gimp_image_attach_new_parasite (image_ID, "gimp-pattern-name",
- GIMP_PARASITE_PERSISTENT,
- strlen (name) + 1, name);
+ parasite = gimp_parasite_new ("gimp-pattern-name",
+ GIMP_PARASITE_PERSISTENT,
+ strlen (name) + 1, name);
+ gimp_image_parasite_attach (image_ID, parasite);
+ gimp_parasite_free (parasite);
layer_ID = gimp_layer_new (image_ID, name, ph.width, ph.height,
image_type, 100, GIMP_NORMAL_MODE);
diff --git a/plug-ins/print/print-utils.c b/plug-ins/print/print-utils.c
index 168ca4f..4f68d71 100644
--- a/plug-ins/print/print-utils.c
+++ b/plug-ins/print/print-utils.c
@@ -120,9 +120,10 @@ print_utils_key_file_save_as_parasite (GKeyFile *key_file,
gint32 image_ID,
const gchar *parasite_name)
{
- gchar *contents;
- gsize length;
- GError *error = NULL;
+ GimpParasite *parasite;
+ gchar *contents;
+ gsize length;
+ GError *error = NULL;
g_return_if_fail (parasite_name != NULL);
@@ -136,6 +137,9 @@ print_utils_key_file_save_as_parasite (GKeyFile *key_file,
return;
}
- gimp_image_attach_new_parasite (image_ID, parasite_name, 0, length, contents);
+ parasite = gimp_parasite_new (parasite_name, 0, length, contents);
g_free (contents);
+
+ gimp_image_parasite_attach (image_ID, parasite);
+ gimp_parasite_free (parasite);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]