XUtils

ThorVG

a platform-independent portable library that allows for drawing vector-based scenes and animations, including SVG and Lottie. [MIT] [website](https://www.thorvg.org/)


Build with Visual Studio

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

Install with vcpkg

You can download and install pre-packaged ThorVG using the vcpkg package manager.

Clone the vcpkg repo. Make sure you are in the directory you want the tool installed to before doing this.

git clone https://github.com/Microsoft/vcpkg.git

Run the bootstrap script to build the vcpkg.

./bootstrap-vcpkg.sh

Install the ThorVG package.

./vcpkg install thorvg

Install with Conan

You can download and install pre-packaged ThorVG using the Conan package manager.

Follow the instructions on this page on how to set up Conan.

Install the ThorVG package:

conan install --requires="thorvg/[*]" --build=missing

Install with MSYS2

You can download and install pre-packaged ThorVG using the MSYS2 package manager.

Download and execute the MSYS2 installer on the web page above and follow the steps. When done, just launch one of the terminals in the start menu, according to the architecture and compiler you want (either 32 or 64 bits, with MSVCRT or UCRT library). Then you can install the ThorVG package :

pacman -S thorvg

To update to a newer release (and update all the packages, which is preferable), run :

pacman -Syu

Back to contents

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.

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.

Back to contents

In Practice

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.

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.

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.

Back to contents

Documentation

The ThorVG API documentation can be accessed at thorvg.org/apis, and is also available in the C++ API, C API within this repository.

Back to contents

Tools

API Bindings

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"

Back to contents

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.

Back to contents

Communication

For real-time conversations and discussions, please join us on Discord

Back to contents


Articles

  • coming soon...