见此图:https://s2.loli.net/2022/01/22/kz5cY8Lqw12VWIK.png
图中代码读取了同一张图片,
为什么用 getpixel 得到是正确的色值 16711680(0xFF0000)
但是直接用显存来读就会在前面多出两位,变成 4294901760(0xFFFF0000)?
附代码:
#include <easyx.h>
int main()
{
initgraph(640, 480);
IMAGE m;
loadimage(&m, L"E:\\_MYC\\_VS_Project\\2_5D_RacingCar\\map\\c\\mask.png");
DWORD* buf = GetImageBuffer(&m);
SetWorkingImage(&m);
int x = 820, y = 590;
COLORREF c = getpixel(x, y);
COLORREF v = BGR(buf[y * getwidth() + x]);
closegraph();
return 0;
}