Struct embedded_graphics::primitives::PrimitiveStyle [−][src]
#[non_exhaustive]pub struct PrimitiveStyle<C> where
C: PixelColor, { pub fill_color: Option<C>, pub stroke_color: Option<C>, pub stroke_width: u32, pub stroke_alignment: StrokeAlignment, }
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, the with_stroke and
with_fill methods can be used for styles that only require a stroke or
fill respectively. For more complex styles, use the PrimitiveStyleBuilder.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
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: u32Stroke width in pixels.
stroke_alignment: StrokeAlignmentStroke alignment.
The stroke alignment sets if the stroke is drawn inside, outside or centered on the outline of a shape.
This property only applies to closed shapes (rectangle, circle, …) and is ignored for open shapes (line, …).
Implementations
impl<C> PrimitiveStyle<C> where
C: PixelColor, [src]
impl<C> PrimitiveStyle<C> where
C: PixelColor, [src]pub fn with_stroke(stroke_color: C, stroke_width: u32) -> Self[src]
pub fn with_stroke(stroke_color: C, stroke_width: u32) -> Self[src]Creates a stroke primitive style.
If the stroke_width is 0 the resulting style won’t draw a stroke.
pub fn is_transparent(&self) -> bool[src]
pub fn is_transparent(&self) -> bool[src]Returns if a primitive drawn with this style is completely transparent.
Trait Implementations
impl<C: Clone> Clone for PrimitiveStyle<C> where
C: PixelColor, [src]
impl<C: Clone> Clone for PrimitiveStyle<C> where
C: PixelColor, [src]fn clone(&self) -> PrimitiveStyle<C>[src]
fn clone(&self) -> PrimitiveStyle<C>[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]Performs copy-assignment from source. Read more
impl<C: Debug> Debug for PrimitiveStyle<C> where
C: PixelColor, [src]
impl<C: Debug> Debug for PrimitiveStyle<C> where
C: PixelColor, [src]impl<C> Default for PrimitiveStyle<C> where
C: PixelColor, [src]
impl<C> Default for PrimitiveStyle<C> where
C: PixelColor, [src]impl<C> From<&'_ PrimitiveStyle<C>> for PrimitiveStyleBuilder<C> where
C: PixelColor, [src]
impl<C> From<&'_ PrimitiveStyle<C>> for PrimitiveStyleBuilder<C> where
C: PixelColor, [src]fn from(style: &PrimitiveStyle<C>) -> Self[src]
fn from(style: &PrimitiveStyle<C>) -> Self[src]Performs the conversion.
impl<C: Hash> Hash for PrimitiveStyle<C> where
C: PixelColor, [src]
impl<C: Hash> Hash for PrimitiveStyle<C> where
C: PixelColor, [src]impl<C: Ord> Ord for PrimitiveStyle<C> where
C: PixelColor, [src]
impl<C: Ord> Ord for PrimitiveStyle<C> where
C: PixelColor, [src]impl<C: PartialEq> PartialEq<PrimitiveStyle<C>> for PrimitiveStyle<C> where
C: PixelColor, [src]
impl<C: PartialEq> PartialEq<PrimitiveStyle<C>> for PrimitiveStyle<C> where
C: PixelColor, [src]fn eq(&self, other: &PrimitiveStyle<C>) -> bool[src]
fn eq(&self, other: &PrimitiveStyle<C>) -> bool[src]This method tests for self and other values to be equal, and is used
by ==. Read more
fn ne(&self, other: &PrimitiveStyle<C>) -> bool[src]
fn ne(&self, other: &PrimitiveStyle<C>) -> bool[src]This method tests for !=.
impl<C: PartialOrd> PartialOrd<PrimitiveStyle<C>> for PrimitiveStyle<C> where
C: PixelColor, [src]
impl<C: PartialOrd> PartialOrd<PrimitiveStyle<C>> for PrimitiveStyle<C> where
C: PixelColor, [src]fn partial_cmp(&self, other: &PrimitiveStyle<C>) -> Option<Ordering>[src]
fn partial_cmp(&self, other: &PrimitiveStyle<C>) -> Option<Ordering>[src]This method returns an ordering between self and other values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl<C: PixelColor> StyledDimensions<PrimitiveStyle<C>> for Arc[src]
impl<C: PixelColor> StyledDimensions<PrimitiveStyle<C>> for Arc[src]fn styled_bounding_box(&self, style: &PrimitiveStyle<C>) -> Rectangle[src]
fn styled_bounding_box(&self, style: &PrimitiveStyle<C>) -> Rectangle[src]Returns the bounding box using the given style.
impl<C: PixelColor> StyledDimensions<PrimitiveStyle<C>> for Circle[src]
impl<C: PixelColor> StyledDimensions<PrimitiveStyle<C>> for Circle[src]fn styled_bounding_box(&self, style: &PrimitiveStyle<C>) -> Rectangle[src]
fn styled_bounding_box(&self, style: &PrimitiveStyle<C>) -> Rectangle[src]Returns the bounding box using the given style.
impl<C: PixelColor> StyledDimensions<PrimitiveStyle<C>> for Ellipse[src]
impl<C: PixelColor> StyledDimensions<PrimitiveStyle<C>> for Ellipse[src]fn styled_bounding_box(&self, style: &PrimitiveStyle<C>) -> Rectangle[src]
fn styled_bounding_box(&self, style: &PrimitiveStyle<C>) -> Rectangle[src]Returns the bounding box using the given style.
impl<C: PixelColor> StyledDimensions<PrimitiveStyle<C>> for Line[src]
impl<C: PixelColor> StyledDimensions<PrimitiveStyle<C>> for Line[src]fn styled_bounding_box(&self, style: &PrimitiveStyle<C>) -> Rectangle[src]
fn styled_bounding_box(&self, style: &PrimitiveStyle<C>) -> Rectangle[src]Returns the bounding box using the given style.
impl<C: PixelColor> StyledDimensions<PrimitiveStyle<C>> for Polyline<'_>[src]
impl<C: PixelColor> StyledDimensions<PrimitiveStyle<C>> for Polyline<'_>[src]fn styled_bounding_box(&self, style: &PrimitiveStyle<C>) -> Rectangle[src]
fn styled_bounding_box(&self, style: &PrimitiveStyle<C>) -> Rectangle[src]Returns the bounding box using the given style.
impl<C: PixelColor> StyledDimensions<PrimitiveStyle<C>> for Rectangle[src]
impl<C: PixelColor> StyledDimensions<PrimitiveStyle<C>> for Rectangle[src]fn styled_bounding_box(&self, style: &PrimitiveStyle<C>) -> Rectangle[src]
fn styled_bounding_box(&self, style: &PrimitiveStyle<C>) -> Rectangle[src]Returns the bounding box using the given style.
impl<C: PixelColor> StyledDimensions<PrimitiveStyle<C>> for RoundedRectangle[src]
impl<C: PixelColor> StyledDimensions<PrimitiveStyle<C>> for RoundedRectangle[src]fn styled_bounding_box(&self, style: &PrimitiveStyle<C>) -> Rectangle[src]
fn styled_bounding_box(&self, style: &PrimitiveStyle<C>) -> Rectangle[src]Returns the bounding box using the given style.
impl<C: PixelColor> StyledDimensions<PrimitiveStyle<C>> for Sector[src]
impl<C: PixelColor> StyledDimensions<PrimitiveStyle<C>> for Sector[src]fn styled_bounding_box(&self, style: &PrimitiveStyle<C>) -> Rectangle[src]
fn styled_bounding_box(&self, style: &PrimitiveStyle<C>) -> Rectangle[src]Returns the bounding box using the given style.
impl<C: PixelColor> StyledDimensions<PrimitiveStyle<C>> for Triangle[src]
impl<C: PixelColor> StyledDimensions<PrimitiveStyle<C>> for Triangle[src]fn styled_bounding_box(&self, style: &PrimitiveStyle<C>) -> Rectangle[src]
fn styled_bounding_box(&self, style: &PrimitiveStyle<C>) -> Rectangle[src]Returns the bounding box using the given style.
impl<C: PixelColor> StyledDrawable<PrimitiveStyle<C>> for Arc[src]
impl<C: PixelColor> StyledDrawable<PrimitiveStyle<C>> for Arc[src]type Color = C
type Color = CColor type.
fn draw_styled<D>(
&self,
style: &PrimitiveStyle<C>,
target: &mut D
) -> Result<Self::Output, D::Error> where
D: DrawTarget<Color = C>, [src]
fn draw_styled<D>(
&self,
style: &PrimitiveStyle<C>,
target: &mut D
) -> Result<Self::Output, D::Error> where
D: DrawTarget<Color = C>, [src]Draws the primitive using the given style.
impl<C: PixelColor> StyledDrawable<PrimitiveStyle<C>> for Circle[src]
impl<C: PixelColor> StyledDrawable<PrimitiveStyle<C>> for Circle[src]type Color = C
type Color = CColor type.
fn draw_styled<D>(
&self,
style: &PrimitiveStyle<C>,
target: &mut D
) -> Result<Self::Output, D::Error> where
D: DrawTarget<Color = C>, [src]
fn draw_styled<D>(
&self,
style: &PrimitiveStyle<C>,
target: &mut D
) -> Result<Self::Output, D::Error> where
D: DrawTarget<Color = C>, [src]Draws the primitive using the given style.
impl<C: PixelColor> StyledDrawable<PrimitiveStyle<C>> for Ellipse[src]
impl<C: PixelColor> StyledDrawable<PrimitiveStyle<C>> for Ellipse[src]type Color = C
type Color = CColor type.
fn draw_styled<D>(
&self,
style: &PrimitiveStyle<C>,
target: &mut D
) -> Result<Self::Output, D::Error> where
D: DrawTarget<Color = C>, [src]
fn draw_styled<D>(
&self,
style: &PrimitiveStyle<C>,
target: &mut D
) -> Result<Self::Output, D::Error> where
D: DrawTarget<Color = C>, [src]Draws the primitive using the given style.
impl<C: PixelColor> StyledDrawable<PrimitiveStyle<C>> for Line[src]
impl<C: PixelColor> StyledDrawable<PrimitiveStyle<C>> for Line[src]type Color = C
type Color = CColor type.
fn draw_styled<D>(
&self,
style: &PrimitiveStyle<C>,
target: &mut D
) -> Result<Self::Output, D::Error> where
D: DrawTarget<Color = C>, [src]
fn draw_styled<D>(
&self,
style: &PrimitiveStyle<C>,
target: &mut D
) -> Result<Self::Output, D::Error> where
D: DrawTarget<Color = C>, [src]Draws the primitive using the given style.
impl<C: PixelColor> StyledDrawable<PrimitiveStyle<C>> for Polyline<'_>[src]
impl<C: PixelColor> StyledDrawable<PrimitiveStyle<C>> for Polyline<'_>[src]type Color = C
type Color = CColor type.
fn draw_styled<D>(
&self,
style: &PrimitiveStyle<C>,
target: &mut D
) -> Result<Self::Output, D::Error> where
D: DrawTarget<Color = C>, [src]
fn draw_styled<D>(
&self,
style: &PrimitiveStyle<C>,
target: &mut D
) -> Result<Self::Output, D::Error> where
D: DrawTarget<Color = C>, [src]Draws the primitive using the given style.
impl<C: PixelColor> StyledDrawable<PrimitiveStyle<C>> for Rectangle[src]
impl<C: PixelColor> StyledDrawable<PrimitiveStyle<C>> for Rectangle[src]type Color = C
type Color = CColor type.
fn draw_styled<D>(
&self,
style: &PrimitiveStyle<C>,
target: &mut D
) -> Result<Self::Output, D::Error> where
D: DrawTarget<Color = C>, [src]
fn draw_styled<D>(
&self,
style: &PrimitiveStyle<C>,
target: &mut D
) -> Result<Self::Output, D::Error> where
D: DrawTarget<Color = C>, [src]Draws the primitive using the given style.
impl<C: PixelColor> StyledDrawable<PrimitiveStyle<C>> for RoundedRectangle[src]
impl<C: PixelColor> StyledDrawable<PrimitiveStyle<C>> for RoundedRectangle[src]type Color = C
type Color = CColor type.
fn draw_styled<D>(
&self,
style: &PrimitiveStyle<C>,
target: &mut D
) -> Result<Self::Output, D::Error> where
D: DrawTarget<Color = C>, [src]
fn draw_styled<D>(
&self,
style: &PrimitiveStyle<C>,
target: &mut D
) -> Result<Self::Output, D::Error> where
D: DrawTarget<Color = C>, [src]Draws the primitive using the given style.
impl<C: PixelColor> StyledDrawable<PrimitiveStyle<C>> for Sector[src]
impl<C: PixelColor> StyledDrawable<PrimitiveStyle<C>> for Sector[src]type Color = C
type Color = CColor type.
fn draw_styled<D>(
&self,
style: &PrimitiveStyle<C>,
target: &mut D
) -> Result<Self::Output, D::Error> where
D: DrawTarget<Color = C>, [src]
fn draw_styled<D>(
&self,
style: &PrimitiveStyle<C>,
target: &mut D
) -> Result<Self::Output, D::Error> where
D: DrawTarget<Color = C>, [src]Draws the primitive using the given style.
impl<C: PixelColor> StyledDrawable<PrimitiveStyle<C>> for Triangle[src]
impl<C: PixelColor> StyledDrawable<PrimitiveStyle<C>> for Triangle[src]type Color = C
type Color = CColor type.
fn draw_styled<D>(
&self,
style: &PrimitiveStyle<C>,
target: &mut D
) -> Result<Self::Output, D::Error> where
D: DrawTarget<Color = C>, [src]
fn draw_styled<D>(
&self,
style: &PrimitiveStyle<C>,
target: &mut D
) -> Result<Self::Output, D::Error> where
D: DrawTarget<Color = C>, [src]Draws the primitive using the given style.
impl<C: Copy> Copy for PrimitiveStyle<C> where
C: PixelColor, [src]
C: PixelColor,
impl<C: Eq> Eq for PrimitiveStyle<C> where
C: PixelColor, [src]
C: PixelColor,
impl<C> StructuralEq for PrimitiveStyle<C> where
C: PixelColor, [src]
C: PixelColor,
impl<C> StructuralPartialEq for PrimitiveStyle<C> where
C: PixelColor, [src]
C: PixelColor,
Auto Trait Implementations
impl<C> RefUnwindSafe for PrimitiveStyle<C> where
C: RefUnwindSafe,
C: RefUnwindSafe,
impl<C> Send for PrimitiveStyle<C> where
C: Send,
C: Send,
impl<C> Sync for PrimitiveStyle<C> where
C: Sync,
C: Sync,
impl<C> Unpin for PrimitiveStyle<C> where
C: Unpin,
C: Unpin,
impl<C> UnwindSafe for PrimitiveStyle<C> where
C: UnwindSafe,
C: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>, [src]
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>, [src]pub fn lossless_try_into(self) -> Option<Dst>[src]
pub fn lossless_try_into(self) -> Option<Dst>[src]Performs the conversion.
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>, [src]
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>, [src]pub fn lossy_into(self) -> Dst[src]
pub fn lossy_into(self) -> Dst[src]Performs the conversion.
impl<T> Same<T> for T
impl<T> Same<T> for Ttype Output = T
type Output = TShould always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>, pub fn to_subset(&self) -> Option<SS>
pub fn to_subset(&self) -> Option<SS>The inverse inclusion map: attempts to construct self from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> boolChecks if self is actually part of its subset T (and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SSUse with care! Same as self.to_subset but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SPThe inclusion map: converts self to the equivalent element of its superset.
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,