Skip to content

ui::GradientStops

Header: winui/render/Brush.hpp.

The stops of a gradient brush, in order: a list kept inside the brush up to four stops, so handing a theme's gradient to a control or a renderer allocates nothing. More stops go to the heap. Built like a vector, from a braced list or from a std::vector<GradientStop>, and read like one.

Example:

ui::GradientStops stops{{0.0f, ui::colors::White}, {1.0f, ui::colors::Black}};
stops.push_back({0.5f, ui::Color::from_rgba(128, 128, 128)});
for (const ui::GradientStop& stop : stops) { (void)stop.offset; }

InlineCapacity

static std::size_t InlineCapacity = 4

How many stops fit without allocating.

GradientStops

GradientStops() = default

GradientStops

GradientStops(std::initializer_list<GradientStop> stops)

The stops in stops, in order.

GradientStops

GradientStops(const std::vector<GradientStop>& stops)

The stops in stops, in order.

GradientStops

GradientStops(const GradientStops& other)

GradientStops

GradientStops(GradientStops&& other) noexcept

operator=

GradientStops& operator=(const GradientStops& other)

operator=

GradientStops& operator=(GradientStops&& other) noexcept

~GradientStops

~GradientStops() = default

size

std::size_t size() const noexcept

How many stops there are.

empty

bool empty() const noexcept

Whether there are none, which paints nothing.

begin

const GradientStop* begin() const noexcept

The first stop.

end

const GradientStop* end() const noexcept

One past the last stop.

begin

GradientStop* begin() noexcept

The first stop.

end

GradientStop* end() noexcept

One past the last stop.

data

const GradientStop* data() const noexcept

The stops as one array of size() elements.

data

GradientStop* data() noexcept

The stops as one array of size() elements.

operator[]

const GradientStop& operator[](std::size_t i) const noexcept

Stop i, below size().

operator[]

GradientStop& operator[](std::size_t i) noexcept

Stop i, below size().

front

const GradientStop& front() const noexcept

The first stop; there must be one.

back

const GradientStop& back() const noexcept

The last stop; there must be one.

front

GradientStop& front() noexcept

The first stop; there must be one.

back

GradientStop& back() noexcept

The last stop; there must be one.

push_back

void push_back(const GradientStop& stop)

Adds stop after the last one.

clear

void clear() noexcept

Removes every stop.

to_vector

std::vector<GradientStop> to_vector() const

The stops as a vector.