thorvg_python.accessor¶
Classes¶
Accessor API |
Module Contents¶
- class thorvg_python.accessor.Accessor(engine: thorvg_python.engine.Engine, accessor: AccessorPointer | None)¶
Accessor API
A module for manipulation of the scene tree
This module helps to control the scene tree.
- engine¶
- thorvg_lib¶
- _new() thorvg_python.base.AccessorPointer¶
Creates a new AccessorPointer object.
Note
You need not call this method as it is auto called when initializing
Accessor()...versionadded: 1.0
- _del() thorvg_python.base.Result¶
Deletes the given accessor object.
Added in version 1.0.
- set(paint: thorvg_python.paint.Paint, func: collections.abc.Callable[[thorvg_python.base.PaintPointer, bytes], bool], data: bytes) thorvg_python.base.Result¶
Sets the paint of the accessor then iterates through its descendents.
Iterates through all descendents of the scene passed through the paint argument while calling func on each and passing the data pointer to this function. When func returns false iteration stops and the function returns.
- Parameters:¶
- paint : thorvg_python.paint.Paint¶
A PaintPointer to the scene object.
- func : Callable[[thorvg_python.base.PaintPointer, bytes], bool]¶
A function pointer to the function that will be execute for each child.
- data : bytes¶
A void pointer to data that will be passed to the func.
- Result:¶
INVALID_ARGUMENT An invalid AccessorPointer, PaintPointer, or function pointer.
- Return type:¶
Added in version 1.0.
- accessor_generate_id(name: str) int¶
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.
- accessor_get_name(_id: int) str¶
Retrieve the original name string from a given unique ID.
Returns the name associated with the specified identifier.
This method is only valid when @ref tvg_picture_set_accessible() is set to @c true for the Picture associated with the given @p paint in @ref tvg_accessor_set() Otherwise, the name information may not be available.
- Parameters:¶
- _id : int¶
The unique identifier.
- Returns:¶
The corresponding name string, or
Noneif not found or unavailable.
See also
tvg_accessor_generate_id()
See also
tvg_accessor_set()
See also
tvg_picture_set_accessible()
Note
This function is only available within Accessor callbacks registered via @ref tvg_accessor_set().
Note
Experimental API