1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
BITMAPINFO info;
info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
info.bmiHeader.biWidth = 640;
info.bmiHeader.biHeight = 400;
info.bmiHeader.biPlanes = 1;
info.bmiHeader.biBitCount = 24;
info.bmiHeader.biCompression = BI_RGB;
info.bmiHeader.biSizeImage = bit24format_size;
info.bmiHeader.biXPelsPerMeter = 0;
info.bmiHeader.biYPelsPerMeter = 0;
info.bmiHeader.biClrUsed = 0;
info.bmiHeader.biClrImportant = 0;
PAINTSTRUCT ps;
HDC hdc = BeginPaint(finestra_principale, &ps);
if(hdc == NULL) MessageBox( NULL, "BeginPaint", "ERRORE", MB_OK);
HDC cdc = CreateCompatibleDC(hdc);
//HBITMAP immagine = CreateDIBitmap(cdc, &info.bmiHeader, CBM_INIT, (void *) bit24format, &info, 0);
//if(immagine == NULL) MessageBox( NULL, "CreateDIBitmap", "ERRORE", MB_OK);
HBITMAP immagine = CreateCompatibleBitmap(cdc, 640, 400);
int control = SetDIBits(cdc, immagine, 1, 399, (void *) bit24format, &info, DIB_PAL_COLORS);
bit24format[10]='\0';
sprintf(video_text, "SetDIBits: %d", control);
MessageBox( NULL, video_text, "dati", MB_OK);
SelectObject(cdc, immagine);
BitBlt(hdc, 0, 0, 640, 400, cdc, 0, 0, SRCCOPY);
DeleteDC(cdc);
DeleteObject(immagine);
EndPaint(finestra_principale, &ps);
|