The function description is as follows:
{x,y: Current coordinates
Color: Performing a fill event for this color
Fillstyle:fsborder (fill from current position until color is encountered), fssurface (current background color and color are filled together)} procedure Tcanvas.floodfill (X, Y:integer; Color:tcolor; Fillstyle:tfillstyle);
Sample code
Procedure Tform15.btn1click (Sender:tobject); Const POINTS1:ARRAY[0..2] of Tpoint = (x:0; y:0), (x:100; y:100), (x:15;
Y:50)); POINTS2:ARRAY[0..2] of tpoint = (x:0; y:200), (x:100; y:300), (x:50;
Y:350)); Begin self.
Repaint;
Canvas.Pen.Color: = clred; Canvas.
brush.color:=clred;
Canvas.polygon (POINTS1); Canvas.
Brush.color:=clgreen;
Canvas.floodfill (0,0,clred,fssurface);
Canvas.Pen.Color: = clred;
Canvas.polygon (POINTS2); Canvas.
Brush.color:=clgreen;
Canvas.floodfill (50,250,clred,fsborder);
End
Procedure Tform15.btn2click (Sender:tobject); Const POINTS3:ARRAY[0..3] of Tpoint = (x:0; y:0), (x:100; y:100), (x:15; Y:50), (x:0;
y:0)); POINTS4:ARRAY[0..3] of tpoint = (x:0; y:200), (x:100; y:300), (x:50; y:350), (x:0;
y:200)); Begin self.
Repaint;
Canvas.Pen.Color: = clred;
Canvas.Pen.Width: = 2;
Canvas.polyline (POINTS3); Canvas.
Brush.color:=clgreen;
Canvas.floodfill (0,0,clred,fssurface);
Canvas.Pen.Color: = clred;Canvas.polyline (POINTS4); Canvas.
Brush.color:=clgreen;
Canvas.floodfill (50,280,clred,fsborder); End