如何创建一个 WPF 图像控件,该控件从我读入内存的 JPEG 中获取数据?
对于应用程序中的图像,我已将图像的 source
属性设置为磁盘上的 JPEG 文件,但作为下一次迭代的一部分,我想测试将它们保留在内存中以提高速度。
如何告诉 WPF Image 控件从内存源而不是文件获取信息?
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 from an in-memory source rather than from a file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 InteropBitmap 和 WriteableBitmap,继承自 BitmapSource 的两个类允许您从数组提供图像的像素。
要创建 InteropBitmap,请使用 Imaging 类上的方法,例如 Imaging.CreateBitmapSourceFromMemorySection。
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.