Skip to content

Fix transparency and compositing order in immediate mode rendering - #1297

Merged
Huevos merged 3 commits into
OpenViX:Developerfrom
DimitarCC:screen-alphablend-fix
Aug 19, 2026
Merged

Fix transparency and compositing order in immediate mode rendering#1297
Huevos merged 3 commits into
OpenViX:Developerfrom
DimitarCC:screen-alphablend-fix

Conversation

@DimitarCC

Copy link
Copy Markdown
Contributor

This pull request refactors and improves the painting and compositing logic for root widgets and their children in the GUI system. The main focus is on ensuring correct compositing order, handling of transparency, alpha blending, gradients, and rounded corners, and improving clarity and maintainability. The changes also update method signatures and add documentation to clarify behavior.

Painting and compositing improvements:

  • Changed the root widget list (m_root) to always be sorted front-to-back in immediate mode and back-to-front in buffered mode, ensuring correct z-ordering and compositing. The insertion logic now uses <= to make sure newly added widgets with the same z-position appear on top.
  • Updated the painting routine in eWidgetDesktop::paint() to paint the background first and then root widgets back-to-front in immediate mode, ensuring that transparent, blended, or rounded widgets composite correctly on top of what is behind them.
  • Removed unnecessary pre-clearing of the drawing area for widgets with alpha blending, gradients, or rounded corners, so they blend against the actual content behind them as intended.

Clip region and visibility calculation:

  • Simplified calcWidgetClipRegion by removing the parent parameter and clarifying the logic for when a widget should subtract its region from the parent's visible region. Now, regions are only subtracted for fully opaque, non-gradient, non-alphablended, and non-rounded widgets. [1] [2] [3]

API and maintainability improvements:

  • Updated method signatures in eWidgetDesktop and eWindow to reflect the new logic and added documentation for clarity. Added setWidgetAlphaBlend to eWindow to ensure both the window and its child use the correct alpha blending setting. [1] [2] [3]

This commit addresses issues with how transparent, alpha-blended,
gradient-blended, and rounded-corner widgets (especially root widgets)
are composited in immediate rendering mode.

The background and any underlying widgets must be painted *before*
overlapping transparent elements to ensure correct blending.
Changes include:
- Modifying `calcWidgetClipRegion` to ensure areas under transparent widgets
  remain visible for underlying layers.
- Refactoring `paint()` to ensure the desktop background is painted first
  in immediate mode, and root widgets are iterated back-to-front for painting.
- Removing pre-clearing in `paintLayer` to allow blending against existing content.
- Adjusting `addRootWidget` to ensure widgets with identical z-positions
  are consistently stacked with the last-added on top.
- Ensuring `eWindow` also sets alpha blend on its child widget for visibility.
This commit addresses issues with how transparent, alpha-blended,
gradient-blended, and rounded-corner widgets (especially root widgets)
are composited in immediate rendering mode.

The background and any underlying widgets must be painted *before*
overlapping transparent elements to ensure correct blending.
Changes include:
- Modifying `calcWidgetClipRegion` to ensure areas under transparent widgets
  remain visible for underlying layers.
- Refactoring `paint()` to ensure the desktop background is painted first
  in immediate mode, and root widgets are iterated back-to-front for painting.
- Removing pre-clearing in `paintLayer` to allow blending against existing content.
- Adjusting `addRootWidget` to ensure widgets with identical z-positions
  are consistently stacked with the last-added on top.
- Ensuring `eWindow` also sets alpha blend on its child widget for visibility.
@Huevos
Huevos merged commit 15c3e9c into OpenViX:Developer Aug 19, 2026
1 check passed
@DimitarCC
DimitarCC deleted the screen-alphablend-fix branch August 19, 2026 15:02
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