I have an android Path object (created from text: paint.getTextPath(someString, 0, someString.length(), 0f, 0f, myPathObject);)
How can I iterate over path object segments ("move to", "line to", "quad to", etc...) like with PathIterator in awt?
Old question but I wanted it to have the answer
Look at 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());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With