1use ::serde::{Deserialize, Serialize};
2
3use crate::basic_types::StraightSRgba8;
4use crate::fixed::{Sfixed16P16, Sfixed8P8};
5use crate::float_is::Is;
6use crate::gradient::ColorStop;
7
8#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
9#[serde(rename_all = "snake_case")]
10pub struct Blur {
11 pub blur_x: Sfixed16P16,
12 pub blur_y: Sfixed16P16,
13 pub passes: u8,
14}
15
16#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
17#[serde(rename_all = "snake_case")]
18pub struct Bevel {
19 pub shadow_color: StraightSRgba8,
20 pub highlight_color: StraightSRgba8,
21 pub blur_x: Sfixed16P16,
22 pub blur_y: Sfixed16P16,
23 pub angle: Sfixed16P16,
24 pub distance: Sfixed16P16,
25 pub strength: Sfixed8P8,
26 pub inner: bool,
27 pub knockout: bool,
28 pub composite_source: bool,
29 pub on_top: bool,
30 pub passes: u8,
31}
32
33#[derive(Clone, Debug, Serialize, Deserialize)]
34#[serde(rename_all = "snake_case")]
35pub struct ColorMatrix {
36 pub matrix: [f32; 20],
37}
38
39impl ::std::cmp::PartialEq for ColorMatrix {
40 fn eq(&self, other: &Self) -> bool {
41 self.matrix.is(&other.matrix)
42 }
43
44 fn ne(&self, other: &Self) -> bool {
45 !self.eq(other)
46 }
47}
48
49impl ::std::cmp::Eq for ColorMatrix {}
50
51#[derive(Clone, Debug, Serialize, Deserialize)]
52#[serde(rename_all = "snake_case")]
53pub struct Convolution {
54 pub matrix_width: usize,
55 pub matrix_height: usize,
56 pub divisor: f32,
57 pub bias: f32,
58 pub matrix: Vec<f32>,
59 pub default_color: StraightSRgba8,
60 pub clamp: bool,
61 pub preserve_alpha: bool,
62}
63
64impl ::std::cmp::PartialEq for Convolution {
65 fn eq(&self, other: &Self) -> bool {
66 self.matrix_width == other.matrix_width
67 && self.matrix_height == other.matrix_height
68 && self.divisor.is(&other.divisor)
69 && self.bias.is(&other.bias)
70 && self.matrix.is(&other.matrix)
71 && self.default_color == other.default_color
72 && self.clamp == other.clamp
73 && self.preserve_alpha == other.preserve_alpha
74 }
75
76 fn ne(&self, other: &Self) -> bool {
77 !self.eq(other)
78 }
79}
80
81impl ::std::cmp::Eq for Convolution {}
82
83#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
84#[serde(rename_all = "snake_case")]
85pub struct DropShadow {
86 pub color: StraightSRgba8,
87 pub blur_x: Sfixed16P16,
88 pub blur_y: Sfixed16P16,
89 pub angle: Sfixed16P16,
90 pub distance: Sfixed16P16,
91 pub strength: Sfixed8P8,
92 pub inner: bool,
93 pub knockout: bool,
94 pub composite_source: bool,
95 pub passes: u8,
96}
97
98#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
99#[serde(rename_all = "snake_case")]
100pub struct Glow {
101 pub color: StraightSRgba8,
102 pub blur_x: Sfixed16P16,
103 pub blur_y: Sfixed16P16,
104 pub strength: Sfixed8P8,
105 pub inner: bool,
106 pub knockout: bool,
107 pub composite_source: bool,
108 pub passes: u8,
109}
110
111#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
112#[serde(rename_all = "snake_case")]
113pub struct GradientBevel {
114 pub gradient: Vec<ColorStop>,
115 pub blur_x: Sfixed16P16,
116 pub blur_y: Sfixed16P16,
117 pub angle: Sfixed16P16,
118 pub distance: Sfixed16P16,
119 pub strength: Sfixed8P8,
120 pub inner: bool,
121 pub knockout: bool,
122 pub composite_source: bool,
123 pub on_top: bool,
124 pub passes: u8,
125}
126
127#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
128#[serde(rename_all = "snake_case")]
129pub struct GradientGlow {
130 pub gradient: Vec<ColorStop>,
131 pub blur_x: Sfixed16P16,
132 pub blur_y: Sfixed16P16,
133 pub angle: Sfixed16P16,
134 pub distance: Sfixed16P16,
135 pub strength: Sfixed8P8,
136 pub inner: bool,
137 pub knockout: bool,
138 pub composite_source: bool,
139 pub on_top: bool,
140 pub passes: u8,
141}