Thursday, May 29, 2014

RenderTargetBitmap for off-screen rendering?

I'm making an app with a video export function that, among other things, allows you to export presentations to video. I'm rendering the content on-screen, in a canvas, and then using RenderTargetBitmap (giving it the canvas) to create the frame. It actually works great, except -


RenderTargetBitmap pauses whenever the user navigates away from the app. I assume this is because it uses the UI thread and the UI thread gets suspended when the window is not visible. Meaning, the app must stay in focus for the entire render. This is fine for quick renders, but for longer renders, it would be annoying to tie up the user's computer for an hour or longer.


Is there any way either to (a) prevent the UI thread from suspending when the user navigates away (thus ensuring RenderTargetBitmap can keep working), or (b) render UIElement's to a bitmap in a worker thread that doesn't get suspended?


If, as I assume, the answer is no, are there other ways to render text, shapes, and other multimedia content to a bitmap besides using UIElements and RenderTargetBitmap? For example in Win32 you can render text and such to a GDI device-context and then get the bits that way. Is there anything similar for WinRT?


Thanks much!




No comments:

Post a Comment