I need a GetPixel tolerance code. Here’s is what I have for searching for a pixel.
Code:
int findcolor(int &x1, int &y1, int &x2, int &y2, unsigned int r, unsigned int g, unsigned int b, int &x, int &y)
{
int XL, YL, xcount, ycount, TLXBackup;
TLXBackup = x1;
XL = x2 - x1;
YL = y2 - y1;
xcount = 0;
ycount = 0;
POINT TR;
HDC hdc = GetDC(NULL);
Loop:
DWORD color2 = GetPixel(hdc, x1, y1);
unsigned int R = GetRValue(color2);
unsigned int G = GetGValue(color2);
unsigned int B = GetBValue(color2);
if ( xcount == XL)
{
y1++;
x1 = TLXBackup;
ycount++;
xcount = 0;
}
if ( ycount == YL )
{
ReleaseDC;
return 0;
}
xcount++;
x1++;
if ((r == R) && (g == G) && (b == B))
{
x = x1;
y = y1;
ReleaseDC;
return 1;
}
goto Loop;
}
i have ben searching google and still am but not finding mutch.