GetPixel

Syntax

DWORD GetPixel(hDC,X,Y)

This function retrieves the RGB color value of the pixel at the point specified by the X and Y parameters. The point must be in the clipping region. If the point is not in the clipping region, the function is ignored.

Parameter Type/Description  

hDC HDC Identifies the device context.  
X int Specifies the logical x-coordinate of the point to be examined.  
Y int Specifies the logical y-coordinate of the point to be examined.  

Return Value

The return value specifies an RGB color value for the color of the given point. It is –1 if the coordinates do not specify a point in the clipping region.

Comments

Not all devices support the GetPixel function. For more information, see the RC_BITBLT raster capability in the GetDeviceCaps function, earlier in this chapter.