Commit af5c587e authored by Michael Natterer's avatar Michael Natterer 😴

pdb, libgimp: port lib.pl to the new GType based libgimp API

All foo_pdb.c functions in libgimp regenerated. I have reviewed this a
dozen times, but please have a look, there might well be glitches and
our public API is sortof important...
parent a0ee939d
Pipeline #99935 failed with stages
in 2 minutes and 16 seconds
......@@ -47,18 +47,20 @@
gchar *
gimp_version (void)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
gchar *version = NULL;
return_vals = gimp_run_procedure ("gimp-version",
&nreturn_vals,
GIMP_PDB_END);
args = gimp_value_array_new_from_types (G_TYPE_NONE);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
version = g_strdup (return_vals[1].data.d_string);
return_vals = gimp_run_procedure_with_array ("gimp-version",
args);
gimp_value_array_unref (args);
gimp_destroy_params (return_vals, nreturn_vals);
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
version = g_value_dup_string (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);
return version;
}
......@@ -77,18 +79,20 @@ gimp_version (void)
gint
gimp_getpid (void)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
gint pid = 0;
return_vals = gimp_run_procedure ("gimp-getpid",
&nreturn_vals,
GIMP_PDB_END);
args = gimp_value_array_new_from_types (G_TYPE_NONE);
return_vals = gimp_run_procedure_with_array ("gimp-getpid",
args);
gimp_value_array_unref (args);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
pid = return_vals[1].data.d_int32;
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
pid = g_value_get_int (gimp_value_array_index (return_vals, 1));
gimp_destroy_params (return_vals, nreturn_vals);
gimp_value_array_unref (return_vals);
return pid;
}
......@@ -108,18 +112,21 @@ gimp_getpid (void)
gboolean
gimp_attach_parasite (const GimpParasite *parasite)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-attach-parasite",
&nreturn_vals,
GIMP_PDB_PARASITE, parasite,
GIMP_PDB_END);
args = gimp_value_array_new_from_types (GIMP_TYPE_PARASITE,
G_TYPE_NONE);
g_value_set_boxed (gimp_value_array_index (args, 0), parasite);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
return_vals = gimp_run_procedure_with_array ("gimp-attach-parasite",
args);
gimp_value_array_unref (args);
gimp_destroy_params (return_vals, nreturn_vals);
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
return success;
}
......@@ -140,18 +147,21 @@ gimp_attach_parasite (const GimpParasite *parasite)
gboolean
gimp_detach_parasite (const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-detach-parasite",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
args = gimp_value_array_new_from_types (G_TYPE_STRING,
G_TYPE_NONE);
g_value_set_string (gimp_value_array_index (args, 0), name);
return_vals = gimp_run_procedure_with_array ("gimp-detach-parasite",
args);
gimp_value_array_unref (args);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
gimp_value_array_unref (return_vals);
return success;
}
......@@ -171,19 +181,22 @@ gimp_detach_parasite (const gchar *name)
GimpParasite *
gimp_get_parasite (const gchar *name)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
GimpParasite *parasite = NULL;
return_vals = gimp_run_procedure ("gimp-get-parasite",
&nreturn_vals,
GIMP_PDB_STRING, name,
GIMP_PDB_END);
args = gimp_value_array_new_from_types (G_TYPE_STRING,
G_TYPE_NONE);
g_value_set_string (gimp_value_array_index (args, 0), name);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
parasite = gimp_parasite_copy (&return_vals[1].data.d_parasite);
return_vals = gimp_run_procedure_with_array ("gimp-get-parasite",
args);
gimp_value_array_unref (args);
gimp_destroy_params (return_vals, nreturn_vals);
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;
}
......@@ -204,29 +217,25 @@ gimp_get_parasite (const gchar *name)
gchar **
gimp_get_parasite_list (gint *num_parasites)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
gchar **parasites = NULL;
gint i;
return_vals = gimp_run_procedure ("gimp-get-parasite-list",
&nreturn_vals,
GIMP_PDB_END);
args = gimp_value_array_new_from_types (G_TYPE_NONE);
return_vals = gimp_run_procedure_with_array ("gimp-get-parasite-list",
args);
gimp_value_array_unref (args);
*num_parasites = 0;
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
{
*num_parasites = return_vals[1].data.d_int32;
if (*num_parasites > 0)
{
parasites = g_new0 (gchar *, *num_parasites + 1);
for (i = 0; i < *num_parasites; i++)
parasites[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
}
*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_destroy_params (return_vals, nreturn_vals);
gimp_value_array_unref (return_vals);
return parasites;
}
......@@ -245,19 +254,22 @@ gimp_get_parasite_list (gint *num_parasites)
gchar *
gimp_temp_name (const gchar *extension)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
gchar *name = NULL;
return_vals = gimp_run_procedure ("gimp-temp-name",
&nreturn_vals,
GIMP_PDB_STRING, extension,
GIMP_PDB_END);
args = gimp_value_array_new_from_types (G_TYPE_STRING,
G_TYPE_NONE);
g_value_set_string (gimp_value_array_index (args, 0), extension);
return_vals = gimp_run_procedure_with_array ("gimp-temp-name",
args);
gimp_value_array_unref (args);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
name = g_strdup (return_vals[1].data.d_string);
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_destroy_params (return_vals, nreturn_vals);
gimp_value_array_unref (return_vals);
return name;
}
This diff is collapsed.
......@@ -47,17 +47,19 @@
gboolean
gimp_brushes_refresh (void)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-brushes-refresh",
&nreturn_vals,
GIMP_PDB_END);
args = gimp_value_array_new_from_types (G_TYPE_NONE);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
return_vals = gimp_run_procedure_with_array ("gimp-brushes-refresh",
args);
gimp_value_array_unref (args);
gimp_destroy_params (return_vals, nreturn_vals);
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
return success;
}
......@@ -80,30 +82,27 @@ gchar **
gimp_brushes_get_list (const gchar *filter,
gint *num_brushes)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
gchar **brush_list = NULL;
gint i;
return_vals = gimp_run_procedure ("gimp-brushes-get-list",
&nreturn_vals,
GIMP_PDB_STRING, filter,
GIMP_PDB_END);
args = gimp_value_array_new_from_types (G_TYPE_STRING,
G_TYPE_NONE);
g_value_set_string (gimp_value_array_index (args, 0), filter);
return_vals = gimp_run_procedure_with_array ("gimp-brushes-get-list",
args);
gimp_value_array_unref (args);
*num_brushes = 0;
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
{
*num_brushes = return_vals[1].data.d_int32;
if (*num_brushes > 0)
{
brush_list = g_new0 (gchar *, *num_brushes + 1);
for (i = 0; i < *num_brushes; i++)
brush_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
}
*num_brushes = g_value_get_int (gimp_value_array_index (return_vals, 1));
brush_list = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
}
gimp_destroy_params (return_vals, nreturn_vals);
gimp_value_array_unref (return_vals);
return brush_list;
}
......@@ -57,23 +57,31 @@ gimp_brushes_popup (const gchar *brush_callback,
gint spacing,
GimpLayerMode paint_mode)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-brushes-popup",
&nreturn_vals,
GIMP_PDB_STRING, brush_callback,
GIMP_PDB_STRING, popup_title,
GIMP_PDB_STRING, initial_brush,
GIMP_PDB_FLOAT, opacity,
GIMP_PDB_INT32, spacing,
GIMP_PDB_INT32, paint_mode,
GIMP_PDB_END);
args = gimp_value_array_new_from_types (G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_DOUBLE,
GIMP_TYPE_INT32,
G_TYPE_ENUM,
G_TYPE_NONE);
g_value_set_string (gimp_value_array_index (args, 0), brush_callback);
g_value_set_string (gimp_value_array_index (args, 1), popup_title);
g_value_set_string (gimp_value_array_index (args, 2), initial_brush);
g_value_set_double (gimp_value_array_index (args, 3), opacity);
g_value_set_int (gimp_value_array_index (args, 4), spacing);
g_value_set_enum (gimp_value_array_index (args, 5), paint_mode);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
return_vals = gimp_run_procedure_with_array ("gimp-brushes-popup",
args);
gimp_value_array_unref (args);
gimp_destroy_params (return_vals, nreturn_vals);
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
return success;
}
......@@ -91,18 +99,21 @@ gimp_brushes_popup (const gchar *brush_callback,
gboolean
gimp_brushes_close_popup (const gchar *brush_callback)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-brushes-close-popup",
&nreturn_vals,
GIMP_PDB_STRING, brush_callback,
GIMP_PDB_END);
args = gimp_value_array_new_from_types (G_TYPE_STRING,
G_TYPE_NONE);
g_value_set_string (gimp_value_array_index (args, 0), brush_callback);
return_vals = gimp_run_procedure_with_array ("gimp-brushes-close-popup",
args);
gimp_value_array_unref (args);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
gimp_value_array_unref (return_vals);
return success;
}
......@@ -128,22 +139,29 @@ gimp_brushes_set_popup (const gchar *brush_callback,
gint spacing,
GimpLayerMode paint_mode)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-brushes-set-popup",
&nreturn_vals,
GIMP_PDB_STRING, brush_callback,
GIMP_PDB_STRING, brush_name,
GIMP_PDB_FLOAT, opacity,
GIMP_PDB_INT32, spacing,
GIMP_PDB_INT32, paint_mode,
GIMP_PDB_END);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
gimp_destroy_params (return_vals, nreturn_vals);
args = gimp_value_array_new_from_types (G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_DOUBLE,
GIMP_TYPE_INT32,
G_TYPE_ENUM,
G_TYPE_NONE);
g_value_set_string (gimp_value_array_index (args, 0), brush_callback);
g_value_set_string (gimp_value_array_index (args, 1), brush_name);
g_value_set_double (gimp_value_array_index (args, 2), opacity);
g_value_set_int (gimp_value_array_index (args, 3), spacing);
g_value_set_enum (gimp_value_array_index (args, 4), paint_mode);
return_vals = gimp_run_procedure_with_array ("gimp-brushes-set-popup",
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;
}
......@@ -53,30 +53,27 @@ gchar **
gimp_buffers_get_list (const gchar *filter,
gint *num_buffers)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
gchar **buffer_list = NULL;
gint i;
return_vals = gimp_run_procedure ("gimp-buffers-get-list",
&nreturn_vals,
GIMP_PDB_STRING, filter,
GIMP_PDB_END);
args = gimp_value_array_new_from_types (G_TYPE_STRING,
G_TYPE_NONE);
g_value_set_string (gimp_value_array_index (args, 0), filter);
return_vals = gimp_run_procedure_with_array ("gimp-buffers-get-list",
args);
gimp_value_array_unref (args);
*num_buffers = 0;
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
{
*num_buffers = return_vals[1].data.d_int32;
if (*num_buffers > 0)
{
buffer_list = g_new0 (gchar *, *num_buffers + 1);
for (i = 0; i < *num_buffers; i++)
buffer_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
}
*num_buffers = g_value_get_int (gimp_value_array_index (return_vals, 1));
buffer_list = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
}
gimp_destroy_params (return_vals, nreturn_vals);
gimp_value_array_unref (return_vals);
return buffer_list;
}
......@@ -98,20 +95,24 @@ gchar *
gimp_buffer_rename (const gchar *buffer_name,
const gchar *new_name)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
gchar *real_name = NULL;
return_vals = gimp_run_procedure ("gimp-buffer-rename",
&nreturn_vals,
GIMP_PDB_STRING, buffer_name,
GIMP_PDB_STRING, new_name,
GIMP_PDB_END);
args = gimp_value_array_new_from_types (G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_NONE);
g_value_set_string (gimp_value_array_index (args, 0), buffer_name);
g_value_set_string (gimp_value_array_index (args, 1), new_name);
return_vals = gimp_run_procedure_with_array ("gimp-buffer-rename",
args);
gimp_value_array_unref (args);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
real_name = g_strdup (return_vals[1].data.d_string);
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_destroy_params (return_vals, nreturn_vals);
gimp_value_array_unref (return_vals);
return real_name;
}
......@@ -131,18 +132,21 @@ gimp_buffer_rename (const gchar *buffer_name,
gboolean
gimp_buffer_delete (const gchar *buffer_name)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
gboolean success = TRUE;
return_vals = gimp_run_procedure ("gimp-buffer-delete",
&nreturn_vals,
GIMP_PDB_STRING, buffer_name,
GIMP_PDB_END);
args = gimp_value_array_new_from_types (G_TYPE_STRING,
G_TYPE_NONE);
g_value_set_string (gimp_value_array_index (args, 0), buffer_name);
success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
return_vals = gimp_run_procedure_with_array ("gimp-buffer-delete",
args);
gimp_value_array_unref (args);
gimp_destroy_params (return_vals, nreturn_vals);
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
gimp_value_array_unref (return_vals);
return success;
}
......@@ -162,19 +166,22 @@ gimp_buffer_delete (const gchar *buffer_name)
gint
gimp_buffer_get_width (const gchar *buffer_name)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
gint width = 0;
return_vals = gimp_run_procedure ("gimp-buffer-get-width",
&nreturn_vals,
GIMP_PDB_STRING, buffer_name,
GIMP_PDB_END);
args = gimp_value_array_new_from_types (G_TYPE_STRING,
G_TYPE_NONE);
g_value_set_string (gimp_value_array_index (args, 0), buffer_name);
return_vals = gimp_run_procedure_with_array ("gimp-buffer-get-width",
args);
gimp_value_array_unref (args);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
width = return_vals[1].data.d_int32;
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_destroy_params (return_vals, nreturn_vals);
gimp_value_array_unref (return_vals);
return width;
}
......@@ -194,19 +201,22 @@ gimp_buffer_get_width (const gchar *buffer_name)
gint
gimp_buffer_get_height (const gchar *buffer_name)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
gint height = 0;
return_vals = gimp_run_procedure ("gimp-buffer-get-height",
&nreturn_vals,
GIMP_PDB_STRING, buffer_name,
GIMP_PDB_END);
args = gimp_value_array_new_from_types (G_TYPE_STRING,
G_TYPE_NONE);
g_value_set_string (gimp_value_array_index (args, 0), buffer_name);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
height = return_vals[1].data.d_int32;
return_vals = gimp_run_procedure_with_array ("gimp-buffer-get-height",
args);
gimp_value_array_unref (args);
gimp_destroy_params (return_vals, nreturn_vals);
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;
}
......@@ -226,19 +236,22 @@ gimp_buffer_get_height (const gchar *buffer_name)
gint
gimp_buffer_get_bytes (const gchar *buffer_name)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
gint bytes = 0;
return_vals = gimp_run_procedure ("gimp-buffer-get-bytes",
&nreturn_vals,
GIMP_PDB_STRING, buffer_name,
GIMP_PDB_END);
args = gimp_value_array_new_from_types (G_TYPE_STRING,
G_TYPE_NONE);
g_value_set_string (gimp_value_array_index (args, 0), buffer_name);
return_vals = gimp_run_procedure_with_array ("gimp-buffer-get-bytes",
args);
gimp_value_array_unref (args);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
bytes = return_vals[1].data.d_int32;
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
bytes = g_value_get_int (gimp_value_array_index (return_vals, 1));
gimp_destroy_params (return_vals, nreturn_vals);
gimp_value_array_unref (return_vals);
return bytes;
}
......@@ -258,19 +271,22 @@ gimp_buffer_get_bytes (const gchar *buffer_name)
GimpImageBaseType
gimp_buffer_get_image_type (const gchar *buffer_name)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
GimpImageBaseType image_type = 0;
return_vals = gimp_run_procedure ("gimp-buffer-get-image-type",
&nreturn_vals,
GIMP_PDB_STRING, buffer_name,
GIMP_PDB_END);
args = gimp_value_array_new_from_types (G_TYPE_STRING,
G_TYPE_NONE);
g_value_set_string (gimp_value_array_index (args, 0), buffer_name);
return_vals = gimp_run_procedure_with_array ("gimp-buffer-get-image-type",
args);
gimp_value_array_unref (args);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
image_type = return_vals[1].data.d_int32;
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
image_type = g_value_get_enum (gimp_value_array_index (return_vals, 1));
gimp_destroy_params (return_vals, nreturn_vals);
gimp_value_array_unref (return_vals);
return image_type;
}
......@@ -63,24 +63,32 @@ _gimp_channel_new (gint32 image_ID,
gdouble opacity,
const GimpRGB *color)
{
GimpParam *return_vals;
gint nreturn_vals;
GimpValueArray *args;
GimpValueArray *return_vals;
gint32 channel_ID = -1;
return_vals = gimp_run_procedure ("gimp-channel-new",
&nreturn_vals,
GIMP_PDB_IMAGE, image_ID,
GIMP_PDB_INT32, width,
GIMP_PDB_INT32, height,
GIMP_PDB_STRING, name,
GIMP_PDB_FLOAT, opacity,
GIMP_PDB_COLOR, color,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
channel_ID = return_vals[1].data.d_channel;
gimp_destroy_params (return_vals, nreturn_vals);
args = gimp_value_array_new_from_types (GIMP_TYPE_IMAGE_ID,
GIMP_TYPE_INT32,
GIMP_TYPE_INT32,
G_TYPE_STRING,
G_TYPE_DOUBLE,
GIMP_TYPE_RGB,
G_TYPE_NONE);
gimp_value_set_image_id (gimp_value_array_index (args, 0), image_ID);
g_value_set_int (gimp_value_array_index (args, 1), width);
g_value_set_int (gimp_value_array_index (args, 2), height);
g_value_set_string (gimp_value_array_index (args, 3), name);
g_value_set_double (gimp_value_array_index (args, 4), opacity);
gimp_value_set_rgb (gimp_value_array_index (args, 5), color);
return_vals = gimp_run_procedure_with_array ("gimp-channel-new",
args);