thorvg_python.gradient.linear¶
Classes¶
Linear Gradient API |
Module Contents¶
-
class thorvg_python.gradient.linear.LinearGradient(engine: thorvg_python.engine.Engine, grad: thorvg_python.base.GradientPointer | None =
None)¶ Bases:
thorvg_python.gradient.GradientLinear Gradient API
- engine¶
- thorvg_lib¶
- _new() thorvg_python.base.GradientPointer¶
Creates a new linear gradient object.
Note
You need not call this method as it is auto called when initializing
LinearGradient().
- set(x1: float, y1: float, x2: float, y2: float) thorvg_python.base.Result¶
Sets the linear gradient bounds.
The bounds of the linear gradient are defined as a surface constrained by two parallel lines crossing the given points (
x1,y1) and (x2,y2), respectively. Both lines are perpendicular to the line linking (x1,y1) and (x2,y2).- Parameters:¶
- x1 : float¶
The horizontal coordinate of the first point used to determine the gradient bounds.
- y1 : float¶
The vertical coordinate of the first point used to determine the gradient bounds.
- x2 : float¶
The horizontal coordinate of the second point used to determine the gradient bounds.
- y2 : float¶
The vertical coordinate of the second point used to determine the gradient bounds.
- Returns:¶
Result.INVALID_ARGUMENT An invalid GradientPointer.
- Return type:¶
Note
In case the first and the second points are equal, an object is filled with a single color using the last color specified in the Gradient.set_color_stops().
See also
Gradient.set_color_stops()
- get() tuple[thorvg_python.base.Result, float, float, float, float]¶
Gets the linear gradient bounds.
The bounds of the linear gradient are defined as a surface constrained by two parallel lines crossing the given points (
x1,y1) and (x2,y2), respectively. Both lines are perpendicular to the line linking (x1,y1) and (x2,y2).- Returns:¶
Result.INVALID_ARGUMENT An invalid GradientPointer.
- Return type:¶
- Returns:¶
The horizontal coordinate of the first point used to determine the gradient bounds.
- Return type:¶
float
- Returns:¶
The vertical coordinate of the first point used to determine the gradient bounds.
- Return type:¶
float
- Returns:¶
The horizontal coordinate of the second point used to determine the gradient bounds.
- Return type:¶
float
- Returns:¶
The vertical coordinate of the second point used to determine the gradient bounds.
- Return type:¶
float