ThorVG  v0.15
Fillabstract

An abstract class representing the gradient fill of the Shape object. More...

Inheritance diagram for Fill:

Classes

struct  ColorStop
 A data structure storing the information about the color and its relative position inside the gradient bounds. More...
 

Public Member Functions

Result colorStops (const ColorStop *colorStops, uint32_t cnt) noexcept
 Sets the parameters of the colors of the gradient and their position. More...
 
Result spread (FillSpread s) noexcept
 Sets the FillSpread value, which specifies how to fill the area outside the gradient bounds. More...
 
Result transform (const Matrix &m) noexcept
 Sets the matrix of the affine transformation for the gradient fill. More...
 
uint32_t colorStops (const ColorStop **colorStops) const noexcept
 Gets the parameters of the colors of the gradient, their position and number. More...
 
FillSpread spread () const noexcept
 Gets the FillSpread value of the fill. More...
 
Matrix transform () const noexcept
 Gets the matrix of the affine transformation of the gradient fill. More...
 
Fillduplicate () const noexcept
 Creates a copy of the Fill object. More...
 
virtual Type type () const noexcept=0
 Returns the ID value of this class. More...
 
TVG_DEPRECATED uint32_t identifier () const noexcept
 

Detailed Description

An abstract class representing the gradient fill of the Shape object.

It contains the information about the gradient colors and their arrangement inside the gradient bounds. The gradients bounds are defined in the LinearGradient or RadialGradient class, depending on the type of the gradient to be used. It specifies the gradient behavior in case the area defined by the gradient bounds is smaller than the area to be filled.

Member Function Documentation

◆ colorStops() [1/2]

uint32_t colorStops ( const ColorStop **  colorStops) const
noexcept

Gets the parameters of the colors of the gradient, their position and number.

Parameters
[out]colorStopsA pointer to the memory location, where the array of the gradient's ColorStop is stored.
Returns
The number of colors used in the gradient. This value corresponds to the length of the colorStops array.

◆ colorStops() [2/2]

Result colorStops ( const ColorStop colorStops,
uint32_t  cnt 
)
noexcept

Sets the parameters of the colors of the gradient and their position.

Parameters
[in]colorStopsAn array of ColorStop data structure.
[in]cntThe count of the colorStops array equal to the colors number used in the gradient.

◆ duplicate()

Fill* duplicate ( ) const
noexcept

Creates a copy of the Fill object.

Return a newly created Fill object with the properties copied from the original.

Returns
A copied Fill object when succeed, nullptr otherwise.

◆ identifier()

TVG_DEPRECATED uint32_t identifier ( ) const
noexcept
See also
Fill::type()

◆ spread() [1/2]

FillSpread spread ( ) const
noexcept

Gets the FillSpread value of the fill.

Returns
The FillSpread value of this Fill.

◆ spread() [2/2]

Result spread ( FillSpread  s)
noexcept

Sets the FillSpread value, which specifies how to fill the area outside the gradient bounds.

Parameters
[in]sThe FillSpread value.

◆ transform() [1/2]

Matrix transform ( ) const
noexcept

Gets the matrix of the affine transformation of the gradient fill.

In case no transformation was applied, the identity matrix is returned.

Returns
The augmented transformation matrix.

◆ transform() [2/2]

Result transform ( const Matrix m)
noexcept

Sets the matrix of the affine transformation for the gradient fill.

The augmented matrix of the transformation is expected to be given.

Parameters
[in]mThe 3x3 augmented matrix.

◆ type()

virtual Type type ( ) const
pure virtualnoexcept

Returns the ID value of this class.

This method can be used to check the current concrete instance type.

Returns
The class type ID of the Fill instance.
Since
Experimental API

Implemented in RadialGradient, and LinearGradient.