Thor Vector Graphics is a production-ready vector graphics engine designed for creating interactive apps and creative tools. It combines high performance with lightweight efficiency, as Thor embodies a dual meaning—symbolizing both immense strength and lightning-fast agility. Embracing the philosophy of simplicity leads to reliability, the ThorVG project provides easy, user-friendly interfaces while maintaining a compact footprint and minimal overhead.
The following primitives are supported by ThorVG:
ThorVG is designed for a wide range of programs, offering adaptability for integration and use in various applications and systems. It achieves this through a single binary with selectively buildable, modular components in a building block style. This ensures both optimal size and easy maintenance.
The core library of ThorVG maintains a binary size of approximately 170KB. This is significantly smaller compared to graphics engines designed primarily for desktop environments and offers the following advantages.
ThorVG is based on the C++ standard and provides consistent functionality across various platforms through an abstraction layer that minimizes dependence on specific operating systems or hardware.
If your program includes the main renderer, you can seamlessly utilize ThorVG APIs by transitioning drawing contexts between the main renderer and ThorVG. Throughout these API calls, ThorVG effectively serializes drawing commands among volatile paint nodes. Subsequently, it undertakes synchronous or asynchronous rendering via its render-backend engines. Additionally, ThorVG is adept at handling vector images, including formats like SVG and Lottie, and it remains adaptable for accommodating additional popular formats as needed. In the rendering process, the library may generate intermediate frame buffers for scene compositing, though only when essential. The accompanying diagram provides a concise overview of how to effectively incorporate ThorVG within your system.
ThorVG is optimized for CPU-based rasterization, with a strong focus on vector rendering in environments where GPU resources are limited, unavailable, or intentionally avoided. In representative CPU benchmarks, ThorVG demonstrates an average of ~2.9× faster performance to a widely-used vector graphics engine across common vector rendering workloads. The advantage is particularly clear in geometry-heavy scenarios such as rectangles, strokes, rotations, and circle rendering.
ThorVG incorporates a threading mechanism designed to seamlessly retrieve upcoming scenes without unnecessary delays. It utilizes a finely-tuned task scheduler based on thread pools to handle a variety of tasks, including encoding, decoding, updating, and rendering. This architecture ensures efficient use of multi-core processing.
The task scheduler is carefully designed to abstract complexity, simplify integration, and enhance user convenience. Its use is optional, allowing users to adopt it based on their specific needs.
ThorVG supports smart partial rendering, which enables more efficient rendering workflows by updating only the portions of a vector scene that have changed. By internally tracking modified regions, it minimizes unnecessary redraws and optimizes overall performance. This feature provides significant benefits in scenarios such as UI rendering, design tools, or applications where large parts of the scene remain static and only small elements update between frames. In such cases, avoiding full-scene rendering can greatly reduce computational workload and improve energy efficiency—making it particularly valuable on mobile and embedded systems.
The following figure illustrates the geometry changes and highlights the minimal redraw region (outlined in red) that needs to be updated. Only the modified area between the previous and current frames is selectively redrawn, significantly improving performance.
Please note that in highly dynamic content—such as fast-paced games or full-screen animations where nearly all objects change every frame—partial rendering provides little to no benefit and may even introduce minor overhead. In these scenarios, full-scene rendering is typically the better choice. For a practical showcase, visit this page demonstrating a performance comparison of partial rendering using ThorVG's software renderer.
Today, ThorVG provides its own implementation of multiple rendering backends, allowing you to choose the one that best suits your application and target platform.
ThorVG is particularly ahead of the curve in the web ecosystem. WebGPU introduces a next-generation graphics API comparable to Vulkan, providing low-overhead GPU access and modern graphics capabilities. This enables more aggressive optimization strategies while preserving feature parity with other ThorVG backends. All vector rendering features are fully supported on the WebGPU backend, ensuring a consistent rendering experience across platforms.
Beyond feature completeness, the WebGPU backend also delivers substantial performance improvements over the OpenGL backend in many rendering workloads. Internal benchmarks show up an average of approximately 1.8× higher rendering throughput, with the largest gains observed in stroke rendering, gradients, and image rendering. Even for general vector rendering, WebGPU consistently maintains higher performance while producing identical visual output.
[!NOTE] Benchmark results were obtained using ThorVG's benchmark application on Apple M1. Actual performance may vary depending on the hardware, operating system, graphics driver, and rendering workload.
Furthermore, by abstracting native graphics APIs such as Metal, Vulkan, and DirectX through WebGPU, ThorVG provides a single rendering interface that seamlessly scales across desktop, mobile, and web environments. This architecture allows applications to benefit from modern GPU capabilities without requiring platform-specific rendering code.
ThorVG is designed to be portable across a wide range of devices, including small IoT devices, embedded systems, mobile platforms, game consoles, desktop environments, and the web. It is actively under development, with continuous efforts to expand support for essential platforms as needed. Currently, the major supported platforms include:
This section details the steps required to configure the environment for installing ThorVG.
ThorVG supports meson build system. Install meson and ninja if you don't have them already.
Run meson to configure ThorVG in the thorvg root folder.
meson setup builddir
Run ninja to build & install ThorVG:
ninja -C builddir install
Regardless of the installation, all build results (symbols, executable) are generated in the builddir folder in thorvg. Some results such as examples won't be installed, you can check More examples section to see how to change it.
Note that some systems might include ThorVG package as a default component. In that case, you can skip this manual installation.
If you want to create Visual Studio project files, use the command --backend=vs. The resulting solution file thorvg.sln will be located in the build folder.
meson setup builddir --backend=vs
If you want to create Xcode project files, use the command --backend=xcode. The resulting solution file thorvg.xcodeproj will be located in the build folder.
meson setup builddir --backend=xcode
ThorVG renders vector shapes to a given canvas buffer. The following is a quick start to show you how to use the essential APIs.
First, you should initialize the ThorVG engine:
tvg::Initializer::init(4); //4 threads
Then it would be best if you prepared an empty canvas for drawing on it:
static uint32_t buffer[WIDTH * HEIGHT]; //canvas target buffer
auto canvas = tvg::SwCanvas::gen(); //generate a canvas
canvas->target(buffer, WIDTH, WIDTH, HEIGHT, tvg::ColorSpace::ARGB8888); //buffer, stride, w, h, Colorspace
Next you can draw multiple shapes on the canvas:
auto rect = tvg::Shape::gen(); //generate a shape
rect->appendRect(50, 50, 200, 200, 20, 20); //define it as a rounded rectangle (x, y, w, h, rx, ry)
rect->fill(100, 100, 100); //set its color (r, g, b)
canvas->add(rect); //add the rectangle to the canvas
auto circle = tvg::Shape::gen(); //generate a shape
circle->appendCircle(400, 400, 100, 100); //define it as a circle (cx, cy, rx, ry)
auto fill = tvg::RadialGradient::gen(); //generate a radial gradient
fill->radial(400, 400, 150, 400, 400, 0); //set the radial gradient geometry info (cx, cy, radius, fx, fy, fr)
tvg::Fill::ColorStop colorStops[2]; //gradient colors
colorStops[0] = {0.0, 255, 255, 255, 255}; //1st color values (offset, r, g, b, a)
colorStops[1] = {1.0, 0, 0, 0, 255}; //2nd color values (offset, r, g, b, a)
fill->colorStops(colorStops, 2); //set the gradient colors info
circle->fill(fill); //set the circle fill
canvas->add(circle); //add the circle to the canvas
This code generates the following result:
You can also draw you own shapes and use dashed stroking:
auto path = tvg::Shape::gen(); //generate a path
path->moveTo(199, 34); //set sequential path coordinates
path->lineTo(253, 143);
path->lineTo(374, 160);
path->lineTo(287, 244);
path->lineTo(307, 365);
path->lineTo(199, 309);
path->lineTo(97, 365);
path->lineTo(112, 245);
path->lineTo(26, 161);
path->lineTo(146, 143);
path->close();
path->fill(150, 150, 255); //path color
path->strokeWidth(3); //stroke width
path->strokeFill(0, 0, 255); //stroke color
path->strokeJoin(tvg::StrokeJoin::Round); //stroke join style
path->strokeCap(tvg::StrokeCap::Round); //stroke cap style
float pattern[2] = {10, 10}; //stroke dash pattern (line, gap)
path->strokeDash(pattern, 2); //set the stroke pattern
canvas->add(path); //add the path to the canvas
The code generates the following result:
Now begin rendering & finish it at a particular time:
canvas->draw();
canvas->sync();
Then you can acquire the rendered image from the buffer memory.
Lastly, terminate the engine after its usage:
tvg::Initializer::term();
ThorVG facilitates SVG Tiny Specification rendering via its dedicated SVG interpreter. Adhering to the SVG Tiny Specification, the implementation maintains a lightweight profile, rendering it particularly advantageous for embedded systems. While ThorVG comprehensively adheres to most of the SVG Tiny specs, certain features remain unsupported within the current framework. These include:
The figure below highlights ThorVG's SVG rendering capabilities:
The following code snippet shows how to draw SVG image using ThorVG:
auto picture = tvg::Picture::gen(); //generate a picture
picture->load("tiger.svg"); //load a SVG file
canvas->add(picture); //add the picture to the canvas
The result is:
ThorVG supports a wide range of Lottie animation features. Lottie is an industry-standard, JSON-based vector animation format that enables animations to be distributed seamlessly across platforms, much like static assets. Lottie files are compact, compatible with a wide range of devices, and can be scaled without pixelation. The format also makes it easy to create, edit, test, collaborate on, and distribute animations. For more information, visit the Lottie Animation Community website.
Please check out the ThorVG Test to explore the performance of various Lottie animations powered by ThorVG. For frontend developement, you can also install ThorVG Lottie Player npm package.
ThorVG offers flexibility in configuring its binary. In addition to serving as a general-purpose graphics engine, it can be built as a compact Lottie animation playback library using specific build options:
$meson setup builddir -Dloaders="lottie, ..."
Alternatively, enable all loaders available for Lottie:
$meson setup builddir -Dloaders="all"
The following example demonstrates how to play a Lottie animation with ThorVG:
auto animation = tvg::Animation::gen(); //generate an animation
auto picture = animation->picture(); //acquire a picture which associated with the animation.
picture->load("lottie.json"); //load a Lottie file
auto duration = animation->duration(); //figure out the animation duration time in seconds.
canvas->add(picture); //add the picture to the canvas
First, create an animation and retrieve its associated picture. Load the Lottie file (lottie.json) into the picture, and then add the picture to the canvas. Use the animation object to control the frames during playback. You can also retrieve the animation duration when implementing the playback loop.
animation->frame(animation->totalFrame() * progress); //Set a current animation frame to display
The progress variable represents the animation position, ranging from 0 to 1 over its total duration. Adjust it to display the animation at the desired position, and then update the canvas to redraw the corresponding frame.
ThorVG supports Lottie Expressions, enabling small JavaScript snippets to dynamically control animated properties. This unlocks advanced capabilities such as interactivity, dynamic theming, and context-aware animation behavior. However, expressions are not currently part of the official Lottie specification and may increase binary size or affect performance, especially on resource-constrained devices. ThorVG therefore disables expression support by default; enable it explicitly with the extra build option when required:
$meson setup builddir -Dloaders="lottie, ..." -Dextra="lottie_exp, ..."
Camtasia adopted ThorVG for Lottie rendering, enabling customizable animations and dynamic color adjustments.
Canva adopted ThorVG for Lottie rendering on iOS, delivering up to 80% faster rendering and 70% lower peak memory usage.
dotLottie is an open-source format for packaging Lottie animations and assets. Its player uses ThorVG for efficient rendering.
Espressif Systems provides ThorVG as an official ESP-IDF component for ESP32 and ESP32-P4 vector graphics.
Godot integrates ThorVG to enable high-quality vector-based UI and assets in its open-source game engine.
Lottie Creator leverages ThorVG to power its Canvas engine with fast, scalable vector rendering for interactive animations.
LVGL is an open-source graphics library leveraging ThorVG as its vector drawing primitives library for embedded systems.
SEGGER uses ThorVG as a GPU driver for high-performance vector rendering in embedded GUIs.
Tizen, an open-source platform integrating ThorVG as its vector graphics backend for rendering primitives, SVG, and Lottie animations.
Would you like us to showcase your project with ThorVG? Feel free to open an issue or submit a pull request!
Check out Thor Janitor, an interactive demo game fully rendered using ThorVG. It renders tens of thousands of objects in real-time with effects like DropShadow and Blur, running stably at 120+ FPS! Give it a try!
A wide range of native sample codes is available in the thorvg.example repository to help you understand and work with the ThorVG C++ APIs.
The ThorVG Playground is an interactive web-based environment where you can explore various graphic features and instantly see the results in real time.
ThorVG view is an interactive web tool for testing and validating vector and motion graphics assets with ThorVG. It provides a quick way to verify how standard formats such as SVG and Lottie are parsed, rendered, and animated by the engine.
Powered by ThorVG WebAssembly, assets are rendered directly in the browser with no server-side processing, making it useful for compatibility testing, visual inspection, debugging, and experimenting with asset behavior in real time.
A Visual Studio Code extension that integrates ThorVG View for previewing Lottie animations and SVG files directly inside the editor.
CLI Tools provides lightweight command-line tools, including svg2png for converting SVG files to PNG images and lottie2gif for converting Lottie animations to animated GIFs.
ThorVG is designed to be portable and extensible across various platforms. The following projects integrate ThorVG into specific environments or tools:
Our main development APIs are written in C++, but ThorVG also provides API bindings for C.
To enable CAPI binding, you need to activate this feature in the build options:
meson setup builddir -Dbindings="capi"
The ThorVG API documentation is available at thorvg.org/apis, and can also be found directly in this repository via the C++ API and C API.
For comprehensive and well-structured technical information, please visit the DeepWiki, which offers in-depth guidance on ThorVG's architecture, features, and usage.
ThorVG provides flexible image loading capabilities, supporting both static and external loaders. This design ensures that even in environments lacking external libraries, users can rely on built-in static loaders for core functionality. At its core, the ThorVG library is fully self-contained and operates without mandatory external dependencies. However, several optional feature extensions are available, each with its own set of dependencies.
The following outlines the dependencies for these optional features:
ThorVG stands as a purely open-source initiative. We are grateful to the individuals, organizations, and companies that have contributed to the development of the ThorVG project. The dedicated efforts of the individuals and entities listed below have enabled ThorVG to reach its current state.
Corporate partners collaborate with ThorVG through development, integration, and strategic initiatives that help advance the project.
If you’re interested in partnering with ThorVG, we’d love to hear from you. Please reach out at thorvg@thorvg.org
We sincerely thank all of our sponsors, past and present, whose financial support has helped shape the evolution of ThorVG. Your generosity is more than a contribution—it is an investment in a high-performance, accessible graphics engine built for real-world production.
For real-time conversations and discussions, please join us on Discord
A production-ready C++ vector graphics engine supporting SVG and Lottie formats, featuring advanced rendering backends such as WebGPU for high-performance graphics.
@thorvg/thorvg