Reputation: 897
Is there any way that we could crop a particular RECT from the image captured using the Desktop Duplication and renders it back to the window after applying some effects.
please have a look at this picture:
Take notepad as the example ,so as per the above picture i want to capture the red rectangular area (the window RECT area) and renders it back to a window. and when the window is moved from one position to another the capturing source RECT should also move along with the window (exactly like the windows magnifier window).
I have already referred to DXGI desktop duplication sample and it looks very complicated.
Note: I will use WDA_EXCLUDEFROMCAPTURE to remove the window from the capturing RECT so that I will be able to get the visual behind the window
Upvotes: 1
Views: 1887
Reputation: 69716
The API is designed in such way that you capture composed image for the entire monitor with a really small processing overhead. There is no option to capture a region of interest (ROI), and there is no much sense in this either: you would gain nearly nothing, specifically there would be no performance benefit.
When you capture a frame you have a standard texture and you are free to do whatever you want with the data. Specifically you can extract your ROI. You can also check updated/moved rectangles against your ROI coordinates. You can map texture data and process it as byte array too. That is, it is fairly easy to crop and there are multiple ways to do this - it is just not the task Desktop Duplication API is designed for.
Upvotes: 3