pub struct Stroke {
pub width: f32,
pub cap: StrokeCap,
pub join: StrokeJoin,
}Expand description
Describes how an outline is stroked.
The stroke is centered on the geometry: it extends width / 2 to either
side of the path, matching Skia / Jetpack Compose semantics.
Fields§
§width: f32Total stroke width in the caller’s coordinate space (dp for
crate::DrawScope callers).
cap: StrokeCapHow the ends of an open stroked path are shaped.
join: StrokeJoinHow corners between stroked segments are shaped.
Implementations§
Source§impl Stroke
impl Stroke
Sourcepub const fn with_width(self, width: f32) -> Stroke
pub const fn with_width(self, width: f32) -> Stroke
Returns the stroke with its width replaced by width.
Sourcepub const fn with_cap(self, cap: StrokeCap) -> Stroke
pub const fn with_cap(self, cap: StrokeCap) -> Stroke
Returns the stroke with its cap replaced by cap.
Sourcepub const fn with_join(self, join: StrokeJoin) -> Stroke
pub const fn with_join(self, join: StrokeJoin) -> Stroke
Returns the stroke with its join replaced by join.
Sourcepub fn half_width(&self) -> f32
pub fn half_width(&self) -> f32
Half the stroke width, clamped to a finite non-negative value.
This is the amount the stroke bleeds outside (and inside) the geometry.
Sourcepub fn is_visible(&self) -> bool
pub fn is_visible(&self) -> bool
A stroke is renderable only when it has a strictly positive, finite width.
Trait Implementations§
impl Copy for Stroke
Source§impl RenderHash for Stroke
impl RenderHash for Stroke
Source§fn render_hash(&self) -> u64
fn render_hash(&self) -> u64
Returns a hash over exactly the values that change what is drawn. Equal values give equal
hashes.
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more