wp8怎样调用当前存入图片库mediaLibrary的图片?c#
1.能够直接调用writeablebitmap中的图片么?
2.如果必须使用文件路径,把pics 代入到path中,应该怎么写?现在的类型貌似是不对应的?
{
WriteableBitmap aaa = new WriteableBitmap(555, 555);
aaa.Render(cc, new MatrixTransform());
aaa.Invalidate();
SaveToMediaLibrary(aaa, fileName, 100);
MediaLibrary mediaLibrary = new MediaLibrary();
PictureAlbumCollection albums = mediaLibrary.RootPictureAlbum.Albums;
var pics = albums[0].Pictures[albums[0].Pictures.Count - 1].GetImage();
byte[] png = gogo(pics);
}
private byte[] gogo(string path)
{
StreamResourceInfo info = App.GetResourceStream(new Uri(path, UriKind.Relative));
if (info == null) return null;
Stream stream = info.Stream;
byte[] data = new byte[stream.Length];
stream.Read(data, 0, (int)stream.Length);
return data;
}
private async void SelectImageOne(byte[]outArary)
{
StorageFile storageFile=await Windows.Storage.KnownFolders.DocumentsLibrary.CreateFileAsync("1.txt",Windows.Storage.CreationCollisionOption.ReplaceExisting);
awaitFileIO.WriteBytesAsync(storageFile, outArary);
}
可以读文件,用他读图片,我想到的