Microsoft.Maui.Graphics
Microsoft.Maui.Graphics copied to clipboard
Can it support SVG and other vector graph formats?
Current platform-independent Svg support in .Net is https://github.com/wieslawsoltes/Svg.Skia . If Maui.Graphics takes over from SkiaSharp as the main .Net platform-independent graphics abstraction then I would assume this lib will get ported to Maui.Graphics. You can ask there though to guage interest.
Pinging @wieslawsoltes .
Current platform-independent Svg support in .Net is https://github.com/wieslawsoltes/Svg.Skia . If Maui.Graphics takes over from SkiaSharp as the main .Net platform-independent graphics abstraction then I would assume this lib will get ported to Maui.Graphics. You can ask there though to guage interest.
It really depends on what API will be supported in Microsoft.Maui.Graphics. Svg.Skia for full feature set supported required a lot of SkiaSharp apis. If you want just basic subset of Svg (no filter effects etc.) that it should be pretty easy to add. Svg.Skia has special abstraction layer modeled so it's easy to add new targets (if they have necessary features).
hope svg.skia can provide a preliminary SVG support for Maui @wieslawsoltes .
@charlesroddie
If Maui.Graphics takes over from SkiaSharp as the main .Net platform-independent graphics abstraction...
That's a big "if". The advantage of Skia is its universal support - extending beyond .Net circles.
I don't see how or why there would be a platform that Maui.Graphics supports, that isn't already supported by Skia. To me, for the foreseeable future, it makes more sense to leverage Skia, make Maui-based layers on it, to mix with other layers that go direct to Skia, than to port-and-maintain stuff that already works well there.
Even in environments where Maui can render straight to a frame buffer without needing Skia as an intermediary, can point Skia at the same frame buffer, let Skg.Skia work as-is. Or am I missing something?
My two cents.
I like Skia - nicer API to work with. Possible major advantage of Maui.Graphics is the lack of need to deploy a 5MB library to user systems. For web this seems critical to me: with good linking/AOT, Skia could easily dominate download size of dotnet wasm apps in future. But not completely sure - maybe it's possible to deploy SkiaSharp to web without deploying Skia, when using a browser which has Skia integrated?
Good point.
Is this still the best way to go about rendering an SVG image directly onto a MAUI GraphicsView
? Other possibilities, and potential ongoing work, were mentioned in the thread.
Over a half year later, is Svg.Skia still the best way to go? Or, is something in the MS ecosystem evolving to displace it?
Also, @wieslawsoltes, is there any code-behind that accompanies your most recent post? If so, can you share it? Thanks.
It seems to me that this is currently the best solution for using SVG's in MAUI views. @wieslawsoltes, Could you share the code of how you were able to do this in MAUI? What does SvgDrawable look like? I don't understand how you are using Svg.Skia, are you still using IDrawable?
@techfan101 @DclearEE were you able to get access to the rest of the code for the SvgDrawable?
@techfan101 @DclearEE were you able to get access to the rest of the code for the SvgDrawable?
I ended up using SkiaSharp to do everything with SVGs. Using Skia was similar to Maui.graphics but it had more capabilities. I also switched to using the Uno Platform to build my app instead of Maui. I haven’t revisited Maui or its graphics library since.