How to copy data from TDirect2DCanvas (Direct2D Rendertarget)?
Asked Answered
G

1

8

I'm trying out the Direct2D RenderTarget property of C++ Builder's TDirect2DCanvas to benchmark bitmap manipulation using the GPU. This is most impressive compared to GDI. However, I cannot figure out how to get the result back into CPU memory so I can use it for further CPU processing. Did read about using WIC but apparently you loose most of the hardware acceleration. Windows 8 seem to offer a new bitmap with map functionality, but I want to use (standard) Windows 7. Also C++ Builder does not offer the header files for these new functions.

Given a TDirect2DCanvas, or so you wish a Direct2D RenderTarget or a ID2D1Bitmap, how do I copy the bitmap back to CPU memory?

Griffen answered 13/3, 2014 at 14:59 Comment(0)
P
0

I am not an expert in Delphi or the C++ Builder, but here is how I would try from a DirectX API perspective.

  1. Create a DXGI in combination with Direct2D.
  2. Render your scene as you already do.
  3. As the DXGI swap chain for the back buffer to get the pixel information.

Here is a very good article which explains how to do it: https://msdn.microsoft.com/en-us/magazine/dn198239.aspx

Patriciate answered 13/5, 2015 at 7:58 Comment(1)
Thanks Jasper, but I already know how to do it in W8 (or 7 with PU). My question is, or better was, how to do it in W7.Griffen

© 2022 - 2024 — McMap. All rights reserved.