add bitmap drawing

This commit is contained in:
Adolfo Reyna
2026-01-13 21:47:03 -05:00
parent 5e0fe7c6d9
commit 28310a4eb5
5 changed files with 972 additions and 2 deletions

View File

@@ -419,6 +419,24 @@ void LowLevelRenderer::draw_arc(int center_x, int center_y, int radius, int star
}
}
void LowLevelRenderer::draw_bitmap(const unsigned char* bitmap, int x, int y, int width, int height, bool invert)
{
for (int py = 0; py < height; ++py) {
for (int px = 0; px < width; ++px) {
int bit_index = py * width + px;
int byte_index = bit_index / 8;
int bit_offset = 7 - (bit_index % 8); // MSB first
bool pixel_on = (bitmap[byte_index] & (1 << bit_offset)) != 0;
if (invert) {
pixel_on = !pixel_on;
}
if (pixel_on) {
set_pixel(x + px, y + py, true);
}
}
}
}
void LowLevelRenderer::draw_circle(int x, int y, int radius, bool on)
{
int x_pos = radius;