From 76e39eac8cee2175ec62a191f7c91ca53857e80c Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Fri, 5 Mar 2021 18:07:48 -0500 Subject: more raleigh, including button and vbox widgets --- src/user/libfont/fonts.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/user/libfont') diff --git a/src/user/libfont/fonts.c b/src/user/libfont/fonts.c index 51e127b..d63a5d9 100644 --- a/src/user/libfont/fonts.c +++ b/src/user/libfont/fonts.c @@ -58,11 +58,17 @@ struct font_info *get_font(const char *name) { //pitch is in pixels void put_char(const struct font_info *font, char ch, _pixel_t *pb_ptr, uint32_t pb_pitch, _pixel_t bg, _pixel_t fg) { -//char *const msg = format("put_char(font = 0x%x, ch = '%c', pb_ptr = 0x%x, pb_pitch = %u, bg = 0x%2x, fg = 0x%2x);", font, ch, pb_ptr, pb_pitch, bg, fg); -//_system_log(msg); -//free_block(msg); const bool *const bitmap = font->bitmaps[(uint8_t)ch] ? font->bitmaps[(uint8_t)ch] : font->bitmaps[0]; for (uint32_t y = 0; y < font->char_height; ++y) for (uint32_t x = 0; x < font->char_width; ++x) pb_ptr[y * pb_pitch + x] = bitmap[y * font->char_width + x] ? fg : bg; +} + +//pitch is in pixels +void put_char_no_bg(const struct font_info *font, char ch, _pixel_t *pb_ptr, uint32_t pb_pitch, _pixel_t fg) { + const bool *const bitmap = font->bitmaps[(uint8_t)ch] ? font->bitmaps[(uint8_t)ch] : font->bitmaps[0]; + for (uint32_t y = 0; y < font->char_height; ++y) + for (uint32_t x = 0; x < font->char_width; ++x) + if (bitmap[y * font->char_width + x]) + pb_ptr[y * pb_pitch + x] = fg; } \ No newline at end of file -- cgit v1.2.3