This commit is contained in:
Isaac Mills 2024-10-11 12:01:17 -06:00
parent 0115197751
commit 487b7bbe3c
Signed by: fnmain
GPG key ID: B67D7410F33A0F61
2 changed files with 8 additions and 0 deletions

View file

@ -119,6 +119,8 @@ pub struct TextArea<'a> {
pub bounds: TextBounds, pub bounds: TextBounds,
/// The default color of the text area. /// The default color of the text area.
pub default_color: Color, pub default_color: Color,
/// The opacity of the text
pub opacity: f32,
/// Additional custom glyphs to render. /// Additional custom glyphs to render.
pub custom_glyphs: &'a [CustomGlyph], pub custom_glyphs: &'a [CustomGlyph],
} }

View file

@ -246,6 +246,12 @@ impl TextRenderer {
Some(some) => some, Some(some) => some,
None => text_area.default_color, None => text_area.default_color,
}; };
let color = Color::rgba(
(color.r() as f32 * text_area.opacity + 0.5) as u8,
(color.g() as f32 * text_area.opacity + 0.5) as u8,
(color.b() as f32 * text_area.opacity + 0.5) as u8,
(color.a() as f32 * text_area.opacity + 0.5) as u8,
);
if let Some(glyph_to_render) = prepare_glyph( if let Some(glyph_to_render) = prepare_glyph(
physical_glyph.x, physical_glyph.x,