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.
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.
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
Once the build is complete, you can run each example binary directly from the builddir folder.
To run an example with the GL or WGPU engine, pass 'gl' or 'wg' as a command-line argument. By default, the examples run with the software rendering engine.
./builddir/src/Shapes gl # Runs with OpenGL/ES
./builddir/src/Shapes wg # Runs with WebGPU
./builddir/src/Shapes # Runs with Software (default)