Example usage for android.graphics PathMeasure setPath

List of usage examples for android.graphics PathMeasure setPath

Introduction

In this page you can find the example usage for android.graphics PathMeasure setPath.

Prototype

public void setPath(Path path, boolean forceClosed) 

Source Link

Document

Assign a new path, or null to have none.

Usage

From source file:android.support.wear.widget.util.ArcSwipe.java

private float[][] interpolate(float[] start, float[] end, int steps, boolean isClockwise) {
    float startAngle = getAngle(start[0], start[1]);
    float endAngle = getAngle(end[0], end[1]);

    Path path = new Path();
    PathMeasure pathMeasure = new PathMeasure();
    path.moveTo(start[0], start[1]);/*from  w w  w  .  ja v  a  2s . co m*/
    path.arcTo(mBounds, startAngle, getSweepAngle(startAngle, endAngle, isClockwise));
    pathMeasure.setPath(path, false);
    float pathLength = pathMeasure.getLength();

    float[][] res = new float[steps][2];
    float[] mPathTangent = new float[2];

    for (int i = 1; i < steps + 1; i++) {
        pathMeasure.getPosTan((pathLength * i) / (steps + 2f), res[i - 1], mPathTangent);
    }

    return res;
}

From source file:de.uni_weimar.mheinz.androidtouchscope.display.ScopeView.java

private int channelOnCount() {
    int count = 0;

    PathMeasure measure = new PathMeasure(mPathChan1, false);
    count += measure.getLength() > 0 ? 1 : 0;
    measure.setPath(mPathChan2, false);
    count += measure.getLength() > 0 ? 1 : 0;

    return count;
}