[][src]Struct bevy_svg_map::SvgStyle

pub struct SvgStyle(_);

Implementations

impl SvgStyle[src]

Translater from SVG style (&str slice) to bevy (passing ) The string slice is parsed into a HashMap. Lazy accession to its values. Chief struct to implement the user-provided strategy to associate components/materials given the style of the path.

Except stroke_opacity() and fill_opacity() that return a Result, all the types return an Option<T>. More properties could be exposed but these are enough for now to build things.

Example

use bevy_svg_map::SvgStyle;
use bevy::prelude::Color;

let style = SvgStyle::from("fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1");
assert_eq!(
    style.stroke().unwrap(),
    Color {
        r: 0f32,
        g: 0f32,
        b: 0f32,
        a: 1f32
    }
);

pub fn stroke(&self) -> Option<Color>[src]

pub fn fill(&self) -> Option<Color>[src]

pub fn stroke_dashmap(&self) -> Option<NumberList>[src]

pub fn stroke_opacity(&self) -> Result<f32, ParseFloatError>[src]

In both opacities, please remember that they return a Result (it may change in the future)


let style = SvgStyle::from("fill:none;stroke:#000000;stroke-width:1.0px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.5");
assert_eq!(
    style.stroke_opacity().unwrap(),
    0.5
);

pub fn fill_opacity(&self) -> Result<f32, ParseFloatError>[src]

pub fn stroke_width(&self) -> Option<f32>[src]

Trait Implementations

impl Debug for SvgStyle[src]

impl Default for SvgStyle[src]

impl<'_> From<&'_ str> for SvgStyle[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Component for T where
    T: 'static + Send + Sync

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any

impl<T> From<T> for T[src]

impl<T> FromResources for T where
    T: Default

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Resource for T where
    T: 'static + Send + Sync

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,