Das verstehe ich nicht ganz ...
Wird dann für P3 und P4 einfach dann das gleiche für Y gemacht? Also so:
Delphi-Quellcode:
begin
P1.X := -1;
for y:=0 to image3.Height-1 do
begin
for x:=1 to image3.width-1 do
begin
if (((image3.Canvas.pixels[x,y]) and 255) > 10) then
begin
P1.X := x;
p1.Y := y;
break;
end;
end;
if P1.X > 0 then Break;
end;
P2.X := -1;
for y := image3.Height-1 Downto 0 do
begin
for x:= image3.width-1 Downto 0 do
begin
if (((image3.Canvas.pixels[x,y]) and 255) > 10) then
begin
P2.X := x;
P2.Y := y;
break;
end;
end;
if P2.X > 0 then Break;
end;
P3.Y := -1;
for y:=0 to image3.Height-1 do
begin
for x:=1 to image3.width-1 do
begin
if (((image3.Canvas.pixels[x,y]) and 255) > 10) then
begin
P3.X := x;
p3.Y := y;
break;
end;
end;
if P3.Y > 0 then Break;
end;
P4.Y := -1;
for y := image3.Height-1 Downto 0 do
begin
for x:= image3.width-1 Downto 0 do
begin
if (((image3.Canvas.pixels[x,y]) and 255) > 10) then
begin
P4.X := x;
P4.Y := y;
break;
end;
end;
if P4.Y > 0 then Break;
end;
xm := round(P1.X+((P2.X-P1.X)/2));
ym := round(P3.Y+((P4.Y-P3.Y)/2));
Form1.roter_Kreis(xm, ym, 15, 40);
end;
Er zeichnet zwar einen roten Kreis, setzt diesen jedoch genau in die Mitte des Imagefeldes.