#include <Array.au3>
#include <WinAPIEx.au3>
#include <WindowsConstants.au3>
$t = TimerInit()
WinActivate ("[CLASS:Photo_Lightweight_Viewer]")
WinWaitActive ("[CLASS:Photo_Lightweight_Viewer]")
$arr = _PixelGetArray(228, 204, 106, 46, 0x22B14C)
ConsoleWrite(TimerDiff($t) & @LF)
toPoint()
_ArrayDisplay($arr)
Func _PixelGetArray($iX, $iY, $iWidth, $iHeight, $iColor, $hWnd = WinWait('primer.png'))
Local $aPixels[$iWidth * $iHeight + 1][2]
Local $hDC = _WinAPI_GetDC($hWnd)
Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC)
Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight)
_WinAPI_SelectObject($hMemDC, $hBitmap)
_WinAPI_BitBlt($hMemDC, 0, 0, $iWidth, $iHeight, $hDC, $iX, $iY, $SRCCOPY)
_WinAPI_DeleteDC($hMemDC)
_WinAPI_ReleaseDC($hWnd, $hDC)
Local $iSize = $iWidth * $iHeight
Local $tBits = DllStructCreate("dword[" & $iSize & "]")
_WinAPI_GetBitmapBits($hBitmap, 4 * $iSize, DllStructGetPtr($tBits))
Local $iCount = 0
For $i = 1 To $iSize
If BitAND(DllStructGetData($tBits, 1, $i), 0x00FFFFFF) = $iColor Then
$iCount += 1
$aPixels[$iCount][0] = Mod($i, $iWidth) - 1
If $aPixels[$iCount][0] = -1 Then $aPixels[$iCount][0] = $iWidth - 1
$aPixels[$iCount][1] = Ceiling($i / $iWidth) - 1
EndIf
Next
ReDim $aPixels[$iCount + 1][2]
$aPixels[0][0] = $iCount
Return $aPixels
EndFunc
Func toPoint()
Local $e=1
$i=1
While $i < UBound($Arr)
For $j=0 To $i-1
If (Abs($Arr[$i][0]-$Arr[$j][0]) <= $e And Abs($Arr[$i][1]-$Arr[$j][1]) <= $e) Then
_ArrayDelete($Arr, $j)
$i -= 2
ExitLoop
EndIf
Next
$i += 1
WEnd
EndFunc