use of android.graphics.PathMeasure in project MaterialCalendar by Haoxiqiang.
the class WeatherTemplateView method getPoints.
protected PathPoints[] getPoints(Path path, int size) {
// Size of 100 indicates that, 100 points
// would be extracted from the path
PathPoints[] pointArray = new PathPoints[size];
PathMeasure pm = new PathMeasure(path, false);
float length = pm.getLength();
float distance = 0f;
float speed = length / size;
int counter = 0;
float[] aCoordinates = new float[2];
while ((distance < length) && (counter < size)) {
pm.getPosTan(distance, aCoordinates, null);
pointArray[counter] = new PathPoints(aCoordinates[0], aCoordinates[1]);
counter++;
distance = distance + speed;
}
return pointArray;
}
use of android.graphics.PathMeasure in project YhLibraryForAndroid by android-coco.
the class LineChartView method setAnim.
// 设置动画
private void setAnim(Canvas canvas) {
PathMeasure measure = new PathMeasure(mPath, false);
float pathLength = measure.getLength();
PathEffect effect = new DashPathEffect(new float[] { pathLength, pathLength }, pathLength - pathLength * mProgress);
mPaintLine.setPathEffect(effect);
canvas.drawPath(mPath, mPaintLine);
}
Aggregations