ruffle-rs / ruffle

A Flash Player emulator written in Rust
https://ruffle.rs
Other
15.19k stars 784 forks source link

Transparency In Windows #16882

Open sombraguerrero opened 1 month ago

sombraguerrero commented 1 month ago

Discussed in https://github.com/ruffle-rs/ruffle/discussions/16869

Originally posted by **gelatinguy** June 24, 2024 Hi, I love Ruffle! Does it currently have support for Windows transparency? Using the official Flash Player years ago, I was able to capture a window using Xsplit, which is a streaming software. Xsplit could capture the window with transparency, meaning if there wasn't art for the background, it would show only the graphics in Flash, and the background would be transparent, so I could see other elements in Xsplit, on layers lower than the Flash Player window capture. Xsplit eventually deprecated the transparency in Flash, possibly due to how Windows 10 changed how transparency is reported. This is similar to how old HTML documents would set the wmode to transparent, and if the SWF didn't have art for a background, it would show the webpage's background behind the SWF file. I now use OBS (free streaming software). It has a "Game Capture," which can capture Ruffle just fine. It has an "Allow Transparency" option, which for some Windows programs that support it, can show the background as transparent (e.g Stream Avatars). I would like to use OBS to capture a window and have the artwork show, but the background be transparent. It is a feature of the old Flash Player, but I believe it needs a modern implementation to work in Windows 11, which is what I use. If you need, I can supply a simple SWF for you to test, but it would be as simple as a radial gradient circle on one layer, and that's it. The background would have to show behind it smoothly, rather than whatever the Stage's background is set to. Thanks for your time, gel, from Discord
gelatinguy commented 4 weeks ago

Oh, thanks for putting this here. Let me know if you need more info.

Croworbit commented 3 weeks ago

is there any way you can make an example swf and show what you expect vs current ruffle behavior? @gelatinguy

gelatinguy commented 3 weeks ago

@Croworbit Below is the sample SWF in Ruffle. The background looks black, but in Flash, it has no art for a background. It's just the Stage set to black. Ruffle sample Ruffle player

Next is a mock up of what it would look like in OBS if Ruffle was reporting transparency like Flash Player used to, to Windows. OBS's Game Capture has a checkbox that says "Allow Transparency" Checkbox in OBS' Game Capture Properties

Ruffle mock up in OBS on a checkered BG

Flash Player used to report transparency a certain way to Windows, but I think it was Windows 10 that introduced a new way to report transparency, and the old way was deprecated and no longer supported. Ruffle needs to report the modern way, and all programs in Windows that can read this setting can take advantage of it. Sorry, I don't know the technical parameters of what Windows or OBS are looking for.

sodscg commented 1 week ago

see also https://github.com/ruffle-rs/ruffle/issues/13718