Search code examples
directxdirect2d

Retrieve IDXGISurface from ID2D1BitmapBrush


My application uses 2 DXGISurfaceRenderTargets.

The 1st render target is used to create ID2D1Bitmap, then ID2D1BitmapBrush from it.

Resulting ID2D1BitmapBrush is used to FillGeometry on the 2nd render target.

Is it possible to retrieve IDXGISurface that was used to create ID2D1BitmapBrush from the ID2D1BitmapBrush or the ID2D1Bitmap?

Windows 8 has ID2D1Bitmap1 with GetSurface method, but I need this on Windows 7.

Thank you.


Solution

  • No, you cannot, as you pointed out, only ID2D1Bitmap1 can retrieve the surface by calling Getsurface, and that's only works on Windows 8.

    If you want to use the surface, can you store it after creation, and then pass it as the parameter to the function which used it?

    D2D1Bitmap

    D2D1Bitmap1