Open
Description
Summary
Have several questions about color blending in gpui.
Description
- Put transparent rectagles together, and the blended color is strange.
impl Render for Test {
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
div()
.h_full()
.w_full()
.bg(rgba(0xE0E0E0FF))
.flex()
.child(
div()
.bg(gpui::red().alpha(0.5))
.h(px(100.0))
.w(px(100.0))
.flex()
.child(
div()
.bg(gpui::blue().alpha(0.5))
.h(px(50.0))
.w(px(50.0))
.m(px(25.0))
)
)
}
}
- Rgba::blend seems neither an simple alpha blend nor an premultiplied simple alpha blend. I think at least alpha of the both colors will contribute to the composited alpha channel.
Lines 61 to 74 in 61abfd5
Expected Behavior:
Blend in figma, the same as examples from w3c compositing and blending
Actual Behavior:
The color of the red and purple part are both different from the examples
Zed Version and System Specs
gpui latest from git
Metadata
Metadata
Assignees
Labels
No labels