开发者

How do I create a WPF Image control that sources its data from a JPEG I've read into memory?

For the images in my application, I have been setting the source property of my image to a JPEG file on disk but, as part of my next iteration, I want to test keeping them in memory for speed.

How do I tell the WPF Image control to get its information fro开发者_运维技巧m an in-memory source rather than from a file?


Have a look at InteropBitmap and WriteableBitmap, two classes that inherit from BitmapSource that allow you to supply the pixels of the image from an array.

To create an InteropBitmap you use methods on the Imaging class like Imaging.CreateBitmapSourceFromMemorySection.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜