pub struct Stroke {
pub width: f32,
pub color: Color,
pub curve: bool,
pub dash: Dash,
}Expand description
How a line is drawn: a width, a colour, and whether the points are
the corners of a polyline or the knots of a curve through them.
Fields§
§width: f32Stroke width in logical px. Round caps at both ends of every segment, which is also the join between two of them.
color: ColorThe stroke colour. Inside the core it rides in the node’s bg
slot, so a transition eases it and enter / exit can start
or end it there.
curve: boolDraw a smooth curve through the points (a centripetal Catmull-Rom
spline, flattened by flatten_curve) instead of the polyline. Two
points are a straight segment either way.
dash: DashThe marks and gaps the stroke is cut into; Dash::SOLID, the
default, is none.
Implementations§
Source§impl Stroke
impl Stroke
pub fn new(width: f32, color: Color) -> Self
pub fn curve(self) -> Self
Sourcepub fn dash(self, on: f32, off: f32) -> Self
pub fn dash(self, on: f32, off: f32) -> Self
Cuts the stroke into marks on long with gaps off long between
them; see Dash.
Sourcepub fn dashed(self, dash: Dash) -> Self
pub fn dashed(self, dash: Dash) -> Self
The whole pattern at once, for a dash-dot or one read from data.
Sourcepub fn dash_offset(self, offset: f32) -> Self
pub fn dash_offset(self, offset: f32) -> Self
How far into the pattern the stroke starts; see Dash::offset.