19,468
社区成员
发帖
与我相关
我的任务
分享
GBufferedHDC = ::CreateCompatibleDC(NULL);
////////////////////
BITMAPINFO info = {0};
info.bmiHeader.biSize = sizeof(info.bmiHeader);
info.bmiHeader.biWidth = SCREEN_WIDTH;
info.bmiHeader.biHeight = -SCREEN_HEIGHT;
info.bmiHeader.biPlanes = 1;
info.bmiHeader.biBitCount = 32;
info.bmiHeader.biCompression = BI_RGB;
info.bmiHeader.biSizeImage = SCREEN_WIDTH * SCREEN_HEIGHT * 32 / 8;
// 创建一块内存纹理并获取其数据指针
void* pBits = NULL;
GBufferedHandle = ::CreateDIBSection(GBufferedHDC, &info, DIB_RGB_COLORS, &pBits, NULL, 0);
::SelectObject(GBufferedHDC, GBufferedHandle);
//here: "dib.dsBm.bmBits" will points to the pixels of hdib.
::GetObject(GBufferedHandle , sizeof(DIBSECTION), &GDIBSection);
//这里指向图像的内存区域
GDatas = (BYTE*)GDIBSection.dsBm.bmBits;
GBufferedHDC = ::CreateCompatibleDC(NULL);
////////////////////
BITMAPINFO info = {0};
info.bmiHeader.biSize = sizeof(info.bmiHeader);
info.bmiHeader.biWidth = SCREEN_WIDTH;
info.bmiHeader.biHeight = -SCREEN_HEIGHT;
info.bmiHeader.biPlanes = 1;
info.bmiHeader.biBitCount = 32;
info.bmiHeader.biCompression = BI_RGB;
info.bmiHeader.biSizeImage = SCREEN_WIDTH * SCREEN_HEIGHT * 32 / 8;
// 创建一块内存纹理并获取其数据指针
void* pBits = NULL;
GBufferedHandle = ::CreateDIBSection(GBufferedHDC, &info, DIB_RGB_COLORS, &pBits, NULL, 0);
::SelectObject(GBufferedHDC, GBufferedHandle);
//here: "dib.dsBm.bmBits" will points to the pixels of hdib.
::GetObject(GBufferedHandle , sizeof(DIBSECTION), &GDIBSection);
//这里指向图像的内存区域
GDatas = (BYTE*)GDIBSection.dsBm.bmBits;