Struct embedded_graphics::style::PrimitiveStyle
source · #[non_exhaustive]pub struct PrimitiveStyle<C>where
C: PixelColor,{
pub fill_color: Option<C>,
pub stroke_color: Option<C>,
pub stroke_width: u32,
}
Expand description
Style properties for primitives.
PrimitiveStyle
can be applied to a primitive to define how the primitive
is drawn.
Because PrimitiveStyle
has the non_exhaustive
attribute, it cannot be created using a
struct literal. To create a PrimitiveStyle
, use the primitive_style!
macro or
PrimitiveStyleBuilder
.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.fill_color: Option<C>
Fill color of the primitive.
If fill_color
is set to None
no fill will be drawn.
stroke_color: Option<C>
Stroke color of the primitive.
If stroke_color
is set to None
or the stroke_width
is set to 0
no stroke will be
drawn.
stroke_width: u32
Stroke width in pixels.
Implementations§
source§impl<C> PrimitiveStyle<C>where
C: PixelColor,
impl<C> PrimitiveStyle<C>where
C: PixelColor,
sourcepub fn with_stroke(stroke_color: C, stroke_width: u32) -> Self
pub fn with_stroke(stroke_color: C, stroke_width: u32) -> Self
Creates a stroke primitive style.
If the stroke_width
is 0
the resulting style won’t draw a stroke.
Trait Implementations§
source§impl<C> Clone for PrimitiveStyle<C>where
C: PixelColor + Clone,
impl<C> Clone for PrimitiveStyle<C>where
C: PixelColor + Clone,
source§fn clone(&self) -> PrimitiveStyle<C>
fn clone(&self) -> PrimitiveStyle<C>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<C> Debug for PrimitiveStyle<C>where
C: PixelColor + Debug,
impl<C> Debug for PrimitiveStyle<C>where
C: PixelColor + Debug,
source§impl<C> Default for PrimitiveStyle<C>where
C: PixelColor,
impl<C> Default for PrimitiveStyle<C>where
C: PixelColor,
source§impl<C> Hash for PrimitiveStyle<C>where
C: PixelColor + Hash,
impl<C> Hash for PrimitiveStyle<C>where
C: PixelColor + Hash,
source§impl<C> Ord for PrimitiveStyle<C>where
C: PixelColor + Ord,
impl<C> Ord for PrimitiveStyle<C>where
C: PixelColor + Ord,
source§fn cmp(&self, other: &PrimitiveStyle<C>) -> Ordering
fn cmp(&self, other: &PrimitiveStyle<C>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<C> PartialEq for PrimitiveStyle<C>where
C: PixelColor + PartialEq,
impl<C> PartialEq for PrimitiveStyle<C>where
C: PixelColor + PartialEq,
source§fn eq(&self, other: &PrimitiveStyle<C>) -> bool
fn eq(&self, other: &PrimitiveStyle<C>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<C> PartialOrd for PrimitiveStyle<C>where
C: PixelColor + PartialOrd,
impl<C> PartialOrd for PrimitiveStyle<C>where
C: PixelColor + PartialOrd,
source§fn partial_cmp(&self, other: &PrimitiveStyle<C>) -> Option<Ordering>
fn partial_cmp(&self, other: &PrimitiveStyle<C>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<C> Copy for PrimitiveStyle<C>where
C: PixelColor + Copy,
impl<C> Eq for PrimitiveStyle<C>where
C: PixelColor + Eq,
impl<C> StructuralPartialEq for PrimitiveStyle<C>where
C: PixelColor,
Auto Trait Implementations§
impl<C> RefUnwindSafe for PrimitiveStyle<C>where
C: RefUnwindSafe,
impl<C> Send for PrimitiveStyle<C>where
C: Send,
impl<C> Sync for PrimitiveStyle<C>where
C: Sync,
impl<C> Unpin for PrimitiveStyle<C>where
C: Unpin,
impl<C> UnwindSafe for PrimitiveStyle<C>where
C: UnwindSafe,
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