MonoAGS: Choosing between ImageSharp and SkiaSharp

Started by tzachs, Mon 14/05/2018 17:05:19

Previous topic - Next topic

tzachs

I wanted to share a dilemma I'm having and maybe get some feedback. It's about which library to choose for loading/manipulating bitmaps, vector drawing on bitmaps and text rendering.
Currently we're using GDI+ on desktop and native APIs on mobile.
Reasons I want to move:
1. Be able to share code between desktop and mobile.
2. GDI+ has been a little buggy in the past, and it's single threaded only.
3. The real deal breaker, though, is loading custom fonts (i.e fonts that are not installed on the system). It seems to be completely broken. It used to work on Windows but not work on Mac and Linux, but now it stopped working on Windows too, and I have no idea why. On Linux & Mac I can do an ugly workaround by installing the fonts and restarting the game, but on Windows I can't even do that unless the application runs with elevated permissions, and I don't want to force people running the game as administrator. And it becomes urgent to move now, as I want to use font awesome for icons in the editor and I don't want to force people to install the font.

Both ImageSharp and SkiaSharp claim to be fully cross-platform and appear to support loading custom fonts and be able to run concurrently, so all of those should be solved (well, we'll need to test).
ImageSharp is a fully managed solution and community based, while SkiaSharp is a managed wrapper around Skia -> Skia is used by Google Chrome and developed by Google and SkiaSharp is sponsored by Microsoft.

Differences between the 2 libraries:
1. ImageSharp being a fully managed solution will be easier to debug if something goes wrong, probably be more portable because one less dependency (although skia is also probably very portable if used by chrome) and easier to deploy, and easier for us to contribute to if we need to make changes (and is more popular among developers, maybe for that reason).
2. SkiaSharp is faster than ImageSharp, and it allows in theory to have hardware-accelerated text rendering (in practice, I haven't actually managed to get it to work, and even if I did, as we want to also attempt moving to Veldrid we won't be OpenGL only anymore so we might not be able to use this feature anyway), and it also supports SVG rendering via an extension which ImageSharp does not currently support.

Thoughts?

cat

Is speed important? Of course, people abuse AGS for lots of stuff, but the main objective are 2D adventure games. SVG would be neat, though...
I'd choose the library that is easier to use and has the longer expected lifetime and support.

tzachs

I think speed is still relevant, if SkiaSharp loads images from file faster, it means less waiting time until your game starts, or when switching rooms, etc (though I'm not sure how big is the performance difference on practice). And yeah, svg support is something I really want to have (there is some hope that ImageSharp would be able to work with svg in the future but it's not a guarantee).
As for ease of use, ImageSharp is the winner, though (and they are tied regarding expected lifetime and support, they are both in very active development and popular).

SMF spam blocked by CleanTalk