Skip to content

File include/brisk/graphics/Gradients.hpp


ColorStop class

ColorStop

Represents a color stop in a gradient.

position variable (ColorStop::position)

float position

The position of the color stop within the gradient, ranging from 0.0 to 1.0.

color variable (ColorStop::color)

ColorF color

The color associated with this color stop.


GradientType enum

enum class GradientType : int

Enumeration for different types of gradients.

Linear enumerator (GradientType::Linear)

A linear gradient.

Radial enumerator (GradientType::Radial)

A radial gradient.

Angle enumerator (GradientType::Angle)

An angular gradient.

Reflected enumerator (GradientType::Reflected)

A reflected gradient.

Diamond enumerator (GradientType::Diamond)

A diamond gradient.

InsideOutside enumerator (GradientType::InsideOutside)

An inside-outside gradient.


ColorStopArray typedef

ColorStopArray = SmallVector<ColorStop, 3>

A small vector type for storing an array of color stops.


gradientResolution variable

constexpr inline size_t gradientResolution = 1024

The resolution for the gradient, used in shader calculations.
Note Must match the value in Shader


Gradient class

Gradient

Represents a gradient for rendering.


GradientData class

GradientData

Struct for storing gradient data.

GradientData function (GradientData::GradientData)

explicit GradientData(const Gradient &gradient)

Constructs GradientData from a Gradient object.
Param gradient The gradient from which to construct the data.

explicit GradientData(const function<ColorF(float)> &func)

Constructs GradientData from a function mapping float to ColorF.
Param func The function to map positions to colors.

explicit GradientData(const std::vector<ColorF> &list,
                      float gamma)

Constructs GradientData from a vector of colors and a gamma correction factor.
Param list A vector of colors to use in the gradient.
Param gamma The gamma correction factor to apply.

operator() function (GradientData::operator())

ColorF operator()(float x) const

Gets the color at a specified position.
Param x The position (between 0.0 and 1.0) to query.
Returns The color at the specified position in the gradient.


GradientResource class

GradientResource

Represents a resource associated with a gradient.

id variable (GradientResource::id)

uint64_t id

Unique identifier for the gradient resource.

data variable (GradientResource::data)

GradientData data

The gradient data.


makeGradient function

inline RC<GradientResource>
makeGradient(const GradientData &data)

Creates a new gradient resource.
Param data The gradient data to associate with the resource.
Returns A reference-counted pointer to the newly created GradientResource.


Gradient class

Gradient

Represents a gradient for rendering.

Gradient function (Gradient::Gradient)

explicit Gradient(GradientType type)

Constructs a gradient of a specified type.
Param type The type of the gradient.

explicit Gradient(GradientType type, PointF startPoint,
                  PointF endPoint)

Constructs a gradient of a specified type between two points.
Param type The type of the gradient.
Param startPoint The starting point of the gradient.
Param endPoint The ending point of the gradient.

getStartPoint function (Gradient::getStartPoint)

PointF getStartPoint() const

Gets the starting point of the gradient.
Returns The starting point of the gradient.

setStartPoint function (Gradient::setStartPoint)

void setStartPoint(PointF pt)

Sets the starting point of the gradient.
Param pt The new starting point.

getEndPoint function (Gradient::getEndPoint)

PointF getEndPoint() const

Gets the ending point of the gradient.
Returns The ending point of the gradient.

setEndPoint function (Gradient::setEndPoint)

void setEndPoint(PointF pt)

Sets the ending point of the gradient.
Param pt The new ending point.

addStop function (Gradient::addStop)

void addStop(float position, ColorF color)

Adds a color stop to the gradient.
Param position The position of the color stop (between 0.0 and 1.0).
Param color The color of the stop.

colorStops function (Gradient::colorStops)

const ColorStopArray &colorStops() const

Gets the array of color stops defined in the gradient.
Returns A reference to the array of color stops.

rasterize function (Gradient::rasterize)

RC<GradientResource> rasterize() const

Rasterizes the gradient into a GradientResource.
Returns A reference-counted pointer to the rasterized gradient resource.

m_type variable (Gradient::m_type)

GradientType m_type

The type of the gradient.

m_startPoint variable (Gradient::m_startPoint)

PointF m_startPoint

The starting point of the gradient.

m_endPoint variable (Gradient::m_endPoint)

PointF m_endPoint

The ending point of the gradient.

m_colorStops variable (Gradient::m_colorStops)

ColorStopArray m_colorStops

The color stops for the gradient.


Auto-generated from sources, Revision , https://github.com/brisklib/brisk/blob//include/brisk/