List of usage examples for android.graphics Rect union
public void union(Rect r)
From source file:com.android.camera.HighlightView.java
private void moveBy(float dx, float dy) { Rect invalRect = new Rect(mDrawRect); mCropRect.offset(dx, dy);/*from www. j a va2 s.c o m*/ // 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); }
From source file:com.example.gatsu.theevent.HighlightView.java
void moveBy(float dx, float dy) { Rect invalRect = new Rect(mDrawRect); mCropRect.offset(dx, dy);// w w w . jav a 2 s . c om // 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); }
From source file:org.caojun.library.cropimage.HighlightView.java
void moveBy(float dx, float dy) { Rect invalRect = new Rect(mDrawRect); mCropRect.offset(dx, dy);/*from ww w. j a va 2s . com*/ // 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); mView.invalidate(invalRect); }
From source file:org.androfarsh.widget.DragGridLayout.java
private boolean requestHoverRect(Rect rect) { rect.setEmpty();// www. j av a 2 s .com for (final Cell cell : mHoveredCells) { if (!rect.isEmpty()) { rect.union(cell.rect); } else { rect.set(cell.rect); } } return !mHoveredCells.isEmpty() && !rect.isEmpty(); }
From source file:com.android.launcher3.CellLayout.java
private void getViewsIntersectingRegion(int cellX, int cellY, int spanX, int spanY, View dragView, Rect boundingRect, ArrayList<View> intersectingViews) { if (boundingRect != null) { boundingRect.set(cellX, cellY, cellX + spanX, cellY + spanY); }// www .j av a 2 s .c o m intersectingViews.clear(); Rect r0 = new Rect(cellX, cellY, cellX + spanX, cellY + spanY); Rect r1 = new Rect(); final int count = mShortcutsAndWidgets.getChildCount(); for (int i = 0; i < count; i++) { View child = mShortcutsAndWidgets.getChildAt(i); if (child == dragView) continue; LayoutParams lp = (LayoutParams) child.getLayoutParams(); r1.set(lp.cellX, lp.cellY, lp.cellX + lp.cellHSpan, lp.cellY + lp.cellVSpan); if (Rect.intersects(r0, r1)) { mIntersectingViews.add(child); if (boundingRect != null) { boundingRect.union(r1); } } } }