【发布时间】:2015-06-27 16:44:51
【问题描述】:
我有一个 android Path 对象(从文本创建:paint.getTextPath(someString, 0, someString.length(), 0f, 0f, myPathObject);)
如何在 awt 中使用 PathIterator 迭代路径对象段(“移动到”、“行到”、“四到”等)?
【问题讨论】:
标签: java android path awt curve
我有一个 android Path 对象(从文本创建:paint.getTextPath(someString, 0, someString.length(), 0f, 0f, myPathObject);)
如何在 awt 中使用 PathIterator 迭代路径对象段(“移动到”、“行到”、“四到”等)?
【问题讨论】:
标签: java android path awt curve
老问题,但我希望它有答案
看android.graphics.PathMeasure API 1
float[] tmpPos = new float[2];
float[] tmpTan = new float[2];
PathMeasure measure = new PathMeasure();
measure.setPath(path, true);
do {
float dist = measure.getLength();
for (float p = 0; p < dist; p += 1) {
measure.getPosTan(p, tmpPos, tmpTan);
float x = tmpPos[0], y = tmpPos[1];
float nx = tmpTan[0], ny = tmpTan[1];
// do your own stuff
}
} while (measure.nextContour());
【讨论】: