docs: public CloseableReference<Bitmap> createBitmap(
        Bitmap source,
        int x,
        int y,
        int width,
        int height,
        @Nullable Matrix matrix,
        boolean filter,
        @Nullable Object callerContext) {
      Preconditions.checkNotNull(source, "Source bitmap cannot be null");
      checkXYSign(x, y);
      checkWidthHeight(width, height);
      checkFinalImageBounds(source, x, y, width, height);
  
      // assigned because matrix can modify the final width, height
      int newWidth = width;
      int newHeight = height;
  
      Canvas canvas;
      CloseableReference<Bitmap> bitmapRef;
      Paint paint;
  
      Rect srcRectangle = new Rect(x, y, x + width, y + height);
      RectF dstRectangle = new RectF(0, 0, width, height);
      Bitmap.Config newConfig = getSuitableBitmapConfig(source);
  
      if (matrix == null || matrix.isIdentity()) {
        bitmapRef = createBitmap(newWidth, newHeight, newConfig, source.hasAlpha(), callerContext);
        setPropertyFromSourceBitmap(source, bitmapRef.get());
        canvas = new Canvas(bitmapRef.get());
        paint = null;   // not needed
      } else {
        boolean transformed = !matrix.rectStaysRect();
        RectF deviceRectangle = new RectF();
        matrix.mapRect(deviceRectangle, dstRectangle);
  
        newWidth = Math.round(deviceRectangle.width());
        newHeight = Math.round(deviceRectangle.height());
        bitmapRef =
            createBitmap(
                newWidth,
                newHeight,
                transformed ? Bitmap.Config.ARGB_8888 : newConfig,
                transformed || source.hasAlpha(),
                callerContext);
  
        setPropertyFromSourceBitmap(source, bitmapRef.get());
        canvas = new Canvas(bitmapRef.get());
        canvas.translate(-deviceRectangle.left, -deviceRectangle.top);
        canvas.concat(matrix);
  
        paint = new Paint();
        paint.setFilterBitmap(filter);
        if (transformed) {
          paint.setAntiAlias(true);
        }
      }
  
      canvas.drawBitmap(source, srcRectangle, dstRectangle, paint);
      canvas.setBitmap(null);
  
      return bitmapRef;
    }