Struct floem_peniko::Stroke

source ·
pub struct Stroke {
    pub width: f32,
    pub join: Join,
    pub miter_limit: f32,
    pub start_cap: Cap,
    pub end_cap: Cap,
    pub dash_pattern: Dashes,
    pub dash_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.

§dash_pattern: Dashes

Lengths of dashes in alternating on/off order.

§dash_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 Stroke

source

pub fn new(width: f32) -> Self

Creates a new stroke with the specified width.

source

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

Builder method for setting the join style.

source

pub fn with_miter_limit(self, limit: f32) -> Self

Builder method for setting the limit for miter joins.

source

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

Builder method for setting the cap style for the start of the stroke.

source

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

Builder method for setting the cap style for the end of the stroke.

source

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

Builder method for setting the cap style.

source

pub fn with_dashes<P>(self, offset: f32, pattern: P) -> Self
where P: IntoIterator, P::Item: Borrow<f32>,

Builder method for setting the dashing parameters.

source

pub fn with_scale(self, yes: bool) -> Self

Builder method for setting whether or not the stroke should be affected by the scale of any applied transform.

Trait Implementations§

source§

impl Clone for Stroke

source§

fn clone(&self) -> Stroke

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 Debug for Stroke

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> for StyleRef<'a>

source§

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

Converts to this type from the input type.
source§

impl From<Stroke> for Style

source§

fn from(stroke: Stroke) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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.