android.graphics.Matrix.isIdentity()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(182)

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

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

相关文章