Bonjour,
j'ai un probleme pour passer un Bitmap en 32bpp,
je charge le fichier en memoire (HBITMAP) et ensuite je tente de le modifier, mais le probleme est que je ne sais pas comment lire le buffer de pixels qui lui est associé, voila le code que j'ai fait, il se compile mais ça donne un truc tres moche (pas du tout le résultat desiré)
HBITMAP Create32bppBitmap(HBITMAP hbmp)
{
HDC hdc;
HBITMAP hpic;
BITMAPINFO bmi,tbm;
ULONG bHeight,bWidth,x,y;
VOID *pvBits;
hdc = CreateCompatibleDC(dcPicture);
GetObject(hbmp,sizeof(BITMAPINFO),&tbm);
ZeroMemory(&bmi,sizeof(BITMAPINFO));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = bWidth = tbm.bmiHeader.biWidth;
bmi.bmiHeader.biHeight = bHeight = tbm.bmiHeader.biHeight;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = bWidth * bHeight * 4;
hpic = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0);
for (y = 0; y < bHeight; y++)
{
for (x = 0; x < bWidth; x++)
{
((UINT32 *)pvBits)[x + y * bWidth] = MAKELONG(MAKEWORD(255,bmi.bmiColors[x + y * bWidth].rgbRed),MAKEWORD(bmi.bmiColors[x + y * bWidth].rgbGreen,bmi.bmiColors[x + y * bWidth].rgbBlue));
}
}
return hpic;
//http://www.nomorepasting.com/paste.php?pasteID=36273
}
Merci
K@zuya 