Skip to content

ui::StrokeStyle

Header: winui/render/Renderer.hpp.

A Shape's stroke settings with their defaults. dash_array and dash_offset are in multiples of thickness. An empty array is a solid line.

Example:

auto line = std::make_unique<ui::LineControl>();
line->set_stroke(ui::colors::Black);
line->set_stroke_style(ui::StrokeStyle{
    .start_cap  = ui::PenLineCap::Round,
    .end_cap    = ui::PenLineCap::Round,
    .dash_array = {2.0f, 1.0f}, // 2x thickness on, 1x off
});
line->set_stroke_thickness(4.0f); // thickness is owned by this setter

Field Type Default
thickness float 1.0f Pen width in DIPs.
start_cap PenLineCap PenLineCap::Flat Cap at a figure's first point.
end_cap PenLineCap PenLineCap::Flat Cap at a figure's last point.
dash_cap PenLineCap PenLineCap::Flat Cap at both ends of every dash.
line_join PenLineJoin PenLineJoin::Miter How corners are joined.
miter_limit float 10.0f Miter length cap, in half-thicknesses.
dash_array std::vector<float> On/off lengths in thicknesses; empty is solid.
dash_offset float 0.0f Start phase in the dash pattern, in thicknesses.