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) -> Stroke
pub fn curve(self) -> Stroke
Sourcepub fn dash(self, on: f32, off: f32) -> Stroke
pub fn dash(self, on: f32, off: f32) -> Stroke
Cuts the stroke into marks on long with gaps off long between
them; see Dash.
Sourcepub fn dashed(self, dash: Dash) -> Stroke
pub fn dashed(self, dash: Dash) -> Stroke
The whole pattern at once, for a dash-dot or one read from data.
Sourcepub fn dash_offset(self, offset: f32) -> Stroke
pub fn dash_offset(self, offset: f32) -> Stroke
How far into the pattern the stroke starts; see Dash::offset.
Trait Implementations§
impl Copy for Stroke
impl StructuralPartialEq for Stroke
Auto Trait Implementations§
impl Freeze for Stroke
impl RefUnwindSafe for Stroke
impl Send for Stroke
impl Sync for Stroke
impl Unpin for Stroke
impl UnsafeUnpin for Stroke
impl UnwindSafe for Stroke
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.