Code example for Matrix

Methods: isIdentity

0
    return newBitmap;
  } 
 
  @Implementation 
  public static Bitmap createBitmap(Bitmap src, int x, int y, int width, int height, Matrix matrix, boolean filter) {
    if (x == 0 && y == 0 && width == src.getWidth() && height == src.getHeight() && (matrix == null || matrix.isIdentity())) {
      return src; // Return the original.
    } 
 
    Bitmap newBitmap = Robolectric.newInstanceOf(Bitmap.class);
    ShadowBitmap shadowBitmap = shadowOf(newBitmap);
 
    shadowBitmap.appendDescription(shadowOf(src).getDescription());
    shadowBitmap.appendDescription(" at (" + x + "," + y);
    shadowBitmap.appendDescription(" with width " + width + " and height " + height);
    if (matrix != null) {
      shadowBitmap.appendDescription(" using matrix " + matrix);
    } 
    if (filter) {
      shadowBitmap.appendDescription(" with filter");