![]() |
![]() |
![]() |
procedure FloodFill(img: TImage32; x, y: Integer; newColor: TColor32; compareFunc: TCompareFunction = nil; tolerance: Integer = 0);
FloodFill recolors pixels in the region defined by the starting pixel (x,y) and any adjacent pixels that closely match the starting pixel. Non-matching pixels form a barrier to further filling. If no CompareFunc is supplied, FloodFill will recolor only those pixels that exactly match the starting pixel.
Alternatively, the library user can choose one of the predefined compare functions, CompareRGB or CompareHue, or a custom compare function.
uses Image32, Image32_PNG, Image32_vector, Image32_Extra; ... var img: TImage32; begin img := TImage32.Create; img.LoadFromResource('BEETLE', 'PNG'); FloodFill(img, 90,130, clLime32, CompareRGB, 100); FloodFill(img, 140,110, clLime32, CompareRGB, 100); img.SaveToFile('floodfill.png'); img.Free; end;
Before:![]() |
After:![]() |
Copyright ©2019 Angus Johnson - Image32 ver. 1.54 - Documentation last updated on 7-November-2020