Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semi-transparent image blending problem #476

Open
0xd34d10cc opened this issue Aug 9, 2020 · 1 comment
Open

Semi-transparent image blending problem #476

0xd34d10cc opened this issue Aug 9, 2020 · 1 comment
Labels
bug Something isn't working image rendering

Comments

@0xd34d10cc
Copy link

I have a semi-transparent image and custom theme, but seems like the semi-transparent pixels still blend with white (default) color even when custom theme is active. Screenshot:
image
See "styling" example here: https://github.com/0xd34d10cc/iced/tree/image_edges
Is there a way to fix this?

@0xd34d10cc 0xd34d10cc changed the title Image styling options Semi-transparent image blending problem Aug 9, 2020
@hecrj hecrj added the bug Something isn't working label Aug 10, 2020
@hecrj
Copy link
Member

hecrj commented Aug 10, 2020

@0xd34d10cc Thanks for the report!

Here is how your image looks without its alpha channel:

image

iced_wgpu uses bilinear filtering for images by default which can cause artifacts when combined with transparent pixels like the ones in your image. There is a blog post—Beware of Transparent Pixels—that explains some of the details.

If we want to avoid this consistently, we should eventually store images with a premultiplied alpha. This should not be hard, but it's an operation that we should either defer to the GPU, as it consists in applying a transformation to every single pixel of the image, or run in a background worker once we introduce async support to our rendering pipeline.

In the meanwhile, you may be able to fix the issue by editing the image and extend the purple transparent pixels to completely surround the edges of the circle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working image rendering
Projects
None yet
Development

No branches or pull requests

2 participants