RectF contains - top ranked examples from Open Source projects

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

This code example shows how to use the following methods:contains
		translationMatrix.mapRect(transRect);
		return transRect;						
	} 
 
	private boolean pointerAreaTouched(MotionEvent event, int area) {				
		RectF transRect = new RectF(pointerAreaRects[area]);
		translationMatrix.mapRect(transRect);
		if(transRect.contains(event.getX(), event.getY()))
			return true;			 
		return false; 
	}	 
	 
	private boolean pointerTouched(MotionEvent event) {				
		RectF transRect = new RectF(pointerRect);
		translationMatrix.mapRect(transRect);
		if(transRect.contains(event.getX(), event.getY()))
			return true;			 
		return false; 
	}			 
 
7
CodeRank
This code example shows how to use the following methods:contains, inset, offset, set
    public boolean fullPhotoCropped() { 
        return cropBounds.contains(photoBounds);
    } 
 
    private int detectTouchArea(float x, float y) {
        RectF area = new RectF();
        area.set(cropBounds);
        area.inset(-TOUCH_AREA_SPAN, -TOUCH_AREA_SPAN);
        if (!area.contains(x, y)) {
            return TOUCH_AREA_OUTSIDE;
        } 
 
        // left 
        area.set(cropBounds.left - TOUCH_AREA_SPAN, cropBounds.top  + TOUCH_AREA_SPAN,
                cropBounds.left + TOUCH_AREA_SPAN, cropBounds.bottom - TOUCH_AREA_SPAN);
        if (area.contains(x, y)) {
            return TOUCH_AREA_LEFT;
        } 
        // right 
        area.offset(cropBounds.width(), 0f);

7
CodeRank
This code example shows how to use the following methods:contains, height, width
     
    /** 
     * {@inheritDoc}  
     */ 
    public boolean contains(float x, float y, float width, float height) {
        return mRect.contains((int)x, (int)y, (int) (x + width), (int) (y + height));
    } 
     
    /** 
     * {@inheritDoc}  
     */ 
    public boolean contains(PointF point) {
        return mRect.contains(point.x, point.y);
    } 
 
     
    /** 
     * {@inheritDoc}  
     */ 
    @Deprecated 

7
CodeRank
This code example shows how to use the following methods:contains, height, width
    } 
 
    private float[] pointToSatVal(float x, float y) {
        final RectF rect = mSatValRect;
        float[] result = new float[2];
        float width = rect.width();
        float height = rect.height();
 
        if (x < rect.left) {
            x = 0f;
        } else if (x > rect.right) {
            x = width;
        } else { 
            x = x - rect.left;
        } 
 
        if (y < rect.top) {
            y = 0f;
        } else if (y > rect.bottom) {
            y = height;

7
CodeRank
This code example shows how to use the following methods:contains
        else if (bottom <= TOUCH_TOLERANCE) {
            movingEdges |= MOVE_BOTTOM;
        } 
 
        // Check inside block. 
        if (cropped.contains(x, y) && (movingEdges == 0)) {
            movingEdges = MOVE_BLOCK;
        } 
        invalidate(); 
    } 
 
    private void moveEdges(float deltaX, float deltaY) {
        RectF cropped = getCropBoundsDisplayed();
        if (movingEdges == MOVE_BLOCK) {
            // Move the whole cropped bounds within the photo display bounds. 
            deltaX = (deltaX > 0) ? Math.min(displayBounds.right - cropped.right, deltaX)
                    : Math.max(displayBounds.left - cropped.left, deltaX);
            deltaY = (deltaY > 0) ? Math.min(displayBounds.bottom - cropped.bottom, deltaY)
                    : Math.max(displayBounds.top - cropped.top, deltaY);
            cropped.offset(deltaX, deltaY);
6
CodeRank
This code example shows how to use the following methods:centerX, centerY, contains, inset
	 *           the y 
	 * @return the hit 
	 */ 
	public int getHit( float x, float y ) {
 
		final RectF rect = new RectF( mDrawRect );
		rect.inset( -mPadding, -mPadding );
 
		final float pts[] = new float[] { x, y };
 
		final Matrix rotateMatrix = new Matrix();
		rotateMatrix.postTranslate( -rect.centerX(), -rect.centerY() );
		rotateMatrix.postRotate( -mRotation );
		rotateMatrix.postTranslate( rect.centerX(), rect.centerY() );
		rotateMatrix.mapPoints( pts );
 
		x = pts[0];
		y = pts[1];
 
		mContext.invalidate();

6
CodeRank
This code example shows how to use the following methods:contains, height, width
			mLastTouchedPanel = PANEL_HUE;
 
			mHue = pointToHue(event.getY());
 
			update = true;
		} else if (mSatValRect.contains(startX, startY)) {
 
			mLastTouchedPanel = PANEL_SAT_VAL;
 
			final float[] result = pointToSatVal(event.getX(), event.getY());
 
			mSat = result[0];
			mVal = result[1];
 
			update = true;
		} else if (mAlphaRect != null && mAlphaRect.contains(startX, startY)) {
 
			mLastTouchedPanel = PANEL_ALPHA;
 
			mAlpha = pointToAlpha((int) event.getX());

6
CodeRank
This code example shows how to use the following methods:contains, height, width
	private float[] pointToSatVal(float x, float y){
 
		final RectF rect = mSatValRect;
		float[] result = new float[2];
 
		float width = rect.width();
		float height = rect.height();
 
		if (x < rect.left){
			x = 0f;
		} 
		else if(x > rect.right){
			x = width;
		} 
		else{ 
			x = x - rect.left;
		} 
 
		if (y < rect.top){
			y = 0f;

6
CodeRank
This code example shows how to use the following methods:contains, intersects
    	return new PointF(point[0], point[1]);
    } 
     
    // Returns true if the line segment defined by the given two points intersects the given rectangle. 
    public static boolean lineSegmentIntersectsRect(PointF p1, PointF p2, RectF r2) {
    	RectF line = new RectF(Math.min(p1.x, p2.x), Math.min(p1.y, p2.y), Math.max(p1.x, p2.x), Math.max(p1.y, p2.y));
    	 
    	// If the bounding box of the line segment intersects the rectangle or one contains the other, 
    	//    the line segment intersects the rectangle. 
    	return RectF.intersects(line, r2) || line.contains(r2) || r2.contains(line);
    } 
} 
6
CodeRank
This code example shows how to use the following methods:contains, height, width
    private float[] pointToSatVal(float x, float y) {
 
        final RectF rect = mSatValRect;
        final float[] result = new float[2];
 
        final float width = rect.width();
        final float height = rect.height();
 
        if (x < rect.left) {
            x = 0f;
        } else if (x > rect.right) {
            x = width;
        } else { 
            x = x - rect.left;
        } 
 
        if (y < rect.top) {
            y = 0f;
        } else if (y > rect.bottom) {
            y = height;

6
CodeRank

Related RectF contains Questions & Answers:

contains Method Overview
Returns true iff the 4 specified sides of a rectangle are inside or equal to this rectangle.
See Code Examples for other Android RectF Methods: