Recent

Author Topic: Flood Fill  (Read 4661 times)

JasonLugg

  • Jr. Member
  • **
  • Posts: 67
Flood Fill
« on: August 29, 2017, 08:42:37 pm »
Hi All

Thanks in advance. I am struggling with flood fill. If I draw a (closed) shape on a tImage.Canvas and then choose flood fill, the closed shape is filled which is all good.

However, If I load an image and copy it to the canvas in question, and then chose flood fill the entire image is filled (i.e fill does not stop at a boundary)?

Code: Pascal  [Select][+][-]
  1. tTileIn.Canvas.Brush.Color:=tColourIn;
  2.      tTileIn.Canvas.FloodFill(MouseXIn, MouseYIn, tColourIn, tFillStyle.fsBorder);
  3.      tTileIn.Refresh;                                                            

I have tried both fill styles to no avail!

Any help much appreciated.

[Win 7].

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Flood Fill
« Reply #1 on: August 29, 2017, 09:01:04 pm »
FloodFill fills the area around (X,Y) with the current Brush.Color.

It stops filling when it meets a border (fsBorder) of a different Color (specified as a parameter in the call), or a solid region (fsSurface) of a different Color, or when  it reaches the bounds of the canvas.

 

TinyPortal © 2005-2018