InteropBitmap synchronization
-
Wednesday, June 01, 2011 1:55 AM
WPF InteropBitmap can be created from shared memory, i.e.
Imaging.CreateBitmapSourceFromMemorySection()In this case, we can update shared memory in another thread or process, and then after updating, calling InteropBitmap.Invalidate() to present the changes.
From the WPF source code, InteropBitmap is just a wrapper of IWICBitmap, but it doesn't exposeIWICBitmap::lock which is used for exclusive writing (there is a unofficial way to expose this interface).
So, how do I sync writing and reading of WPF InteropBitmap?
- Updating occurs in user's thread.
- Reading always occurs in WPF internal render thread via IWICBitmapSource::CopyPixels
Thanks
All Replies
-
Friday, June 03, 2011 7:05 AMModerator
Hi Chang Chen,
No I am afraid there is not such a straightforward way to make synchronization of InteropBitmap in WPF. The possible workaround may be converting the InteropBitmap to WritableBitmap which has a Lock method. Please kindly check if this could meet your requirements.
Best regards
Yves Zhang [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

- Marked As Answer by Yves.ZModerator Monday, June 13, 2011 9:53 PM

