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
)¶
ColorW 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 (conic) gradient.
Reflected
enumerator (GradientType::Reflected
)¶
A reflected gradient.
ColorStopArray
typedef¶
ColorStopArray = SmallVector<ColorStop, 2>
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<ColorW(float)> &func)
Constructs GradientData from a function mapping float to ColorW.
Param func
The function to map positions to colors.
explicit GradientData(const std::vector<ColorW> &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 with premultiplied alpha.
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.
explicit Gradient(GradientType type, PointF startPoint,
PointF endPoint,
ColorStopArray colorStops)
Constructs a gradient with color stops.
Param type
The type of the gradient.
Param startPoint
The starting point of the gradient.
Param endPoint
The ending point of the gradient.
Param colorStops
Array of color stops.
explicit Gradient(GradientType type, PointF startPoint,
PointF endPoint, ColorW startColor,
ColorW endColor)
Constructs a gradient with start and end colors.
Param type
The type of the gradient.
Param startPoint
The starting point of the gradient.
Param endPoint
The ending point of the gradient.
Param startColor
The starting color.
Param endColor
The ending color.
getType
function (Gradient::getType
)¶
GradientType getType() const noexcept
Gets the type of the gradient.
Returns The gradient type.
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, ColorW 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.
void addStop(ColorStop colorStop)
Adds a color stop to the gradient.
Param colorStop
The color stop to add.
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.
LinearGradient
class¶
LinearGradient
LinearGradient
function (LinearGradient::LinearGradient
)¶
explicit LinearGradient()
Constructs an empty linear gradient.
explicit LinearGradient(PointF startPoint, PointF endPoint)
Constructs a linear gradient between two points.
Param startPoint
The starting point of the gradient.
Param endPoint
The ending point of the gradient.
explicit LinearGradient(PointF startPoint, PointF endPoint,
ColorStopArray colorStops)
Constructs a linear gradient with color stops.
Param startPoint
The starting point of the gradient.
Param endPoint
The ending point of the gradient.
Param colorStops
Array of color stops.
explicit LinearGradient(PointF startPoint, PointF endPoint,
ColorW startColor, ColorW endColor)
Constructs a linear gradient with start and end colors.
Param startPoint
The starting point of the gradient.
Param endPoint
The ending point of the gradient.
Param startColor
The starting color.
Param endColor
The ending color.
RadialGradient
class¶
RadialGradient
RadialGradient
function (RadialGradient::RadialGradient
)¶
explicit RadialGradient()
Constructs an empty radial gradient.
explicit RadialGradient(PointF point, float radius)
Constructs a radial gradient with a center point and radius.
Param point
The center point of the gradient.
Param radius
The radius of the gradient.
explicit RadialGradient(PointF point, float radius,
ColorStopArray colorStops)
Constructs a radial gradient with color stops.
Param point
The center point of the gradient.
Param radius
The radius of the gradient.
Param colorStops
Array of color stops.
explicit RadialGradient(PointF point, float radius,
ColorW startColor, ColorW endColor)
Constructs a radial gradient with start and end colors.
Param point
The center point of the gradient.
Param radius
The radius of the gradient.
Param startColor
The starting color.
Param endColor
The ending color.
Auto-generated from sources, Revision , https://github.com/brisklib/brisk/blob//include/brisk/