resvg
backend implementation using the [Skia] library.
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:
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
.Also, Skia doesn't have a stable API, therefore we can support only a fixed version. Right now it is m76.
Install:
stable-x86_64-pc-windows-msvc
[Rust] target.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 ```
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
We assume that you have already built Skia itself.
sh
SKIA_DIR=path SKIA_LIB_DIR=path cargo build --release
resvg-skia
depends only on Skia itself.
On Linux, harfbuzz
is also required.
sh
cargo run --release -- in.svg out.png
The resulting binary can be found at: target/release/resvg-skia
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