Code example for Rect

Methods: insetunion

0
	} 
 
	// Grows the cropping rectange by (dx, dy) in image space. 
	void moveBy(float dx, float dy) {
		// System.out.println(String.format("move by : %3.0f - %3.0f",dx,dy)); 
		Rect invalRect = new Rect(mDrawRect);
 
		float width = 0;
		float height = 0;
		if (mResizeDrawableHeight != null && mResizeDrawableWidth != null) {
			width = mResizeDrawableHeight.getIntrinsicWidth() / 2;
			height = mResizeDrawableWidth.getIntrinsicHeight() / 2;
		} 
		invalRect.inset((int) -width, (int) -height);
		mCropRect.offset(dx, dy);
 
		// Put the cropping rectangle inside image rectangle. 
		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);
	} 
 
	// Grows the cropping rectange by (dx, dy) in image space. 
	void growBy(float dx, float dy) {