ThorVG  v0.6
Enumerations | Functions
Initializer

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

Collaboration diagram for Initializer:

Enumerations

enum  Tvg_Engine { TVG_ENGINE_SW = (1 << 1), TVG_ENGINE_GL = (1 << 2) }
 Enumeration specifying the engine type used for the graphics backend. For multiple backends bitwise operation is allowed. More...
 

Functions

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

Detailed Description

A module enabling initialization and termination of the TVG engines.

Enumeration Type Documentation

◆ Tvg_Engine

enum Tvg_Engine

Enumeration specifying the engine type used for the graphics backend. For multiple backends bitwise operation is allowed.

Enumerator
TVG_ENGINE_SW 

CPU rasterizer.

TVG_ENGINE_GL 

OpenGL rasterizer.

Function Documentation

◆ tvg_engine_init()

TVG_EXPORT Tvg_Result tvg_engine_init ( Tvg_Engine  engine_method,
unsigned  threads 
)

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.

tvg_engine_init(TVG_ENGINE_SW, 0); //Initialize software renderer and use the main thread only
Parameters
[in]engine_methodThe engine types to initialize. This is relative to the Canvas types, in which it will be used. For multiple backends bitwise operation is allowed.
  • 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_FAILED_ALLOCATIONAn internal error possibly with memory allocation.
TVG_RESULT_INVALID_ARGUMENTUnknown engine type.
TVG_RESULT_NOT_SUPPORTEDUnsupported engine type.
TVG_RESULT_UNKNOWNOther error.
Note
The Initializer keeps track of the number of times it was called. Threads count is fixed at the first init() call.
See also
tvg_engine_term()
Tvg_Engine

◆ tvg_engine_term()

TVG_EXPORT Tvg_Result tvg_engine_term ( Tvg_Engine  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_methodThe engine types to terminate. This is relative to the Canvas types, in which it will be used. For multiple backends bitwise operation is allowed
  • 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_CONDITIONNothing to be terminated.
TVG_RESULT_INVALID_ARGUMENTUnknown engine type.
TVG_RESULT_NOT_SUPPORTEDUnsupported engine type.
TVG_RESULT_UNKNOWNAn internal error.
See also
tvg_engine_init()
Tvg_Engine
TVG_ENGINE_SW
@ TVG_ENGINE_SW
CPU rasterizer.
Definition: thorvg_capi.h:84
tvg_engine_init
TVG_EXPORT Tvg_Result tvg_engine_init(Tvg_Engine engine_method, unsigned threads)
Initializes TVG engines.
tvg_engine_term
TVG_EXPORT Tvg_Result tvg_engine_term(Tvg_Engine engine_method)
Terminates TVG engines.