本文整理匯總了Java中android.graphics.RectF.isEmpty方法的典型用法代碼示例。如果您正苦於以下問題:Java RectF.isEmpty方法的具體用法?Java RectF.isEmpty怎麽用?Java RectF.isEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.graphics.RectF
的用法示例。
在下文中一共展示了RectF.isEmpty方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: canScrollHorizontally
import android.graphics.RectF; //導入方法依賴的package包/類
/**
* 與ViewPager結合的時候使用
* @param direction
* @return
*/
@Override
public boolean canScrollHorizontally(int direction) {
if (mPinchMode == PinchImageView.PINCH_MODE_SCALE) {
return true;
}
RectF bound = getImageBound(null);
if (bound == null) {
return false;
}
if (bound.isEmpty()) {
return false;
}
if (direction > 0) {
return bound.right > getWidth();
} else {
return bound.left < 0;
}
}
示例2: canScrollVertically
import android.graphics.RectF; //導入方法依賴的package包/類
/**
* 與ViewPager結合的時候使用
* @param direction
* @return
*/
@Override
public boolean canScrollVertically(int direction) {
if (mPinchMode == PinchImageView.PINCH_MODE_SCALE) {
return true;
}
RectF bound = getImageBound(null);
if (bound == null) {
return false;
}
if (bound.isEmpty()) {
return false;
}
if (direction > 0) {
return bound.bottom > getHeight();
} else {
return bound.top < 0;
}
}
示例3: canScrollHorizontally
import android.graphics.RectF; //導入方法依賴的package包/類
/**
* 與ViewPager結合的時候使用
*
* @param direction
* @return
*/
@Override
public boolean canScrollHorizontally(int direction) {
if (mPinchMode == PinchImageView.PINCH_MODE_SCALE) {
return true;
}
RectF bound = getImageBound(null);
if (bound == null) {
return false;
}
if (bound.isEmpty()) {
return false;
}
if (direction > 0) {
return bound.right > getWidth();
} else {
return bound.left < 0;
}
}
示例4: canScrollVertically
import android.graphics.RectF; //導入方法依賴的package包/類
/**
* 與ViewPager結合的時候使用
*
* @param direction
* @return
*/
@Override
public boolean canScrollVertically(int direction) {
if (mPinchMode == PinchImageView.PINCH_MODE_SCALE) {
return true;
}
RectF bound = getImageBound(null);
if (bound == null) {
return false;
}
if (bound.isEmpty()) {
return false;
}
if (direction > 0) {
return bound.bottom > getHeight();
} else {
return bound.top < 0;
}
}
示例5: compare
import android.graphics.RectF; //導入方法依賴的package包/類
@Override
public PhotoSize compare(@NonNull RectF photo, @NonNull RectF container) {
if (photo.isEmpty())
return PhotoSize.small;
if (photo.width() < container.width()
&& photo.height() < container.height())
return PhotoSize.small;
else if (photo.width() > container.width()
&& photo.height() > container.height())
return PhotoSize.large;
return PhotoSize.middle;
}
示例6: cropImage
import android.graphics.RectF; //導入方法依賴的package包/類
@Nullable
public Bitmap cropImage() {
Bitmap viewBitmap = getViewBitmap();
if (viewBitmap == null || viewBitmap.isRecycled()) {
return null;
}
cancelAllAnimations();
setImageToWrapCropBounds(false);
RectF currentImageRect = RectUtils.trapToRect(this.mCurrentImageCorners);
if (currentImageRect.isEmpty()) {
return null;
}
float currentScale = getCurrentScale();
float currentAngle = getCurrentAngle();
if (this.mMaxResultImageSizeX > 0 && this.mMaxResultImageSizeY > 0) {
float cropWidth = this.mCropRect.width() / currentScale;
float cropHeight = this.mCropRect.height() / currentScale;
if (cropWidth > ((float) this.mMaxResultImageSizeX) || cropHeight > ((float) this
.mMaxResultImageSizeY)) {
float resizeScale = Math.min(((float) this.mMaxResultImageSizeX) / cropWidth, (
(float) this.mMaxResultImageSizeY) / cropHeight);
Bitmap resizedBitmap = Bitmap.createScaledBitmap(viewBitmap, (int) (((float)
viewBitmap.getWidth()) * resizeScale), (int) (((float) viewBitmap
.getHeight()) * resizeScale), false);
if (viewBitmap != resizedBitmap) {
viewBitmap.recycle();
}
viewBitmap = resizedBitmap;
currentScale /= resizeScale;
}
}
if (currentAngle != 0.0f) {
this.mTempMatrix.reset();
this.mTempMatrix.setRotate(currentAngle, (float) (viewBitmap.getWidth() / 2), (float)
(viewBitmap.getHeight() / 2));
Bitmap rotatedBitmap = Bitmap.createBitmap(viewBitmap, 0, 0, viewBitmap.getWidth(),
viewBitmap.getHeight(), this.mTempMatrix, true);
if (viewBitmap != rotatedBitmap) {
viewBitmap.recycle();
}
viewBitmap = rotatedBitmap;
}
return Bitmap.createBitmap(viewBitmap, (int) ((this.mCropRect.left - currentImageRect
.left) / currentScale), (int) ((this.mCropRect.top - currentImageRect.top) /
currentScale), (int) (this.mCropRect.width() / currentScale), (int) (this
.mCropRect.height() / currentScale));
}