ThorVG  v0.1
Functions

A module managing the multiple paints as one group paint. More...

Collaboration diagram for Scene:

Functions

TVG_EXPORT Tvg_Painttvg_scene_new ()
 Creates a new scene object. More...
 
TVG_EXPORT Tvg_Result tvg_scene_reserve (Tvg_Paint *scene, uint32_t size)
 Sets the size of the container, where all the paints pushed into the scene are stored. More...
 
TVG_EXPORT Tvg_Result tvg_scene_push (Tvg_Paint *scene, Tvg_Paint *paint)
 Passes drawing elements to the scene using Tvg_Paint objects. More...
 
TVG_EXPORT Tvg_Result tvg_scene_clear (Tvg_Paint *scene)
 Sets the total number of the paints pushed into the scene to be zero. (BETA version) More...
 

Detailed Description

A module managing the multiple paints as one group paint.

As a group, scene can be transformed, translucent, composited with other target paints, its children will be affected by the scene world.

Function Documentation

◆ tvg_scene_clear()

TVG_EXPORT Tvg_Result tvg_scene_clear ( Tvg_Paint scene)

Sets the total number of the paints pushed into the scene to be zero. (BETA version)

Warning
Please do not use it, this API is not official one. It could be modified in the next version.

◆ tvg_scene_new()

TVG_EXPORT Tvg_Paint* tvg_scene_new ( )

Creates a new scene object.

A scene object is used to group many paints into one object, which can be manipulated using TVG APIs.

Returns
A new scene object.

◆ tvg_scene_push()

TVG_EXPORT Tvg_Result tvg_scene_push ( Tvg_Paint scene,
Tvg_Paint paint 
)

Passes drawing elements to the scene using Tvg_Paint objects.

Only the paints pushed into the scene will be drawing targets. If you know the number of pushed objects in the advance, please call tvg_scene_reserve().

Parameters
[in]sceneA Tvg_Paint pointer to the scene object.
[in]paintA graphical object to be drawn.
Returns
Tvg_Result enumeration.
Return values
TVG_RESULT_SUCCESSSucceed.
TVG_RESULT_INVALID_ARGUMENTAn invalid pointer to the scene.
TVG_RESULT_MEMORY_CORRUPTIONAn invalid pointer to the paint.
TVG_RESULT_INSUFFICIENT_CONDITIONAn internal error.
Note
The rendering order of the paints is the same as the order as they were pushed. Consider sorting the paints before pushing them if you intend to use layering.
See also
tvg_scene_reserve()

◆ tvg_scene_reserve()

TVG_EXPORT Tvg_Result tvg_scene_reserve ( Tvg_Paint scene,
uint32_t  size 
)

Sets the size of the container, where all the paints pushed into the scene are stored.

If the number of objects pushed into the scene is known in advance, calling the function prevents multiple memory reallocation, thus improving the performance.

Parameters
[in]sceneA Tvg_Paint pointer to the scene object.
[in]sizeThe number of objects for which the memory is to be reserved.
Returns
Tvg_Result enumeration.
Return values
TVG_RESULT_SUCCESSSucceed.
TVG_RESULT_INVALID_ARGUMENTAn invalid Tvg_Paint pointer.