Struct zeno::Stroke

source ·
pub struct Stroke<'a> {
    pub width: f32,
    pub join: Join,
    pub miter_limit: f32,
    pub start_cap: Cap,
    pub end_cap: Cap,
    pub dashes: &'a [f32],
    pub offset: f32,
    pub scale: bool,
}
Expand description

Describes the visual style of a stroke.

Fields§

§width: f32

Width of the stroke.

§join: Join

Style for connecting segments of the stroke.

§miter_limit: f32

Limit for miter joins.

§start_cap: Cap

Style for capping the beginning of an open subpath.

§end_cap: Cap

Style for capping the end of an open subpath.

§dashes: &'a [f32]

Lengths of dashes in alternating on/off order.

§offset: f32

Offset of the first dash.

§scale: bool

True if the stroke width should be affected by the scale of a transform.

Implementations§

source§

impl<'a> Stroke<'a>

source

pub fn new(width: f32) -> Self

Creates a new stroke style with the specified width.

source

pub fn width(&mut self, width: f32) -> &mut Self

Sets the width of the stroke. The default is 1.

source

pub fn join(&mut self, join: Join) -> &mut Self

Sets the join style that determines how individual segments of the path will be connected. The default is miter.

source

pub fn miter_limit(&mut self, limit: f32) -> &mut Self

Sets the limit for miter joins beyond which a bevel will be generated. The default is 4.

source

pub fn cap(&mut self, cap: Cap) -> &mut Self

Sets the cap style that will be generated at the start and end of the stroke. Note that this will override the individual start and end cap options. The default is butt.

source

pub fn caps(&mut self, start: Cap, end: Cap) -> &mut Self

Sets both the start and end cap styles for the stroke.

source

pub fn dash(&mut self, dashes: &'a [f32], offset: f32) -> &mut Self

Sets the dash array and offset of the stroke. The default is an empty array, meaning that the stroke will be drawn as a continuous line.

source

pub fn scale(&mut self, scale: bool) -> &mut Self

Sets whether or not scaling is applied to the stroke. The default is true.

Trait Implementations§

source§

impl<'a> Clone for Stroke<'a>

source§

fn clone(&self) -> Stroke<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for Stroke<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Stroke<'_>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'a> From<&'a Stroke<'a>> for Style<'a>

source§

fn from(style: &'a Stroke<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a mut Stroke<'a>> for Style<'a>

source§

fn from(style: &'a mut Stroke<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Stroke<'a>> for Style<'a>

source§

fn from(style: Stroke<'a>) -> Self

Converts to this type from the input type.
source§

impl<'a> Copy for Stroke<'a>

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Stroke<'a>

§

impl<'a> Send for Stroke<'a>

§

impl<'a> Sync for Stroke<'a>

§

impl<'a> Unpin for Stroke<'a>

§

impl<'a> UnwindSafe for Stroke<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.