Draw colored glyphs in iced_tiny_skia
This commit is contained in:
parent
a9ee8f62fd
commit
9af0a27e67
1 changed files with 7 additions and 1 deletions
|
|
@ -188,7 +188,7 @@ fn draw(
|
|||
|
||||
if let Some((buffer, placement)) = glyph_cache.allocate(
|
||||
physical_glyph.cache_key,
|
||||
color,
|
||||
glyph.color_opt.map(from_color).unwrap_or(color),
|
||||
font_system,
|
||||
&mut swash,
|
||||
) {
|
||||
|
|
@ -213,6 +213,12 @@ fn draw(
|
|||
}
|
||||
}
|
||||
|
||||
fn from_color(color: cosmic_text::Color) -> Color {
|
||||
let [r, g, b, a] = color.as_rgba();
|
||||
|
||||
Color::from_rgba8(r, g, b, a as f32 / 255.0)
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
struct GlyphCache {
|
||||
entries: FxHashMap<
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue