You can use CreateEffect with CLSID_D2D1Crop, then with GetOutput you get a ID2D1Image that you can draw with DrawImage
Direct2D: How to get part of a client area as a ID2D1Bitmap
thebluetropics
1,046
Reputation points
I need to get part of a window's client area as ID2D1Bitmap
in Direct2D application.
For example, if a the client area size is 420x320px, how can I get the 100x100px part of the client area? (crop effect)
Also, if this seems impossible with Direct2D, it is okay to use GDI as long as it is compatible with Direct2D (e.g Bitmap
can be converted to ID2D1Bitmap
afaik)
Regards, @thebluetropics
Accepted answer
1 additional answer
Sort by: Most helpful
-
thebluetropics 1,046 Reputation points
2022-10-04T12:30:26.633+00:00 As stated in this thread by Castorix, use
CreateCompatibleRenderTarget()
and useID2D1BitmapRenderTarget::GetBitmap()