public MatrixAssert isIdentity() { isNotNull(); assertThat(actual.isIdentity()) // .overridingErrorMessage("Expected to be identity matrix but was not.") // .isTrue(); return this; }
public MatrixAssert isNotIdentity() { isNotNull(); assertThat(actual.isIdentity()) // .overridingErrorMessage("Expected to not be identity matrix but was.") // .isTrue(); return this; } }
@Test public void testIsIdentity() { final Matrix matrix = new Matrix(); assertThat(matrix.isIdentity()) .isTrue(); matrix.postScale(2.0f, 2.0f); assertThat(matrix.isIdentity()) .isFalse(); }
@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(); }
@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(); }
@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(); } }
private static void checkInverse(Matrix matrix) { final Matrix inverse = new Matrix(); assertThat(matrix.invert(inverse)) .isTrue(); matrix.postConcat(inverse); assertThat(matrix.isIdentity()) .isTrue(); } }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }