Android的路径阵列 - 读取路径上的点? [英] Android path to array - read the points on a path?

查看:664
本文介绍了Android的路径阵列 - 读取路径上的点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法来读取绘制路径时创建的点?看来愚蠢的,我认为一个路径不能读取。

Is there a way to read the points created when drawing a path? It seems silly to me that a path cannot be readable.

还是只是不如手动写入当前手指的位置到一个数组?

Or is it just better to manually write the current finger position to an array?

感谢

推荐答案

你想要的任何路径您可以阅读尽可能多的积分。 示例如何读取路径中间坐标:

You can read as many points as you want from any path. Example how to read coordinates from the middle of path:

    PathMeasure pm = new PathMeasure(myPath, false);
    //coordinates will be here
    float aCoordinates[] = {0f, 0f};

    //get coordinates of the middle point
    pm.getPosTan(pm.getLength() * 0.5f, aCoordinates, null);

您可以通过从路径上的任何距离开始变得点坐标。

You can pass any distance from the path start to get point coordinates.

这篇关于Android的路径阵列 - 读取路径上的点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆