Einzelnen Beitrag anzeigen

chrizl08

Registriert seit: 14. Sep 2008
14 Beiträge
 
#1

Scanline x,y Koordinaten falsch?!?

  Alt 16. Sep 2008, 22:43
Hi,
ich habe folgende Scanline Schleife;
Delphi-Quellcode:
Function FindColor(bmp:TBitmap):TPoint;
type
  PixArray = array[1..3] of Byte;
var
  i, iMax, x, y, w, h: Integer;
  p : ^PixArray;
begin

  Result:=Point(-1,-1);

  Form1.ProgressBar1.Max := bmp.Height-1;

  for y := 0 to bmp.Height-1 do begin
    p := bmp.ScanLine[y];
    Form1.ProgressBar1.Position := y;
    for x := 0 to bmp.Width-1 do begin
      if( (p^[3]=255) AND (p^[2]=0) AND (p^[1]=0) ) then begin
        Showmessage('Gefunden');
        Result := Point(x, y);
        exit;
      end;
      inc(p)
    end;
  end;
end;
Leider liegen die gefundenen Koordinaten immer ca. 300 Pixel rechts neben dem gesuchten Punkt.
Woran liegt das? Am umgekehrten Aufbau von Scanlines?

Danke!!
  Mit Zitat antworten Zitat