---
title: "GdiGraphics..::.FloodFill Method (Single, Single, Brush, Color, FloodFillMode, Single, Boolean, Boolean)"
canonical: https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Drawing_GdiGraphics_FloodFill_8_f2fe5cc7.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# GdiGraphics.FloodFill Method (Single, Single, Brush, Color, FloodFillMode, Single, Boolean, Boolean)
 
Fills an area of the display surface with the specified brush starting from specified point.
 
**Namespace:** [Aurigma.GraphicsMill.Drawing](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Drawing.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```
Public Sub FloodFill ( _x As Single, _y As Single, _brush As Brush, _targetColor As Color, _mode As FloodFillMode, _tolerance As Single, _preserveAlpha As Boolean, _processHalftones As Boolean _
)
```
 
```csharp
public void FloodFill(float x,float y,Brush brush,Color targetColor,FloodFillMode mode,float tolerance,bool preserveAlpha,bool processHalftones
)
```
 
### Parameters
 
 - x
     - Type: [System.Single](http://msdn2.microsoft.com/en-us/3www918f)
X-coordinate of the point to start filling from.

 - y
     - Type: [System.Single](http://msdn2.microsoft.com/en-us/3www918f)
Y-coordinate of the point to start filling from.

 - brush
     - Type: [Aurigma.GraphicsMill.Drawing.Brush](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_Brush.htm.md)
 [Brush](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_Brush.htm.md) class instance used to fill the surface. Currently only [SolidBrush](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_SolidBrush.htm.md) is supported.

 - targetColor
     - Type: [Aurigma.GraphicsMill.Color](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Color.htm.md)
The [Color](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Color.htm.md) which is used to determine the filling area boundaries. The method behaviour depends on *mode* argument value. If *mode* is [UntilColor](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_FloodFillMode.htm.md), this is a boundary color (when algorithm meets this color, it stops filling). If *mode* is [TillColor](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_FloodFillMode.htm.md), this is a surface color (algorithm continue filling till current color is the same as target color).

 - mode
     - Type: [Aurigma.GraphicsMill.Transforms.FloodFillMode](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_FloodFillMode.htm.md)
 [FloodFillMode](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_FloodFillMode.htm.md) value specifying how to determine the filling area boundary (see comments for *targetColor*).

 - tolerance
     - Type: [System.Single](http://msdn2.microsoft.com/en-us/3www918f)
Value in range [0, 1] specifying admissible tolerance (distance between colors in color space) when comparing current color and target color (see comments for *targetColor*). Minimum value (0) means exact match of the colors, maximum value (1) means that any color matches.

 - preserveAlpha
     - Type: [System.Boolean](http://msdn2.microsoft.com/en-us/a28wyd50)
Value specifying if to preserve alpha channel. If **true**, alpha channel will not be overwritten by the colors defined by filling brush.

 - processHalftones
     - Type: [System.Boolean](http://msdn2.microsoft.com/en-us/a28wyd50)
Value specifying how to handle situations when current color does not exactly match target color, but tolerant to it (with specified *tolerance*). If **false**, this pixel is replaced with brush color, if **true**, it is alpha-blended (alpha is calculated as 1 - T, where T is actual tolerance between these colors).
 
## Remarks
  
**Note** 
Flood fill can be applied only at [GdiGraphics](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_GdiGraphics.htm.md) which is associated with [Bitmap](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Bitmap.htm.md). If you try to apply it at [GdiGraphics](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_GdiGraphics.htm.md) associated with device context, method will throw an exception.
   
## See Also

### Reference

- [GdiGraphics Class](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_GdiGraphics.htm.md)
- [FloodFill Overload](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_FloodFill.htm.md)
- [Aurigma.GraphicsMill.Drawing Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Drawing.htm.md)
