Introduction to Skia: A Modern 2D Graphics Library – Eduardo Lima, Igalia

Skia is a 2D text, geometries and images library in C++. It focuses on accuracy (i.e. on screen looks exactly the same as in PDF) rather than performance at the cost of quality. It’s BSD licensed (originally proprietary, until bought by Google). Its backends are software rastering, GL/GLES, PDF (poppler), XPS (MS document specification)

Why yet another 2D library (next to cairo, QPainter, OS-specific solutions). Android support is a major selling point. That’s why it’s used by Chrome/ium and Firefox(OS) => 1.5 million users. Since it’s backed by Google and has so many users, it’s well resourced and future safe. Even though it’s corporate-owned it is community- and contribution-friendly.

Architecture: Simple high-level API, on top of device independent abstraction classes for generic operations, on top of the device-specific classes on top of backends. The rendering backend is decided at compile time.

High level API: SkCanvas handle; SkPaint with the styling info (you can have several in parallel, it is passed with every drawing call => simpler than e.g. QPainter).

SkPicture & SkPicturePlayback allow to capture and replay the drawing operations. They are stored in a very efficient binary format, can be used to pass info between processes or to reuse several times.

It also has advanced animation and blending functionalities, cfr. on Android. Of course also anti-aliasing, sub-pixel text rendering.

OpenGL(ES) backend is called Ganesh. Having this as a backend allows to use a lot of features that give good performance, moving most of the work to the GPU. Unfortunately, on mobile, the GLES driver quality is often not so good and it has quirks – so Chrome on Android actually uses the rastering backend. There are good Skia tools to evaluate performance: Skia-telemetry, But there are no public benchmarks comparing Skia against cairo etc.

Contribution process is a bit like Qt’s, in the sense that it is review-driven and has well-defined roles of who can do what.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s