fix: text rendering did not work correctly with alpha#3934
Open
progweb wants to merge 1 commit intoAcademySoftwareFoundation:mainfrom
Open
fix: text rendering did not work correctly with alpha#3934progweb wants to merge 1 commit intoAcademySoftwareFoundation:mainfrom
progweb wants to merge 1 commit intoAcademySoftwareFoundation:mainfrom
Conversation
Contributor
Author
Contributor
Author
Signed-off-by: Nicolas VIVIEN <nicolas@vivien.fr>
lgritz
reviewed
Aug 11, 2023
| if (c == alpha_channel) | ||
| pixelcolor[c] = alpha + (1.0f - alpha) * pixelcolor[c]; | ||
| else | ||
| pixelcolor[c] = (val * alpha * textcolor[c]) + (1.0f - alpha) * pixelcolor[c]; |
Collaborator
There was a problem hiding this comment.
You may have noticed CI failures. Basically, every test with text in it is failing with this PR.
I think this line is the part that's responsible. Compared to the old code, you have an extra multiplication of the foreground color by alpha. I believe (but admit that I am not 100% sure) that it was correct before because freetype is supplying color results that are already scaled by the glyph's alpha coverage, so now you are doubly accounting for alpha coverage in the foreground.
Collaborator
|
@progweb Any comments on the last concerned I raised about the CI failure? |
Contributor
Author
|
Not available, I’ll fix this in few days for the next week. |
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.


As render text with shadow with channel alpha, I don't get the same result that without channel alpha.
Without channel alpha, shadow option permit to draw a dilated text in black, whereas with channel alpha, OIIO makes a gap...
Working with dev-2.2 branch, I can see the same issue on master branch.
In using this patch, shadow option works as expected on image with alpha buffer.
Ref: #3932
[Note]: OpenImageIO is used in the gpx2video project.