app, libgimp, pdb: improve docs and names of autocrop functions.

- Clean up a bit the 2 procedures' descriptions and add more info in
  gimp_image_autocrop() description to explain how the input drawable is
  used.
- Rename gimp_image_autocrop_layer() to gimp_image_autocrop_selected_layers(),
  which makes it clearer.
This commit is contained in:
Jehan 2025-02-09 18:23:42 +01:00
parent 9e2d8e4e16
commit 3c21b768c5
5 changed files with 50 additions and 36 deletions

View file

@ -110,12 +110,12 @@ image_autocrop_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
image_autocrop_layer_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
image_autocrop_selected_layers_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
GimpProgress *progress,
const GimpValueArray *args,
GError **error)
{
gboolean success = TRUE;
GimpImage *image;
@ -185,7 +185,9 @@ register_image_autocrop_procs (GimpPDB *pdb)
"gimp-image-autocrop");
gimp_procedure_set_static_help (procedure,
"Remove empty borders from the image",
"Remove empty borders from the image.",
"Remove empty borders from the @image based on empty borders of the input @drawable.\n"
"\n"
"The input drawable serves as a base for detecting cropping extents (transparency or background color).",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",
@ -207,14 +209,15 @@ register_image_autocrop_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
* gimp-image-autocrop-layer
* gimp-image-autocrop-selected-layers
*/
procedure = gimp_procedure_new (image_autocrop_layer_invoker, TRUE, FALSE);
procedure = gimp_procedure_new (image_autocrop_selected_layers_invoker, TRUE, FALSE);
gimp_object_set_static_name (GIMP_OBJECT (procedure),
"gimp-image-autocrop-layer");
"gimp-image-autocrop-selected-layers");
gimp_procedure_set_static_help (procedure,
"Crop the selected layers based on empty borders of the input drawable",
"Crop the selected layers of the input \"image\" based on empty borders of the input \"drawable\". \n\nThe input drawable serves as a base for detecting cropping extents (transparency or background color), and is not necessarily among the cropped layers (the current selected layers).",
"Crop the selected layers of the input @image based on empty borders of the input @drawable.\n"
"The input drawable serves as a base for detecting cropping extents (transparency or background color), and is not necessarily among the cropped layers (the current selected layers).",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Spencer Kimball & Peter Mattis",

View file

@ -408,8 +408,8 @@ EXPORTS
gimp_image_add_sample_point
gimp_image_add_vguide
gimp_image_attach_parasite
gimp_image_autocrop
gimp_image_autocrop_layer
gimp_image_autocrop
gimp_image_autocrop_selected_layers
gimp_image_clean_all
gimp_image_convert_color_profile
gimp_image_convert_color_profile_from_file

View file

@ -30,9 +30,9 @@
/**
* SECTION: gimpimageautocrop
* @title: gimpimageautocrop
* @short_description: Functions that crop images to a layer.
* @short_description: Functions that crop images or layers.
*
* Functions that crop images to a layer.
* Functions that crop images or layers.
**/
@ -43,7 +43,11 @@
*
* Remove empty borders from the image
*
* Remove empty borders from the image.
* Remove empty borders from the @image based on empty borders of the
* input @drawable.
*
* The input drawable serves as a base for detecting cropping extents
* (transparency or background color).
*
* Returns: TRUE on success.
**/
@ -73,24 +77,24 @@ gimp_image_autocrop (GimpImage *image,
}
/**
* gimp_image_autocrop_layer:
* gimp_image_autocrop_selected_layers:
* @image: Input image).
* @drawable: Input drawable.
*
* Crop the selected layers based on empty borders of the input
* drawable
*
* Crop the selected layers of the input \"image\" based on empty
* borders of the input \"drawable\". \n\nThe input drawable serves as
* a base for detecting cropping extents (transparency or background
* color), and is not necessarily among the cropped layers (the current
* selected layers).
* Crop the selected layers of the input @image based on empty borders
* of the input @drawable.
* The input drawable serves as a base for detecting cropping extents
* (transparency or background color), and is not necessarily among the
* cropped layers (the current selected layers).
*
* Returns: TRUE on success.
**/
gboolean
gimp_image_autocrop_layer (GimpImage *image,
GimpDrawable *drawable)
gimp_image_autocrop_selected_layers (GimpImage *image,
GimpDrawable *drawable)
{
GimpValueArray *args;
GimpValueArray *return_vals;
@ -102,7 +106,7 @@ gimp_image_autocrop_layer (GimpImage *image,
G_TYPE_NONE);
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
"gimp-image-autocrop-layer",
"gimp-image-autocrop-selected-layers",
args);
gimp_value_array_unref (args);

View file

@ -32,10 +32,10 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gboolean gimp_image_autocrop (GimpImage *image,
GimpDrawable *drawable);
gboolean gimp_image_autocrop_layer (GimpImage *image,
GimpDrawable *drawable);
gboolean gimp_image_autocrop (GimpImage *image,
GimpDrawable *drawable);
gboolean gimp_image_autocrop_selected_layers (GimpImage *image,
GimpDrawable *drawable);
G_END_DECLS

View file

@ -21,7 +21,11 @@ sub image_autocrop {
$blurb = 'Remove empty borders from the image';
$help = <<'HELP';
Remove empty borders from the image.
Remove empty borders from the @image based on empty borders of the input @drawable.
The input drawable serves as a base for detecting cropping extents
(transparency or background color).
HELP
&std_pdb_misc;
@ -82,12 +86,15 @@ CODE
);
}
sub image_autocrop_layer {
sub image_autocrop_selected_layers {
$blurb = 'Crop the selected layers based on empty borders of the input drawable';
$help = <<'HELP';
Crop the selected layers of the input "image" based on empty borders of the input "drawable".
\n\nThe input drawable serves as a base for detecting cropping extents (transparency or background color), and is not necessarily among the cropped layers (the current selected layers).
Crop the selected layers of the input @image based on empty borders of the input @drawable.
The input drawable serves as a base for detecting cropping extents
(transparency or background color), and is not necessarily among the
cropped layers (the current selected layers).
HELP
&std_pdb_misc;
@ -157,13 +164,13 @@ CODE
"gimp-intl.h");
@procs = qw(image_autocrop
image_autocrop_layer);
image_autocrop_selected_layers);
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Image Autocrop';
$doc_title = 'gimpimageautocrop';
$doc_short_desc = 'Functions that crop images to a layer.';
$doc_long_desc = 'Functions that crop images to a layer.';
$doc_short_desc = 'Functions that crop images or layers.';
$doc_long_desc = 'Functions that crop images or layers.';
1;