COLORREF GetPixel(hdc, nXPos, nYPos) | |||||
HDC hdc; | /* handle of device context | */ | |||
int nXPos; | /* x-coordinate of pixel to retrieve | */ | |||
int nYPos; | /* y-coordinate of pixel to retrieve | */ |
The GetPixel function retrieves the RGB (red, green, blue) color value of the pixel at the specified coordinates. The point must be in the clipping region; if it is not, the function is ignored.
hdc
Identifies the device context.
nXPos
Specifies the logical x-coordinate of the point to be examined.
nYPos
Specifies the logical y-coordinate of the point to be examined.
The return value specifies an RGB color value for the color of the given point, if the function is successful. It is –1 if the coordinates do not specify a point in the clipping region.
Not all devices support the GetPixel function. For more information, see the description of the GetDeviceCaps function.