pub struct Dash {
pub pattern: [f32; 4],
pub offset: f32,
}Expand description
A stroke’s dash pattern (backlog V2): a mark, a gap, a second mark and a second gap, repeated along the stroke’s length from its first point.
The lengths are the ones seen, in logical px. Every mark is
round-capped, as the stroke itself is, so a mark on long is drawn as
a capsule whose centre line is on − width long, and a mark no longer
than the stroke is wide is a dot. (SVG’s stroke-dasharray measures
the centre line instead, which with a round cap makes 4 4 at a width
of 4 a solid line; this pattern at any width is SVG’s
on − width, off + width.) The first mark’s cap sits where a solid
stroke’s would, half the width before the first point.
The pattern runs along the arc length of the whole stroke, so it keeps
its phase across the corners of a polyline and the pieces of a curve;
on a path it restarts at every subpath, as SVG’s does.
Fields§
§pattern: [f32; 4]Mark, gap, mark, gap. A two-length pattern is the same pair twice.
offset: f32How far into the pattern the stroke starts, in logical px: growing it moves the marks towards the stroke’s first point, which is what a marquee’s marching ants are. Any number; it wraps.
Implementations§
Source§impl Dash
impl Dash
Sourcepub fn of(lengths: &[f32]) -> Option<Dash>
pub fn of(lengths: &[f32]) -> Option<Dash>
The pattern as the bindings spell it: one length (marks and gaps alike), two (a mark and a gap) or four (a mark, a gap, a second mark, a second gap — a dash-dot). None for any other count.
Sourcepub fn offset(self, offset: f32) -> Dash
pub fn offset(self, offset: f32) -> Dash
Self::offset set.
Trait Implementations§
impl Copy for Dash
impl StructuralPartialEq for Dash
Auto Trait Implementations§
impl Freeze for Dash
impl RefUnwindSafe for Dash
impl Send for Dash
impl Sync for Dash
impl Unpin for Dash
impl UnsafeUnpin for Dash
impl UnwindSafe for Dash
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.