我正在使用诺基亚成像 SDK 开发 WP8 应用程序。我正在尝试为图像添加滤镜效果并将其渲染为WriteableBitmap
.
这是我的代码:
private async void PhotoChosen(object sender, PhotoResult photoResult)
{
if (photoResult != null)
{
BitmapImage bitmap = new BitmapImage();
bitmap.SetSource(photoResult.ChosenPhoto);
WriteableBitmap wb = new WriteableBitmap(bitmap.PixelWidth, bitmap.PixelHeight);
StreamImageSource source = new StreamImageSource(photoResult.ChosenPhoto);
var effects = new FilterEffect(source);
effects.Filters = new IFilter[] { new SketchFilter() };
var renderer = new WriteableBitmapRenderer(effects, wb);
await renderer.RenderAsync();
}
}
一切都很好,但是当这条线正在处理时:
await renderer.RenderAsync();
这ArgumentException
是抛出:
Value does not fall within the expected range
我认为我在创建IImageProvider effects
或时犯了一个错误WriteableBitmap wb
有没有人遇到这个问题并发现了问题?谢谢 :)