ThorVG Example
August 29, 2026 ยท View on GitHub
ThorVG Example
ThorVG Example provides a wide range of example codes. Those examples demonstrate how to use ThorVG's APIs to render vector graphics, handle images, and play animations. Each example is designed to highlight specific features and help developers get started quickly with ThorVG.
How To
This section details the steps required to configure the environment for installing ThorVG Example. Please note that ThorVG and SDL must be installed on your system before building the examples.
Build
ThorVG Example supports Meson build system. Install meson and ninja if you don't have them already.
Run Meson to configure ThorVG Example in the project root folder.
meson setup builddir
Run ninja to build
ninja -C builddir
Run
Once the build is complete, you can run each example binary directly from the builddir folder.
To run an example with the GL or WebGPU engine, pass -e gl or -e wg as a command-line argument. By default, the examples run with the cpu rendering engine.
./builddir/src/Shapes # Runs with Software (default)
./builddir/src/Shapes -e gl # Runs with OpenGL/ES
./builddir/src/Shapes -e wg # Runs with WebGPU
./builddir/src/Shapes -r 1200x1200 # Runs with a 1200x1200 window
./builddir/src/Picture -i <input_path> # Loads and renders the given asset
Options can be combined when applicable:
./builddir/src/Animation -e wg -r 1200x1200 -i ./sample.json
This runs the Animation example using the WebGPU engine with a 1200x1200 window and the specified input asset.