_ChArMz
2006-12-20 12:39:51
Function FindMultiBitmapsTol(var Bx, By: Integer; Bitmaps: array of Integer; MaxTol, TolStep, X1, Y1, X2, Y2: Integer): Boolean;
Var
Tol, I: Integer;
Begin
Repeat
For I:= 0 to GetArrayLength(Bitmaps) - 1 do
Begin
If(Bitmaps[I] > 0)then
Begin
If(FindBitmapToleranceIn(Bitmaps[I], x, y, X1, Y1, X2, Y2, Tol))then
Begin
Result:= True;
Bx:= x;
By:= y;
Break;
End
End
End
Tol:= Tol + TolStep;
Until(Tol > MaxTol);
End;Example:
FindMultiBitmapsTol(x, y, [Road1, Road2, Road3, Road4, Road5, Road6], 75, 5, MMX1, MMY1, MMX2, MMY2);
That function can seach for an unlimited amount of bitmaps, rather then using find bitmapsprogressivetol, or just plain FindBitmapToleranceIn.
This procedure could also be edited a little bit for the use of finding and unlimited amount of colors.
Using:
FindColorTolerance(x, y, Color, X1, Y1, X2, Y2, Tol);
It can also be used as a auto colorfinding procedures, by just switching the function from a boolean, to a Integer.
Instead of Result:= True;, make it Result:= GetColor(x, y); making it search for the bitmaps or colors, then providing the color found.
I hope this function is useful.
Thank You!
~ChArMz