Now it is OK
Here is the result
I remove the files from Mediafire
How I did?
HBITMAP CreateBitmapMask(HWND __hWnd,HBITMAP __hBmpObject,HBITMAP __hBmpMask,LPBITMAP __lpBitmap)
{
HDC _hDC, _hDCObject, _hDCMask, _hDCNewMask ;
HBITMAP _hBmpObjectOld, _hBmpMaskOld, _hBmpNewMask, _hBmpNewMaskOld ;
_hBmpNewMask = NULL ;
GetObject(__hBmpObject,sizeof(BITMAP),__lpBitmap) ;
_hDC = GetDC(__hWnd) ;
if(_hDC)
{
_hDCObject = CreateCompatibleDC(_hDC) ;
if(_hDCObject)
{
_hDCMask = CreateCompatibleDC(_hDC) ;
if(_hDCMask)
{
_hDCNewMask = CreateCompatibleDC(_hDC) ;
if(_hDCNewMask)
{
_hBmpNewMask = CreateCompatibleBitmap(_hDC,__lpBitmap->bmWidth,__lpBitmap->bmHeight) ;
if(_hBmpNewMask)
{
_hBmpNewMaskOld = SelectObject(_hDCNewMask,_hBmpNewMask) ;
if(_hBmpNewMaskOld)
{
_hBmpMaskOld = SelectObject(_hDCMask,__hBmpMask) ;
if(_hBmpMaskOld)
{
_hBmpObjectOld = SelectObject(_hDCObject,__hBmpObject) ;
if(_hBmpObjectOld)
{
SetTextColor(_hDCObject,0x00FF00) ;
BitBlt(_hDCNewMask,0,0,__lpBitmap->bmWidth,__lpBitmap->bmHeight,_hDCMask,0,0,SRCCOPY) ;
BitBlt(_hDCNewMask,0,0,__lpBitmap->bmWidth,__lpBitmap->bmHeight,_hDCObject,0,0,SRCINVERT) ;
SelectObject(_hDCObject,_hBmpObjectOld) ;
}
SelectObject(_hDCMask,_hBmpMaskOld) ;
}
SelectObject(_hDCNewMask,_hBmpNewMaskOld) ;
}
}
DeleteDC(_hDCNewMask) ;
}
DeleteDC(_hDCMask) ;
}
DeleteDC(_hDCObject) ;
}
ReleaseDC(__hWnd,_hDC) ;
}
return (_hBmpNewMask) ;
}
First I create the mask.
The mask is green and black
I want to keep the black part.
static void Navette_OnPaint(HWND __hWnd)
{
PAINTSTRUCT _Ps ;
RECT _Rc ;
BITMAP _Bitmap ;
HDC _hDC, _hDCMem, _hDCMask, _hDCBackground ;
HBITMAP _hBitmap, _hBitmapOld, _hBmpBgOld, _hBmpMask, _hBmpMaskOld ;
DWORD _dwNewWidth, _dwNewHeight ;
_hDC = BeginPaint(__hWnd,&_Ps) ;
if(_hDC)
{
_hDCMem = CreateCompatibleDC(_hDC) ;
if(_hDCMem)
{
_hDCBackground = CreateCompatibleDC(_hDC) ;
if(_hDCBackground)
{
_hBmpBgOld = SelectObject(_hDCBackground,lpBackground->hImgBitmap) ;
if(_hBmpBgOld)
{
_hBmpMask = CreateBitmapMask(__hWnd,lpNavette->hImgBitmap,lpNavette_Mask->hImgBitmap,&_Bitmap) ;
if(_hBmpMask)
{
_hDCMask = CreateCompatibleDC(_hDC) ;
if(_hDCMask)
{
_hBmpMaskOld = SelectObject(_hDCMask,_hBmpMask) ;
if(_hBmpMaskOld)
{
GetClientRect(__hWnd,&_Rc) ;
_hBitmap = CreateCompatibleBitmap(_hDC,_Rc.right,_Rc.bottom) ;
if(_hBitmap)
{
_hBitmapOld = SelectObject(_hDCMem,_hBitmap) ;
if(_hBitmapOld)
{
ImageResize(lpBackground->BitmapInfo.bmiHeader.bV5Width,lpBackground->BitmapInfo.bmiHeader.bV5Height,_Rc.right,_Rc.bottom,&_dwNewWidth,&_dwNewHeight) ;
SetStretchBltMode(_hDC,COLORONCOLOR) ;
SetStretchBltMode(_hDCMem,COLORONCOLOR) ;
BitBlt(_hDCBackground,100,100,_Bitmap.bmWidth,_Bitmap.bmHeight,_hDCMask,0,0,SRCPAINT) ;
StretchBlt(_hDCMem,0,0,_dwNewWidth,_dwNewHeight,_hDCBackground,0,0,lpBackground->BitmapInfo.bmiHeader.bV5Width,lpBackground->BitmapInfo.bmiHeader.bV5Height,SRCCOPY) ;
BitBlt(_hDC,(_Rc.right - _dwNewWidth) / 2,(_Rc.bottom - _dwNewHeight) / 2,_dwNewWidth,_dwNewHeight,_hDCMem,0,0,SRCCOPY) ;
SelectObject(_hDCMem,_hBitmapOld) ;
}
DeleteObject(_hBitmap) ;
}
SelectObject(_hDCMask,_hBmpMaskOld) ;
}
DeleteDC(_hDCMask) ;
}
DeleteObject(_hBmpMask) ;
}
SelectObject(_hDCBackground,_hBmpBgOld) ;
}
DeleteDC(_hDCBackground) ;
}
DeleteDC(_hDCMem) ;
}
EndPaint(__hWnd,&_Ps) ;
}
return ;
}
The problem is that americans painted some part of the shuttle in black.
If they used RED I would have not any problem.