I have a problem with saving a bitmap into a file. I\'m using How to save ID2D1Bitmap to PNG file as a reference, but I have a different error than the one posted in that.
Your understanding of resource affinity is insufficient. Resources are device-specific rather than factory-specific. Yes, they tend to be factory-specific as well, but the key is the device specificity.
In your example, you are passing in a bitmap created by some other render target, which you then pass to the DrawBitmap method of a different render target. You may only draw a bitmap created by the same render target. This ensures that the bitmap and the render target (source and target) are in the same resource domain (address space).