The motivation behind this implementation was my inability to find a floodfill implementation in either Swing or SWT. If you are working in computer graphics with Java, you might find some of these ideas and implementation useful.
Try the online demo, or download the demo. Run swt.bat or swing.bat, and you should see a map of the United States. Click on any state and you should see it color up.
Take a look at the running storytests that guarantee the correctness of the system.
To make this implementation faster, we could scan rectangles instead of lines. To go about this,
we have some failing storytests. The real challenge is
in creating the right testing framework that can guarantee correctness. The intuitive and
documenting nature of the storytests takes several iterations to evolve, and the intent
of this page is to show such storytests.
Take a look at the source code to examine the design.
Please direct your feedback to somik at stanford dot edu.