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
 
#16

Re: FloodFill Rekursiv

  Alt 20. Jun 2007, 17:55
...muss euch nochmal um Hilfe bitten bei der Sache:
Das ganze sieht jetzt so aus:

Delphi-Quellcode:
procedure FloodFill(ABmp: TBitmap; x,y: Integer; AColor: TColor; Border: TColor; var Map: TBoolmap);
var l,i: Integer;
    r,g,b: Byte;
    c: TColor;
begin
  if Length(Map) = 0 then
  begin
    SetLength(Map,Abmp.Height);
    for i:= 0 to ABmp.Height-1 do
      SetLength(Map[i],ABmp.Width);
  end;

  if Map[y,x] then
    exit;

  if (ABmp.Canvas.Pixels[x,y] <> Border) and (x >= 0) and (x <= ABmp.Width-1)
    and (y <= ABmp.Height-1) and (y >= 0)
  then
  begin
    l := GetRValue(ABmp.Canvas.Pixels[x,y]);
    r:= cut(GetRValue(AColor)-(255-l));
    g:= cut(GetGValue(AColor)-(255-l));
    b:= cut(GetBValue(AColor)-(255-l));
    c := RGB(r,g,b);

    ABmp.Canvas.Pixels[x,y] := c;
    Map[y,x] := true;

    FloodFill(ABmp,x,y+1,AColor,Border,Map);
    FloodFill(ABmp,x,y-1,AColor,Border,Map);
    FloodFill(ABmp,x+1,y,AColor,Border,Map);
    FloodFill(ABmp,x-1,y,AColor,Border,Map);
  end;
end;
Seitdem ich das mehrfarbige Floodfill hab gibts en Stackoverflow. Dann hab ich halt das BooleanArray hinzugefügt aber es kommt immernoch ein Stack Overflow -.-

Wodran liegt das denn jetzt bitte ? -.-

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