`
ribishuangba
  • 浏览: 292453 次
文章分类
社区版块
存档分类
最新评论

Silverlight - WriteableBitmap的跨域调用限制

 
阅读更多

Silverlight 3中增加的WriteableBitmap大大方便了图片编辑。最近使用了.NET Image Tools,其中很多编辑功能都是基于对WritableBitmap的操作。项目中有一个Image的Source是来自不同域下的Uri,使用.NET Image Tools是遇到了一个异常"Cannnot acess Bitmap" , 搜索到一个讨论,才发现WriteableBitmap也有跨域调用下的限制:

The WriteableBitmap class has a security model that restricts access to the Pixels array, if the WriteableBitmap is constructed using cross-domain content. For example, a WriteableBitmap that is constructed using a BitmapImage referencing a URL that comes from another domain does not permit access to its Pixels array. The restriction extends to any UI element that uses a URL-derived property for setting some or all of its content. In particular, this restriction applies to the "Grab a frame of a running video from MediaElement" scenario. If the MediaElement.Source references a video file from another domain, the WriteableBitmap created by referencing the MediaElement as the element source restricts access to the Pixels array.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics