salut, c'est possible avec un BitBlt et MERGECOPY. avec MERGECOPY il y a un AND entre la couleur du pixel source et le brush en sélection dans le DC destination.
exemple en WIN32:
HBITMAP hBitmap; BITMAP bm; HBRUSH hBrush; HDC hdc, hdcMem;
// chargement du bitmap en rc hBitmap = LoadBitmap(hInstance, "IMAGE1");
// récupération informations bmp GetObject(hBitmap, sizeof(BITMAP), &bm);
// création d'un brush bleu hBrush = CreateSolidBrush(RGB(0, 0, 255));
// récupération du DC de la fenêtre du prog hdc = GetDC(hwnd);
// sélection du brush dans le DC hBrush = (HBRUSH) SelectObject(hdc, hBrush);
// création d'un DCmem hdcMem = CreateCompatibleDC(hdc);
// sélection du bmp dans le DCmem hBitmap = (HBITMAP) SelectObject(hdcMem, hBitmap);
// copie du DCmem vers DC avec MERGECOPY BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, MERGECOPY);
// sélection du brush d'origine, destruction du brush et du DC DeleteObject(SelectObject(hdc, hBrush)); ReleaseDC(hwnd, hdc);
// sélection du bmp d'origine, destruction du bmp et du DCmem DeleteObject(SelectObject(hdcMem, hBitmap)); DeleteDC(hdcMem);
dans fichier .rc
IMAGE1 BITMAP DISCARDABLE "image.bmp"
avec ce code, j'ai bien une image bleu avec un bmp 24bpp. bye.
|