DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information....


Declaration: FloodFillMatrix (px, py: integer; Tolerance: double; Target: double; var Data: TDouble2DArray; var ATop, ABot, ALeft, ARight: integer): integer;
Fills all connected pixels of the Data matrix with the value specified by Target. Pixels are considered to be connected if they have a common edge and their values are within the range defined by Data[px,py]+/-Tolerance. The starting point of the flood fill algorithm is controlled by px and py (zero-based pixel coordinates). On return, the variable parameters ATop, ABot, ALeft and ARight specify the circumscribing rectangle of the filled area (pixel coordinates).

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 pixel outside the Data array