如何保存具有多个图像的画布到Windows应用商店中使用c#和xaml的图片库 [英] How to save a canvas having more than one image to the picture library in windows store app using c# and xaml
问题描述
我正在使用c#和xaml创建一个应用程序的Windows 8商店应用程序。我使用了一个画布,其中多个图像添加,现在我想保存画布到图片库。
I am creating an application for windows 8 store app using c# and xaml.I have used a canvas where more than one images are added now i want t save the canvas to the picture library .
感谢:)
推荐答案
您可以使用WinRT XAML Toolkit的Composition库。构建您的UI,就像在屏幕上显示一样,在根元素上调用 Measure
和排列
输出图像尺寸并使用扩展方法之一 - WriteableBitmapRenderExtensions.Render()
或 .RenderToPngStream()
a WriteableBitmap
或 MemoryStream
。如果您在应用清单中启用图片库访问功能,则可以将位图或流保存到文件。
You can use WinRT XAML Toolkit's Composition library. Build your UI as you would to display on screen, call Measure
and Arrange
on the root element to size it to your output image dimensions and use one of the extension methods - WriteableBitmapRenderExtensions.Render()
or .RenderToPngStream()
to render to a WriteableBitmap
or MemoryStream
respectively. You can then save the bitmap or stream to a file if you enable pictures library access capability in your app's manifest.
这篇关于如何保存具有多个图像的画布到Windows应用商店中使用c#和xaml的图片库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!