Skip to main content

cranpose_ui/text/
decoration.rs

1use crate::modifier::Color;
2
3#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
4pub struct TextDecoration(u32);
5
6impl TextDecoration {
7    pub const NONE: Self = Self(0);
8    pub const UNDERLINE: Self = Self(1);
9    pub const LINE_THROUGH: Self = Self(2);
10
11    pub fn contains(&self, other: Self) -> bool {
12        (self.0 & other.0) != 0
13    }
14
15    pub fn combine(self, other: Self) -> Self {
16        Self(self.0 | other.0)
17    }
18}
19
20impl Default for TextDecoration {
21    fn default() -> Self {
22        Self::NONE
23    }
24}
25
26#[derive(Clone, Copy, Debug, PartialEq)]
27pub struct Shadow {
28    pub color: Color,
29    pub offset: crate::modifier::Point, // Using Point as Offset counterpart
30    pub blur_radius: f32,
31}
32
33impl Default for Shadow {
34    fn default() -> Self {
35        Self {
36            color: Color(0.0, 0.0, 0.0, 1.0), // Black default
37            offset: crate::modifier::Point::new(0.0, 0.0),
38            blur_radius: 0.0,
39        }
40    }
41}