Skip to content

Commit

Permalink
Fix transparency in ab_glyph renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
Friz64 committed Nov 19, 2023
1 parent 702a0da commit 9d9450a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/title/ab_glyph_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ impl AbGlyphTitleText {
let left = bounds.min.x as u32;
let top = bounds.min.y as u32;
outline.draw(|x, y, c| {
// `ab_glyph` may return values greater than 1.0, but they are defined to be
// same as 1.0. For our purposes, we need to contrain this value.
let c = c.min(1.0);

let p_idx = (top + y) * width + (left + x);
let old_alpha_u8 = pixels[p_idx as usize].alpha();
let new_alpha = c + (old_alpha_u8 as f32 / 255.0);
Expand Down

0 comments on commit 9d9450a

Please sign in to comment.