Path reset - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Path reset method.

This code example shows how to use the following methods:close, computeBounds, lineTo, moveTo, quadTo
 
    /** 
     * Updates the internal data required to draw. 
     */ 
    private void update() { 
        mPath.reset();
        mPath.moveTo(mX1, mY1);
        mPath.quadTo(mCtrlx, mCtrly, mX2, mY2);
         
        mPath.computeBounds(rectBuffer, false);
        mRegion = new Region((int)rectBuffer.left, (int)rectBuffer.top, (int)rectBuffer.right, (int)rectBuffer.bottom);
         
        mPath.lineTo(mX2 + 1, mY2);
        mPath.quadTo(mCtrlx + 1, mCtrly, mX1 + 1, mY1);
        mPath.close();
         
        mRegion.setPath(mPath, mRegion);
    } 
     
    /** 
8
CodeRank
This code example shows how to use the following methods:close, computeBounds, cubicTo, lineTo, moveTo
 
    /** 
     * Updates the internal data required to draw. 
     */ 
    private void update() { 
        mPath.reset();
        mPath.moveTo(mX1, mY1);
        mPath.cubicTo(mCtrlx1, mCtrly1, mCtrlx2, mCtrly2, mX2, mY2);
         
        RectF rect = new RectF();
        mPath.computeBounds(rect, false);
        mRegion = new Region((int)rect.left, (int)rect.top, (int)rect.right, (int)rect.bottom);
        regionBuffer.set(mRegion);
         
        mPath.lineTo(mX2 + 1, mY2);
        mPath.cubicTo(mCtrlx2 + 1, mCtrly2, mCtrlx1 + 1, mCtrly1, mX1 + 1, mY1);
        mPath.close();
 
        mRegion.setPath(mPath, mRegion);
    } 

8
CodeRank
This code example shows how to use the following methods:lineTo, moveTo, reset
            // paint.setColor(0xff00ff00); 
            paint.setColor(AppSettings.get().getCurrentBorderColor());
            paint.setStrokeWidth(1F);
            paint.setStyle(Paint.Style.STROKE);
 
            path.reset();
            path.moveTo(l, b);
            path.lineTo(l, t + mAvatar.getFarOffset());
            c.drawPath(path, paint);
 
            path.reset();
            path.moveTo(l, t);
            path.lineTo(l, t + mAvatar.getCloseOffset());
            c.drawPath(path, paint);
 
        } else { 
            super.dispatchDraw(c);
        } 
    } 
} 
7
CodeRank
This code example shows how to use the following methods:addArc, reset
This code example shows how to use the following methods:close, lineTo, moveTo, reset
    } 
 
    @Override 
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        if (changed) {
            mPath.reset();
            mPath.moveTo(0, getHeight());
            mPath.lineTo(getWidth(), getHeight() / 2);
            mPath.lineTo(0, 0);
            mPath.close();
        } 
        super.onLayout(changed, left, top, right, bottom);
    } 
 
    @Override 
    protected void onDraw(Canvas canvas) {
        canvas.drawPath(mPath, mPaint);
        super.onDraw(canvas);
    } 
 
7
CodeRank
This code example shows how to use the following methods:arcTo, close, lineTo, reset
     */ 
    public ArcShape(float x, float y, float width, float height, float startAngle, float angleExtent, boolean useCenter) {
        this.mOval = new RectF(x, y, x + width, y + height);
        this.mStartAngle = startAngle;
        this.mAngleExtent = angleExtent;
        this.mPath = new Path();
        this.mStartPoint = new PointF();
        this.mEndPoint = new PointF();
        this.mUseCenter = useCenter;
        this.mRegion = new Region();
        update(); 
    } 
 
    /** 
     * Creates a new arc shap from specified location, size, double angles, and useCenter values. 
     * @param x The x-coordinate of upper-left corner of the arc 
     * @param y The y-coordinate of upper-left corner of the arc 
     * @param width The overall width of the full oval of which this arc is a partial section 
     * @param height The overall height of the full oval of which this arc is a partial section 
     * @param startAngle The starting angle of the arc in degrees 

7
CodeRank
This code example shows how to use the following methods:lineTo, moveTo, reset
            // paint.setColor(0xff00ff00); 
            paint.setColor(AppSettings.get().getCurrentBorderColor());
            paint.setStrokeWidth(1F);
            paint.setStyle(Paint.Style.STROKE);
 
            path.reset();
            path.moveTo(l, b);
            path.lineTo(l, t + mAvatar.getFarOffset());
            c.drawPath(path, paint);
 
            path.reset();
            path.moveTo(l, t);
            path.lineTo(l, t + mAvatar.getCloseOffset());
            c.drawPath(path, paint);
 
        } else { 
            super.dispatchDraw(c);
        } 
    } 
} 
7
CodeRank
This code example shows how to use the following methods:close, reset, set
        mRegion = new Region((int) rect.left, (int) rect.top, (int) rect.right, (int) rect.bottom);
        mRegion.setPath(mClosedTempPath, mRegion);
    } 
 
    private void updateTempPath() { 
        mClosedTempPath.reset();
        mClosedTempPath.set(mPath);
        mClosedTempPath.close();
    } 
 
    /** 
     * {@inheritDoc} 
     */ 
    @Override 
    public Shape clone() {
        return new Polygon(this);
    } 
     
    /** 
     * {@inheritDoc} 
7
CodeRank
This code example shows how to use the following methods:arcTo, close, moveTo, reset
 
		super.onSizeChanged(w, h, oldw, oldh);
	} 
 
	private void updatePath(final int w, final int h) {
		path.reset();
 
		if (progress == 0) {
			path.close();
		} else if (progress < maxProgress) {
			final float angle = progress * 360 / maxProgress;
 
			path.moveTo(w / 2f, h / 2f);
			path.arcTo(new RectF(1, 1, w - 1, h - 1), 270, angle);
			path.close();
		} else { 
			path.addCircle(w / 2f, h / 2f, (w / 2f) - 1, Direction.CW);
		} 
	} 
 
7
CodeRank
This code example shows how to use the following methods:addOval, reset
     * @param width The width of the bounding rectangle 
     * @param height The height of the bounding rectangle 
     */ 
    public OvalShape(float x, float y, float width, float height) {
        mOval = new RectF(x, y, x + width, y + height);
        mPath = new Path();
        update(); 
    } 
 
    /** 
     * Creates new oval shape from specified double location and double size. 
     * @param x The x-coordinates of the bounding rectangle 
     * @param y The x-coordinates of the bounding rectangle 
     * @param width The width of the bounding rectangle 
     * @param height The height of the bounding rectangle 
     */ 
    public OvalShape(double x, double y, double width, double height) {
        mOval = new RectF((float)x, (float)y, (float)(x + width), (float)(y + height));
        mPath = new Path();
        update(); 

7
CodeRank

Related Path reset Questions & Answers:

reset Method Overview
Clear any lines and curves from the path, making it empty.
See Code Examples for other Android Path Methods: