wp8怎样调用当前存入图片库mediaLibrary的图片

有有不白 2014-07-26 12:45:36
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;
}
...全文
238 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
有有不白 2014-07-31
  • 打赏
  • 举报
回复
wp8怎样调用当前存入图片库mediaLibrary的图片?c# 我们现在有这样一个刚截取的图片。

 var fileName = "hello"; 
 WriteableBitmap aaa = new WriteableBitmap(555, 555);
 aaa.Render(ccc, new MatrixTransform());
 aaa.Invalidate();
 SaveToMediaLibrary(aaa, fileName, 100);
如果提取文件路径,把pics 代入到path中,应该怎么写?
MediaLibrary mediaLibrary = new MediaLibrary();
PictureAlbumCollection albums = mediaLibrary.RootPictureAlbum.Albums;
var pics  = albums[0].Pictures[albums[0].Pictures.Count - 1].GetImage();
var pic  = albums[0].Pictures[albums[0].Pictures.Count - 1].GetThumbnail();
又怎样调取thumbnail的地址呢?
byte[] PNG = gogo(pics);  
byte[] PNGS = gogo(pics); 
message.ThumbData  = PNG;
message.ImageData =  PNGS;
}
这个byte转化工具是不是很鸡肋?我们一定要提取path么?能够直接调用writeablebitmap中的图片么?
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;
}
有有不白 2014-07-31
  • 打赏
  • 举报
回复
我的问题主要是多种方法间的纠结。。。这个函数卡住那个函数, 我把题目再修改下,大家请支招~
vbfool 2014-07-30
  • 打赏
  • 举报
回复
媒体库是个独立的对象,里边有获取图片的方法,话说做WP不能老想着绝对路径啊,90%的状况是不能使用绝对路径的。
有有不白 2014-07-29
  • 打赏
  • 举报
回复
upupup

7,655

社区成员

发帖
与我相关
我的任务
社区描述
Windows Phone是微软发布的一款手机操作系统,它将微软旗下的Xbox LIVE游戏、Zune音乐与独特的视频体验整合至手机中。
社区管理员
  • Windows客户端开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧