Java Code Examples for android.graphics.Path#rMoveTo()

The following examples show how to use android.graphics.Path#rMoveTo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SVGAPath.java    From VideoOS-Android-SDK with GNU General Public License v3.0 4 votes vote down vote up
private void operate(Path finalPath, String method, StringTokenizer args) {
    float x0 = 0.0f;
    float y0 = 0.0f;
    float x1 = 0.0f;
    float y1 = 0.0f;
    float x2 = 0.0f;
    float y2 = 0.0f;
    try {
        int index = 0;
        while (args.hasMoreTokens()) {
            String s = args.nextToken();
            if (TextUtils.isEmpty(s)) {
                continue;
            }
            if (index == 0) {
                x0 = Float.valueOf(s);
            }
            if (index == 1) {
                y0 = Float.valueOf(s);
            }
            if (index == 2) {
                x1 = Float.valueOf(s);
            }
            if (index == 3) {
                y1 = Float.valueOf(s);
            }
            if (index == 4) {
                x2 = Float.valueOf(s);
            }
            if (index == 5) {
                y2 = Float.valueOf(s);
            }
            index++;
        }
    } catch (Exception e) {
    }
    SVGAPoint currentPoint = new SVGAPoint(0.0f, 0.0f, 0.0f);
    if ("M".equals(method)) {
        finalPath.moveTo(x0, y0);
        currentPoint = new SVGAPoint(x0, y0, 0.0f);
    } else if ("m".equals(method)) {
        finalPath.rMoveTo(x0, y0);
        currentPoint = new SVGAPoint(currentPoint.x + x0, currentPoint.y + y0, 0.0f);
    }
    if ("L".equals(method)) {
        finalPath.lineTo(x0, y0);
    } else if ("l".equals(method)) {
        finalPath.rLineTo(x0, y0);
    }
    if ("C".equals(method)) {
        finalPath.cubicTo(x0, y0, x1, y1, x2, y2);
    } else if ("c".equals(method)) {
        finalPath.rCubicTo(x0, y0, x1, y1, x2, y2);
    }
    if ("Q".equals(method)) {
        finalPath.quadTo(x0, y0, x1, y1);
    } else if ("q".equals(method)) {
        finalPath.rQuadTo(x0, y0, x1, y1);
    }
    if ("H".equals(method)) {
        finalPath.lineTo(x0, currentPoint.y);
    } else if ("h".equals(method)) {
        finalPath.rLineTo(x0, 0f);
    }
    if ("V".equals(method)) {
        finalPath.lineTo(currentPoint.x, x0);
    } else if ("v".equals(method)) {
        finalPath.rLineTo(0f, x0);
    }
    if ("Z".equals(method)) {
        finalPath.close();
    } else if ("z".equals(method)) {
        finalPath.close();
    }

}