设定像素点

COLORREF

颜色类型

实际上是 unsigned long

1622873470897

RGB宏

RGB(红,绿,蓝);

SetPixel

指定坐标处的像素设为指定的颜色

1
COLORREF SetPixel(HDC hdc, int X, int Y, COLORREF crColor);
1
SetPixel(hdc,i,j,color);

GetPixel

1
COLORREF GetPixel(HDC hdc, int nXPos, int nYPos)

hdc:设备环境句柄。

nXPos:指定要检查的像素点的逻辑X轴坐标。

nYPos:指定要检查的像素点的逻辑Y轴坐标。

1
color = GetPixel(hdc,200,200);

GetRValue宏

获取红色值

1
red = GetRValue(color);

GetGValue宏

获取绿色值

1
green = GetGValue(color);

GetBValue宏

获取蓝色值

1
blue = GetBValue(color);