SRL Archive - Other Scripts

FindColorCircle


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…

Avaphi

2007-02-18 14:19:50

Freddy, I know its an old topic, but I do have some reasonable questions :

1) How does it scan for color? Inwards? outwards?
2) How fast does it scan?

Thanks

Freddy1990

2007-02-19 05:33:22

This is slow as hell, ur better off using the one in my plugins, it's alot faster