app, libgimp, pdb: improve gimp_vectors_stroke_get_length() docs.

The `precision` parameter in particular had no min/max, which meant we
could provide a forbidden parameter (e.g. a negative precision) which
would cause a core CRITICAL. We must forbid illegal values from PDB side
(hence outputting a normal plug-in error message, not a core bug).

Also improving a bit the description of this parameter as I was
wondering what precision was needed exactly to get a stroke length. This
is the precision for determining whether a portion of the stroke is
"straight enough" or if we want to break it into smaller pieces until we
get a straight portion.
This commit is contained in:
Jehan 2021-01-20 20:33:41 +01:00
parent e813d90fbb
commit fee221167c
3 changed files with 5 additions and 5 deletions

View File

@ -1499,8 +1499,8 @@ register_vectors_procs (GimpPDB *pdb)
gimp_procedure_add_argument (procedure,
g_param_spec_double ("precision",
"precision",
"The precision used for the approximation",
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
"The precision used for approximating straight portions of the stroke",
0.0, G_MAXDOUBLE, 0.1,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_double ("length",

View File

@ -202,7 +202,7 @@ gimp_vectors_get_strokes (GimpVectors *vectors,
* gimp_vectors_stroke_get_length:
* @vectors: The vectors object.
* @stroke_id: The stroke ID.
* @precision: The precision used for the approximation.
* @precision: The precision used for approximating straight portions of the stroke.
*
* Measure the length of the given stroke.
*

View File

@ -179,8 +179,8 @@ sub vectors_stroke_get_length {
desc => 'The vectors object' },
{ name => 'stroke_id', type => 'int32',
desc => 'The stroke ID' },
{ name => 'precision', type => 'float',
desc => 'The precision used for the approximation' }
{ name => 'precision', type => '0.0 <= float', default => 0.1,
desc => 'The precision used for approximating straight portions of the stroke' }
);
@outargs = (