From 5a7878839660f2f03985f8819d2f84172de12662 Mon Sep 17 00:00:00 2001 From: Jonathan Johnson Date: Thu, 4 Jan 2024 16:09:58 -0800 Subject: [PATCH] Enabling animated transparent capture --- src/window.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/window.rs b/src/window.rs index 8756d44..b93a7dd 100644 --- a/src/window.rs +++ b/src/window.rs @@ -3425,7 +3425,11 @@ where self.recorder.window.size().width.get(), self.recorder.window.size().height.get(), ); - encoder.set_color(png::ColorType::Rgb); + encoder.set_color(if Format::HAS_ALPHA { + png::ColorType::Rgba + } else { + png::ColorType::Rgb + }); encoder.set_adaptive_filter(png::AdaptiveFilterType::Adaptive); encoder.set_animated(u32::try_from(frames.len()).assert("too many frames"), 0)?; encoder.set_compression(png::Compression::Best);