【发布时间】:2017-10-11 15:31:24
【问题描述】:
有没有办法在 UWP 应用程序中沿 Path 几何图形找到 x% 的 Point?在 WPF 中,这可以使用:
var path = new Path { Data = Geometry.Parse(svgLikePathString) };
var flattened = path.Data.GetFlattenedGeometry();
// e.g. x = 0.5 for 50% along the path
flattened.GetPointAtFractionLength(x, out Point point, out Point tangent);
上下文 我正在将基于 WPF 的应用程序转换为 UWP,我可以在其中显示来自同一点数组的不同路径,有点像 https://bl.ocks.org/mbostock/4342190。在 UWP 中,我可以使用this approach 替换Geometry.Parse(string),但是Geometry 上不再存在path.Data.GetFlattenedGeometry() 和GetPointAtFractionLength()。
【问题讨论】:
-
UWP 不支持
GetFlattenedGeometry()和GetPointAtFractionLength()。您可以考虑直接通过Desktop Bridge 将您的 WPF 应用程序转换为 UWP。 -
谢谢。是的,在这个阶段,我已经设法使用 SkiaSharp 进行路径操作获得了一个可行的解决方案。我认为这将是我的解决方案。