Trait graphics_style::GraphicsStyle
source · [−]pub trait GraphicsStyle {
fn draw_style(&self, state: &mut StyleContext);
}Expand description
Trait for drawing a shape with a style.
Required methods
fn draw_style(&self, state: &mut StyleContext)
fn draw_style(&self, state: &mut StyleContext)
Draws a shape with a style.
Arguments
state:
returns: ()
Examples
use graphics_style::{GraphicsStyle, StyleContext, RGBA};
pub struct CustomLineStyle {
pub width: f32,
pub color: RGBA,
}
impl GraphicsStyle for CustomLineStyle {
fn draw_style(&self, state: &mut StyleContext) {
state.line_width = Some(self.width);
state.line_color = Some(self.color);
}
}