Closed thecaptncode closed 3 years ago
I have a idea to move all System.Imaging logic into a decorator, to get a flexible solution. Skia should be the fastest lib, if we move away from System.Imaging.
I am very interested in hearing more. Delegates are another alternative as well and are mockable. How do you see decorators working?
Our internals don't need the Imaging, we just need the bytes / IntPtr to the Byte Array. The Decorater could load the image and than call the SendBitmapToDevice with the Pointer.
I will try to refactor it for this idea :-)
Sounds like a good idea. There are a couple things to keep in mind.
SkiaSharp requires the access to be within an unsafe { } block. Which, in retrospect I'm surprised System.Imaging doesn't. SkiaSharp returns 4 bytes per pixel, one of them for the Alpha channel, which I don't see us ever needing to manipulate.
Here is an example: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/bitmaps/pixel-bits
Greg
Dis a test with SkiaSharp on the develop branch. But looks like the installation of the required lib for linux is a pain in the ass on the pi and test pipeline on github
Which SkiaSharp NuGet packages did you use? I have been using SkiaSharp and SkiaSharp.NativeAssets.Linux,
Thanks for the Hint, i only used the Main NuGet Package. It's working in the GitHub Action now and i dont need to compile it on the Pi any more :-)
Oh that;s good. I'm glad I could help.
Moved Imaging logic out of the devices (on develop branch), it can be replaced if the IoT Team is moving to a other library.
I thought I'd open up an issue just for this.
According to https://github.com/dotnet/iot/issues/1403 the .NET IoT guys are planning a move away from System.Imaging since it has been deprecated. The link to a Microsoft doc in that issue lists three alternatives. I can explore the conversion of this project to one of them if you wish.
I have moved the local copy of my IoTDisplay project (not pushed to GitHub yet) from System.Imaging to SkiaSharp and it is working well. The same could be done with the Waveshare driver and still remain compatible with existing code.
What are your thoughts? Greg