move default splash into sdcard (#2595)

* move bmps to sdcard
* remove unrelated files
* gitignore
* credit
* format
This commit is contained in:
sommermorgentraum
2025-03-26 17:34:00 +08:00
committed by GitHub
parent 8a7aa9c0f8
commit 37cc35d3c6
10 changed files with 224 additions and 457 deletions
+3 -25
View File
@@ -36,34 +36,12 @@ Style Style::invert() const {
.foreground = background};
}
int Painter::draw_char(Point p, const Style& style, char c, uint8_t zoom_factor) {
int Painter::draw_char(Point p, const Style& style, char c, uint8_t zoom_level) {
const auto glyph = style.font.glyph(c);
if (zoom_factor <= 1) {
display.draw_glyph(p, glyph, style.foreground, style.background);
} else {
// dot to square
const uint8_t* pixels = glyph.pixels();
for (int y = 0; y < glyph.h(); y++) { // each line
for (int x = 0; x < glyph.w(); x++) { // each clum
// pos
int byte_index = (y * glyph.w() + x) / 8;
int bit_pos = (y * glyph.w() + x) % 8;
display.draw_glyph(p, glyph, style.foreground, style.background, zoom_level);
// fill
Color pixel_color = ((pixels[byte_index] & (1 << bit_pos)) != 0) ? style.foreground : style.background;
/* ^ true: fg, false: bg
^ the byte_index-th bit AKA current bit
^ current px in current byte */
display.fill_rectangle(
{p.x() + x * zoom_factor, p.y() + y * zoom_factor,
zoom_factor, zoom_factor},
pixel_color);
}
}
}
return glyph.advance().x() * zoom_factor;
return glyph.advance().x() * zoom_level;
}
int Painter::draw_string(Point p, const Style& style, std::string_view text) {