-
October 6th, 2012, 01:24 PM
#1
Drawing Text to a decompressed video frame
I'm trying to draw text to a DIB
Code:
void CRenderer::RenderScreen(BYTE* data)
{
BITMAPINFOHEADER* pbitmapInfoHeader = (BITMAPINFOHEADER*)data;
(HBITMAP*)(data+sizeof(BITMAPINFOHEADER));
const char *DemoText = "ABCD0123456789\0";
RECT TextArea = {400, 400, 400, 400};
HFONT fontHandle = CreateFont(60, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_OUTLINE_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, VARIABLE_PITCH || FF_DONTCARE, "Arial\0");
HDC hdc = CreateDC(m_DispDevice.DeviceName,NULL,NULL,NULL); // creates a device context (DC) for a device ("\\.\DISPLAY2")
SelectObject ( hdc, fontHandle);
SetTextColor( hdc, RGB (128, 128, 128));
SetBkMode( hdc, TRANSPARENT);
DrawDibDraw(m_hDrwScr,hdc,m_ptScrPos.x,m_ptScrPos.y,-1,-1,pbitmapInfoHeader,phbitmap, 0,0,pbitmapInfoHeader->biWidth,pbitmapInfoHeader->biHeight,0); // draws a DIB to the screen
DrawTextA ( hdc, DemoText, 14, &TextArea, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); // draws formatted text in the specified rectangle
DeleteObject( fontHandle);
DeleteDC(hdc);
};
(data=(BYTE*)AVIStreamGetFrame(m_pGetFrame,Num);)
the code is working, but text is flicker because i can't draw text to decompresed frame and after this draws a DIB to the screen
Any ideas?
thanks
-
October 9th, 2012, 02:09 AM
#2
Re: Drawing Text to a decompressed video frame
How are you decompressing the video frames?
If you are using the Media Foundation SDK, take a look at the example here: http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
-
October 9th, 2012, 05:44 AM
#3
Re: Drawing Text to a decompressed video frame
if you only want the visual appearance of text on top of video but don't need the actual text "in" the bitmap, then you could also have a look at window layering. You basically create a new window place it on top of the videstream, make the window transparent and then just draw what you need to draw (transparently) onto your own window. The Windows WDM will then be responsible for proper painting of everything.
see http://msdn.microsoft.com/en-us/libr...px#layered_win
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|