docs: protected void updateImageState() {
          float viewWidth = getWidth();
          float viewHeight = getHeight();
  
          if ((int) viewWidth <= 0 || (int) viewHeight <= 0) {
              return;
          }
  
          if (sourceBitmap != null) {
              BitmapShader imageShader = new BitmapShader(sourceBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
              imagePaint.setShader(imageShader);
  
              // Scale the bitmap using a matrix, ensuring that it always matches the view bounds.
              float bitmapWidth = sourceBitmap.getWidth();
              float bitmapHeight = sourceBitmap.getHeight();
  
              float scaleFactor = (bitmapWidth < bitmapHeight) ? bitmapWidth : bitmapHeight;
              float xScale = viewWidth / scaleFactor;
              float yScale = viewHeight / scaleFactor;
  
              // Translate image to center crop (if it is not a perfect square bitmap)
              float dx = 0;
              float dy = 0;
  
              if (bitmapWidth > bitmapHeight) {
                  dx = (viewWidth - bitmapWidth * xScale) * 0.5f;
              }
              else if (bitmapHeight > bitmapWidth) {
                  dy = (viewHeight - bitmapHeight * yScale) * 0.5f;
              }
  
              matrix.set(null);
              matrix.setScale(xScale, yScale);
              matrix.postTranslate((dx + 0.5f), (dy + 0.5f));
  
              imageShader.setLocalMatrix(matrix);
              imageRectF.set(0, 0, viewWidth, viewHeight);
          }
          updateBackground();
          invalidate();
      }