Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More intuitive color use for the draw_text function #123

Merged
merged 3 commits into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/framebuffer/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,16 @@ impl framebuffer::FramebufferDraw for core::Framebuffer {
}

glyph.draw(|x, y, v| {
let mult = (1.0 - v).min(1.0);
self.write_pixel(
Point2 {
x: (x + bounding_box.min.x as u32) as i32,
y: (y + bounding_box.min.y as u32) as i32,
},
color::RGB((c1 * mult) as u8, (c2 * mult) as u8, (c3 * mult) as u8),
color::RGB(
(255.0 + (c1 - 255.0) * v) as u8,
(255.0 + (c2 - 255.0) * v) as u8,
(255.0 + (c3 - 255.0) * v) as u8,
),
)
});
}
Expand Down
Loading