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...
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...
Fill * | duplicate () const noexcept
| Creates a copy of the Fill object. 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]

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.

## colorStops() [2/2]

uint32_t colorStops | ( | const ColorStop ** | colorStops | ) | const

noexcept

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

Parameters

  [in] | 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.

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

## spread() [1/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.

## spread() [2/2]

FillSpread spread | ( |  | ) | const

noexcept

Gets the FillSpread value of the fill.

Returns
  The FillSpread value of this Fill.