How to get the pixel data from IDCompositionSurface

71 Views Asked by At

I am using DirectComposition in conjunction with DirectManipulation to render things. I have some text present on the DirectCompositionVisuals which are chained vertically. I want to pull the pixel data of the selection so that I can do stuff with it. I am trying to do the following but this however results in surface getting cleared

HRESULT hr = DCSurface->BeginDraw(&rect, IID_PPV_ARGS(&dxSurface), &point);
HDC hdcSurface = nullptr;
hr = dxSurface->GetDC(FALSE, &hdcSurface);

1

There are 1 best solutions below

4
On

As far as I'm concerned, first, you should create an updateable surface object that can be associated with one or more visuals for composition via IDCompositionDevice::CreateSurface method. And then use the IDCompositionSurface::BeginDraw method to initialize the surface with pixel data.