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
Creates a stroke primitive style.
If the stroke_width is 0 the resulting style won’t draw a stroke.
Returns if a primitive drawn with this style is completely transparent.
Trait Implementations
Performs the conversion.
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
Returns the bounding box using the given style.
Returns the bounding box using the given style.
Returns the bounding box using the given style.
Returns the bounding box using the given style.
Returns the bounding box using the given style.
Returns the bounding box using the given style.
Returns the bounding box using the given style.
Returns the bounding box using the given style.
Returns the bounding box using the given style.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
Mutably borrows from an owned value. Read more
Casts the value.
Performs the conversion.
Performs the conversion.
Casts the value.
type Output = T
type Output = TShould always be Self
Casts the value.
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.
Casts the value.
pub fn vzip(self) -> VCasts the value.