我正在尝试从数组创建 HBITMAP,其中包含像素的颜色值。问题是,当我尝试创建 24-bpp 位图时,CreateDIBItmap 使用的是 BGR 值,而不是我想要的 RGB 值。
创建Bitmap的代码如下:
image_size = 600 * 600 * 3;
aimp_buffer = (char *)malloc(image_size * sizeof(char));
for (counter = 0; counter < image_size;)
{
aimp_buffer[counter++] = 255;
aimp_buffer[counter++] = 0;
aimp_buffer[counter++] = 0;
}
ads_scrbuf->avo_buffer = (void *)aimp_buffer;
ads_scrbuf->im_height = 600;
ads_scrbuf->im_width = 600;
ads_scrbuf->im_scanline = 600;
memset(&info, 0, sizeof(info));
memset(&info.bmiHeader, 0, sizeof(info.bmiHeader));
info.bmiHeader.biBitCount = 24;
info.bmiHeader.biHeight= -600;
info.bmiHeader.biWidth= 600;
info.bmiHeader.biSize = sizeof(info.bmiHeader);
info.bmiHeader.biPlanes = 1;
info.bmiHeader.biCompression = BI_RGB;
memset(&header, 0, sizeof(BITMAPV5HEADER));
header.bV5Width …Run Code Online (Sandbox Code Playgroud) 我正在使用MS SQL Server 2008 R2,我需要在每一行中都有一个单元格,其中包含在数据库中插入行的日期和时间.现在,因为我想编写脚本,然后在MS SQL Server 2005中加载数据库我不能使用日期时间或日期,所以我尝试在计算列规范属性中使用getdate()函数.谁能帮帮我吗.
谢谢
我想做一些我认为相当简单的事情,但由于我是winapi的新手,我发现了很多问题.基本上我有一个HDC(我从一个加载的位图BitBlitting),我正在绘制一个矩形.然后我想将HDC BitBlt放到一个新的HBITMAP对象上,但唉现在无济于事.
这是我的代码,我一直试图开始工作几个小时
BITMAPINFO info;
Bitmap *tempbmp = Bitmap::FromFile(L"C:\\Users\\abelajc\\Pictures\\BackgroundImage.png", false);
HBITMAP loadedbackground;
tempbmp->GetHBITMAP(NULL, &loadedbackground);
HBRUSH hRed = CreateSolidBrush(RGB(255, 0, 0));
HDC pDC = GetDC(0);
HDC TmpDC = CreateCompatibleDC(pDC); //main DC on which we will paint on
HDC dcBmp = CreateCompatibleDC(TmpDC); //DC for the loadedbackground HBitmap
HGDIOBJ TmpObj2 = SelectObject(dcBmp , tempbmp); //Selecting Bitmap in DC
BitBlt(TmpDC, 0, 0, 512, 512, dcBmp, 0, 0, SRCCOPY);
SelectObject(dcBmp, TmpObj2); //Deselecting Bitmap from DC
DeleteDC(dcBmp);
RECT rectangle;
SetRect(&rectangle, 5, 5, 20, 20);
FillRect(TmpDC, &rectangle, …Run Code Online (Sandbox Code Playgroud)