app, libgimp, pdb: gimp_layer_new() allows a NULL name.

Our core code allows a NULL name, so there is no reason not to. We just have to
explain the rules (basically: you don't choose the name!).
This commit is contained in:
Jehan 2024-02-26 22:41:54 +01:00
parent a1b7b4dedd
commit eacb3ebf82
4 changed files with 26 additions and 21 deletions

View File

@ -1257,7 +1257,7 @@ register_layer_procs (GimpPDB *pdb)
"gimp-layer-new");
gimp_procedure_set_static_help (procedure,
"Create a new layer.",
"This procedure creates a new layer with the specified width, height, and type. Name, opacity, and mode are also supplied parameters. The new layer still needs to be added to the image, as this is not automatic. Add the new layer with the 'gimp-image-insert-layer' command. Other attributes such as layer mask modes, and offsets should be set with explicit procedure calls.",
"This procedure creates a new layer with the specified width, height, and type. If @name is %NULL, a default layer name will be used. Opacity, and mode are also supplied parameters. The new layer still needs to be added to the image, as this is not automatic. Add the new layer with the 'gimp-image-insert-layer' command. Other attributes such as layer mask modes, and offsets should be set with explicit procedure calls.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",

View File

@ -75,22 +75,25 @@ gimp_layer_get_by_id (gint32 layer_id)
/**
* gimp_layer_new:
* @image: The image to which to add the layer.
* @name: The layer name.
* @width: The layer width.
* @height: The layer height.
* @type: The layer type.
* @opacity: The layer opacity.
* @mode: The layer combination mode.
* @image: The image to which to add the layer.
* @name: (nullable): The layer name.
* @width: The layer width.
* @height: The layer height.
* @type: The layer type.
* @opacity: The layer opacity.
* @mode: The layer combination mode.
*
* Create a new layer.
*
* This procedure creates a new layer with the specified width, height,
* and type. Name, opacity, and mode are also supplied parameters. The
* new layer still needs to be added to the image, as this is not
* automatic. Add the new layer with the gimp_image_insert_layer()
* command. Other attributes such as layer mask modes, and offsets
* should be set with explicit procedure calls.
* This procedure creates a new layer with the specified @width, @height, and
* @type. If @name is %NULL, a default layer name will be used.
* @opacity and @mode are also supplied parameters.
*
* The new 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 layer.
* The object belongs to libgimp and you should not free it.

View File

@ -49,11 +49,12 @@
* Create a new layer.
*
* This procedure creates a new layer with the specified width, height,
* and type. Name, opacity, and mode are also supplied parameters. The
* new layer still needs to be added to the image, as this is not
* automatic. Add the new layer with the gimp_image_insert_layer()
* command. Other attributes such as layer mask modes, and offsets
* should be set with explicit procedure calls.
* and type. If @name is %NULL, a default layer name will be used.
* Opacity, and mode are also supplied parameters. The new layer still
* needs to be added to the image, as this is not automatic. Add the
* new layer with the gimp_image_insert_layer() command. Other
* attributes such as layer mask modes, and offsets should be set with
* explicit procedure calls.
*
* Returns: (transfer none): The newly created layer.
**/

View File

@ -21,7 +21,8 @@ sub layer_new {
$help = <<'HELP';
This procedure creates a new layer with the specified width, height,
and type. Name, opacity, and mode are also supplied parameters. The
and type. If @name is %NULL, a default layer name will be used.
Opacity, and mode are also supplied parameters. The
new layer still needs to be added to the image, as this is not
automatic. Add the new layer with the gimp_image_insert_layer()
command. Other attributes such as layer mask modes, and offsets should
@ -42,7 +43,7 @@ HELP
{ name => 'type', type => 'enum GimpImageType',
desc => 'The layer type' },
{ name => 'name', type => 'string',
desc => 'The layer name', null_ok => 1 },
desc => 'The layer name', null_ok => 0 },
{ name => 'opacity', type => '0 <= float <= 100',
desc => 'The layer opacity' },
{ name => 'mode', type => 'enum GimpLayerMode',