Lumia imaging sdk 3 blur effect issue (The component cannot be found. (Exception from HRESULT: 0x88982F50))

1

I need to render an xaml element and apply a blur effect using LumiaImageSDK 3

            var bitmapRended = new RenderTargetBitmap();
            await bitmapRended.RenderAsync(LayoutRoot);

            IBuffer buffer = await bitmapRended.GetPixelsAsync();

            var target = new WriteableBitmap(bitmapRended.PixelWidth, bitmapRended.PixelHeight);
            var source = new BufferImageSource(buffer);
            var blur = new BlurEffect(source, 128);

            var renderer = new WriteableBitmapRenderer(blur, target);

            var result = await renderer.RenderAsync();

            var imgBrush = new ImageBrush();
            imgBrush.ImageSource = result;

            Menu.Background = imgBrush;

but when i run the code i get this error:

The component cannot be found. (Exception from HRESULT: 0x88982F50)

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

i think is something related to the way i convert the RenderTargetBitmap to an IRandomAccessStream.

the exception is raised from this line of code : var result = await renderer.RenderAsync();

it seams that the problem is a deadlock but i'm not able to find a solution

edit: code updated

c#
windows-runtime
windows-phone-8.1
winrt-xaml
lumia-imaging-sdk
asked on Stack Overflow Oct 15, 2015 by frenk91 • edited Oct 20, 2015 by frenk91

2 Answers

2

I got the same issue when using Lumia Imaging SDK. I am still checking the issue. However, to blur a image, using Win2D is a alternative choice.

Your code above shows how to render a XAML UIElement as s stream or sth. Then you can blur it by using Win2D library. I have post simply talking about how to do the blur stuff.

Hope it helps.

answered on Stack Overflow Oct 16, 2015 by JuniperPhoton
1

Since you have a IBuffer with the result (IBuffer buffer) then skip all the buffer manipulation and just create a BufferImageSource.

var target = new WriteableBitmap(bitmapRender.PixelWidth, bitmapRender.PixelHeight);
using (var source = new BufferImageSource(buffer))
using (var blur = new BlurEffect(source , 128))
using (var renderer = new WriteableBitmapRenderer(blur, target))
{
    var result = await renderer.RenderAsync();
}

That said I can't see an obvious problem with the code you wrote. I will have to look into it, but until then, have you made sure the stream is at the beginning? That is a common error with streams.

answered on Stack Overflow Oct 16, 2015 by David Božjak

User contributions licensed under CC BY-SA 3.0