#[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§
Source§impl<C> PrimitiveStyle<C>where
C: PixelColor,
impl<C> PrimitiveStyle<C>where
C: PixelColor,
Sourcepub const fn with_stroke(stroke_color: C, stroke_width: u32) -> Self
pub const 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.
Sourcepub const fn is_transparent(&self) -> bool
pub const fn is_transparent(&self) -> bool
Returns if a primitive drawn with this style is completely transparent.
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>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more