本文整理了Java中android.graphics.Matrix.isIdentity()
方法的一些代码示例,展示了Matrix.isIdentity()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.isIdentity()
方法的具体详情如下:
包路径:android.graphics.Matrix
类名称:Matrix
方法名:isIdentity
暂无
代码示例来源:origin: square/assertj-android
public MatrixAssert isIdentity() {
isNotNull();
assertThat(actual.isIdentity()) //
.overridingErrorMessage("Expected to be identity matrix but was not.") //
.isTrue();
return this;
}
代码示例来源:origin: square/assertj-android
public MatrixAssert isNotIdentity() {
isNotNull();
assertThat(actual.isIdentity()) //
.overridingErrorMessage("Expected to not be identity matrix but was.") //
.isTrue();
return this;
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testIsIdentity() {
final Matrix matrix = new Matrix();
assertThat(matrix.isIdentity())
.isTrue();
matrix.postScale(2.0f, 2.0f);
assertThat(matrix.isIdentity())
.isFalse();
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testReset() {
final Matrix matrix = new Matrix();
matrix.postScale(2.0f, 2.0f);
matrix.postTranslate(1.0f, 2.0f);
matrix.postRotate(45.0f);
matrix.reset();
assertThat(matrix.isIdentity())
.isTrue();
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testSet() {
final Matrix matrix1 = new Matrix();
matrix1.postScale(2.0f, 2.0f);
matrix1.postTranslate(1.0f, 2.0f);
matrix1.postRotate(45.0f);
final Matrix matrix2 = new Matrix();
matrix2.set(matrix1);
assertThat(matrix1)
.isEqualTo(matrix2);
matrix2.set(null);
assertThat(matrix2.isIdentity())
.isTrue();
}
代码示例来源:origin: sephiroth74/ImageViewZoom
@Override
public void setImageMatrix(Matrix matrix) {
Matrix current = getImageMatrix();
boolean needUpdate = false;
if (matrix == null && !current.isIdentity() || matrix != null && !current.equals(matrix)) {
needUpdate = true;
}
super.setImageMatrix(matrix);
if (needUpdate) {
onImageMatrixChanged();
}
}
代码示例来源:origin: robolectric/robolectric
private static void checkInverse(Matrix matrix) {
final Matrix inverse = new Matrix();
assertThat(matrix.invert(inverse))
.isTrue();
matrix.postConcat(inverse);
assertThat(matrix.isIdentity())
.isTrue();
}
}
代码示例来源:origin: ZieIony/Carbon
public void getHitRect(@NonNull Rect outRect) {
Matrix matrix = getMatrix();
if (matrix.isIdentity()) {
outRect.set(getLeft(), getTop(), getRight(), getBottom());
} else {
tmpHitRect.set(0, 0, getWidth(), getHeight());
matrix.mapRect(tmpHitRect);
outRect.set((int) tmpHitRect.left + getLeft(), (int) tmpHitRect.top + getTop(),
(int) tmpHitRect.right + getLeft(), (int) tmpHitRect.bottom + getTop());
}
outRect.left -= touchMargin.left;
outRect.top -= touchMargin.top;
outRect.right += touchMargin.right;
outRect.bottom += touchMargin.bottom;
}
代码示例来源:origin: ZieIony/Carbon
public void getHitRect(@NonNull Rect outRect) {
Matrix matrix = getMatrix();
if (matrix.isIdentity()) {
outRect.set(getLeft(), getTop(), getRight(), getBottom());
} else {
tmpHitRect.set(0, 0, getWidth(), getHeight());
matrix.mapRect(tmpHitRect);
outRect.set((int) tmpHitRect.left + getLeft(), (int) tmpHitRect.top + getTop(),
(int) tmpHitRect.right + getLeft(), (int) tmpHitRect.bottom + getTop());
}
outRect.left -= touchMargin.left;
outRect.top -= touchMargin.top;
outRect.right += touchMargin.right;
outRect.bottom += touchMargin.bottom;
}
代码示例来源:origin: ZieIony/Carbon
public void getHitRect(@NonNull Rect outRect) {
Matrix matrix = getMatrix();
if (matrix.isIdentity()) {
outRect.set(getLeft(), getTop(), getRight(), getBottom());
} else {
tmpHitRect.set(0, 0, getWidth(), getHeight());
matrix.mapRect(tmpHitRect);
outRect.set((int) tmpHitRect.left + getLeft(), (int) tmpHitRect.top + getTop(),
(int) tmpHitRect.right + getLeft(), (int) tmpHitRect.bottom + getTop());
}
outRect.left -= touchMargin.left;
outRect.top -= touchMargin.top;
outRect.right += touchMargin.right;
outRect.bottom += touchMargin.bottom;
}
代码示例来源:origin: ZieIony/Carbon
public void getHitRect(@NonNull Rect outRect) {
Matrix matrix = getMatrix();
if (matrix.isIdentity()) {
outRect.set(getLeft(), getTop(), getRight(), getBottom());
} else {
tmpHitRect.set(0, 0, getWidth(), getHeight());
matrix.mapRect(tmpHitRect);
outRect.set((int) tmpHitRect.left + getLeft(), (int) tmpHitRect.top + getTop(),
(int) tmpHitRect.right + getLeft(), (int) tmpHitRect.bottom + getTop());
}
outRect.left -= touchMargin.left;
outRect.top -= touchMargin.top;
outRect.right += touchMargin.right;
outRect.bottom += touchMargin.bottom;
}
代码示例来源:origin: ZieIony/Carbon
public void getHitRect(@NonNull Rect outRect) {
Matrix matrix = getMatrix();
if (matrix.isIdentity()) {
outRect.set(getLeft(), getTop(), getRight(), getBottom());
} else {
tmpHitRect.set(0, 0, getWidth(), getHeight());
matrix.mapRect(tmpHitRect);
outRect.set((int) tmpHitRect.left + getLeft(), (int) tmpHitRect.top + getTop(),
(int) tmpHitRect.right + getLeft(), (int) tmpHitRect.bottom + getTop());
}
outRect.left -= touchMargin.left;
outRect.top -= touchMargin.top;
outRect.right += touchMargin.right;
outRect.bottom += touchMargin.bottom;
}
代码示例来源:origin: ZieIony/Carbon
public void getHitRect(@NonNull Rect outRect) {
Matrix matrix = getMatrix();
if (matrix.isIdentity()) {
outRect.set(getLeft(), getTop(), getRight(), getBottom());
} else {
tmpHitRect.set(0, 0, getWidth(), getHeight());
matrix.mapRect(tmpHitRect);
outRect.set((int) tmpHitRect.left + getLeft(), (int) tmpHitRect.top + getTop(),
(int) tmpHitRect.right + getLeft(), (int) tmpHitRect.bottom + getTop());
}
outRect.left -= touchMargin.left;
outRect.top -= touchMargin.top;
outRect.right += touchMargin.right;
outRect.bottom += touchMargin.bottom;
}
代码示例来源:origin: ZieIony/Carbon
public void getHitRect(@NonNull Rect outRect) {
Matrix matrix = getMatrix();
if (matrix.isIdentity()) {
outRect.set(getLeft(), getTop(), getRight(), getBottom());
} else {
tmpHitRect.set(0, 0, getWidth(), getHeight());
matrix.mapRect(tmpHitRect);
outRect.set((int) tmpHitRect.left + getLeft(), (int) tmpHitRect.top + getTop(),
(int) tmpHitRect.right + getLeft(), (int) tmpHitRect.bottom + getTop());
}
outRect.left -= touchMargin.left;
outRect.top -= touchMargin.top;
outRect.right += touchMargin.right;
outRect.bottom += touchMargin.bottom;
}
代码示例来源:origin: ZieIony/Carbon
public void getHitRect(@NonNull Rect outRect) {
Matrix matrix = getMatrix();
if (matrix.isIdentity()) {
outRect.set(getLeft(), getTop(), getRight(), getBottom());
} else {
tmpHitRect.set(0, 0, getWidth(), getHeight());
matrix.mapRect(tmpHitRect);
outRect.set((int) tmpHitRect.left + getLeft(), (int) tmpHitRect.top + getTop(),
(int) tmpHitRect.right + getLeft(), (int) tmpHitRect.bottom + getTop());
}
outRect.left -= touchMargin.left;
outRect.top -= touchMargin.top;
outRect.right += touchMargin.right;
outRect.bottom += touchMargin.bottom;
}
代码示例来源:origin: ZieIony/Carbon
public void getHitRect(@NonNull Rect outRect) {
Matrix matrix = getMatrix();
if (matrix.isIdentity()) {
outRect.set(getLeft(), getTop(), getRight(), getBottom());
} else {
tmpHitRect.set(0, 0, getWidth(), getHeight());
matrix.mapRect(tmpHitRect);
outRect.set((int) tmpHitRect.left + getLeft(), (int) tmpHitRect.top + getTop(),
(int) tmpHitRect.right + getLeft(), (int) tmpHitRect.bottom + getTop());
}
outRect.left -= touchMargin.left;
outRect.top -= touchMargin.top;
outRect.right += touchMargin.right;
outRect.bottom += touchMargin.bottom;
}
代码示例来源:origin: ZieIony/Carbon
public void getHitRect(@NonNull Rect outRect) {
Matrix matrix = getMatrix();
if (matrix.isIdentity()) {
outRect.set(getLeft(), getTop(), getRight(), getBottom());
} else {
tmpHitRect.set(0, 0, getWidth(), getHeight());
matrix.mapRect(tmpHitRect);
outRect.set((int) tmpHitRect.left + getLeft(), (int) tmpHitRect.top + getTop(),
(int) tmpHitRect.right + getLeft(), (int) tmpHitRect.bottom + getTop());
}
outRect.left -= touchMargin.left;
outRect.top -= touchMargin.top;
outRect.right += touchMargin.right;
outRect.bottom += touchMargin.bottom;
}
代码示例来源:origin: ZieIony/Carbon
public void getHitRect(@NonNull Rect outRect) {
Matrix matrix = getMatrix();
if (matrix.isIdentity()) {
outRect.set(getLeft(), getTop(), getRight(), getBottom());
} else {
tmpHitRect.set(0, 0, getWidth(), getHeight());
matrix.mapRect(tmpHitRect);
outRect.set((int) tmpHitRect.left + getLeft(), (int) tmpHitRect.top + getTop(),
(int) tmpHitRect.right + getLeft(), (int) tmpHitRect.bottom + getTop());
}
outRect.left -= touchMargin.left;
outRect.top -= touchMargin.top;
outRect.right += touchMargin.right;
outRect.bottom += touchMargin.bottom;
}
代码示例来源:origin: ZieIony/Carbon
public void getHitRect(@NonNull Rect outRect) {
Matrix matrix = getMatrix();
if (matrix.isIdentity()) {
outRect.set(getLeft(), getTop(), getRight(), getBottom());
} else {
tmpHitRect.set(0, 0, getWidth(), getHeight());
matrix.mapRect(tmpHitRect);
outRect.set((int) tmpHitRect.left + getLeft(), (int) tmpHitRect.top + getTop(),
(int) tmpHitRect.right + getLeft(), (int) tmpHitRect.bottom + getTop());
}
outRect.left -= touchMargin.left;
outRect.top -= touchMargin.top;
outRect.right += touchMargin.right;
outRect.bottom += touchMargin.bottom;
}
代码示例来源:origin: ZieIony/Carbon
public void getHitRect(@NonNull Rect outRect) {
Matrix matrix = getMatrix();
if (matrix.isIdentity()) {
outRect.set(getLeft(), getTop(), getRight(), getBottom());
} else {
tmpHitRect.set(0, 0, getWidth(), getHeight());
matrix.mapRect(tmpHitRect);
outRect.set((int) tmpHitRect.left + getLeft(), (int) tmpHitRect.top + getTop(),
(int) tmpHitRect.right + getLeft(), (int) tmpHitRect.bottom + getTop());
}
outRect.left -= touchMargin.left;
outRect.top -= touchMargin.top;
outRect.right += touchMargin.right;
outRect.bottom += touchMargin.bottom;
}
内容来源于网络,如有侵权,请联系作者删除!