Skia backend for resvg

resvg backend implementation using the [Skia] library.

Build

The Skia build process is not trivial, therefore we are not building it automatically. A caller should built it manually and set corespondent environment variables:

Also, Skia doesn't have a stable API, therefore we can support only a fixed version. Right now it is m76.

on Windows using MSVC

Install:

SKIA_DIR should point to a Skia directory that contains the Skia include directory. SKIA_LIB_DIR should point to a Skia directory that contains skia.dll.

Build using x64 Native Tools Command Prompt for VS 2017 shell:

```batch set PATH=%userprofile%.cargo\bin;%PATH% set SKIADIR=path set SKIALIBDIR=path rustup.exe default stable-x8664-pc-windows-msvc

cargo.exe build --release ```

on Linux

We assume that you have already built Skia itself.

Install harfbuzz using your distributive's package manager.

On Ubuntu you can install it via:

sh sudo apt install libharfbuzz-dev

Build resvg:

sh SKIA_DIR=path SKIA_LIB_DIR=path cargo build --release

on macOS

We assume that you have already built Skia itself.

sh SKIA_DIR=path SKIA_LIB_DIR=path cargo build --release

Runtime dependencies

resvg-skia depends only on Skia itself.

On Linux, harfbuzz is also required.

Running resvg CLI

sh cargo run --release -- in.svg out.png

The resulting binary can be found at: target/release/resvg-skia

Running examples

A simple SVG to PNG converter:

sh cargo run --example minimal -- in.svg out.png

Render image using a manually constructed SVG render tree:

sh cargo run --example custom_rtree

Draw bounding boxes around all shapes on input SVG:

sh cargo run --example draw_bboxes -- bboxes.svg bboxes.png -z 4

License

MPLv2.0.