Skip to content

ui::PathSegment

Header: winui/render/PathGeometry.hpp.

One piece of a figure, starting where the previous one ended. A Line uses p1 as its end point; a Quadratic has one control point p1 and ends at p2; a Cubic has control points p1 and p2 and ends at p3.

Arcs never appear here: the PathGeometry builders and PathGeometry::parse() convert them to cubics.

Example:

ui::PathFigure figure{.start = ui::Point{0, 0}};
figure.segments.push_back({.kind = ui::PathSegmentKind::Line, .p1 = ui::Point{10, 0}});
figure.segments.push_back({.kind = ui::PathSegmentKind::Quadratic,
                           .p1   = ui::Point{15, 5},
                           .p2   = ui::Point{10, 10}});

kind

PathSegmentKind kind = PathSegmentKind::Line

The segment type; decides which points are read.

p1

Point p1 {}

The end point of a Line, else the first control point.

p2

Point p2 {}

The end of a Quadratic, the second control point of a Cubic.

p3

Point p3 {}

The end of a Cubic; unused otherwise.

end

Point end() const

The point the segment ends at, whichever member that is for its kind.