harrisonturton / wasm-ui

🖼 Proof-of-concept GUI rendering engine for WebGL and Rust
13 stars 2 forks source link

Transparent colors are not rendered with transparency #5

Open harrisonturton opened 2 years ago

harrisonturton commented 2 years ago

Currently, transparent colors like this:

Color::green().alpha(0.5)

Results in a lighter shade of green. When two widgets are drawn on top of each other, the topmost widget just covers the bottom one with its own color, rather than mixing the two.

The browser rendering engine currently doesn't have a compositing step, it's a very basic immediate-mode renderer that just naively paints the LayoutBox geometry. I think fixing this would require introducing some more logic around layers.

harrisonturton commented 2 years ago

Found a related bug.

When a child of a Flex widget has a Material::Solid(Color::transparent()), it renders as a white box, rather than as the color underline the child widget.