更新时间:2022-12-21 11:03:32
你好vjguna,
Hi vjguna,
>>我想知道是否有可能在内存中渲染wpf应用程序然后它将作为图像处理库的4k视频叠加添加。
>>I would like to know whether it is possible to render wpf application in memory and then it will be added as an overlay on 4k video by image processing library.
我们可以将WPF控件绘制到内存中,像这样:
We could draw WPF control to memory, like this:
public BitmapSource RenderToBitmap(UIElement element, Size size)
{
element.Measure(size);
element.Arrange(new Rect(size));
element.UpdateLayout();
var bitmap = new RenderTargetBitmap(
(int)size.Width, (int)size.Height, 96, 96, PixelFormats.Default);
bitmap.Render(element);
return bitmap;
}
欲了解更多信息,请参阅:
For more information, please refer to:
祝你好运,
张龙