android.graphics.Rect#union ( )源码实例Demo

下面列出了android.graphics.Rect#union ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: UltimateAndroid   文件: HighlightView.java
void moveBy(float dx, float dy) {
    Rect invalRect = new Rect(drawRect);

    cropRect.offset(dx, dy);

    // Put the cropping rectangle inside image rectangle
    cropRect.offset(
            Math.max(0, imageRect.left - cropRect.left),
            Math.max(0, imageRect.top  - cropRect.top));

    cropRect.offset(
            Math.min(0, imageRect.right  - cropRect.right),
            Math.min(0, imageRect.bottom - cropRect.bottom));

    drawRect = computeLayout();
    invalRect.union(drawRect);
    invalRect.inset(-(int) handleRadius, -(int) handleRadius);
    viewContext.invalidate(invalRect);
}
 
源代码2 项目: LockDemo   文件: HighlightView.java
void moveBy(float dx, float dy) {
    Rect invalRect = new Rect(drawRect);

    cropRect.offset(dx, dy);

    // Put the cropping rectangle inside image rectangle
    cropRect.offset(
            Math.max(0, imageRect.left - cropRect.left),
            Math.max(0, imageRect.top  - cropRect.top));

    cropRect.offset(
            Math.min(0, imageRect.right  - cropRect.right),
            Math.min(0, imageRect.bottom - cropRect.bottom));

    drawRect = computeLayout();
    invalRect.union(drawRect);
    invalRect.inset(-(int) handleRadius, -(int) handleRadius);
    viewContext.invalidate(invalRect);
}
 
源代码3 项目: CodenameOne   文件: PagerTabStrip.java
@Override
void updateTextPositions(int position, float positionOffset, boolean force) {
    final Rect r = mTempRect;
    int bottom = getHeight();
    int left = mCurrText.getLeft() - mTabPadding;
    int right = mCurrText.getRight() + mTabPadding;
    int top = bottom - mIndicatorHeight;

    r.set(left, top, right, bottom);

    super.updateTextPositions(position, positionOffset, force);
    mTabAlpha = (int) (Math.abs(positionOffset - 0.5f) * 2 * 0xFF);

    left = mCurrText.getLeft() - mTabPadding;
    right = mCurrText.getRight() + mTabPadding;
    r.union(left, top, right, bottom);

    invalidate(r);
}
 
源代码4 项目: bither-android   文件: HighlightView.java
void moveBy(float dx, float dy) {
	Rect invalRect = new Rect(mDrawRect);

	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);
}
 
源代码5 项目: XERUNG   文件: HighlightView.java
void moveBy(float dx, float dy) {
    Rect invalRect = new Rect(drawRect);

    cropRect.offset(dx, dy);

    // Put the cropping rectangle inside image rectangle
    cropRect.offset(
            Math.max(0, imageRect.left - cropRect.left),
            Math.max(0, imageRect.top  - cropRect.top));

    cropRect.offset(
            Math.min(0, imageRect.right  - cropRect.right),
            Math.min(0, imageRect.bottom - cropRect.bottom));

    drawRect = computeLayout();
    invalRect.union(drawRect);
    invalRect.inset(-(int) handleRadius, -(int) handleRadius);
    viewContext.invalidate(invalRect);
}
 
源代码6 项目: XERUNG   文件: HighlightView.java
void moveBy(float dx, float dy) {
    Rect invalRect = new Rect(drawRect);

    cropRect.offset(dx, dy);

    // Put the cropping rectangle inside image rectangle
    cropRect.offset(
            Math.max(0, imageRect.left - cropRect.left),
            Math.max(0, imageRect.top  - cropRect.top));

    cropRect.offset(
            Math.min(0, imageRect.right  - cropRect.right),
            Math.min(0, imageRect.bottom - cropRect.bottom));

    drawRect = computeLayout();
    invalRect.union(drawRect);
    invalRect.inset(-(int) handleRadius, -(int) handleRadius);
    viewContext.invalidate(invalRect);
}
 
源代码7 项目: V.FlyoutTest   文件: PagerTabStrip.java
@Override
void updateTextPositions(int position, float positionOffset, boolean force) {
    final Rect r = mTempRect;
    int bottom = getHeight();
    int left = mCurrText.getLeft() - mTabPadding;
    int right = mCurrText.getRight() + mTabPadding;
    int top = bottom - mIndicatorHeight;

    r.set(left, top, right, bottom);

    super.updateTextPositions(position, positionOffset, force);
    mTabAlpha = (int) (Math.abs(positionOffset - 0.5f) * 2 * 0xFF);

    left = mCurrText.getLeft() - mTabPadding;
    right = mCurrText.getRight() + mTabPadding;
    r.union(left, top, right, bottom);

    invalidate(r);
}
 
源代码8 项目: WifiChat   文件: HighlightView.java
void moveBy(float dx, float dy) {
	Rect invalRect = new Rect(mDrawRect);

	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);
	mContext.invalidate();
}
 
源代码9 项目: adt-leanback-support   文件: PagerTabStrip.java
@Override
void updateTextPositions(int position, float positionOffset, boolean force) {
    final Rect r = mTempRect;
    int bottom = getHeight();
    int left = mCurrText.getLeft() - mTabPadding;
    int right = mCurrText.getRight() + mTabPadding;
    int top = bottom - mIndicatorHeight;

    r.set(left, top, right, bottom);

    super.updateTextPositions(position, positionOffset, force);
    mTabAlpha = (int) (Math.abs(positionOffset - 0.5f) * 2 * 0xFF);

    left = mCurrText.getLeft() - mTabPadding;
    right = mCurrText.getRight() + mTabPadding;
    r.union(left, top, right, bottom);

    invalidate(r);
}
 
源代码10 项目: CloudPan   文件: HighlightView.java
void moveBy(float dx, float dy) {
    Rect invalRect = new Rect(drawRect);

    cropRect.offset(dx, dy);

    // Put the cropping rectangle inside image rectangle
    cropRect.offset(
            Math.max(0, imageRect.left - cropRect.left),
            Math.max(0, imageRect.top  - cropRect.top));

    cropRect.offset(
            Math.min(0, imageRect.right  - cropRect.right),
            Math.min(0, imageRect.bottom - cropRect.bottom));

    drawRect = computeLayout();
    invalRect.union(drawRect);
    invalRect.inset(-(int) handleRadius, -(int) handleRadius);
    viewContext.invalidate(invalRect);
}
 
源代码11 项目: HaiNaBaiChuan   文件: HighlightView.java
void moveBy(float dx, float dy) {
    Rect invalRect = new Rect(drawRect);

    cropRect.offset(dx, dy);

    // Put the cropping rectangle inside image rectangle
    cropRect.offset(
            Math.max(0, imageRect.left - cropRect.left),
            Math.max(0, imageRect.top  - cropRect.top));

    cropRect.offset(
            Math.min(0, imageRect.right  - cropRect.right),
            Math.min(0, imageRect.bottom - cropRect.bottom));

    drawRect = computeLayout();
    invalRect.union(drawRect);
    invalRect.inset(-(int) handleRadius, -(int) handleRadius);
    viewContext.invalidate(invalRect);
}
 
源代码12 项目: memoir   文件: HighlightView.java
void moveBy(float dx, float dy) {
    Rect invalRect = new Rect(mDrawRect);

    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);
}
 
源代码13 项目: memoir   文件: HighlightView.java
void moveBy(float dx, float dy) {
    Rect invalRect = new Rect(mDrawRect);

    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);
}
 
源代码14 项目: GalleryFinal   文件: HighlightView.java
void moveBy(float dx, float dy) {
    Rect invalRect = new Rect(drawRect);

    cropRect.offset(dx, dy);

    // Put the cropping rectangle inside image rectangle
    cropRect.offset(
            Math.max(0, imageRect.left - cropRect.left),
            Math.max(0, imageRect.top  - cropRect.top));

    cropRect.offset(
            Math.min(0, imageRect.right  - cropRect.right),
            Math.min(0, imageRect.bottom - cropRect.bottom));

    drawRect = computeLayout();
    invalRect.union(drawRect);
    invalRect.inset(-(int) handleRadius, -(int) handleRadius);
    viewContext.invalidate(invalRect);
}
 
源代码15 项目: UltimateAndroid   文件: PagerTabStrip.java
@Override
void updateTextPositions(int position, float positionOffset, boolean force) {
    final Rect r = mTempRect;
    int bottom = getHeight();
    int left = mCurrText.getLeft() - mTabPadding;
    int right = mCurrText.getRight() + mTabPadding;
    int top = bottom - mIndicatorHeight;

    r.set(left, top, right, bottom);

    super.updateTextPositions(position, positionOffset, force);
    mTabAlpha = (int) (Math.abs(positionOffset - 0.5f) * 2 * 0xFF);

    left = mCurrText.getLeft() - mTabPadding;
    right = mCurrText.getRight() + mTabPadding;
    r.union(left, top, right, bottom);

    invalidate(r);
}
 
源代码16 项目: YiBo   文件: HighlightView.java
void moveBy(float dx, float dy) {
    Rect invalRect = new Rect(mDrawRect);

    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);
}
 
源代码17 项目: reader   文件: HighlightView.java
void moveBy(float dx, float dy) {
    Rect invalRect = new Rect(mDrawRect);

    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);
}
 
源代码18 项目: RippleDrawable   文件: RippleDrawable.java
@Override
public Rect getDirtyBounds() {
    if (isProjected()) {
        final Rect drawingBounds = mDrawingBounds;
        final Rect dirtyBounds = mDirtyBounds;
        dirtyBounds.set(drawingBounds);
        drawingBounds.setEmpty();

        final int cX = (int) mHotspotBounds.exactCenterX();
        final int cY = (int) mHotspotBounds.exactCenterY();
        final Rect rippleBounds = mTempRect;

        final Ripple[] activeRipples = mExitingRipples;
        final int N = mExitingRipplesCount;
        for (int i = 0; i < N; i++) {
            activeRipples[i].getBounds(rippleBounds);
            rippleBounds.offset(cX, cY);
            drawingBounds.union(rippleBounds);
        }

        final RippleBackground background = mBackground;
        if (background != null) {
            background.getBounds(rippleBounds);
            rippleBounds.offset(cX, cY);
            drawingBounds.union(rippleBounds);
        }

        dirtyBounds.union(drawingBounds);
        dirtyBounds.union(super.getDirtyBounds());
        return dirtyBounds;
    } else {
        return getBounds();
    }
}
 
源代码19 项目: Carbon   文件: RippleDrawableICS.java
@Override
public Rect getDirtyBounds() {
    if (!isBounded()) {
        final Rect drawingBounds = mDrawingBounds;
        final Rect dirtyBounds = mDirtyBounds;
        dirtyBounds.set(drawingBounds);
        drawingBounds.setEmpty();

        final int cX = (int) mHotspotBounds.exactCenterX();
        final int cY = (int) mHotspotBounds.exactCenterY();
        final Rect rippleBounds = mTempRect;

        final RippleForeground[] activeRipples = mExitingRipples;
        final int N = mExitingRipplesCount;
        for (int i = 0; i < N; i++) {
            activeRipples[i].getBounds(rippleBounds);
            rippleBounds.offset(cX, cY);
            drawingBounds.union(rippleBounds);
        }

        final RippleBackground background = mBackground;
        if (background != null) {
            background.getBounds(rippleBounds);
            rippleBounds.offset(cX, cY);
            drawingBounds.union(rippleBounds);
        }

        dirtyBounds.union(drawingBounds);
        if (Build.VERSION.SDK_INT >= 21)
            dirtyBounds.union(super.getDirtyBounds());
        return dirtyBounds;
    } else {
        return getBounds();
    }
}
 
源代码20 项目: vlayout   文件: RangeStyle.java
public void adjustLayout(int startPosition, int endPosition, LayoutManagerHelper helper) {
    if (!isChildrenEmpty()) {
        for (Map.Entry<Range<Integer>, T> entry : mChildren.entrySet()) {
            RangeStyle rangeStyle = entry.getValue();
            rangeStyle.adjustLayout(startPosition, endPosition, helper);
        }
    }
    if (requireLayoutView()) {
        View refer = null;
        Rect tempRect = new Rect();
        final OrientationHelperEx orientationHelper = helper.getMainOrientationHelper();
        for (int i = 0; i < helper.getChildCount(); i++) {
            refer = helper.getChildAt(i);
            int anchorPos = helper.getPosition(refer);
            if (getRange().contains(anchorPos)) {
                if (refer.getVisibility() == View.GONE) {
                    tempRect.setEmpty();
                } else {
                    final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams)
                        refer.getLayoutParams();
                    if (helper.getOrientation() == VirtualLayoutManager.VERTICAL) {
                        tempRect.union(helper.getDecoratedLeft(refer) - params.leftMargin,
                            orientationHelper.getDecoratedStart(refer),
                            helper.getDecoratedRight(refer) + params.rightMargin,
                            orientationHelper.getDecoratedEnd(refer));
                    } else {
                        tempRect.union(orientationHelper.getDecoratedStart(refer),
                            helper.getDecoratedTop(refer) - params.topMargin, orientationHelper.getDecoratedEnd(refer),
                            helper.getDecoratedBottom(refer) + params.bottomMargin);
                    }
                }
            }
        }
        if (!tempRect.isEmpty()) {
            mLayoutRegion.set(tempRect.left - mPaddingLeft, tempRect.top - mPaddingTop,
                tempRect.right + mPaddingRight, tempRect.bottom + mPaddingBottom);
        } else {
            mLayoutRegion.setEmpty();
        }
        if (mLayoutView != null) {
            mLayoutView.layout(mLayoutRegion.left, mLayoutRegion.top, mLayoutRegion.right, mLayoutRegion.bottom);
        }
    }
}