# ThorVG: Initializer

Initializerfinal
ThorVG

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

## Static Public Member Functions

static Result | init (CanvasEngine engine, uint32_t threads) noexcept
| Initializes TVG engines. More...
static Result | term (CanvasEngine engine) noexcept
| Terminates TVG engines. More...
static const char * | version (uint32_t *major, uint32_t *minor, uint32_t *micro) noexcept
| Retrieves the version of the TVG engine. More...

## Detailed Description

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

## Member Function Documentation

## init()

static Result init | ( | CanvasEngine | engine,
|  | uint32_t | threads
| ) |  |

staticnoexcept

Initializes TVG engines.

TVG requires the running-engine environment. TVG runs its own task-scheduler for parallelizing rendering tasks efficiently. You can indicate the number of threads, the count of which is designated `threads`. In the initialization step, TVG will generate/spawn the threads as set by `threads` count.

Parameters

  [in] | engine | The engine types to initialize. This is relative to the Canvas types, in which it will be used. For multiple backends bitwise operation is allowed.
  [in] | threads | The number of additional threads. Zero indicates only the main thread is to be used.

Return values

  Result::NonSupport | In case the engine type is not supported on the system.

Note
  The Initializer keeps track of the number of times it was called. Threads count is fixed at the first init() call.

See also
  Initializer::term()

## term()

static Result term | ( | CanvasEngine | engine | ) |

staticnoexcept

Terminates TVG engines.

Parameters

  [in] | engine | The engine types to terminate. This is relative to the Canvas types, in which it will be used. For multiple backends bitwise operation is allowed

Return values

  Result::InsufficientCondition | In case there is nothing to be terminated.
  Result::NonSupport | In case the engine type is not supported on the system.

Note
  Initializer does own reference counting for multiple calls.

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] | major | A major version number.
  [out] | minor | A minor version number.
  [out] | micro | A 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