I need to draw a video to another window where I could get the device context hDC
using GetDCEx
. I can already achieve drawing using System.Drawing.Graphics
:
g = Graphics.FromHdc(hdc);
// Now I need to get the video frame/bitmap here
g.DrawImage(frameBitmap, 0, 0);
However I don't think System.Drawing
has any class for video rendering, so I plan to use System.Windows.Media.MediaPlayer
. However, the best I could do is to get it to RenderTargetBitmap
. There is a way to use an encoder to render to Bitmap file and then decoding it to System.Drawing.Image
, but I think it would be too slow.
So either of these can solve my problem, please tell me if any is possible:
Can a WPF
DrawingVisual
draw on a hDC?Can a DrawingVisual somehow draws on a
Graphics
?A quick way to get
System.Drawing.Bitmap
fromDrawingVisual
/MediaPlayer
/VideoDrawing
?