Example usage for android.graphics Path quadTo

List of usage examples for android.graphics Path quadTo

Introduction

In this page you can find the example usage for android.graphics Path quadTo.

Prototype

public void quadTo(float x1, float y1, float x2, float y2) 

Source Link

Document

Add a quadratic bezier from the last point, approaching control point (x1,y1), and ending at (x2,y2).

Usage

From source file:Main.java

public static void computeCircleSucSymbolPath(RectF contentRect, int sideLength, Path successSymbolPath) {
    successSymbolPath.moveTo(contentRect.left + sideLength * 0.24f, contentRect.top + sideLength * 0.47f);

    successSymbolPath.quadTo(contentRect.left + sideLength * 0.24f, contentRect.top + sideLength * 0.47f,
            contentRect.left + sideLength * 0.44f, contentRect.top + sideLength * 0.68f);

    successSymbolPath.quadTo(contentRect.left + sideLength * 0.44f, contentRect.top + sideLength * 0.68f,
            contentRect.left + sideLength * 0.73f, contentRect.top + sideLength * 0.35f);
}

From source file:Main.java

public static void computeCircleFailedSymbolPath(RectF contentRect, int sideLength, Path failedSymbolPath1,
        Path failedSymbolPath2) {
    float padding = sideLength * 0.3f;
    failedSymbolPath1.moveTo(contentRect.left + padding, contentRect.top + padding);
    failedSymbolPath1.quadTo(contentRect.left + padding, contentRect.top + padding, contentRect.right - padding,
            contentRect.bottom - padding);

    failedSymbolPath2.moveTo(contentRect.right - padding, contentRect.top + padding);
    failedSymbolPath2.quadTo(contentRect.right - padding, contentRect.top + padding, contentRect.left + padding,
            contentRect.bottom - padding);
}

From source file:Main.java

public static Path createCommentShape(int x, int y, int width, int height, boolean no_bottom) {
    Path gp = new Path();
    int arc = 4;/*w  w w . ja  v a2s  . c  o  m*/

    if (no_bottom == true) {
        gp.moveTo(0, height);
        gp.lineTo(0, 5 + arc);
    } else {
        gp.moveTo(0, 5 + arc);
    }

    gp.quadTo(0, 5, arc, 5);
    gp.lineTo(15, 5);
    gp.lineTo(20, 0);
    gp.lineTo(25, 5);
    gp.lineTo(width - arc, 5);
    gp.quadTo(width, 5, width, 5 + arc);
    gp.lineTo(width, height - arc);

    if (no_bottom) {
        gp.lineTo(width, height);
    } else {
        gp.quadTo(width, height, width - arc, height);
        gp.lineTo(arc, height);
        gp.quadTo(0, height, 0, height - arc);
        gp.lineTo(0, 5 + arc);
    }

    return gp;
}

From source file:Main.java

private static void arcQuadTo(Path pathForTurn, double angle, float radius, double angle2, float radius2,
        float proc, float cx, float cy) {
    float X = getProjX(angle, cx, cy, radius);
    float Y = getProjY(angle, cx, cy, radius);
    float X2 = getProjX(angle2, cx, cy, radius2);
    float Y2 = getProjY(angle2, cx, cy, radius2);
    pathForTurn.quadTo(X, Y, X2 * proc + X * (1 - proc), Y2 * proc + Y * (1 - proc));
}

From source file:Main.java

private static void arcQuadTo(Path pathForTurn, double angle0, float radius0, double angle, float radius,
        double angle2, float radius2, float dl, float cx, float cy) {
    float X0 = getProjX(angle0, cx, cy, radius0);
    float Y0 = getProjY(angle0, cx, cy, radius0);
    float X = getProjX(angle, cx, cy, radius);
    float Y = getProjY(angle, cx, cy, radius);
    float X2 = getProjX(angle2, cx, cy, radius2);
    float Y2 = getProjY(angle2, cx, cy, radius2);
    float l2 = (float) Math.sqrt((X - X2) * (X - X2) + (Y - Y2) * (Y - Y2));
    float l0 = (float) Math.sqrt((X - X0) * (X - X0) + (Y - Y0) * (Y - Y0));
    float proc2 = (float) (dl / l2);
    float proc = (float) (dl / l0);
    pathForTurn.lineTo(X0 * proc + X * (1 - proc), Y0 * proc + Y * (1 - proc));
    pathForTurn.quadTo(X, Y, X2 * proc2 + X * (1 - proc2), Y2 * proc2 + Y * (1 - proc2));
}

From source file:android.support.graphics.drawable.PathInterpolatorCompat.java

private void initQuad(float controlX, float controlY) {
    Path path = new Path();
    path.moveTo(0, 0);/*  w  w  w.  j ava  2s . c  o  m*/
    path.quadTo(controlX, controlY, 1f, 1f);
    initPath(path);
}

From source file:com.imczy.customactivitytransition.transition.ShareElemReturnChangePosition.java

public ShareElemReturnChangePosition() {
    setPathMotion(new PathMotion() {
        @Override/*from w w w .  j ava2 s . c o m*/
        public Path getPath(float startX, float startY, float endX, float endY) {
            Path path = new Path();
            path.moveTo(startX, startY);

            float controlPointX = (startX + endX) / 3;
            float controlPointY = (startY + endY) / 2;

            path.quadTo(controlPointX, controlPointY, endX, endY);
            return path;
        }
    });
}

From source file:com.imczy.customactivitytransition.transition.ChangePosition.java

public ChangePosition() {
    // ? ???//from  w w  w  .  j a  v  a2s  . com
    setPathMotion(new PathMotion() {
        @Override
        public Path getPath(float startX, float startY, float endX, float endY) {
            Path path = new Path();
            path.moveTo(startX, startY);

            float controlPointX = (startX + endX) / 3;
            float controlPointY = (startY + endY) / 2;

            // ??, (controlPointX, controlPointY) 
            path.quadTo(controlPointX, controlPointY, endX, endY);
            return path;
        }
    });
}

From source file:andoridhost.imczy.com.activitymaterial.custom.ReturnChangePosition.java

public ReturnChangePosition() {
    setPathMotion(new PathMotion() {
        @Override/*from   w w w  .j a  v a2  s  .co m*/
        public Path getPath(float startX, float startY, float endX, float endY) {
            Path path = new Path();
            path.moveTo(startX, startY);

            Log.d(TAG, "getPath() called with: " + "startX = [" + startX + "], startY = [" + startY
                    + "], endX = [" + endX + "], endY = [" + endY + "]");

            float controlPointX = (startX + endX) / 3;
            float controlPointY = (startY + endY) / 2;

            path.quadTo(controlPointX, controlPointY, endX, endY);
            return path;
        }
    });
}

From source file:andoridhost.imczy.com.activitymaterial.custom.ChangePosition.java

public ChangePosition() {
    setPathMotion(new PathMotion() {
        @Override/*from w w w  .jav a2s. c  o m*/
        public Path getPath(float startX, float startY, float endX, float endY) {
            Path path = new Path();
            path.moveTo(startX, startY);

            Log.d(TAG, "getPath() called with: " + "startX = [" + startX + "], startY = [" + startY
                    + "], endX = [" + endX + "], endY = [" + endY + "]");

            float controlPointX = (startX + endX) / 3;
            float controlPointY = (startY + endY) / 2;

            path.quadTo(controlPointX, controlPointY, endX, endY);
            return path;
        }
    });
}