ThorVG  v0.15
Accessorfinal

The Accessor is a utility class to debug the Scene structure by traversing the scene-tree. More...

Public Member Functions

Result set (const Picture *picture, std::function< bool(const Paint *paint, void *data)> func, void *data) noexcept
 Set the access function for traversing the Picture scene tree nodes. More...
 

Static Public Member Functions

static uint32_t id (const char *name) noexcept
 Generate a unique ID (hash key) from a given name. More...
 
static std::unique_ptr< Accessorgen () noexcept
 Creates a new Accessor object. More...
 

Detailed Description

The Accessor is a utility class to debug the Scene structure by traversing the scene-tree.

The Accessor helps you search specific nodes to read the property information, figure out the structure of the scene tree and its size.

Warning
We strongly warn you not to change the paints of a scene unless you really know the design-structure.
Since
0.10

Member Function Documentation

◆ gen()

static std::unique_ptr<Accessor> gen ( )
staticnoexcept

Creates a new Accessor object.

Returns
A new Accessor object.

◆ id()

static uint32_t id ( const char *  name)
staticnoexcept

Generate a unique ID (hash key) from a given name.

This function computes a unique identifier value based on the provided string. You can use this to assign a unique ID to the Paint object.

Parameters
[in]nameThe input string to generate the unique identifier from.
Returns
The generated unique identifier value.
See also
Paint::id
Note
Experimental API

◆ set()

Result set ( const Picture picture,
std::function< bool(const Paint *paint, void *data)>  func,
void *  data 
)
noexcept

Set the access function for traversing the Picture scene tree nodes.

Parameters
[in]pictureThe picture node to traverse the internal scene-tree.
[in]funcThe callback function calling for every paint nodes of the Picture.
[in]dataData passed to the func as its argument.
Note
The bitmap based picture might not have the scene-tree.
Experimental API