Int数组到windows phone中的WriteableBitmap

时间:2013-03-17 08:46:56

标签: c# windows-phone-7 windows-phone-8

如何在Windows Phone 8中将int []像素数组转换为WriteableBitmap?之后,我想将此图像保存到MediaLibrary。

2 个答案:

答案 0 :(得分:1)

我在Windows Phone上知道的唯一方法是使用WriteableBitmapEx库。除了WriteableBitmap之外,它还实现了“具有各种重载的SetPixel方法”:

http://writeablebitmapex.codeplex.com/

可以从Visual Studio 2012中简单地安装库:

PROJECT =>管理NuGet包=>在线=>搜索“WriteableBitmapEx”

答案 1 :(得分:0)

您可以使用int []的copyTo成员函数将int []复制到WriteableBitmap。

int[] ARGBPx = new int[(int)captureDevice.PreviewResolution.Width * (int)captureDevice.PreviewResolution.Height];            
WriteableBitmap writeableBitmap_preview;        

ARGBPx.CopyTo(writeableBitmap_preview.Pixels, 0);         
writeableBitmap_preview.Invalidate();