如何创建一个 WPF 图像控件,该控件从我读入内存的 JPEG 中获取数据?

发布于 2024-09-08 03:32:25 字数 135 浏览 8 评论 0原文

对于应用程序中的图像,我已将图像的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

汹涌人海 2024-09-15 03:32:25

查看 InteropBitmapWriteableBitmap,继承自 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文