Skip to content

Commit

Permalink
Update text.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Koranir committed Feb 13, 2024
1 parent 52e207b commit 1bc7e48
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tiny_skia/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
);
Expand Down

0 comments on commit 1bc7e48

Please sign in to comment.