android.graphics.Rect.union()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(402)

本文整理了Java中android.graphics.Rect.union方法的一些代码示例,展示了Rect.union的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rect.union方法的具体详情如下:
包路径:android.graphics.Rect
类名称:Rect
方法名:union

Rect.union介绍

[英]Update this Rect to enclose itself and the [x,y] coordinate. There is no check to see that this rectangle is non-empty.
[中]更新此矩形以将其自身和[x,y]坐标围起来。无法检查此矩形是否为非空。

代码示例

代码示例来源:origin: jdamcd/android-crop

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);
}

代码示例来源:origin: seven332/EhViewer

mTmpInvalidateRect.union(Math.round(left), Math.round(top),
      Math.round(right), Math.round(bottom));
mInvalidate.union(mTmpInvalidateRect);
invalidate(mInvalidate);
mInvalidate.set(mTmpInvalidateRect);

代码示例来源:origin: ZieIony/Carbon

activeRipples[i].getBounds(rippleBounds);
    rippleBounds.offset(cX, cY);
    drawingBounds.union(rippleBounds);
    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 {

代码示例来源:origin: multidots/android-app-common-tasks

private 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);
}

代码示例来源:origin: multidots/android-app-common-tasks

private 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);
}

代码示例来源:origin: timusus/RecyclerView-FastScroll

public void setThumbPosition(int x, int y) {
  if (mThumbPosition.x == x && mThumbPosition.y == y) {
    return;
  }
  // do not create new objects here, this is called quite often
  mInvalidateRect.set(mThumbPosition.x + mOffset.x, mOffset.y, mThumbPosition.x + mOffset.x + mWidth, mRecyclerView.getHeight() + mOffset.y);
  mThumbPosition.set(x, y);
  mInvalidateTmpRect.set(mThumbPosition.x + mOffset.x, mOffset.y, mThumbPosition.x + mOffset.x + mWidth, mRecyclerView.getHeight() + mOffset.y);
  mInvalidateRect.union(mInvalidateTmpRect);
  mRecyclerView.invalidate(mInvalidateRect);
}

代码示例来源:origin: timusus/RecyclerView-FastScroll

public void setOffset(int x, int y) {
  if (mOffset.x == x && mOffset.y == y) {
    return;
  }
  // do not create new objects here, this is called quite often
  mInvalidateRect.set(mThumbPosition.x + mOffset.x, mOffset.y, mThumbPosition.x + mOffset.x + mWidth, mRecyclerView.getHeight() + mOffset.y);
  mOffset.set(x, y);
  mInvalidateTmpRect.set(mThumbPosition.x + mOffset.x, mOffset.y, mThumbPosition.x + mOffset.x + mWidth, mRecyclerView.getHeight() + mOffset.y);
  mInvalidateRect.union(mInvalidateTmpRect);
  mRecyclerView.invalidate(mInvalidateRect);
}

代码示例来源:origin: timusus/RecyclerView-FastScroll

mInvalidateRect.union(mBgBounds);
return mInvalidateRect;

代码示例来源:origin: klinker24/launcher3

public void setThumbWidth(int width) {
  mInvalidateRect.set(mThumbOffset.x - mThumbCurvature, mThumbOffset.y,
      mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight);
  mThumbWidth = width;
  updateThumbPath();
  mInvalidateRect.union(mThumbOffset.x - mThumbCurvature, mThumbOffset.y,
      mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight);
  mRv.invalidate(mInvalidateRect);
}

代码示例来源:origin: fookwood/Launcher3

public void setThumbWidth(int width) {
  mInvalidateRect.set(mThumbOffset.x - mThumbCurvature, mThumbOffset.y,
      mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight);
  mThumbWidth = width;
  updateThumbPath();
  mInvalidateRect.union(mThumbOffset.x - mThumbCurvature, mThumbOffset.y,
      mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight);
  mRv.invalidate(mInvalidateRect);
}

代码示例来源:origin: klinker24/Android-Blur-Launcher

public void setThumbWidth(int width) {
  mInvalidateRect.set(mThumbOffset.x - mThumbCurvature, mThumbOffset.y,
      mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight);
  mThumbWidth = width;
  updateThumbPath();
  mInvalidateRect.union(mThumbOffset.x - mThumbCurvature, mThumbOffset.y,
      mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight);
  mRv.invalidate(mInvalidateRect);
}

代码示例来源:origin: gpfduoduo/AirPlay-Receiver-on-Android

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);
}

代码示例来源:origin: fookwood/Launcher3

public void setThumbOffset(int x, int y) {
  if (mThumbOffset.x == x && mThumbOffset.y == y) {
    return;
  }
  mInvalidateRect.set(mThumbOffset.x - mThumbCurvature, mThumbOffset.y,
      mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight);
  mThumbOffset.set(x, y);
  updateThumbPath();
  mInvalidateRect.union(mThumbOffset.x - mThumbCurvature, mThumbOffset.y,
      mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight);
  mRv.invalidate(mInvalidateRect);
}

代码示例来源:origin: klinker24/launcher3

public void setThumbOffset(int x, int y) {
  if (mThumbOffset.x == x && mThumbOffset.y == y) {
    return;
  }
  mInvalidateRect.set(mThumbOffset.x - mThumbCurvature, mThumbOffset.y,
      mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight);
  mThumbOffset.set(x, y);
  updateThumbPath();
  mInvalidateRect.union(mThumbOffset.x - mThumbCurvature, mThumbOffset.y,
      mThumbOffset.x + mThumbWidth, mThumbOffset.y + mThumbHeight);
  mRv.invalidate(mInvalidateRect);
}

代码示例来源:origin: BiglySoftware/BiglyBT-Android

public void setThumbPosition(int x, int y) {
  if (mThumbPosition.x == x && mThumbPosition.y == y) {
    return;
  }
  // do not create new objects here, this is called quite often
  mInvalidateRect.set(mThumbPosition.x + mOffset.x, mOffset.y, mThumbPosition.x + mOffset.x + mWidth, mRecyclerView.getHeight() + mOffset.y);
  mThumbPosition.set(x, y);
  mInvalidateTmpRect.set(mThumbPosition.x + mOffset.x, mOffset.y, mThumbPosition.x + mOffset.x + mWidth, mRecyclerView.getHeight() + mOffset.y);
  mInvalidateRect.union(mInvalidateTmpRect);
  mRecyclerView.invalidate(mInvalidateRect);
}

代码示例来源:origin: PhilippC/keepass2android

/**
 * Requests a redraw of the entire keyboard. Calling {@link #invalidate} is not sufficient
 * because the keyboard renders the keys to an off-screen buffer and an invalidate() only
 * draws the cached buffer.
 * @see #invalidateKey(Key)
 */
public void invalidateAllKeys() {
  mDirtyRect.union(0, 0, getWidth(), getHeight());
  mDrawPending = true;
  invalidate();
}

代码示例来源:origin: klinker24/Android-Blur-Launcher

public void setTrackWidth(int width) {
  mInvalidateRect.set(mThumbOffset.x - mThumbCurvature, 0, mThumbOffset.x + mThumbWidth,
      mRv.getVisibleHeight());
  mTrackWidth = width;
  updateThumbPath();
  mInvalidateRect.union(mThumbOffset.x - mThumbCurvature, 0, mThumbOffset.x + mThumbWidth,
      mRv.getVisibleHeight());
  mRv.invalidate(mInvalidateRect);
}

代码示例来源:origin: fookwood/Launcher3

public void setTrackWidth(int width) {
  mInvalidateRect.set(mThumbOffset.x - mThumbCurvature, 0, mThumbOffset.x + mThumbWidth,
      mRv.getHeight());
  mTrackWidth = width;
  updateThumbPath();
  mInvalidateRect.union(mThumbOffset.x - mThumbCurvature, 0, mThumbOffset.x + mThumbWidth,
      mRv.getHeight());
  mRv.invalidate(mInvalidateRect);
}

代码示例来源:origin: osfans/trime

/**
 * Requests a redraw of the entire keyboard. Calling {@link #invalidate} is not sufficient because
 * the keyboard renders the keys to an off-screen buffer and an invalidate() only draws the cached
 * buffer.
 *
 * @see #invalidateKey(int)
 */
public void invalidateAllKeys() {
 mDirtyRect.union(0, 0, getWidth(), getHeight());
 mDrawPending = true;
 invalidate();
}

代码示例来源:origin: osfans/trime

private void invalidateKeys(List<Key> keys) {
 if (keys == null || keys.size() == 0) return;
 for (Key key : keys) {
  mDirtyRect.union(
    key.getX() + getPaddingLeft(),
    key.getY() + getPaddingTop(),
    key.getX() + key.getWidth() + getPaddingLeft(),
    key.getY() + key.getHeight() + getPaddingTop());
 }
 onBufferDraw();
 invalidate();
}

相关文章