StageStyle.EXTENDED with transparent background
Christopher Schnick
crschnick at xpipe.io
Thu Nov 13 16:22:40 UTC 2025
Haha yeah I thought the MonkeyTester would make a good demo content page
for a sample application. And it does!
On 13/11/2025 17:20, Andy Goryachev wrote:
> What Kickstart FX? :-)
>
> Joking, joking, I am glad you found it helping.
>
> -andy
>
> *
>
> Confidential- Oracle Internal
>
> From: *openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of
> Christopher Schnick <crschnick at xpipe.io>
> *Date: *Thursday, November 13, 2025 at 06:27
> *To: *Michael Strauß <michaelstrau2 at gmail.com>
> *Cc: *OpenJFX <openjfx-dev at openjdk.org>
> *Subject: *Re: StageStyle.EXTENDED with transparent background
>
> We run our applications with native materials for some time now
> without any issues.
>
> On Windows 11, it uses the Mica material for the Stage. It
> automatically adjusts based on the system theme, so you will always
> have a good look and contrast for all theme configurations. The mica
> material can also be swtiched to the acrylic one, however the acrylic
> theme was primarily intended for Windows 10 and is being replaced by
> Mica for Windows 11.
>
> On macOS, it uses the new Liquid Glass material in macOS 26 and the
> Vibrant material for older versions. With Liquid Glass you can also
> configure the tint if needed.
>
> This can all be achieved via a few native calls with the existing
> Stages, at least with the older stage styles like Unified.
>
> Isn't the original issue just about the extended stage style using a
> white background? I'm no expert on the implementation, but the other
> types of Stages like Unified show their background if you set the
> Scene and root node background to be transparent. Normally that window
> fill was always white anyway as JavaFX did not support window theming
> before, but if the window theme is set to something different, then
> that sticks out. Is there something fundamentally limiting so that the
> Extended stage is forced to draw a white background?
>
> Unified:
>
> Extended, even with DWMWA_USE_IMMERSIVE_DARK_MODE set to true:
>
> On 13/11/2025 00:33, Michael Strauß wrote:
>
> I finally got around to looking into this. I see two requests
> here, one to add per-pixel window transparency to EXTENDED
> stages and another to support backdrop materials like Windows’
> Mica and Acrylic. On the Mac adding per-pixel transparency to
> all stage styles is easy. On Windows it would take a lot more
> work and as far as I know can’t be done with the existing DX9
> back end (the necessary DirectComposition API’s are tied to
> DX11). We would also need to reconcile platform differences
> related to hit testing and drop shadows. So it’s a big ask.
>
> I think we can probably get there by using a WS_EX_LAYERED window
> like we do for StageStyle.TRANSPARENT, if we accept the
> significant performance impact. With DirectComposition, we can
> directly interface with the DWM composition engine and skip the
> GDI window surface completely. This requires a fair bit of
> integration with JavaFX that goes beyond changes in the Glass
> toolkit. However, it doesn't require a D3D11 rendering pipeline.
> It works with the existing D3D9 pipeline by having D3D9 render
> into a shared off-screen surface, which is then accessed by
> DirectComposition with ID3D11Device::OpenSharedResource.
>
> (I know there’s a DX12 version of JavaFX in the works but it’s
> hard for me to get enthused. I run Windows in a VM and it’s
> likely to be stuck on DX11 for a long time.) Supporting
> translucent backdrop materials is simpler since we can ask the
> OS to draw the effect and then composite the JavaFX content
> over it all within an opaque window. This is how the UNIFIED
> stage style works so we can leverage that logic. On Mac this
> is easy to set up. On Windows 11 22H2 and beyond we can easily
> access a couple of materials. For earlier Windows versions or
> for a more extensive list of materials we would need to roll
> our own using DirectComposition.
>
> That's correct, it's reasonably simple to support
> platform-provided backdrop materials. Anything custom is a lot
> more difficult. I have a prototype of JavaFX with
> DirectComposition, along with a custom acrylic implementation.
> It's very old, and looks like this (running on Windows 10):
> https://github.com/user-attachments/assets/cd702a74-603a-4d7e-9078-52f915a4448a
> In the end, there doesn't seem to be much common ground between
> the various OS platforms for any reasonably powerful
> cross-platform API. Maybe we could have the supporting
> infrastructure in JavaFX, but only exposing API in a
> platform-specific module (either as part of OpenJFX or 3rd party)?
> This certainly requires quite a bit of work.
>
> I know nothing about DirectComposition but I’m pretty sure
> someone on this list has used it to prototype an Acrylic
> effect for JavaFX. I’ll see if I can find that e-mail. I’m
> particularly interested in whether this can easily be turned
> on and off on-the-fly and how dark mode would be handled (the
> platform-provided materials respond to dark mode).
>
> I've never heard of any previous effort, and it couldn't have been
> me beacuse I haven't talked about this up util now. I'd be
> interested to learn about other attempts at solving this.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20251113/041e849f/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aBRzaHD5w0KvUgrJ.png
Type: image/png
Size: 282963 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20251113/041e849f/aBRzaHD5w0KvUgrJ-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HRrOi0IB1NCsFlHW.png
Type: image/png
Size: 208285 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20251113/041e849f/HRrOi0IB1NCsFlHW-0001.png>
More information about the openjfx-dev
mailing list