内容纲要
需要使用Windows库,只能基于windows平台。
FColor GetMousePointColor()
{
POINT Pos;
GetCursorPos(&Pos);
const HDC HDcContext = GetDC(nullptr);
const COLORREF Color = GetPixel(HDcContext, Pos.x, Pos.y);
ReleaseDC(nullptr, HDcContext);
int R = GetRValue(Color);
int G = GetGValue(Color);
int B = GetBValue(Color);
return FColor(R, G, B, 255);
}