Freddy1990
2006-05-24 17:59:46
function FindColorCircle(var x, y: Integer; color, radius, MidPointx, MidPointy: Integer): Boolean;
var
xx, yy, x1, x2: Integer;
begin
Result := False;
for yy := MidPointy - radius to MidPointy + radius do begin
for xx := MidPointx - radius to MidPointx do begin
if trunc(sqr(xx - MidPointx) + sqr(yy - MidPointy) - sqr(radius)) = 0 then
x1 := xx;
end;
x2 := 2 * MidPointx - x1;
for xx := x1 to x2 do begin
if color = GetColor(xx, yy) then begin
x := xx;
y := yy;
Result := True;
end;
end;
end;
end;Dun exactly know how efficient it is, i could have made some mistakes, its late and i'm tired, but as ar as i could c it worked relatively good…