pdb, libgimpbase: Rename GIMP_VECTORS_STROKE_TYPE...

...to GIMP_PATH_STROKE_TYPE as part of
the GimpVectors -> GimpPath API
update.
This commit is contained in:
Alx Sa 2024-07-19 15:07:43 +00:00
parent 3fbfb21cff
commit d701b70336
15 changed files with 189 additions and 190 deletions

View File

@ -685,7 +685,7 @@ path_stroke_get_points_invoker (GimpProcedure *procedure,
num_points = points_array->len;
controlpoints = g_new (gdouble, num_points * 2);
type = GIMP_VECTORS_STROKE_TYPE_BEZIER;
type = GIMP_PATH_STROKE_TYPE_BEZIER;
for (i = 0; i < num_points; i++)
{
controlpoints[2*i] = g_array_index (points_array,
@ -749,7 +749,7 @@ path_stroke_new_from_points_invoker (GimpProcedure *procedure,
success = FALSE;
if (type == GIMP_VECTORS_STROKE_TYPE_BEZIER &&
if (type == GIMP_PATH_STROKE_TYPE_BEZIER &&
num_points % 6 == 0)
{
coords = g_new (GimpCoords, num_points/2);
@ -1933,9 +1933,9 @@ register_path_procs (GimpPDB *pdb)
gimp_procedure_add_return_value (procedure,
g_param_spec_enum ("type",
"type",
"type of the stroke (always GIMP_VECTORS_STROKE_TYPE_BEZIER for now).",
GIMP_TYPE_VECTORS_STROKE_TYPE,
GIMP_VECTORS_STROKE_TYPE_BEZIER,
"type of the stroke (always GIMP_PATH_STROKE_TYPE_BEZIER for now).",
GIMP_TYPE_PATH_STROKE_TYPE,
GIMP_PATH_STROKE_TYPE_BEZIER,
GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure,
g_param_spec_int ("num-points",
@ -1965,7 +1965,7 @@ register_path_procs (GimpPDB *pdb)
"gimp-path-stroke-new-from-points");
gimp_procedure_set_static_help (procedure,
"Adds a stroke of a given type to the path object.",
"Adds a stroke of a given type to the path object. The coordinates of the control points can be specified. For now only strokes of the type GIMP_VECTORS_STROKE_TYPE_BEZIER are supported. The control points are specified as a pair of float values for the x- and y-coordinate. The Bezier stroke type needs a multiple of three control points. Each Bezier segment endpoint (anchor, A) has two additional control points (C) associated. They are specified in the order CACCACCAC...",
"Adds a stroke of a given type to the path object. The coordinates of the control points can be specified. For now only strokes of the type GIMP_PATH_STROKE_TYPE_BEZIER are supported. The control points are specified as a pair of float values for the x- and y-coordinate. The Bezier stroke type needs a multiple of three control points. Each Bezier segment endpoint (anchor, A) has two additional control points (C) associated. They are specified in the order CACCACCAC...",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Simon Budig",
@ -1980,9 +1980,9 @@ register_path_procs (GimpPDB *pdb)
gimp_procedure_add_argument (procedure,
g_param_spec_enum ("type",
"type",
"type of the stroke (always GIMP_VECTORS_STROKE_TYPE_BEZIER for now).",
GIMP_TYPE_VECTORS_STROKE_TYPE,
GIMP_VECTORS_STROKE_TYPE_BEZIER,
"type of the stroke (always GIMP_PATH_STROKE_TYPE_BEZIER for now).",
GIMP_TYPE_PATH_STROKE_TYPE,
GIMP_PATH_STROKE_TYPE_BEZIER,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
g_param_spec_int ("num-points",

View File

@ -29,14 +29,14 @@
GimpStroke *
gimp_stroke_new_from_coords (GimpVectorsStrokeType type,
gimp_stroke_new_from_coords (GimpPathStrokeType type,
const GimpCoords *coords,
gint n_coords,
gboolean closed)
{
switch (type)
{
case GIMP_VECTORS_STROKE_TYPE_BEZIER:
case GIMP_PATH_STROKE_TYPE_BEZIER:
return gimp_bezier_stroke_new_from_coords (coords, n_coords, closed);
break;
default:

View File

@ -18,14 +18,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __GIMP_VECTORS_NEW_H__
#define __GIMP_VECTORS_NEW_H__
#ifndef __GIMP_STROKE_NEW_H__
#define __GIMP_STROKE_NEW_H__
GimpStroke * gimp_stroke_new_from_coords (GimpVectorsStrokeType type,
GimpStroke * gimp_stroke_new_from_coords (GimpPathStrokeType type,
const GimpCoords *coords,
gint n_coords,
gboolean closed);
#endif /* __GIMP_VECTORS_NEW_H__ */
#endif /* __GIMP_STROKE_NEW_H__ */

View File

@ -47,6 +47,7 @@ static const GimpGetTypeFunc get_type_funcs[] =
gimp_pdb_proc_type_get_type,
gimp_pdb_status_type_get_type,
gimp_paint_application_mode_get_type,
gimp_path_stroke_type_get_type,
gimp_precision_get_type,
gimp_progress_command_get_type,
gimp_repeat_mode_get_type,
@ -61,8 +62,7 @@ static const GimpGetTypeFunc get_type_funcs[] =
gimp_text_justification_get_type,
gimp_transfer_mode_get_type,
gimp_transform_direction_get_type,
gimp_transform_resize_get_type,
gimp_vectors_stroke_type_get_type
gimp_transform_resize_get_type
};
static const gchar * const type_names[] =
@ -111,6 +111,7 @@ static const gchar * const type_names[] =
"GimpPDBProcType",
"GimpPDBStatusType",
"GimpPaintApplicationMode",
"GimpPathStrokeType",
"GimpPrecision",
"GimpProgressCommand",
"GimpRepeatMode",
@ -125,8 +126,7 @@ static const gchar * const type_names[] =
"GimpTextJustification",
"GimpTransferMode",
"GimpTransformDirection",
"GimpTransformResize",
"GimpVectorsStrokeType"
"GimpTransformResize"
};
static gboolean enums_initialized = FALSE;

View File

@ -672,11 +672,11 @@ gimp_path_stroke_flip_free (GimpPath *path,
* this is always a bezier stroke, where the coordinates are the
* control points.
*
* Returns: type of the stroke (always GIMP_VECTORS_STROKE_TYPE_BEZIER for now).
* Returns: type of the stroke (always GIMP_PATH_STROKE_TYPE_BEZIER for now).
*
* Since: 2.4
**/
GimpVectorsStrokeType
GimpPathStrokeType
gimp_path_stroke_get_points (GimpPath *path,
gint stroke_id,
gint *num_points,
@ -685,7 +685,7 @@ gimp_path_stroke_get_points (GimpPath *path,
{
GimpValueArray *args;
GimpValueArray *return_vals;
GimpVectorsStrokeType type = 0;
GimpPathStrokeType type = 0;
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_PATH, path,
@ -715,7 +715,7 @@ gimp_path_stroke_get_points (GimpPath *path,
/**
* gimp_path_stroke_new_from_points:
* @path: The path object.
* @type: type of the stroke (always GIMP_VECTORS_STROKE_TYPE_BEZIER for now).
* @type: type of the stroke (always GIMP_PATH_STROKE_TYPE_BEZIER for now).
* @num_points: The number of elements in the array, i.e. the number of controlpoints in the stroke * 2 (x- and y-coordinate).
* @controlpoints: (array length=num_points) (element-type gdouble): List of the x- and y-coordinates of the control points.
* @closed: Whether the stroke is to be closed or not.
@ -724,12 +724,11 @@ gimp_path_stroke_get_points (GimpPath *path,
*
* Adds a stroke of a given type to the path object. The coordinates of
* the control points can be specified. For now only strokes of the
* type GIMP_VECTORS_STROKE_TYPE_BEZIER are supported. The control
* points are specified as a pair of float values for the x- and
* y-coordinate. The Bezier stroke type needs a multiple of three
* control points. Each Bezier segment endpoint (anchor, A) has two
* additional control points (C) associated. They are specified in the
* order CACCACCAC...
* type GIMP_PATH_STROKE_TYPE_BEZIER are supported. The control points
* are specified as a pair of float values for the x- and y-coordinate.
* The Bezier stroke type needs a multiple of three control points.
* Each Bezier segment endpoint (anchor, A) has two additional control
* points (C) associated. They are specified in the order CACCACCAC...
*
* Returns: The stroke ID of the newly created stroke.
*
@ -737,7 +736,7 @@ gimp_path_stroke_get_points (GimpPath *path,
**/
gint
gimp_path_stroke_new_from_points (GimpPath *path,
GimpVectorsStrokeType type,
GimpPathStrokeType type,
gint num_points,
const gdouble *controlpoints,
gboolean closed)
@ -748,7 +747,7 @@ gimp_path_stroke_new_from_points (GimpPath *path,
args = gimp_value_array_new_from_types (NULL,
GIMP_TYPE_PATH, path,
GIMP_TYPE_VECTORS_STROKE_TYPE, type,
GIMP_TYPE_PATH_STROKE_TYPE, type,
G_TYPE_INT, num_points,
GIMP_TYPE_FLOAT_ARRAY, NULL,
G_TYPE_BOOLEAN, closed,

View File

@ -79,13 +79,13 @@ gboolean gimp_path_stroke_flip_free (GimpPath
gdouble y1,
gdouble x2,
gdouble y2);
GimpVectorsStrokeType gimp_path_stroke_get_points (GimpPath *path,
GimpPathStrokeType gimp_path_stroke_get_points (GimpPath *path,
gint stroke_id,
gint *num_points,
gdouble **controlpoints,
gboolean *closed);
gint gimp_path_stroke_new_from_points (GimpPath *path,
GimpVectorsStrokeType type,
GimpPathStrokeType type,
gint num_points,
const gdouble *controlpoints,
gboolean closed);

View File

@ -154,6 +154,7 @@ EXPORTS
gimp_path_free
gimp_path_get_user_writable_dir
gimp_path_parse
gimp_path_stroke_type_get_type
gimp_path_to_str
gimp_pdb_error_handler_get_type
gimp_pdb_proc_type_get_type
@ -246,7 +247,6 @@ EXPORTS
gimp_value_take_float_array
gimp_value_take_int32_array
gimp_value_take_object_array
gimp_vectors_stroke_type_get_type
gimp_wire_clear_error
gimp_wire_destroy
gimp_wire_error

View File

@ -1898,17 +1898,17 @@ gimp_transform_resize_get_type (void)
}
GType
gimp_vectors_stroke_type_get_type (void)
gimp_path_stroke_type_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_VECTORS_STROKE_TYPE_BEZIER, "GIMP_VECTORS_STROKE_TYPE_BEZIER", "bezier" },
{ GIMP_PATH_STROKE_TYPE_BEZIER, "GIMP_PATH_STROKE_TYPE_BEZIER", "bezier" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_VECTORS_STROKE_TYPE_BEZIER, "GIMP_VECTORS_STROKE_TYPE_BEZIER", NULL },
{ GIMP_PATH_STROKE_TYPE_BEZIER, "GIMP_PATH_STROKE_TYPE_BEZIER", NULL },
{ 0, NULL, NULL }
};
@ -1916,9 +1916,9 @@ gimp_vectors_stroke_type_get_type (void)
if (G_UNLIKELY (! type))
{
type = g_enum_register_static ("GimpVectorsStrokeType", values);
type = g_enum_register_static ("GimpPathStrokeType", values);
gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");
gimp_type_set_translation_context (type, "vectors-stroke-type");
gimp_type_set_translation_context (type, "path-stroke-type");
gimp_enum_set_value_descriptions (type, descs);
}

View File

@ -1306,19 +1306,19 @@ typedef enum /*< skip >*/
/**
* GimpVectorsStrokeType:
* @GIMP_VECTORS_STROKE_TYPE_BEZIER: A bezier stroke
* GimpPathStrokeType:
* @GIMP_PATH_STROKE_TYPE_BEZIER: A bezier stroke
*
* Possible type of strokes in vectors objects.
* Possible type of strokes in path objects.
**/
#define GIMP_TYPE_VECTORS_STROKE_TYPE (gimp_vectors_stroke_type_get_type ())
#define GIMP_TYPE_PATH_STROKE_TYPE (gimp_path_stroke_type_get_type ())
GType gimp_vectors_stroke_type_get_type (void) G_GNUC_CONST;
GType gimp_path_stroke_type_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_VECTORS_STROKE_TYPE_BEZIER
} GimpVectorsStrokeType;
GIMP_PATH_STROKE_TYPE_BEZIER
} GimpPathStrokeType;
G_END_DECLS

View File

@ -434,14 +434,14 @@ In some cases you will want a function which returns an array or a
function which receives an array. Array arguments are specified in a
special way which is a bit different than the other arguments. To see
how array arguments are specified, let's take a look at the +@outargs+
of +vectors_stroke_get_points+ from
https://gitlab.gnome.org/GNOME/gimp/tree/master/pdb/groups/vectors.pdb[pdb/groups/vectors.pdb]:
of +path_stroke_get_points+ from
https://gitlab.gnome.org/GNOME/gimp/tree/master/pdb/groups/path.pdb[pdb/groups/path.pdb]:
[source,perl]
----
@outargs = (
{ name => 'type', type => 'enum GimpVectorsStrokeType',
desc => 'type of the stroke (always GIMP_VECTORS_STROKE_TYPE_BEZIER for now).' },
{ name => 'type', type => 'enum GimpPathStrokeType',
desc => 'type of the stroke (always GIMP_PATH_STROKE_TYPE_BEZIER for now).' },
{ name => 'controlpoints', type => 'floatarray',
desc => 'List of the control points for the stroke (x0, y0, x1, y1, ...).',
array => { name => 'num_points',

View File

@ -630,11 +630,11 @@ package Gimp::CodeGen::enums;
GIMP_UNIT_PICA => '4',
GIMP_UNIT_END => '5' }
},
GimpVectorsStrokeType =>
GimpPathStrokeType =>
{ contig => 1,
header => 'libgimpbase/gimpbaseenums.h',
symbols => [ qw(GIMP_VECTORS_STROKE_TYPE_BEZIER) ],
mapping => { GIMP_VECTORS_STROKE_TYPE_BEZIER => '0' }
symbols => [ qw(GIMP_PATH_STROKE_TYPE_BEZIER) ],
mapping => { GIMP_PATH_STROKE_TYPE_BEZIER => '0' }
},
GimpColorManagementMode =>
{ contig => 1,

View File

@ -633,8 +633,8 @@ HELP
);
@outargs = (
{ name => 'type', type => 'enum GimpVectorsStrokeType',
desc => 'type of the stroke (always GIMP_VECTORS_STROKE_TYPE_BEZIER for now).' },
{ name => 'type', type => 'enum GimpPathStrokeType',
desc => 'type of the stroke (always GIMP_PATH_STROKE_TYPE_BEZIER for now).' },
{ name => 'controlpoints', type => 'floatarray',
desc => 'List of the control points for the stroke (x0, y0, x1, y1, ...).',
array => { name => 'num_points',
@ -660,7 +660,7 @@ HELP
num_points = points_array->len;
controlpoints = g_new (gdouble, num_points * 2);
type = GIMP_VECTORS_STROKE_TYPE_BEZIER;
type = GIMP_PATH_STROKE_TYPE_BEZIER;
for (i = 0; i < num_points; i++)
{
controlpoints[2*i] = g_array_index (points_array,
@ -751,7 +751,7 @@ sub path_stroke_new_from_points {
$help = <<'HELP';
Adds a stroke of a given type to the path object. The coordinates of the
control points can be specified.
For now only strokes of the type GIMP_VECTORS_STROKE_TYPE_BEZIER are supported.
For now only strokes of the type GIMP_PATH_STROKE_TYPE_BEZIER are supported.
The control points are specified as a pair of float values for the x- and
y-coordinate.
The Bezier stroke type needs a multiple of three control points. Each Bezier
@ -764,8 +764,8 @@ HELP
@inargs = (
{ name => 'path', type => 'path',
desc => 'The path object' },
{ name => 'type', type => 'enum GimpVectorsStrokeType',
desc => 'type of the stroke (always GIMP_VECTORS_STROKE_TYPE_BEZIER for now).' },
{ name => 'type', type => 'enum GimpPathStrokeType',
desc => 'type of the stroke (always GIMP_PATH_STROKE_TYPE_BEZIER for now).' },
{ name => 'controlpoints', type => 'floatarray',
desc => 'List of the x- and y-coordinates of the control points.',
array => { name => 'num_points',
@ -791,7 +791,7 @@ HELP
success = FALSE;
if (type == GIMP_VECTORS_STROKE_TYPE_BEZIER &&
if (type == GIMP_PATH_STROKE_TYPE_BEZIER &&
num_points % 6 == 0)
{
coords = g_new (GimpCoords, num_points/2);

View File

@ -1225,7 +1225,7 @@ save_paths (GOutputStream *output,
for (s = 0; s < num_strokes; s++)
{
GimpVectorsStrokeType type;
GimpPathStrokeType type;
gdouble *points;
gint num_points;
gboolean closed;
@ -1234,7 +1234,7 @@ save_paths (GOutputStream *output,
type = gimp_path_stroke_get_points (iter->data, strokes[s],
&num_points, &points, &closed);
if (type != GIMP_VECTORS_STROKE_TYPE_BEZIER ||
if (type != GIMP_PATH_STROKE_TYPE_BEZIER ||
num_points > 65535 ||
num_points % 6)
{

View File

@ -1704,7 +1704,7 @@ load_resource_2000 (const PSDimageres *res_a,
}
/* Add sub-path */
gimp_path_stroke_new_from_points (path,
GIMP_VECTORS_STROKE_TYPE_BEZIER,
GIMP_PATH_STROKE_TYPE_BEZIER,
cntr, controlpoints, closed);
g_free (controlpoints);
}

View File

@ -183,7 +183,7 @@ save_paths (TIFF *tif,
for (s = 0; s < num_strokes; s++)
{
GimpVectorsStrokeType type;
GimpPathStrokeType type;
gdouble *points;
gint num_points;
gboolean closed;
@ -192,7 +192,7 @@ save_paths (TIFF *tif,
type = gimp_path_stroke_get_points (iter->data, strokes[s],
&num_points, &points, &closed);
if (type != GIMP_VECTORS_STROKE_TYPE_BEZIER ||
if (type != GIMP_PATH_STROKE_TYPE_BEZIER ||
num_points > 65535 ||
num_points % 6)
{