The Requirements
I’m not sure how to describe this so I’ll give an example that should be easier to explain.
I have a small (maximum 50×50 pixels) 1bit/pixel bitmap (black and white).
Only one pixel is added at a time.
Find the largest (by area) polygon that exists using the black pixels as the edges.
The actual scenario isn’t actually graphics related and uses a 2D Boolean array but the logic would be the same I imagine.
The Desired Behavior

The problem
I am not sure how to get the largest polygon when it is completed. I can do the filling if I can just get the polygon. In the above image I have highlighted the polygon that should be selected.
It turns out it was much more simple than I was expecting. I guess I was trying to make things overcomplicated. Because of the small dimensions and the fact that it will not run that frequently, speed is not a really an issue.
I don’t have access to exactly how I did it right now but this is the general idea.
Each pixel is stored as an instance of SomePixelType.
There is a Stack<SomePixelType> of pixels called visitedPixels.
A pixel is considered a possible polygon edge if:
SomePixelType has a method named GetNextPixel.
When GetNextPixel is called it will search neighbouring pixels (starting directly up and going clockwise) for a possible polygon edge and return it. Calling it again will continue searching from the last match. Once all neighbouring pixels have been checked it will return null.
When a pixel is set this method would be called.
From here on it is fairly easy to fill in. As the question was about finding the polygon I will stop at this step.