小编Oli*_*aur的帖子

Gdiplus :: Bitmap到BYTE数组?

这是我的尝试(丑陋的GDI + GDI混合......)

// ...
BYTE               pixels[BMP_WIDTH * BMP_HEIGHT * BMP_BPP];
HBITMAP            hBitmap;
Gdiplus::Bitmap    cBitmap(BMP_WIDTH, BMP_HEIGHT, PixelFormat32bppRGB);
Gdiplus::Graphics  cGraphics(&cBitmap);
Gdiplus::Pen       cPen(Gdiplus::Color(255, 255, 0, 0));

cGraphics.DrawRectangle(&cPen, 0, 0, cBitmap.GetWidth() - 1, cBitmap.GetHeight() - 1);

// and here it get's real ugly, I'd like to change that...
cBitmap.GetHBITMAP(Gdiplus::Color(255, 255, 255), &hBitmap);
GetBitmapBits(hBitmap, sizeof(pixels), pixels);
// ...
Run Code Online (Sandbox Code Playgroud)

有人告诉我使用LockBits,但我真的不明白怎么做.我试过了,但是我失败了,所以我也不打算发布那个尝试.

c++ gdi+ bitmap

9
推荐指数
2
解决办法
1万
查看次数

标签 统计

bitmap ×1

c++ ×1

gdi+ ×1