Math2DFloodFill_4Neighbour(Int32, Int32, FuncInt32, Int32, Boolean, ActionInt32, Int32, FuncInt32, Int32, Boolean) Method |
A very general flood fill algorithm (4-Neighbour algorithm).
It tests iteratively the 4 neighbouring pixels.
Namespace: Altaxo.GeometryAssembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3179.0 (4.8.3179.0)
Syntax public static void FloodFill_4Neighbour(
int xStart,
int yStart,
Func<int, int, bool> IsPixelToBeFilled,
Action<int, int> SetPixelToNewValue,
Func<int, int, bool> IsPixelCoordinateValid
)
Parameters
- xStart Int32
- The start pixel's x coordinate.
- yStart Int32
- The start pixel's x coordinate.
- IsPixelToBeFilled FuncInt32, Int32, Boolean
-
Function that evaluated if the pixel fulfills a condition so that it should be set to a new value.
Args are the x and y pixel coordinates,
the return value is true if the pixel should be set to a new value.
- SetPixelToNewValue ActionInt32, Int32
-
Action to set the pixel to a new value.
Args are the x and y coordinates of the pixel.
Since the pixel's value is never tested again, there is no need to really set the pixel's value.
Thus, this action can also be used to count the pixels that fulfill the condition given in IsPixelToBeFilled, etc.
- IsPixelCoordinateValid FuncInt32, Int32, Boolean
- Tests the pixel coordinate to find out if it is in a valid range. Params are x, y of the pixel coordinate. The return value is true if the coordinate is valid, i.e. the pixel should be processed; otherwise, it is false.
See Also