#include <WinAPIGdi.au3>
$aPixels = _PixelGetArray2(0, 0, 100, 100, 0x000000, 10)
#include <Array.au3>
_ArrayDisplay($aPixels)
; -----------------------------------------------------------------------------------------------------
Func _PixelGetArray2($iX, $iY, $iWidth, $iHeight, $iColor, $iShade = 0, $hWnd = 0, $fFirstOnly = False)
Local $iTime = TimerInit()
Local $iSize = $iWidth * $iHeight, $aPixels[$iSize + 1][2] = [[0]]
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, 0x00CC0020) ; $SRCCOPY
_WinAPI_DeleteDC($hMemDC)
_WinAPI_ReleaseDC($hWnd, $hDC)
Local $tBits = DllStructCreate('byte[' & $iSize * 4 & ']')
_WinAPI_GetBitmapBits($hBitmap, $iSize * 4, DllStructGetPtr($tBits))
_WinAPI_DeleteObject($hBitmap)
Local $sText = StringTrimLeft(DllStructGetData($tBits, 1), 2)
Local $iStep = $iWidth * 8
Local $aLines[$iHeight], $c = 0
For $i = 1 To StringLen($sText) Step $iStep
$aLines[$c] = StringMid($sText, $i, $iStep)
$c += 1
Next
Local $iPos, $iStart, $iLen = StringLen($aLines[0])
$iColor = StringRegExpReplace(Hex($iColor, 6), "(.{2})(.{2})(.{2})", "$3$2$1")
If $iShade Then
Local $iB = Dec(StringMid($iColor, 1, 2))
Local $iG = Dec(StringMid($iColor, 3, 2))
Local $iR = Dec(StringMid($iColor, 5, 2))
For $i = 0 To $iHeight - 1
For $j = 1 To $iLen Step 8
Switch Dec(StringMid($aLines[$i], $j, 2))
Case $iB - $iShade To $iB + $iShade
Switch Dec(StringMid($aLines[$i], $j + 2, 2))
Case $iG - $iShade To $iG + $iShade
Switch Dec(StringMid($aLines[$i], $j + 4, 2))
Case $iR - $iShade To $iR + $iShade
$aPixels[0][0] += 1
$aPixels[$aPixels[0][0]][0] = ($j - 1) / 8 + $iX
$aPixels[$aPixels[0][0]][1] = $i + $iY
If $fFirstOnly Then ExitLoop 2
EndSwitch
EndSwitch
EndSwitch
Next
Next
Else
For $i = 0 To $iHeight - 1
$iStart = 1
While $iStart <= $iLen
$iPos = StringInStr($aLines[$i], $iColor, 1, 1, $iStart)
If $iPos Then
If Mod($iPos - 1, 8) Then
$iStart = $iPos + 2
ContinueLoop
EndIf
$aPixels[0][0] += 1
$aPixels[$aPixels[0][0]][0] = ($iPos - 1) / 8 + $iX
$aPixels[$aPixels[0][0]][1] = $i + $iY
If $fFirstOnly Then ExitLoop 2
$iStart = $iPos + 8
Else
ExitLoop
EndIf
WEnd
Next
EndIf
ReDim $aPixels[$aPixels[0][0] + 1][2]
$aPixels[0][1] = Round(TimerDiff($iTime))
Return $aPixels
EndFunc ;==>_PixelGetArray2