Skip to main content
 首页 » 编程设计

C# RenderTargetBitmap 到 SoftwareBitmap

2024年01月26日29haluo1

如何将 RenderTargetBitmap 对象放入 SoftwareBitmap 中?可以获取 RenderTargetBitmap 作为图像源,另一方面我可以使用 SoftwareBitmap 作为 SoftwareBitmapSource 并将其转换为 ImageSource。但是如何将 RenderTargetBitmap 直接转换为 SoftwareBitmap?

请您参考如下方法:

渲染目标位图。 GetPixelsAsync返回一个 IBuffer,您可以使用 SoftwareBitmap 将其复制到 SoftwareBitmap 中。 CreateCopyFromBuffer