android.graphics.Path#rMoveTo ( )源码实例Demo

下面列出了android.graphics.Path#rMoveTo ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: VideoOS-Android-SDK   文件: SVGAPath.java
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();
    }

}