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:

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

  • Filling: Solid Colors, Linear & Radial Gradients and Texture Mapping

  • Stroking: Width, Join, Cap, Dash Patterns

  • Scene Graph & Transformations

  • Composition: Blending, Masking, Path Clipping

  • Text: Unicode Characters and Horizontal Text Layout using the Scalable Fonts (TTF)

  • Images: TVG, SVG, JPG, PNG, WebP, Raw Bitmap

  • Animation: Lottie

anti-aliased_shapes.png

Anti-aliased Shapes

path-clipping.png

Path-Clipping

blending.png

Blending

gradient_filling.png

Gradient Filling

svg.png

SVG

texturing.png

Texturing

stroking.png

Stroking

masking.png

Masking

text.png

Text

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

iOS

Android

Web

Structural Design

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 maintanence.

example_structure.png

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.png

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 supports Lottie animations. Although most features are supported, some advanced properties of Lottie may not be available yet:

  • Shape Modifiers

  • 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

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.png

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.

In Practice

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

dotLottie

dotLottie is an open-source file format that aggregates one or more Lottie files and their associated resources, such as images and fonts, into a single file. This enables an efficient and easy distribution of animations. dotLottie files are ZIP archives compressed with the Deflate compression method and carry the file extension of “.lottie”. Think of it as a superset of Lottie. LottieFiles aims to achieve just that. dotLottie player by LottieFiles is now powered by ThorVG.

example_dotlottie_edited.jpg

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

LVGL

LVGL is the most popular free and open-source embedded graphics library to create beautiful UIs for any MCU, MPU and display type.  The complete graphic framework includes a variety of widgets for you to use in the creation of your GUI, and supports more advanced functions such as animations and anti-aliasing. ThorVG serves as the vector drawing primitives library in the LVGL framework. 

example_lvgl.png

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

Contributors

ThorVG stands as a purely open-source initiatives. 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.

bottom of page