Am creating the video player using directshow in VC++. I created the video player successfully with some of the common controls. Now am trying to display the image over the playing video. Here is the Code:
void CVMR9Dlg::OnBnClickedDrawimage()
{
pVmr->QueryInterface(IID_IVMRMixerBitmap9, (void**)&pMixerBmp);
ZeroMemory(&alphaBitmap, sizeof(alphaBitmap) );
const float EDGE_BUFFER = 0.04f;
CDC * pdc = GetDC();
CDC mCompatibleDC;
HBITMAP hBitmap =LoadBitmap(AfxGetApp()>m_hInstance,
MAKEINTRESOURCE(IDB_BITMAP1));
BITMAP bm;
GetObject(hBitmap, sizeof(bm), &bm);
int mBitmapWidth = bm.bmWidth;
int mBitmapHeight= bm.bmHeight;
mCompatibleDC.CreateCompatibleDC(pdc);
mCompatibleDC.SelectObject(hBitmap);
CRect reSrc(0,0,mBitmapWidth,mBitmapHeight);
CRect reDst;
alphaBitmap.dwFlags |= VMR9AlphaBitmap_hDC;
alphaBitmap.hdc = mCompatibleDC.m_hDC;
alphaBitmap.rSrc = reSrc;
CRect mRect;
mRect.SetRect(0,0,45,75);
LONG cx, cy;
pWc->GetNativeVideoSize(&cx, &cy, NULL, NULL);
float fBmpCompWidth = (float)45 / (float)cx;
alphaBitmap.rDest.right = 1.0f - EDGE_BUFFER;
alphaBitmap.rDest.left = 1.0f - fBmpCompWidth- EDGE_BUFFER;
float mTop = (float)(cy - 75) / (float)cy - EDGE_BUFFER;
alphaBitmap.rDest.top = mTop;
float mBottom = 1.0f - EDGE_BUFFER;
alphaBitmap.rDest.bottom = mBottom;
pRect = alphaBitmap.rDest;
alphaBitmap.fAlpha = 0.0;
alphaBitmap.dwFlags |= VMR9AlphaBitmap_SrcColorKey;
alphaBitmap.clrSrcKey = RGB(0, 255, 0);
pMixerBmp->SetAlphaBitmap(&alphaBitmap);
}
Its build successfully but am getting the screen shot as an image rather than getting the loaded bitmap.
Anyone help me to resolve from this error.
Thanks & Regards,
J.SurjithKumar