Windows 8 Metro App - Render PNGs(Windows 8 Metro 应用程序 - 渲染 PNG)
问题描述
我需要在 Windows 8 应用程序中呈现一些自定义 PNG.
I am needing to render some custom PNGs in a Windows 8 app.
基本上,我需要通过将我的应用中制作的一些绘图放在动态磁贴的图像上来创建自定义动态磁贴,唯一的方法是将 PNG 渲染到磁盘,看这里.
Basically I need to create a custom live tile by putting some drawings made in my app on top of an image for a live tile, and the only way to do this is render a PNG to disk, see here.
我应该使用什么库来执行此操作?我的第一个想法是使用 Xaml UserControl 和 RenderTargetBitmap,但它在 Metro 应用程序中不可用.
What library should I use to do this? My first thought was to use a Xaml UserControl and RenderTargetBitmap, but it is not available in a Metro app.
推荐答案
WinRT XAML Toolkit 有一些您也可以使用的 WriteableBitmap 扩展方法.您可能可以使用 WriteableBitmapLoadExtensions 进行加载和 WriteableBitmapSaveExtensions 用于保存.它具有相当有限的 blitting 功能,因为 WriteableBitmapEx 已经公开了该功能,并且无论如何编写都很简单.WriteableBitmapBlitBlockExtensions 只是一种从位图中对全宽像素块进行 blit 的方法宽度相同.
WinRT XAML Toolkit has some extension methods for WriteableBitmap that you could use too. You could probably use WriteableBitmapLoadExtensions for loading and WriteableBitmapSaveExtensions for saving. It has a fairly limited blitting capability though since that is exposed by WriteableBitmapEx already and simple to write anyway. WriteableBitmapBlitBlockExtensions is only a method to blit a full width block of pixels from bitmaps of same width.
Edit* RenderTargetBitmap 现在在 Windows 8.1 中可用.但它不支持某些元素(我认为它不渲染相机预览、媒体元素,也许还有 WebViews).
Edit* RenderTargetBitmap is now available in Windows 8.1. It doesn't support some elements though (I think it doesn't render camera previews, media elements and perhaps WebViews).
这篇关于Windows 8 Metro 应用程序 - 渲染 PNG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Windows 8 Metro 应用程序 - 渲染 PNG
基础教程推荐
- 将数据集转换为列表 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- 获取C#保存对话框的文件路径 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- 如果条件可以为空 2022-01-01
