openframeworks / openframeworks/openFrameworks
Font color cast at border due to alpha blending (TTF, AA, no border)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
ofDisableAlphaBlending() does not have effect on font.drawString(..)
When AA is enabled, the font has a smooth border, and it is blended with the background. At the border of the font, some color from the background is mixed with font color.
The problem appears when we do not want to get color from the background mixed with font color, as the text image will be further blended with other images. Alpha blending should be disabled when the font is drawn. But the font edge looks the same, with a color cast from background at the border, regardless if alpha blending is enabled or not.
Setup:
loadFont is called with default params except for font path and size. (border is false)
Image has 4 channels. Background can be set to black (0,0,0,0). Disable alpha blending. font color is (255, 127, 0, 255)
In this case, the issue is that a blackish border appear around the font. (colors like (100, 50, 0, 40) I would expect that at border, font color is maintained, only alpha is changed. (255, 127, 0, 40) or similar.
To reproduce it, just save the image as png, and open it with an image viewer that has a different background than the one set in the OF before drawing the font. Maybe try several color for bgnd in OF, so that the color cast is obvious.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the font.drawString(..) path and reproduce the issue with AA enabled, no border, a four-channel image, and alpha blending disabled. Save the result as PNG and compare the font edge against different viewer backgrounds; done means the edge retains the font color while only its alpha changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100