RectF isEmpty - 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 isEmpty method.

This code example shows how to use the following methods:height, isEmpty, set, width
		mFillPaint.setDither( mDither );
		mFillPaint.setColorFilter( mColorFilter );
 
		if ( mCornerRadius > 0 ) {
			float rad = mCornerRadius;
			float r = Math.min( mRect.width(), mRect.height() ) * 0.5f;
			if ( rad > r ) {
				rad = r;
			} 
			canvas.drawRoundRect( mRect, rad, rad, mFillPaint );
		} else { 
			canvas.drawRect( mRect, mFillPaint );
		} 
 
	} 
 
	/** 
	 * Ensure valid rect. 
	 *  
	 * @return true, if successful 

7
CodeRank
This code example shows how to use the following methods:height, isEmpty, set, width
		mFillPaint.setDither( mDither );
		mFillPaint.setColorFilter( mColorFilter );
 
		if ( mCornerRadius > 0 ) {
			float rad = mCornerRadius;
			float r = Math.min( mRect.width(), mRect.height() ) * 0.5f;
			if ( rad > r ) {
				rad = r;
			} 
			canvas.drawRoundRect( mRect, rad, rad, mFillPaint );
		} else { 
			canvas.drawRect( mRect, mFillPaint );
		} 
 
	} 
 
	/** 
	 * Ensure valid rect. 
	 * 
	 * @return true, if successful 

7
CodeRank
This code example shows how to use the following methods:height, isEmpty, width
    protected float getPhotoHeight() { 
        return photoBounds.height();
    } 
 
    protected void mapPhotoPoint(float x, float y, PointF dst) {
        if (photoBounds.isEmpty()) {
            dst.set(0, 0);
        } else { 
            float[] point = new float[] {x, y};
            photoMatrix.mapPoints(point);
            dst.set(point[0] / photoBounds.width(), point[1] / photoBounds.height());
        } 
    } 
 
    protected void mapPhotoRect(RectF src, RectF dst) {
        if (photoBounds.isEmpty()) {
            dst.setEmpty();
        } else { 
            photoMatrix.mapRect(dst, src);
            dst.set(dst.left / photoBounds.width(), dst.top / photoBounds.height(),
6
CodeRank
This code example shows how to use the following methods:height, isEmpty, width
    /** 
     * Gets straighten matrix for the given bounds and degrees. 
     */ 
    public static void getStraightenMatrix(RectF bounds, float degrees, Matrix matrix) {
        matrix.reset();
        if ((degrees != 0) && !bounds.isEmpty()) {
            float w = bounds.width() / 2;
            float h = bounds.height() / 2;
            float adjustAngle;
            if ((degrees < 0 && w > h) || (degrees > 0 && w <= h)) {
                // The top left point is the boundary. 
                adjustAngle = (float) Math.atan(h / -w) + MATH_PI + degrees * DEGREES_TO_RADIAN;
            } else { 
                // The top right point is the boundary. 
                adjustAngle = (float) Math.atan(h / w) - MATH_PI + degrees * DEGREES_TO_RADIAN;
            } 
            float radius = (float) Math.hypot(w, h);
            float scaleX = (float) Math.abs(radius * Math.cos(adjustAngle)) / w;
            float scaleY = (float) Math.abs(radius * Math.sin(adjustAngle)) / h;
            float scale = Math.max(scaleX, scaleY);
5
CodeRank
This code example shows how to use the following methods:height, isEmpty, width
    protected float getPhotoHeight() { 
        return photoBounds.height();
    } 
 
    protected void mapPhotoPoint(float x, float y, PointF dst) {
        if (photoBounds.isEmpty()) {
            dst.set(0, 0);
        } else { 
            float[] point = new float[] {x, y};
            photoMatrix.mapPoints(point);
            dst.set(point[0] / photoBounds.width(), point[1] / photoBounds.height());
        } 
    } 
 
    protected void mapPhotoRect(RectF src, RectF dst) {
        if (photoBounds.isEmpty()) {
            dst.setEmpty();
        } else { 
            photoMatrix.mapRect(dst, src);
            dst.set(dst.left / photoBounds.width(), dst.top / photoBounds.height(),
5
CodeRank
This code example shows how to use the following methods:height, isEmpty, width
    protected float getPhotoHeight() { 
        return photoBounds.height();
    } 
 
    protected void mapPhotoPoint(float x, float y, PointF dst) {
        if (photoBounds.isEmpty()) {
            dst.set(0, 0);
        } else { 
            float[] point = new float[] {x, y};
            photoMatrix.mapPoints(point);
            dst.set(point[0] / photoBounds.width(), point[1] / photoBounds.height());
        } 
    } 
 
    protected void mapPhotoRect(RectF src, RectF dst) {
        if (photoBounds.isEmpty()) {
            dst.setEmpty();
        } else { 
            photoMatrix.mapRect(dst, src);
            dst.set(dst.left / photoBounds.width(), dst.top / photoBounds.height(),
5
CodeRank
This code example shows how to use the following methods:height, isEmpty, toString, width
		mClipPath.close();
 
		// 设置绘制目标坐标 
		initSrcRect(); 
 
		GLogger.i(TAG, "layout mBoundsRect = is Rect :" + !mBoundsRect.isEmpty() + "," + mBoundsRect.toString() + ", mBoundsBL : " + mBoundsRect.width() / mBoundsRect.height() +", mClipPath.isEmpty() = " + mClipPath.isEmpty());
		// GLogger.i(TAG, "layout mClipPath.isEmpty() = " + mClipPath.isEmpty() 
		// + ", is BoundsRest : " + mClipPath.isRect(mBoundsRect)); 
		GLogger.i(TAG, "layout mClipPath.isEmpty() = " + mClipPath.isEmpty());
	} 
 
	private void initSrcRect() { 
		//mBitmap为null时,等价于 mBitmapRect.isEmpty() 
		if (!mBitmapRect.isEmpty()) {
			final float itemW = this.getWidth();
			final float itemH = this.getHeight();
			final float srcW = mBitmapRect.right;
			final float srcH = mBitmapRect.bottom;
 
			// 等比例进行填充 
5
CodeRank
isEmpty Method Overview
Returns true if the rectangle is empty (left >= right or top >= bottom)
See Code Examples for other Android RectF Methods: