thorvg_python.base¶
Attributes¶
Classes¶
A structure responsible for managing and drawing graphical elements. |
|
A structure representing a graphical element. |
|
A structure representing a gradient fill of a PaintPointer object. |
|
A structure representing an object that enables to save a PaintPointer object into a file. |
|
A structure representing an animation controller object. |
|
A structure representing an object that enables iterating through a scene's descendents. |
|
Enumeration specifying the result from the APIs. |
|
Enumeration specifying the methods of combining the 8-bit color channels into 32-bit color. |
|
Enumeration to specify rendering engine behavior. |
|
Enumeration indicating the method used in the masking of two objects - the target and the source. |
|
Enumeration indicates the method used for blending paint. |
|
Enumeration indicating the ThorVG object type value. |
|
Enumeration specifying the values of the path commands accepted by ThorVG. |
|
Enumeration determining the ending type of a stroke in the open sub-paths. |
|
Enumeration specifying how to fill the area outside the gradient bounds. |
|
Enumeration specifying how to fill the area outside the gradient bounds. |
|
Enumeration specifying the algorithm used to establish which parts of the shape |
|
A data structure storing the information about the color and its relative position inside the gradient bounds. |
|
A data structure storing the information about the color and its relative position inside the gradient bounds. |
|
A data structure representing a point in two-dimensional space. |
|
A data structure representing a three-dimensional matrix. |
|
Describes the font metrics of a text object. |
Module Contents¶
- class thorvg_python.base.CanvasPointer¶
Bases:
ctypes.c_void_pA structure responsible for managing and drawing graphical elements.
It sets up the target buffer, which can be drawn on the screen. It stores the PaintPointer objects (Shape, Scene, Picture).
Note
You should use
Canvasclass instead.
- class thorvg_python.base.PaintPointer¶
Bases:
ctypes.c_void_pA structure representing a graphical element.
Warning
The PaintPointer objects cannot be shared between Canvases.
Note
You should use
Paintclass instead.
- class thorvg_python.base.GradientPointer¶
Bases:
ctypes.c_void_pA structure representing a gradient fill of a PaintPointer object.
Note
You should use
LinearGradientorRadialGradientclass instead.
- class thorvg_python.base.SaverPointer¶
Bases:
ctypes.c_void_pA structure representing an object that enables to save a PaintPointer object into a file.
Note
You should use Saver class instead.
- class thorvg_python.base.AnimationPointer¶
Bases:
ctypes.c_void_pA structure representing an animation controller object.
Note
You should use
Animationclass instead.
- class thorvg_python.base.AccessorPointer¶
Bases:
ctypes.c_void_pA structure representing an object that enables iterating through a scene’s descendents.
Note
You should use
Accessorclass instead
- class thorvg_python.base.Result¶
Bases:
enum.IntEnumEnumeration specifying the result from the APIs.
All ThorVG APIs could potentially return one of the values in the list. Please note that some APIs may additionally specify the reasons that trigger their return values.
-
SUCCESS =
0¶
-
INVALID_ARGUMENT =
1¶
-
INSUFFICIENT_CONDITION =
2¶
-
FAILED_ALLOCATION =
3¶
-
MEMORY_CORRUPTION =
4¶
-
NOT_SUPPORTED =
5¶
-
UNKNOWN =
255¶
-
SUCCESS =
- class thorvg_python.base.Colorspace¶
Bases:
enum.IntEnumEnumeration specifying the methods of combining the 8-bit color channels into 32-bit color.
Changed in version 0.13: Added
ABGR8888SandARGB8888SChanged in version 1.0: Added
UNKNOWN-
ABGR8888 =
0¶
-
ARGB8888 =
1¶
-
ABGR8888S =
2¶
-
ARGB8888S =
3¶
-
UNKNOWN =
255¶
-
ABGR8888 =
- class thorvg_python.base.EngineOption¶
Bases:
enum.IntEnumEnumeration to specify rendering engine behavior.
Note
The availability or behavior of
EngineMethod.SMART_RENDERmay vary depending on platform or backend support. It attempts to optimize rendering performance by updating only the regions of the canvas that have changed between frames (partial redraw). This can be highly effective in scenarios where most of the canvas remains static and only small portions are updated—such as simple animations or GUI interactions. However, in complex scenes where a large portion of the canvas changes frequently (e.g., full-screen animations or heavy object movements), the overhead of tracking changes and managing update regions may outweigh the benefits, resulting in decreased performance compared to the default rendering mode. Thus, it is recommended to benchmark both modes in your specific use case to determine the optimal setting.Added in version 1.0.
-
NONE =
0¶
-
DEFAULT =
1¶
-
SMART_RENDER =
2¶
-
NONE =
- class thorvg_python.base.MaskMethod¶
Bases:
enum.IntEnumEnumeration indicating the method used in the masking of two objects - the target and the source.
-
NONE =
0¶
-
ALPHA =
1¶
-
INVERSE_ALPHA =
2¶
-
LUMA =
3¶
-
INVERSE_LUMA =
4¶
-
ADD =
5¶
-
SUBTRACT =
6¶
-
INTERSECT =
7¶
-
DIFFERENCE =
8¶
-
LIGHTEN =
9¶
-
DARKEN =
10¶
-
NONE =
- class thorvg_python.base.BlendMethod¶
Bases:
enum.IntEnumEnumeration indicates the method used for blending paint. Please refer to the respective formulas for each method.
-
NORMAL =
0¶
-
MULTIPLY =
1¶
-
SCREEN =
2¶
-
OVERLAY =
3¶
-
DARKEN =
4¶
-
LIGHTEN =
5¶
-
COLORDODGE =
6¶
-
COLORBURN =
7¶
-
HARDLIGHT =
8¶
-
SOFTLIGHT =
9¶
-
DIFFERENCE =
10¶
-
EXCLUSION =
11¶
-
HUE =
12¶
-
SATURATION =
13¶
-
COLOR =
14¶
-
LUMINOSITY =
15¶
-
ADD =
16¶
-
COMPOSITION =
255¶
-
NORMAL =
- class thorvg_python.base.TvgType¶
Bases:
enum.IntEnumEnumeration indicating the ThorVG object type value.
ThorVG’s drawing objects can return object type values, allowing you to identify the specific type of each object.
-
UNDEF =
0¶
-
SHAPE =
1¶
-
SCENE =
2¶
-
PICTURE =
3¶
-
TEXT =
4¶
-
LINEAR_GRAD =
10¶
-
RADIAL_GRAD =
11¶
-
UNDEF =
- class thorvg_python.base.PathCommand¶
Bases:
enum.IntEnumEnumeration specifying the values of the path commands accepted by ThorVG.
-
CLOSE =
0¶
-
MOVE_TO =
1¶
-
LINE_TO =
2¶
-
CUBIC_TO =
3¶
-
CLOSE =
- class thorvg_python.base.StrokeCap¶
Bases:
enum.IntEnumEnumeration determining the ending type of a stroke in the open sub-paths.
-
BUTT =
0¶
-
ROUND =
1¶
-
SQUARE =
2¶
-
BUTT =
- class thorvg_python.base.StrokeJoin¶
Bases:
enum.IntEnumEnumeration specifying how to fill the area outside the gradient bounds.
-
MITER =
0¶
-
ROUND =
1¶
-
BEVEL =
2¶
-
MITER =
- class thorvg_python.base.StrokeFill¶
Bases:
enum.IntEnumEnumeration specifying how to fill the area outside the gradient bounds.
-
PAD =
0¶
-
REFLECT =
1¶
-
REPEAT =
2¶
-
PAD =
- class thorvg_python.base.FillRule¶
Bases:
enum.IntEnumEnumeration specifying the algorithm used to establish which parts of the shape are treated as the inside of the shape.
-
NON_ZERO =
0¶
-
EVEN_ODD =
1¶
-
NON_ZERO =
- class thorvg_python.base.ColorStop¶
Bases:
ctypes.StructureA data structure storing the information about the color and its relative position inside the gradient bounds.
- _fields_¶
- class thorvg_python.base.TextWrap¶
Bases:
enum.IntEnumA data structure storing the information about the color and its relative position inside the gradient bounds.
-
NONE =
0¶
-
CHARACTER =
1¶
-
WORD =
2¶
-
SMART =
3¶
-
ELLIPSIS =
4¶
-
HYPHENATION =
5¶
-
NONE =
- class thorvg_python.base.PointStruct¶
Bases:
ctypes.StructureA data structure representing a point in two-dimensional space.
- _fields_¶
- class thorvg_python.base.Matrix¶
Bases:
ctypes.StructureA data structure representing a three-dimensional matrix.
The elements e11, e12, e21 and e22 represent the rotation matrix, including the scaling factor.
The elements e13 and e23 determine the translation of the object along the x and y-axis, respectively.
The elements e31 and e32 are set to 0, e33 is set to 1.
- _fields_¶
- class thorvg_python.base.TextMetrics¶
Bases:
ctypes.StructureDescribes the font metrics of a text object.
Provides the basic vertical layout metrics used for text rendering, such as ascent, descent, and line spacing (linegap).
See also
Text.get_metrics()
Note
Experimental API
- _fields_¶
- ascent : float¶
- descent : float¶
- linegap : float¶
- advance : float¶
- thorvg_python.base.PictureAssetResolverType¶