1/// The color type that is used by all the backend
2#[derive(Clone, Copy)]
3pub struct BackendColor {
4pub alpha: f64,
5pub rgb: (u8, u8, u8),
6}
78impl BackendColor {
9#[inline(always)]
10pub fn mix(&self, alpha: f64) -> Self {
11Self {
12 alpha: self.alpha * alpha,
13 rgb: self.rgb,
14 }
15 }
16}
1718/// The style data for the backend drawing API
19pub trait BackendStyle {
20/// Get the color of current style
21fn color(&self) -> BackendColor;
2223/// Get the stroke width of current style
24fn stroke_width(&self) -> u32 {
251
26}
27}
2829impl BackendStyle for BackendColor {
30fn color(&self) -> BackendColor {
31*self
32}
33}