簡體   English   中英

草圖過濾器 - 使用C#的windows phone 8.1 silverlight

[英]Sketch Filter - windows phone 8.1 silverlight using C#

我有一個WriteableBitmap格式的圖像現在我想對它應用草圖過濾器並在圖像控件中顯示它而不保存。 我該怎么做到這一點?

Lumia Imaging SDK具有您可以使用的SketchFilter

這是一個快速函數,它將一個SketchFilter應用於wbIn並在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;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM