The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.
Rust ffmpegfree-video-editormodel-context-protocolnon-linear-editoroffline-firstopen-source-video-editorself-hostedvideo-editingvideo-editing-automationvideo-editing-softwarevideo-editing-toolsvideo-editorvoice-cloningyoutube-automationyoutube-shorts
feat(project): a transparent background - the frame is clear where nothing covers it, with a checker under the preview (#456)
Jareer870290a09151
diff --git a/src/crates/concat-api/src/lib.rs b/src/crates/concat-api/src/lib.rsindex b170d35b..ed482cc9 100644--- a/src/crates/concat-api/src/lib.rs+++ b/src/crates/concat-api/src/lib.rs@@ -527,7 +527,7 @@ impl Api {video.height,video.rate_num,video.rate_den,- [0, 0, 0],+ video.canvas,).map_err(ApiError::failed)?;self.adopt(info)@@ -1322,7 +1322,7 @@ mod tests {location: location.clone(),name: "Round trip".to_owned(),video: Some(VideoSettings {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],width: 1080,height: 1920,rate_num: 60,diff --git a/src/crates/concat-core/src/timeline.rs b/src/crates/concat-core/src/timeline.rsindex 7f737766..0d91eee0 100644--- a/src/crates/concat-core/src/timeline.rs+++ b/src/crates/concat-core/src/timeline.rs@@ -380,10 +380,11 @@ pub struct Timeline {pub width: u32,/// Output height in pixels.pub height: u32,- /// What shows where no picture covers the frame, as eight-bit- /// `[r, g, b]`: the project's canvas colour, black unless it was given- /// another. A transition to black still goes to black.- pub canvas: [u8; 3],+ /// What shows where no picture covers the frame, as eight-bit straight+ /// `[r, g, b, a]`: the project's canvas colour, opaque black unless it+ /// was given another, and clear for an overlay. A transition to black+ /// still goes to black.+ pub canvas: [u8; 4],tracks: Arena<Track>,clips: Arena<Clip>,order: Vec<TrackId>,@@ -396,7 +397,7 @@ impl Timeline {frame_rate,width,height,- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],tracks: Arena::new(),clips: Arena::new(),order: Vec::new(),diff --git a/src/crates/concat-export/src/lib.rs b/src/crates/concat-export/src/lib.rsindex 8455e6fe..111c6b8a 100644--- a/src/crates/concat-export/src/lib.rs+++ b/src/crates/concat-export/src/lib.rs@@ -468,10 +468,14 @@ pub struct ExportRequest {/// clocks and keyframe fractions keep their local timing.#[serde(default)]pub effect_time_offset: f64,- /// What shows where no picture covers the frame, `[r, g, b]`; black- /// when a request does not say. See `VideoSettings::canvas`.- #[serde(default)]- pub canvas: [u8; 3],+ /// What shows where no picture covers the frame, straight+ /// `[r, g, b, a]`; opaque black when a request does not say. See+ /// `VideoSettings::canvas`.+ #[serde(+ default = "opaque_black",+ deserialize_with = "concat_project::model::rgba_array"+ )]+ pub canvas: [u8; 4],/// The flattened clip list to render.pub clips: Vec<ExportClip>,}@@ -2267,10 +2271,19 @@ pub struct PreviewFrameRequest {/// What the timeline is output in; SDR when a request does not say.#[serde(default)]pub color_space: ColorSpace,- /// What shows where no picture covers the frame; black when a request- /// does not say.- #[serde(default)]- pub canvas: [u8; 3],+ /// What shows where no picture covers the frame; opaque black when a+ /// request does not say.+ #[serde(+ default = "opaque_black",+ deserialize_with = "concat_project::model::rgba_array"+ )]+ pub canvas: [u8; 4],+}++/// The canvas of a request that does not name one: what every frame had+/// before there was a choice. Not `[u8; 4]`'s default, which is clear.+fn opaque_black() -> [u8; 4] {+ concat_project::model::OPAQUE_BLACK}/// The signal a timeline of `space` is drawn for (`FramePlan::output`).@@ -2556,7 +2569,7 @@ pub fn preview_plan(rate_num: i64,rate_den: i64,color_space: ColorSpace,- canvas: [u8; 3],+ canvas: [u8; 4],) -> PreviewPlan {// A preview has no error to give, and a picture at the wrong pace beats// none; the document opens with a sane rate (VideoSettings::or) anyway.@@ -2720,7 +2733,7 @@ mod tests {time,width: 8,height: 8,- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],layers: vec![ground, top],treatments: Vec::new(),output: concat_core::frame::Signal::Sdr,@@ -2809,7 +2822,7 @@ mod tests {time,width: 16,height: 8,- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],layers: vec![ground_layer(solid([255, 0, 0, 255])), incoming],treatments: Vec::new(),output: concat_core::frame::Signal::Sdr,@@ -2934,7 +2947,7 @@ mod tests {one.media_height = Some(height);}let request = PreviewFrameRequest {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],time,width,height,@@ -3050,7 +3063,7 @@ mod tests {let pool = concat_media::ReaderPool::new(16 * 1024 * 1024, 2);let pixel = |clips: &[ExportClip], time: f64, x: u32, y: u32| -> [u8; 3] {let request = PreviewFrameRequest {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],time,width,height,@@ -3148,7 +3161,7 @@ mod tests {request_clip.crop = Some([0.0, 0.5, 0.0, 0.0]);request_clip.flip_h = true;let request = PreviewFrameRequest {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],time: 0.5,width,height,@@ -3214,7 +3227,7 @@ mod tests {request_clip.media_width = Some(64);request_clip.media_height = Some(64);let request = PreviewFrameRequest {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],time: 0.5,width: 64,height: 64,@@ -3240,7 +3253,7 @@ mod tests {let mut outliving = clip("video", 0, 0.0, 3.0, 0.0);outliving.path = path.to_string_lossy().into_owned();let late = PreviewFrameRequest {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],time: 2.5,width: 64,height: 64,@@ -3265,7 +3278,7 @@ mod tests {effected.media_height = Some(64);effected.effects = vec![AppliedFilter::new("concat.mono")];let filtered = PreviewFrameRequest {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],time: 0.5,width: 64,height: 64,@@ -3387,7 +3400,7 @@ mod tests {let pool = concat_media::ReaderPool::new(16 * 1024 * 1024, 2);let request = |clips: Vec<ExportClip>| PreviewFrameRequest {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],time: 1.0,width,height,@@ -3477,7 +3490,7 @@ mod tests {still.media_width = Some(32);still.media_height = Some(64);let request = PreviewFrameRequest {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],time: 0.5,width: 64,height: 64,@@ -3544,7 +3557,7 @@ mod tests {footage.media_height = Some(64);let nested = root.join("Movies").join("Concat");let request = ExportRequest {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],output: nested.join("out.mp4").to_string_lossy().into_owned(),width: 64,height: 64,@@ -3626,7 +3639,7 @@ mod tests {footage.media_height = Some(64);let output = dir.join("out.mp4");let request = ExportRequest {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],output: output.to_string_lossy().into_owned(),width: 64,height: 64,diff --git a/src/crates/concat-host/src/media.rs b/src/crates/concat-host/src/media.rsindex 9a18ed18..27f58d18 100644--- a/src/crates/concat-host/src/media.rs+++ b/src/crates/concat-host/src/media.rs@@ -1342,7 +1342,7 @@ mod tests {}).expect("places");let settings = DocumentSettings {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],name: name.to_owned(),width: 64,height: 32,diff --git a/src/crates/concat-host/src/preview.rs b/src/crates/concat-host/src/preview.rsindex f60ff645..a99acfef 100644--- a/src/crates/concat-host/src/preview.rs+++ b/src/crates/concat-host/src/preview.rs@@ -52,7 +52,7 @@ pub struct FrameSpec {pub color_space: ColorSpace,/// What shows where no picture covers the frame; see/// `VideoSettings::canvas`.- pub canvas: [u8; 3],+ pub canvas: [u8; 4],}/// The reader pool behind the monitor, shareable across threads.@@ -77,7 +77,7 @@ struct PlanEntry {height: u32,rate: (i64, i64),color_space: ColorSpace,- canvas: [u8; 3],+ canvas: [u8; 4],plan: Arc<concat_export::PreviewPlan>,}diff --git a/src/crates/concat-host/src/projects.rs b/src/crates/concat-host/src/projects.rsindex 0e050f70..c9a731ef 100644--- a/src/crates/concat-host/src/projects.rs+++ b/src/crates/concat-host/src/projects.rs@@ -70,10 +70,13 @@ pub struct ProjectInfo {/// Denominator of the frame rate.pub rate_den: i64,/// What shows where no picture covers the frame, for a project's first- /// timeline; see `VideoSettings::canvas`. Black for a recents entry- /// written before there was one.- #[serde(default)]- pub canvas: [u8; 3],+ /// timeline; see `VideoSettings::canvas`. Opaque black for a recents+ /// entry written before there was one.+ #[serde(+ default = "opaque_black",+ deserialize_with = "concat_project::model::rgba_array"+ )]+ pub canvas: [u8; 4],/// Milliseconds since the epoch.pub opened_at: u64,}@@ -101,17 +104,22 @@ struct Video {height: u32,rate_num: i64,rate_den: i64,- /// `#rrggbb`, left out while black; see `VideoSettings::canvas`.+ /// `#rrggbb` or `#rrggbbaa`, left out while opaque black; see+ /// `VideoSettings::canvas`.#[serde(- default,+ default = "opaque_black",skip_serializing_if = "is_black",- with = "concat_project::model::hex_rgb"+ with = "concat_project::model::hex_rgba")]- canvas: [u8; 3],+ canvas: [u8; 4],}-fn is_black(rgb: &[u8; 3]) -> bool {- *rgb == [0, 0, 0]+fn opaque_black() -> [u8; 4] {+ concat_project::model::OPAQUE_BLACK+}++fn is_black(rgba: &[u8; 4]) -> bool {+ *rgba == concat_project::model::OPAQUE_BLACK}fn now_millis() -> u64 {@@ -132,7 +140,7 @@ pub fn create(height: u32,rate_num: i64,rate_den: i64,- canvas: [u8; 3],+ canvas: [u8; 4],) -> Result<ProjectInfo, String> {let root = Path::new(location).join(folder_name(name));let manifest = root.join(MANIFEST);@@ -662,6 +670,22 @@ fn count_files(dir: &Path) -> usize {mod tests {use super::*;+ /// A recents list written while the canvas was three channels still+ /// reads, each entry opaque, and a four-channel one keeps its alpha+ /// (#456): a list that failed to read would be an empty Start screen.+ #[test]+ fn recents_with_a_three_channel_canvas_still_read() {+ let entry = |canvas: &str| {+ format!(+ r#"{{"path":"/p","name":"p","width":8,"height":8,"rateNum":30,"rateDen":1,"canvas":{canvas},"openedAt":1}}"#+ )+ };+ let list = format!("[{},{}]", entry("[0,177,64]"), entry("[0,0,0,0]"));+ let read: Vec<ProjectInfo> = serde_json::from_str(&list).expect("reads");+ assert_eq!(read[0].canvas, [0, 177, 64, 255]);+ assert_eq!(read[1].canvas, [0, 0, 0, 0]);+ }+#[test]fn sanitises_names_windows_would_reject() {assert_eq!(folder_name("My: Project?"), "My- Project-");@@ -686,7 +710,7 @@ mod tests {#[test]fn a_project_named_nul_is_created_and_reads_back() {let location = scratch("device-name");- let info = create(&location, "nul", 1920, 1080, 30, 1, [0, 0, 0]).expect("creates");+ let info = create(&location, "nul", 1920, 1080, 30, 1, [0, 0, 0, 255]).expect("creates");assert!(is_project(Path::new(&info.path)));assert_eq!(info.name, "nul");}diff --git a/src/crates/concat-host/src/session.rs b/src/crates/concat-host/src/session.rsindex 7cca1baf..c3472c60 100644--- a/src/crates/concat-host/src/session.rs+++ b/src/crates/concat-host/src/session.rs@@ -320,7 +320,7 @@ mod tests {fn settings() -> DocumentSettings {DocumentSettings {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],name: "Test".to_owned(),width: 1920,height: 1080,@@ -342,7 +342,7 @@ mod tests {1080,30,1,- [0, 0, 0],+ [0, 0, 0, 255],).expect("creates");@@ -359,7 +359,7 @@ mod tests {assert!(view.can_undo);session.set_video(VideoSettings {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],width: 1280,height: 720,rate_num: 25,diff --git a/src/crates/concat-host/src/templates.rs b/src/crates/concat-host/src/templates.rsindex 6d0cda79..3fbc5cf7 100644--- a/src/crates/concat-host/src/templates.rs+++ b/src/crates/concat-host/src/templates.rs@@ -299,7 +299,7 @@ pub fn instantiate(info.height,info.rate_num,info.rate_den,- [0, 0, 0],+ [0, 0, 0, 255],)?;let root = PathBuf::from(&project.path);@@ -489,7 +489,7 @@ mod tests {}let settings = DocumentSettings {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],name: "Beat Intro".to_owned(),width: 1920,height: 1080,diff --git a/src/crates/concat-host/tests/export.rs b/src/crates/concat-host/tests/export.rsindex 85b927e7..fa41e231 100644--- a/src/crates/concat-host/tests/export.rs+++ b/src/crates/concat-host/tests/export.rs@@ -476,7 +476,7 @@ impl Studio {video.height,video.rate_num,video.rate_den,- [0, 0, 0],+ [0, 0, 0, 255],).expect("creates the project");let session = Session::open_info(&info).expect("opens the project");@@ -653,7 +653,7 @@ fn effect(id: &str) -> AppliedFilter {fn video(width: u32, height: u32, rate_num: i64, rate_den: i64) -> VideoSettings {VideoSettings {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],width,height,rate_num,@@ -898,7 +898,7 @@ fn a_background_fills_the_bars_in_the_export_and_the_monitor() {];let monitor = |studio: &Studio| {let request = concat_export::PreviewFrameRequest {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],time: 1.0,width,height,diff --git a/src/crates/concat-host/tests/stabilize.rs b/src/crates/concat-host/tests/stabilize.rsindex 1b28da7d..495fbe34 100644--- a/src/crates/concat-host/tests/stabilize.rs+++ b/src/crates/concat-host/tests/stabilize.rs@@ -175,7 +175,7 @@ fn a_shaky_shot_is_measured_and_held_still() {HEIGHT,30,1,- [0, 0, 0],+ [0, 0, 0, 255],).expect("creates the project");let mut session = Session::open_info(&info).expect("opens the project");@@ -292,7 +292,7 @@ fn a_shaky_shot_is_measured_and_held_still() {Arc::clone(&clips),&session.settings(),FrameSpec {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],time: k as f64 / 30.0,width: WIDTH,height: HEIGHT,diff --git a/src/crates/concat-mobile/src/lib.rs b/src/crates/concat-mobile/src/lib.rsindex ea221f18..f8b869b7 100644--- a/src/crates/concat-mobile/src/lib.rs+++ b/src/crates/concat-mobile/src/lib.rs@@ -160,7 +160,7 @@ impl Engine {1920,30,1,- [0, 0, 0],+ [0, 0, 0, 255],)?};let session = Session::open_info(&info)?;diff --git a/src/crates/concat-project/src/doc.rs b/src/crates/concat-project/src/doc.rsindex 79ea5dbb..8dd941b5 100644--- a/src/crates/concat-project/src/doc.rs+++ b/src/crates/concat-project/src/doc.rs@@ -301,7 +301,7 @@ pub struct DocumentSettings {pub rate_den: i64,/// What shows where no picture covers the frame; see/// `VideoSettings::canvas`.- pub canvas: [u8; 3],+ pub canvas: [u8; 4],}impl DocumentSettings {diff --git a/src/crates/concat-project/src/lib.rs b/src/crates/concat-project/src/lib.rsindex 5b566912..38d02a7f 100644--- a/src/crates/concat-project/src/lib.rs+++ b/src/crates/concat-project/src/lib.rs@@ -164,7 +164,8 @@ mod tests {);}- /// A timeline's canvas colour is written as `#rrggbb` and read back;+ /// A timeline's canvas colour is written as `#rrggbb` (`#rrggbbaa` when+ /// it is see-through) and read back;/// black is not written at all, so a document without one is the/// document it always was, and junk reads as black (#456).#[test]@@ -173,7 +174,7 @@ mod tests {let black = serde_json::to_value(VideoSettings::default()).unwrap();assert!(black.get("canvas").is_none(), "{black}");let green = VideoSettings {- canvas: [0, 177, 64],+ canvas: [0, 177, 64, 255],..VideoSettings::default()};let written = serde_json::to_value(green).unwrap();@@ -184,7 +185,22 @@ mod tests {"width": 1920, "height": 1080, "rateNum": 30, "rateDen": 1, "canvas": "teal"})).unwrap();- assert_eq!(junk.canvas, [0, 0, 0]);+ assert_eq!(junk.canvas, [0, 0, 0, 255]);+ // A see-through canvas carries its alpha, and an opaque one written+ // with an `ff` alpha reads as the same colour.+ let clear = VideoSettings {+ canvas: [0, 0, 0, 0],+ ..VideoSettings::default()+ };+ let written = serde_json::to_value(clear).unwrap();+ assert_eq!(written["canvas"], "#00000000");+ let read: VideoSettings = serde_json::from_value(written).unwrap();+ assert_eq!(read.canvas, [0, 0, 0, 0]);+ let opaque: VideoSettings = serde_json::from_value(json!({+ "width": 1920, "height": 1080, "rateNum": 30, "rateDen": 1, "canvas": "#00b140ff"+ }))+ .unwrap();+ assert_eq!(opaque.canvas, [0, 177, 64, 255]);}#[test]@@ -265,7 +281,7 @@ mod tests {height: 1080,rate_num: 30,rate_den: 1,- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],}}diff --git a/src/crates/concat-project/src/model.rs b/src/crates/concat-project/src/model.rsindex 7b40ee62..c38c4b62 100644--- a/src/crates/concat-project/src/model.rs+++ b/src/crates/concat-project/src/model.rs@@ -778,6 +778,17 @@ impl Background {}/// `#rrggbb` (or `#rrggbbaa`, its alpha ignored) as three channels.+/// `#rrggbb` (opaque) or `#rrggbbaa` as four straight channels.+fn rgba_of(hex: &str) -> Option<[u8; 4]> {+ let [r, g, b] = rgb_of(hex)?;+ let digits = hex.trim().strip_prefix('#')?;+ let a = match digits.len() {+ 8 => u8::from_str_radix(&digits[6..8], 16).ok()?,+ _ => 255,+ };+ Some([r, g, b, a])+}+fn rgb_of(hex: &str) -> Option<[u8; 3]> {let digits = hex.trim().strip_prefix('#')?;if !(digits.len() == 6 || digits.len() == 8) || !digits.is_ascii() {@@ -2631,33 +2642,72 @@ pub struct VideoSettings {#[serde(deserialize_with = "wire::color_space")]pub color_space: ColorSpace,/// What shows where no picture covers the frame - a gap, the space- /// around a title, a clip fading in - as `#rrggbb` in the document:- /// black unless the project was given another (#456). Left out of the- /// document while it is black, so those documents stay as they were.- #[serde(default, skip_serializing_if = "is_black", with = "hex_rgb")]+ /// around a title, a clip fading in - as straight `[r, g, b, a]`,+ /// written `#rrggbb` in the document, or `#rrggbbaa` when it lets+ /// something show through: opaque black unless the project was given+ /// another (#456). Alpha zero is a transparent frame, for an overlay+ /// exported in a format that keeps alpha; a format that does not+ /// gets black there. Left out of the document while it is opaque+ /// black, so those documents stay as they were.+ #[serde(default = "opaque_black", skip_serializing_if = "is_black", with = "hex_rgba")]#[cfg_attr(feature = "schema", schemars(with = "String"))]- pub canvas: [u8; 3],+ pub canvas: [u8; 4],}-fn is_black(rgb: &[u8; 3]) -> bool {- *rgb == [0, 0, 0]+/// The canvas every project had before it could be given one.+pub const OPAQUE_BLACK: [u8; 4] = [0, 0, 0, 255];++/// A canvas written as a bare array of channels, as the recents list and+/// the export and preview requests carry it: `[r, g, b, a]`, or `[r, g, b]`+/// as it was written before the canvas had an alpha, which is opaque. Any+/// other shape is opaque black, so one odd entry does not lose the rest of+/// what it is read with.+pub fn rgba_array<'de, D: serde::Deserializer<'de>>(deserializer: D) -> Result<[u8; 4], D::Error> {+ let value = serde_json::Value::deserialize(deserializer)?;+ let channels: Option<Vec<u8>> = value.as_array().and_then(|items| {+ items+ .iter()+ .map(|item| item.as_u64().and_then(|n| u8::try_from(n).ok()))+ .collect()+ });+ Ok(match channels.as_deref() {+ Some(&[r, g, b]) => [r, g, b, 255],+ Some(&[r, g, b, a]) => [r, g, b, a],+ _ => OPAQUE_BLACK,+ })}-/// A colour kept as three channels and written as `#rrggbb`, the way the-/// document writes every colour. One that does not read is black.-pub mod hex_rgb {+fn opaque_black() -> [u8; 4] {+ OPAQUE_BLACK+}++fn is_black(rgba: &[u8; 4]) -> bool {+ *rgba == OPAQUE_BLACK+}++/// A colour kept as four straight channels and written the way the+/// document writes every colour: `#rrggbb` while it is opaque,+/// `#rrggbbaa` when it is not. One that does not read is opaque black.+pub mod hex_rgba {use serde::{Deserialize, Deserializer, Serializer};- /// `#rrggbb`, lower case.- pub fn serialize<S: Serializer>(rgb: &[u8; 3], serializer: S) -> Result<S::Ok, S::Error> {- serializer.serialize_str(&format!("#{:02x}{:02x}{:02x}", rgb[0], rgb[1], rgb[2]))+ /// `#rrggbb`, or `#rrggbbaa` short of opaque; lower case.+ pub fn serialize<S: Serializer>(rgba: &[u8; 4], serializer: S) -> Result<S::Ok, S::Error> {+ let [r, g, b, a] = *rgba;+ serializer.serialize_str(&if a == 255 {+ format!("#{r:02x}{g:02x}{b:02x}")+ } else {+ format!("#{r:02x}{g:02x}{b:02x}{a:02x}")+ })}- /// `#rrggbb` or `#rrggbbaa`, its alpha ignored; black for anything- /// else.- pub fn deserialize<'de, D: Deserializer<'de>>(deserializer: D) -> Result<[u8; 3], D::Error> {+ /// `#rrggbb` (opaque) or `#rrggbbaa`; opaque black for anything else.+ pub fn deserialize<'de, D: Deserializer<'de>>(deserializer: D) -> Result<[u8; 4], D::Error> {let value = serde_json::Value::deserialize(deserializer)?;- Ok(value.as_str().and_then(super::rgb_of).unwrap_or([0, 0, 0]))+ Ok(value+ .as_str()+ .and_then(super::rgba_of)+ .unwrap_or(super::OPAQUE_BLACK))}}@@ -2671,7 +2721,7 @@ impl Default for VideoSettings {rate_num: 30,rate_den: 1,color_space: ColorSpace::Sdr,- canvas: [0, 0, 0],+ canvas: OPAQUE_BLACK,}}}diff --git a/src/crates/concat-render/src/gpu.rs b/src/crates/concat-render/src/gpu.rsindex 237ddd78..b3251425 100644--- a/src/crates/concat-render/src/gpu.rs+++ b/src/crates/concat-render/src/gpu.rs@@ -387,6 +387,32 @@ fn fs_resolve_tone_mapped(@builtin(position) at: vec4<f32>) -> @location(0) vec4let clipped = clamp(light, vec3<f32>(0.0), vec3<f32>(1.0));return vec4<f32>(pow(clipped, vec3<f32>(1.0 / 2.4)), colour.a);}++// A frame on a canvas that lets something show through (#456): the working+// space holds it premultiplied, and a file that keeps alpha takes it+// straight, so the light is divided out of its coverage before the gamma.+// Nothing covers a texel of alpha zero, which comes out clear black.+fn unpremultiplied(colour: vec4<f32>) -> vec4<f32> {+ if (colour.a <= 0.0) {+ return vec4<f32>(0.0);+ }+ return vec4<f32>(colour.rgb / colour.a, min(colour.a, 1.0));+}++@fragment+fn fs_resolve_straight(@builtin(position) at: vec4<f32>) -> @location(0) vec4<f32> {+ let colour = unpremultiplied(textureLoad(picture, vec2<i32>(at.xy), 0));+ let clipped = clamp(colour.rgb, vec3<f32>(0.0), vec3<f32>(1.0));+ return vec4<f32>(pow(clipped, vec3<f32>(1.0 / 2.4)), colour.a);+}++@fragment+fn fs_resolve_tone_mapped_straight(@builtin(position) at: vec4<f32>) -> @location(0) vec4<f32> {+ let colour = unpremultiplied(textureLoad(picture, vec2<i32>(at.xy), 0));+ let light = to_sdr(colour.rgb * 203.0) / 203.0;+ let clipped = clamp(light, vec3<f32>(0.0), vec3<f32>(1.0));+ return vec4<f32>(pow(clipped, vec3<f32>(1.0 / 2.4)), colour.a);+}"#;/// SMPTE ST 2084 and BT.2390's roll-off, which the deep upload and the@@ -691,6 +717,13 @@ pub struct WgpuCompositor {/// screen.resolve_pipeline: wgpu::RenderPipeline,tone_mapped_pipeline: wgpu::RenderPipeline,+ /// The same two for a see-through canvas: the frame handed back with+ /// straight alpha rather than opaque.+ straight_pipelines: [wgpu::RenderPipeline; 2],+ /// Whether the plan being drawn has a canvas that lets something show+ /// through (`FramePlan::canvas`), so its frame keeps its alpha: taken+ /// up by `prepare`, as `output` is.+ see_through: bool,/// What the plan being drawn is output in (`FramePlan::output`): taken/// up by `prepare`, and read by the uploads and the resolve after it.output: concat_core::frame::Signal,@@ -1269,6 +1302,8 @@ impl WgpuCompositor {let resolve_pipeline = copy_into(wgpu::TextureFormat::Rgba8Unorm, "fs_resolve");let tone_mapped_pipeline =copy_into(wgpu::TextureFormat::Rgba8Unorm, "fs_resolve_tone_mapped");+ let straight_pipelines = ["fs_resolve_straight", "fs_resolve_tone_mapped_straight"]+ .map(|entry| copy_into(wgpu::TextureFormat::Rgba8Unorm, entry));let hdr_pipelines = ["fs_resolve_hlg", "fs_resolve_pq"].map(|entry| copy_into(wgpu::TextureFormat::Rgba16Uint, entry));@@ -1372,6 +1407,8 @@ impl WgpuCompositor {upload_pipeline,resolve_pipeline,tone_mapped_pipeline,+ straight_pipelines,+ see_through: false,output: concat_core::frame::Signal::Sdr,hdr_pipelines,deliver_hdr: false,@@ -1500,6 +1537,7 @@ impl WgpuCompositor {/// final render, into whichever target the caller wants.fn prepare(&mut self, plan: &FramePlan) -> (Vec<Draw>, Vec<Vertex>) {self.output = plan.output;+ self.see_through = plan.see_through();self.used.values_mut().for_each(|used| *used = 0);self.composites += 1;let (width, height) = (plan.width, plan.height);@@ -2417,10 +2455,14 @@ impl WgpuCompositor {) {let pipeline = if self.delivering_hdr() {&self.hdr_pipelines[usize::from(self.output == concat_core::frame::Signal::Pq)]- } else if self.output == concat_core::frame::Signal::Sdr {- &self.resolve_pipeline} else {- &self.tone_mapped_pipeline+ let sdr = self.output == concat_core::frame::Signal::Sdr;+ match (self.see_through, sdr) {+ (false, true) => &self.resolve_pipeline,+ (false, false) => &self.tone_mapped_pipeline,+ (true, true) => &self.straight_pipelines[0],+ (true, false) => &self.straight_pipelines[1],+ }};Self::copy(encoder,@@ -3519,10 +3561,14 @@ impl WgpuCompositor {let from = &data[row * padded_row..row * padded_row + row_bytes];pixels[row * row_bytes..(row + 1) * row_bytes].copy_from_slice(from);}- // The output goes to a screen or an encoder; neither has anything- // to show through, and blending may have left alpha short of one.- for pixel in pixels.chunks_exact_mut(4) {- pixel[3] = 255;+ // The output goes to a screen or an encoder, which have nothing+ // to show through, and blending may have left alpha short of+ // one - unless the canvas is see-through, when the alpha is+ // the point (#456).+ if !self.see_through {+ for pixel in pixels.chunks_exact_mut(4) {+ pixel[3] = 255;+ }}}target.staging.unmap();@@ -3532,14 +3578,16 @@ impl WgpuCompositor {/// A plan's canvas colour as the working space holds it: each eight-bit/// level through the 2.4 gamma every picture is uploaded through, so the-/// canvas and a still of the same colour come out the same, 1.0 SDR white.-fn clear_of([r, g, b]: [u8; 3]) -> wgpu::Color {- let light = |level: u8| (f64::from(level) / 255.0).powf(2.4);+/// canvas and a still of the same colour come out the same, 1.0 SDR white;+/// premultiplied by its alpha, as everything drawn over it is.+fn clear_of([r, g, b, a]: [u8; 4]) -> wgpu::Color {+ let alpha = f64::from(a) / 255.0;+ let light = |level: u8| (f64::from(level) / 255.0).powf(2.4) * alpha;wgpu::Color {r: light(r),g: light(g),b: light(b),- a: 1.0,+ a: alpha,}}diff --git a/src/crates/concat-render/src/gpu/tests.rs b/src/crates/concat-render/src/gpu/tests.rsindex 9e85bf6c..d85b5297 100644--- a/src/crates/concat-render/src/gpu/tests.rs+++ b/src/crates/concat-render/src/gpu/tests.rs@@ -130,12 +130,45 @@ fn empty_output_is_opaque_black() {assert_eq!(frame.pixel(3, 3), Some([0, 0, 0, 255]));}+/// On a see-through canvas the frame comes back with straight alpha, as+/// the CPU reference makes it: clear where nothing covers it, opaque under+/// an opaque picture, and half covered under a half-faded one, in that+/// picture's own colour rather than darkened towards the clear (#456).+#[test]+fn a_see_through_canvas_keeps_the_alpha_of_what_covers_it() {+ let Some(mut gpu) = gpu() else { return };+ let square = Arc::new(solid(4, 4, [200, 40, 40, 255]));+ let plan = FramePlan {+ canvas: [0, 0, 0, 0],+ layers: vec![PlannedLayer::picture(detached_clip(), square.clone())],+ ..FramePlan::empty(8, 4)+ };+ let frame = gpu.render(&plan);+ assert_eq!(frame.pixel(0, 2).map(|p| p[3]), Some(0));+ let pixel = frame.pixel(4, 2).expect("a pixel");+ assert!(pixel[3] == 255 && pixel[0].abs_diff(200) <= 1, "{pixel:?}");++ let mut faded = PlannedLayer::picture(detached_clip(), square);+ faded.opacity = 0.5;+ let frame = gpu.render(&FramePlan {+ layers: vec![faded],+ ..plan+ });+ let pixel = frame.pixel(4, 2).expect("a pixel");+ assert!(pixel[3].abs_diff(128) <= 1, "{pixel:?}");+ assert!(pixel[0].abs_diff(200) <= 2 && pixel[1].abs_diff(40) <= 2, "{pixel:?}");++ // And an opaque canvas after it is opaque again.+ let frame = gpu.render(&FramePlan::empty(4, 4));+ assert_eq!(frame.pixel(1, 1), Some([0, 0, 0, 255]));+}+/// The canvas colour comes back out as it went in: cleared in linear/// light through the upload's gamma and resolved back, within a level.#[test]fn an_empty_frame_is_the_canvas_colour() {let Some(mut gpu) = gpu() else { return };- for canvas in [[0, 177, 64], [255, 255, 255], [0, 71, 187], [31, 31, 31]] {+ for canvas in [[0, 177, 64, 255], [255, 255, 255, 255], [0, 71, 187, 255], [31, 31, 31, 255]] {let frame = gpu.render(&FramePlan {canvas,..FramePlan::empty(4, 4)@@ -946,7 +979,7 @@ fn a_transition_kept_on_the_device_matches_the_read_back_one() {time: concat_core::time::Rational::new(1, 2),width,height,- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],layers: vec![PlannedLayer::picture(detached_clip(),Arc::new(solid(width, height, colour)),@@ -1004,7 +1037,7 @@ fn a_frame_drawn_before_is_not_uploaded_again() {time: concat_core::time::Rational::new(0, 1),width: 64,height: 36,- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],layers: vec![PlannedLayer::picture(detached_clip(), Arc::clone(frame))],treatments: Vec::new(),output: concat_core::frame::Signal::Sdr,@@ -1045,7 +1078,7 @@ fn the_pool_stays_within_its_limits() {time: concat_core::time::Rational::new(0, 1),width: 4,height: 4,- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],layers: vec![PlannedLayer::picture(detached_clip(), frame)],treatments: Vec::new(),output: concat_core::frame::Signal::Sdr,diff --git a/src/crates/concat-render/src/plan.rs b/src/crates/concat-render/src/plan.rsindex 76fe7fc5..69786aba 100644--- a/src/crates/concat-render/src/plan.rs+++ b/src/crates/concat-render/src/plan.rs@@ -734,8 +734,10 @@ pub struct FramePlan {/// Output height.pub height: u32,/// What is drawn under the bottom layer, where no picture covers the- /// frame: the timeline's canvas colour, eight-bit `[r, g, b]`.- pub canvas: [u8; 3],+ /// frame: the timeline's canvas colour, eight-bit straight+ /// `[r, g, b, a]`. Short of opaque, the frame comes back with its+ /// alpha (see [`FramePlan::see_through`]).+ pub canvas: [u8; 4],/// Visible layers, bottom-most first.pub layers: Vec<PlannedLayer>,/// The treatments live at this instant, in ascending track order.@@ -753,13 +755,20 @@ impl FramePlan {time: Rational::ZERO,width,height,- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],layers: Vec::new(),treatments: Vec::new(),output: Signal::Sdr,}}+ /// Whether the canvas lets something show through, so the frame keeps+ /// the alpha of what covers it rather than coming back opaque: an+ /// overlay bound for a file that keeps alpha (#456).+ pub fn see_through(&self) -> bool {+ self.canvas[3] < 255+ }+/// True if nothing is on screen. The result is the canvas, not an/// error: gaps in a timeline are ordinary.pub fn is_empty(&self) -> bool {diff --git a/src/crates/concat-render/src/reference.rs b/src/crates/concat-render/src/reference.rsindex 4f666698..25a9eb09 100644--- a/src/crates/concat-render/src/reference.rs+++ b/src/crates/concat-render/src/reference.rs@@ -48,8 +48,7 @@ impl Compositor for CpuCompositor {// besides its effects, which are the GPU's alone and are held to// their packages' probes instead.let mut ground = Frame::black(plan.width, plan.height);- let [r, g, b] = plan.canvas;- ground.fill([r, g, b, 255]);+ ground.fill(plan.canvas);let next = 0;for layer in &plan.layers[next..] {draw(&mut ground, plan, layer);@@ -165,14 +164,20 @@ impl Weighing<'_> {}// In linear light, as the GPU blends: the layer's colour and the// ground decoded from their stored gamma, weighed, and encoded back.+ // The ground is weighed by its own coverage, which is all of it+ // unless the canvas is see-through (#456): the GPU blends over+ // premultiplied colour, so this mixes over the premultiplied+ // ground and divides the coverage that results back out.+ let coverage = f32::from(under[3]) / 255.0;+ let covered = alpha + coverage * (1.0 - alpha);for channel in 0..3 {let colour = self.shading.colour(channel, linear(sample[channel]));- let ground = linear(f32::from(under[channel]));- under[channel] = encoded(mix(self.blend, colour, ground, alpha))+ let ground = linear(f32::from(under[channel])) * coverage;+ under[channel] = encoded(mix(self.blend, colour, ground, alpha) / covered).round().clamp(0.0, 255.0) as u8;}- under[3] = 255;+ under[3] = (covered * 255.0).round().clamp(0.0, 255.0) as u8;}}@@ -366,7 +371,7 @@ mod tests {use crate::Compositor;use crate::plan::{FramePlan, PlannedLayer, detached_clip};let gap = FramePlan {- canvas: [0, 177, 64],+ canvas: [0, 177, 64, 255],..FramePlan::empty(8, 4)};let frame = super::CpuCompositor.render(&gap);@@ -392,6 +397,36 @@ mod tests {assert_eq!(frame.pixel(4, 2), Some([255, 255, 255, 255]));}+ /// On a see-through canvas the frame keeps its alpha: clear where+ /// nothing covers it, opaque under an opaque picture, and as covered+ /// as a half-faded picture is, in that picture's own colour (#456).+ #[test]+ fn a_see_through_canvas_keeps_the_alpha_of_what_covers_it() {+ use crate::Compositor;+ use crate::plan::{FramePlan, PlannedLayer, detached_clip};+ let mut square = concat_core::Frame::black(4, 4);+ square.fill([200, 40, 40, 255]);+ let square = std::sync::Arc::new(square);+ let plan = FramePlan {+ canvas: [0, 0, 0, 0],+ layers: vec![PlannedLayer::picture(detached_clip(), square.clone())],+ ..FramePlan::empty(8, 4)+ };+ let frame = super::CpuCompositor.render(&plan);+ assert_eq!(frame.pixel(0, 2).map(|p| p[3]), Some(0));+ assert_eq!(frame.pixel(4, 2), Some([200, 40, 40, 255]));++ let mut faded = PlannedLayer::picture(detached_clip(), square);+ faded.opacity = 0.5;+ let frame = super::CpuCompositor.render(&FramePlan {+ layers: vec![faded],+ ..plan+ });+ let pixel = frame.pixel(4, 2).expect("a pixel");+ assert!(pixel[3].abs_diff(128) <= 1, "{pixel:?}");+ assert!(pixel[0].abs_diff(200) <= 1 && pixel[1].abs_diff(40) <= 1, "{pixel:?}");+ }+#[test]fn lighten_and_darken_weigh_the_layer_in_by_its_alpha() {use super::{Blend, mix};diff --git a/src/crates/concat/locales/ar.json b/src/crates/concat/locales/ar.jsonindex 6189d928..4a1b2cbb 100644--- a/src/crates/concat/locales/ar.json+++ b/src/crates/concat/locales/ar.json@@ -665,6 +665,8 @@"start.showInFolder": "إظهار في المجلد","start.sortName": "الاسم","start.sortRecent": "الأحدث",+ "start.transparent": "شفاف",+ "start.transparentHint": "شفاف حيث لا يغطيه شيء. صدّر بصيغة ProRes 4444 (.mov) أو WebM للحفاظ على ذلك؛ الصيغ الأخرى تُظهر الأسود هناك.","start.welcome": "مرحبًا بك في Concat","start.welcomeBack": "مرحبًا بعودتك","start.welcomeBackNote": "تابع من حيث توقفت، أو ابدأ شيئًا جديدًا.",diff --git a/src/crates/concat/locales/az.json b/src/crates/concat/locales/az.jsonindex 787a0c1a..c14a4ef1 100644--- a/src/crates/concat/locales/az.json+++ b/src/crates/concat/locales/az.json@@ -665,6 +665,8 @@"start.showInFolder": "Qovluqda göstər","start.sortName": "Ad","start.sortRecent": "Ən son",+ "start.transparent": "Şəffaf",+ "start.transparentHint": "Heç nəyin örtmədiyi yerlər şəffafdır. Bunu saxlamaq üçün ProRes 4444 (.mov) və ya WebM kimi ixrac edin; digər formatlarda orada qara görünür.","start.welcome": "Concat-a xoş gəlmisiniz","start.welcomeBack": "Yenidən xoş gəlmisiniz","start.welcomeBackNote": "Qaldığınız yerdən davam edin, ya da yeni bir şeyə başlayın.",diff --git a/src/crates/concat/locales/bn.json b/src/crates/concat/locales/bn.jsonindex 94730e3a..f6622a95 100644--- a/src/crates/concat/locales/bn.json+++ b/src/crates/concat/locales/bn.json@@ -665,6 +665,8 @@"start.showInFolder": "ফোল্ডারে দেখান","start.sortName": "নাম","start.sortRecent": "সাম্প্রতিক",+ "start.transparent": "স্বচ্ছ",+ "start.transparentHint": "যেখানে কিছু ঢেকে নেই সেখানে স্বচ্ছ। এটি রাখতে ProRes 4444 (.mov) বা WebM হিসেবে এক্সপোর্ট করুন; অন্য ফরম্যাটে সেখানে কালো দেখায়।","start.welcome": "Concat-এ স্বাগতম","start.welcomeBack": "আবার স্বাগতম","start.welcomeBackNote": "যেখানে থেমেছিলেন সেখান থেকে চালিয়ে যান, অথবা নতুন কিছু শুরু করুন।",diff --git a/src/crates/concat/locales/de.json b/src/crates/concat/locales/de.jsonindex 0870d059..a8fadab2 100644--- a/src/crates/concat/locales/de.json+++ b/src/crates/concat/locales/de.json@@ -665,6 +665,8 @@"start.showInFolder": "Im Ordner zeigen","start.sortName": "Name","start.sortRecent": "Zuletzt",+ "start.transparent": "Transparent",+ "start.transparentHint": "Durchsichtig, wo nichts darüber liegt. Exportiere als ProRes 4444 (.mov) oder WebM, um das zu behalten; andere Formate zeigen dort Schwarz.","start.welcome": "Willkommen bei Concat","start.welcomeBack": "Willkommen zurück","start.welcomeBackNote": "Mach weiter, wo du aufgehört hast, oder fang etwas Neues an.",diff --git a/src/crates/concat/locales/en.json b/src/crates/concat/locales/en.jsonindex fc3e5931..186a07d1 100644--- a/src/crates/concat/locales/en.json+++ b/src/crates/concat/locales/en.json@@ -665,6 +665,8 @@"start.showInFolder": "Show in folder","start.sortName": "Name","start.sortRecent": "Recent",+ "start.transparent": "Transparent",+ "start.transparentHint": "Clear where nothing covers it. Export as ProRes 4444 (.mov) or WebM to keep that; other formats show black there.","start.welcome": "Welcome to Concat","start.welcomeBack": "Welcome back","start.welcomeBackNote": "Pick up where you left off, or start something new.",diff --git a/src/crates/concat/locales/es.json b/src/crates/concat/locales/es.jsonindex 90da910f..9d4aa152 100644--- a/src/crates/concat/locales/es.json+++ b/src/crates/concat/locales/es.json@@ -665,6 +665,8 @@"start.showInFolder": "Mostrar en la carpeta","start.sortName": "Nombre","start.sortRecent": "Recientes",+ "start.transparent": "Transparente",+ "start.transparentHint": "Transparente donde nada lo cubre. Exporta como ProRes 4444 (.mov) o WebM para conservarlo; los demás formatos muestran negro ahí.","start.welcome": "Te damos la bienvenida a Concat","start.welcomeBack": "Hola de nuevo","start.welcomeBackNote": "Sigue donde lo dejaste o empieza algo nuevo.",diff --git a/src/crates/concat/locales/fa.json b/src/crates/concat/locales/fa.jsonindex 53bb8e6d..688b3b86 100644--- a/src/crates/concat/locales/fa.json+++ b/src/crates/concat/locales/fa.json@@ -665,6 +665,8 @@"start.showInFolder": "نمایش در پوشه","start.sortName": "نام","start.sortRecent": "اخیر",+ "start.transparent": "شفاف",+ "start.transparentHint": "جایی که چیزی آن را نپوشانده شفاف است. برای حفظ آن با ProRes 4444 (.mov) یا WebM خروجی بگیرید؛ قالبهای دیگر آنجا سیاه نشان میدهند.","start.welcome": "به Concat خوش آمدید","start.welcomeBack": "خوش برگشتید","start.welcomeBackNote": "از همان جایی که ماندید ادامه دهید، یا چیز تازهای شروع کنید.",diff --git a/src/crates/concat/locales/fr.json b/src/crates/concat/locales/fr.jsonindex 2f206992..75aeaeeb 100644--- a/src/crates/concat/locales/fr.json+++ b/src/crates/concat/locales/fr.json@@ -665,6 +665,8 @@"start.showInFolder": "Afficher dans le dossier","start.sortName": "Nom","start.sortRecent": "Récents",+ "start.transparent": "Transparent",+ "start.transparentHint": "Transparent là où rien ne le couvre. Exportez en ProRes 4444 (.mov) ou WebM pour le garder ; les autres formats y affichent du noir.","start.welcome": "Bienvenue dans Concat","start.welcomeBack": "Bon retour","start.welcomeBackNote": "Reprenez là où vous en étiez, ou commencez quelque chose de nouveau.",diff --git a/src/crates/concat/locales/he.json b/src/crates/concat/locales/he.jsonindex ebf50685..aa9e2f06 100644--- a/src/crates/concat/locales/he.json+++ b/src/crates/concat/locales/he.json@@ -665,6 +665,8 @@"start.showInFolder": "הצגה בתיקייה","start.sortName": "שם","start.sortRecent": "אחרונים",+ "start.transparent": "שקוף",+ "start.transparentHint": "שקוף במקום ששום דבר לא מכסה אותו. ייצאו כ־ProRes 4444 (.mov) או WebM כדי לשמור על כך; פורמטים אחרים מציגים שם שחור.","start.welcome": "ברוכים הבאים ל-Concat","start.welcomeBack": "ברוכים השבים","start.welcomeBackNote": "אפשר להמשיך מאיפה שהפסקת, או להתחיל משהו חדש.",diff --git a/src/crates/concat/locales/hi.json b/src/crates/concat/locales/hi.jsonindex cdcff676..b5f2f3a3 100644--- a/src/crates/concat/locales/hi.json+++ b/src/crates/concat/locales/hi.json@@ -665,6 +665,8 @@"start.showInFolder": "फ़ोल्डर में दिखाएं","start.sortName": "नाम","start.sortRecent": "हाल के",+ "start.transparent": "पारदर्शी",+ "start.transparentHint": "जहाँ कुछ नहीं ढका, वहाँ पारदर्शी। इसे बनाए रखने के लिए ProRes 4444 (.mov) या WebM में एक्सपोर्ट करें; दूसरे फ़ॉर्मैट वहाँ काला दिखाते हैं।","start.welcome": "Concat में आपका स्वागत है","start.welcomeBack": "फिर से स्वागत है","start.welcomeBackNote": "जहां छोड़ा था वहीं से जारी रखें, या कुछ नया शुरू करें।",diff --git a/src/crates/concat/locales/hr.json b/src/crates/concat/locales/hr.jsonindex c1d71472..37aeb6c7 100644--- a/src/crates/concat/locales/hr.json+++ b/src/crates/concat/locales/hr.json@@ -665,6 +665,8 @@"start.showInFolder": "Prikaži u mapi","start.sortName": "Naziv","start.sortRecent": "Nedavno",+ "start.transparent": "Prozirno",+ "start.transparentHint": "Prozirno gdje ga ništa ne prekriva. Izvezite kao ProRes 4444 (.mov) ili WebM da to zadržite; drugi formati ondje prikazuju crno.","start.welcome": "Dobro došli u Concat","start.welcomeBack": "Dobro došli natrag","start.welcomeBackNote": "Nastavite gdje ste stali ili započnite nešto novo.",diff --git a/src/crates/concat/locales/id.json b/src/crates/concat/locales/id.jsonindex 399d2643..37e625a8 100644--- a/src/crates/concat/locales/id.json+++ b/src/crates/concat/locales/id.json@@ -665,6 +665,8 @@"start.showInFolder": "Tampilkan di folder","start.sortName": "Nama","start.sortRecent": "Terbaru",+ "start.transparent": "Transparan",+ "start.transparentHint": "Transparan di bagian yang tidak tertutup apa pun. Ekspor sebagai ProRes 4444 (.mov) atau WebM untuk mempertahankannya; format lain menampilkan hitam di sana.","start.welcome": "Selamat datang di Concat","start.welcomeBack": "Selamat datang kembali","start.welcomeBackNote": "Lanjutkan dari bagian terakhir, atau mulai sesuatu yang baru.",diff --git a/src/crates/concat/locales/it.json b/src/crates/concat/locales/it.jsonindex f3365487..628ff6e2 100644--- a/src/crates/concat/locales/it.json+++ b/src/crates/concat/locales/it.json@@ -665,6 +665,8 @@"start.showInFolder": "Mostra nella cartella","start.sortName": "Nome","start.sortRecent": "Recenti",+ "start.transparent": "Trasparente",+ "start.transparentHint": "Trasparente dove nulla lo copre. Esporta in ProRes 4444 (.mov) o WebM per mantenerlo; gli altri formati lì mostrano nero.","start.welcome": "Ti diamo il benvenuto in Concat","start.welcomeBack": "Bentornato","start.welcomeBackNote": "Riprendi da dove avevi lasciato o inizia qualcosa di nuovo.",diff --git a/src/crates/concat/locales/ja.json b/src/crates/concat/locales/ja.jsonindex 1c7ddfbd..c2852980 100644--- a/src/crates/concat/locales/ja.json+++ b/src/crates/concat/locales/ja.json@@ -665,6 +665,8 @@"start.showInFolder": "フォルダーで表示","start.sortName": "名前","start.sortRecent": "最近",+ "start.transparent": "透明",+ "start.transparentHint": "何も重なっていない部分は透明です。透明を保つには ProRes 4444 (.mov) か WebM で書き出します。ほかの形式ではそこが黒になります。","start.welcome": "Concat へようこそ","start.welcomeBack": "おかえりなさい","start.welcomeBackNote": "前回の続きから、または新しく始めましょう。",diff --git a/src/crates/concat/locales/ko.json b/src/crates/concat/locales/ko.jsonindex 666d02f0..4ca5b561 100644--- a/src/crates/concat/locales/ko.json+++ b/src/crates/concat/locales/ko.json@@ -665,6 +665,8 @@"start.showInFolder": "폴더에서 보기","start.sortName": "이름","start.sortRecent": "최근",+ "start.transparent": "투명",+ "start.transparentHint": "아무것도 덮지 않은 곳은 투명합니다. 유지하려면 ProRes 4444(.mov) 또는 WebM으로 내보내세요. 다른 형식은 그 부분이 검게 보입니다.","start.welcome": "Concat에 오신 것을 환영합니다","start.welcomeBack": "다시 오신 것을 환영합니다","start.welcomeBackNote": "하던 작업을 이어서 하거나 새로 시작하세요.",diff --git a/src/crates/concat/locales/nl.json b/src/crates/concat/locales/nl.jsonindex 28789011..cd54f4d0 100644--- a/src/crates/concat/locales/nl.json+++ b/src/crates/concat/locales/nl.json@@ -665,6 +665,8 @@"start.showInFolder": "Tonen in map","start.sortName": "Naam","start.sortRecent": "Recent",+ "start.transparent": "Transparant",+ "start.transparentHint": "Doorzichtig waar niets het bedekt. Exporteer als ProRes 4444 (.mov) of WebM om dat te behouden; andere formaten tonen daar zwart.","start.welcome": "Welkom bij Concat","start.welcomeBack": "Welkom terug","start.welcomeBackNote": "Ga verder waar je gebleven was, of begin iets nieuws.",diff --git a/src/crates/concat/locales/pl.json b/src/crates/concat/locales/pl.jsonindex d0f03140..f8983901 100644--- a/src/crates/concat/locales/pl.json+++ b/src/crates/concat/locales/pl.json@@ -665,6 +665,8 @@"start.showInFolder": "Pokaż w folderze","start.sortName": "Nazwa","start.sortRecent": "Ostatnie",+ "start.transparent": "Przezroczyste",+ "start.transparentHint": "Przezroczyste tam, gdzie nic go nie zakrywa. Eksportuj jako ProRes 4444 (.mov) lub WebM, aby to zachować; inne formaty pokażą tam czerń.","start.welcome": "Witaj w Concat","start.welcomeBack": "Witaj ponownie","start.welcomeBackNote": "Wróć do przerwanej pracy albo zacznij coś nowego.",diff --git a/src/crates/concat/locales/pt-BR.json b/src/crates/concat/locales/pt-BR.jsonindex 27fa6724..1d068eea 100644--- a/src/crates/concat/locales/pt-BR.json+++ b/src/crates/concat/locales/pt-BR.json@@ -665,6 +665,8 @@"start.showInFolder": "Mostrar na pasta","start.sortName": "Nome","start.sortRecent": "Recentes",+ "start.transparent": "Transparente",+ "start.transparentHint": "Transparente onde nada cobre. Exporte como ProRes 4444 (.mov) ou WebM para manter isso; outros formatos mostram preto ali.","start.welcome": "Boas-vindas ao Concat","start.welcomeBack": "Olá de novo","start.welcomeBackNote": "Continue de onde parou ou comece algo novo.",diff --git a/src/crates/concat/locales/ru.json b/src/crates/concat/locales/ru.jsonindex 821e70c1..8d561166 100644--- a/src/crates/concat/locales/ru.json+++ b/src/crates/concat/locales/ru.json@@ -665,6 +665,8 @@"start.showInFolder": "Показать в папке","start.sortName": "Имя","start.sortRecent": "Недавние",+ "start.transparent": "Прозрачный",+ "start.transparentHint": "Прозрачно там, где ничего нет. Чтобы сохранить прозрачность, экспортируйте в ProRes 4444 (.mov) или WebM; в других форматах там будет чёрный.","start.welcome": "Добро пожаловать в Concat","start.welcomeBack": "С возвращением","start.welcomeBackNote": "Продолжите с того места, где остановились, или начните что-то новое.",diff --git a/src/crates/concat/locales/th.json b/src/crates/concat/locales/th.jsonindex 5e8cae11..0b482a2a 100644--- a/src/crates/concat/locales/th.json+++ b/src/crates/concat/locales/th.json@@ -665,6 +665,8 @@"start.showInFolder": "แสดงในโฟลเดอร์","start.sortName": "ชื่อ","start.sortRecent": "ล่าสุด",+ "start.transparent": "โปร่งใส",+ "start.transparentHint": "โปร่งใสในส่วนที่ไม่มีอะไรทับ ส่งออกเป็น ProRes 4444 (.mov) หรือ WebM เพื่อคงไว้ รูปแบบอื่นจะแสดงเป็นสีดำตรงนั้น","start.welcome": "ยินดีต้อนรับสู่ Concat","start.welcomeBack": "ยินดีต้อนรับกลับมา","start.welcomeBackNote": "ทำต่อจากที่ค้างไว้ หรือเริ่มงานใหม่",diff --git a/src/crates/concat/locales/tr.json b/src/crates/concat/locales/tr.jsonindex 9d1048d0..3980d6de 100644--- a/src/crates/concat/locales/tr.json+++ b/src/crates/concat/locales/tr.json@@ -665,6 +665,8 @@"start.showInFolder": "Klasörde göster","start.sortName": "Ad","start.sortRecent": "Son kullanılan",+ "start.transparent": "Saydam",+ "start.transparentHint": "Hiçbir şeyin örtmediği yerler saydamdır. Bunu korumak için ProRes 4444 (.mov) veya WebM olarak dışa aktarın; diğer biçimler orada siyah gösterir.","start.welcome": "Concat'e hoş geldiniz","start.welcomeBack": "Tekrar hoş geldiniz","start.welcomeBackNote": "Kaldığınız yerden devam edin ya da yeni bir şey başlatın.",diff --git a/src/crates/concat/locales/uk.json b/src/crates/concat/locales/uk.jsonindex 804dfbca..ff51120f 100644--- a/src/crates/concat/locales/uk.json+++ b/src/crates/concat/locales/uk.json@@ -665,6 +665,8 @@"start.showInFolder": "Показати в папці","start.sortName": "Назва","start.sortRecent": "Нещодавні",+ "start.transparent": "Прозорий",+ "start.transparentHint": "Прозоро там, де нічого немає. Щоб зберегти прозорість, експортуйте в ProRes 4444 (.mov) або WebM; в інших форматах там буде чорний.","start.welcome": "Ласкаво просимо до Concat","start.welcomeBack": "З поверненням","start.welcomeBackNote": "Продовжте з того місця, де зупинилися, або почніть щось нове.",diff --git a/src/crates/concat/locales/ur.json b/src/crates/concat/locales/ur.jsonindex b2127f38..1632b105 100644--- a/src/crates/concat/locales/ur.json+++ b/src/crates/concat/locales/ur.json@@ -665,6 +665,8 @@"start.showInFolder": "فولڈر میں دکھائیں","start.sortName": "نام","start.sortRecent": "حالیہ",+ "start.transparent": "شفاف",+ "start.transparentHint": "جہاں کچھ نہ ڈھکا ہو وہاں شفاف۔ اسے برقرار رکھنے کے لیے ProRes 4444 (.mov) یا WebM میں ایکسپورٹ کریں؛ دوسرے فارمیٹ وہاں سیاہ دکھاتے ہیں۔","start.welcome": "Concat میں خوش آمدید","start.welcomeBack": "دوبارہ خوش آمدید","start.welcomeBackNote": "جہاں چھوڑا تھا وہیں سے جاری رکھیں، یا کچھ نیا شروع کریں۔",diff --git a/src/crates/concat/locales/vi.json b/src/crates/concat/locales/vi.jsonindex e58848a7..25fef029 100644--- a/src/crates/concat/locales/vi.json+++ b/src/crates/concat/locales/vi.json@@ -665,6 +665,8 @@"start.showInFolder": "Hiện trong thư mục","start.sortName": "Tên","start.sortRecent": "Gần đây",+ "start.transparent": "Trong suốt",+ "start.transparentHint": "Trong suốt ở chỗ không có gì che. Xuất dưới dạng ProRes 4444 (.mov) hoặc WebM để giữ lại; các định dạng khác hiển thị màu đen ở đó.","start.welcome": "Chào mừng bạn đến với Concat","start.welcomeBack": "Chào mừng bạn trở lại","start.welcomeBackNote": "Tiếp tục từ chỗ bạn dừng lại, hoặc bắt đầu điều gì đó mới.",diff --git a/src/crates/concat/locales/zh-Hans.json b/src/crates/concat/locales/zh-Hans.jsonindex 86f9e76e..2cc7b1ee 100644--- a/src/crates/concat/locales/zh-Hans.json+++ b/src/crates/concat/locales/zh-Hans.json@@ -665,6 +665,8 @@"start.showInFolder": "在文件夹中显示","start.sortName": "名称","start.sortRecent": "最近",+ "start.transparent": "透明",+ "start.transparentHint": "没有画面覆盖的地方是透明的。导出为 ProRes 4444 (.mov) 或 WebM 可保留透明;其他格式在那里显示为黑色。","start.welcome": "欢迎使用 Concat","start.welcomeBack": "欢迎回来","start.welcomeBackNote": "从上次中断的地方继续,或开始新的创作。",diff --git a/src/crates/concat/locales/zh-TW.json b/src/crates/concat/locales/zh-TW.jsonindex 5c5c056f..558eb44f 100644--- a/src/crates/concat/locales/zh-TW.json+++ b/src/crates/concat/locales/zh-TW.json@@ -665,6 +665,8 @@"start.showInFolder": "在資料夾中顯示","start.sortName": "名稱","start.sortRecent": "最近",+ "start.transparent": "透明",+ "start.transparentHint": "沒有畫面覆蓋的地方是透明的。匯出為 ProRes 4444 (.mov) 或 WebM 可保留透明;其他格式在那裡顯示為黑色。","start.welcome": "歡迎使用 Concat","start.welcomeBack": "歡迎回來","start.welcomeBackNote": "從上次中斷的地方繼續,或開始新的創作。",diff --git a/src/crates/concat/src/lib.rs b/src/crates/concat/src/lib.rsindex ca8711da..a80a2bcf 100644--- a/src/crates/concat/src/lib.rs+++ b/src/crates/concat/src/lib.rs@@ -722,6 +722,7 @@ fn start(project: Option<std::path::PathBuf>, smoke: bool) -> Result<(), slint::colour.red(),colour.green(),colour.blue(),+ colour.alpha(),])));}));app.on_start_create(on_window!(|state| {@@ -1847,6 +1848,7 @@ fn start(project: Option<std::path::PathBuf>, smoke: bool) -> Result<(), slint::colour.red(),colour.green(),colour.blue(),+ colour.alpha(),])));}));app.on_project_custom_width_edited(on_window!(|state, width: f32| {@@ -2864,7 +2866,7 @@ mod tests {#[test]fn a_failed_save_keeps_the_real_session_and_its_edit() {let scratch = Scratch::new("session");- let info = projects::create(&scratch.location(), "Closing", 1920, 1080, 30, 1, [0, 0, 0])+ let info = projects::create(&scratch.location(), "Closing", 1920, 1080, 30, 1, [0, 0, 0, 255]).expect("creates the project");let manifest = projects::manifest_path(Path::new(&info.path));@@ -2942,7 +2944,7 @@ mod tests {#[test]fn a_delayed_autosave_cannot_replace_the_close_snapshot() {let scratch = Scratch::new("ordered-close");- let info = projects::create(&scratch.location(), "Ordered", 1920, 1080, 30, 1, [0, 0, 0])+ let info = projects::create(&scratch.location(), "Ordered", 1920, 1080, 30, 1, [0, 0, 0, 255]).expect("creates the project");let mut session = Session::open_info(&info).expect("opens the session");let (old_path, old_document) = session.prepare_save(None);diff --git a/src/crates/concat/src/panes/project.rs b/src/crates/concat/src/panes/project.rsindex bbd9aa09..a5bc930c 100644--- a/src/crates/concat/src/panes/project.rs+++ b/src/crates/concat/src/panes/project.rs@@ -25,8 +25,8 @@ pub enum ProjectMsg {CustomFps(f32),/// A row of the colour list: SDR, HDR HLG, HDR PQ.ColorSpaceChanged(i32),- /// What shows where no picture covers the frame, `[r, g, b]` (#456).- CanvasChanged([u8; 3]),+ /// What shows where no picture covers the frame, `[r, g, b, a]` (#456).+ CanvasChanged([u8; 4]),Apply,}@@ -46,7 +46,7 @@ pub struct ProjectPane {/// What the timeline is output in.pub color_space: ColorSpace,/// What shows where no picture covers the frame.- pub canvas: [u8; 3],+ pub canvas: [u8; 4],}/// The colour list's rows, in the sheet's order.@@ -184,7 +184,7 @@ impl ProjectPane {.iter().position(|space| *space == self.color_space).unwrap_or(0) as i32,- canvas: slint::Color::from_rgb_u8(self.canvas[0], self.canvas[1], self.canvas[2]),+ canvas: slint::Color::from_argb_u8(self.canvas[3], self.canvas[0], self.canvas[1], self.canvas[2]),}}}diff --git a/src/crates/concat/src/panes/start.rs b/src/crates/concat/src/panes/start.rsindex c293ccaf..13cc849c 100644--- a/src/crates/concat/src/panes/start.rs+++ b/src/crates/concat/src/panes/start.rs@@ -34,8 +34,8 @@ pub enum StartMsg {CustomWidth(f32),CustomHeight(f32),CustomFps(f32),- /// What shows where no picture covers the frame, `[r, g, b]`.- CanvasChanged([u8; 3]),+ /// What shows where no picture covers the frame, `[r, g, b, a]`.+ CanvasChanged([u8; 4]),DismissError,/// Pick where the project folder goes.Browse,@@ -138,7 +138,7 @@ pub struct StartPane {pub custom_rate: (i64, i64),/// What shows where no picture covers the frame (#456): black, as/// every project before it had.- pub canvas: [u8; 3],+ pub canvas: [u8; 4],pub busy: bool,pub error: String,/// The projects' search, as typed; empty shows them all.@@ -164,7 +164,7 @@ impl Default for StartPane {rate: 3,custom_size: (1920, 1080),custom_rate: (30, 1),- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],busy: false,error: String::new(),query: String::new(),@@ -525,7 +525,7 @@ impl StartPane {size: self.size as i32,rate: self.rate as i32,size_readout: format!("{width} x {height}").into(),- canvas: slint::Color::from_rgb_u8(self.canvas[0], self.canvas[1], self.canvas[2]),+ canvas: slint::Color::from_argb_u8(self.canvas[3], self.canvas[0], self.canvas[1], self.canvas[2]),custom_width: width as f32,custom_height: height as f32,custom_fps: fps_of(num, den) as f32,@@ -596,7 +596,7 @@ mod tests {fn the_projects_search_and_sort() {let recent = |name: &str, path: &str| projects::Recent {info: projects::ProjectInfo {- canvas: [0, 0, 0],+ canvas: [0, 0, 0, 255],path: path.into(),name: name.into(),width: 1920,diff --git a/src/crates/concat/src/studio.rs b/src/crates/concat/src/studio.rsindex e714b7a7..c0daed1d 100644--- a/src/crates/concat/src/studio.rs+++ b/src/crates/concat/src/studio.rs@@ -9590,6 +9590,7 @@ impl Studio {.as_ref().filter(|source| source.kind != model::MediaKind::Audio);editor.set_has_picture(source.is_some() || showing.is_some());+ editor.set_see_through(self.project().active().video.canvas[3] < 255);editor.set_preview_clip_name(source.map(|source| source.name.as_str())diff --git a/src/crates/concat/ui/assets/checker.png b/src/crates/concat/ui/assets/checker.pngnew file mode 100644index 00000000..cb4b244cBinary files /dev/null and b/src/crates/concat/ui/assets/checker.png differdiff --git a/src/crates/concat/ui/dialogs/canvas-picker.slint b/src/crates/concat/ui/dialogs/canvas-picker.slintnew file mode 100644index 00000000..384239f5--- /dev/null+++ b/src/crates/concat/ui/dialogs/canvas-picker.slint@@ -0,0 +1,93 @@+// SPDX-License-Identifier: AGPL-3.0-or-later+// SPDX-FileCopyrightText: 2026 Jareer Abdullah and Concat contributors++import { I18n } from "../i18n.slint";+import { Theme } from "../theme/theme.slint";+import { Tip } from "../primitives/tooltip.slint";+import { ColourField } from "../inspector/controls.slint";++// What shows where no picture covers the frame - the gaps, the space+// around a title (#456) - as the New Project screen and Project settings+// both pick it. Five at a press: black, white and the two keying colours,+// for a picture that is cut out later, and Transparent, for an overlay+// bound for another editor or a stream; any other colour typed or picked+// on the right. A colour typed or picked is opaque: only Transparent lets+// the frame show through.+//+// Transparent is a checker, as every editor draws it, and says under the+// row what keeps it: an export that drops alpha gets black there.++export component CanvasPicker inherits VerticalLayout {+ in property <color> value;+ in property <bool> enabled: true;++ callback changed(value: color);++ property <bool> see-through: root.value.to-hsv().alpha < 1;++ spacing: 6px;++ HorizontalLayout {+ spacing: 8px;++ for preset in [#000000, #ffffff, #00b140, #0047bb, #00000000]: VerticalLayout {+ alignment: center;++ Rectangle {+ width: 24px;+ height: 24px;+ border-radius: Theme.r-sm;+ clip: true;+ border-width: root.value == preset ? 2px : 1px;+ border-color: root.value == preset ? Theme.accent+ : pick.has-hover ? Theme.line-strong : Theme.line;+ background: preset;++ if preset.to-hsv().alpha < 1: Rectangle {+ x: 1px;+ y: 1px;+ width: parent.width - 2px;+ height: parent.height - 2px;+ border-radius: Theme.r-sm - 1px;+ clip: true;++ for cell in 16: Rectangle {+ x: Math.floor(cell / 4) * 6px;+ y: Math.mod(cell, 4) * 6px;+ width: 6px;+ height: 6px;+ background: Math.mod(Math.floor(cell / 4) + Math.mod(cell, 4), 2) == 0 ? #c8c8c8 : #7a7a7a;+ }+ }++ pick := TouchArea {+ mouse-cursor: pointer;+ enabled: root.enabled;+ clicked => { root.changed(preset); }+ }++ if preset.to-hsv().alpha < 1: Tip {+ text: I18n.t("start.transparent");+ active: pick.has-hover;+ }+ }+ }++ Rectangle { horizontal-stretch: 1; }++ ColourField {+ horizontal-stretch: 0;+ padding-left: 0;+ padding-right: 0;+ value: root.value;+ changed(value) => { root.changed(value.with-alpha(1)); }+ }+ }++ if root.see-through: Text {+ text: I18n.t("start.transparentHint");+ color: Theme.fg-dim;+ font-size: Theme.fs-sm;+ wrap: word-wrap;+ }+}diff --git a/src/crates/concat/ui/dialogs/project.slint b/src/crates/concat/ui/dialogs/project.slintindex feeb447c..46cfeadd 100644--- a/src/crates/concat/ui/dialogs/project.slint+++ b/src/crates/concat/ui/dialogs/project.slint@@ -7,7 +7,7 @@ import { Glyph } from "../icons.slint";import { Button, DialogRow, DialogSection, Field, Modal } from "../primitives/modal.slint";import { Select } from "../primitives/select.slint";import { NumberField } from "../primitives/number-field.slint";-import { ColourField } from "../inspector/controls.slint";+import { CanvasPicker } from "canvas-picker.slint";// The project sheet: what the Details panel's Modify button opens.//@@ -192,12 +192,11 @@ export component ProjectDialog inherits Modal {}// What shows where no picture covers the frame: the gaps, the- // space around a title. The timeline's, like the frame above.+ // space around a title. The timeline's, like the frame above;+ // see CanvasPicker.DialogRow {label: I18n.t("start.background");- ColourField {- padding-left: 0;- padding-right: 0;+ CanvasPicker {value: root.data.canvas;changed(value) => { root.canvas-changed(value); }}diff --git a/src/crates/concat/ui/editor.slint b/src/crates/concat/ui/editor.slintindex 9e99c43d..a4638d0c 100644--- a/src/crates/concat/ui/editor.slint+++ b/src/crates/concat/ui/editor.slint@@ -251,6 +251,10 @@ export global Editor {/// The engine's composited frame at the playhead, or an empty image/// while one is on its way. Set from Rust; see `Studio::request_preview`.in-out property <image> preview-frame;+ /// The timeline's canvas lets something show through (#456): the+ /// monitor draws a checker under the frame, so what is clear reads as+ /// clear rather than as the stage's black.+ in-out property <bool> see-through;callback play-toggled();callback seek(seconds: float);diff --git a/src/crates/concat/ui/inspector/controls.slint b/src/crates/concat/ui/inspector/controls.slintindex 98c5011e..84bdacc8 100644--- a/src/crates/concat/ui/inspector/controls.slint+++ b/src/crates/concat/ui/inspector/controls.slint@@ -956,7 +956,7 @@ export component ColourField inherits HorizontalLayout {y: Math.mod(cell, 3) * 8px;width: 8px;height: 8px;- background: Math.mod(cell + Math.floor(cell / 3), 2) == 0 ? #c8c8c8 : #7a7a7a;+ background: Math.mod(Math.floor(cell / 3) + Math.mod(cell, 3), 2) == 0 ? #c8c8c8 : #7a7a7a;}}if !root.alpha: Rectangle { background: Theme.fg-dim; }diff --git a/src/crates/concat/ui/phone/editor.slint b/src/crates/concat/ui/phone/editor.slintindex 9e3c1fcf..f133f24e 100644--- a/src/crates/concat/ui/phone/editor.slint+++ b/src/crates/concat/ui/phone/editor.slint@@ -550,6 +550,7 @@ export component PhoneEditor inherits Rectangle {has-picture: Editor.has-picture;clip-name: Editor.preview-clip-name;frame: Editor.preview-frame;+ see-through: Editor.see-through;stage-items: Editor.stage-items;stage-guides: Editor.stage-guides;stroke-path: Editor.stroke-path;diff --git a/src/crates/concat/ui/start.slint b/src/crates/concat/ui/start.slintindex b6b81c5a..5bbdabf4 100644--- a/src/crates/concat/ui/start.slint+++ b/src/crates/concat/ui/start.slint@@ -11,7 +11,7 @@ import { Tip } from "primitives/tooltip.slint";import { Focus } from "util.slint";import { NumberField } from "primitives/number-field.slint";import { Select } from "primitives/select.slint";-import { ColourField } from "inspector/controls.slint";+import { CanvasPicker } from "dialogs/canvas-picker.slint";import { SegmentedControl } from "primitives/segmented-control.slint";// The launch screen: the app's home, and the window's own ground under all@@ -2451,48 +2451,16 @@ export component NewProjectDialog inherits Modal {}}- // What shows where no picture covers the frame - the gaps, the- // space around a title. Four to pick at a press - black, white and- // the two keying colours, for a picture that is cut out later - and- // any other typed or picked on the right. Transparent comes with- // an export that keeps it (#456).+ // What shows where no picture covers the frame; see CanvasPicker.FormRow {label: I18n.upper("start.background");last: true;stacked: root.narrow;- HorizontalLayout {- spacing: 8px;-- for preset in [#000000, #ffffff, #00b140, #0047bb]: VerticalLayout {- alignment: center;-- Rectangle {- width: 24px;- height: 24px;- border-radius: Theme.r-sm;- border-width: root.data.canvas == preset ? 2px : 1px;- border-color: root.data.canvas == preset ? Theme.accent- : pick.has-hover ? Theme.line-strong : Theme.line;- background: preset;-- pick := TouchArea {- mouse-cursor: pointer;- enabled: !root.data.busy;- clicked => { root.canvas-changed(preset); }- }- }- }-- Rectangle { horizontal-stretch: 1; }-- ColourField {- horizontal-stretch: 0;- padding-left: 0;- padding-right: 0;- value: root.data.canvas;- changed(value) => { root.canvas-changed(value); }- }+ CanvasPicker {+ value: root.data.canvas;+ enabled: !root.data.busy;+ changed(value) => { root.canvas-changed(value); }}}diff --git a/src/crates/concat/ui/workspace/preview-pane.slint b/src/crates/concat/ui/workspace/preview-pane.slintindex 927c690f..ed13b89a 100644--- a/src/crates/concat/ui/workspace/preview-pane.slint+++ b/src/crates/concat/ui/workspace/preview-pane.slint@@ -758,6 +758,8 @@ export component PreviewPane inherits Rectangle {callback source-closed();/// The decoded frame. Drawn fitted to the stage when there is one.in property <image> frame;+ /// The frame lets something show through; see `Editor.see-through`.+ in property <bool> see-through;/// Every picture under the playhead, for the selection drawn over the/// frame. See StageOverlay.in property <[StageItemData]> stage-items;@@ -1044,6 +1046,18 @@ export component PreviewPane inherits Rectangle {}}+ // Under a see-through frame, the checker every editor draws+ // where nothing covers it: one tile, repeated.+ if root.see-through && root.has-picture: Image {+ x: 0;+ y: 0;+ width: parent.width;+ height: parent.height;+ source: @image-url("../assets/checker.png");+ horizontal-tiling: repeat;+ vertical-tiling: repeat;+ }+// The engine's frame, when one has arrived. It is already// the stage's shape, so `contain` only absorbs a rounding// pixel either way.diff --git a/src/crates/concat/ui/workspace/seat.slint b/src/crates/concat/ui/workspace/seat.slintindex fcdb54da..7f140a53 100644--- a/src/crates/concat/ui/workspace/seat.slint+++ b/src/crates/concat/ui/workspace/seat.slint@@ -181,6 +181,7 @@ export component Seat inherits Rectangle {has-picture: Editor.has-picture;clip-name: Editor.preview-clip-name;frame: Editor.preview-frame;+ see-through: Editor.see-through && !SourcePreview.open;stage-items: SourcePreview.open ? [] : Editor.stage-items;stage-guides: Editor.stage-guides;stroke-path: Editor.stroke-path;