Fix text transparency in iced_tiny_skia

This commit is contained in:
Daniel Yoon 2024-02-14 09:03:25 +11:00 committed by Héctor Ramón Jiménez
parent 84cc9f130b
commit 7a572655c1
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -238,6 +238,12 @@ fn draw(
)
.expect("Create glyph pixel map");
let opacity = color.a
* glyph
.color_opt
.map(|c| c.a() as f32 / 255.0)
.unwrap_or(1.0);
pixels.draw_pixmap(
physical_glyph.x + placement.left,
physical_glyph.y - placement.top
@ -246,7 +252,10 @@ fn draw(
* transformation.scale_factor())
.round() as i32,
pixmap,
&tiny_skia::PixmapPaint::default(),
&tiny_skia::PixmapPaint {
opacity,
..tiny_skia::PixmapPaint::default()
},
tiny_skia::Transform::identity(),
clip_mask,
);