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;
}
------解决思路----------------------
媒体库是个独立的对象,里边有获取图片的方法,话说做WP不能老想着绝对路径啊,90%的状况是不能使用绝对路径的。