Windows 8 Metro App - Render PNGs

纵然是瞬间 提交于 2019-12-20 02:27:10

问题


I am needing to render some custom PNGs in a Windows 8 app.

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.

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.


回答1:


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 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).




回答2:


Currently the only option is to use DirectX (or SharpDX) to create your image. You'll probably have to recreate the drawing using the low-level DirectX APIs. WritableBitmapEx might also be helpful if your drawings are simple.



来源:https://stackoverflow.com/questions/12180235/windows-8-metro-app-render-pngs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!