mirror of https://github.com/GNOME/gimp.git
pdb: clean up gimp-layer-group-new
There is no need to wrap it with a function with identical signature. Also move it next to the other layer-new functions.
This commit is contained in:
parent
97b35ab332
commit
548d2e041d
|
@ -178,6 +178,38 @@ layer_new_from_drawable_invoker (GimpProcedure *procedure,
|
|||
return return_vals;
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
layer_group_new_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GValueArray *args,
|
||||
GError **error)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
GValueArray *return_vals;
|
||||
GimpImage *image;
|
||||
GimpLayer *layer_group = NULL;
|
||||
|
||||
image = gimp_value_get_image (&args->values[0], gimp);
|
||||
|
||||
if (success)
|
||||
{
|
||||
layer_group = gimp_group_layer_new (image);
|
||||
|
||||
if (! layer_group)
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
return_vals = gimp_procedure_get_return_values (procedure, success,
|
||||
error ? *error : NULL);
|
||||
|
||||
if (success)
|
||||
gimp_value_set_layer (&return_vals->values[1], layer_group);
|
||||
|
||||
return return_vals;
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
layer_copy_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
|
@ -1027,38 +1059,6 @@ layer_set_mode_invoker (GimpProcedure *procedure,
|
|||
error ? *error : NULL);
|
||||
}
|
||||
|
||||
static GValueArray *
|
||||
layer_group_new_invoker (GimpProcedure *procedure,
|
||||
Gimp *gimp,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
const GValueArray *args,
|
||||
GError **error)
|
||||
{
|
||||
gboolean success = TRUE;
|
||||
GValueArray *return_vals;
|
||||
GimpImage *image;
|
||||
GimpLayer *layer_group = NULL;
|
||||
|
||||
image = gimp_value_get_image (&args->values[0], gimp);
|
||||
|
||||
if (success)
|
||||
{
|
||||
layer_group = gimp_group_layer_new (image);
|
||||
|
||||
if (! layer_group)
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
return_vals = gimp_procedure_get_return_values (procedure, success,
|
||||
error ? *error : NULL);
|
||||
|
||||
if (success)
|
||||
gimp_value_set_layer (&return_vals->values[1], layer_group);
|
||||
|
||||
return return_vals;
|
||||
}
|
||||
|
||||
void
|
||||
register_layer_procs (GimpPDB *pdb)
|
||||
{
|
||||
|
@ -1209,6 +1209,35 @@ register_layer_procs (GimpPDB *pdb)
|
|||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-layer-group-new
|
||||
*/
|
||||
procedure = gimp_procedure_new (layer_group_new_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
"gimp-layer-group-new");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-layer-group-new",
|
||||
"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.",
|
||||
"Barak Itkin <lightningismyname@gmail.com>",
|
||||
"Barak Itkin",
|
||||
"2010",
|
||||
NULL);
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_image_id ("image",
|
||||
"image",
|
||||
"The image to which to add the layer group",
|
||||
pdb->gimp, FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
gimp_param_spec_layer_id ("layer-group",
|
||||
"layer group",
|
||||
"The newly created layer group",
|
||||
pdb->gimp, FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-layer-copy
|
||||
*/
|
||||
|
@ -2050,33 +2079,4 @@ register_layer_procs (GimpPDB *pdb)
|
|||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
||||
/*
|
||||
* gimp-layer-group-new
|
||||
*/
|
||||
procedure = gimp_procedure_new (layer_group_new_invoker);
|
||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||
"gimp-layer-group-new");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-layer-group-new",
|
||||
"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.",
|
||||
"Barak Itkin <lightningismyname@gmail.com>",
|
||||
"Barak Itkin",
|
||||
"2010",
|
||||
NULL);
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_image_id ("image",
|
||||
"image",
|
||||
"The image to which to add the layer group",
|
||||
pdb->gimp, FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
gimp_param_spec_layer_id ("layer-group",
|
||||
"layer group",
|
||||
"The newly created layer group",
|
||||
pdb->gimp, FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
}
|
||||
|
|
|
@ -82,25 +82,6 @@ gimp_layer_copy (gint32 layer_ID)
|
|||
return _gimp_layer_copy (layer_ID, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_layer_group_new:
|
||||
* @image_ID: The image to which to add the layer.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Returns: The newly created layer group.
|
||||
*/
|
||||
gint32
|
||||
gimp_layer_group_new (gint32 image_ID)
|
||||
{
|
||||
return _gimp_layer_group_new (image_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_layer_get_preserve_trans:
|
||||
* @layer_ID: The layer.
|
||||
|
|
|
@ -34,7 +34,6 @@ gint32 gimp_layer_new (gint32 image_ID,
|
|||
gdouble opacity,
|
||||
GimpLayerModeEffects mode);
|
||||
gint32 gimp_layer_copy (gint32 layer_ID);
|
||||
gint32 gimp_layer_group_new (gint32 image_ID);
|
||||
|
||||
|
||||
#ifndef GIMP_DISABLE_DEPRECATED
|
||||
|
|
|
@ -166,6 +166,41 @@ gimp_layer_new_from_drawable (gint32 drawable_ID,
|
|||
return layer_copy_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_layer_group_new:
|
||||
* @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.
|
||||
*
|
||||
* Returns: The newly created layer group.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
*/
|
||||
gint32
|
||||
gimp_layer_group_new (gint32 image_ID)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gint32 layer_group_ID = -1;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-layer-group-new",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_IMAGE, image_ID,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
layer_group_ID = return_vals[1].data.d_layer;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return layer_group_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* _gimp_layer_copy:
|
||||
* @layer_ID: The layer to copy.
|
||||
|
@ -1110,38 +1145,3 @@ gimp_layer_set_mode (gint32 layer_ID,
|
|||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* _gimp_layer_group_new:
|
||||
* @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.
|
||||
*
|
||||
* Returns: The newly created layer group.
|
||||
*
|
||||
* Since: GIMP 2.8
|
||||
*/
|
||||
gint32
|
||||
_gimp_layer_group_new (gint32 image_ID)
|
||||
{
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
gint32 layer_group_ID = -1;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp-layer-group-new",
|
||||
&nreturn_vals,
|
||||
GIMP_PDB_IMAGE, image_ID,
|
||||
GIMP_PDB_END);
|
||||
|
||||
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
|
||||
layer_group_ID = return_vals[1].data.d_layer;
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
|
||||
return layer_group_ID;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ gint32 gimp_layer_new_from_visible (gint32 i
|
|||
const gchar *name);
|
||||
gint32 gimp_layer_new_from_drawable (gint32 drawable_ID,
|
||||
gint32 dest_image_ID);
|
||||
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);
|
||||
|
@ -92,7 +93,6 @@ gboolean gimp_layer_set_opacity (gint32 l
|
|||
GimpLayerModeEffects gimp_layer_get_mode (gint32 layer_ID);
|
||||
gboolean gimp_layer_set_mode (gint32 layer_ID,
|
||||
GimpLayerModeEffects mode);
|
||||
G_GNUC_INTERNAL gint32 _gimp_layer_group_new (gint32 image_ID);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -159,6 +159,39 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
sub layer_group_new {
|
||||
$blurb = 'Create a new layer group.';
|
||||
|
||||
$help = <<'HELP';
|
||||
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.
|
||||
HELP
|
||||
|
||||
&barak_pdb_misc('2010', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => 'image', type => 'image',
|
||||
desc => 'The image to which to add the layer group' }
|
||||
);
|
||||
|
||||
@outargs = (
|
||||
{ name => 'layer_group', type => 'layer',
|
||||
desc => 'The newly created layer group' }
|
||||
);
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
layer_group = gimp_group_layer_new (image);
|
||||
|
||||
if (! layer_group)
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub layer_copy {
|
||||
$blurb = 'Copy a layer.';
|
||||
|
||||
|
@ -1071,39 +1104,6 @@ CODE
|
|||
);
|
||||
}
|
||||
|
||||
sub layer_group_new {
|
||||
$blurb = 'Create a new layer group.';
|
||||
|
||||
$help = <<'HELP';
|
||||
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.
|
||||
HELP
|
||||
|
||||
&barak_pdb_misc('2010', '2.8');
|
||||
|
||||
@inargs = (
|
||||
{ name => 'image', type => 'image',
|
||||
desc => 'The image to which to add the layer group' }
|
||||
);
|
||||
|
||||
@outargs = (
|
||||
{ name => 'layer_group', type => 'layer', wrap => 1,
|
||||
desc => 'The newly created layer group' }
|
||||
);
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
layer_group = gimp_group_layer_new (image);
|
||||
|
||||
if (! layer_group)
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
@headers = qw("libgimpbase/gimpbase.h"
|
||||
"config/gimpcoreconfig.h"
|
||||
"core/gimp.h"
|
||||
|
@ -1117,6 +1117,7 @@ CODE
|
|||
@procs = qw(layer_new
|
||||
layer_new_from_visible
|
||||
layer_new_from_drawable
|
||||
layer_group_new
|
||||
layer_copy
|
||||
layer_add_alpha
|
||||
layer_flatten
|
||||
|
@ -1134,8 +1135,7 @@ CODE
|
|||
layer_get_show_mask layer_set_show_mask
|
||||
layer_get_edit_mask layer_set_edit_mask
|
||||
layer_get_opacity layer_set_opacity
|
||||
layer_get_mode layer_set_mode
|
||||
layer_group_new);
|
||||
layer_get_mode layer_set_mode);
|
||||
|
||||
%exports = (app => [@procs], lib => [@procs]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue