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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Clone, Copy, Debug, Eq, PartialEq)]
#[serde(rename_all = "camelCase")]
pub enum StrokeAlign {
Inside,
Center,
Outside,
}
#[derive(Serialize, Deserialize, Clone, Copy, Debug, Eq, PartialEq)]
pub enum TextFontWeight {
#[serde(rename = "normal")]
Normal,
#[serde(rename = "bold")]
Bold,
}
#[derive(Serialize, Deserialize, Clone, Copy, Debug, Eq, PartialEq)]
pub enum TextFontStyle {
#[serde(rename = "normal")]
Normal,
#[serde(rename = "italic")]
Italic,
}
#[derive(Serialize, Deserialize, Clone, Copy, Debug, Eq, PartialEq)]
pub enum TextDecoration {
#[serde(rename = "none")]
None,
#[serde(rename = "underline")]
Underline,
#[serde(rename = "line-through")]
LineThrough,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct FreeformPathPoint {
pub id: String,
pub x: f64,
pub y: f64,
pub in_x: f64,
pub in_y: f64,
pub out_x: f64,
pub out_y: f64,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct SplitMaskParams {
pub feather: f64,
pub inverted: bool,
pub stroke_color: String,
pub stroke_width: f64,
pub stroke_align: StrokeAlign,
pub center_x: f64,
pub center_y: f64,
pub rotation: f64,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct RectangleMaskParams {
pub feather: f64,
pub inverted: bool,
pub stroke_color: String,
pub stroke_width: f64,
pub stroke_align: StrokeAlign,
pub center_x: f64,
pub center_y: f64,
pub width: f64,
pub height: f64,
pub rotation: f64,
pub scale: f64,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct TextMaskParams {
pub feather: f64,
pub inverted: bool,
pub stroke_color: String,
pub stroke_width: f64,
pub stroke_align: StrokeAlign,
pub content: String,
pub font_size: f64,
pub font_family: String,
pub font_weight: TextFontWeight,
pub font_style: TextFontStyle,
pub text_decoration: TextDecoration,
pub letter_spacing: f64,
pub line_height: f64,
pub center_x: f64,
pub center_y: f64,
pub rotation: f64,
pub scale: f64,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct FreeformPathMaskParams {
pub feather: f64,
pub inverted: bool,
pub stroke_color: String,
pub stroke_width: f64,
pub stroke_align: StrokeAlign,
pub path: Vec<FreeformPathPoint>,
pub closed: bool,
pub center_x: f64,
pub center_y: f64,
pub rotation: f64,
pub scale: f64,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(tag = "type", rename_all = "kebab-case")]
pub enum Mask {
Split { id: String, params: SplitMaskParams },
CinematicBars { id: String, params: RectangleMaskParams },
Rectangle { id: String, params: RectangleMaskParams },
Ellipse { id: String, params: RectangleMaskParams },
Heart { id: String, params: RectangleMaskParams },
Diamond { id: String, params: RectangleMaskParams },
Star { id: String, params: RectangleMaskParams },
Text { id: String, params: TextMaskParams },
Freeform { id: String, params: FreeformPathMaskParams },
}
|