Region setPath - top ranked examples from Open Source projects

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

This code example shows how to use the following methods:setPath
        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);
    } 
     
    /** 
     * {@inheritDoc}  
     */ 
    @Override 
    public boolean equals(Object o) {
        if (o instanceof QuadCurveShape) {
6
CodeRank
This code example shows how to use the following methods:setPath
    public void update() { 
        updateTempPath(); 
         
        RectF rect = new RectF();
        mPath.computeBounds(rect, false);
        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() {
6
CodeRank
This code example shows how to use the following methods:setPath
     * Updates the internal data required to draw. 
     */ 
    private void update() { 
        RectF rect = new RectF();
        mPath.computeBounds(rect, false);
        mRegion = new Region((int)rect.left, (int)rect.top, (int)rect.right, (int)rect.bottom);
        mRegion.setPath(mPath, mRegion);
    } 
 
    /** 
     * {@inheritDoc}  
     */ 
    @Override 
    public boolean equals(Object o) {
        if (o instanceof PathShape) {
            PathShape pathShape = (PathShape)o;
            Region region = new Region(this.mRegion);
            if (! region.op(pathShape.mRegion, Op.XOR)) {
                return true; 
            } 
6
CodeRank
This code example shows how to use the following methods:setPath
        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);
    } 
     
    /** 
     * {@inheritDoc}  
     */ 
    @Override 
    public boolean equals(Object o) {
6
CodeRank
This code example shows how to use the following methods:setPath
     * Updates the internal data required to draw. 
     */ 
    private void update() { 
        mPath.reset();
        mPath.addOval(mOval, Direction.CW);
        mRegion = new Region((int)mOval.left, (int)mOval.top, (int) mOval.right, (int) mOval.bottom);
        mRegion.setPath(mPath, mRegion);
    } 
 
 
    /** 
     * {@inheritDoc} 
     */ 
    @Override 
    public boolean equals(Object o) {
        if (o instanceof OvalShape) {
            OvalShape ovalShape = (OvalShape)o;
            if (this.mOval.left == ovalShape.mOval.left &&
                    this.mOval.right == ovalShape.mOval.right &&
                    this.mOval.top == ovalShape.mOval.top &&
6
CodeRank
This code example shows how to use the following methods:setPath
     * Updates the internal data required to draw. 
     */ 
    private void update() { 
        mPath.reset();
        mPath.addRoundRect(mRect, mRX, mRY, Direction.CW);
        mRegion = new Region((int)getMinX(), (int)getMinY(), (int) getMaxX(), (int) getMaxY());
        mRegion.setPath(mPath, mRegion);
    } 
 
    /** 
     * {@inheritDoc} 
     */ 
    @Override 
    public boolean equals(Object o) {
        if (o instanceof RoundRectShape) {
            RoundRectShape roundRectShape = (RoundRectShape)o;
            if (this.getX() == roundRectShape.getX() && 
                    this.getY() == roundRectShape.getY() && 
                    this.getWidth() == roundRectShape.getWidth() && 
                    this.getHeight() == roundRectShape.getHeight()&&
6
CodeRank
This code example shows how to use the following methods:getBoundaryPath, isEmpty, op, setPath
      matrix.setScale(scale, scale, delegate.getWidth() / 2, delegate.getHeight() / 2);
      path.transform(matrix);
      Rect rect = new Rect(-delegate.getWidth() / 3, -delegate.getHeight() / 3, delegate.getWidth() * 4 / 3, delegate.getHeight() * 4 / 3);
      RectF rectf = new RectF();
      path.computeBounds(rectf, false);
      Region region = new Region(rect);
      region.setPath(path, region);
      region.op(rect, region, Op.INTERSECT);
      if (region.isEmpty()) {
        mBlockRegion = null; 
        mDrawType = DrawType.NoDraw; 
        return; 
      } 
      mBlockRegion = region;
      path = mBlockRegion.getBoundaryPath();
      path.close();
      mDrawPath = path;
    } 
    Paint paint = mPaintBlock;
    // paint.setAntiAlias(true); 
5
CodeRank
This code example shows how to use the following methods:setPath
        mPath.arcTo(mOval, mStartAngle, mAngleExtent);
        if (mUseCenter) {
            mPath.lineTo(mOval.centerX(), mOval.centerY());
        } 
        mPath.close();
        mRegion = new Region((int)mOval.left, (int)mOval.top, (int) mOval.right, (int) mOval.bottom);
        mRegion.setPath(mPath, mRegion);
    } 
 
    /** 
     * {@inheritDoc}  
     */ 
    @Override 
    public boolean equals(Object o) {
        if (o instanceof ArcShape) {
            ArcShape arcShape = (ArcShape)o;
            if (this.mOval.left == arcShape.mOval.left &&
                    this.mOval.right == arcShape.mOval.right &&
                    this.mOval.top == arcShape.mOval.top &&
                    this.mOval.bottom == arcShape.mOval.bottom &&
6
CodeRank
This code example shows how to use the following methods:contains, op, setPath
					// http://stackoverflow.com/questions/2597590/how-can-i-tell-if-a-closed-path-contains-a-given-point 
					 
					RectF rectF = new RectF();
					mPathShape.computeBounds(rectF, true);
					 
					Region figRegion = new Region();
					figRegion.setPath(mPathShape, new Region((int)rectF.left, (int)rectF.top, (int)rectF.right, (int)rectF.bottom));
					 
					mPathClipRef.computeBounds(rectF, true);
					Region clipRegion = new Region();
					clipRegion.setPath(mPathClipRef, new Region((int)rectF.left, (int)rectF.top, (int)rectF.right, (int)rectF.bottom));
					 
					if(!clipRegion.isEmpty())
						figRegion.op(clipRegion, Region.Op.INTERSECT);
					 
					if(figRegion.contains((int)event.getX(), (int)event.getY())) {
						return performClickInsideFigure(); 
					} 
					//else 
					//	return false; 
				} 
5
CodeRank
This code example shows how to use the following methods:contains, setPath
    } 
 
    public boolean contains(float x, float y) {
        rectF = new RectF();
        path.computeBounds(rectF, true);
        Region region = new Region();
        region.setPath(path, new Region((int) rectF.left, (int) rectF.top, (int) rectF.right, (int) rectF.bottom));
        return region.contains((int) x, (int) y);
    } 
 
    @Override 
    public void clean() { 
        super.clean(); 
        p = null;
        path = null;
        rectF = null;
    } 
} 
 
5
CodeRank
setPath Method Overview
Set the region to the area described by the path and clip.
See Code Examples for other Android Region Methods: