thorvg_python.base¶
- class thorvg_python.base.AnimationStruct¶
Bases:
StructureA structure representing an animation controller object.
Note
You should use
Animationclass instead.
- class thorvg_python.base.BlendMethod(*values)¶
Bases:
IntEnumEnumeration indicates the method used for blending paint. Please refer to the respective formulas for each method.
-
ADD =
16¶ Simply adds pixel values of one layer with the other. (S + D)
-
COLOR =
14¶ Reserved. Not supported.
-
COLORBURN =
7¶ Divides the inverted bottom layer by the top layer, then inverts the result. 255 - (255 - D) / S
-
COLORDODGE =
6¶ Divides the bottom layer by the inverted top layer. D / (255 - S)
-
DARKEN =
4¶ Creates a pixel that retains the smallest components of the top and bottom layer pixels. min(S, D)
-
DIFFERENCE =
10¶ Subtracts the bottom layer from the top layer or vice versa, always non-negative. (S - D) if (S > D), otherwise (D - S)
-
EXCLUSION =
11¶ Result is twice the product of the top and bottom layers, subtracted from their sum. S + D - (2 * S * D)
-
HARDLIGHT =
8¶ Same as Overlay but with color roles reversed. (2 * S * D) if (S < Sa), otherwise (Sa * Da) - 2 * (Da - S) * (Sa - D)
-
HARDMIX =
17¶ Reserved. Not supported.
-
HUE =
12¶ Reserved. Not supported.
-
LIGHTEN =
5¶ Opposite action of Darken. max(S, D)
-
LUMINOSITY =
15¶ Reserved. Not supported.
-
MULTIPLY =
1¶ Takes the RGB channel values from 0 to 255 of each pixel in the top layer and multiplies them with the values for the corresponding pixel from the bottom layer. (S * D)
-
NORMAL =
0¶ Perform the alpha blending (default). S if (Sa == 255), otherwise (Sa * S) + (255 - Sa) * D
-
OVERLAY =
3¶ Combines Multiply and Screen blend modes. (2 * S * D) if (2 * D < Da), otherwise (Sa * Da) - 2 * (Da - S) * (Sa - D)
-
SATURATION =
13¶ Reserved. Not supported.
-
SCREEN =
2¶ The values of the pixels in the two layers are inverted, multiplied, and then inverted again. (S + D) - (S * D)
-
SOFTLIGHT =
9¶ Same as Overlay but applying pure black or white does not result in pure black or white. (1 - 2 * S) * (D ^ 2) + (2 * S * D)
-
ADD =
- class thorvg_python.base.CanvasStruct¶
Bases:
StructureA structure responsible for managing and drawing graphical elements.
It sets up the target buffer, which can be drawn on the screen. It stores the PaintStruct objects (Shape, Scene, Picture).
Note
You should use
Canvasclass instead.
- class thorvg_python.base.ColorStop¶
Bases:
StructureA data structure storing the information about the color and its relative position inside the gradient bounds.
- a : int¶
The alpha channel value in the range [0 ~ 255], where 0 is completely transparent and 255 is opaque.
- b : int¶
The blue color channel value in the range [0 ~ 255].
- g : int¶
The green color channel value in the range [0 ~ 255].
- offset : float¶
The relative position of the color.
- r : int¶
The red color channel value in the range [0 ~ 255].
- class thorvg_python.base.Colorspace(*values)¶
Bases:
IntEnumEnumeration specifying the methods of combining the 8-bit color channels into 32-bit color.
Changed in version 0.13: Added
ABGR8888SandARGB8888S-
ABGR8888 =
0¶ alpha, blue, green, red. Colors are alpha-premultiplied. (a << 24 | b << 16 | g << 8 | r)
- Type:¶
The channels are joined in the order
-
ABGR8888S =
2¶ alpha, blue, green, red. Colors are un-alpha-premultiplied.
- Type:¶
The channels are joined in the order
-
ARGB8888 =
1¶ alpha, red, green, blue. Colors are alpha-premultiplied. (a << 24 | r << 16 | g << 8 | b)
- Type:¶
The channels are joined in the order
-
ABGR8888 =
- class thorvg_python.base.CompositeMethod(*values)¶
Bases:
IntEnumEnumeration indicating the method used in the composition of two objects - the target and the source.
Deprecated since version 0.15: CLIP_PATH deprecated. Use Paint::clip() instead.
Changed in version 0.9: Added LUMA_MASK
Changed in version 0.14: Added INVERSE_LUMA_MAS
-
ALPHA_MASK =
2¶ The pixels of the source and the target are alpha blended. As a result, only the part of the source, which intersects with the target is visible.
-
CLIP_PATH =
1¶ The intersection of the source and the target is determined and only the resulting pixels from the source are rendered. Note that ClipPath only supports the Shape type.
-
INVERSE_ALPHA_MASK =
3¶ The pixels of the source and the complement to the target’s pixels are alpha blended. As a result, only the part of the source which is not covered by the target is visible.
-
INVERSE_LUMA_MASK =
5¶ The source pixels are converted to grayscale (luma value) and complement to the target’s pixels are alpha blended. As a result, only the part of the source which is not covered by the target is visible.
-
LUMA_MASK =
4¶ The source pixels are converted to grayscale (luma value) and alpha blended with the target. As a result, only the part of the source which intersects with the target is visible.
-
NONE =
0¶ No composition is applied.
-
ALPHA_MASK =
- class thorvg_python.base.EngineBackend(*values)¶
Bases:
IntEnumEnumeration specifying the engine type used for the graphics backend. For multiple backends bitwise operation is allowed.
-
GL =
4¶ OpenGL rasterizer.
-
SW =
2¶ CPU rasterizer.
-
GL =
- class thorvg_python.base.FillRule(*values)¶
Bases:
IntEnumEnumeration specifying the algorithm used to establish which parts of the shape are treated as the inside of the shape.
-
EVEN_ODD =
1¶ A line from the point to a location outside the shape is drawn and its intersections with the path segments of the shape are counted. If the number of intersections is an odd number, the point is inside the shape.
-
WINDING =
0¶ A line from the point to a location outside the shape is drawn. The intersections of the line with the path segment of the shape are counted. Starting from zero, if the path segment of the shape crosses the line clockwise, one is added, otherwise one is subtracted. If the resulting sum is non zero, the point is inside the shape.
-
EVEN_ODD =
- class thorvg_python.base.GradientStruct¶
Bases:
StructureA structure representing a gradient fill of a PaintStruct object.
Note
You should use
LinearGradientorRadialGradientclass instead.
- class thorvg_python.base.Identifier(*values)¶
Bases:
IntEnumsee TvgType
Deprecated since version 0.15.
-
LINEAR_GRAD =
4¶ A linear gradient type.
-
PICTURE =
3¶ A picture type paint.
-
RADIAL_GRAD =
5¶ A radial gradient type.
-
SCENE =
2¶ A scene type paint.
-
SHAPE =
1¶ A shape type paint.
-
TEXT =
6¶ A text type paint.
-
UNDEF =
0¶ Undefined type.
-
LINEAR_GRAD =
- class thorvg_python.base.Matrix¶
Bases:
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.
- e11¶
Structure/Union member
- e12¶
Structure/Union member
- e13¶
Structure/Union member
- e21¶
Structure/Union member
- e22¶
Structure/Union member
- e23¶
Structure/Union member
- e31¶
Structure/Union member
- e32¶
Structure/Union member
- e33¶
Structure/Union member
- class thorvg_python.base.MempoolPolicy(*values)¶
Bases:
IntEnumEnumeration specifying the methods of Memory Pool behavior policy.
-
DEFAULT =
0¶ Default behavior that ThorVG is designed to.
-
INDIVIDUAL =
2¶ Allocate designated memory pool that is used only by the current canvas instance.
-
SHAREABLE =
1¶ Memory Pool is shared among canvases.
-
DEFAULT =
- class thorvg_python.base.PaintStruct¶
Bases:
StructureA structure representing a graphical element.
Warning
The PaintStruct objects cannot be shared between Canvases.
Note
You should use
Paintclass instead.
- class thorvg_python.base.PathCommand(*values)¶
Bases:
IntEnumEnumeration specifying the values of the path commands accepted by ThorVG.
-
CLOSE =
0¶ Ends the current sub-path and connects it with its initial point. Corresponds to Z command in the SVG path commands.
-
CUBIC_TO =
3¶ Draws a cubic Bezier curve from the current point to the given point using two given control points and sets a new value of the current point. Corresponds to C command in the SVG path commands.
-
LINE_TO =
2¶ Draws a line from the current point to the given point and sets a new value of the current point. Corresponds to L command in the SVG path commands.
-
MOVE_TO =
1¶ Sets a new initial point of the sub-path and a new current point. Corresponds to M command in the SVG path commands.
-
CLOSE =
- class thorvg_python.base.PointStruct¶
Bases:
StructureA data structure representing a point in two-dimensional space.
- x¶
Structure/Union member
- y¶
Structure/Union member
- class thorvg_python.base.Result(*values)¶
Bases:
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.
-
FAILED_ALLOCATION =
3¶ The value returned in case of unsuccessful memory allocation.
-
INSUFFICIENT_CONDITION =
2¶ The value returned in case the request cannot be processed - e.g. asking for properties of an object, which does not exist.
-
INVALID_ARGUMENT =
1¶ The value returned in the event of a problem with the arguments given to the API - e.g. empty paths or null pointers.
-
MEMORY_CORRUPTION =
4¶ The value returned in the event of bad memory handling - e.g. failing in pointer releasing or casting
-
NOT_SUPPORTED =
5¶ The value returned in case of choosing unsupported engine features(options).
-
SUCCESS =
0¶ The value returned in case of a correct request execution.
-
UNKNOWN =
6¶ The value returned in all other cases.
-
FAILED_ALLOCATION =
- class thorvg_python.base.SaverStruct¶
Bases:
StructureA structure representing an object that enables to save a PaintStruct object into a file.
Note
You should use Saver class instead.
- class thorvg_python.base.StrokeCap(*values)¶
Bases:
IntEnumEnumeration determining the ending type of a stroke in the open sub-paths.
-
BUTT =
2¶ The stroke ends exactly at each of the two endpoints of a sub-path. For zero length sub-paths no stroke is rendered.
-
ROUND =
1¶ The stroke is extended in both endpoints of a sub-path by a half circle, with a radius equal to half of the stroke width. For zero length sub-paths a full circle is rendered.
-
SQUARE =
0¶ The stroke is extended in both endpoints of a sub-path by a rectangle, with the width equal to the stroke width and the length equal to half of the stroke width. For zero length sub-paths the square is rendered with the size of the stroke width.
-
BUTT =
- class thorvg_python.base.StrokeFill(*values)¶
Bases:
IntEnumEnumeration specifying how to fill the area outside the gradient bounds.
-
PAD =
0¶ The remaining area is filled with the closest stop color.
-
REFLECT =
1¶ The gradient pattern is reflected outside the gradient area until the expected region is filled.
-
REPEAT =
2¶ The gradient pattern is repeated continuously beyond the gradient area until the expected region is filled.
-
PAD =
- class thorvg_python.base.StrokeJoin(*values)¶
Bases:
IntEnumEnumeration specifying how to fill the area outside the gradient bounds.
-
BEVEL =
0¶ The outer corner of the joined path segments is bevelled at the join point. The triangular region of the corner is enclosed by a straight line between the outer corners of each stroke.
-
MITER =
2¶ The outer corner of the joined path segments is spiked. The spike is created by extension beyond the join point of the outer edges of the stroke until they intersect. If the extension goes beyond the limit, the join style is converted to the Bevel styl
-
ROUND =
1¶ The outer corner of the joined path segments is rounded. The circular region is centered at the join point.
-
BEVEL =
- class thorvg_python.base.TvgType(*values)¶
Bases:
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.
-
LINEAR_GRAD =
10¶ A linear gradient type.
-
PICTURE =
3¶ A picture type paint.
-
RADIAL_GRAD =
11¶ A radial gradient type.
-
SCENE =
2¶ A scene type paint.
-
SHAPE =
1¶ A shape type paint.
-
TEXT =
4¶ A text type paint.
-
UNDEF =
0¶ Undefined type.
-
LINEAR_GRAD =