Hallo Freunde,
ich finde den Fehler in dieser Procedure nicht. es wird nicht richtig gefüllt: wenn ich auf meine weisse zeichefläche klicke und vorher als neue farbe blau ausgewählt habe wir die obere rechte ecke/Berich nicht richtig gefüllt, es bleiben weise streifen übrig.
es soll nur das gefüllt werden was der farbe entspricht wo mit der maus vorher geklickt wurde.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45:
| procedure tform1.Fuellen(x,y:integer;farbe:TColor); var help, farbe1: tcolor; vorFarbe:tcolor; x1,y1: integer; x2,y2: integer; ix, iy: integer; begin screen.Cursor:=crHourGlass; x1:=x;x2:=x; y1:=y;y2:=y; ix:=image1.Picture.Bitmap.width; iy:=image1.Picture.Bitmap.height; vorfarbe:= image1.picture.Bitmap.canvas.pixels[x,y]; while (ix>x1) and (iy>y1) do begin if x1<ix then begin farbe1:= image1.Canvas.pixels[x1,y1]; if vorfarbe=farbe1 then image1.Canvas.pixels[x1,y1]:=farbe;
farbe1:= image1.Canvas.pixels[x2,y1]; if vorfarbe=farbe1 then image1.Canvas.pixels[x2,y1]:=farbe; end; if x2>0 then begin farbe1:= image1.Canvas.pixels[x2,y2]; if vorfarbe=farbe1 then image1.Canvas.pixels[x2,y2]:=farbe;
farbe1:= image1.Canvas.pixels[x1,y2]; if vorfarbe=farbe1 then image1.Canvas.pixels[x1,y2]:=farbe; end; inc(x1); if x1=ix then begin x1:=x;inc(y1); end; dec(x2); if x2=0 then begin x2:=x;dec(y2); end; end;
screen.Cursor:=crDefault; end; |
_________________
Wissen ist macht, nichts wissen macht auch nichts. ODER: Wer nichts weis, kann nichts vergessen.