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
use super::*;
#[derive(Clone, Copy, Debug, Default, PartialEq)]
#[cfg_attr(feature = "persistence", derive(serde::Deserialize, serde::Serialize))]
pub struct Stroke {
pub width: f32,
pub color: Color32,
}
impl Stroke {
pub fn none() -> Self {
Self::new(0.0, Color32::TRANSPARENT)
}
pub fn new(width: impl Into<f32>, color: impl Into<Color32>) -> Self {
Self {
width: width.into(),
color: color.into(),
}
}
}
impl<Color> From<(f32, Color)> for Stroke
where
Color: Into<Color32>,
{
fn from((width, color): (f32, Color)) -> Stroke {
Stroke::new(width, color)
}
}