WinRT: how to save WriteableBitmap to localfolder

孤街醉人 提交于 2020-02-01 07:26:04

问题


How to save a WriteableBitmap to localfolder using C# in WinRT?


回答1:


You can check WinRT XAML Toolkit for a set of extension methods to do exactly what you need: http://winrtxamltoolkit.codeplex.com/SourceControl/changeset/view/0657c67a93d5#WinRTXamlToolkit%2fImaging%2fWriteableBitmapSaveExtensions.cs




回答2:


Here are bits and pieces of the answer

var bitmap = new WriteableBitmap(width,height);
var stream = bitmap.PixelBuffer.AsStream();

than you can get IOutputStream from Stream to write the data into the local folder.

this post explains how to convert Stream to byte[]

and this explains how to write byte[] array to localfolder.



来源:https://stackoverflow.com/questions/13040824/winrt-how-to-save-writeablebitmap-to-localfolder

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