| ThorVG v0.1

Macros | Functions
Initializer
ThorVG_CAPI (BETA version)

A module enabling initialization and termination of the TVG engines. More...

Collaboration diagram for Initializer:

## Macros
#define | TVG_ENGINE_SW (1 << 1)
#define | TVG_ENGINE_GL (1 << 2)

## Functions
TVG_EXPORT Tvg_Result | tvg_engine_init (unsigned engine_method, unsigned threads)
| Initializes TVG engines. More...
TVG_EXPORT Tvg_Result | tvg_engine_term (unsigned engine_method)
| Terminates TVG engines. More...

## Detailed Description

A module enabling initialization and termination of the TVG engines.

## Macro Definition Documentation

## ◆ TVG_ENGINE_GL

#define TVG_ENGINE_GL (1 << 2)

OpenGL raster engine type.

## ◆ TVG_ENGINE_SW

#define TVG_ENGINE_SW (1 << 1)

CPU raster engine type.

## Function Documentation

## ◆ tvg_engine_init()

TVG_EXPORT Tvg_Result tvg_engine_init | ( | unsigned | engine_method,
|  | unsigned | threads
| ) |  |

Initializes TVG engines.

It must be called before any other function, at the beginning of the TVG client.

tvg_engine_init(TVG_ENGINE_SW, 0); //Initialize software renderer and use the main thread only

Parameters

  [in] | engine_method | The engine types TVG_ENGINE_SW: CPU rasterizer TVG_ENGINE_GL: OpenGL rasterizer (not supported yet)
  [in] | threads | The number of additional threads used to perform rendering. Zero indicates only the main thread is to be used.

Returns
  Tvg_Result enumeration.

Return values

  TVG_RESULT_SUCCESS | Succeed.
  TVG_RESULT_INSUFFICIENT_CONDITION | An internal error possibly with memory allocation.
  TVG_RESULT_INVALID_ARGUMENT | Unknown engine type.
  TVG_RESULT_NOT_SUPPORTED | Unsupported engine type.
  TVG_RESULT_UNKNOWN | Other error.

Note
  For multiple backeneds bitwise operation on the engine types is allowed.

See also
  tvg_engine_term()
  TVG_ENGINE_SW, TVG_ENGINE_GL

## ◆ tvg_engine_term()

TVG_EXPORT Tvg_Result tvg_engine_term | ( | unsigned | engine_method | ) |

Terminates TVG engines.

It should be called in case of termination of the TVG client with the same engine types as were passed when tvg_engine_init() was called.

tvg_engine_init(TVG_ENGINE_SW, 0);
//define canvas and shapes, update shapes, general rendering calls
tvg_engine_term(TVG_ENGINE_SW);

Parameters

  engine_method | renderer type TVG_ENGINE_SW: CPU rasterizer TVG_ENGINE_GL: OpenGL rasterizer (not supported yet)

Returns
  Tvg_Result enumeration.

Return values

  TVG_RESULT_SUCCESS | Succeed.
  TVG_RESULT_INSUFFICIENT_CONDITION | Multiple function calls.
  TVG_RESULT_INVALID_ARGUMENT | Unknown engine type.
  TVG_RESULT_NOT_SUPPORTED | Unsupported engine type.
  TVG_RESULT_UNKNOWN | An internal error.

See also
  tvg_engine_init()
  TVG_ENGINE_SW, TVG_ENGINE_GL