Struct kludgine::shapes::StrokeOptions
source · pub struct StrokeOptions<Unit> {
pub color: Color,
pub line_width: Unit,
pub line_join: LineJoin,
pub start_cap: LineCap,
pub end_cap: LineCap,
pub miter_limit: f32,
pub tolerance: f32,
}
Expand description
Options for stroking lines on a path.
Fields§
§color: Color
The color to apply to the stroke.
line_width: Unit
The width of the line.
line_join: LineJoin
See the SVG specification.
Default value: LineJoin::Miter
.
start_cap: LineCap
What cap to use at the start of each sub-path.
Default value: LineCap::Butt
.
end_cap: LineCap
What cap to use at the end of each sub-path.
Default value: LineCap::Butt
.
miter_limit: f32
See the SVG specification.
Must be greater than or equal to 1.0.
Default value: StrokeOptions::DEFAULT_MITER_LIMIT
.
tolerance: f32
Maximum allowed distance to the path when building an approximation.
See Flattening and tolerance.
Default value: StrokeOptions::DEFAULT_TOLERANCE
.
Implementations§
source§impl<Unit> StrokeOptions<Unit>
impl<Unit> StrokeOptions<Unit>
sourcepub fn start_cap(self, cap: LineCap) -> Self
pub fn start_cap(self, cap: LineCap) -> Self
Sets the line cap style for the start of line segments and returns self.
sourcepub fn end_cap(self, cap: LineCap) -> Self
pub fn end_cap(self, cap: LineCap) -> Self
Sets the line cap style for the end of line segments and returns self.
sourcepub fn miter_limit(self, limit: f32) -> Self
pub fn miter_limit(self, limit: f32) -> Self
Sets the miter limit and returns self.
source§impl StrokeOptions<Px>
impl StrokeOptions<Px>
source§impl StrokeOptions<Lp>
impl StrokeOptions<Lp>
sourcepub fn mm_wide(mm: impl Into<FloatOrInt>) -> Self
pub fn mm_wide(mm: impl Into<FloatOrInt>) -> Self
Returns the default options with the line width specified in millimeters.
sourcepub fn cm_wide(cm: impl Into<FloatOrInt>) -> Self
pub fn cm_wide(cm: impl Into<FloatOrInt>) -> Self
Returns the default options with the line width specified in centimeters.
sourcepub fn points_wide(points: impl Into<FloatOrInt>) -> Self
pub fn points_wide(points: impl Into<FloatOrInt>) -> Self
Returns the default options with the line width specified in points (1/72 of an inch).
sourcepub fn inches_wide(inches: impl Into<FloatOrInt>) -> Self
pub fn inches_wide(inches: impl Into<FloatOrInt>) -> Self
Returns the default options with the line width specified in inches.
Trait Implementations§
source§impl<Unit: Clone> Clone for StrokeOptions<Unit>
impl<Unit: Clone> Clone for StrokeOptions<Unit>
source§fn clone(&self) -> StrokeOptions<Unit>
fn clone(&self) -> StrokeOptions<Unit>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<Unit: Debug> Debug for StrokeOptions<Unit>
impl<Unit: Debug> Debug for StrokeOptions<Unit>
source§impl<Unit> Default for StrokeOptions<Unit>where
Unit: DefaultStrokeWidth,
impl<Unit> Default for StrokeOptions<Unit>where
Unit: DefaultStrokeWidth,
source§impl<Unit> From<Color> for StrokeOptions<Unit>where
Unit: DefaultStrokeWidth,
impl<Unit> From<Color> for StrokeOptions<Unit>where
Unit: DefaultStrokeWidth,
source§impl<Unit> From<StrokeOptions<Unit>> for StrokeOptionswhere
Unit: FloatConversion<Float = f32>,
impl<Unit> From<StrokeOptions<Unit>> for StrokeOptionswhere
Unit: FloatConversion<Float = f32>,
source§fn from(options: StrokeOptions<Unit>) -> Self
fn from(options: StrokeOptions<Unit>) -> Self
source§impl<Unit: PartialEq> PartialEq for StrokeOptions<Unit>
impl<Unit: PartialEq> PartialEq for StrokeOptions<Unit>
source§fn eq(&self, other: &StrokeOptions<Unit>) -> bool
fn eq(&self, other: &StrokeOptions<Unit>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<Unit> ScreenScale for StrokeOptions<Unit>where
Unit: ScreenScale<Px = Px, Lp = Lp, UPx = UPx>,
impl<Unit> ScreenScale for StrokeOptions<Unit>where
Unit: ScreenScale<Px = Px, Lp = Lp, UPx = UPx>,
§type Lp = StrokeOptions<Lp>
type Lp = StrokeOptions<Lp>
Lp
.§type Px = StrokeOptions<Px>
type Px = StrokeOptions<Px>
Px
.§type UPx = StrokeOptions<UPx>
type UPx = StrokeOptions<UPx>
UPx
.source§fn into_px(self, scale: Fraction) -> Self::Px
fn into_px(self, scale: Fraction) -> Self::Px
Px
)
using the provided scale
factor.source§fn from_px(px: Self::Px, scale: Fraction) -> Self
fn from_px(px: Self::Px, scale: Fraction) -> Self
scale
factor.source§fn into_lp(self, scale: Fraction) -> Self::Lp
fn into_lp(self, scale: Fraction) -> Self::Lp
Lp
) using the provided scale
factor.source§fn from_lp(lp: Self::Lp, scale: Fraction) -> Self
fn from_lp(lp: Self::Lp, scale: Fraction) -> Self
scale
factor.impl<Unit: Copy> Copy for StrokeOptions<Unit>
impl<Unit> StructuralPartialEq for StrokeOptions<Unit>
Auto Trait Implementations§
impl<Unit> Freeze for StrokeOptions<Unit>where
Unit: Freeze,
impl<Unit> RefUnwindSafe for StrokeOptions<Unit>where
Unit: RefUnwindSafe,
impl<Unit> Send for StrokeOptions<Unit>where
Unit: Send,
impl<Unit> Sync for StrokeOptions<Unit>where
Unit: Sync,
impl<Unit> Unpin for StrokeOptions<Unit>where
Unit: Unpin,
impl<Unit> UnwindSafe for StrokeOptions<Unit>where
Unit: UnwindSafe,
Blanket Implementations§
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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
source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters
when converting.source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar> ) -> T
self
into C
, using the provided parameters.§impl<A> Cast for A
impl<A> Cast for A
source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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
.§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
.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle
.source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other
into Self
, while performing the appropriate scaling,
rounding and clamping.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
source§fn into_angle(self) -> U
fn into_angle(self) -> U
T
.source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters
when converting.source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar> ) -> T
self
into C
, using the provided parameters.source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
source§fn into_color(self) -> U
fn into_color(self) -> U
source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
§impl<Unit> IntoComponents<Unit> for Unitwhere
Unit: Copy,
impl<Unit> IntoComponents<Unit> for Unitwhere
Unit: Copy,
§fn into_components(self) -> (Unit, Unit)
fn into_components(self) -> (Unit, Unit)
source§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self
into T
, while performing the appropriate scaling,
rounding and clamping.source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors
fails to cast.source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains
the unclamped color. Read more