add bitmap drawing
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user