Code example for RectF

Methods: height, isEmpty, set, width

0
		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 
	 */ 
	private boolean ensureValidRect() { 
		if ( mRectIsDirty ) {
			mRectIsDirty = false;
 
			Rect bounds = getBounds();
			float inset = 0;
 
			mRect.set( bounds.left + inset, bounds.top + inset, bounds.right - inset, bounds.bottom - inset );
 
			final int[] colors = mColors;
 
			if ( colors != null ) {
				RectF r = mRect;
				float x0, x1, y0, y1;
 
				final float level = 1.0f;
				switch ( mOrientation ) {
					case TOP_BOTTOM:
						x0 = r.left;
						y0 = r.top;
						x1 = x0;
						y1 = level * r.bottom;
						break; 
					case TR_BL:
						x0 = r.right;
						y0 = r.top;
						x1 = level * r.left;
						y1 = level * r.bottom;
						break; 
					case RIGHT_LEFT:
						x0 = r.right;
						y0 = r.top;
						x1 = level * r.left;
						y1 = y0;
						break; 
					case BR_TL:
						x0 = r.right;
						y0 = r.bottom;
						x1 = level * r.left;
						y1 = level * r.top;
						break; 
					case BOTTOM_TOP:
						x0 = r.left;
						y0 = r.bottom;
						x1 = x0;
						y1 = level * r.top;
						break; 
					case BL_TR:
						x0 = r.left;
						y0 = r.bottom;
						x1 = level * r.right;
						y1 = level * r.top;
						break; 
					case LEFT_RIGHT:
						x0 = r.left;
						y0 = r.top;
						x1 = level * r.right;
						y1 = y0;
						break; 
					default:/* TL_BR */ 
						x0 = r.left;
						y0 = r.top;
						x1 = level * r.right;
						y1 = level * r.bottom;
						break; 
				} 
 
				mFillPaint.setShader( new LinearGradient( x0, y0, x1, y1, colors, mPositions, Shader.TileMode.CLAMP ) );
			} 
		} 
		return !mRect.isEmpty();
	} 
 
	/* 
	 * (non-Javadoc) 
	 *