Function Reference
FFNearestSpotSearches a SnapShot for an area containing a minimum number of pixels of the given color, closest to the given point.
FFNearestSpot ( SizeSearch, NbPixel, PosX, PosY, Color [, ShadeVariation [, ForceNewSnap [, Left [, Top [, Right [, Bottom [, NoSnapShot [, WindowHandle]]]]]]]] )
Parameters
SizeSearch | The width and height of the area to search for. |
NbPixel | Minimum number of pixels in the area. |
PosX | X coordinate of proximity position. |
PosY | Y coordinate of proximity position. |
Color | Colour value of pixel to find (in decimal or hex). -1 to use the FastFind color list. |
ShadeVariation | [optional] A number between 0 and 255 to indicate the allowed number of shades of variation of the red, green, and blue components of the colour. Default is 0 (exact match). |
ForceNewSnap | [optional] If true, a new SnapShot will be made and the search will be done on that. Default is True. |
Left | [optional] Left coordinate of the new SnapShot area. Default is 0. |
Top | [optional] Top coordinate of the new SnapShot area. Default is 0. |
Right | [optional] Right coordinate of the new SnapShot area. Default is 0. |
Bottom | [optional] Bottom coordinate of the new SnapShot area. Default is 0. |
NoSnapShot | [optional] SnapShot number. Determines which "slot" the new SnapShot will be stored in. |
WindowHandle | [optional] Window handle to be used. |
Return Value
Success: | Returns a three-element array of area's coordinates and number of pixels found. (Array[0] = x, Array[1] = y, Array[2] = Number of pixels found). |
Failure: | Returns 0 and sets @ERROR |
Remarks
The coordinates returned specify the barycenter (center of mass) of the area found.If more than one acceptable area exists within the SnapShot, this function will return the one closest to PosX, PosY. This is useful for finding clusters of pixels of a particular color. Setting the Color parameter to -1 will cause the search to match on any color in the FastFind color list.
A new SnapShot will be saved in the default slot if ForceNewSnap remains True.
Related
FFSnapShot, FFAddColor, FFAddExcludedArea, FFGetPixel, FFNearestPixel, FFBestSpot
Example
#include "FastFind.au3"
$FFhWnd = WinGetHandle("[ACTIVE]")
FFSetWnd($FFhWnd)
FFSnapShot()
Local $aCoords = FFNearestSpot(10, 25, 0, 0, 0x00FFFFFF, False)
If Not @error Then
MsgBox(0, "Coords", $aCoords[0] & ", " & $aCoords[1])
Else
MsgBox(0, "Coords", "Match not found.")
EndIf