8
votes

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?

1

1 Answers

0
votes

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