summaryrefslogtreecommitdiff
path: root/rust/crates/scene/src/mask.rs
diff options
context:
space:
mode:
authorcashmere <cashmere@autistici.org>2026-07-28 19:41:16 +0200
committercashmere <cashmere@autistici.org>2026-07-28 19:41:16 +0200
commitf5a82152394fde4d8f740f664ab7737b82861618 (patch)
tree5a51b181abead1ce03d2dbfc12b77918d3be0e1b /rust/crates/scene/src/mask.rs
parente837e7504379e100ff3b56282577ec67bb88bec9 (diff)
downloadopencut-f5a82152394fde4d8f740f664ab7737b82861618.tar.gz
feat: GPUI desktop port foundation
- scene crate: full project/scene/element model, serde round-trip proven against the web SerializedProject shape - transfer crate: .ocp zip container, cross-compat with web fflate archives proven in both directions - storage crate: filesystem project store replacing IndexedDB, .ocp import/export - media crate: ffmpeg-next 8 decoder (frames, audio, thumbnails, waveform summaries) - playback crate: wall-clock anchored, frame-rounded playback clock - gpu crate: native texture readback; compositor renders headless offscreen on Vulkan (spike test) - flake devshell: rust toolchain, GPUI native deps, ffmpeg dev, bindgen clang args; GPUI hello-world builds - port plan in notes/gpui-port.md
Diffstat (limited to 'rust/crates/scene/src/mask.rs')
-rw-r--r--rust/crates/scene/src/mask.rs128
1 files changed, 128 insertions, 0 deletions
diff --git a/rust/crates/scene/src/mask.rs b/rust/crates/scene/src/mask.rs
new file mode 100644
index 00000000..12f026d2
--- /dev/null
+++ b/rust/crates/scene/src/mask.rs
@@ -0,0 +1,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 },
+}