Пример #1
0
/******************************Public*Routine******************************\
* UpdateAppImage
* DON'T WORK IN RENDERLESS MODE
\**************************************************************************/
BOOL//
CMpegMovie::UpdateAppImage(VMRALPHABITMAP* lpBmpInfo)
{
	if ( m_Vw ) {

		// Windowed movie playback can't have app image.
		return FALSE;

	}	else {


		IVMRMixerBitmap* pBmp;

		if (!m_Wc)
			return FALSE;

		HRESULT hres = m_Wc->QueryInterface(IID_IVMRMixerBitmap, (LPVOID *)&pBmp);
		if(SUCCEEDED(hres))
		{
			hres = pBmp->UpdateAlphaBitmapParameters(lpBmpInfo);
			pBmp->Release();
		}

		return hres;

	}
}
Пример #2
0
/******************************Public*Routine******************************\
* SetAppImage
* DON'T WORK IN RENDERLESS MODE
\**************************************************************************/
BOOL
CMpegMovie::SetAppImage(
    VMRALPHABITMAP* lpBmpInfo
    )
{
	if ( m_Vw ) {

		// Windowed movie playback can't have app image.
		return FALSE;

	}	else {


		IVMRMixerBitmap* pBmp;
		HRESULT hres = m_Wc->QueryInterface(IID_IVMRMixerBitmap, (LPVOID *)&pBmp);
		if(SUCCEEDED(hres))
		{
			hres = pBmp->SetAlphaBitmap(lpBmpInfo);
			pBmp->Release();
		}
		else
		{
			char sz[256]; 
			AMGetErrorText(hres, sz, 256);
		}

		return hres;
	}
}
Пример #3
0
void CImageMixer_VMR7::Clear()
{
	if (m_hdc!=NULL) {
		IVMRMixerBitmap *pMixerBitmap;

		if (SUCCEEDED(m_pRenderer->QueryInterface(IID_IVMRMixerBitmap,
								reinterpret_cast<LPVOID*>(&pMixerBitmap)))) {
			VMRALPHABITMAP ab;

			ab.dwFlags=VMRBITMAP_DISABLE;
			ab.fAlpha=0.0f;
			pMixerBitmap->UpdateAlphaBitmapParameters(&ab);
			pMixerBitmap->Release();
		}
	}
}
Пример #4
0
bool CImageMixer_VMR7::SetBitmap(HBITMAP hbm,int Opacity,COLORREF TransColor,RECT *pDestRect)
{
	IVMRMixerBitmap *pMixerBitmap;
	IVMRWindowlessControl *pWindowlessControl;
	LONG NativeWidth,NativeHeight;
	BITMAP bm;
	VMRALPHABITMAP ab;
	HRESULT hr;

	if (!CreateMemDC())
		return false;
	if (FAILED(m_pRenderer->QueryInterface(IID_IVMRMixerBitmap,
									reinterpret_cast<LPVOID*>(&pMixerBitmap))))
		return false;
	m_pRenderer->QueryInterface(IID_IVMRWindowlessControl,
							reinterpret_cast<LPVOID*>(&pWindowlessControl));
	hr=pWindowlessControl->GetNativeVideoSize(&NativeWidth,&NativeHeight,NULL,NULL);
	if (FAILED(hr) || NativeWidth==0 || NativeHeight==0) {
		NativeWidth=1440;
		NativeHeight=1080;
	}
	pWindowlessControl->Release();
	::SelectObject(m_hdc,hbm);
	ab.dwFlags=VMRBITMAP_HDC;
	if (TransColor!=CLR_INVALID)
		ab.dwFlags|=VMRBITMAP_SRCCOLORKEY;
	ab.hdc=m_hdc;
	ab.pDDS=NULL;
	::GetObject(hbm,sizeof(BITMAP),&bm);
	::SetRect(&ab.rSrc,0,0,bm.bmWidth,bm.bmHeight);
	ab.rDest.left=(float)pDestRect->left/(float)NativeWidth;
	ab.rDest.top=(float)pDestRect->top/(float)NativeHeight;
	ab.rDest.right=(float)pDestRect->right/(float)NativeWidth;
	ab.rDest.bottom=(float)pDestRect->bottom/(float)NativeHeight;
	ab.fAlpha=(float)Opacity/100.0f;
	ab.clrSrcKey=TransColor;
	hr=pMixerBitmap->SetAlphaBitmap(&ab);
	pMixerBitmap->Release();
	if (FAILED(hr)) {
		::SelectObject(m_hdc,m_hbmOld);
		return false;
	}
	return true;
}