code: public static void scale(Bitmap src, Bitmap dest, int clearColor,
                               int x, int y, int sw, int sh,
                               int dx, int dy,
                               int dw, int dh) {
          clearBitmap(dest, clearColor);
          Canvas canvas = new Canvas(dest);
          Paint paint = WorkCache.PAINT.get();
          paint.setFilterBitmap(true);
          canvas.drawBitmap(src, new Rect(x + 1, y + 1, sw - 1, sh - 1), new Rect(dx, dy, dw, dh), paint);
          canvas.setBitmap(null);
      }
docs: Scaling region of bitmap to destination bitmap region
  
  @param src        source bitmap
  @param dest       destination bitmap
  @param clearColor color for clearing dest before drawing
  @param x          source x
  @param y          source y
  @param sw         source width
  @param sh         source height
  @param dx         destination x
  @param dy         destination y
  @param dw         destination width
  @param dh         destination height