Skip to main content

declare_host_translucent_surface

Function declare_host_translucent_surface 

Source
pub fn declare_host_translucent_surface()
Expand description

Declare that the native host window has already been configured translucent (PixelFormat.TRANSLUCENT/isOpaque = false) so this shell’s next GPU surface should be created with an alpha channel too.

Called only by the generated host glue (jni_glue::native_set_surface_mode on Android, ffi_glue::set_surface_mode on iOS), from the same branch that actually configured the window — see the module docs’ Callers section. Calling this without that window configuration in place is a host-template bug, not a supported app-Rust opt-in.

Callable from any thread (see the module docs’ Layering and thread contract), and idempotent — calling it more than once, or after the surface already latched translucent, has no additional effect.

Must be called before the running shell’s surface-creation path reads SurfaceModeWatcher::current (see the module docs) — calling it after the surface already exists has no effect on that surface.

Declaring translucency does not guarantee the resolved outcome: the platform may refuse (see the module docs’ This latch is a HOST DECLARATION, not the outcome), in which case the app degrades to the opaque Mode A contract.