ThorVG  v0.1
Macros | Functions

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_methodThe engine types
  • TVG_ENGINE_SW: CPU rasterizer
  • TVG_ENGINE_GL: OpenGL rasterizer (not supported yet)
[in]threadsThe 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_SUCCESSSucceed.
TVG_RESULT_INSUFFICIENT_CONDITIONAn internal error possibly with memory allocation.
TVG_RESULT_INVALID_ARGUMENTUnknown engine type.
TVG_RESULT_NOT_SUPPORTEDUnsupported engine type.
TVG_RESULT_UNKNOWNOther 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.

//define canvas and shapes, update shapes, general rendering calls
Parameters
engine_methodrenderer type
  • TVG_ENGINE_SW: CPU rasterizer
  • TVG_ENGINE_GL: OpenGL rasterizer (not supported yet)
Returns
Tvg_Result enumeration.
Return values
TVG_RESULT_SUCCESSSucceed.
TVG_RESULT_INSUFFICIENT_CONDITIONMultiple function calls.
TVG_RESULT_INVALID_ARGUMENTUnknown engine type.
TVG_RESULT_NOT_SUPPORTEDUnsupported engine type.
TVG_RESULT_UNKNOWNAn internal error.
See also
tvg_engine_init()
TVG_ENGINE_SW, TVG_ENGINE_GL