ThorVG v1.0
Loading...
Searching...
No Matches
Initializerfinal

A class that enables initialization and termination of the TVG engines. More...

#include <thorvg.h>

Static Public Member Functions

static Result init (uint32_t threads=0) noexcept
 Initializes the ThorVG engine runtime.
 
static Result term () noexcept
 Terminates the ThorVG engine.
 
static const char * version (uint32_t *major, uint32_t *minor, uint32_t *micro) noexcept
 Retrieves the version of the TVG engine.
 

Detailed Description

A class that enables initialization and termination of the TVG engines.

Member Function Documentation

◆ init()

static Result init ( uint32_t  threads = 0)
staticnoexcept

Initializes the ThorVG engine runtime.

ThorVG requires an active runtime environment for rendering operations. This function sets up an internal task scheduler and creates a specified number of worker threads to enable parallel rendering.

Parameters
[in]threadsThe number of worker threads to launch. A value of 0 indicates that only the main thread will be used.
Returns
Result indicating success or failure of initialization.
Note
This function uses internal reference counting to allow multiple init() calls. However, the number of threads is fixed during the first successful initialization and cannot be changed in subsequent calls.
See also
Initializer::term()

◆ term()

static Result term ( )
staticnoexcept

Terminates the ThorVG engine.

Cleans up resources and stops any internal threads initialized by init().

Return values
Result::InsufficientConditionReturned if there is nothing to terminate (e.g., init() was not called).
Note
The initializer maintains a reference count for safe repeated use. Only the final call to term() will fully shut down the engine.
See also
Initializer::init()

◆ version()

static const char * version ( uint32_t *  major,
uint32_t *  minor,
uint32_t *  micro 
)
staticnoexcept

Retrieves the version of the TVG engine.

Parameters
[out]majorA major version number.
[out]minorA minor version number.
[out]microA micro version number.
Returns
The version of the engine in the format major.minor.micro, or a nullptr in case of an internal error.
Since
0.15