libgimp: deprecate gimp_image_attach_new_parasite()

and port all its users to gimp_image_parasite_attach().
This commit is contained in:
Michael Natterer 2010-07-09 14:15:55 +02:00
parent c87025ead6
commit 611877783c
6 changed files with 85 additions and 63 deletions

View File

@ -25,40 +25,6 @@
#undef __GIMP_IMAGE_H__
#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.
@ -136,6 +102,40 @@ gimp_image_get_thumbnail_data (gint32 image_ID,
return image_data;
}
/**
* 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.
@ -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.
*

View File

@ -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

View File

@ -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]);

View File

@ -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);

View File

@ -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);

View File

@ -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);
}