Windows 8 Metro 应用程序 - 渲染 PNG [英] Windows 8 Metro App - Render PNGs

查看:45
本文介绍了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 UserControlRenderTargetBitmap,但它在 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆