| ThorVG v0.8

Classes | Public Member Functions | List of all members
Fill
ThorVG

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

Inheritance diagram for Fill:
[legend]

## 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...
Fill * | duplicate () const noexcept
| Creates a copy of the Fill object. More...
uint32_t | identifier () const noexcept
| Return the unique id value of the Fill instance. More...

## 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] | colorStops | A 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] | colorStops | An array of ColorStop data structure.
  [in] | cnt | The count of the `colorStops` array equal to the colors number used in the gradient.

Returns
  Result::Success when succeed.

## ◆ 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()

uint32_t identifier | ( |  | ) | const
| noexcept

Return the unique id value of the Fill instance.

This method can be called for checking the current concrete instance type.

Returns
  The type id of the Fill instance.

@BETA_API

## ◆ 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] | s | The FillSpread value.

Returns
  Result::Success when succeed.

## ◆ 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.

Return values

  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] | m | The 3x3 augmented matrix.

Returns
  Result::Success when succeed, Result::FailedAllocation otherwise.