iced-rs / iced

A cross-platform GUI library for Rust, inspired by Elm
https://iced.rs
MIT License
23.3k stars 1.07k forks source link

Container shadows are inconsistent between `wgpu` and `tiny-skia` with custom theme #2339

Open mtkennerly opened 3 months ago

mtkennerly commented 3 months ago

Is there an existing issue for this?

Is this issue related to iced?

What happened?

I have a custom theme where the Container appearance includes:

            shadow: Shadow {
                color: Color::BLACK,
                offset: Vector::ZERO,
                blur_radius: 0.0,
            }

With wgpu, there is no visible shadow. With tiny-skia, black fills whole container.

I can work around it by using Color::TRANSPARENT.

Gist (using red shadow for illustration purposes): https://gist.github.com/mtkennerly/993c3fbdd7ea770c0c28d268cf063664

ICED_BACKEND=wgpu cargo run

Screenshot 2024-03-18 234327

ICED_BACKEND=tiny-skia cargo run

Screenshot 2024-03-18 234342

What is the expected behavior?

The wgpu and tiny-skia examples should look the same.

Version

crates.io release

Operating System

Windows

Do you have any log output?

No response

njust commented 3 months ago

Hi, I have the same Issue, but wanted to add, that for buttons shadows work fine also with the tiny-skia backend:

Wgpu backend image

Tiny-skia backend image

What do you mean by "can work around it by using Color::TRANSPARENT."? Using Color::TRANSPARENT for the shadow effectively means no visible shadow. So the workaround for the tiny-skia backend is not using shadows at all?

mtkennerly commented 3 months ago

So the workaround for the tiny-skia backend is not using shadows at all?

My use case is without any shadows, but yeah, that doesn't help if you actually want them 😅