Flood Fill Task

The flood fill task is designed to give you a graphical way of solving a problem through differing efficiency. A task that at first glance looks like a simple use of recursion quickly becomes too cumbersome.

A flood fill is a process of filling an image's boundary with a selected colour.

There are varying methods for achieving this, but to save time, there is a skeleton VB.NET project that provides a method of loading a bitmap and visually selecting the area to fill. Python users have a number of ways to achieve this as shown in the link here.

If you wish to undertake your own program, you will need to create a Windows form application as doing this in console mode is possible, but provides no visible way to select the image or display it. Bitmaps are best here as they are uncompressed and therefore do not require compression work or display artefacts of lossy compression.

There is an excellent Wikipedia article on flood filling and it lists varying methods to achieve it. You should attempt to implement one of these algorithms.

To make this work, you need to add a project reference to system.drawing. This is achieved by right-clicking references in the solution explorer and selecting 'add reference' as shown below

Within the system.drawing class is a bitmap class, which we will use. The bitmap supports many methods, including GetPixel(x,y) which returns a color object. It also supports a SetPixel(x,y,color) method to set individual pixels.

Sample skeleton program