Given a 2-dimensional 2-color bitmap, write a function to implement flood fill, e.g. the bucket in MS Paint. Assume that the fill will only fill white pixels with black.
The function should take the following parameters:
- A 2D array of booleans representing the pixels in the bitmap
- The X and Y position of the start point for the fill
So for example, in Java:
public void floodFill(boolean[][] bitmap, int xStart, int yStart)
This is a classic flood fill problem: starting from a given coordinate, convert all connected white pixels to black. A typical solution uses DFS or BFS to explore the four neighboring cells, stopping when it goes out of bounds or reaches a non-white pixel. The main challenges are handling boundaries correctly and avoiding repeated visits.