I am in the process of writting a bunch of applications for my desktop environment. The plan is to have, at a minimum:
Obviously I am aware the terminal will probably take very long, but I plan on working on it little by little over a long time. These applications are not meant for anything other than my own personal use, but if you would like to accompany their development, just have a look at this repository.
In any case, all the above applications require text rendering, which is in itself a big can of worms. We will ignore all of that and instead focus only on the final step: alpha blending the glyph's grayscale bytemap onto a background.
Alpha blending two 8bit values using an 8bit alpha channel can be done like so:
fn alpha_blend_with_float(dst: &mut u8, src: u8, alpha: u8) {
// put alpha in 0..1.0 range
let a = alpha as f32 / 255.0;
// get the complement
let ac = 1.0 - a;
// multiply each component by how much they should
// "contribute" to the final value
*dst = ((*dst as f32 * ac) + (src as f32 * a)).round() as u8;
}