adding text color to the render class

This commit is contained in:
Adolfo Reyna
2026-01-13 23:02:54 -05:00
parent 28310a4eb5
commit cff4956829
2 changed files with 10 additions and 4 deletions

View File

@@ -18,12 +18,16 @@
LowLevelRenderer::LowLevelRenderer(uint8_t* buffer, int width, int height)
: bit_buffer(buffer), V_WIDTH(width), V_HEIGHT(height), current_font(&font_acme_5_outlines),
clipping_enabled(false), clip_x(0), clip_y(0), clip_width(width), clip_height(height) {}
clipping_enabled(false), clip_x(0), clip_y(0), clip_width(width), clip_height(height), text_color(true) {}
void LowLevelRenderer::set_font(const unsigned char (*font)[96][6]) {
current_font = font;
}
void LowLevelRenderer::set_text_color(bool color) {
text_color = color;
}
// Clipping functions
void LowLevelRenderer::set_clip_rect(int x, int y, int width, int height) {
clip_x = x;
@@ -431,7 +435,7 @@ void LowLevelRenderer::draw_bitmap(const unsigned char* bitmap, int x, int y, in
pixel_on = !pixel_on;
}
if (pixel_on) {
set_pixel(x + px, y + py, true);
set_pixel(x + px, y + py, text_color);
}
}
}
@@ -499,7 +503,7 @@ void LowLevelRenderer::draw_char_vcol(int x, int y, char c)
// Most of these 1-bit fonts use bit 0 as the top pixel
if (column_byte & (1 << row))
{
set_pixel(x + col, y + row, true);
set_pixel(x + col, y + row, text_color);
}
}
}
@@ -537,7 +541,7 @@ void LowLevelRenderer::draw_char_scaled(int x, int y, char c, int scale)
{
set_pixel(x + (col * scale) + sx,
y + (row * scale) + sy,
true);
text_color);
}
}
}

View File

@@ -35,6 +35,7 @@ private:
const unsigned char (*current_font)[96][6];
bool clipping_enabled;
int clip_x, clip_y, clip_width, clip_height;
bool text_color;
void draw_corner_arc(int center_x, int center_y, int radius, int quadrant, bool on);
void fill_bottom_flat_triangle(int x1, int y1, int x2, int y2, int x3, int y3, bool on);
void fill_top_flat_triangle(int x1, int y1, int x2, int y2, int x3, int y3, bool on);
@@ -45,6 +46,7 @@ public:
// Font management
void set_font(const unsigned char (*font)[96][6]);
void set_text_color(bool color);
// --- 1-BIT DRAWING PRIMITIVES ---
void set_pixel(int x, int y, bool on);