ui::LinearGradientBrush¶
Header: winui/render/Brush.hpp.
A linear gradient running along one GradientAxis of the painted bounds.
Flat-color drawing keeps taking a plain Color. A control that wants gradient chrome passes one of these to Renderer::fill_rounded_rect_gradient(), and a Shape takes it as one alternative of Brush.
Example:
const ui::LinearGradientBrush luna{
.stops = {{0.0f, ui::Color::from_rgba(255, 255, 255)},
{1.0f, ui::Color::from_rgba(214, 208, 197)}},
};
renderer.fill_rounded_rect_gradient(ui::Rect{0, 0, 75, 23}, 3.0f, luna);
auto rect = std::make_unique<ui::RectangleControl>();
rect->set_fill(ui::LinearGradientBrush{.stops = luna.stops, .axis = ui::GradientAxis::Horizontal});
| Field | Type | Default | |
|---|---|---|---|
stops |
GradientStops |
The color stops, in increasing offset order. Empty paints nothing. |
|
axis |
GradientAxis |
GradientAxis::Vertical |
The direction the stops run; Vertical by default. |