static getImageDataBBox(imageData, w, h) {
    if (imageData.length !== w * h * 4) return null;
    const min = { x: w, y: h };
    const max = { x: 0, y: 0 };

    for (let y = 0; y < h; y++) {
      for (let x = 0; x < w; x++) {
        const alphaIndex = 4 * (y * w + x) + 3;

        if (imageData[alphaIndex]) {
          if (min.x > x) min.x = x;
          if (min.y > y) min.y = y;
          if (max.x < x) max.x = x;
          if (max.y < y) max.y = y;
        }
      }
    }
    return min.x <= max.x && min.y <= max.y
      ? { x: min.x, y: min.y, width: max.x - min.x, height: max.y - min.y }
      : null;
  }
Calculate BBox of Brush region from image data
@param {Uint8ClampedArray} imageData Array containing the data in the RGBA order
@param {Number} width
@param {Number} height
@return {BBox}