Code:
function FindBitmapInCircleTol(bitmap:integer; var x, y: Integer; Centerx, Centery, Radius, Tol:integer): Boolean;
var
Temp: TCanvas;
Cx, Cy, H, W, ScreenBmp, TempBmp, Handle: Integer;
begin
W := 2*Radius;
H := 2*Radius;
Handle := GetClientWindowHandle;
TempBmp := BitmapFromString(W, H, '');
Temp := GetBitmapCanvas(TempBmp);
ScreenBmp := BitmapFromString(W, H, '');
FastDrawClear(TempBmp, -1);
CopyClientToBitmap(ScreenBmp, CenterX-Radius, CenterY-Radius, CenterX+Radius, CenterY+Radius);
CopyCanvas(GetBitmapCanvas(TempBmp), Temp, 0, 0, W, H, 0, 0, W, H);
Temp.Ellipse(0, 0, W, H);
CopyCanvas(Temp, GetBitmapCanvas(TempBmp), 0, 0, W, H, 0, 0, W, H);
SetTransparentColor(TempBmp, 16777215);
FastDrawTransparent(0, 0, TempBmp, ScreenBmp);
SetTargetBitmap(ScreenBmp);
X := -1;
Y := -1;
Cx := W div 2;
Cy := H div 2;
if FindBitmapSpiralTolerance(Bitmap, Cx, Cy, 0, 0, W, H, Tol) then
begin
X := Cx+CenterX-Radius;
Y := Cy+CenterY-Radius;
Result := true;
end;
SetClientWindowHandle(Handle);
FreeBitmap(TempBmp);
FreeBitmap(ScreenBmp);
end;