I need a function which compares an image from the program resources with an image captured from Windows desktop.
bool CompareImage(POINT xy, DWORD ResourceID);
xy - left top coordinate of an image appeared on the desktop
ResourceID - id of the image resource of the application (.bmp file, example is enclosed to the project)
Return values: Comparison should be pixel perfect, if at least one pixel does not match then return false. Function should return true only if all pixels staring from xy on the desktop match all pixels in the image from resources.
Required region (the same size as a resource image) of the desktop should be captured to memory before comparison to speed up the process.
Comparison should start from the center of image (by spiral, rays of whatever) because expected difference will be concentrated in center (unless your algorithm is extremely fast).
Function has to be free of memory and handle leaks.
No third party libraries are allowed, only Windows API, GDI, GDI+ and other Visual Studio built-ins.
Result should a Visual Studio C++ project compiled to test command line application which BitBlt image from its resources to desktop and when uses the function to compare and show the result.
Multithreading is welcomed but not necessary.