0

I need a flood fill algorithm to fill existing raster shapes with various colors and fill patterns. From what I know, the QuickFill algorithm is the best way to do a flood fill. I've found a number of implementations, but they are all in C++ and use Windows SDK functions. The problem is that I need a .NET implementation.

If worse comes to worse I can write a new implementation, but I would rather use an existing implementation (that hopefully doesn't have bugs). Is anyone aware of an existing flood fill implementation in C#/VB.NET?

Dharman
  • 30,962
  • 25
  • 85
  • 135
Erick T
  • 7,009
  • 9
  • 50
  • 85
  • Are you talking about _the_ `System.Drawing.Graphics` .NET class? – BeemerGuy Nov 20 '10 at 01:39
  • Beemer, I would like to use types in the Graphics class, but I didn't find any flood fill types, unless you have an existing graphics path. I am dealing with raster images, so no luck there. – Erick T Dec 01 '10 at 00:28

1 Answers1

2

I like a lot to work with the Aforge Library that has two good FlodFill implementations, but both are 4 directional only.

If you need other implementations there exist two code project articles Flood Fill Algorithms in C# and GDI+ and Queue-Linear Flood Fill: A Fast Flood Fill Algorithm.

And if you like to dig in the code and learn, there is the Paint .Net project that has an excelent flood fill implementation.

Edgar Hernandez
  • 4,020
  • 1
  • 24
  • 27