Support Configurable Composite Alpha Modes, Transparency, & Renderer Options - #71
Merged
Conversation
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
different place
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
force-pushed
the
transparent-windows
branch
from
July 24, 2026 00:38
2dc6dd6 to
1c8983c
Compare
Signed-off-by: Nico Burns <nico@nicoburns.com>
This was referenced Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 toOpaque), 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
softbufferdoes 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-nativeto use struct updates orDefault::default()when constructing renderer options to accommodate the#[non_exhaustive]attribute.Key Changes
1. Transparency & Alpha Compositing Control
composite_alpha_modeoption to vello'swindow_renderer.rsand vello-hybrid'swindow_renderer.rs. This controls the surface compositing behavior of the WGPU surface inside the respective window renderers.PixelsRendererOptionsstruct insidelib.rsto customize thebase_colorandcomposite_alpha_modeusing thePixelsBuilderAPI.SkiaRendererOptionsinsidewindow_renderer.rsto customize thebase_coloronly as Skia handles transparency by default.Color::TRANSPARENTinimage_renderer.rsby default to preserve alpha channels in rendered outputs.2. Extensibility & Future Proofing
window_renderer.rsand vello-hybrid'swindow_renderer.rsas#[non_exhaustive]to allow adding more configuration fields in the future without breaking user builds.3. Crate-specific Options & Structs
anyrender_vello_cpu: ExportedVelloCpuRendererOptionsas an alias forPixelsRendererOptions.anyrender_skia: ExportedSkiaRasterRendererOptionsas an alias forPixelsRendererOptions.Breaking Changes
VelloRendererOptionsandVelloHybridRendererOptionsare now#[non_exhaustive]. Constructing these structs directly without usingDefault::default()or struct update syntax will cause compilation errors.Devin Review