top of page

About ThorVG

ThorVG is an open-source graphics library designed for creating vector-based scenes and animations. Embracing the philosophy of "Simpler is better," the ThorVG project offers intuitive and user-friendly interfaces, all the while maintaining a compact size and minimal software complexity.

The following list shows primitives that are supported by ThorVG:

  • Shape: Line, Arc, Curve, Path, Polygon

  • Filling: Solid & Gradients and Texture Mapping

  • Scene Graph & Affine Transformation (translation, rotation, scale, ...)

  • Stroking: Width, Join, Cap, Dash

  • Composition: Blending, Masking, Path Clipping

  • Image: TVG, SVG, JPG, PNG, WebP, Bitmap

  • Animation: Lottie

anti-aliased_shapes.png

Anti-aliased Shapes

svg.png

SVG

gradient_filling.png

Gradient Filling

masking.png

Masking

stroking.png

Stroking

blending.png

Blending

path-clipping.png

Path-Clipping

texturing.png

Texturing

Supported Platforms

ThorVG is currently under development and is expanding its support for essential platforms as needed. The major platforms that ThorVG can be directly integrated with at present include the following:

platforms.png

Linux

MacOS

Windows

Tizen

Basic Strategy

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 backend raster engines.

ThorVG is adept at handling vector images, including formats like SVG, 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.

example_flow.webp

Threading

ThorVG incorporates a threading mechanism that aims to seamlessly acquire subsequent scenes without unnecessary delays. It operates using a finely-tuned task scheduler based on thread pools, encompassing various tasks such as encoding, decoding, updating, and rendering. This design ensures that all tasks can effectively leverage multi-processing capabilities.

The task scheduler has been meticulously crafted to conceal complexity, streamline integration, and enhance user convenience. Therefore, the policy it employs is optional, allowing users to select it based on their specific requirements.

thorvg_threading.webp

SVG

ThorVG facilitates SVG (Scalable Vector Graphics) 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:

  • Animation

  • Fonts & Text

  • Interactivity

  • Multimedia

512px-Ghostscript_Tiger_svg.webp

Ghostscript Tiger using ThorVG

Lottie

ThorVG aims to fully support Lottie Animation features. Lottie is a JSON-based vector animation file format that enables seamless distribution of animations on any platform, akin to shipping static assets. These files are compact and compatible with various devices, scaling up or down without pixelation. With Lottie, you can easily create, edit, test, collaborate, and distribute animations in a user-friendly manner. For more information, please visit LottieFiles' website.

Currently, ThorVG provides experimental support for Lottie Animation, and while most features are supported, a few advanced properties of Lottie may not be available yet:

  • Texts

  • Shape Modifiers (Pucker/Bloat, Twist, Merge, ZigZag)

  • Layer effects

  • Expressions

Lottie animations powered by ThorVG

TVG Picture

ThorVG introduces the dedicated vector data format, known as TVG Picture, designed to efficiently store Paint node properties within a scene in binary form. This format is meticulously optimized in advance, ensuring compact file sizes and swift data loading processes.

To leverage the TVG Picture format, ThorVG employs a specialized module called TVG Saver. This module is responsible for optimizing the data associated with all scene-tree nodes and storing them in binary form. During the optimization phase, TVG Saver intelligently eliminates unused information, eliminates duplicated properties, consolidates overlapping shapes, and employs data compression where feasible. Remarkably, these optimizations maintain compatibility with future versions of ThorVG libraries, with data compression utilizing the Lempel-Ziv-Welchi algorithm when applicable.

As a result of these efforts, the final data size is notably smaller than other text-based vector data formats, such as SVG. This reduction in data size not only minimizes I/O operations but also mitigates memory bandwidth requirements during data loading. This aspect proves particularly beneficial for programs reliant on substantial vector resources.

Furthermore, TVG Picture substantially streamlines resource loading tasks by circumventing the need for data interpretation, resulting in reduced runtime memory demands and rendering tasks that subsequently enhance performance.

By adopting TVG Picture, you can achieve an average reduction of over 30% in data size and loading times (for more details, refer to See More). Notably, the extent of performance improvement is contingent on resource size and complexity.

512px-Ghostscript_Tiger_svg.webp

86,486 → 54,568
(50,622)

tvg2.jpg

8,950 → 1,737
(1,341)

tvg3.jpg

37,319 → 6,575
(6,234)

tvg4_edited.jpg

340,873 → 68,910
(58,017)

Comparison of the file sizes: SVG → TVG (Compressed)

As TVG Saver facilitates the export of the scene-tree into TVG Picture data files (TVG), the subsequent task of importing and restoring this data to programmable instances is efficiently handled by the TVG Loader. For seamless conversion from SVG to TVG, the ThorVG Viewer provides a swift solution.

tvg_format.webp

ThorVG Viewer

ThorVG provides the resource verification tool for the ThorVG Engine. It does immediate rendering via web browser running on the ThorVG web-assembly binary, allowing real-time editing of the vector elements on it. It doesn't upload your resources to any external server while allowing to export to supported formats such as TVG, so the designer resource copyright is protected.

Practices

The following list showcases various practical examples of ThorVG in use.

Tizen

ThorVG has been integrated into the Tizen platform as the vector graphics engine. NUI is the name of Tizen UI framework which is written in C#. ThorVG is the backend engine of the NUI Vector Graphics which is used for vector primitive drawings and scalable image contents such as SVG and Lottie Animation among the Tizen applications.

tizen.png

Godot

ThorVG has been integrated into the Godot project to enable the creation of sleek and visually appealing user interfaces (UIs) and vector resources in the Godot game engine. Godot is a modern game engine that is both free and open-source, offering a comprehensive range of tools. With Godot, you can concentrate on developing your game without the need to recreate existing functionalities.

example_godot.webp

Rive

We're also building a Rive port that supports Rive Animation running through the ThorVG backend. Rive is a brand new animation platform that supports fancy, user interactive vector animations. For more details see Rive-Tizen on Github.

b144cf_6b46b10996d54f07abc689b75527a315~mv2.gif
bottom of page