内容纲要

需要使用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);
}

Related Posts

发表回复

同步Schの秘密防空洞