[SOLVED] troubles with near-neighbor upscaling bitmap fonts
Posted: Fri Nov 27, 2020 10:27 pm
I have this code:
I originally believed this would simply upscale bicubic 2x for each pixel, but I'm getting visually buggy results.
This is the code for the message I am attempting to display:
This is the result:
Anyone know why this is? I've been stuck on this for a while and have made some progress, but the background coloring is killing me. It's not supposed to be there. I can't do without the upscaling because the text is too small and I have terrible vision...
Code: Select all
void Terminal::put_entry_at(char c, uint32_t color, size_t xpos, size_t ypos)
{
uint64_t font_selector = FONT[c];
uint8_t bits[64];
for (uint8_t i = 1; i <= 64; i++)
{
bits[i] = get_bit(font_selector, i);
}
// for (int i = 63; i >= 0; i--)
// {
// if ((i + 1) % 8 == 0)
// serial_msg('\n');
// serial_msg(new_bits[i] + 48); // 48, ASCII code '0'
// }
for (uint32_t y = 0, yy = (ypos * 16); y < 8; y++, yy += 2)
{
for (uint32_t x = 0, xx = (xpos * 16); x < 8; x++, xx += 2)
{
if (bits[(8 * y) + x])
plot_pixel(pos(xx, yy), color);
plot_pixel(pos(xx + 1, yy), color);
plot_pixel(pos(xx, yy + 1), color);
plot_pixel(pos(xx + 1, yy + 1), color);
}
}
}
This is the code for the message I am attempting to display:
Code: Select all
terminal.put_entry_at('H', 0x00FFFF, 0, 0);
terminal.put_entry_at('e', 0x00FFFF, 1, 0);
terminal.put_entry_at('l', 0x00FFFF, 2, 0);
terminal.put_entry_at('l', 0x00FFFF, 3, 0);
terminal.put_entry_at('o', 0x00FFFF, 4, 0);
terminal.put_entry_at(',', 0x00FFFF, 5, 0);
terminal.put_entry_at(' ', 0x00FFFF, 6, 0);
terminal.put_entry_at('w', 0x00FFFF, 7, 0);
terminal.put_entry_at('o', 0x00FFFF, 8, 0);
terminal.put_entry_at('r', 0x00FFFF, 9, 0);
terminal.put_entry_at('l', 0x00FFFF, 10, 0);
terminal.put_entry_at('d', 0x00FFFF, 11, 0);
terminal.put_entry_at('!', 0x00FFFF, 12, 0);