pub struct Style {
pub fill: Option<Fill>,
pub stroke: Option<Stroke>,
pub transform: Transform2D,
}Expand description
Complete style for geometry rendering.
A style combines optional fill and stroke properties, along with a transform.
Fields§
§fill: Option<Fill>Optional fill properties
stroke: Option<Stroke>Optional stroke properties
transform: Transform2DTransform to apply to the geometry
Implementations§
Source§impl Style
impl Style
Sourcepub fn fill_color(color: Color) -> Self
pub fn fill_color(color: Color) -> Self
Create a fill-only style with a solid color.
Sourcepub fn stroke_color(color: Color, width: f32) -> Self
pub fn stroke_color(color: Color, width: f32) -> Self
Create a stroke-only style with a solid color.
Sourcepub fn fill_and_stroke(
fill_paint: impl Into<Paint>,
stroke_paint: impl Into<Paint>,
stroke_width: f32,
) -> Self
pub fn fill_and_stroke( fill_paint: impl Into<Paint>, stroke_paint: impl Into<Paint>, stroke_width: f32, ) -> Self
Create a style with both fill and stroke.
Sourcepub fn with_fill_paint(self, paint: impl Into<Paint>) -> Self
pub fn with_fill_paint(self, paint: impl Into<Paint>) -> Self
Set the fill paint.
Sourcepub fn with_fill_color(self, color: Color) -> Self
pub fn with_fill_color(self, color: Color) -> Self
Set the fill color.
Sourcepub fn with_stroke(self, stroke: Stroke) -> Self
pub fn with_stroke(self, stroke: Stroke) -> Self
Set the stroke.
Sourcepub fn with_stroke_paint(self, paint: impl Into<Paint>, width: f32) -> Self
pub fn with_stroke_paint(self, paint: impl Into<Paint>, width: f32) -> Self
Set the stroke paint and width.
Sourcepub fn with_stroke_color(self, color: Color, width: f32) -> Self
pub fn with_stroke_color(self, color: Color, width: f32) -> Self
Set the stroke color and width.
Sourcepub fn with_transform(self, transform: Transform2D) -> Self
pub fn with_transform(self, transform: Transform2D) -> Self
Set the transform.
Sourcepub fn has_stroke(&self) -> bool
pub fn has_stroke(&self) -> bool
Check if this style has a visible stroke.
Sourcepub fn is_visible(&self) -> bool
pub fn is_visible(&self) -> bool
Check if this style is visible (has fill or stroke).
Sourcepub fn get_fill_color(&self) -> Option<Color>
pub fn get_fill_color(&self) -> Option<Color>
Get the fill color (for solid fills).
Sourcepub fn get_stroke_color(&self) -> Option<Color>
pub fn get_stroke_color(&self) -> Option<Color>
Get the stroke color (for solid strokes).
Trait Implementations§
impl StructuralPartialEq for Style
Auto Trait Implementations§
impl Freeze for Style
impl RefUnwindSafe for Style
impl Send for Style
impl Sync for Style
impl Unpin for Style
impl UnsafeUnpin for Style
impl UnwindSafe for Style
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more