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