thorvg_python.gradient¶
- class thorvg_python.gradient.Gradient(engine: Engine, grad: GradientStruct)¶
Bases:
objectCommon Gradient API
A module managing the gradient fill of objects.
The module enables to set and to get the gradient colors and their arrangement inside the gradient bounds, to specify the gradient bounds and the gradient behavior in case the area defined by the gradient bounds is smaller than the area to be filled.
This is base Gradient class. Please use LinearGradient or RadialGradient for creating
- duplicate() Gradient | None¶
Duplicates the given GradientStruct object.
Creates a new object and sets its all properties as in the original object.
- get_color_stops() tuple[Result, Sequence[ColorStop]]¶
Gets the parameters of the colors of the gradient, their position and number
The function does not allocate any memory.
- get_identifier() tuple[Result, Identifier]¶
Deprecated since version 0.15.
See also
Gradient.get_type()
- get_spread() tuple[Result, StrokeFill]¶
Gets the FillSpread value of the gradient object.
- get_transform() tuple[Result, Matrix]¶
Gets the matrix of the affine transformation of the gradient object.
In case no transformation was applied, the identity matrix is set.
- get_type() tuple[Result, TvgType]¶
Gets the unique value of the gradient instance indicating the instance type.
- Returns:¶
INVALID_ARGUMENT In case a
nullptris passed as the argument.- Return type:¶
- Returns:¶
The unique type of the gradient instance type.
- Return type:¶
Note
Experimental API
- set_color_stops(color_stop: Sequence[ColorStop]) Result¶
Sets the parameters of the colors of the gradient and their position.
- set_spread(spread: StrokeFill) Result¶
Sets the StrokeFill value, which specifies how to fill the area outside the gradient bounds.