Add link to helpful article in font alpha TODO

This commit is contained in:
Emil Ernerfeldt 2024-11-06 13:33:43 +01:00
parent 5d6a58b917
commit fc743d63b4
1 changed files with 3 additions and 1 deletions

View File

@ -301,7 +301,9 @@ impl FontImage {
/// If you are having problems with text looking skinny and pixelated, try using a low gamma, e.g. `0.4`.
#[inline]
pub fn srgba_pixels(&self, gamma: Option<f32>) -> impl ExactSizeIterator<Item = Color32> + '_ {
let gamma = gamma.unwrap_or(0.55); // TODO(emilk): this default coverage gamma is a magic constant, chosen by eye. I don't even know why we need it.
// TODO(emilk): this default coverage gamma is a magic constant, chosen by eye. I don't even know why we need it.
// Maybe we need to implement the ideas in https://hikogui.org/2022/10/24/the-trouble-with-anti-aliasing.html
let gamma = gamma.unwrap_or(0.55);
self.pixels.iter().map(move |coverage| {
let alpha = coverage.powf(gamma);
// We want to multiply with `vec4(alpha)` in the fragment shader: