It is possible to apply filters to a picture, but I can apply only 1 filter, using lumia imaging sdk. When developing on Win 8.1, I used an array with filters and they were all applied at once, it doesn't work like that, is there any way to apply several filters at once?

The code for applying the effect:

public async Task<bool> ApplyEffectAsync(StorageFile file) { WriteableBitmap temp = new WriteableBitmap(1280, 720); temp = new WriteableBitmap(1280, 720); FileStream = await File.OpenAsync(FileAccessMode.Read); temp.SetSource(FileStream); OriginalPicture = temp; FileStream.Seek(0); original.Invalidate(); ((IImageConsumer) Effect).Source = new RandomAccessStreamImageSource(FileStream); M_renderer = new WriteableBitmapRenderer((IImageProvider)Effect, original); FilteringPicture = await M_renderer.RenderAsync(); filtering.Invalidate(); return true; } 

    2 answers 2

    To apply effects you can use the Win2D library. You can find an example here.
    To combine several effects there you can use CompositeEffect
    Example:

     var myTextBitmap = new CanvasRenderTarget(sender, 300, 100); using (var ds = myTextBitmap.CreateDrawingSession()) { ds.Clear(Color.FromArgb(0, 0, 0, 0)); ds.DrawText("Неоновый текст!", 0, 0, Colors.White, new CanvasTextFormat { FontSize = 24, FontWeight = Windows.UI.Text.FontWeights.Bold }); } var effectGraph = new CompositeEffect(); effectGraph.Mode = CanvasComposite.Add; effectGraph.Sources.Add(new ColorMatrixEffect { Source = new GaussianBlurEffect { Source = new MorphologyEffect { Source = myTextBitmap, Mode = MorphologyEffectMode.Dilate, Width = 7, Height = 4 }, BlurAmount = 3f }, ColorMatrix = new Matrix5x4 { M11 = 0f, M12 = 0f, M13 = 0f, M14 = 0f, M21 = 0f, M22 = 0f, M23 = 0f, M24 = 0f, M31 = 0f, M32 = 0f, M33 = 0f, M34 = 0f, M41 = 0f, M42 = 1f, M43 = 0f, M44 = 1f, M51 = 1f, M52 = -0.5f, M53 = 0f, M54 = 0f } }); effectGraph.Sources.Add(myTextBitmap); args.DrawingSession.DrawImage(effectGraph,100,100); 

    In addition, you can use the Lumia Imaging SDK, but I can not say how it is with a few effects.

    • I just use lumia sdk - SmiLe
    • Oh, sorry, overlooked. But the option with Win2D, I hope you threw. - Alexej Sommer

    In Effect.Source you must transfer the previously filtered image, and not read it from FileStream