pwnaz0r
2007-10-11 14:12:57
Does not use uptext. Made it really quick cause i was bored. Will find the middle of any object, spiraling out from x and y.
function MiddleObj(var x, y: integer; Colors: TIntegerArray; MaxHeight,
MaxWidth, Tolerance: integer): boolean;
var
a: integer;
Origin: TPoint;
sColors: TIntegerArray;
tTPA, rTPA: TPointArray;
begin
sColors:= Colors;
BubbleSortB(sColors);
for a:= 0 to Length(sColors) - 1 do
if not FindColorSpiralTolerance(Origin.x, Origin.y, sColors[a], 10, 10,
MSX2 - 10, MSY2 - 10, Tolerance)then
begin
if (a = (Length(sColors) - 1)) then
begin
result:= false;
exit;
end;
end;
for a:= 0 to Length(sColors) - 1 do
begin
FindColorsTolerance(tTPA, sColors[a], Origin.x - MaxWidth, Origin.Y -
MaxHeight, Origin.x + MaxWidth, Origin.Y + MaxHeight, Tolerance);
rTPA:= CombineTPA(tTPA, rTPA);
end;
MiddleTPAEx(rTPA, x, y);
result:= true;
end;