Code example for Rect

Methods: insetunion

0
        } 
//        Log.v(TAG, "ratio is now " + this.mCropRect.width() / this.mCropRect.height()); 
    } 
     
    void moveBy(float dx, float dy) {
        Rect invalRect = new Rect(mDrawRect);
 
        mCropRect.offset(dx, dy);
        mCropRect.offset(
                Math.max(0, mImageRect.left - mCropRect.left), 
                Math.max(0, mImageRect.top  - mCropRect.top));
 
        mCropRect.offset(
                Math.min(0, mImageRect.right  - mCropRect.right), 
                Math.min(0, mImageRect.bottom - mCropRect.bottom));                
 
        mDrawRect = computeLayout();
        invalRect.union(mDrawRect);
        invalRect.inset(-10, -10);
        mContext.invalidate(invalRect);
    } 
     
    private void shift(RectF r, float dx, float dy) {
        r.left   += dx;