app, libgimp, pdb, plug-ins: PDB (gimp-group-layer-new) made public.
This commit is contained in:
@ -59,16 +59,24 @@ group_layer_new_invoker (GimpProcedure *procedure,
|
|||||||
gboolean success = TRUE;
|
gboolean success = TRUE;
|
||||||
GimpValueArray *return_vals;
|
GimpValueArray *return_vals;
|
||||||
GimpImage *image;
|
GimpImage *image;
|
||||||
|
const gchar *name;
|
||||||
GimpGroupLayer *group_layer = NULL;
|
GimpGroupLayer *group_layer = NULL;
|
||||||
|
|
||||||
image = g_value_get_object (gimp_value_array_index (args, 0));
|
image = g_value_get_object (gimp_value_array_index (args, 0));
|
||||||
|
name = g_value_get_string (gimp_value_array_index (args, 1));
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
group_layer = GIMP_GROUP_LAYER (gimp_group_layer_new (image));
|
group_layer = GIMP_GROUP_LAYER (gimp_group_layer_new (image));
|
||||||
|
|
||||||
if (! group_layer)
|
if (! group_layer)
|
||||||
success = FALSE;
|
{
|
||||||
|
success = FALSE;
|
||||||
|
}
|
||||||
|
else if (name != NULL && strlen (name) > 0)
|
||||||
|
{
|
||||||
|
gimp_item_rename (GIMP_ITEM (group_layer), name, error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return_vals = gimp_procedure_get_return_values (procedure, success,
|
return_vals = gimp_procedure_get_return_values (procedure, success,
|
||||||
@ -128,12 +136,16 @@ register_group_layer_procs (GimpPDB *pdb)
|
|||||||
/*
|
/*
|
||||||
* gimp-group-layer-new
|
* gimp-group-layer-new
|
||||||
*/
|
*/
|
||||||
procedure = gimp_procedure_new (group_layer_new_invoker, TRUE, TRUE);
|
procedure = gimp_procedure_new (group_layer_new_invoker, TRUE, FALSE);
|
||||||
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
gimp_object_set_static_name (GIMP_OBJECT (procedure),
|
||||||
"gimp-group-layer-new");
|
"gimp-group-layer-new");
|
||||||
gimp_procedure_set_static_help (procedure,
|
gimp_procedure_set_static_help (procedure,
|
||||||
"Create a new group layer.",
|
"Create a new group layer.",
|
||||||
"This procedure creates a new group layer. Attributes such as layer mode and opacity should be set with explicit procedure calls. Add the new group layer (which is a kind of layer) with [method@image.insert_layer].\n"
|
"This procedure creates a new group layer with a given @name. If @name is %NULL, GIMP will choose a name using its default layer name algorithm.\n"
|
||||||
|
"\n"
|
||||||
|
"The new group layer still needs to be added to the image, as this is not automatic. Add the new layer with the [method@Image.insert_layer] method.\n"
|
||||||
|
"Other attributes such as layer mask, modes and offsets should be set with explicit procedure calls.\n"
|
||||||
|
"\n"
|
||||||
"Other procedures useful with group layers: [method@image_reorder_item], [method@item.get_parent], [method@item.get_children], [method@item.is_group].",
|
"Other procedures useful with group layers: [method@image_reorder_item], [method@item.get_parent], [method@item.get_children], [method@item.is_group].",
|
||||||
NULL);
|
NULL);
|
||||||
gimp_procedure_set_static_attribution (procedure,
|
gimp_procedure_set_static_attribution (procedure,
|
||||||
@ -146,6 +158,13 @@ register_group_layer_procs (GimpPDB *pdb)
|
|||||||
"The image to which to add the group layer",
|
"The image to which to add the group layer",
|
||||||
FALSE,
|
FALSE,
|
||||||
GIMP_PARAM_READWRITE));
|
GIMP_PARAM_READWRITE));
|
||||||
|
gimp_procedure_add_argument (procedure,
|
||||||
|
gimp_param_spec_string ("name",
|
||||||
|
"name",
|
||||||
|
"The group layer name",
|
||||||
|
FALSE, TRUE, FALSE,
|
||||||
|
NULL,
|
||||||
|
GIMP_PARAM_READWRITE));
|
||||||
gimp_procedure_add_return_value (procedure,
|
gimp_procedure_add_return_value (procedure,
|
||||||
gimp_param_spec_group_layer ("group-layer",
|
gimp_param_spec_group_layer ("group-layer",
|
||||||
"group layer",
|
"group layer",
|
||||||
|
@ -73,37 +73,3 @@ gimp_group_layer_get_by_id (gint32 layer_id)
|
|||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gimp_group_layer_new:
|
|
||||||
* @image: The image to which to add the layer.
|
|
||||||
* @name: (nullable): The group layer name.
|
|
||||||
*
|
|
||||||
* Create a new group layer.
|
|
||||||
*
|
|
||||||
* This procedure creates a new group layer with a given @name. If @name is
|
|
||||||
* %NULL, GIMP will choose a name using its default layer name algorithm.
|
|
||||||
*
|
|
||||||
* The new group layer still needs to be added to the image, as this is
|
|
||||||
* not automatic. Add the new layer with the [method@Image.insert_layer]
|
|
||||||
* method.
|
|
||||||
*
|
|
||||||
* Other attributes such as layer mask modes, and offsets should be set
|
|
||||||
* with explicit procedure calls.
|
|
||||||
*
|
|
||||||
* Returns: (transfer none): The newly created group layer.
|
|
||||||
* The object belongs to libgimp and you should not free it.
|
|
||||||
*
|
|
||||||
* Since: 3.0
|
|
||||||
*/
|
|
||||||
GimpGroupLayer *
|
|
||||||
gimp_group_layer_new (GimpImage *image,
|
|
||||||
const gchar *name)
|
|
||||||
{
|
|
||||||
GimpGroupLayer *layer = _gimp_group_layer_new (image);
|
|
||||||
|
|
||||||
if (name != NULL)
|
|
||||||
gimp_item_set_name (GIMP_ITEM (layer), name);
|
|
||||||
|
|
||||||
return layer;
|
|
||||||
}
|
|
||||||
|
@ -40,9 +40,6 @@ G_DECLARE_FINAL_TYPE (GimpGroupLayer, gimp_group_layer, GIMP, GROUP_LAYER, GimpL
|
|||||||
|
|
||||||
GimpGroupLayer * gimp_group_layer_get_by_id (gint32 layer_id);
|
GimpGroupLayer * gimp_group_layer_get_by_id (gint32 layer_id);
|
||||||
|
|
||||||
GimpGroupLayer * gimp_group_layer_new (GimpImage *image,
|
|
||||||
const gchar *name) G_GNUC_WARN_UNUSED_RESULT;
|
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -37,15 +37,22 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _gimp_group_layer_new:
|
* gimp_group_layer_new:
|
||||||
* @image: The image to which to add the group layer.
|
* @image: The image to which to add the group layer.
|
||||||
|
* @name: (nullable): The group layer name.
|
||||||
*
|
*
|
||||||
* Create a new group layer.
|
* Create a new group layer.
|
||||||
*
|
*
|
||||||
* This procedure creates a new group layer. Attributes such as layer
|
* This procedure creates a new group layer with a given @name. If
|
||||||
* mode and opacity should be set with explicit procedure calls. Add
|
* @name is %NULL, GIMP will choose a name using its default layer name
|
||||||
* the new group layer (which is a kind of layer) with
|
* algorithm.
|
||||||
* [method@image.insert_layer].
|
*
|
||||||
|
* The new group layer still needs to be added to the image, as this is
|
||||||
|
* not automatic. Add the new layer with the
|
||||||
|
* [method@Image.insert_layer] method.
|
||||||
|
* Other attributes such as layer mask, modes and offsets should be set
|
||||||
|
* with explicit procedure calls.
|
||||||
|
*
|
||||||
* Other procedures useful with group layers:
|
* Other procedures useful with group layers:
|
||||||
* [method@image_reorder_item], [method@item.get_parent],
|
* [method@image_reorder_item], [method@item.get_parent],
|
||||||
* [method@item.get_children], [method@item.is_group].
|
* [method@item.get_children], [method@item.is_group].
|
||||||
@ -55,7 +62,8 @@
|
|||||||
* Since: 2.8
|
* Since: 2.8
|
||||||
**/
|
**/
|
||||||
GimpGroupLayer *
|
GimpGroupLayer *
|
||||||
_gimp_group_layer_new (GimpImage *image)
|
gimp_group_layer_new (GimpImage *image,
|
||||||
|
const gchar *name)
|
||||||
{
|
{
|
||||||
GimpValueArray *args;
|
GimpValueArray *args;
|
||||||
GimpValueArray *return_vals;
|
GimpValueArray *return_vals;
|
||||||
@ -63,6 +71,7 @@ _gimp_group_layer_new (GimpImage *image)
|
|||||||
|
|
||||||
args = gimp_value_array_new_from_types (NULL,
|
args = gimp_value_array_new_from_types (NULL,
|
||||||
GIMP_TYPE_IMAGE, image,
|
GIMP_TYPE_IMAGE, image,
|
||||||
|
G_TYPE_STRING, name,
|
||||||
G_TYPE_NONE);
|
G_TYPE_NONE);
|
||||||
|
|
||||||
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
||||||
|
@ -32,8 +32,9 @@ G_BEGIN_DECLS
|
|||||||
/* For information look into the C source or the html documentation */
|
/* For information look into the C source or the html documentation */
|
||||||
|
|
||||||
|
|
||||||
G_GNUC_INTERNAL GimpGroupLayer* _gimp_group_layer_new (GimpImage *image);
|
GimpGroupLayer* gimp_group_layer_new (GimpImage *image,
|
||||||
GimpLayer* gimp_group_layer_merge (GimpGroupLayer *group_layer);
|
const gchar *name);
|
||||||
|
GimpLayer* gimp_group_layer_merge (GimpGroupLayer *group_layer);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -19,9 +19,17 @@ sub group_layer_new {
|
|||||||
$blurb = 'Create a new group layer.';
|
$blurb = 'Create a new group layer.';
|
||||||
|
|
||||||
$help = <<'HELP';
|
$help = <<'HELP';
|
||||||
This procedure creates a new group layer. Attributes such as layer mode
|
This procedure creates a new group layer with a given @name. If @name is
|
||||||
and opacity should be set with explicit procedure calls. Add the new
|
%NULL, GIMP will choose a name using its default layer name algorithm.
|
||||||
group layer (which is a kind of layer) with [method@image.insert_layer].
|
|
||||||
|
|
||||||
|
The new group layer still needs to be added to the image, as this is
|
||||||
|
not automatic. Add the new layer with the [method@Image.insert_layer]
|
||||||
|
method.
|
||||||
|
|
||||||
|
Other attributes such as layer mask, modes and offsets should be set
|
||||||
|
with explicit procedure calls.
|
||||||
|
|
||||||
|
|
||||||
Other procedures useful with group layers: [method@image_reorder_item],
|
Other procedures useful with group layers: [method@image_reorder_item],
|
||||||
[method@item.get_parent], [method@item.get_children], [method@item.is_group].
|
[method@item.get_parent], [method@item.get_children], [method@item.is_group].
|
||||||
@ -29,11 +37,11 @@ HELP
|
|||||||
|
|
||||||
&barak_pdb_misc('2010', '2.8');
|
&barak_pdb_misc('2010', '2.8');
|
||||||
|
|
||||||
$lib_private = 1;
|
|
||||||
|
|
||||||
@inargs = (
|
@inargs = (
|
||||||
{ name => 'image', type => 'image',
|
{ name => 'image', type => 'image',
|
||||||
desc => 'The image to which to add the group layer' }
|
desc => 'The image to which to add the group layer' },
|
||||||
|
{ name => 'name', type => 'string', none_ok => 1,
|
||||||
|
desc => "The group layer name" }
|
||||||
);
|
);
|
||||||
|
|
||||||
@outargs = (
|
@outargs = (
|
||||||
@ -46,7 +54,13 @@ HELP
|
|||||||
group_layer = GIMP_GROUP_LAYER (gimp_group_layer_new (image));
|
group_layer = GIMP_GROUP_LAYER (gimp_group_layer_new (image));
|
||||||
|
|
||||||
if (! group_layer)
|
if (! group_layer)
|
||||||
success = FALSE;
|
{
|
||||||
|
success = FALSE;
|
||||||
|
}
|
||||||
|
else if (name != NULL && strlen (name) > 0)
|
||||||
|
{
|
||||||
|
gimp_item_rename (GIMP_ITEM (group_layer), name, error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CODE
|
CODE
|
||||||
);
|
);
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
; group-new not throw
|
; group-new not throw
|
||||||
; This is setup, not an assert, because we need to capture the group's ID
|
; This is setup, not an assert, because we need to capture the group's ID
|
||||||
; Note the ID is not wrapped in list
|
; Note the ID is not wrapped in list
|
||||||
(define testGroup (gimp-group-layer-new testImage))
|
(define testGroup (gimp-group-layer-new testImage ""))
|
||||||
(define testGroup2 (gimp-group-layer-new testImage))
|
(define testGroup2 (gimp-group-layer-new testImage ""))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
; group-new not throw
|
; group-new not throw
|
||||||
; This is setup, not an assert, because we need to capture the group's ID
|
; This is setup, not an assert, because we need to capture the group's ID
|
||||||
; Note the ID is not wrapped in list
|
; Note the ID is not wrapped in list
|
||||||
(define testGroup (gimp-group-layer-new testImage))
|
(define testGroup (gimp-group-layer-new testImage ""))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user