Thema: Delphi FloodFill Rekursiv

Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#6

Re: FloodFill Rekursiv

  Alt 19. Jun 2007, 13:15
Ok thx. Also ich habs jetzt so abgeändert:

Delphi-Quellcode:
procedure FloodFill(ABmp: TBitmap; x,y: Integer; AColor: TColor; Border: TColor);
begin
  if (ABmp.Canvas.Pixels[x,y] <> Border) and (ABmp.Canvas.Pixels[x,y] <> AColor)
    and (x <= ABmp.Width) and (x >= 0) and (y <= ABmp.Height) and (y >= 0)
  then
  begin
    ABmp.Canvas.Pixels[x,y] := AColor;
    FloodFill(ABmp,x,y+1,AColor,Border);
    FloodFill(ABmp,x,y-1,AColor,Border);
    FloodFill(ABmp,x+1,y,AColor,Border);
    FloodFill(ABmp,x-1,y,AColor,Border);
  end;
end;
Das klappt auch bei manchen flächen.. Aber bei Flächen die viel Bitmap-Rand enthalten gibts wieder en Stack-Overflow... -.-

Gruß
Neutral General
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat