path-tool: Add length to info output

This requires GskPathMeasure.
This commit is contained in:
Matthias Clasen 2023-08-12 16:32:41 -04:00
parent 32d00ca9ed
commit 81c8d1dd28

View File

@ -89,6 +89,7 @@ do_info (int *argc, const char ***argv)
{ NULL, },
};
GskPath *path;
GskPathMeasure *measure;
graphene_rect_t bounds;
g_set_prgname ("gtk4-path-tool info");
@ -114,6 +115,7 @@ do_info (int *argc, const char ***argv)
}
path = get_path (args[0]);
measure = gsk_path_measure_new (path);
if (gsk_path_is_empty (path))
g_print ("%s\n", _("Path is empty."));
@ -124,6 +126,8 @@ do_info (int *argc, const char ***argv)
if (gsk_path_is_closed (path))
g_print ("%s\n", _("Path is closed"));
g_print ("%s %g\n", _("Path length"), gsk_path_measure_get_length (measure));
if (gsk_path_get_bounds (path, &bounds))
g_print ("%s: %g %g %g %g\n", _("Bounds"),
bounds.origin.x, bounds.origin.y,