cranpose_text/
decoration.rs1use cranpose_ui_graphics::Color;
2
3#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
6pub struct TextDecoration(u32);
7
8impl TextDecoration {
9 pub const NONE: Self = Self(0);
11 pub const UNDERLINE: Self = Self(1);
13 pub const LINE_THROUGH: Self = Self(2);
15
16 pub fn contains(&self, other: Self) -> bool {
18 (self.0 | other.0) == self.0
19 }
20
21 pub fn combine(self, other: Self) -> Self {
23 Self(self.0 | other.0)
24 }
25}
26
27impl Default for TextDecoration {
28 fn default() -> Self {
29 Self::NONE
30 }
31}
32
33#[cfg(test)]
34#[path = "tests/decoration_tests.rs"]
35mod tests;
36
37#[derive(Clone, Copy, Debug, PartialEq)]
39pub struct Shadow {
40 pub color: Color,
42 pub offset: cranpose_ui_graphics::Point,
44 pub blur_radius: f32,
46}
47
48impl Default for Shadow {
49 fn default() -> Self {
50 Self {
51 color: Color(0.0, 0.0, 0.0, 1.0),
52 offset: cranpose_ui_graphics::Point::new(0.0, 0.0),
53 blur_radius: 0.0,
54 }
55 }
56}