Portable window transparency: alpha mode? #3486
Labels
area: documentation
Documentation for crate items, public or private
help required
We need community help to make this happen.
type: enhancement
New feature or request
Continuing from #687, #2836: support for window transparency.
The status quo, as I understand it, is that an application window may use transparency by (1) enabling window transparency (e.g.
winit::window::WindowBuilder::with_transparent
) and (2) selecting aCompositeAlphaMode
other thanOpaque
.The problem
I may be wrong here, but the way I see it, WGPU is supposedly a medium-level portable graphics library.
CompositeAlphaMode
feels like a low-level control and is not portable (attempting to use any unsupported option is an error).CompositeAlphaMode
lists several options, of which only a subset are likely supported by the device/platform:Auto
: choosesOpaque
orInherit
Opaque
: ignore alpha channel. May not be supported?PreMultiplied
: expect non-alpha channels are pre-multiplied by alpha. May not be supported?PostMultiplied
: non-alpha channels are not pre-multiplied. May not be supported.Inherit
: platform-specific result. Refers to "native WSI command" without further details.Probing
Only a subset of the above are supported. This is described by
SurfaceCapabilities::alpha_modes
. Applications must select whichever of the supported modes is closest to their requirements.Conversion
It appears that applications wishing to support portable transparency must be prepared to output textures compliant with multiple of the above modes, and thus must be able to convert depending on the mode selected.
Suggested solutions
High-level API
One alternative is a high-level API, supporting only the following modes, and supporting them on all platforms (with automatic conversion where required):
Opaque
PreMultiplied
PostMultiplied
Better docs
Otherwise, please better document the following:
Inherit
The text was updated successfully, but these errors were encountered: