Skip to content

Conversation

var4yn
Copy link

@var4yn var4yn commented Jul 26, 2025

FIx draw text with alpha.

The previous version of the function added a white outline to the text. When attempting to render semi-transparent text (e.g., using alpha = 125), the text ended up cutting out the background instead of blending with it.

See the examples below:
— The top label is rendered using the old function.
— The bottom label shows the result after my changes.

output_alpha_225_in_text
  • rgb alpha 255 text

Frame 10
  • rgb alpha 125 text ( old function cuts the image )

output_luma_alpha_225_in_text
  • luma alpha 225 text

output_luma_alpha_125_in_text
  • luma alpha 125 text

Suggestions:

To compute a has_alpha: bool flag, I based my logic on this.
It may be useful to expose this logic via Pixel::has_alpha() method inside the image crate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant