Skip to main content

alpha_mode_is_translucent

Function alpha_mode_is_translucent 

Source
pub fn alpha_mode_is_translucent(mode: CompositeAlphaMode) -> bool
Expand description

Whether a resolved wgpu::CompositeAlphaMode actually composites the surface’s alpha against what is behind it — i.e. whether the surface really came up translucent, as opposed to what the caller requested.

This is the truth behind ConfiguredSurface::resolved_translucent: resolve_alpha_mode can silently degrade a SurfaceAlphaRequest::TranslucentPreferred to Auto when the platform advertises no translucent mode, and a shell that kept keying its paint contract off the request would then clear to transparent and punch its native-view slots against an OPAQUE swapchain — presenting black rectangles.

The three translucent modes are exactly resolve_alpha_mode’s preference list — Inherit (Android), PostMultiplied (iOS), PreMultiplied; Opaque/Auto ignore the surface’s alpha entirely and are therefore not translucent (Auto is what every opaque caller and every fallback resolves to).