Code example for Path

Methods: addCirclelineTomoveToquadToreset

0
     * ---------------------------------------------------------- Private 
     * methods --------------------------------------------------------- 
     */ 
 
    private void touchDown(float x, float y) {
        mPath.reset();
        mPath.moveTo(x, y);
        curX = x;
        curY = y;
        origCurX = curX;
        origCurY = curY;
    } 
 
    private void touchMove(float x, float y) {
        float dx = Math.abs(x - curX);
        float dy = Math.abs(y - curY);
        if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) {
            mPath.quadTo(curX, curY, (x + curX) / 2, (y + curY) / 2);
            curX = x;
            curY = y;
        } 
    } 
 
    private void touchUp() { 
        if (curX == origCurX && curY == origCurY) {
            Log.i("SignatureView", "Draw a dot 2 pixels wide");
            mPath.addCircle(curX, curY, 2, Path.Direction.CW);
        } else { 
            mPath.lineTo(curX, curY);
        } 
        if (mCanvas == null) {
            mCanvas = new Canvas();
            mCanvas.setBitmap(mBitmap);
        } 
        mCanvas.drawPath(mPath, mPaint);
        this.signed = true;
        mPath.reset();
    } 
 
    static class SavedState extends BaseSavedState
    { 
        int stateToSave;