Repository navigation
renderText: the outline doesn't show through translucent text - #77
Merged
Merged
Conversation
The stroke covers the glyphs as well (it's a distance field from them), and was drawn under them with one minus the fill's alpha: with a translucent text color it showed through. It's now masked by the glyphs' coverage (text and color glyphs), which is the same for opaque text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YJgRK5qpwJEbHPuFv6kgAQ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the outline of
Image.renderText(strokeWidth): it showed through translucent text, so a 50%-alpha black text color with an orange stroke came out brown inside the letters, and the emoji came out tinted orange.Cause
The stroke is a distance field around the glyphs, so it also covers the glyphs themselves. It was drawn underneath them weighted by one minus the fill's alpha, so with a translucent text color it showed through.
Fix
The stroke is now weighted by one minus the glyphs' coverage (text and color glyphs) instead of the fill's alpha.
effects,options,regressions) pass unchanged.Test
tests/regressions.jschecks that pixels fully covered by translucent text keep exactly the text color when a stroke is added. The test fails on master (483 of 483 pixels tinted) and passes here.🤖 Generated with Claude Code
https://claude.ai/code/session_01YJgRK5qpwJEbHPuFv6kgAQ