1
votes

How to use Blend Effect from Lumia Imaging SDK in UWP windows 10 for Mobile?

this is my code for get byte array from blend effect. it's work for Desktop Mode, but not for Mobile(Windows Phone)

                byte[] byteImageResult;
                var fileWM = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/ADI.Mobile-wm.png"));
                using (var stream = await capturedMedia.OpenAsync(FileAccessMode.Read))
                using (var fileStreamWM = await fileWM.OpenAsync(FileAccessMode.Read))
                using (var _blendEffect = new BlendEffect())
                {
                    _blendEffect.Source = new RandomAccessStreamImageSource(stream);
                    _blendEffect.ForegroundSource = new RandomAccessStreamImageSource(fileStreamWM);
                    _blendEffect.TargetArea = new Rect(0, 0.93, 0, 0);
                    _blendEffect.TargetOutputOption = OutputOption.PreserveSize;

                    using (var renderer = new JpegRenderer(_blendEffect))
                    {
                        IBuffer jpegBuffer = await renderer.RenderAsync();
                        byteImageResult = jpegBuffer.ToArray();
                        biResult = await Tools.ByteArrayToBitmapImage(byteImageResult);
                    }
                }

What's wrong with my code?

1
Can you be more specific, how does it not work on Windows Phone?David Božjak
What's version of your SDK? Have you tried with the latest Lumia Imaging SDK UWP? Then what's your specific error?Fangfang Wu - MSFT
@DavidBožjak : always force close when execute var _blendEffect= new BlendEffect()Gigin Ginanjar
@FangfangWu-MSFT : yes, it's the latest Lumia Imaging SDK UWP. I got from Nugget. Version 3.0.593.Gigin Ginanjar
i got error like this image puu.sh/lbg7J.pngGigin Ginanjar

1 Answers

0
votes

I encountered such problem before too and it was the emulator. The error didn't appear when running on a physical device.