Commit 87646e9a authored by Michael Natterer's avatar Michael Natterer 😴

libgimp: deprecate and rename the image parasite functions

in exactly the way the drawable functios were turned into item ones.
parent e69ecba2
......@@ -471,7 +471,11 @@ gimp_pdb_compat_procs_register (GimpPDB *pdb,
{ "gimp-vectors-parasite-find", "gimp-item-get-parasite" },
{ "gimp-vectors-parasite-attach", "gimp-item-attach-parasite" },
{ "gimp-vectors-parasite-detach", "gimp-item-detach-parasite" },
{ "gimp-vectors-parasite-list", "gimp-item-get-parasite-list" }
{ "gimp-vectors-parasite-list", "gimp-item-get-parasite-list" },
{ "gimp-image-parasite-find", "gimp-image-get-parasite" },
{ "gimp-image-parasite-attach", "gimp-image-attach-parasite" },
{ "gimp-image-parasite-detach", "gimp-image-detach-parasite" },
{ "gimp-image-parasite-list", "gimp-image-get-parasite-list" }
};
g_return_if_fail (GIMP_IS_PDB (pdb));
......
......@@ -2483,6 +2483,121 @@ image_get_vectors_by_tattoo_invoker (GimpProcedure *procedure,
return return_vals;
}
static GValueArray *
image_attach_parasite_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpImage *image;
const GimpParasite *parasite;
image = gimp_value_get_image (&args->values[0], gimp);
parasite = g_value_get_boxed (&args->values[1]);
if (success)
{
gimp_image_parasite_attach (image, parasite);
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GValueArray *
image_detach_parasite_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpImage *image;
const gchar *name;
image = gimp_value_get_image (&args->values[0], gimp);
name = g_value_get_string (&args->values[1]);
if (success)
{
gimp_image_parasite_detach (image, name);
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GValueArray *
image_get_parasite_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
GimpImage *image;
const gchar *name;
GimpParasite *parasite = NULL;
image = gimp_value_get_image (&args->values[0], gimp);
name = g_value_get_string (&args->values[1]);
if (success)
{
parasite = gimp_parasite_copy (gimp_image_parasite_find (image, name));
if (! parasite)
success = FALSE;
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_take_boxed (&return_vals->values[1], parasite);
return return_vals;
}
static GValueArray *
image_get_parasite_list_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
GimpImage *image;
gint32 num_parasites = 0;
gchar **parasites = NULL;
image = gimp_value_get_image (&args->values[0], gimp);
if (success)
{
parasites = gimp_image_parasite_list (image, &num_parasites);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
{
g_value_set_int (&return_vals->values[1], num_parasites);
gimp_value_take_stringarray (&return_vals->values[2], parasites, num_parasites);
}
return return_vals;
}
void
register_image_procs (GimpPDB *pdb)
{
......@@ -4959,4 +5074,131 @@ register_image_procs (GimpPDB *pdb)
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-image-attach-parasite
*/
procedure = gimp_procedure_new (image_attach_parasite_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-image-attach-parasite");
gimp_procedure_set_static_strings (procedure,
"gimp-image-attach-parasite",
"Add a parasite to an image.",
"This procedure attaches a parasite to an image. It has no return values.",
"Jay Cox",
"Jay Cox",
"1998",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"image",
"The image",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_parasite ("parasite",
"parasite",
"The parasite to attach to an image",
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-image-detach-parasite
*/
procedure = gimp_procedure_new (image_detach_parasite_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-image-detach-parasite");
gimp_procedure_set_static_strings (procedure,
"gimp-image-detach-parasite",
"Removes a parasite from an image.",
"This procedure detaches a parasite from an image. It has no return values.",
"Jay Cox",
"Jay Cox",
"1998",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"image",
"The image",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("name",
"name",
"The name of the parasite to detach from an image.",
FALSE, FALSE, FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-image-get-parasite
*/
procedure = gimp_procedure_new (image_get_parasite_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-image-get-parasite");
gimp_procedure_set_static_strings (procedure,
"gimp-image-get-parasite",
"Look up a parasite in an image",
"Finds and returns the parasite that was previously attached to an image.",
"Jay Cox",
"Jay Cox",
"1998",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"image",
"The image",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("name",
"name",
"The name of the parasite to find",
FALSE, FALSE, FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_parasite ("parasite",
"parasite",
"The found parasite",
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-image-get-parasite-list
*/
procedure = gimp_procedure_new (image_get_parasite_list_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-image-get-parasite-list");
gimp_procedure_set_static_strings (procedure,
"gimp-image-get-parasite-list",
"List all parasites.",
"Returns a list of all currently attached parasites.",
"Marc Lehmann",
"Marc Lehmann",
"1999",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"image",
"The image",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_int32 ("num-parasites",
"num parasites",
"The number of attached parasites",
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_string_array ("parasites",
"parasites",
"The names of currently attached parasites",
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
}
......@@ -26,7 +26,6 @@
#include "pdb-types.h"
#include "core/gimp-parasites.h"
#include "core/gimpimage.h"
#include "core/gimpparamspecs.h"
#include "gimppdb.h"
......@@ -132,121 +131,6 @@ parasite_list_invoker (GimpProcedure *procedure,
return return_vals;
}
static GValueArray *
image_parasite_find_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
GimpImage *image;
const gchar *name;
GimpParasite *parasite = NULL;
image = gimp_value_get_image (&args->values[0], gimp);
name = g_value_get_string (&args->values[1]);
if (success)
{
parasite = gimp_parasite_copy (gimp_image_parasite_find (image, name));
if (! parasite)
success = FALSE;
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
g_value_take_boxed (&return_vals->values[1], parasite);
return return_vals;
}
static GValueArray *
image_parasite_attach_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpImage *image;
const GimpParasite *parasite;
image = gimp_value_get_image (&args->values[0], gimp);
parasite = g_value_get_boxed (&args->values[1]);
if (success)
{
gimp_image_parasite_attach (image, parasite);
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GValueArray *
image_parasite_detach_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpImage *image;
const gchar *name;
image = gimp_value_get_image (&args->values[0], gimp);
name = g_value_get_string (&args->values[1]);
if (success)
{
gimp_image_parasite_detach (image, name);
}
return gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
}
static GValueArray *
image_parasite_list_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GValueArray *args,
GError **error)
{
gboolean success = TRUE;
GValueArray *return_vals;
GimpImage *image;
gint32 num_parasites = 0;
gchar **parasites = NULL;
image = gimp_value_get_image (&args->values[0], gimp);
if (success)
{
parasites = gimp_image_parasite_list (image, &num_parasites);
}
return_vals = gimp_procedure_get_return_values (procedure, success,
error ? *error : NULL);
if (success)
{
g_value_set_int (&return_vals->values[1], num_parasites);
gimp_value_take_stringarray (&return_vals->values[2], parasites, num_parasites);
}
return return_vals;
}
void
register_parasite_procs (GimpPDB *pdb)
{
......@@ -354,131 +238,4 @@ register_parasite_procs (GimpPDB *pdb)
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-image-parasite-find
*/
procedure = gimp_procedure_new (image_parasite_find_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-image-parasite-find");
gimp_procedure_set_static_strings (procedure,
"gimp-image-parasite-find",
"Look up a parasite in an image",
"Finds and returns the parasite that was previously attached to an image.",
"Jay Cox",
"Jay Cox",
"1998",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"image",
"The image",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("name",
"name",
"The name of the parasite to find",
FALSE, FALSE, FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_parasite ("parasite",
"parasite",
"The found parasite",
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-image-parasite-attach
*/
procedure = gimp_procedure_new (image_parasite_attach_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-image-parasite-attach");
gimp_procedure_set_static_strings (procedure,
"gimp-image-parasite-attach",
"Add a parasite to an image.",
"This procedure attaches a parasite to an image. It has no return values.",
"Jay Cox",
"Jay Cox",
"1998",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"image",
"The image",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_parasite ("parasite",
"parasite",
"The parasite to attach to an image",
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-image-parasite-detach
*/
procedure = gimp_procedure_new (image_parasite_detach_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-image-parasite-detach");
gimp_procedure_set_static_strings (procedure,
"gimp-image-parasite-detach",
"Removes a parasite from an image.",
"This procedure detaches a parasite from an image. It has no return values.",
"Jay Cox",
"Jay Cox",
"1998",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"image",
"The image",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_string ("name",
"name",
"The name of the parasite to detach from an image.",
FALSE, FALSE, FALSE,
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
/*
* gimp-image-parasite-list
*/
procedure = gimp_procedure_new (image_parasite_list_invoker);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-image-parasite-list");
gimp_procedure_set_static_strings (procedure,
"gimp-image-parasite-list",
"List all parasites.",
"Returns a list of all currently attached parasites.",
"Marc Lehmann",
"Marc Lehmann",
"1999",
NULL);
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"image",
"The image",
pdb->gimp, FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_int32 ("num-parasites",
"num parasites",
"The number of attached parasites",
0, G_MAXINT32, 0,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_string_array ("parasites",
"parasites",
"The names of currently attached parasites",
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
}
......@@ -323,6 +323,7 @@ EXPORTS
gimp_image_add_layer
gimp_image_add_vectors
gimp_image_add_vguide
gimp_image_attach_parasite
gimp_image_attach_new_parasite
gimp_image_base_type
gimp_image_clean_all
......@@ -333,6 +334,7 @@ EXPORTS
gimp_image_crop
gimp_image_delete
gimp_image_delete_guide
gimp_image_detach_parasite
gimp_image_duplicate
gimp_image_find_next_guide
gimp_image_flatten
......@@ -359,6 +361,8 @@ EXPORTS
gimp_image_get_layer_position
gimp_image_get_layers
gimp_image_get_name
gimp_image_get_parasite
gimp_image_get_parasite_list
gimp_image_get_resolution
gimp_image_get_selection
gimp_image_get_tattoo_state
......
......@@ -358,6 +358,74 @@ gimp_image_lower_vectors_to_bottom (gint32 image_ID,
return gimp_image_lower_item_to_bottom (image_ID, vectors_ID);
}
/**
* gimp_image_parasite_find:
* @image_ID: The image.
* @name: The name of the parasite to find.
*
* Deprecated: Use gimp_image_get_parasite() instead.
*
* Returns: The found parasite.
**/
GimpParasite *
gimp_image_parasite_find (gint32 image_ID,
const gchar *name)
{
return gimp_image_get_parasite (image_ID, name);
}
/**
* gimp_image_parasite_attach:
* @image_ID: The image.
* @parasite: The parasite to attach to an image.
*
* Deprecated: Use gimp_image_attach_parasite() instead.
*
* Returns: TRUE on success.
**/
gboolean
gimp_image_parasite_attach (gint32 image_ID,
const GimpParasite *parasite)
{
return gimp_image_attach_parasite (image_ID, parasite);
}
/**
* gimp_image_parasite_detach:
* @image_ID: The image.
* @name: The name of the parasite to detach from an image.
*
* Deprecated: Use gimp_image_detach_parasite() instead.
*
* Returns: TRUE on success.
**/
gboolean
gimp_image_parasite_detach (gint32 image_ID,
const gchar *name)
{
return gimp_image_detach_parasite (image_ID, name);
}
/**
* gimp_image_parasite_list:
* @image_ID: The image.
* @num_parasites: The number of attached parasites.
* @parasites: The names of currently attached parasites.
*
* Deprecated: Use gimp_image_get_parasite_list() instead.
*
* Returns: TRUE on success.
**/
gboolean
gimp_image_parasite_list (gint32 image_ID,
gint *num_parasites,
gchar ***parasites)
{
*parasites = gimp_image_get_parasite_list (image_ID, num_parasites);
return *parasites != NULL;
}
/**
* gimp_image_attach_new_parasite:
* @image_ID: the ID of the image to attach the #GimpParasite to.
......
......@@ -26,54 +26,63 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
guchar * gimp_image_get_colormap (gint32 image_ID,
gint *num_colors);
gboolean gimp_image_set_colormap (gint32 image_ID,
const guchar *colormap,
gint num_colors);
guchar * gimp_image_get_colormap (gint32 image_ID,
gint *num_colors);
gboolean gimp_image_set_colormap (gint32 image_ID,
const guchar *colormap,
gint num_colors);
guchar * gimp_image_get_thumbnail_data (gint32 image_ID,
gint *width,
gint *height,
gint *bpp);
guchar * gimp_image_get_thumbnail_data (gint32 image_ID,
gint *width,
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);
gint gimp_image_get_layer_position (gint32 image_ID,
gint32 layer_ID);
gboolean gimp_image_raise_layer (gint32 image_ID,
gint32 layer_ID);
gboolean gimp_image_lower_layer (gint32 image_ID,
gint32 layer_ID);
gboolean gimp_image_raise_layer_to_top (gint32 image_ID,
gint32 layer_ID);
gboolean gimp_image_lower_layer_to_bottom (gint32 image_ID,
gint32 layer_ID);
gint gimp_image_get_channel_position (gint32 image_ID,
gint32 channel_ID);
gboolean gimp_image_raise_channel (gint32 image_ID,
gint32 channel_ID);
gboolean gimp_image_lower_channel (gint32 image_ID,
gint32 channel_ID);
gint gimp_image_get_vectors_position (gint32 image_ID,
gint32 vectors_ID);
gboolean gimp_image_raise_vectors (gint32 image_ID,
gint32 vectors_ID);
gboolean gimp_image_lower_vectors (gint32 image_ID,
gint32 vectors_ID);
gboolean gimp_image_raise_vectors_to_top (gint32 image_ID,
gint32 vectors_ID);
gboolean gimp_image_lower_vectors_to_bottom (gint32 image_ID,
gint32 vectors_ID);
gboolean gimp_image_attach_new_parasite (gint32 image_ID,
const gchar *name,
gint flags,
gint size,
gconstpointer data);
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);
gint gimp_image_get_layer_position (gint32 image_ID,
gint32 layer_ID);
gboolean gimp_image_raise_layer (gint32 image_ID,
gint32 layer_ID);
gboolean gimp_image_lower_layer (gint32 image_ID,
gint32 layer_ID);
gboolean gimp_image_raise_layer_to_top (gint32 image_ID,
gint32 layer_ID);
gboolean gimp_image_lower_layer_to_bottom (gint32 image_ID,
gint32 layer_ID);
gint gimp_image_get_channel_position (gint32 image_ID,
gint32 channel_ID);
gboolean gimp_image_raise_channel (gint32 image_ID,
gint32 channel_ID);
gboolean gimp_image_lower_channel (gint32 image_ID,
gint32 channel_ID);
gint gimp_image_get_vectors_position (gint32 image_ID,
gint32 vectors_ID);
gboolean gimp_image_raise_vectors (gint32 image_ID,
gint32 vectors_ID);
gboolean gimp_image_lower_vectors (gint32 image_ID,
gint32 vectors_ID);
gboolean gimp_image_raise_vectors_to_top (gint32 image_ID,
gint32 vectors_ID);
gboolean gimp_image_lower_vectors_to_bottom (gint32 image_ID,
gint32 vectors_ID);
GimpParasite * gimp_image_parasite_find (gint32 image_ID,