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

Text does not have transparency in tiny_skia renderer #2245

Closed
2 tasks done
Koranir opened this issue Feb 10, 2024 · 0 comments
Closed
2 tasks done

Text does not have transparency in tiny_skia renderer #2245

Koranir opened this issue Feb 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Koranir
Copy link
Contributor

Koranir commented Feb 10, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Is this issue related to iced?

  • My hardware is compatible and my graphics drivers are up-to-date.

What happened?

When rendering text using the tiny_skia renderer, the alpha channel is not respected.

When the text is rasterized and cached, it ignores the alpha component (which is quite reasonable, as it makes it so that if the alpha component changes slightly it does not have to be re-rasterized), but the alpha component is not added back later.
This is because the default blending:

&tiny_skia::PixmapPaint::default(),

Has a full 100% transparency.
The fix is simple enough, as the color is already available at:
color: Color,

Which could then be substituted into the blending with a:

&PixmapPaint {
    opacity: color.a,
    ..Default::default()
}

(the blend mode might have to be changed as well)

Note: I haven't checked whether the individual glyph's option color (glyph.color_opt from run.glyphs) has an alpha value and should multiply with the original alpha.

What is the expected behavior?

The text should be rendered with transparency.

Version

master

Operating System

Linux

Do you have any log output?

No response

@Koranir Koranir added the bug Something isn't working label Feb 10, 2024
@Koranir Koranir closed this as completed Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant