logo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
mod add_assign;
mod convert;
mod draw_style;
use crate::{resolver::StyleContext, *};
use std::{cmp::Ordering, ops::AddAssign};

/// Trait for drawing a shape with a style.
pub trait GraphicsStyle {
    /// Draws a shape with a style.
    ///
    /// # Arguments
    ///
    /// * `state`:
    ///
    /// returns: ()
    ///
    /// # Examples
    ///
    /// ```rust
    /// 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);
    ///     }
    /// }
    /// ```
    fn draw_style(&self, state: &mut StyleContext);
}