-
get HBITMAP from Byte array .helpful post 2008. 6. 27. 16:59반응형ok well I have created a DOB but there's something wrong with the colors...
reds show up blue and so on...
is it because I have not set up the bmiColors member of the BITMAPINFO ?
all i have are the raw bitmap image bits..no color tables.. how do I set
that up?
so far i've got:
int w, h;
unsigned int nBytes;
BYTE* bits = GetRawBitmapBits(&w, &h, &nBytes); // allocs the bit buffer and
fills it
BITMAPINFO bmi;
memset (&bmi, 0, sizeof(BITMAPINFO));
bmi.bmiHeader.biSize = sizeof(BITMAPINFO);
bmi.bmiHeader.biWidth = w;
bmi.bmiHeader.biHeight = hehight;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 24;
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = nBytes;
//bmi.bmiColors = ????
BYTE* dibBits = NULL;
HBITMAP hBM = CreateDIBSection( hDC, &bmi,DIB_RGB_COLORS,(void**)&dibBits,
NULL, NULL );
SetDIBits(hDC, hBM, 0, h, buff, &bmi, DIB_RGB_COLORS); //copies my bits
into the DIB
free (bits);
return hBM
thanks!
"John Hornick [MSFT]" <JHorn...@online.microsoft.com> wrote in message
news:VhTdjdjmDHA.1544@cpmsftngxa06.phx.gbl...반응형'helpful post' 카테고리의 다른 글
building to boost (0) 2008.11.17 Using Yasm with Visual Studio 2005 and VC++ version 8 (0) 2008.09.16 Obtaining ACE for win32 VC2005 (0) 2008.05.30 _endthread와 _endthreadex (explicitly) 호출할까 말까? (0) 2008.05.22 "PropertyGrid component. Please verify that the common language runtime and .NET frameworks are properly installed.." (0) 2008.04.15