app, libgimp, pdb: also get rid of gimp_text_layer_new() wrapper.

See previous commit.
This commit is contained in:
Jehan 2025-01-20 20:54:55 +01:00
parent e125c30cfd
commit 65635e8a0c
6 changed files with 92 additions and 116 deletions

View file

@ -999,12 +999,16 @@ register_text_layer_procs (GimpPDB *pdb)
/*
* gimp-text-layer-new
*/
procedure = gimp_procedure_new (text_layer_new_invoker, TRUE, TRUE);
procedure = gimp_procedure_new (text_layer_new_invoker, TRUE, FALSE);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-text-layer-new");
gimp_procedure_set_static_help (procedure,
"Creates a new text layer.",
"This procedure creates a new text layer. The arguments are kept as simple as necessary for the normal case. All text attributes, however, can be modified with the appropriate gimp_text_layer_set_*() procedures. The new layer still needs to be added to the image, as this is not automatic. Add the new layer using 'gimp-image-insert-layer'.",
"This procedure creates a new text layer displaying the specified @text. By default the width and height of the layer will be determined by the @text contents, the @font, @size and @unit.\n"
"\n"
"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.\n"
"\n"
"The arguments are kept as simple as necessary for the basic case. All text attributes, however, can be modified with the appropriate `gimp_text_layer_set_*()` procedures.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Marcus Heese <heese@cip.ifi.lmu.de>",
@ -1048,7 +1052,7 @@ register_text_layer_procs (GimpPDB *pdb)
gimp_procedure_add_return_value (procedure,
gimp_param_spec_text_layer ("layer",
"layer",
"The new text layer.",
"The new text layer. The object belongs to libgimp and you should not free it.",
FALSE,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);

View file

@ -80,40 +80,6 @@ gimp_text_layer_get_by_id (gint32 layer_id)
return NULL;
}
/**
* gimp_text_layer_new:
* @image: The image to which to add the layer.
* @text: The text to generate (in UTF-8 encoding).
* @font: The name of the font.
* @size: The size of text in either pixels or points.
* @unit: The units of specified size.
*
* Create a new layer.
*
* This procedure creates a new text layer displaying the specified @text. By
* default the width and height of the layer will be determined by the @text
* contents, the @fontname, @size and @unit.
*
* 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 text layer.
* The object belongs to libgimp and you should not free it.
*
* Since: 3.0
*/
GimpTextLayer *
gimp_text_layer_new (GimpImage *image,
const gchar *text,
GimpFont *font,
gdouble size,
GimpUnit *unit)
{
return _gimp_text_layer_new (image, text, font, size, unit);
}
/* private functions */

View file

@ -40,12 +40,6 @@ G_DECLARE_FINAL_TYPE (GimpTextLayer, gimp_text_layer, GIMP, TEXT_LAYER, GimpLaye
GimpTextLayer * gimp_text_layer_get_by_id (gint32 layer_id);
GimpTextLayer * gimp_text_layer_new (GimpImage *image,
const gchar *text,
GimpFont *font,
gdouble size,
GimpUnit *unit) G_GNUC_WARN_UNUSED_RESULT;
G_END_DECLS

View file

@ -37,7 +37,7 @@
/**
* _gimp_text_layer_new:
* gimp_text_layer_new:
* @image: The image.
* @text: The text to generate (in UTF-8 encoding).
* @font: The font to write the text with.
@ -46,23 +46,29 @@
*
* Creates a new text layer.
*
* This procedure creates a new text layer. The arguments are kept as
* simple as necessary for the normal case. All text attributes,
* however, can be modified with the appropriate
* gimp_text_layer_set_*() procedures. The new layer still needs to be
* added to the image, as this is not automatic. Add the new layer
* using gimp_image_insert_layer().
* This procedure creates a new text layer displaying the specified
* @text. By default the width and height of the layer will be
* determined by the @text contents, the @font, @size and @unit.
*
* Returns: (transfer none): The new text layer.
* 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.
*
* The arguments are kept as simple as necessary for the basic case.
* All text attributes, however, can be modified with the appropriate
* `gimp_text_layer_set_*()` procedures.
*
* Returns: (transfer none):
* The new text layer. The object belongs to libgimp and you should not free it.
*
* Since: 2.6
**/
GimpTextLayer *
_gimp_text_layer_new (GimpImage *image,
const gchar *text,
GimpFont *font,
gdouble size,
GimpUnit *unit)
gimp_text_layer_new (GimpImage *image,
const gchar *text,
GimpFont *font,
gdouble size,
GimpUnit *unit)
{
GimpValueArray *args;
GimpValueArray *return_vals;

View file

@ -32,58 +32,58 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
G_GNUC_INTERNAL GimpTextLayer* _gimp_text_layer_new (GimpImage *image,
const gchar *text,
GimpFont *font,
gdouble size,
GimpUnit *unit);
gchar* gimp_text_layer_get_text (GimpTextLayer *layer);
gboolean gimp_text_layer_set_text (GimpTextLayer *layer,
const gchar *text);
gchar* gimp_text_layer_get_markup (GimpTextLayer *layer);
gboolean gimp_text_layer_set_markup (GimpTextLayer *layer,
const gchar *markup);
GimpFont* gimp_text_layer_get_font (GimpTextLayer *layer);
gboolean gimp_text_layer_set_font (GimpTextLayer *layer,
GimpFont *font);
gdouble gimp_text_layer_get_font_size (GimpTextLayer *layer,
GimpUnit **unit);
gboolean gimp_text_layer_set_font_size (GimpTextLayer *layer,
gdouble font_size,
GimpUnit *unit);
gboolean gimp_text_layer_get_antialias (GimpTextLayer *layer);
gboolean gimp_text_layer_set_antialias (GimpTextLayer *layer,
gboolean antialias);
GimpTextHintStyle gimp_text_layer_get_hint_style (GimpTextLayer *layer);
gboolean gimp_text_layer_set_hint_style (GimpTextLayer *layer,
GimpTextHintStyle style);
gboolean gimp_text_layer_get_kerning (GimpTextLayer *layer);
gboolean gimp_text_layer_set_kerning (GimpTextLayer *layer,
gboolean kerning);
gchar* gimp_text_layer_get_language (GimpTextLayer *layer);
gboolean gimp_text_layer_set_language (GimpTextLayer *layer,
const gchar *language);
GimpTextDirection gimp_text_layer_get_base_direction (GimpTextLayer *layer);
gboolean gimp_text_layer_set_base_direction (GimpTextLayer *layer,
GimpTextDirection direction);
GimpTextJustification gimp_text_layer_get_justification (GimpTextLayer *layer);
gboolean gimp_text_layer_set_justification (GimpTextLayer *layer,
GimpTextJustification justify);
GeglColor* gimp_text_layer_get_color (GimpTextLayer *layer);
gboolean gimp_text_layer_set_color (GimpTextLayer *layer,
GeglColor *color);
gdouble gimp_text_layer_get_indent (GimpTextLayer *layer);
gboolean gimp_text_layer_set_indent (GimpTextLayer *layer,
gdouble indent);
gdouble gimp_text_layer_get_line_spacing (GimpTextLayer *layer);
gboolean gimp_text_layer_set_line_spacing (GimpTextLayer *layer,
gdouble line_spacing);
gdouble gimp_text_layer_get_letter_spacing (GimpTextLayer *layer);
gboolean gimp_text_layer_set_letter_spacing (GimpTextLayer *layer,
gdouble letter_spacing);
gboolean gimp_text_layer_resize (GimpTextLayer *layer,
gdouble width,
gdouble height);
GimpTextLayer* gimp_text_layer_new (GimpImage *image,
const gchar *text,
GimpFont *font,
gdouble size,
GimpUnit *unit);
gchar* gimp_text_layer_get_text (GimpTextLayer *layer);
gboolean gimp_text_layer_set_text (GimpTextLayer *layer,
const gchar *text);
gchar* gimp_text_layer_get_markup (GimpTextLayer *layer);
gboolean gimp_text_layer_set_markup (GimpTextLayer *layer,
const gchar *markup);
GimpFont* gimp_text_layer_get_font (GimpTextLayer *layer);
gboolean gimp_text_layer_set_font (GimpTextLayer *layer,
GimpFont *font);
gdouble gimp_text_layer_get_font_size (GimpTextLayer *layer,
GimpUnit **unit);
gboolean gimp_text_layer_set_font_size (GimpTextLayer *layer,
gdouble font_size,
GimpUnit *unit);
gboolean gimp_text_layer_get_antialias (GimpTextLayer *layer);
gboolean gimp_text_layer_set_antialias (GimpTextLayer *layer,
gboolean antialias);
GimpTextHintStyle gimp_text_layer_get_hint_style (GimpTextLayer *layer);
gboolean gimp_text_layer_set_hint_style (GimpTextLayer *layer,
GimpTextHintStyle style);
gboolean gimp_text_layer_get_kerning (GimpTextLayer *layer);
gboolean gimp_text_layer_set_kerning (GimpTextLayer *layer,
gboolean kerning);
gchar* gimp_text_layer_get_language (GimpTextLayer *layer);
gboolean gimp_text_layer_set_language (GimpTextLayer *layer,
const gchar *language);
GimpTextDirection gimp_text_layer_get_base_direction (GimpTextLayer *layer);
gboolean gimp_text_layer_set_base_direction (GimpTextLayer *layer,
GimpTextDirection direction);
GimpTextJustification gimp_text_layer_get_justification (GimpTextLayer *layer);
gboolean gimp_text_layer_set_justification (GimpTextLayer *layer,
GimpTextJustification justify);
GeglColor* gimp_text_layer_get_color (GimpTextLayer *layer);
gboolean gimp_text_layer_set_color (GimpTextLayer *layer,
GeglColor *color);
gdouble gimp_text_layer_get_indent (GimpTextLayer *layer);
gboolean gimp_text_layer_set_indent (GimpTextLayer *layer,
gdouble indent);
gdouble gimp_text_layer_get_line_spacing (GimpTextLayer *layer);
gboolean gimp_text_layer_set_line_spacing (GimpTextLayer *layer,
gdouble line_spacing);
gdouble gimp_text_layer_get_letter_spacing (GimpTextLayer *layer);
gboolean gimp_text_layer_set_letter_spacing (GimpTextLayer *layer,
gdouble letter_spacing);
gboolean gimp_text_layer_resize (GimpTextLayer *layer,
gdouble width,
gdouble height);
G_END_DECLS

View file

@ -22,17 +22,23 @@ sub text_layer_new {
$blurb = 'Creates a new text layer.';
$help = <<'HELP';
This procedure creates a new text layer. The arguments are kept as
simple as necessary for the normal case. All text attributes, however,
can be modified with the appropriate gimp_text_layer_set_*()
procedures. The new layer still needs to be added to the image, as
this is not automatic. Add the new layer using gimp_image_insert_layer().
This procedure creates a new text layer displaying the specified @text. By
default the width and height of the layer will be determined by the @text
contents, the @font, @size and @unit.
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.
The arguments are kept as simple as necessary for the basic case. All
text attributes, however, can be modified with the appropriate
`gimp_text_layer_set_*()` procedures.
HELP
&marcus_pdb_misc('2008', '2.6');
$lib_private = 1;
@inargs = (
{ name => 'image', type => 'image',
desc => 'The image' },
@ -48,7 +54,7 @@ HELP
@outargs = (
{ name => 'layer', type => 'text_layer',
desc => 'The new text layer.' }
desc => 'The new text layer. The object belongs to libgimp and you should not free it.' }
);
%invoke = (