Skip to content

Support Configurable Composite Alpha Modes, Transparency, & Renderer Options - #71

Merged
nicoburns merged 42 commits into
mainfrom
transparent-windows
Jul 24, 2026
Merged

Support Configurable Composite Alpha Modes, Transparency, & Renderer Options#71
nicoburns merged 42 commits into
mainfrom
transparent-windows

Conversation

@nicoburns

@nicoburns nicoburns commented Jul 24, 2026

Copy link
Copy Markdown
Member

Re-open of #70

Summary

This pull request introduces the ability to configure composite alpha modes and base colors across various renderers. Previously, the composite alpha mode was hardcoded (e.g. to Auto, which often defaults to Opaque), making alpha-blending and transparency difficult or impossible.

We now expose configurable option structs and allow specifying the background/clear colors and composite alpha modes for Vello, Vello Hybrid, Skia, and Pixels (CPU) renderers. Additionally, we make key options structs future-proof by marking them as #[non_exhaustive].

Note

softbuffer does not support transparency natively (yet), so these alpha-compositing features will apply only to the GPU and Pixels-based paths.

A small adjustment will need to be made in dioxus-native to use struct updates or Default::default() when constructing renderer options to accommodate the #[non_exhaustive] attribute.

Key Changes

1. Transparency & Alpha Compositing Control

  • Vello Renderers: Added composite_alpha_mode option to vello's window_renderer.rs and vello-hybrid's window_renderer.rs. This controls the surface compositing behavior of the WGPU surface inside the respective window renderers.
  • Pixels CPU / Raster Renderers: Added configuration options via the PixelsRendererOptions struct inside lib.rs to customize the base_color and composite_alpha_mode using the PixelsBuilder API.
  • Skia Renderer: Added configuration options via the SkiaRendererOptions inside window_renderer.rs to customize the base_color only as Skia handles transparency by default.
  • Skia Raster Renderer: Clears the canvas with Color::TRANSPARENT in image_renderer.rs by default to preserve alpha channels in rendered outputs.

2. Extensibility & Future Proofing

  • Marked options in vello's window_renderer.rs and vello-hybrid's window_renderer.rs as #[non_exhaustive] to allow adding more configuration fields in the future without breaking user builds.

3. Crate-specific Options & Structs

  • anyrender_vello_cpu: Exported VelloCpuRendererOptions as an alias for PixelsRendererOptions.
  • anyrender_skia: Exported SkiaRasterRendererOptions as an alias for PixelsRendererOptions.

Breaking Changes

  • The configuration structs VelloRendererOptions and VelloHybridRendererOptions are now #[non_exhaustive]. Constructing these structs directly without using Default::default() or struct update syntax will cause compilation errors.

Devin Review

Status Commit
⚪ Not started

Run Devin Review

Open in Devin Review (Staging)

varappdev and others added 30 commits July 18, 2026 19:14
Done to allow adding of more fields in the future without breaking
builds.
Allows users of the crate to define the composite alpha mode rather than
have it hardcoded to Auto (which often is hardcoded to Opaque)
to allow more fields to be added in the future without breaking changes.
Skia handles transparency by default apparently. I checked.
to transparent

again Pixels needs to be informed of CompositeAlphaMode to actually do
transparency
Skia did not handle composite alpha by itself it was just hardcoded to true specifically on the opengl backend (and metal)
…nder_vello_hybrid

because vello_hybrid is hardcoded to fill in with transparency, just fill over that transparency with chosen colour to give users more choice.
OpenGL has no concept of opaque mode apparently so ask for 0 bits of transparency.
along with better fallback on PostMultiplied if PreMultiplied is not available for some reason
Signed-off-by: Nico Burns <nico@nicoburns.com>
@nicoburns
nicoburns force-pushed the transparent-windows branch from 2dc6dd6 to 1c8983c Compare July 24, 2026 00:38
Signed-off-by: Nico Burns <nico@nicoburns.com>
@nicoburns
nicoburns merged commit 6d5840c into main Jul 24, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants