I need to check the color of exactly 1 pixel that always has the same coordinates.
On Windows 10 with Aero my pc takes around 17ms to check the color on the desktop and over 30ms with moving images.
The most time is spent on the _ScreenCapture_Capture function although it only captures 1 pixel.
Is there any faster implementation for this?
I'm using this to calculate the average computing time per pixel:
On Windows 10 with Aero my pc takes around 17ms to check the color on the desktop and over 30ms with moving images.
The most time is spent on the _ScreenCapture_Capture function although it only captures 1 pixel.
Is there any faster implementation for this?
I'm using this to calculate the average computing time per pixel:
Code:
#include <GDIPlus.au3> ; for GDI+
#include <ScreenCapture.au3>
; GDI+ method
_GDIPlus_Startup() ;initialize GDI+
$n1 = 200 ; iterations
$start_time=TimerInit()
For $i = 1 To $n1
Local $iColor = 0
Local $hHBmp = _ScreenCapture_Capture("", 0, 0, 1, 1) ;create a GDI bitmap by capturing an area on desktop
Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBmp) ;convert GDI to GDI+ bitmap
_WinAPI_DeleteObject($hHBmp) ;release GDI bitmap resource because not needed anymore
$iColor = _GDIPlus_BitmapGetPixel($hBitmap, 0, 0) ;get current pixel color
Next
$time=int(TimerDiff($start_time))/$n1
ConsoleWrite("GDIPlus average ms/pixel: "&$time&@crlf)
;cleanup GDI+ resources
_GDIPlus_Shutdown()
Exit