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
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.

stroke_alignment: StrokeAlignment

Stroke 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 primitive style without fill and stroke.

Creates a stroke primitive style.

If the stroke_width is 0 the resulting style won’t draw a stroke.

Creates a fill primitive style.

Returns if a primitive drawn with this style is completely transparent.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

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

This method tests greater than or equal to (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.

Color type.

Output type.

Draws the primitive using the given style.

Color type.

Output type.

Draws the primitive using the given style.

Color type.

Output type.

Draws the primitive using the given style.

Color type.

Output type.

Draws the primitive using the given style.

Color type.

Output type.

Draws the primitive using the given style.

Color type.

Output type.

Draws the primitive using the given style.

Color type.

Output type.

Draws the primitive using the given style.

Color type.

Output type.

Draws the primitive using the given style.

Color type.

Output type.

Draws the primitive using the given style.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Casts the value.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Casts the value.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Casts the value.

Should always be Self

Casts the value.

Performance hack: Clone doesn’t get inlined for Copy types in debug mode, so make it inline anyway.

Tests if Self the same as the type T Read more

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Casts the value.

Casts the value.