Hacker News new | ask | show | jobs
by royjacobs 2636 days ago
This is very interesting. Especially since other vector engines are either unmaintained (like Antigrain) or extremely hard to build (Skia, Cairo).

I do wonder if these kind of libraries shouldn't be supplanted by hardware accelerated rendering, though.

4 comments

> are either unmaintained (like Antigrain)

The author of Antigrain passed away a few years back, sadly.

It was and still probably is one of the best graphics libraries out there, and he was really hoping for a time when antialias-free, vector-based UI on high-pixel-density screens would become reality.

[1] Announcement in Russian: https://rsdn.org/forum/life/5377743.flat

"Maxim Shemanarev 1966-2013. Tragically, unexpectedly passed away in his home at 47." The discussion that follows names epileptic seizure as the cause of death.

[2] For example, this glorious text on text rasterization from 2007 http://www.antigrain.com/research/font_rasterization/index.h...

Skia is actually not too hard to build once you're used to gn and ninja. Download both of those tools and add them to your PATH, then cd into Skia's repo (that you just cloned):

    $ python tools/git-sync-deps
    $ gn gen out/release -args="is_official_build=true is_component_build=false"
    $ ninja -C out/release
This will build it as a static library. I believe by default it will try to use system libraries, you can make it use its own version of those libraries in this slightly more complicated process (which could be done with a script but I'm too lazy to write one right now):

    $ gn args out/release --list --short
This will print all the current build arguments, copy all the use_system_XXX = true, you'll have to modify those to be = false, and paste them into the text editor that will open once you run:

    $ gn args out/release
After that, run ninja to build

    $ ninja -C out/release
For the include files, you have to add at least these to your include directory:

    include
    include/config
    include/core
    include/effects
    include/gpu
On Windows, you might want to have two builds linking against different versions of the std lib (because of the whole iterator debug level stuff). Add these args: extra_cflags=["/MTd"] and extra_cflags=["/MT"] for debug/release builds (statically linked in this case).
Skia is not so terrible, you just have to use their slightly obscure build tool. And it produces >8GB build artefacts with ~50 or more dependencies... Come to think of it is a bit of a nightmare.
I tried to use it a few times, but having to configure a Google build environment, without Google class workstations, meant I always gave up in the process and used Skia.Sharp instead.
I explained how to build it here, give it a try: https://news.ycombinator.com/item?id=19586159
Thanks for the heads up, but doing it across Windows/UWP, Android and iOS requires a bit more of effort than what you described, hence Skia.Sharp instead.
I'm doing exactly that though. To compile for iOS for example, create a separate output directory with `target_os="ios" target_cpu="arm64"`. You can see a few more examples here https://skia.org/user/build

Unfortunately, C++ libraries are a bit harder to use than other languages, hopefully the modules proposal will make this a lot easier.

Just in case: Skia can be built without Google build environment. For the Sciter (https://sciter.com) I just included all needed files into projects ( MSVC and XCode ). That setup takes some initial time but after that it works as any other library like libpng, etc.
This is what we really need, something that outputs an API agnostic set of render commands, (shaders, uniforms, mesh layouts etc) which auto clip themselves and such, so they can just be integrated across various engines and renderers.

Of course a better format in the first place(mentioned in another comment) would just solve this anyway

This is similar to the approach libraries like ImGui take. They abstract the rendering backend exactly in this way.