COLORREF GetPixel(hdc, nXPos, nYPos) | |||||
HDC hdc; | /* handle of device context | */ | |||
int nXPos; | /* x-coordinate of pixel | */ | |||
int nYPos; | /* y-coordinate of pixel | */ |
The GetPixel function retrieves the RGB (red, green, blue) color value of the pixel at the specified coordinates.
hdc
Identifies the device context.
nXPos
Specifies the logical x-coordinate of the pixel to be examined.
nYPos
Specifies the logical y-coordinate of the pixel to be examined.
The return value specifies an RGB value if the function is successful. It is CLR_INVALID if the pixel was outside of the current clipping region.
The pixel must be within the boundaries of the current clipping region.
Not all devices support GetPixel, an application should call GetDeviceCaps to determine whether or not a given device supports GetPixel.
GetDeviceCaps