草图过滤器 - windows phone 8.1 silverlight 使用 C#

Sketch Filter - windows phone 8.1 silverlight using C#

我有一个 WriteableBitmap 格式的图像,现在我想对其应用草图滤镜并在不保存的情况下在图像控件中显示它。 我怎样才能做到这一点?

你可以使用Lumia Imaging SDK has a SketchFilter

这是一个快速函数,它将 SketchFilter 应用于 wbIn 和 return wbOut

中的过滤图像
using Lumia.Imaging;
using Lumia.InteropServices.WindowsRuntime;
using Lumia.Imaging.Artistic;

...

async Task FilterWriteableBitmap(WriteableBitmap wbIn, WriteableBitmap wbOut)
{
    using (var imageSource = new BitmapImageSource(wbIn.AsBitmap()))
    using (var filterEffect = new FilterEffect(imageSource))
    using (var renderer = new WriteableBitmapRenderer(filterEffect,wbOut)) 
    {
        var filter = new SketchFilter(SketchMode.Color);

        filterEffect.Filters = new IFilter[] { filter };

        await renderer.RenderAsync();
    }
}

...

await FilterWriteableBitmap(originalWB,filteredWB)
img.Source = filteredWB;