ui::PathGeometry¶
Header: winui/render/PathGeometry.hpp.
A set of figures and the fill rule between them: what a Path, a path icon or any other Shape draws.
A default-constructed PathGeometry is empty and draws nothing. Build one with the static builders or parse path markup, then hand it to a ui::PathControl, to ui::Path{.data = ...}, to IconSource::path(), or straight to Renderer::draw_geometry().
Example:
const auto arrow = ui::PathGeometry::parse("F1 M 20,20L 24,10L 24,24L 5,24"); // nullopt if malformed
const ui::PathGeometry pill = ui::PathGeometry::rectangle(ui::Rect{0, 0, 40, 16}, 8.0f, 8.0f);
const ui::PathGeometry both[] = {*arrow, pill};
const ui::PathGeometry group = ui::PathGeometry::group(both, ui::FillRule::Nonzero);
window.set_content(ui::Path{
.data = group,
.fill = ui::colors::Black,
.stroke = ui::Color::from_rgba(0, 120, 215),
});
figures¶
The figures, drawn in order; all share fill_rule.
fill_rule¶
How overlapping figures decide what is inside (markup F0/F1).
line¶
A line: one open figure from from to to.
rectangle¶
A rectangle, also a Rectangle shape's outline: a closed figure, its corners rounded by elliptical arcs of radius_x by radius_y when either is positive (each clamped to half the rect), sixteen points in all.
ellipse¶
An ellipse: a closed figure of four quarter arcs.
polyline¶
static PathGeometry polyline(std::span<const Point> points, bool closed, FillRule rule = FillRule::EvenOdd)
A Polyline (closed false) or Polygon (closed true): straight segments through points. Fewer than two points is empty.
group¶
A group: every member's figures under one fill rule.
parse¶
Parses path markup such as F1 M 0,10 L 5,0 L 10,10 Z. Returns nullopt when the markup doesn't parse. An empty string is an empty geometry.
empty¶
True when there are no figures (the geometry draws nothing).
bounds¶
The tight bounding box of every figure (Bézier extrema, not control points). An empty geometry has an empty rect at the origin.
transformed¶
Every point run through m. Béziers stay Béziers: an affine transform of the control points is the transform of the curve.
fill_contains¶
Whether p is inside the filled area under the fill rule, with curves flattened finely enough for hit testing.