2

我想使用WP8上的诺基亚成像SDK将两个图像混合在一起。为此,我需要将blendFilter.ForegroundSource设置为从IImageProvider派生的图像类型。 我尝试使用从内容加载图像作为IImageProvider

Uri uri = new Uri("/images/background.jpg", UriKind.Relative); 
var imgSource = new BitmapImage(uri); 
blendFilter.ForegroundSource = new BitmapImageSource(imgSource); 

但BitmapImage的未实现IReadableBitmap。

我该如何解决这个问题?

回答

4

您是否尝试过使用StorageFileImageSource?

string imageFile = @"images\background.jpg" 
var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(imageFile); 
blendFilter.ForegroundSource = new StorageFileImageSource(file)) 
+0

谢谢,这就是我一直在寻找的。我一直对所有图像格式,流等都感到困惑。 – Thomas