The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....


Class: none
Declaration: [1] function FloodFillArray (px, py: integer; Target: integer; var Data: TInt2DArray; var ATop, ABot, ALeft, ARight: integer): integer;
[2] function FloodFillArray (px, py: integer; Tolerance: double; Target: double; var Data: TDouble2DArray; var ATop, ABot, ALeft, ARight: integer): integer;

The function FloodFillArray fills all connected cells of the Data array with the value specified by Target. Cells are considered to be connected if they have a common edge and their values either are equal to Data[px,py] (version [1]) or are within the range defined by Data[px,py]+/-Tolerance (version [2]). The starting point of the flood fill algorithm is controlled by px and py (zero-based coordinates). On return, the variable parameters ATop, ABot, ALeft and ARight specify the circumscribing rectangle of the filled area.

The function returns the following error codes:

>0 ... everything is OK, the returned number is the number of cells belonging to the filled region
-1 ... [px,py] points to a cell outside the Data array

Last Update: 2018-Jul-30