views:

80

answers:

0

Hi all,

The WPF application I have build has a Viewport3D containg all kinds of UIElement3D objects. Now I would like to save a high resolution snapshot of a certain view to a file. I have tried RenderTargetBitmap in the past, but I do not like this approach because of the following downsides:

  • Memory leakage (at least with .NET 3.5 SP1). It should be solved however with 4.0, but I have not tested that yet.
  • Software rendering does not give the same results as hardware rendering when using anti-aliasing and pixel shaders.
  • RenderTargetBitmap needs a lot of time (like 10 seconds) to form an image, instead of fraction of a second needed for display on screen.

So I wonder whether it would be possible to use a VisualBrush, containing a snapshot copy, in a new control/window (preferably offscreen) and then grab the contents trough the front- or backbuffer using DirectX or GDI techniques. I could imagine that resolution beyond capabilities of graphics card might be a problem, but that could be solved by grabbing multiple sub images and stitch them together aftwerwards. So anyone with some ideas on this topic?

Please keep in mind that I have read about DirectX, XNA, SlimDX, GDI+, BitBlt and so on, but that's about all the experience I have on these matters. Target platform is Windows XP+. If a solution is possible but not on XP, I would like to know also.

Best regards,

Jan van de Pol